diff options
author | Ole Troan <ot@cisco.com> | 2018-05-24 13:21:43 +0200 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2018-05-25 00:11:30 +0000 |
commit | d57f63698f99fad0288ac040d83b3ecd380d4bfd (patch) | |
tree | 863864e2228e611fc357e9049e44e13416253b82 /test | |
parent | ada24ea7012448b75d57ab87a6b7796c55bc44f5 (diff) |
VPP-1277: IPIP - Copy TOS/TC from inner packet to outer.
Add support for either copying TOS/TC from inner packet to outer,
or set to fixed value.
Change-Id: I716a95f875349acec94317b266c8cf9f2f81a785
Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/test_ipip.py | 35 | ||||
-rw-r--r-- | test/vpp_papi_provider.py | 5 |
2 files changed, 22 insertions, 18 deletions
diff --git a/test/test_ipip.py b/test/test_ipip.py index 3a0c401f8af..00721ec90a0 100644 --- a/test/test_ipip.py +++ b/test/test_ipip.py @@ -47,15 +47,15 @@ class TestIPIP(VppTestCase): def test_ipip4(self): """ ip{v4,v6} over ip4 test """ p_ether = Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac) - p_ip6 = IPv6(src="1::1", dst="DEAD::1", nh='UDP') - p_ip4 = IP(src="1.2.3.4", dst="130.67.0.1") + p_ip6 = IPv6(src="1::1", dst="DEAD::1", nh='UDP', tc=42) + p_ip4 = IP(src="1.2.3.4", dst="130.67.0.1", tos=42) p_payload = UDP(sport=1234, dport=1234) # IPv4 transport rv = self.vapi.ipip_add_tunnel( src_address=self.pg0.local_ip4n, dst_address=self.pg1.remote_ip4n, - is_ipv6=0) + is_ipv6=0, tc_tos=0xFF) sw_if_index = rv.sw_if_index # Set interface up and enable IP on it @@ -84,7 +84,7 @@ class TestIPIP(VppTestCase): p_inner_ip6 = p_ip6 p_inner_ip6.hlim -= 1 p6_reply = (IP(src=self.pg0.local_ip4, dst=self.pg1.remote_ip4, - proto='ipv6', id=0) / p_inner_ip6 / p_payload) + proto='ipv6', id=0, tos=42) / p_inner_ip6 / p_payload) p6_reply.ttl -= 1 rx = self.send_and_expect(self.pg0, p6*10, self.pg1) for p in rx: @@ -94,8 +94,9 @@ class TestIPIP(VppTestCase): p4 = (p_ether / p_ip4 / p_payload) p_ip4_inner = p_ip4 p_ip4_inner.ttl -= 1 - p4_reply = (IP(src=self.pg0.local_ip4, - dst=self.pg1.remote_ip4) / p_ip4_inner / p_payload) + p4_reply = (IP(src=self.pg0.local_ip4, dst=self.pg1.remote_ip4, + tos=42) / + p_ip4_inner / p_payload) p4_reply.ttl -= 1 p4_reply.id = 0 rx = self.send_and_expect(self.pg0, p4*10, self.pg1) @@ -128,14 +129,14 @@ class TestIPIP(VppTestCase): def test_ipip6(self): """ ip{v4,v6} over ip6 test """ p_ether = Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac) - p_ip6 = IPv6(src="1::1", dst="DEAD::1", nh='UDP') - p_ip4 = IP(src="1.2.3.4", dst="130.67.0.1") + p_ip6 = IPv6(src="1::1", dst="DEAD::1", tc=42, nh='UDP') + p_ip4 = IP(src="1.2.3.4", dst="130.67.0.1", tos=42) p_payload = UDP(sport=1234, dport=1234) # IPv6 transport rv = self.vapi.ipip_add_tunnel( src_address=self.pg0.local_ip6n, - dst_address=self.pg1.remote_ip6n) + dst_address=self.pg1.remote_ip6n, tc_tos=255) sw_if_index = rv.sw_if_index @@ -162,19 +163,21 @@ class TestIPIP(VppTestCase): # IPv6 in to IPv6 tunnel p6 = (p_ether / p_ip6 / p_payload) - p6_reply = (IPv6(src=self.pg0.local_ip6, - dst=self.pg1.remote_ip6, hlim=63) / p_ip6 / p_payload) + p6_reply = (IPv6(src=self.pg0.local_ip6, dst=self.pg1.remote_ip6, + hlim=63, tc=42) / + p_ip6 / p_payload) p6_reply[1].hlim -= 1 - rx = self.send_and_expect(self.pg0, p6*10, self.pg1) + rx = self.send_and_expect(self.pg0, p6*11, self.pg1) for p in rx: self.validate(p[1], p6_reply) # IPv4 in to IPv6 tunnel p4 = (p_ether / p_ip4 / p_payload) p4_reply = (IPv6(src=self.pg0.local_ip6, - dst=self.pg1.remote_ip6, hlim=63) / p_ip4 / p_payload) + dst=self.pg1.remote_ip6, hlim=63, tc=42) / + p_ip4 / p_payload) p4_reply[1].ttl -= 1 - rx = self.send_and_expect(self.pg0, p4*10, self.pg1) + rx = self.send_and_expect(self.pg0, p4*11, self.pg1) for p in rx: self.validate(p[1], p4_reply) @@ -188,7 +191,7 @@ class TestIPIP(VppTestCase): dst=self.pg0.local_ip6) / p_ip4 / p_payload) p4_reply = (p_ip4 / p_payload) p4_reply.ttl -= 1 - rx = self.send_and_expect(self.pg1, p4*10, self.pg0) + rx = self.send_and_expect(self.pg1, p4*11, self.pg0) for p in rx: self.validate(p[1], p4_reply) @@ -198,7 +201,7 @@ class TestIPIP(VppTestCase): dst=self.pg0.local_ip6) / p_ip6 / p_payload) p6_reply = (p_ip6 / p_payload) p6_reply.hlim = 63 - rx = self.send_and_expect(self.pg1, p6*10, self.pg0) + rx = self.send_and_expect(self.pg1, p6*11, self.pg0) for p in rx: self.validate(p[1], p6_reply) diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py index 105a54f55d9..f72d37df7b2 100644 --- a/test/vpp_papi_provider.py +++ b/test/vpp_papi_provider.py @@ -3359,14 +3359,15 @@ class VppPapiProvider(object): {'sw_if_index': sw_if_index}) def ipip_add_tunnel(self, src_address, dst_address, is_ipv6=1, - instance=0xFFFFFFFF, fib_index=0): + instance=0xFFFFFFFF, fib_index=0, tc_tos=0): """ IPIP tunnel Add/Del """ return self.api(self.papi.ipip_add_tunnel, {'is_ipv6': is_ipv6, 'instance': instance, 'src_address': src_address, 'dst_address': dst_address, - 'fib_index': fib_index}) + 'fib_index': fib_index, + 'tc_tos': tc_tos}) def ipip_del_tunnel(self, sw_if_index): """ IPIP tunnel Delete """ |