Remove main execution block from Quasar model and add configuration files for testing
- Eliminated the main execution block from the Quasar model for cleaner code. - Introduced new configuration files `config_1.conf` and `config_2.conf` for Quasar devices, detailing interface settings and IP configurations. - Added expected output JSON files `config_1.expected.json` and `config_2.expected.json` to validate the parsing of Quasar configurations against expected results.
This commit is contained in:
@@ -21,17 +21,3 @@ class Quasar(BaseDevice):
|
|||||||
if ether_interface:
|
if ether_interface:
|
||||||
interfaces.append(ether_interface)
|
interfaces.append(ether_interface)
|
||||||
return interfaces
|
return interfaces
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
with open("./test7.txt") as file:
|
|
||||||
data = file.read()
|
|
||||||
quasar = Quasar(data)
|
|
||||||
qt = quasar.parse()
|
|
||||||
print(qt)
|
|
||||||
print()
|
|
||||||
with open("./test8.txt") as file:
|
|
||||||
data = file.read()
|
|
||||||
quasar = Quasar(data)
|
|
||||||
qt = quasar.parse()
|
|
||||||
print(qt)
|
|
||||||
|
|||||||
41
tests/fixtures/quasar/config_1.conf
vendored
Normal file
41
tests/fixtures/quasar/config_1.conf
vendored
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# Copyright © 2021-2022, TechArgos LLC
|
||||||
|
# ----------- -----------------
|
||||||
|
# Subsystem Version
|
||||||
|
# ----------- -----------------
|
||||||
|
# Engine 0.2.17.2022-10-21
|
||||||
|
# DPlane 0.2.18.2022-05-16
|
||||||
|
# BfMonitor 1.1.2.2022-08-25
|
||||||
|
# CLI.core 1.0.3.2022-09-30
|
||||||
|
# CLI.engine 1.2.2.2022-10-12
|
||||||
|
# RConsole 0.3.4.2022-01-12
|
||||||
|
# RcAppParams 0.3.1.2022-01-12
|
||||||
|
# SNMP 0.0.11.2022-04-26
|
||||||
|
# Zabbix 0.2.13.2022-01-26
|
||||||
|
# WebUI 1.1.3.2022-10-19
|
||||||
|
# BF.core 9.3.1.2021-01-30
|
||||||
|
#
|
||||||
|
# ------------------------- ---------------
|
||||||
|
# Platform EEPROM field Value
|
||||||
|
# ------------------------- ---------------
|
||||||
|
# Product Name Quasar-T-Q-0002
|
||||||
|
# Product Number HB4NC011234M
|
||||||
|
# Local MAC N/A
|
||||||
|
# Product Serial Number WEE1C1CC0004A
|
||||||
|
# Product Version 0.0
|
||||||
|
# System Manufacturing Date 2026-06-07
|
||||||
|
config ethernet ipv4 address 25.25.1.221/24 gateway 25.25.1.254 enable
|
||||||
|
|
||||||
|
config interface 7/4 fec none mode force-up enable
|
||||||
|
config interface 8/1 fec none mode force-up enable
|
||||||
|
config interface 8/2 fec none mode force-up enable
|
||||||
|
config interface 8/3 fec none mode force-up enable
|
||||||
|
config interface 8/4 fec none mode force-up enable
|
||||||
|
config interface 9/1 fec none mode force-up enable
|
||||||
|
config interface 9/2 fec none mode force-up enable
|
||||||
|
config interface 7/4 description "IN DWDM / OUT TEST_HW_08_N0_p1"
|
||||||
|
config interface 8/1 description "IN DWDM / OUT TEST_HW_09_N1_p0"
|
||||||
|
config interface 8/2 description "IN DWDM / OUT TEST_HW_09_N0_p0"
|
||||||
|
config interface 8/3 description "IN DWDM / OUT TEST_HW_10_N1_p0"
|
||||||
|
config interface 8/4 description "IN DWDM / OUT TEST_HW_10_N0_p0"
|
||||||
|
config interface 9/1 description "IN DWDM / OUT TEST_HW_11_N0_p0"
|
||||||
|
config interface 9/2 description "IN DWDM / OUT TEST_HW_11_N0_p1"
|
||||||
58
tests/fixtures/quasar/config_1.expected.json
vendored
Normal file
58
tests/fixtures/quasar/config_1.expected.json
vendored
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
{
|
||||||
|
"system": {
|
||||||
|
"model": "Quasar-T-Q-0002",
|
||||||
|
"serial_number": "WEE1C1CC0004A",
|
||||||
|
"version": "0.2.17.2022-10-21"
|
||||||
|
},
|
||||||
|
"interfaces": [
|
||||||
|
{
|
||||||
|
"interface": "7/4",
|
||||||
|
"ip_address": null,
|
||||||
|
"mask": null,
|
||||||
|
"description": "IN DWDM / OUT TEST_HW_08_N0_p1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "8/1",
|
||||||
|
"ip_address": null,
|
||||||
|
"mask": null,
|
||||||
|
"description": "IN DWDM / OUT TEST_HW_09_N1_p0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "8/2",
|
||||||
|
"ip_address": null,
|
||||||
|
"mask": null,
|
||||||
|
"description": "IN DWDM / OUT TEST_HW_09_N0_p0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "8/3",
|
||||||
|
"ip_address": null,
|
||||||
|
"mask": null,
|
||||||
|
"description": "IN DWDM / OUT TEST_HW_10_N1_p0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "8/4",
|
||||||
|
"ip_address": null,
|
||||||
|
"mask": null,
|
||||||
|
"description": "IN DWDM / OUT TEST_HW_10_N0_p0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "9/1",
|
||||||
|
"ip_address": null,
|
||||||
|
"mask": null,
|
||||||
|
"description": "IN DWDM / OUT TEST_HW_11_N0_p0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "9/2",
|
||||||
|
"ip_address": null,
|
||||||
|
"mask": null,
|
||||||
|
"description": "IN DWDM / OUT TEST_HW_11_N0_p1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "ethernet",
|
||||||
|
"ip_address": "25.25.1.221",
|
||||||
|
"mask": 24,
|
||||||
|
"description": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"vlans": []
|
||||||
|
}
|
||||||
43
tests/fixtures/quasar/config_2.conf
vendored
Normal file
43
tests/fixtures/quasar/config_2.conf
vendored
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# Copyright © 2021-2024, TechArgos LLC
|
||||||
|
# ----------- ------------------
|
||||||
|
# Component Version
|
||||||
|
# ----------- ------------------
|
||||||
|
# Assembly 0.2.23_9.9.1_GA
|
||||||
|
# Engine 2.23.15.2024-08-22
|
||||||
|
# DPlane 0.2.20.2023-10-17
|
||||||
|
# BfMonitor 1.4.0.2024-08-27
|
||||||
|
# CLI.core 1.0.3.2022-09-30
|
||||||
|
# CLI.engine 1.3.4.2024-08-22
|
||||||
|
# RConsole 1.0.1.2022-12-23
|
||||||
|
# RcAppParams 1.0.1.2022-12-23
|
||||||
|
# SNMP 0.3.0.2024-07-08
|
||||||
|
# Zabbix 0.2.13.2022-01-26
|
||||||
|
# WebUI 1.3.34.2024-08-30
|
||||||
|
# NMS.agent 1.2.12.2024-08-21
|
||||||
|
# SysLog 0.7.12.2024-02-02
|
||||||
|
# NTPd 0.1.5.2024-07-15
|
||||||
|
# AAA 0.0.8.2023-11-16
|
||||||
|
#
|
||||||
|
# ------------------------- --------------------
|
||||||
|
# Platform EEPROM field Value
|
||||||
|
# ------------------------- --------------------
|
||||||
|
# Product Name D5232C-T
|
||||||
|
# Part Number TA-PB-D5232C-T-AC-PI
|
||||||
|
# Local MAC N/A
|
||||||
|
# Product Serial Number WHF1C87123456A
|
||||||
|
# Product Version 0.0
|
||||||
|
# System Manufacturing Date 2026-06-07
|
||||||
|
config ethernet ipv4 address 25.25.18.19/24 gateway 25.25.18.254 enable
|
||||||
|
config interface 1/1 description "TEST_HW_1_1"
|
||||||
|
config interface 1/3 description "TEST_HW_1_3"
|
||||||
|
config interface 2/1 description "TEST_HW_2_1"
|
||||||
|
config interface 2/2 description "TEST_HW_2_2"
|
||||||
|
config interface 2/3 description "TEST_HW_2_3"
|
||||||
|
config interface 2/4 description "TEST_HW_2_4"
|
||||||
|
config interface 3/1 description "TEST_HW_3_1"
|
||||||
|
config interface 3/3 description "TEST_HW_3_3"
|
||||||
|
config interface 3/4 description "TEST_HW_3_4"
|
||||||
|
config interface 4/1 description "TEST_HW_4_1"
|
||||||
|
config interface 4/2 description "TEST_HW_4_2"
|
||||||
|
config interface 4/3 description "TEST_HW_4_3"
|
||||||
|
config interface 4/4 description "TEST_HW_4_4"
|
||||||
94
tests/fixtures/quasar/config_2.expected.json
vendored
Normal file
94
tests/fixtures/quasar/config_2.expected.json
vendored
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
{
|
||||||
|
"system": {
|
||||||
|
"model": "D5232C-T",
|
||||||
|
"serial_number": "WHF1C87123456A",
|
||||||
|
"version": "0.2.23_9.9.1_GA"
|
||||||
|
},
|
||||||
|
"interfaces": [
|
||||||
|
{
|
||||||
|
"interface": "1/1",
|
||||||
|
"ip_address": null,
|
||||||
|
"mask": null,
|
||||||
|
"description": "TEST_HW_1_1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "1/3",
|
||||||
|
"ip_address": null,
|
||||||
|
"mask": null,
|
||||||
|
"description": "TEST_HW_1_3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "2/1",
|
||||||
|
"ip_address": null,
|
||||||
|
"mask": null,
|
||||||
|
"description": "TEST_HW_2_1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "2/2",
|
||||||
|
"ip_address": null,
|
||||||
|
"mask": null,
|
||||||
|
"description": "TEST_HW_2_2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "2/3",
|
||||||
|
"ip_address": null,
|
||||||
|
"mask": null,
|
||||||
|
"description": "TEST_HW_2_3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "2/4",
|
||||||
|
"ip_address": null,
|
||||||
|
"mask": null,
|
||||||
|
"description": "TEST_HW_2_4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "3/1",
|
||||||
|
"ip_address": null,
|
||||||
|
"mask": null,
|
||||||
|
"description": "TEST_HW_3_1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "3/3",
|
||||||
|
"ip_address": null,
|
||||||
|
"mask": null,
|
||||||
|
"description": "TEST_HW_3_3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "3/4",
|
||||||
|
"ip_address": null,
|
||||||
|
"mask": null,
|
||||||
|
"description": "TEST_HW_3_4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "4/1",
|
||||||
|
"ip_address": null,
|
||||||
|
"mask": null,
|
||||||
|
"description": "TEST_HW_4_1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "4/2",
|
||||||
|
"ip_address": null,
|
||||||
|
"mask": null,
|
||||||
|
"description": "TEST_HW_4_2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "4/3",
|
||||||
|
"ip_address": null,
|
||||||
|
"mask": null,
|
||||||
|
"description": "TEST_HW_4_3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "4/4",
|
||||||
|
"ip_address": null,
|
||||||
|
"mask": null,
|
||||||
|
"description": "TEST_HW_4_4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "ethernet",
|
||||||
|
"ip_address": "25.25.18.19",
|
||||||
|
"mask": 24,
|
||||||
|
"description": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"vlans": []
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user