Daniele Moro | 8088956 | 2021-09-08 10:09:26 +0200 | [diff] [blame] | 1 | class QOS: |
| 2 | |
| 3 | def __init__(self): |
| 4 | self.default = '' |
| 5 | |
| 6 | def CASE1(self, main): |
Daniele Moro | 812daee | 2021-10-04 16:28:26 +0200 | [diff] [blame] | 7 | main.case("Leaf-Edge with Mobile Traffic Classification") |
Daniele Moro | 8088956 | 2021-09-08 10:09:26 +0200 | [diff] [blame] | 8 | # 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 Moro | bf53dec | 2021-09-13 18:11:56 +0200 | [diff] [blame] | 29 | # Use the first available ONOS instance CLI |
| 30 | onos_cli = main.Cluster.active(0).CLI |
Daniele Moro | 9ba5cf0 | 2021-10-08 18:00:56 +0200 | [diff] [blame^] | 31 | initial_flow_count = onos_cli.checkFlowCount() |
Daniele Moro | 8088956 | 2021-09-08 10:09:26 +0200 | [diff] [blame] | 32 | up4 = UP4() |
| 33 | trex = Trex() |
| 34 | # Get the P4RT client connected to UP4 in the first available ONOS instance |
| 35 | up4.setup(main.Cluster.active(0).p4rtUp4) |
| 36 | trex.setup(main.TRexClient) |
| 37 | |
Daniele Moro | bf53dec | 2021-09-13 18:11:56 +0200 | [diff] [blame] | 38 | main.step("Program PDRs and FARs via UP4") |
Daniele Moro | 8088956 | 2021-09-08 10:09:26 +0200 | [diff] [blame] | 39 | up4.attachUes() |
| 40 | |
Daniele Moro | bf53dec | 2021-09-13 18:11:56 +0200 | [diff] [blame] | 41 | main.step("Verify PDRs and FARs in ONOS") |
| 42 | up4.verifyUp4Flow(onos_cli) |
| 43 | |
Daniele Moro | 9ba5cf0 | 2021-10-08 18:00:56 +0200 | [diff] [blame^] | 44 | run.checkFlows( |
| 45 | main, |
| 46 | minFlowCount=initial_flow_count+(len(up4.emulated_ues)*2) |
| 47 | ) |
| 48 | |
Daniele Moro | 8088956 | 2021-09-08 10:09:26 +0200 | [diff] [blame] | 49 | # Load traffic config for the current test case |
| 50 | main.step("Load test JSON config") |
| 51 | cfgFile = main.configPath + "/tests/" + "leaf_edge_mobile.json" |
| 52 | with open(cfgFile) as cfg: |
| 53 | testCfg = json.load(cfg) |
| 54 | |
| 55 | main.step("Send traffic with TRex") |
| 56 | for flow in testCfg["flows"]: |
| 57 | trex.createFlow(flow) |
| 58 | trex.sendAndReceiveTraffic(testCfg["duration"]) |
| 59 | |
| 60 | main.step("Log port and flow stats") |
| 61 | trex.logPortStats() |
| 62 | for flow in testCfg["flows"]: |
| 63 | trex.logFlowStats(flow) |
| 64 | |
| 65 | # Assert Flow Stats |
| 66 | for flow in testCfg["flows"]: |
| 67 | if trex.isFlowStats(flow): |
| 68 | main.step("{}: Assert RX Packets".format(flow)) |
| 69 | trex.assertRxPackets(flow) |
| 70 | main.step("{}: Assert Dropped Packets".format(flow)) |
| 71 | trex.assertDroppedPacket(flow) |
| 72 | main.step("{}: Assert 99.9 Percentile Latency".format(flow)) |
| 73 | trex.assert99_9PercentileLatency(flow) |
| 74 | |
Daniele Moro | bf53dec | 2021-09-13 18:11:56 +0200 | [diff] [blame] | 75 | main.step("Remove PDRs and FARs via UP4") |
Daniele Moro | 8088956 | 2021-09-08 10:09:26 +0200 | [diff] [blame] | 76 | up4.detachUes() |
| 77 | |
Daniele Moro | bf53dec | 2021-09-13 18:11:56 +0200 | [diff] [blame] | 78 | main.step("Verify removed PDRs and FARs from ONOS") |
| 79 | up4.verifyNoUesFlow(onos_cli) |
| 80 | |
Daniele Moro | 9ba5cf0 | 2021-10-08 18:00:56 +0200 | [diff] [blame^] | 81 | run.checkFlows(main, minFlowCount=initial_flow_count) |
| 82 | |
Daniele Moro | 8088956 | 2021-09-08 10:09:26 +0200 | [diff] [blame] | 83 | main.step("Teardown") |
| 84 | trex.teardown() |
| 85 | up4.teardown() |
| 86 | run.cleanup(main) |