aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2020-05-02 22:34:40 -0400
committerPaul Vinciguerra <pvinci@vinciconsulting.com>2020-05-03 15:21:42 -0400
commit2f1563129ad8d34d365f5ef8620ff76ff7b08e70 (patch)
tree43493a0b1a729d12e04af7c94ddfad86c1d75248 /src/plugins
parent0b0a84c403ba5fb1473f8d34745ad2ce0dbb2d45 (diff)
tests: vpp_interface remove deprecated packed properties
The api no longer requires packed ip addresses. Type: test Change-Id: If67365d86b7c3189f871a58234e99f9c8f875371 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/gtpu/test/test_gtpu.py11
-rw-r--r--src/plugins/nat/test/test_nat.py26
2 files changed, 19 insertions, 18 deletions
diff --git a/src/plugins/gtpu/test/test_gtpu.py b/src/plugins/gtpu/test/test_gtpu.py
index 6f5c8e2bdb6..f68c86fbc04 100644
--- a/src/plugins/gtpu/test/test_gtpu.py
+++ b/src/plugins/gtpu/test/test_gtpu.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
from template_bd import BridgeDomain
@@ -12,6 +12,8 @@ from scapy.layers.inet import IP, UDP
from scapy.layers.inet6 import IPv6
from scapy.contrib.gtp import GTP_U_Header
from scapy.utils import atol
+
+import util
from vpp_ip_route import VppIpRoute, VppRoutePath
from vpp_ip import INVALID_INDEX
@@ -238,7 +240,7 @@ class TestGtpu(BridgeDomain, VppTestCase):
next_hop_address = cls.pg0.remote_ip4
for dest_ip4 in ip4_range(next_hop_address, ip_range_start,
ip_range_end):
- # add host route so dest_ip4n will not be resolved
+ # add host route so dest_ip4 will not be resolved
rip = VppIpRoute(cls, dest_ip4, 32,
[VppRoutePath(next_hop_address,
INVALID_INDEX)],
@@ -335,10 +337,7 @@ class TestGtpu(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 GTPU VTEP on VPP pg0, and put gtpu_tunnel0 and pg1
# into BD.
diff --git a/src/plugins/nat/test/test_nat.py b/src/plugins/nat/test/test_nat.py
index 214daf8a43a..19e4c50e8f0 100644
--- a/src/plugins/nat/test/test_nat.py
+++ b/src/plugins/nat/test/test_nat.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
+import ipaddress
import socket
import unittest
import struct
@@ -857,7 +858,8 @@ class MethodHolder(VppTestCase):
else:
nat44_ses_delete_num += 1
# sourceIPv4Address
- self.assertEqual(self.pg0.remote_ip4n, record[8])
+ self.assertEqual(self.pg0.remote_ip4,
+ str(ipaddress.IPv4Address(record[8])))
# postNATSourceIPv4Address
self.assertEqual(socket.inet_pton(socket.AF_INET, self.nat_addr),
record[225])
@@ -945,7 +947,7 @@ class MethodHolder(VppTestCase):
else:
self.assertEqual(scapy.compat.orb(record[230]), 11)
# sourceIPv6Address
- self.assertEqual(src_addr, record[27])
+ self.assertEqual(src_addr, str(ipaddress.IPv6Address(record[27])))
# postNATSourceIPv4Address
self.assertEqual(self.nat_addr_n, record[225])
# protocolIdentifier
@@ -976,7 +978,7 @@ class MethodHolder(VppTestCase):
else:
self.assertEqual(scapy.compat.orb(record[230]), 7)
# sourceIPv6Address
- self.assertEqual(src_addr, record[27])
+ self.assertEqual(src_addr, str(ipaddress.IPv6Address(record[27])))
# destinationIPv6Address
self.assertEqual(socket.inet_pton(socket.AF_INET6,
self.compose_ip6(dst_addr,
@@ -7973,19 +7975,19 @@ class TestNAT64(MethodHolder):
self.vapi.nat64_add_del_interface(is_add=1, flags=0,
sw_if_index=self.pg1.sw_if_index)
- self.vapi.nat64_add_del_static_bib(i_addr=self.pg0.remote_ip6n,
+ self.vapi.nat64_add_del_static_bib(i_addr=self.pg0.remote_ip6,
o_addr=self.nat_addr,
i_port=self.tcp_port_in,
o_port=self.tcp_port_out,
proto=IP_PROTOS.tcp, vrf_id=0,
is_add=1)
- self.vapi.nat64_add_del_static_bib(i_addr=self.pg0.remote_ip6n,
+ self.vapi.nat64_add_del_static_bib(i_addr=self.pg0.remote_ip6,
o_addr=self.nat_addr,
i_port=self.udp_port_in,
o_port=self.udp_port_out,
proto=IP_PROTOS.udp, vrf_id=0,
is_add=1)
- self.vapi.nat64_add_del_static_bib(i_addr=self.pg0.remote_ip6n,
+ self.vapi.nat64_add_del_static_bib(i_addr=self.pg0.remote_ip6,
o_addr=self.nat_addr,
i_port=self.icmp_id_in,
o_port=self.icmp_id_out,
@@ -8876,11 +8878,11 @@ class TestNAT64(MethodHolder):
if p.haslayer(Data):
data = ipfix.decode_data_set(p.getlayer(Set))
if scapy.compat.orb(data[0][230]) == 10:
- self.verify_ipfix_bib(data, 1, self.pg0.remote_ip6n)
+ self.verify_ipfix_bib(data, 1, self.pg0.remote_ip6)
elif scapy.compat.orb(data[0][230]) == 6:
self.verify_ipfix_nat64_ses(data,
1,
- self.pg0.remote_ip6n,
+ self.pg0.remote_ip6,
self.pg1.remote_ip4,
25)
else:
@@ -8906,11 +8908,11 @@ class TestNAT64(MethodHolder):
if p.haslayer(Data):
data = ipfix.decode_data_set(p.getlayer(Set))
if scapy.compat.orb(data[0][230]) == 11:
- self.verify_ipfix_bib(data, 0, self.pg0.remote_ip6n)
+ self.verify_ipfix_bib(data, 0, self.pg0.remote_ip6)
elif scapy.compat.orb(data[0][230]) == 7:
self.verify_ipfix_nat64_ses(data,
0,
- self.pg0.remote_ip6n,
+ self.pg0.remote_ip6,
self.pg1.remote_ip4,
25)
else:
@@ -9054,7 +9056,7 @@ class TestNAT66(MethodHolder):
self.vapi.nat66_add_del_interface(is_add=1,
sw_if_index=self.pg1.sw_if_index)
self.vapi.nat66_add_del_static_mapping(
- local_ip_address=self.pg0.remote_ip6n,
+ local_ip_address=self.pg0.remote_ip6,
external_ip_address=self.nat_addr,
is_add=1)
@@ -9133,7 +9135,7 @@ class TestNAT66(MethodHolder):
self.vapi.nat66_add_del_interface(is_add=1, flags=flags,
sw_if_index=self.pg1.sw_if_index)
self.vapi.nat66_add_del_static_mapping(
- local_ip_address=self.pg0.remote_ip6n,
+ local_ip_address=self.pg0.remote_ip6,
external_ip_address=self.nat_addr,
is_add=1)