Skip to content

Commit 5070852

Browse files
committed
tests: Test that ipv6 forwarding state is reflected properly
Signed-off-by: Donald Sharp <[email protected]>
1 parent 0f6b8e5 commit 5070852

File tree

1 file changed

+38
-4
lines changed

1 file changed

+38
-4
lines changed

tests/topotests/zebra_operational_data/test_zebra_operational.py

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,45 @@ def test_zebra_operationalr(tgen):
6161
assert "ip-forwarding" in state.keys(), "IPv4 forwarding state not found"
6262
assert "ipv6-forwarding" in state.keys(), "IPv6 forwarding state not found"
6363
assert "mpls-forwarding" in state.keys(), "MPLS forwarding state not found"
64-
64+
6565
# Verify the values are boolean
66-
assert isinstance(state["ip-forwarding"], bool), "IPv4 forwarding state should be boolean"
67-
assert isinstance(state["ipv6-forwarding"], bool), "IPv6 forwarding state should be boolean"
68-
assert isinstance(state["mpls-forwarding"], bool), "MPLS forwarding state should be boolean"
66+
assert isinstance(
67+
state["ip-forwarding"], bool
68+
), "IPv4 forwarding state should be boolean"
69+
assert isinstance(
70+
state["ipv6-forwarding"], bool
71+
), "IPv6 forwarding state should be boolean"
72+
assert isinstance(
73+
state["mpls-forwarding"], bool
74+
), "MPLS forwarding state should be boolean"
75+
76+
# Test IPv6 forwarding state change
77+
logger.info("Testing IPv6 forwarding state change")
78+
# Store initial state
79+
initial_ipv6_state = state["ipv6-forwarding"]
80+
81+
# Turn off IPv6 forwarding
82+
r1.vtysh_cmd("configure terminal\nno ipv6 forwarding\nexit")
83+
84+
# Get updated state
85+
output = json.loads(r1.vtysh_cmd("show mgmt get-data /frr-zebra:zebra"))
86+
new_state = output["frr-zebra:zebra"]["state"]
87+
88+
# Verify IPv6 forwarding is now off
89+
assert (
90+
new_state["ipv6-forwarding"] is False
91+
), "IPv6 forwarding should be False after disabling"
92+
93+
# Restore original state if it was enabled
94+
if initial_ipv6_state:
95+
r1.vtysh_cmd("configure terminal\nipv6 forwarding\nexit")
96+
97+
# Verify state is restored
98+
output = json.loads(r1.vtysh_cmd("show mgmt get-data /frr-zebra:zebra"))
99+
final_state = output["frr-zebra:zebra"]["state"]
100+
assert (
101+
final_state["ipv6-forwarding"] is True
102+
), "IPv6 forwarding should be restored to True"
69103

70104

71105
if __name__ == "__main__":

0 commit comments

Comments
 (0)