summaryrefslogtreecommitdiffstats
path: root/test/test_ipip.py
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2018-05-24 13:21:43 +0200
committerNeale Ranns <nranns@cisco.com>2018-05-25 00:11:30 +0000
commitd57f63698f99fad0288ac040d83b3ecd380d4bfd (patch)
tree863864e2228e611fc357e9049e44e13416253b82 /test/test_ipip.py
parentada24ea7012448b75d57ab87a6b7796c55bc44f5 (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/test_ipip.py')
-rw-r--r--test/test_ipip.py35
1 files changed, 19 insertions, 16 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)