blob: 556304b612e4d5f139021508a819b060256f7db2 [file] [log] [blame]
Daniele Moro790cc102021-08-30 18:27:30 +02001class UP4:
2
3 def __init__(self):
4 self.default = ''
5
Daniele Moro790cc102021-08-30 18:27:30 +02006 def CASE1(self, main):
Daniele Morobf53dec2021-09-13 18:11:56 +02007 main.case("Fabric UPF traffic terminated in the fabric")
Daniele Moro790cc102021-08-30 18:27:30 +02008 """
Daniele Morobf53dec2021-09-13 18:11:56 +02009 Program PDRs and FARs for UEs
10 Verify PDRs and FARs
Daniele Moro790cc102021-08-30 18:27:30 +020011 Generate traffic from UE to PDN
12 Verify traffic received from PDN
13 Generate traffic from PDN to UE
14 Verify traffic received from UE
Daniele Morobf53dec2021-09-13 18:11:56 +020015 Remove PDRs and FARs for UEs
16 Verify removed PDRs and FARs
Daniele Moro790cc102021-08-30 18:27:30 +020017 """
Daniele Moro790cc102021-08-30 18:27:30 +020018 try:
Daniele Moro80889562021-09-08 10:09:26 +020019 from tests.USECASE.SegmentRouting.dependencies.up4 import UP4
Daniele Moro790cc102021-08-30 18:27:30 +020020 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
21 Testcaselib as run
Daniele Moro790cc102021-08-30 18:27:30 +020022 except ImportError as e:
23 main.log.error("Import not found. Exiting the test")
24 main.log.error(e)
25 main.cleanAndExit()
26
Daniele Moro790cc102021-08-30 18:27:30 +020027 run.initTest(main)
28 main.log.info(main.Cluster.numCtrls)
29 main.Cluster.setRunningNode(3)
30 run.installOnos(main, skipPackage=True, cliSleep=5)
31
Daniele Moro790cc102021-08-30 18:27:30 +020032 main.step("Start scapy and p4rt client")
Daniele Morobf53dec2021-09-13 18:11:56 +020033 # Use the first available ONOS instance CLI
34 onos_cli = main.Cluster.active(0).CLI
Daniele Moro80889562021-09-08 10:09:26 +020035 up4 = UP4()
36 # Get the P4RT client connected to UP4 in the first available ONOS instance
37 up4.setup(main.Cluster.active(0).p4rtUp4)
Daniele Moro790cc102021-08-30 18:27:30 +020038
Daniele Moro93feb022021-10-04 16:26:23 +020039 main.step("Program and Verify PDRs and FARs via UP4")
Daniele Moro80889562021-09-08 10:09:26 +020040 up4.attachUes()
Daniele Morobf53dec2021-09-13 18:11:56 +020041 up4.verifyUp4Flow(onos_cli)
42
Daniele Moro80889562021-09-08 10:09:26 +020043 # ------- Test Upstream traffic (enb->pdn)
Daniele Moro790cc102021-08-30 18:27:30 +020044 main.step("Test upstream traffic")
Daniele Moro80889562021-09-08 10:09:26 +020045 up4.testUpstreamTraffic()
Daniele Moro790cc102021-08-30 18:27:30 +020046
Daniele Moro80889562021-09-08 10:09:26 +020047 # ------- Test Downstream traffic (pdn->enb)
Daniele Moro790cc102021-08-30 18:27:30 +020048 main.step("Test downstream traffic")
Daniele Moro80889562021-09-08 10:09:26 +020049 up4.testDownstreamTraffic()
Daniele Moro790cc102021-08-30 18:27:30 +020050
Daniele Moro93feb022021-10-04 16:26:23 +020051 main.step("Remove and Verify PDRs and FARs via UP4")
Daniele Moro80889562021-09-08 10:09:26 +020052 up4.detachUes()
Daniele Morobf53dec2021-09-13 18:11:56 +020053 up4.verifyNoUesFlow(onos_cli)
54
Daniele Moro790cc102021-08-30 18:27:30 +020055 main.step("Stop scapy and p4rt client")
Daniele Moro80889562021-09-08 10:09:26 +020056 up4.teardown()
Daniele Moro790cc102021-08-30 18:27:30 +020057 run.cleanup(main)
Daniele Morobf53dec2021-09-13 18:11:56 +020058
Jon Halldf04fff2021-10-08 23:50:30 +000059 def CASE2(self):
Daniele Morobf53dec2021-09-13 18:11:56 +020060 main.case("BESS traffic routed")
61 """
62 Program PDRs and FARs for UEs managed via UP4
63 Verify PDRs and FARs
64 Verify Upstream Traffic: eNB -> Fabric -> BESS (encapped)
65 Verify Upstream Traffic: BESS -> Fabric -> PDN (not encapped)
66 Verify Downstream Traffic: PDN -> Fabric -> BESS (not encapped)
67 Verify Downstream Traffic: BESS -> Fabric -> eNB (encapped)
68 Remove PDRs and FARs for UEs managed via UP4
69 Verify removed PDRs and FARs
70 """
71 BESS_TEID = 300
72 BESS_UE_ADDR = "10.241.0.1"
73 GPDU_PORT = 2152
74 UE_PORT = 400
75 PDN_PORT = 800
76 try:
77 from tests.USECASE.SegmentRouting.dependencies.up4 import UP4
78 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
79 Testcaselib as run
80 except ImportError as e:
81 main.log.error("Import not found. Exiting the test")
82 main.log.error(e)
83 main.cleanAndExit()
84
85 run.initTest(main)
86 main.log.info(main.Cluster.numCtrls)
87 main.Cluster.setRunningNode(3)
88 run.installOnos(main, skipPackage=True, cliSleep=5)
89
90 main.step("Start scapy and p4rt client + Scapy on BESS Host")
91 # Use the first available ONOS instance CLI
92 onos_cli = main.Cluster.active(0).CLI
93 up4 = UP4()
94 # Get the P4RT client connected to UP4 in the first available ONOS instance
95 up4.setup(main.Cluster.active(0).p4rtUp4)
96
97 # Setup the emulated BESS host and required parameters
98 bess_host = main.Compute2 # FIXME: Parametrize?
99 bess_interface = bess_host.interfaces[0]
100 bess_s1u_address = bess_interface["ips"][0]
101 bess_host.startScapy(ifaceName=bess_interface["name"], enableGtp=True)
102 enodeb_host = up4.enodeb_host
103 enodeb_interface = up4.enodeb_interface
104 pdn_host = up4.pdn_host
105 pdn_interface = up4.pdn_interface
106
Daniele Moro93feb022021-10-04 16:26:23 +0200107 main.step("Program and Verify PDRs and FARs for UEs via UP4")
Daniele Morobf53dec2021-09-13 18:11:56 +0200108 up4.attachUes()
Daniele Morobf53dec2021-09-13 18:11:56 +0200109 up4.verifyUp4Flow(onos_cli)
110
111 # ------------------- UPSTREAM -------------------
112 # ------- eNB -> fabric -> BESS (encapped)
113 main.step("Test upstream eNB -> fabric -> BESS")
114 # Start filter before sending packets, BESS should receive GTP encapped
115 # packets
116 pkt_filter_upstream = "ip and udp src port %d and udp dst port %d and src host %s and dst host %s" % (
117 GPDU_PORT, GPDU_PORT, up4.enb_address, bess_s1u_address)
118 main.log.info("Start listening on %s intf %s" % (
119 bess_host.name, bess_interface["name"]))
120 main.log.debug("BPF Filter BESS Upstream: \n %s" % pkt_filter_upstream)
121 bess_host.startFilter(ifaceName=bess_interface["name"],
122 sniffCount=1,
123 pktFilter=pkt_filter_upstream)
124 # Send GTP Packet
125 UP4.buildGtpPacket(enodeb_host,
126 src_ip_outer=up4.enb_address,
127 dst_ip_outer=bess_s1u_address,
128 src_ip_inner=BESS_UE_ADDR,
129 dst_ip_inner=pdn_interface["ips"][0],
130 src_udp_inner=UE_PORT,
131 dst_udp_inner=PDN_PORT,
132 teid=BESS_TEID)
133 enodeb_host.sendPacket()
134
135 packets = UP4.checkFilterAndGetPackets(bess_host)
136 # FIXME: with newer scapy TEID becomes teid (required for Scapy 2.4.5)
137 n_packets = packets.count("TEID=" + hex(BESS_TEID) + "L ")
138 tot_packets = packets.count('Ether')
139 utilities.assert_equal(expect=True,
140 actual=n_packets == 1 and tot_packets == 1,
141 onpass="BESS correctly received 1 GTP encapped packet",
142 onfail="ERROR: BESS received %d GTP encapped packets and filter captured %d packets" % (
143 n_packets, tot_packets))
144
145 # ------- BESS -> fabric -> PDN (not-encapped)
146 main.step("Test upstream BESS -> fabric -> PDN")
147 # Start filter before sending packets, PDN should receive non-GTP packet
148 pkt_filter_upstream = "ip and udp src port %d and udp dst port %d and src host %s and dst host %s" % (
149 UE_PORT, PDN_PORT, BESS_UE_ADDR, pdn_interface["ips"][0])
150 main.log.info("Start listening on %s intf %s" % (
151 pdn_host.name, pdn_interface["name"]))
152 main.log.debug("BPF Filter PDN Upstream: \n %s" % pkt_filter_upstream)
153 pdn_host.startFilter(ifaceName=pdn_interface["name"],
154 sniffCount=1,
155 pktFilter=pkt_filter_upstream)
156 # Send UDP Packet
157 UP4.buildUdpPacket(bess_host,
158 src_ip=BESS_UE_ADDR,
159 dst_ip=pdn_interface["ips"][0],
160 src_udp=UE_PORT,
161 dst_udp=PDN_PORT)
162 bess_host.sendPacket()
163
164 packets = UP4.checkFilterAndGetPackets(pdn_host)
165 tot_packets = packets.count('Ether')
166 utilities.assert_equal(expect=True,
167 actual=tot_packets == 1,
168 onpass="PDN correctly received 1 packet",
169 onfail="ERROR: PDN received %d packets" % (
170 tot_packets))
171 # ------------------------------------------------
172
173 # ------------------ DOWNSTREAM ------------------
174 # ------- PDN -> fabric -> BESS (not-encapped)
175 main.step("Test downstream PDN -> fabric -> BESS")
176 pkt_filter_downstream = "ip and udp src port %d and udp dst port %d and src host %s and dst host %s" % (
177 PDN_PORT, UE_PORT, pdn_interface["ips"][0], BESS_UE_ADDR)
178 main.log.info("Start listening on %s intf %s" % (
179 bess_host.name, bess_interface["name"]))
180 main.log.debug(
181 "BPF Filter BESS Downstream: \n %s" % pkt_filter_downstream)
182 bess_host.startFilter(ifaceName=bess_interface["name"],
183 sniffCount=1,
184 pktFilter=pkt_filter_downstream)
185 UP4.buildUdpPacket(pdn_host,
186 dst_eth=up4.router_mac,
187 src_ip=pdn_interface["ips"][0],
188 dst_ip=BESS_UE_ADDR,
189 src_udp=PDN_PORT,
190 dst_udp=UE_PORT)
191 pdn_host.sendPacket()
192
193 packets = UP4.checkFilterAndGetPackets(bess_host)
194
195 tot_packets = packets.count('Ether')
196 utilities.assert_equal(expect=True,
197 actual=tot_packets == 1,
198 onpass="BESS correctly received 1 packet",
199 onfail="ERROR: BESS received %d packets" % (
200 tot_packets))
201
202 # ------- BESS -> fabric -> eNB (encapped)
203 main.step("Test downstream BESS -> fabric -> eNB")
204 pkt_filter_downstream = "ip and udp src port %d and udp dst port %d and src host %s and dst host %s" % (
205 GPDU_PORT, GPDU_PORT, bess_s1u_address, up4.enb_address)
206 main.log.info("Start listening on %s intf %s" % (
207 enodeb_host.name, enodeb_interface["name"]))
208 main.log.debug(
209 "BPF Filter BESS Downstream: \n %s" % pkt_filter_downstream)
210 enodeb_host.startFilter(ifaceName=enodeb_interface["name"],
211 sniffCount=1,
212 pktFilter=pkt_filter_downstream)
213 # Build GTP packet from BESS host
214 UP4.buildGtpPacket(bess_host,
215 src_ip_outer=bess_s1u_address,
216 dst_ip_outer=up4.enb_address,
217 src_ip_inner=pdn_interface["ips"][0],
218 dst_ip_inner=BESS_UE_ADDR,
219 src_udp_inner=PDN_PORT,
220 dst_udp_inner=UE_PORT,
221 teid=BESS_TEID)
222 bess_host.sendPacket()
223
224 packets = UP4.checkFilterAndGetPackets(enodeb_host)
225
226 # FIXME: with newer scapy TEID becomes teid (required for Scapy 2.4.5)
227 n_packets = packets.count("TEID=" + hex(BESS_TEID) + "L ")
228 tot_packets = packets.count('Ether')
229 utilities.assert_equal(expect=True,
230 actual=n_packets == 1 and tot_packets == 1,
231 onpass="eNodeB correctly received 1 GTP encapped packet",
232 onfail="ERROR: eNodeb received %d GTP encapped packets and filter captured %d packets" % (
233 n_packets, tot_packets))
234 # ------------------------------------------------
235
Daniele Moro93feb022021-10-04 16:26:23 +0200236 main.step("Remove and Verify PDRs and FARs for UEs via UP4")
Daniele Morobf53dec2021-09-13 18:11:56 +0200237 up4.detachUes()
Daniele Morobf53dec2021-09-13 18:11:56 +0200238 up4.verifyNoUesFlow(onos_cli)
239
240 main.step("Stop scapy and p4rt client")
241 up4.teardown()
242 bess_host.stopScapy()
243 run.cleanup(main)
Daniele Moro954e2282021-09-22 17:32:03 +0200244
245 def CASE3(self, main):
246 main.case("Verify UP4 from different ONOS instances")
247 """
248 Program PDRs and FARs via UP4 on first ONOS instance
249 Repeat for all ONOS Instances:
250 Verify PDRs and FARs via P4RT
251 Disconnect P4RT client
252 Verify and delete PDRs and FARs via UP4 on the third ONOS instance
253 Repeat for all ONOS Instance:
254 Verify removed PDRs and FARs via P4RT
255 Disconnect P4RT client
256 """
257 try:
258 from tests.USECASE.SegmentRouting.dependencies.up4 import UP4
259 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
260 Testcaselib as run
261 except ImportError as e:
262 main.log.error("Import not found. Exiting the test")
263 main.log.error(e)
264 main.cleanAndExit()
265
266 run.initTest(main)
267 main.log.info(main.Cluster.numCtrls)
268 main.Cluster.setRunningNode(3)
269 run.installOnos(main, skipPackage=True, cliSleep=5)
270
271 onos_cli_0 = main.Cluster.active(0).CLI
272 onos_cli_1 = main.Cluster.active(1).CLI
273 onos_cli_2 = main.Cluster.active(2).CLI
274 up4_0 = UP4()
275 up4_1 = UP4()
276 up4_2 = UP4()
277
Daniele Moro93feb022021-10-04 16:26:23 +0200278 main.step("Program and Verify PDRs and FARs via UP4 on ONOS 0")
Daniele Moro954e2282021-09-22 17:32:03 +0200279 up4_0.setup(main.Cluster.active(0).p4rtUp4, no_host=True)
280 up4_0.attachUes()
281 up4_0.verifyUp4Flow(onos_cli_0)
282 up4_0.teardown()
283
284 main.step("Verify PDRs and FARs number via UP4 P4RT on ONOS 1")
285 up4_1.setup(main.Cluster.active(1).p4rtUp4, no_host=True)
286 utilities.assert_equal(
287 expect=True,
288 actual=up4_1.verifyUesFlowNumberP4rt(),
289 onpass="Correct number of PDRs and FARs",
290 onfail="Wrong number of PDRs and FARs"
291 )
292 up4_1.teardown()
293
294 main.step("Verify PDRs and FARs number via UP4 P4RT on ONOS 2")
295 up4_2.setup(main.Cluster.active(2).p4rtUp4, no_host=True)
296 utilities.assert_equal(
297 expect=True,
298 actual=up4_2.verifyUesFlowNumberP4rt(),
299 onpass="Correct number of PDRs and FARs",
300 onfail="Wrong number of PDRs and FARs"
301 )
302
303 main.step("Verify all ONOS instances have the same number of flows")
304 onos_0_flow_count = onos_cli_0.checkFlowCount()
305 onos_1_flow_count = onos_cli_1.checkFlowCount()
306 onos_2_flow_count = onos_cli_2.checkFlowCount()
307 utilities.assert_equal(
308 expect=True,
309 actual=onos_0_flow_count == onos_1_flow_count == onos_2_flow_count,
310 onpass="All ONOS instances have the same number of flows",
311 onfail="ONOS instances have different number of flows: (%d, %d, %d)" % (
312 onos_0_flow_count, onos_1_flow_count, onos_2_flow_count)
313 )
314
Daniele Moro93feb022021-10-04 16:26:23 +0200315 main.step("Remove and Verify PDRs and FARs via UP4 on ONOS 2")
Daniele Moro954e2282021-09-22 17:32:03 +0200316 up4_2.detachUes()
317 up4_2.verifyNoUesFlow(onos_cli_2)
318
319 main.step("Verify no PDRs and FARs via UP4 P4RT on ONOS 2")
320 utilities.assert_equal(
321 expect=True,
322 actual=up4_2.verifyNoUesFlowNumberP4rt(),
323 onpass="No PDRs and FARs",
324 onfail="Stale PDRs and FARs"
325 )
326 up4_2.teardown()
327
328 main.step("Verify no PDRs and FARs via UP4 P4RT on ONOS 1")
329 up4_1.setup(main.Cluster.active(1).p4rtUp4, no_host=True)
330 utilities.assert_equal(
331 expect=True,
332 actual=up4_1.verifyNoUesFlowNumberP4rt(),
333 onpass="No PDRs and FARs",
334 onfail="Stale PDRs and FARs"
335 )
336 up4_1.teardown()
337
338 main.step("Verify no PDRs and FARs via UP4 P4RT on ONOS 0")
339 up4_0.setup(main.Cluster.active(0).p4rtUp4, no_host=True)
340 utilities.assert_equal(
341 expect=True,
342 actual=up4_0.verifyNoUesFlowNumberP4rt(),
343 onpass="No PDRs and FARs",
344 onfail="Stale PDRs and FARs"
345 )
346 up4_0.teardown()
347
348 main.step("Verify all ONOS instances have the same number of flows")
349 onos_0_flow_count = onos_cli_0.checkFlowCount()
350 onos_1_flow_count = onos_cli_1.checkFlowCount()
351 onos_2_flow_count = onos_cli_2.checkFlowCount()
352 utilities.assert_equal(
353 expect=True,
354 actual=onos_0_flow_count == onos_1_flow_count == onos_2_flow_count,
355 onpass="All ONOS instances have the same number of flows",
356 onfail="ONOS instances have different number of flows: (%d, %d, %d)" % (
Daniele Moroe1d05eb2021-09-23 19:52:30 +0200357 onos_0_flow_count, onos_1_flow_count, onos_2_flow_count)
Daniele Moro954e2282021-09-22 17:32:03 +0200358 )
359 run.cleanup(main)
Daniele Moroe1d05eb2021-09-23 19:52:30 +0200360
361 def CASE4(self, main):
362 main.case("Verify UP4 wipe-out after ONOS reboot")
363 """
364 Program PDRs/FARs
365 Kill ONOS POD
366 Verify PDRs/FARs from other ONOS instances
367 Remove PDRs/FARs
368 Wait/Verify ONOS is back
369 Verify no PDRs/FARs from rebooted instance
370 Re-program PDRs/FARs from rebooted instance
371 Verify all instances have same number of flows
372 Remove PDRs/FARs (cleanup)
373 """
374 try:
375 from tests.USECASE.SegmentRouting.dependencies.up4 import UP4
376 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
377 Testcaselib as run
378 except ImportError as e:
379 main.log.error("Import not found. Exiting the test")
380 main.log.error(e)
381 main.cleanAndExit()
382
383 run.initTest(main)
384 main.log.info(main.Cluster.numCtrls)
385 main.Cluster.setRunningNode(3)
386 run.installOnos(main, skipPackage=True, cliSleep=5)
387
388 onos_cli_0 = main.Cluster.active(0).CLI
389 onos_cli_1 = main.Cluster.active(1).CLI
390 onos_cli_2 = main.Cluster.active(2).CLI
391 kubectl_0 = main.Cluster.active(0).k8s
392
393 up4_0 = UP4()
394 up4_1 = UP4()
395 up4_2 = UP4()
396
Daniele Moro93feb022021-10-04 16:26:23 +0200397 main.step("Program and Verify PDRs and FARs via UP4 on ONOS 0")
Daniele Moroe1d05eb2021-09-23 19:52:30 +0200398 up4_0.setup(main.Cluster.active(0).p4rtUp4, no_host=True)
399 up4_0.attachUes()
400 up4_0.verifyUp4Flow(onos_cli_0)
401 up4_0.teardown()
402
403 onosPod = main.params["UP4_delete_pod"]
404 # Exit from previous port forwarding, because we need to restore
405 # port-forwarding after ONOS reboot.
406 kubectl_0.clearBuffer()
407 kubectl_0.exitFromProcess()
408 main.step("Kill " + onosPod)
409 utilities.assert_equal(
410 expect=main.TRUE,
411 actual=kubectl_0.kubectlDeletePod(
412 podName=onosPod,
413 kubeconfig=kubectl_0.kubeConfig,
414 namespace=main.params['kubernetes']['namespace']
415 ),
416 onpass="%s pod correctly deleted" % onosPod,
417 onfail="%s pod has not been deleted" % onosPod
418 )
419
420 main.step("Verify PDRs and FARs number via UP4 P4RT on ONOS 2")
421 up4_2.setup(main.Cluster.active(2).p4rtUp4, no_host=True)
422 utilities.assert_equal(
423 expect=True,
424 actual=up4_2.verifyUesFlowNumberP4rt(),
425 onpass="Correct number of PDRs and FARs",
426 onfail="Wrong number of PDRs and FARs"
427 )
428
Daniele Moro93feb022021-10-04 16:26:23 +0200429 main.step("Remove and Verify PDRs and FARs via UP4 on ONOS 2")
Daniele Moroe1d05eb2021-09-23 19:52:30 +0200430 up4_2.detachUes()
431 up4_2.verifyNoUesFlow(onos_cli_2)
432
433 main.step("Verify no PDRs and FARs via UP4 P4RT on ONOS 2")
434 utilities.assert_equal(
435 expect=True,
436 actual=up4_2.verifyNoUesFlowNumberP4rt(),
437 onpass="No PDRs and FARs",
438 onfail="Stale PDRs and FARs"
439 )
440 up4_2.teardown()
441
442 main.step("Verify ONOS 0 has restarted correctly")
443 onosStarted = utilities.retry(
444 f=kubectl_0.kubectlCheckPodReady,
445 retValue=main.FALSE,
446 kwargs={
447 "podName": onosPod,
448 "kubeconfig": kubectl_0.kubeConfig,
449 "namespace": main.params['kubernetes']['namespace']
450 },
451 sleep=10,
452 attempts=10
453 )
454 utilities.assert_equal(
455 expect=main.TRUE,
456 actual=onosStarted,
457 onpass="%s pod correctly restarted" % onosPod,
458 onfail="%s pod haven't restarted correctly" % onosPod
459 )
460
461 main.step("Verify ONOS cluster is in good shape")
462 # A bug in kubectl port forwarding doesn't terminate port-forwarding
463 # when the container changed, nor reconnect correctly to the restarted
464 # container.
465 # See: https://github.com/kubernetes/kubectl/issues/686
466 # Re-build the port-list for port forwarding
467 portList = "%s:%s " % (main.Cluster.active(0).CLI.karafPort, 8101)
468 portList += "%s:%s " % (main.Cluster.active(0).REST.port, 8181)
469 portList += "%s:%s " % (main.Cluster.active(0).p4rtUp4.p4rtPort,
470 main.ONOScell.up4Port)
471 kubectl_0.clearBuffer()
472 kubectl_0.kubectlPortForward(
473 onosPod,
474 portList,
475 kubectl_0.kubeConfig,
476 main.params['kubernetes']['namespace']
477 )
478 onos_cli_0.clearBuffer() # Trigger ONOS CLI reconnection
479 onosNodesStatus = utilities.retry(
480 f=main.Cluster.nodesCheck,
481 retValue=False,
482 sleep=5,
483 attempts=10
484 )
485 utilities.assert_equal(
486 expect=True,
487 actual=onosNodesStatus,
488 onpass="ONOS nodes status correct",
489 onfail="Wrong ONOS nodes status"
490 )
491
492 main.step("Verify no PDRs and FARs via UP4 P4RT on ONOS 0")
493 up4_0.setup(main.Cluster.active(0).p4rtUp4, no_host=True)
494 utilities.assert_equal(
495 expect=True,
496 actual=up4_0.verifyNoUesFlowNumberP4rt(),
497 onpass="No PDRs and FARs",
498 onfail="Stale PDRs and FARs"
499 )
500
501 main.step("Re-program PDRs and FARs via UP4 on ONOS 0 after restart")
502 up4_0.attachUes()
503 up4_0.verifyUp4Flow(onos_cli_0)
504 up4_0.teardown()
505
506 main.step("Verify PDRs and FARs via UP4 on ONOS 1")
507 up4_1.setup(main.Cluster.active(1).p4rtUp4, no_host=True)
508 up4_1.verifyUp4Flow(onos_cli_1)
509
510 main.step("Verify all ONOS instances have the same number of flows")
511 onos_0_flow_count = onos_cli_0.checkFlowCount()
512 onos_1_flow_count = onos_cli_1.checkFlowCount()
513 onos_2_flow_count = onos_cli_2.checkFlowCount()
514 utilities.assert_equal(
515 expect=True,
516 actual=onos_0_flow_count == onos_1_flow_count == onos_2_flow_count,
517 onpass="All ONOS instances have the same number of flows",
518 onfail="ONOS instances have different number of flows: (%d, %d, %d)" % (
519 onos_0_flow_count, onos_1_flow_count, onos_2_flow_count)
520 )
521
522 main.step("Cleanup PDRs and FARs via UP4 on ONOS 1")
523 up4_1.detachUes()
Daniele Moro6dfbfef2021-09-28 22:44:19 +0200524 up4_1.verifyNoUesFlow(onos_cli_1)
Daniele Moroe1d05eb2021-09-23 19:52:30 +0200525 up4_1.teardown()
526
527 run.cleanup(main)