Skip to content

Commit 33f2a49

Browse files
authored
Merge pull request #179 from netdevops/claude/test-config-workflows-ko2Hk
Test circular configuration workflows for hier_config
2 parents 81ec52b + f3e4659 commit 33f2a49

39 files changed

Lines changed: 1357 additions & 0 deletions

tests/circular/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Circular config workflow tests."""

tests/circular/conftest.py

Lines changed: 241 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
"""Fixtures for circular config workflow tests."""
2+
3+
from pathlib import Path
4+
5+
import pytest
6+
7+
8+
def _fixture_file_read(filename: str) -> str:
9+
"""Read a fixture file from the fixtures directory."""
10+
return str(
11+
Path(__file__)
12+
.resolve()
13+
.parent.joinpath("fixtures")
14+
.joinpath(filename)
15+
.read_text(encoding="utf8"),
16+
)
17+
18+
19+
# Cisco IOS fixtures
20+
@pytest.fixture(scope="module")
21+
def ios_running_config() -> str:
22+
"""Load IOS running config fixture."""
23+
return _fixture_file_read("ios_running.conf")
24+
25+
26+
@pytest.fixture(scope="module")
27+
def ios_generated_config() -> str:
28+
"""Load IOS generated config fixture."""
29+
return _fixture_file_read("ios_generated.conf")
30+
31+
32+
@pytest.fixture(scope="module")
33+
def ios_remediation_config() -> str:
34+
"""Load IOS remediation config fixture."""
35+
return _fixture_file_read("ios_remediation.conf")
36+
37+
38+
@pytest.fixture(scope="module")
39+
def ios_rollback_config() -> str:
40+
"""Load IOS rollback config fixture."""
41+
return _fixture_file_read("ios_rollback.conf")
42+
43+
44+
# Arista EOS fixtures
45+
@pytest.fixture(scope="module")
46+
def eos_running_config() -> str:
47+
"""Load EOS running config fixture."""
48+
return _fixture_file_read("eos_running.conf")
49+
50+
51+
@pytest.fixture(scope="module")
52+
def eos_generated_config() -> str:
53+
"""Load EOS generated config fixture."""
54+
return _fixture_file_read("eos_generated.conf")
55+
56+
57+
@pytest.fixture(scope="module")
58+
def eos_remediation_config() -> str:
59+
"""Load EOS remediation config fixture."""
60+
return _fixture_file_read("eos_remediation.conf")
61+
62+
63+
@pytest.fixture(scope="module")
64+
def eos_rollback_config() -> str:
65+
"""Load EOS rollback config fixture."""
66+
return _fixture_file_read("eos_rollback.conf")
67+
68+
69+
# Cisco NXOS fixtures
70+
@pytest.fixture(scope="module")
71+
def nxos_running_config() -> str:
72+
"""Load NXOS running config fixture."""
73+
return _fixture_file_read("nxos_running.conf")
74+
75+
76+
@pytest.fixture(scope="module")
77+
def nxos_generated_config() -> str:
78+
"""Load NXOS generated config fixture."""
79+
return _fixture_file_read("nxos_generated.conf")
80+
81+
82+
@pytest.fixture(scope="module")
83+
def nxos_remediation_config() -> str:
84+
"""Load NXOS remediation config fixture."""
85+
return _fixture_file_read("nxos_remediation.conf")
86+
87+
88+
@pytest.fixture(scope="module")
89+
def nxos_rollback_config() -> str:
90+
"""Load NXOS rollback config fixture."""
91+
return _fixture_file_read("nxos_rollback.conf")
92+
93+
94+
# Cisco IOS-XR fixtures
95+
@pytest.fixture(scope="module")
96+
def iosxr_running_config() -> str:
97+
"""Load IOS-XR running config fixture."""
98+
return _fixture_file_read("iosxr_running.conf")
99+
100+
101+
@pytest.fixture(scope="module")
102+
def iosxr_generated_config() -> str:
103+
"""Load IOS-XR generated config fixture."""
104+
return _fixture_file_read("iosxr_generated.conf")
105+
106+
107+
@pytest.fixture(scope="module")
108+
def iosxr_remediation_config() -> str:
109+
"""Load IOS-XR remediation config fixture."""
110+
return _fixture_file_read("iosxr_remediation.conf")
111+
112+
113+
@pytest.fixture(scope="module")
114+
def iosxr_rollback_config() -> str:
115+
"""Load IOS-XR rollback config fixture."""
116+
return _fixture_file_read("iosxr_rollback.conf")
117+
118+
119+
# Juniper JunOS fixtures
120+
@pytest.fixture(scope="module")
121+
def junos_running_config() -> str:
122+
"""Load JunOS running config fixture."""
123+
return _fixture_file_read("junos_running.conf")
124+
125+
126+
@pytest.fixture(scope="module")
127+
def junos_generated_config() -> str:
128+
"""Load JunOS generated config fixture."""
129+
return _fixture_file_read("junos_generated.conf")
130+
131+
132+
@pytest.fixture(scope="module")
133+
def junos_remediation_config() -> str:
134+
"""Load JunOS remediation config fixture."""
135+
return _fixture_file_read("junos_remediation.conf")
136+
137+
138+
@pytest.fixture(scope="module")
139+
def junos_rollback_config() -> str:
140+
"""Load JunOS rollback config fixture."""
141+
return _fixture_file_read("junos_rollback.conf")
142+
143+
144+
# VyOS fixtures
145+
@pytest.fixture(scope="module")
146+
def vyos_running_config() -> str:
147+
"""Load VyOS running config fixture."""
148+
return _fixture_file_read("vyos_running.conf")
149+
150+
151+
@pytest.fixture(scope="module")
152+
def vyos_generated_config() -> str:
153+
"""Load VyOS generated config fixture."""
154+
return _fixture_file_read("vyos_generated.conf")
155+
156+
157+
@pytest.fixture(scope="module")
158+
def vyos_remediation_config() -> str:
159+
"""Load VyOS remediation config fixture."""
160+
return _fixture_file_read("vyos_remediation.conf")
161+
162+
163+
@pytest.fixture(scope="module")
164+
def vyos_rollback_config() -> str:
165+
"""Load VyOS rollback config fixture."""
166+
return _fixture_file_read("vyos_rollback.conf")
167+
168+
169+
# Fortinet FortiOS fixtures
170+
@pytest.fixture(scope="module")
171+
def fortios_running_config() -> str:
172+
"""Load FortiOS running config fixture."""
173+
return _fixture_file_read("fortios_running.conf")
174+
175+
176+
@pytest.fixture(scope="module")
177+
def fortios_generated_config() -> str:
178+
"""Load FortiOS generated config fixture."""
179+
return _fixture_file_read("fortios_generated.conf")
180+
181+
182+
@pytest.fixture(scope="module")
183+
def fortios_remediation_config() -> str:
184+
"""Load FortiOS remediation config fixture."""
185+
return _fixture_file_read("fortios_remediation.conf")
186+
187+
188+
@pytest.fixture(scope="module")
189+
def fortios_rollback_config() -> str:
190+
"""Load FortiOS rollback config fixture."""
191+
return _fixture_file_read("fortios_rollback.conf")
192+
193+
194+
# HP Comware5 fixtures
195+
@pytest.fixture(scope="module")
196+
def comware5_running_config() -> str:
197+
"""Load HP Comware5 running config fixture."""
198+
return _fixture_file_read("comware5_running.conf")
199+
200+
201+
@pytest.fixture(scope="module")
202+
def comware5_generated_config() -> str:
203+
"""Load HP Comware5 generated config fixture."""
204+
return _fixture_file_read("comware5_generated.conf")
205+
206+
207+
@pytest.fixture(scope="module")
208+
def comware5_remediation_config() -> str:
209+
"""Load HP Comware5 remediation config fixture."""
210+
return _fixture_file_read("comware5_remediation.conf")
211+
212+
213+
@pytest.fixture(scope="module")
214+
def comware5_rollback_config() -> str:
215+
"""Load HP Comware5 rollback config fixture."""
216+
return _fixture_file_read("comware5_rollback.conf")
217+
218+
219+
# HP Procurve fixtures
220+
@pytest.fixture(scope="module")
221+
def procurve_running_config() -> str:
222+
"""Load HP Procurve running config fixture."""
223+
return _fixture_file_read("procurve_running.conf")
224+
225+
226+
@pytest.fixture(scope="module")
227+
def procurve_generated_config() -> str:
228+
"""Load HP Procurve generated config fixture."""
229+
return _fixture_file_read("procurve_generated.conf")
230+
231+
232+
@pytest.fixture(scope="module")
233+
def procurve_remediation_config() -> str:
234+
"""Load HP Procurve remediation config fixture."""
235+
return _fixture_file_read("procurve_remediation.conf")
236+
237+
238+
@pytest.fixture(scope="module")
239+
def procurve_rollback_config() -> str:
240+
"""Load HP Procurve rollback config fixture."""
241+
return _fixture_file_read("procurve_rollback.conf")
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
sysname HP-Switch-01
2+
vlan 10
3+
name DATA_VLAN_UPDATED
4+
vlan 20
5+
name VOICE_VLAN
6+
vlan 40
7+
name NEW_VLAN
8+
interface GigabitEthernet1/0/1
9+
port link-mode route
10+
description WAN Interface Primary
11+
ip address 203.0.113.1 255.255.255.252
12+
interface GigabitEthernet1/0/2
13+
port link-mode bridge
14+
description Access Port Updated
15+
port access vlan 10
16+
stp edged-port enable
17+
interface GigabitEthernet1/0/4
18+
port link-mode bridge
19+
description New Interface
20+
port access vlan 40
21+
interface Vlan-interface10
22+
description Data VLAN Interface Updated
23+
ip address 10.100.1.1 255.255.255.0
24+
interface Vlan-interface40
25+
description New VLAN Interface
26+
ip address 10.100.4.1 255.255.255.0
27+
ip route-static 0.0.0.0 0 203.0.113.2
28+
ip route-static 10.10.0.0 16 10.100.1.254
29+
ip route-static 10.20.0.0 16 10.100.1.253
30+
ntp-service unicast-server 10.0.0.50
31+
ntp-service unicast-server 10.0.0.51
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
undo vlan 30
2+
undo interface GigabitEthernet1/0/3
3+
vlan 10
4+
undo name DATA_VLAN
5+
name DATA_VLAN_UPDATED
6+
vlan 40
7+
name NEW_VLAN
8+
interface GigabitEthernet1/0/1
9+
undo description WAN Interface
10+
description WAN Interface Primary
11+
interface GigabitEthernet1/0/2
12+
undo description Access Port
13+
description Access Port Updated
14+
stp edged-port enable
15+
interface GigabitEthernet1/0/4
16+
port link-mode bridge
17+
description New Interface
18+
port access vlan 40
19+
interface Vlan-interface10
20+
undo description Data VLAN Interface
21+
description Data VLAN Interface Updated
22+
interface Vlan-interface40
23+
description New VLAN Interface
24+
ip address 10.100.4.1 255.255.255.0
25+
ip route-static 10.20.0.0 16 10.100.1.253
26+
ntp-service unicast-server 10.0.0.51
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
undo vlan 40
2+
undo interface GigabitEthernet1/0/4
3+
undo interface Vlan-interface40
4+
undo ip route-static 10.20.0.0 16 10.100.1.253
5+
undo ntp-service unicast-server 10.0.0.51
6+
vlan 10
7+
undo name DATA_VLAN_UPDATED
8+
name DATA_VLAN
9+
vlan 30
10+
name OLD_VLAN
11+
interface GigabitEthernet1/0/1
12+
undo description WAN Interface Primary
13+
description WAN Interface
14+
interface GigabitEthernet1/0/2
15+
undo description Access Port Updated
16+
undo stp edged-port enable
17+
description Access Port
18+
interface GigabitEthernet1/0/3
19+
port link-mode bridge
20+
description Old Interface
21+
port access vlan 30
22+
shutdown
23+
interface Vlan-interface10
24+
undo description Data VLAN Interface Updated
25+
description Data VLAN Interface
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
sysname HP-Switch-01
2+
vlan 10
3+
name DATA_VLAN
4+
vlan 20
5+
name VOICE_VLAN
6+
vlan 30
7+
name OLD_VLAN
8+
interface GigabitEthernet1/0/1
9+
port link-mode route
10+
description WAN Interface
11+
ip address 203.0.113.1 255.255.255.252
12+
interface GigabitEthernet1/0/2
13+
port link-mode bridge
14+
description Access Port
15+
port access vlan 10
16+
interface GigabitEthernet1/0/3
17+
port link-mode bridge
18+
description Old Interface
19+
port access vlan 30
20+
shutdown
21+
interface Vlan-interface10
22+
description Data VLAN Interface
23+
ip address 10.100.1.1 255.255.255.0
24+
ip route-static 0.0.0.0 0 203.0.113.2
25+
ip route-static 10.10.0.0 16 10.100.1.254
26+
ntp-service unicast-server 10.0.0.50
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
hostname switch-eos-01
2+
vlan 10
3+
name VLAN10_UPDATED
4+
vlan 20
5+
name VLAN20
6+
vlan 40
7+
name NEW_VLAN
8+
interface Ethernet1
9+
description Uplink to Core Primary
10+
no switchport
11+
ip address 192.168.10.1/24
12+
interface Ethernet2
13+
description Access Port Updated
14+
switchport mode access
15+
switchport access vlan 10
16+
spanning-tree portfast
17+
interface Ethernet3
18+
description Trunk Port
19+
switchport mode trunk
20+
switchport trunk allowed vlan 10,20,40
21+
interface Ethernet4
22+
description New Interface
23+
switchport mode access
24+
switchport access vlan 40
25+
interface Vlan10
26+
description VLAN 10 SVI Updated
27+
ip address 10.10.10.1/24
28+
interface Vlan40
29+
description VLAN 40 SVI
30+
ip address 10.10.40.1/24
31+
router bgp 65100
32+
router-id 192.168.10.1
33+
neighbor 192.168.10.2 remote-as 65200
34+
neighbor 192.168.10.2 description Core Switch Primary
35+
neighbor 192.168.10.3 remote-as 65300
36+
neighbor 192.168.10.3 description Secondary Peer
37+
address-family ipv4
38+
neighbor 192.168.10.2 activate
39+
neighbor 192.168.10.3 activate
40+
ip route 0.0.0.0/0 192.168.10.254
41+
ip route 10.20.0.0/16 192.168.10.253
42+
ntp server 10.0.0.20
43+
ntp server 10.0.0.21

0 commit comments

Comments
 (0)