summaryrefslogtreecommitdiffstats
path: root/src/plugins/srv6-mobile/test/test_srv6_end.py
diff options
context:
space:
mode:
authorTetsuya Murakami <tetsuya.mrk@gmail.com>2020-03-04 16:27:14 -0800
committerDamjan Marion <dmarion@me.com>2020-03-21 12:49:12 +0000
commit9e722bd466383dd53b10d4c1de95ad18db939147 (patch)
treef870d7ad6b974798ac26a0b1580a67b2f61f12a7 /src/plugins/srv6-mobile/test/test_srv6_end.py
parent7a6f5a4fee17bd34f70f9eb25a094764be39d81b (diff)
srv6-mobile: Support GTP4/6.DT and User Plane message mapping
Support the following new features in srv6-mobile. 1. GTP4.DT 2. GTP6.DT 3. User Plane Message encoding based on draft-murakami-dmm-user-plane-message-encoding-01 4. Add SRv6 mobile test cases Type: feature Signed-off-by: Tetsuya Murakami <tetsuya.mrk@gmail.com> Change-Id: I890e5171bf03513d54b4830f01b9dc7f47fe7c48 Signed-off-by: Tetsuya Murakami <tetsuya.mrk@gmail.com>
Diffstat (limited to 'src/plugins/srv6-mobile/test/test_srv6_end.py')
-rw-r--r--src/plugins/srv6-mobile/test/test_srv6_end.py160
1 files changed, 0 insertions, 160 deletions
diff --git a/src/plugins/srv6-mobile/test/test_srv6_end.py b/src/plugins/srv6-mobile/test/test_srv6_end.py
deleted file mode 100644
index 9eb62c9ce33..00000000000
--- a/src/plugins/srv6-mobile/test/test_srv6_end.py
+++ /dev/null
@@ -1,160 +0,0 @@
-#!/usr/bin/env python
-
-from framework import VppTestCase
-from ipaddress import IPv4Address
-from ipaddress import IPv6Address
-from scapy.contrib.gtp import *
-from scapy.all import *
-
-
-class TestSRv6EndMGTP4E(VppTestCase):
- """ SRv6 End.M.GTP4.E (SRv6 -> GTP-U) """
-
- @classmethod
- def setUpClass(cls):
- super(TestSRv6EndMGTP4E, cls).setUpClass()
- try:
- cls.create_pg_interfaces(range(2))
- cls.pg_if_i = cls.pg_interfaces[0]
- cls.pg_if_o = cls.pg_interfaces[1]
-
- cls.pg_if_i.config_ip6()
- cls.pg_if_o.config_ip4()
-
- cls.ip4_dst = cls.pg_if_o.remote_ip4
- # cls.ip4_src = cls.pg_if_o.local_ip4
- cls.ip4_src = "192.168.192.10"
-
- for pg_if in cls.pg_interfaces:
- pg_if.admin_up()
- pg_if.resolve_arp()
-
- except Exception:
- super(TestSRv6EndMGTP4E, cls).tearDownClass()
- raise
-
- def create_packets(self, inner):
-
- ip4_dst = IPv4Address(str(self.ip4_dst))
- # 32bit prefix + 32bit IPv4 DA + 8bit + 32bit TEID + 24bit
- dst = b'\xaa' * 4 + ip4_dst.packed + \
- b'\x11' + b'\xbb' * 4 + b'\x11' * 3
- ip6_dst = IPv6Address(dst)
-
- ip4_src = IPv4Address(str(self.ip4_src))
- # 64bit prefix + 32bit IPv4 SA + 16 bit port + 16bit
- src = b'\xcc' * 8 + ip4_src.packed + \
- b'\xdd' * 2 + b'\x11' * 2
- ip6_src = IPv6Address(src)
-
- self.logger.info("ip4 dst: {}".format(ip4_dst))
- self.logger.info("ip4 src: {}".format(ip4_src))
- self.logger.info("ip6 dst (remote srgw): {}".format(ip6_dst))
- self.logger.info("ip6 src (local srgw): {}".format(ip6_src))
-
- pkts = list()
- for d, s in inner:
- pkt = (Ether() /
- IPv6(dst=str(ip6_dst), src=str(ip6_src)) /
- IPv6ExtHdrSegmentRouting() /
- IPv6(dst=d, src=s) /
- UDP(sport=1000, dport=23))
- self.logger.info(pkt.show2(dump=True))
- pkts.append(pkt)
-
- return pkts
-
- def test_srv6_end(self):
- """ test_srv6_end """
- pkts = self.create_packets([("A::1", "B::1"), ("C::1", "D::1")])
-
- self.vapi.cli(
- "sr localsid address {} behavior end.m.gtp4.e v4src_position 64"
- .format(pkts[0]['IPv6'].dst))
- self.logger.info(self.vapi.cli("show sr localsids"))
-
- self.vapi.cli("clear errors")
-
- self.pg0.add_stream(pkts)
- self.pg_enable_capture(self.pg_interfaces)
- self.pg_start()
-
- self.logger.info(self.vapi.cli("show errors"))
- self.logger.info(self.vapi.cli("show int address"))
-
- capture = self.pg1.get_capture(len(pkts))
-
- for pkt in capture:
- self.logger.info(pkt.show2(dump=True))
- self.assertEqual(pkt[IP].dst, self.ip4_dst)
- self.assertEqual(pkt[IP].src, self.ip4_src)
- self.assertEqual(pkt[GTP_U_Header].teid, 0xbbbbbbbb)
-
-
-class TestSRv6TMTmap(VppTestCase):
- """ SRv6 T.M.Tmap (GTP-U -> SRv6) """
-
- @classmethod
- def setUpClass(cls):
- super(TestSRv6TMTmap, cls).setUpClass()
- try:
- cls.create_pg_interfaces(range(2))
- cls.pg_if_i = cls.pg_interfaces[0]
- cls.pg_if_o = cls.pg_interfaces[1]
-
- cls.pg_if_i.config_ip4()
- cls.pg_if_o.config_ip6()
-
- for pg_if in cls.pg_interfaces:
- pg_if.admin_up()
- pg_if.resolve_arp()
-
- except Exception:
- super(TestSRv6TMTmap, cls).tearDownClass()
- raise
-
-
-class TestSRv6EndMGTP6E(VppTestCase):
- """ SRv6 End.M.GTP6.E """
-
- @classmethod
- def setUpClass(cls):
- super(TestSRv6EndMGTP6E, cls).setUpClass()
- try:
- cls.create_pg_interfaces(range(2))
- cls.pg_if_i = cls.pg_interfaces[0]
- cls.pg_if_o = cls.pg_interfaces[1]
-
- cls.pg_if_i.config_ip4()
- cls.pg_if_o.config_ip6()
-
- for pg_if in cls.pg_interfaces:
- pg_if.admin_up()
- pg_if.resolve_arp()
-
- except Exception:
- super(TestSRv6EndMGTP6E, cls).tearDownClass()
- raise
-
-
-class TestSRv6EndMGTP6D(VppTestCase):
- """ SRv6 End.M.GTP6.D """
-
- @classmethod
- def setUpClass(cls):
- super(TestSRv6EndMGTP6D, cls).setUpClass()
- try:
- cls.create_pg_interfaces(range(2))
- cls.pg_if_i = cls.pg_interfaces[0]
- cls.pg_if_o = cls.pg_interfaces[1]
-
- cls.pg_if_i.config_ip4()
- cls.pg_if_o.config_ip6()
-
- for pg_if in cls.pg_interfaces:
- pg_if.admin_up()
- pg_if.resolve_arp()
-
- except Exception:
- super(TestSRv6EndMGTP6D, cls).tearDownClass()
- raise