blob: 0dcbbd8444533b1f57fe1314e5f5ab51c79cdb6b [file] [log] [blame]
Daniele Moro790cc102021-08-30 18:27:30 +02001class UP4:
2
3 def __init__(self):
4 self.default = ''
5
6 # TODO: add test case that checks entries are being inserted and deleted from ONOS correclty
7 def CASE1(self, main):
8 """
9 Attach UE
10 Generate traffic from UE to PDN
11 Verify traffic received from PDN
12 Generate traffic from PDN to UE
13 Verify traffic received from UE
14 Detach UE
15 """
Daniele Moro790cc102021-08-30 18:27:30 +020016 try:
Daniele Moro80889562021-09-08 10:09:26 +020017 from tests.USECASE.SegmentRouting.dependencies.up4 import UP4
Daniele Moro790cc102021-08-30 18:27:30 +020018 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
19 Testcaselib as run
Daniele Moro790cc102021-08-30 18:27:30 +020020 except ImportError as e:
21 main.log.error("Import not found. Exiting the test")
22 main.log.error(e)
23 main.cleanAndExit()
24
Daniele Moro790cc102021-08-30 18:27:30 +020025 run.initTest(main)
26 main.log.info(main.Cluster.numCtrls)
27 main.Cluster.setRunningNode(3)
28 run.installOnos(main, skipPackage=True, cliSleep=5)
29
Daniele Moro790cc102021-08-30 18:27:30 +020030 main.step("Start scapy and p4rt client")
Daniele Moro80889562021-09-08 10:09:26 +020031 up4 = UP4()
32 # Get the P4RT client connected to UP4 in the first available ONOS instance
33 up4.setup(main.Cluster.active(0).p4rtUp4)
Daniele Moro790cc102021-08-30 18:27:30 +020034
Daniele Moro790cc102021-08-30 18:27:30 +020035 main.step("Attach UEs")
Daniele Moro80889562021-09-08 10:09:26 +020036 up4.attachUes()
Daniele Moro790cc102021-08-30 18:27:30 +020037
Daniele Moro80889562021-09-08 10:09:26 +020038 # ------- Test Upstream traffic (enb->pdn)
Daniele Moro790cc102021-08-30 18:27:30 +020039 main.step("Test upstream traffic")
Daniele Moro80889562021-09-08 10:09:26 +020040 up4.testUpstreamTraffic()
Daniele Moro790cc102021-08-30 18:27:30 +020041
Daniele Moro80889562021-09-08 10:09:26 +020042 # ------- Test Downstream traffic (pdn->enb)
Daniele Moro790cc102021-08-30 18:27:30 +020043 main.step("Test downstream traffic")
Daniele Moro80889562021-09-08 10:09:26 +020044 up4.testDownstreamTraffic()
Daniele Moro790cc102021-08-30 18:27:30 +020045
Daniele Moro790cc102021-08-30 18:27:30 +020046 main.step("Detach UEs")
Daniele Moro80889562021-09-08 10:09:26 +020047 up4.detachUes()
Daniele Moro790cc102021-08-30 18:27:30 +020048
Daniele Moro790cc102021-08-30 18:27:30 +020049 main.step("Stop scapy and p4rt client")
Daniele Moro80889562021-09-08 10:09:26 +020050 up4.teardown()
Daniele Moro790cc102021-08-30 18:27:30 +020051 run.cleanup(main)