summaryrefslogtreecommitdiffstats
path: root/src/plugins/memif/test
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-11-11 08:32:34 +0000
committerPaul Vinciguerra <pvinci@vinciconsulting.com>2019-11-15 13:19:20 +0000
commitefd7bc2b1c8db160933ed3e9ab3cde0d07aaf863 (patch)
treedcd284e6b8fb5aa37cccc912fd3009fd5fd77365 /src/plugins/memif/test
parent5ae7f0db43928a9a043e1e4a53871219060d259d (diff)
tests: Remove the unrequired VPP IP address/prefix class wrappers
Type: refactor Change-Id: I204f3f8eebc5f5d5a377e91262f91c615fd00168 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/plugins/memif/test')
-rw-r--r--src/plugins/memif/test/test_memif.py8
-rw-r--r--src/plugins/memif/test/vpp_memif.py9
2 files changed, 10 insertions, 7 deletions
diff --git a/src/plugins/memif/test/test_memif.py b/src/plugins/memif/test/test_memif.py
index a999b17678f..f11dd89f975 100644
--- a/src/plugins/memif/test/test_memif.py
+++ b/src/plugins/memif/test/test_memif.py
@@ -221,14 +221,15 @@ class TestMemif(VppTestCase):
pkts = []
for i in range(num):
pkt = (Ether(dst=pg.local_mac, src=pg.remote_mac) /
- IP(src=pg.remote_ip4, dst=memif.ip_prefix.address) /
+ IP(src=pg.remote_ip4,
+ dst=str(memif.ip_prefix.network_address)) /
ICMP(id=memif.if_id, type='echo-request', seq=i))
pkts.append(pkt)
return pkts
def _verify_icmp(self, pg, memif, rx, seq):
ip = rx[IP]
- self.assertEqual(ip.src, memif.ip_prefix.address)
+ self.assertEqual(ip.src, str(memif.ip_prefix.network_address))
self.assertEqual(ip.dst, pg.remote_ip4)
self.assertEqual(ip.proto, 1)
icmp = rx[ICMP]
@@ -267,7 +268,8 @@ class TestMemif(VppTestCase):
# add routing to remote vpp
route = VppIpRoute(self.remote_test, self.pg0._local_ip4_subnet, 24,
- [VppRoutePath(memif.ip_prefix.address, 0xffffffff)],
+ [VppRoutePath(memif.ip_prefix.network_address,
+ 0xffffffff)],
register=False)
route.add_vpp_config()
diff --git a/src/plugins/memif/test/vpp_memif.py b/src/plugins/memif/test/vpp_memif.py
index 9bcac1fd5b6..3ccbb68970b 100644
--- a/src/plugins/memif/test/vpp_memif.py
+++ b/src/plugins/memif/test/vpp_memif.py
@@ -1,9 +1,9 @@
import socket
+from ipaddress import IPv4Network
import six
from vpp_object import VppObject
-from vpp_ip import VppIpPrefix
from vpp_papi import VppEnum
@@ -74,8 +74,9 @@ class VppMemif(VppObject):
self.buffer_size = buffer_size
self.hw_addr = hw_addr
self.sw_if_index = None
- self.ip_prefix = VppIpPrefix("192.168.%d.%d" %
- (self.if_id + 1, self.role + 1), 24)
+ self.ip_prefix = IPv4Network("192.168.%d.%d/24" %
+ (self.if_id + 1, self.role + 1),
+ strict=False)
def add_vpp_config(self):
rv = self._test.vapi.memif_create(
@@ -125,7 +126,7 @@ class VppMemif(VppObject):
def config_ip4(self):
return self._test.vapi.sw_interface_add_del_address(
- sw_if_index=self.sw_if_index, prefix=self.ip_prefix.encode())
+ sw_if_index=self.sw_if_index, prefix=self.ip_prefix)
def remove_vpp_config(self):
self._test.vapi.memif_delete(self.sw_if_index)