@@ -104,6 +104,84 @@ def teardown_module(_mod):
104
104
# This function tears down the whole topology.
105
105
tgen .stop_topology ()
106
106
107
+ def test_v6_rtadv_ ():
108
+ failures = 0
109
+ net = get_topogen ().net
110
+ print ("Shutdown r1-eth200" )
111
+ net ["r1" ].cmd (
112
+ 'vtysh -c "config t" -c "interface r1-eth200" '
113
+ ' -c "shutdown" '
114
+ )
115
+
116
+ sleep (2 )
117
+ rtadv_output1 = net ["r1" ].cmd ("vtysh -c 'show interface r1-eth200 json'" )
118
+ sleep (2 )
119
+ rtadv_output2 = net ["r1" ].cmd ("vtysh -c 'show interface r1-eth200 json'" )
120
+ if rtadv_output1 != rtadv_output2 :
121
+ sys .stderr .write (
122
+ f"RA state should not have changed: got { rtadv_output1 } , expected { rtadv_output2 } \n "
123
+ )
124
+ failures += 1
125
+ else :
126
+ print ("RA state verified successfully for interface shut" )
127
+
128
+ print ("Do no shutdown for r1-eth200" )
129
+ net ["r1" ].cmd (
130
+ 'vtysh -c "config t" -c "interface r1-eth200" '
131
+ ' -c "no shutdown" '
132
+ )
133
+
134
+ sleep (2 )
135
+ rtadv_output1 = net ["r1" ].cmd ("vtysh -c 'show interface r1-eth200 json'" )
136
+ sleep (2 )
137
+ rtadv_output2 = net ["r1" ].cmd ("vtysh -c 'show interface r1-eth200 json'" )
138
+ if rtadv_output1 == rtadv_output2 :
139
+ sys .stderr .write (
140
+ f"RA state didn't change: got { rtadv_output1 } , previous { rtadv_output2 } \n "
141
+ )
142
+ failures += 1
143
+ else :
144
+ print ("RA state verified successfully for interface unshut" )
145
+
146
+
147
+ print ("Remove r1-eth200" )
148
+ existing_config = net ["r1" ].cmd ("vtysh -c 'show interface r1-eth200'" )
149
+ net ["r1" ].cmd ("sudo ip link delete r1-eth200" )
150
+ sleep (2 )
151
+ rtadv_output1 = net ["r1" ].cmd ("vtysh -c 'show interface r1-eth200 json'" )
152
+ pattern1 = '"administrativeStatus":"down"'
153
+
154
+ if pattern1 in rtadv_output1 :
155
+ print ("Interface is down verified successfully" )
156
+ else :
157
+ sys .stderr .write (
158
+ f"Interface state not down yet:: got { rtadv_output1 } \n "
159
+ )
160
+ failures += 1
161
+
162
+ pattern2 = '"ndRouterAdvertisementsSent"'
163
+ if pattern2 in rtadv_output1 :
164
+ sys .stderr .write (
165
+ f"RA state still present :: got { rtadv_output1 } \n "
166
+ )
167
+ failures += 1
168
+ else :
169
+ print ("RA state verified successfully" )
170
+
171
+ net ["r1" ].cmd ("sudo ip link add r1-eth200 type veth" )
172
+ sleep (1 )
173
+ net ["r1" ].cmd ("sudo ip link set dev r1-eth200 up" )
174
+ sleep (2 )
175
+ pattern1 = '"administrativeStatus":"up"'
176
+ rtadv_output1 = net ["r1" ].cmd ("vtysh -c 'show interface r1-eth200 json'" )
177
+ if pattern1 in rtadv_output1 :
178
+ print ("Interface is up verified successfully" )
179
+ else :
180
+ sys .stderr .write (
181
+ f"Interface state not up yet:: got { rtadv_output1 } \n "
182
+ )
183
+ failures += 1
184
+ assert failures == 0 , f"Test failed with { failures } failures"
107
185
108
186
def test_bgp_route_cleanup ():
109
187
failures = 0
0 commit comments