Add shutdown attribute to Interfaces class and update related templates

- Added a `shutdown` boolean attribute to the `Interfaces` class to manage interface states.
- Updated the `eltex.ttp` template to include the `shutdown` command based on the new attribute.
- Modified expected configuration JSON files for various devices to reflect the new `shutdown` attribute, ensuring accurate testing and validation of interface configurations.
This commit is contained in:
IluaAir
2026-07-15 00:47:10 +03:00
parent fb2d135187
commit a521c60d76
11 changed files with 76 additions and 0 deletions

View File

@@ -26,6 +26,7 @@ class Interfaces(Base):
ip_address: IPv4Address | None = None
mask: int | None = None
description: str | None = None
shutdown: bool = False
class Vlans(Base):

View File

@@ -25,6 +25,7 @@ Active-image: {{ ignore }} {{ _start_ }}
<group name="interfaces">
interface {{ interface | ORPHRASE }}
shutdown {{ shutdown | set(True) }}
ip address {{ ip_address }} {{ mask | to_cidr }}
name {{ description | ORPHRASE}}
description {{ description | ORPHRASE }}

View File

@@ -7,30 +7,35 @@
"interfaces": [
{
"interface": "TenGigabitEthernet1/0/2",
"shutdown": true,
"ip_address": null,
"mask": null,
"description": "FREE"
},
{
"interface": "TenGigabitEthernet1/0/11",
"shutdown": true,
"ip_address": null,
"mask": null,
"description": "FREE"
},
{
"interface": "vlan 1700",
"shutdown": false,
"ip_address": "13.36.8.1",
"mask": 24,
"description": "sw-test_HW"
},
{
"interface": "vlan 666",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "test"
},
{
"interface": "vlan 777",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "test2"

View File

@@ -7,72 +7,84 @@
"interfaces": [
{
"interface": "Bridge-Aggregation1",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "HW_TEST_1"
},
{
"interface": "Bridge-Aggregation2",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "HW_TEST_2"
},
{
"interface": "Bridge-Aggregation3",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "HW_TEST_3"
},
{
"interface": "Bridge-Aggregation4",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "HW_TEST_4"
},
{
"interface": "NULL0",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": null
},
{
"interface": "Vlan-interface1",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": null
},
{
"interface": "Vlan-interface12",
"shutdown": false,
"ip_address": "15.12.16.246",
"mask": 30,
"description": "BGP to OSPF1"
},
{
"interface": "Vlan-interface3000",
"shutdown": false,
"ip_address": "192.168.19.254",
"mask": 25,
"description": "L3 to HW_TEST_3"
},
{
"interface": "HundredGigE1/0/3",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "HW_TEST_1"
},
{
"interface": "HundredGigE1/0/63",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "HW_TEST_2"
},
{
"interface": "M-GigabitEthernet0/0/0",
"shutdown": false,
"ip_address": "192.168.10.101",
"mask": 24,
"description": null
},
{
"interface": "M-GigabitEthernet0/0/1",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": null

View File

@@ -7,12 +7,14 @@
"interfaces": [
{
"interface": "GigabitEthernet0/0/33",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": null
},
{
"interface": "Vlanif120",
"shutdown": false,
"ip_address": "10.26.196.254",
"mask": 24,
"description": "SSH"

View File

@@ -7,138 +7,161 @@
"interfaces": [
{
"interface": "GigabitEthernet0",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": null
},
{
"interface": "GigabitEthernet0/1",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": null
},
{
"interface": "GigabitEthernet0/2",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": null
},
{
"interface": "GigabitEthernet0/3",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": null
},
{
"interface": "GigabitEthernet0/0",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": null
},
{
"interface": "WifiMaster0",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": null
},
{
"interface": "WifiMaster0/AccessPoint0",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": null
},
{
"interface": "WifiMaster0/AccessPoint1",
"shutdown": true,
"ip_address": null,
"mask": null,
"description": null
},
{
"interface": "WifiMaster0/AccessPoint2",
"shutdown": true,
"ip_address": null,
"mask": null,
"description": null
},
{
"interface": "WifiMaster0/WifiStation0",
"shutdown": true,
"ip_address": null,
"mask": null,
"description": null
},
{
"interface": "WifiMaster1",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": null
},
{
"interface": "WifiMaster1/AccessPoint0",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": null
},
{
"interface": "WifiMaster1/AccessPoint1",
"shutdown": true,
"ip_address": null,
"mask": null,
"description": null
},
{
"interface": "WifiMaster1/AccessPoint2",
"shutdown": true,
"ip_address": null,
"mask": null,
"description": null
},
{
"interface": "WifiMaster1/WifiStation0",
"shutdown": true,
"ip_address": null,
"mask": null,
"description": null
},
{
"interface": "Bridge0",
"shutdown": false,
"ip_address": "17.36.1.1",
"mask": 24,
"description": "Home network"
},
{
"interface": "Bridge1",
"shutdown": true,
"ip_address": "10.1.30.1",
"mask": 24,
"description": "Guest network"
},
{
"interface": "Bridge2",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": null
},
{
"interface": "OpenVPN0",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "test_HW-udp"
},
{
"interface": "OpenVPN2",
"shutdown": true,
"ip_address": null,
"mask": null,
"description": "test_HW-tcp"
},
{
"interface": "Wireguard0",
"shutdown": false,
"ip_address": "10.3.100.1",
"mask": 24,
"description": "test_HW"
},
{
"interface": "Wireguard1",
"shutdown": false,
"ip_address": "10.1.100.1",
"mask": 24,
"description": "test_HW"
},
{
"interface": "Wireguard2",
"shutdown": false,
"ip_address": "10.2.100.1",
"mask": 24,
"description": "test_HW"

View File

@@ -7,24 +7,28 @@
"interfaces": [
{
"interface": "bridge.LAN",
"shutdown": false,
"ip_address": "172.16.3.1",
"mask": 24,
"description": null
},
{
"interface": "ether1",
"shutdown": false,
"ip_address": "10.38.3.245",
"mask": 24,
"description": null
},
{
"interface": "wireguard2",
"shutdown": false,
"ip_address": "10.1.100.2",
"mask": 24,
"description": null
},
{
"interface": "ether4",
"shutdown": false,
"ip_address": "100.10.10.1",
"mask": 24,
"description": null

View File

@@ -7,18 +7,21 @@
"interfaces": [
{
"interface": "GigaEthernet1/0/9",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "FREE"
},
{
"interface": "VLAN1",
"shutdown": false,
"ip_address": "192.168.0.1",
"mask": 16,
"description": null
},
{
"interface": "VLAN1002",
"shutdown": false,
"ip_address": "13.36.8.1",
"mask": 24,
"description": "test-1002"

View File

@@ -7,18 +7,21 @@
"interfaces": [
{
"interface": "GigaEthernet1/0/9",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "FREE"
},
{
"interface": "VLAN1",
"shutdown": false,
"ip_address": "192.168.0.1",
"mask": 16,
"description": null
},
{
"interface": "VLAN1002",
"shutdown": false,
"ip_address": "13.36.8.1",
"mask": 24,
"description": "test-1002"

View File

@@ -7,48 +7,56 @@
"interfaces": [
{
"interface": "7/4",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "IN DWDM / OUT TEST_HW_08_N0_p1"
},
{
"interface": "8/1",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "IN DWDM / OUT TEST_HW_09_N1_p0"
},
{
"interface": "8/2",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "IN DWDM / OUT TEST_HW_09_N0_p0"
},
{
"interface": "8/3",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "IN DWDM / OUT TEST_HW_10_N1_p0"
},
{
"interface": "8/4",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "IN DWDM / OUT TEST_HW_10_N0_p0"
},
{
"interface": "9/1",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "IN DWDM / OUT TEST_HW_11_N0_p0"
},
{
"interface": "9/2",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "IN DWDM / OUT TEST_HW_11_N0_p1"
},
{
"interface": "ethernet",
"shutdown": false,
"ip_address": "25.25.1.221",
"mask": 24,
"description": null

View File

@@ -7,84 +7,98 @@
"interfaces": [
{
"interface": "1/1",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "TEST_HW_1_1"
},
{
"interface": "1/3",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "TEST_HW_1_3"
},
{
"interface": "2/1",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "TEST_HW_2_1"
},
{
"interface": "2/2",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "TEST_HW_2_2"
},
{
"interface": "2/3",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "TEST_HW_2_3"
},
{
"interface": "2/4",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "TEST_HW_2_4"
},
{
"interface": "3/1",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "TEST_HW_3_1"
},
{
"interface": "3/3",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "TEST_HW_3_3"
},
{
"interface": "3/4",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "TEST_HW_3_4"
},
{
"interface": "4/1",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "TEST_HW_4_1"
},
{
"interface": "4/2",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "TEST_HW_4_2"
},
{
"interface": "4/3",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "TEST_HW_4_3"
},
{
"interface": "4/4",
"shutdown": false,
"ip_address": null,
"mask": null,
"description": "TEST_HW_4_4"
},
{
"interface": "ethernet",
"shutdown": false,
"ip_address": "25.25.18.19",
"mask": 24,
"description": null