blob: 315328f3c8551f8097093772c9c5b382dceddb71 [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):
Daniele Moro812daee2021-10-04 16:28:26 +02007 main.case("Leaf-Edge with Mobile Traffic Classification")
Daniele Moro80889562021-09-08 10:09:26 +02008 # Leaf-Edge-Mobile
9 # Attach 2 UEs with different QFI
10 # Generate traffic with Trex for the two UEs
11 # --> no packet drop on RT flow, reasonable latency on RT flow
12 try:
13 from tests.USECASE.SegmentRouting.dependencies.up4 import UP4
14 from tests.USECASE.SegmentRouting.dependencies.trex import Trex
15 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
16 Testcaselib as run
17 import json
18 except ImportError as e:
19 main.log.error("Import not found. Exiting the test")
20 main.log.error(e)
21 main.cleanAndExit()
22
23 run.initTest(main)
24 main.log.info(main.Cluster.numCtrls)
25 main.Cluster.setRunningNode(3)
26 run.installOnos(main, skipPackage=True, cliSleep=5)
27
28 main.step("Start P4rt client and setup TRex")
Daniele Morobf53dec2021-09-13 18:11:56 +020029 # Use the first available ONOS instance CLI
30 onos_cli = main.Cluster.active(0).CLI
Daniele Moro80889562021-09-08 10:09:26 +020031 up4 = UP4()
32 trex = Trex()
33 # Get the P4RT client connected to UP4 in the first available ONOS instance
34 up4.setup(main.Cluster.active(0).p4rtUp4)
35 trex.setup(main.TRexClient)
36
Daniele Morobf53dec2021-09-13 18:11:56 +020037 main.step("Program PDRs and FARs via UP4")
Daniele Moro80889562021-09-08 10:09:26 +020038 up4.attachUes()
39
Daniele Morobf53dec2021-09-13 18:11:56 +020040 main.step("Verify PDRs and FARs in ONOS")
41 up4.verifyUp4Flow(onos_cli)
42
Daniele Moro80889562021-09-08 10:09:26 +020043 # Load traffic config for the current test case
44 main.step("Load test JSON config")
45 cfgFile = main.configPath + "/tests/" + "leaf_edge_mobile.json"
46 with open(cfgFile) as cfg:
47 testCfg = json.load(cfg)
48
49 main.step("Send traffic with TRex")
50 for flow in testCfg["flows"]:
51 trex.createFlow(flow)
52 trex.sendAndReceiveTraffic(testCfg["duration"])
53
54 main.step("Log port and flow stats")
55 trex.logPortStats()
56 for flow in testCfg["flows"]:
57 trex.logFlowStats(flow)
58
59 # Assert Flow Stats
60 for flow in testCfg["flows"]:
61 if trex.isFlowStats(flow):
62 main.step("{}: Assert RX Packets".format(flow))
63 trex.assertRxPackets(flow)
64 main.step("{}: Assert Dropped Packets".format(flow))
65 trex.assertDroppedPacket(flow)
66 main.step("{}: Assert 99.9 Percentile Latency".format(flow))
67 trex.assert99_9PercentileLatency(flow)
68
Daniele Morobf53dec2021-09-13 18:11:56 +020069 main.step("Remove PDRs and FARs via UP4")
Daniele Moro80889562021-09-08 10:09:26 +020070 up4.detachUes()
71
Daniele Morobf53dec2021-09-13 18:11:56 +020072 main.step("Verify removed PDRs and FARs from ONOS")
73 up4.verifyNoUesFlow(onos_cli)
74
Daniele Moro80889562021-09-08 10:09:26 +020075 main.step("Teardown")
76 trex.teardown()
77 up4.teardown()
78 run.cleanup(main)