@@ -61,11 +61,45 @@ def test_zebra_operationalr(tgen):
61
61
assert "ip-forwarding" in state .keys (), "IPv4 forwarding state not found"
62
62
assert "ipv6-forwarding" in state .keys (), "IPv6 forwarding state not found"
63
63
assert "mpls-forwarding" in state .keys (), "MPLS forwarding state not found"
64
-
64
+
65
65
# 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\n no ipv6 forwarding\n exit" )
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\n ipv6 forwarding\n exit" )
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"
69
103
70
104
71
105
if __name__ == "__main__" :
0 commit comments