summaryrefslogtreecommitdiffstats
path: root/test/test_ipip.py
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-05-26 11:34:27 -0700
committerOle Trøan <otroan@employees.org>2019-05-27 13:18:05 +0000
commitcbd0824d6cec24ea2502ffdcdb1666d090f848cf (patch)
tree488c969f7c7429e07d159cdec229e8f362ad1fdc /test/test_ipip.py
parentbbd6b746e09cc4ae4239173081d95349e0263759 (diff)
IPIP tunnel: use address types on API
Change-Id: Ida6a8f96bd858246e993250087bed45e7084ede1 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'test/test_ipip.py')
-rw-r--r--test/test_ipip.py46
1 files changed, 25 insertions, 21 deletions
diff --git a/test/test_ipip.py b/test/test_ipip.py
index 137e3c54dff..6f1d3b883c0 100644
--- a/test/test_ipip.py
+++ b/test/test_ipip.py
@@ -17,6 +17,19 @@ IPIP tests.
"""
+def ipip_add_tunnel(test, src, dst, table_id=0, tc_tos=0xff):
+ """ Add a IPIP tunnel """
+ return test.vapi.ipip_add_tunnel(
+ tunnel={
+ 'src': src,
+ 'dst': dst,
+ 'table_id': table_id,
+ 'instance': 0xffffffff,
+ 'tc_tos': tc_tos
+ }
+ )
+
+
class TestIPIP(VppTestCase):
""" IPIP Test Case """
@@ -71,10 +84,10 @@ class TestIPIP(VppTestCase):
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, tc_tos=0xFF)
+ rv = ipip_add_tunnel(self,
+ self.pg0.local_ip4,
+ self.pg1.remote_ip4,
+ tc_tos=0xFF)
sw_if_index = rv.sw_if_index
# Set interface up and enable IP on it
@@ -226,9 +239,7 @@ class TestIPIP(VppTestCase):
def test_ipip_create(self):
""" ipip create / delete interface test """
- rv = self.vapi.ipip_add_tunnel(
- src_address=inet_pton(AF_INET, '1.2.3.4'),
- dst_address=inet_pton(AF_INET, '2.3.4.5'), is_ipv6=0)
+ rv = ipip_add_tunnel(self, '1.2.3.4', '2.3.4.5')
sw_if_index = rv.sw_if_index
self.vapi.ipip_del_tunnel(sw_if_index)
@@ -237,10 +248,7 @@ class TestIPIP(VppTestCase):
t = VppIpTable(self, 20)
t.add_vpp_config()
- rv = self.vapi.ipip_add_tunnel(
- src_address=inet_pton(AF_INET, '1.2.3.4'),
- dst_address=inet_pton(AF_INET, '2.3.4.5'), is_ipv6=0,
- table_id=20)
+ rv = ipip_add_tunnel(self, '1.2.3.4', '2.3.4.5', table_id=20)
sw_if_index = rv.sw_if_index
self.vapi.ipip_del_tunnel(sw_if_index)
@@ -283,9 +291,10 @@ class TestIPIP6(VppTestCase):
def setup_tunnel(self):
# IPv6 transport
- rv = self.vapi.ipip_add_tunnel(
- src_address=self.pg0.local_ip6n,
- dst_address=self.pg1.remote_ip6n, tc_tos=255)
+ rv = ipip_add_tunnel(self,
+ self.pg0.local_ip6,
+ self.pg1.remote_ip6,
+ tc_tos=255)
sw_if_index = rv.sw_if_index
self.tunnel_if_index = sw_if_index
@@ -502,9 +511,7 @@ class TestIPIP6(VppTestCase):
def test_ipip_create(self):
""" ipip create / delete interface test """
- rv = self.vapi.ipip_add_tunnel(
- src_address=inet_pton(AF_INET, '1.2.3.4'),
- dst_address=inet_pton(AF_INET, '2.3.4.5'), is_ipv6=0)
+ rv = ipip_add_tunnel(self, '1.2.3.4', '2.3.4.5')
sw_if_index = rv.sw_if_index
self.vapi.ipip_del_tunnel(sw_if_index)
@@ -513,10 +520,7 @@ class TestIPIP6(VppTestCase):
t = VppIpTable(self, 20)
t.add_vpp_config()
- rv = self.vapi.ipip_add_tunnel(
- src_address=inet_pton(AF_INET, '1.2.3.4'),
- dst_address=inet_pton(AF_INET, '2.3.4.5'), is_ipv6=0,
- table_id=20)
+ rv = ipip_add_tunnel(self, '1.2.3.4', '2.3.4.5', table_id=20)
sw_if_index = rv.sw_if_index
self.vapi.ipip_del_tunnel(sw_if_index)