- 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.
24 lines
792 B
Python
24 lines
792 B
Python
from oxi.interfaces import BaseDevice, register_parser
|
|
|
|
|
|
@register_parser(["quasar", "qos"])
|
|
class Quasar(BaseDevice):
|
|
template = "quasar.ttp"
|
|
|
|
def interfaces(self) -> list[dict]:
|
|
ether_interface: dict = self.raw.get("interfaces", {})
|
|
interfaces: list[dict] = []
|
|
bulk_interfaces: dict = self.raw.get("bulkinterfaces", {})
|
|
for key, value in bulk_interfaces.items():
|
|
interfaces.append(
|
|
{
|
|
"interface": key,
|
|
"description": value.get("description"),
|
|
"ip_address": value.get("ip_address"),
|
|
"mask": value.get("mask"),
|
|
}
|
|
)
|
|
if ether_interface:
|
|
interfaces.append(ether_interface)
|
|
return interfaces
|