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): |
| 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") |
| 28 | up4 = UP4() |
| 29 | trex = Trex() |
| 30 | # Get the P4RT client connected to UP4 in the first available ONOS instance |
| 31 | up4.setup(main.Cluster.active(0).p4rtUp4) |
| 32 | trex.setup(main.TRexClient) |
| 33 | |
| 34 | main.step("Attach UEs") |
| 35 | up4.attachUes() |
| 36 | |
| 37 | # Load traffic config for the current test case |
| 38 | main.step("Load test JSON config") |
| 39 | cfgFile = main.configPath + "/tests/" + "leaf_edge_mobile.json" |
| 40 | with open(cfgFile) as cfg: |
| 41 | testCfg = json.load(cfg) |
| 42 | |
| 43 | main.step("Send traffic with TRex") |
| 44 | for flow in testCfg["flows"]: |
| 45 | trex.createFlow(flow) |
| 46 | trex.sendAndReceiveTraffic(testCfg["duration"]) |
| 47 | |
| 48 | main.step("Log port and flow stats") |
| 49 | trex.logPortStats() |
| 50 | for flow in testCfg["flows"]: |
| 51 | trex.logFlowStats(flow) |
| 52 | |
| 53 | # Assert Flow Stats |
| 54 | for flow in testCfg["flows"]: |
| 55 | if trex.isFlowStats(flow): |
| 56 | main.step("{}: Assert RX Packets".format(flow)) |
| 57 | trex.assertRxPackets(flow) |
| 58 | main.step("{}: Assert Dropped Packets".format(flow)) |
| 59 | trex.assertDroppedPacket(flow) |
| 60 | main.step("{}: Assert 99.9 Percentile Latency".format(flow)) |
| 61 | trex.assert99_9PercentileLatency(flow) |
| 62 | |
| 63 | main.step("Detach UEs") |
| 64 | up4.detachUes() |
| 65 | |
| 66 | main.step("Teardown") |
| 67 | trex.teardown() |
| 68 | up4.teardown() |
| 69 | run.cleanup(main) |