blob: df535c5016197d7c86f9224fbcba86b742a9cd15 [file] [log] [blame]
Daniele Moro80889562021-09-08 10:09:26 +02001class QOS:
2
3 def __init__(self):
4 self.default = ''
5
6 def CASE1(self, main):
7 # Leaf-Edge-Mobile
8 # Attach 2 UEs with different QFI
9 # Generate traffic with Trex for the two UEs
10 # --> no packet drop on RT flow, reasonable latency on RT flow
11 try:
12 from tests.USECASE.SegmentRouting.dependencies.up4 import UP4
13 from tests.USECASE.SegmentRouting.dependencies.trex import Trex
14 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
15 Testcaselib as run
16 import json
17 except ImportError as e:
18 main.log.error("Import not found. Exiting the test")
19 main.log.error(e)
20 main.cleanAndExit()
21
22 run.initTest(main)
23 main.log.info(main.Cluster.numCtrls)
24 main.Cluster.setRunningNode(3)
25 run.installOnos(main, skipPackage=True, cliSleep=5)
26
27 main.step("Start P4rt client and setup TRex")
Daniele Morobf53dec2021-09-13 18:11:56 +020028 # Use the first available ONOS instance CLI
29 onos_cli = main.Cluster.active(0).CLI
Daniele Moro80889562021-09-08 10:09:26 +020030 up4 = UP4()
31 trex = Trex()
32 # Get the P4RT client connected to UP4 in the first available ONOS instance
33 up4.setup(main.Cluster.active(0).p4rtUp4)
34 trex.setup(main.TRexClient)
35
Daniele Morobf53dec2021-09-13 18:11:56 +020036 main.step("Program PDRs and FARs via UP4")
Daniele Moro80889562021-09-08 10:09:26 +020037 up4.attachUes()
38
Daniele Morobf53dec2021-09-13 18:11:56 +020039 main.step("Verify PDRs and FARs in ONOS")
40 up4.verifyUp4Flow(onos_cli)
41
Daniele Moro80889562021-09-08 10:09:26 +020042 # Load traffic config for the current test case
43 main.step("Load test JSON config")
44 cfgFile = main.configPath + "/tests/" + "leaf_edge_mobile.json"
45 with open(cfgFile) as cfg:
46 testCfg = json.load(cfg)
47
48 main.step("Send traffic with TRex")
49 for flow in testCfg["flows"]:
50 trex.createFlow(flow)
51 trex.sendAndReceiveTraffic(testCfg["duration"])
52
53 main.step("Log port and flow stats")
54 trex.logPortStats()
55 for flow in testCfg["flows"]:
56 trex.logFlowStats(flow)
57
58 # Assert Flow Stats
59 for flow in testCfg["flows"]:
60 if trex.isFlowStats(flow):
61 main.step("{}: Assert RX Packets".format(flow))
62 trex.assertRxPackets(flow)
63 main.step("{}: Assert Dropped Packets".format(flow))
64 trex.assertDroppedPacket(flow)
65 main.step("{}: Assert 99.9 Percentile Latency".format(flow))
66 trex.assert99_9PercentileLatency(flow)
67
Daniele Morobf53dec2021-09-13 18:11:56 +020068 main.step("Remove PDRs and FARs via UP4")
Daniele Moro80889562021-09-08 10:09:26 +020069 up4.detachUes()
70
Daniele Morobf53dec2021-09-13 18:11:56 +020071 main.step("Verify removed PDRs and FARs from ONOS")
72 up4.verifyNoUesFlow(onos_cli)
73
Daniele Moro80889562021-09-08 10:09:26 +020074 main.step("Teardown")
75 trex.teardown()
76 up4.teardown()
77 run.cleanup(main)