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 | 8088956 | 2021-09-08 10:09:26 +0200 | [diff] [blame] | 31 | 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 Moro | bf53dec | 2021-09-13 18:11:56 +0200 | [diff] [blame] | 37 | main.step("Program PDRs and FARs via UP4") |
Daniele Moro | 8088956 | 2021-09-08 10:09:26 +0200 | [diff] [blame] | 38 | up4.attachUes() |
| 39 | |
Daniele Moro | bf53dec | 2021-09-13 18:11:56 +0200 | [diff] [blame] | 40 | main.step("Verify PDRs and FARs in ONOS") |
| 41 | up4.verifyUp4Flow(onos_cli) |
| 42 | |
Daniele Moro | 8088956 | 2021-09-08 10:09:26 +0200 | [diff] [blame] | 43 | # 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 Moro | bf53dec | 2021-09-13 18:11:56 +0200 | [diff] [blame] | 69 | main.step("Remove PDRs and FARs via UP4") |
Daniele Moro | 8088956 | 2021-09-08 10:09:26 +0200 | [diff] [blame] | 70 | up4.detachUes() |
| 71 | |
Daniele Moro | bf53dec | 2021-09-13 18:11:56 +0200 | [diff] [blame] | 72 | main.step("Verify removed PDRs and FARs from ONOS") |
| 73 | up4.verifyNoUesFlow(onos_cli) |
| 74 | |
Daniele Moro | 8088956 | 2021-09-08 10:09:26 +0200 | [diff] [blame] | 75 | main.step("Teardown") |
| 76 | trex.teardown() |
| 77 | up4.teardown() |
| 78 | run.cleanup(main) |