Add H3C device support with configuration and expected output files

- Introduced support for H3C devices by adding a new configuration file `config.conf` containing interface and VLAN settings.
- Created an expected output JSON file `config.expected.json` to validate the parsing of H3C configurations.
- Updated the test model cases to include H3C for comprehensive testing of device parsing functionality.
This commit is contained in:
IluaAir
2026-06-11 16:16:14 +03:00
parent 686cd6d715
commit 8edd1a296c
7 changed files with 331 additions and 12 deletions

View File

@@ -14,11 +14,4 @@ class H3C(BaseDevice):
vlans.append(item)
continue
vlans.extend({"vlan_id": vlan_id} for vlan_id in vlan_ids)
return vlans
if __name__ == "__main__":
with open("./test5.txt") as file:
data = file.read()
h3c = H3C(data)
print(h3c.parse())
return vlans

View File

@@ -26,13 +26,13 @@ Active-image: {{ ignore }} {{ _start_ }}
<group name="interfaces">
interface {{ interface | ORPHRASE }}
ip address {{ ip_address }} {{ mask | to_cidr }}
name {{ description }}
description {{ description }}
name {{ description | ORPHRASE}}
description {{ description | ORPHRASE }}
</group>
<group name="vlans">
interface vlan {{ vlan_id | _start_ }}
name {{ name }}
name {{ name | ORPHRASE }}
vlan {{ _db_ | _start_ }}
vlan {{ vlan_ids | joinmatches(',') | unrange("-", ",") | split(",")}}

View File

@@ -21,6 +21,7 @@ default_system = {
<group name="interfaces">
interface {{ interface }}
description {{ description | ORPHRASE }}
ip address {{ ip_address }} {{ mask | to_cidr }}
</group>

View File

@@ -20,7 +20,7 @@ default_system = {
<group name="interfaces">
interface {{ interface }}
description {{ description }}
description {{ description | ORPHRASE }}
ip address {{ ip_address }} {{ mask | to_cidr }}
</group>
<group name="vlans">