aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_vxlan_gpe.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_vxlan_gpe.py')
-rw-r--r--test/test_vxlan_gpe.py38
1 files changed, 18 insertions, 20 deletions
diff --git a/test/test_vxlan_gpe.py b/test/test_vxlan_gpe.py
index 3d6e26024c9..5c3ac16640c 100644
--- a/test/test_vxlan_gpe.py
+++ b/test/test_vxlan_gpe.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
import socket
-from util import ip4n_range, ip4_range
+from util import ip4_range
import unittest
from framework import VppTestCase, VppTestRunner, running_extended_tests
from template_bd import BridgeDomain
@@ -10,8 +10,10 @@ from scapy.layers.l2 import Ether
from scapy.packet import Raw
from scapy.layers.inet import IP, UDP
from scapy.layers.vxlan import VXLAN
-from scapy.utils import atol
+
+import util
from vpp_ip_route import VppIpRoute, VppRoutePath
+
from vpp_ip import INVALID_INDEX
@@ -95,11 +97,10 @@ class TestVxlanGpe(BridgeDomain, VppTestCase):
INVALID_INDEX)],
register=False)
rip.add_vpp_config()
- dest_ip4n = socket.inet_pton(socket.AF_INET, dest_ip4)
r = cls.vapi.vxlan_gpe_add_del_tunnel(
- src_addr=cls.pg0.local_ip4n,
- dst_addr=dest_ip4n,
+ src_addr=cls.pg0.local_ip4,
+ dst_addr=dest_ip4,
vni=vni)
cls.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=r.sw_if_index,
bd_id=vni)
@@ -115,8 +116,8 @@ class TestVxlanGpe(BridgeDomain, VppTestCase):
vni_end = vni_start + n_shared_dst_tunnels
for vni in range(vni_start, vni_end):
r = cls.vapi.vxlan_gpe_add_del_tunnel(
- src_addr=cls.pg0.local_ip4n,
- dst_addr=cls.mcast_ip4n,
+ local=cls.pg0.local_ip4,
+ remote=cls.mcast_ip4,
mcast_sw_if_index=1,
vni=vni,
is_add=is_add)
@@ -139,12 +140,12 @@ class TestVxlanGpe(BridgeDomain, VppTestCase):
n_distinct_dst_tunnels = 20
ip_range_start = 10
ip_range_end = ip_range_start + n_distinct_dst_tunnels
- for dest_ip4n in ip4n_range(cls.mcast_ip4n, ip_range_start,
- ip_range_end):
- vni = bytearray(dest_ip4n)[3]
+ for dest_ip4 in ip4_range(cls.mcast_ip4, ip_range_start,
+ ip_range_end):
+ vni = int(dest_ip4.split(".")[3])
cls.vapi.vxlan_gpe_add_del_tunnel(
- src_addr=cls.pg0.local_ip4n,
- dst_addr=dest_ip4n,
+ src_addr=cls.pg0.local_ip4,
+ dst_addr=dest_ip4,
mcast_sw_if_index=1,
vni=vni,
is_add=is_add)
@@ -183,18 +184,15 @@ class TestVxlanGpe(BridgeDomain, VppTestCase):
# Our Multicast address
cls.mcast_ip4 = '239.1.1.1'
- cls.mcast_ip4n = socket.inet_pton(socket.AF_INET, cls.mcast_ip4)
- iplong = atol(cls.mcast_ip4)
- cls.mcast_mac = "01:00:5e:%02x:%02x:%02x" % (
- (iplong >> 16) & 0x7F, (iplong >> 8) & 0xFF, iplong & 0xFF)
+ cls.mcast_mac = util.mcast_ip_to_mac(cls.mcast_ip4)
# Create VXLAN-GPE VTEP on VPP pg0, and put vxlan_gpe_tunnel0
# and pg1 into BD.
cls.single_tunnel_vni = 0xabcde
cls.single_tunnel_bd = 11
r = cls.vapi.vxlan_gpe_add_del_tunnel(
- src_addr=cls.pg0.local_ip4n,
- dst_addr=cls.pg0.remote_ip4n,
+ src_addr=cls.pg0.local_ip4,
+ dst_addr=cls.pg0.remote_ip4,
vni=cls.single_tunnel_vni)
cls.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=r.sw_if_index,
bd_id=cls.single_tunnel_bd)
@@ -207,8 +205,8 @@ class TestVxlanGpe(BridgeDomain, VppTestCase):
cls.create_vxlan_gpe_flood_test_bd(cls.mcast_flood_bd,
cls.n_ucast_tunnels)
r = cls.vapi.vxlan_gpe_add_del_tunnel(
- src_addr=cls.pg0.local_ip4n,
- dst_addr=cls.mcast_ip4n,
+ src_addr=cls.pg0.local_ip4,
+ dst_addr=cls.mcast_ip4,
mcast_sw_if_index=1,
vni=cls.mcast_flood_bd)
cls.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=r.sw_if_index,