summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ext/vapi_c_test.c18
-rw-r--r--test/ext/vapi_cpp_test.cpp8
-rw-r--r--test/remote_test.py15
-rw-r--r--test/test_bond.py8
-rw-r--r--test/test_interface_crud.py4
-rw-r--r--test/test_ip4.py19
-rw-r--r--test/test_memif.py13
-rw-r--r--test/test_nat.py35
-rw-r--r--test/test_span.py2
-rw-r--r--test/vpp_interface.py112
-rw-r--r--test/vpp_ip_route.py6
-rw-r--r--test/vpp_memif.py16
-rw-r--r--test/vpp_sub_interface.py8
13 files changed, 125 insertions, 139 deletions
diff --git a/test/ext/vapi_c_test.c b/test/ext/vapi_c_test.c
index 725f5c30407..0b22fff1706 100644
--- a/test/ext/vapi_c_test.c
+++ b/test/ext/vapi_c_test.c
@@ -514,7 +514,7 @@ sw_interface_dump_cb (struct vapi_ctx_s *ctx, void *callback_ctx,
{
ck_assert (NULL != reply);
printf ("Interface dump entry: [%u]: %s\n", reply->sw_if_index,
- reply->interface_name.buf);
+ reply->interface_name);
size_t i = 0;
for (i = 0; i < dctx->num_ifs; ++i)
{
@@ -577,8 +577,8 @@ START_TEST (test_loopbacks_1)
clib_memset (&seen, 0, sizeof (seen));
dump = vapi_alloc_sw_interface_dump (ctx);
dump->payload.name_filter_valid = 0;
- clib_memset (dump->payload.name_filter.buf, 0,
- dump->payload.name_filter.length);
+ clib_memset (dump->payload.name_filter, 0,
+ sizeof (dump->payload.name_filter));
while (VAPI_EAGAIN ==
(rv =
vapi_sw_interface_dump (ctx, dump, sw_interface_dump_cb,
@@ -609,8 +609,8 @@ START_TEST (test_loopbacks_1)
clib_memset (&seen, 0, sizeof (seen));
dump = vapi_alloc_sw_interface_dump (ctx);
dump->payload.name_filter_valid = 0;
- clib_memset (dump->payload.name_filter.buf, 0,
- dump->payload.name_filter.length);
+ clib_memset (dump->payload.name_filter, 0,
+ sizeof (dump->payload.name_filter));
while (VAPI_EAGAIN ==
(rv =
vapi_sw_interface_dump (ctx, dump, sw_interface_dump_cb, &dctx)))
@@ -734,8 +734,8 @@ START_TEST (test_loopbacks_2)
sw_interface_dump_ctx dctx = { false, num_ifs, sw_if_indexes, seen, 0 };
vapi_msg_sw_interface_dump *dump = vapi_alloc_sw_interface_dump (ctx);
dump->payload.name_filter_valid = 0;
- clib_memset (dump->payload.name_filter.buf, 0,
- dump->payload.name_filter.length);
+ clib_memset (dump->payload.name_filter, 0,
+ sizeof (dump->payload.name_filter));
while (VAPI_EAGAIN ==
(rv =
vapi_sw_interface_dump (ctx, dump, sw_interface_dump_cb, &dctx)))
@@ -775,8 +775,8 @@ START_TEST (test_loopbacks_2)
dctx.last_called = false;
dump = vapi_alloc_sw_interface_dump (ctx);
dump->payload.name_filter_valid = 0;
- clib_memset (dump->payload.name_filter.buf, 0,
- dump->payload.name_filter.length);
+ clib_memset (dump->payload.name_filter, 0,
+ sizeof (dump->payload.name_filter));
while (VAPI_EAGAIN ==
(rv =
vapi_sw_interface_dump (ctx, dump, sw_interface_dump_cb, &dctx)))
diff --git a/test/ext/vapi_cpp_test.cpp b/test/ext/vapi_cpp_test.cpp
index 46a2c0ec2f1..68366af2ac8 100644
--- a/test/ext/vapi_cpp_test.cpp
+++ b/test/ext/vapi_cpp_test.cpp
@@ -151,7 +151,7 @@ START_TEST (test_loopbacks_1)
Sw_interface_dump d (con);
auto &p = d.get_request ().get_payload ();
p.name_filter_valid = 0;
- memset (p.name_filter.buf, 0, p.name_filter.length);
+ memset (p.name_filter, 0, sizeof (p.name_filter));
auto rv = d.execute ();
ck_assert_int_eq (VAPI_OK, rv);
WAIT_FOR_RESPONSE (d, rv);
@@ -193,7 +193,7 @@ START_TEST (test_loopbacks_1)
Sw_interface_dump d (con);
auto &p = d.get_request ().get_payload ();
p.name_filter_valid = 0;
- memset (p.name_filter.buf, 0, p.name_filter.length);
+ memset (p.name_filter, 0, sizeof (p.name_filter));
auto rv = d.execute ();
ck_assert_int_eq (VAPI_OK, rv);
WAIT_FOR_RESPONSE (d, rv);
@@ -311,7 +311,7 @@ START_TEST (test_loopbacks_2)
Sw_interface_dump d (con, std::ref (swdcb));
auto &p = d.get_request ().get_payload ();
p.name_filter_valid = 0;
- memset (p.name_filter.buf, 0, p.name_filter.length);
+ memset (p.name_filter, 0, sizeof (p.name_filter));
auto rv = d.execute ();
ck_assert_int_eq (VAPI_OK, rv);
WAIT_FOR_RESPONSE (d, rv);
@@ -340,7 +340,7 @@ START_TEST (test_loopbacks_2)
Sw_interface_dump d (con);
auto &p = d.get_request ().get_payload ();
p.name_filter_valid = 0;
- memset (p.name_filter.buf, 0, p.name_filter.length);
+ memset (p.name_filter, 0, sizeof (p.name_filter));
auto rv = d.execute ();
ck_assert_int_eq (VAPI_OK, rv);
WAIT_FOR_RESPONSE (d, rv);
diff --git a/test/remote_test.py b/test/remote_test.py
index f5b3c620cc4..bc6d70764ec 100644
--- a/test/remote_test.py
+++ b/test/remote_test.py
@@ -3,21 +3,14 @@
import inspect
import os
import unittest
-from framework import VppTestCase
from multiprocessing import Process, Pipe
from pickle import dumps
+
import six
from six import moves
-import sys
-if sys.version_info <= (3, 4):
- from aenum import IntEnum
-else:
- from enum import IntEnum
-if sys.version_info <= (3, 6):
- from aenum import IntFlag
-else:
- from enum import IntFlag
+from framework import VppTestCase
+from enum import Enum
class SerializableClassCopy(object):
@@ -273,7 +266,7 @@ class RemoteClass(Process):
if type(obj) is tuple:
rv = tuple(rv)
return rv
- elif (isinstance(obj, IntEnum) or isinstance(obj, IntFlag)):
+ elif (isinstance(obj, Enum)):
return obj.value
else:
return self._make_obj_serializable(obj)
diff --git a/test/test_bond.py b/test/test_bond.py
index eb43281719e..533038e658a 100644
--- a/test/test_bond.py
+++ b/test/test_bond.py
@@ -9,7 +9,6 @@ from scapy.layers.l2 import Ether
from scapy.layers.inet import IP, UDP
from vpp_bond_interface import VppBondInterface
from vpp_papi import MACAddress
-from vpp_ip import VppIpPrefix
class TestBondInterface(VppTestCase):
@@ -65,9 +64,10 @@ class TestBondInterface(VppTestCase):
mac_address=mac)
bond0.add_vpp_config()
bond0.admin_up()
- self.vapi.sw_interface_add_del_address(
- sw_if_index=bond0.sw_if_index,
- prefix=VppIpPrefix("10.10.10.1", 24).encode())
+ bond0_addr = socket.inet_pton(socket.AF_INET, "10.10.10.1")
+ self.vapi.sw_interface_add_del_address(sw_if_index=bond0.sw_if_index,
+ address=bond0_addr,
+ address_length=24)
self.pg2.config_ip4()
self.pg2.resolve_arp()
diff --git a/test/test_interface_crud.py b/test/test_interface_crud.py
index b845c6b877e..d78cb58be0b 100644
--- a/test/test_interface_crud.py
+++ b/test/test_interface_crud.py
@@ -81,7 +81,7 @@ class TestLoopbackInterfaceCRUD(VppTestCase):
# create
loopbacks = self.create_loopback_interfaces(20)
for i in loopbacks:
- i.local_ip4_prefix.len = 32
+ i.local_ip4_prefix_len = 32
i.config_ip4()
i.admin_up()
@@ -123,7 +123,7 @@ class TestLoopbackInterfaceCRUD(VppTestCase):
# create
loopbacks = self.create_loopback_interfaces(20)
for i in loopbacks:
- i.local_ip4_prefix.len = 32
+ i.local_ip4_prefix_len = 32
i.config_ip4()
i.admin_up()
diff --git a/test/test_ip4.py b/test/test_ip4.py
index 8282d134836..c8c0a71d171 100644
--- a/test/test_ip4.py
+++ b/test/test_ip4.py
@@ -17,7 +17,6 @@ from vpp_ip_route import VppIpRoute, VppRoutePath, VppIpMRoute, \
VppMRoutePath, MRouteItfFlags, MRouteEntryFlags, VppMplsIpBind, \
VppMplsTable, VppIpTable
from vpp_sub_interface import VppSubInterface, VppDot1QSubint, VppDot1ADSubint
-from vpp_ip import VppIpPrefix
class TestIPv4(VppTestCase):
@@ -811,8 +810,8 @@ class TestIPSubNets(VppTestCase):
ip_addr_n = socket.inet_pton(socket.AF_INET, "10.10.10.10")
self.vapi.sw_interface_add_del_address(
- sw_if_index=self.pg0.sw_if_index,
- prefix=VppIpPrefix("10.10.10.10", 16).encode())
+ sw_if_index=self.pg0.sw_if_index, address=ip_addr_n,
+ address_length=16)
pn = (Ether(src=self.pg1.remote_mac,
dst=self.pg1.local_mac) /
@@ -830,9 +829,8 @@ class TestIPSubNets(VppTestCase):
# remove the sub-net and we are forwarding via the cover again
self.vapi.sw_interface_add_del_address(
- sw_if_index=self.pg0.sw_if_index,
- prefix=VppIpPrefix("10.10.10.10", 16).encode(), is_add=0)
-
+ sw_if_index=self.pg0.sw_if_index, address=ip_addr_n,
+ address_length=16, is_add=0)
self.pg1.add_stream(pn)
self.pg_enable_capture(self.pg_interfaces)
self.pg_start()
@@ -849,8 +847,8 @@ class TestIPSubNets(VppTestCase):
ip_addr_n = socket.inet_pton(socket.AF_INET, "10.10.10.10")
self.vapi.sw_interface_add_del_address(
- sw_if_index=self.pg0.sw_if_index,
- prefix=VppIpPrefix("10.10.10.10", 31).encode())
+ sw_if_index=self.pg0.sw_if_index, address=ip_addr_n,
+ address_length=31)
pn = (Ether(src=self.pg1.remote_mac,
dst=self.pg1.local_mac) /
@@ -866,9 +864,8 @@ class TestIPSubNets(VppTestCase):
# remove the sub-net and we are forwarding via the cover again
self.vapi.sw_interface_add_del_address(
- sw_if_index=self.pg0.sw_if_index,
- prefix=VppIpPrefix("10.10.10.10", 31).encode(), is_add=0)
-
+ sw_if_index=self.pg0.sw_if_index, address=ip_addr_n,
+ address_length=31, is_add=0)
self.pg1.add_stream(pn)
self.pg_enable_capture(self.pg_interfaces)
self.pg_start()
diff --git a/test/test_memif.py b/test/test_memif.py
index e5ff18186c1..d89e06bfb4b 100644
--- a/test/test_memif.py
+++ b/test/test_memif.py
@@ -208,14 +208,14 @@ 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=memif.ip4_addr) /
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, memif.ip4_addr)
self.assertEqual(ip.dst, pg.remote_ip4)
self.assertEqual(ip.proto, 1)
icmp = rx[ICMP]
@@ -249,11 +249,10 @@ class TestMemif(VppTestCase):
# add routing to remote vpp
dst_addr = socket.inet_pton(socket.AF_INET, self.pg0._local_ip4_subnet)
dst_addr_len = 24
- next_hop_addr = socket.inet_pton(socket.AF_INET,
- memif.ip_prefix.address)
- self.remote_test.vapi.ip_add_del_route(
- dst_address=dst_addr, dst_address_length=dst_addr_len,
- next_hop_address=next_hop_addr)
+ next_hop_addr = socket.inet_pton(socket.AF_INET, memif.ip4_addr)
+ self.remote_test.vapi.ip_add_del_route(dst_address=dst_addr,
+ dst_address_length=dst_addr_len,
+ next_hop_address=next_hop_addr)
# create ICMP echo-request from local pg to remote memif
packet_num = 10
diff --git a/test/test_nat.py b/test/test_nat.py
index 69a18f8a097..b2c442f81e6 100644
--- a/test/test_nat.py
+++ b/test/test_nat.py
@@ -26,7 +26,6 @@ from syslog_rfc5424_parser.constants import SyslogFacility, SyslogSeverity
from vpp_papi_provider import SYSLOG_SEVERITY
from io import BytesIO
from vpp_papi import VppEnum
-from vpp_ip import VppIpAddress, VppIpPrefix
from scapy.all import bind_layers, Packet, ByteEnumField, ShortField, \
IPField, IntField, LongField, XByteField, FlagsField, FieldLenField, \
PacketListField
@@ -1527,16 +1526,16 @@ class TestNAT44(MethodHolder):
cls.vapi.ip_table_add_del(is_add=1, table_id=10)
cls.vapi.ip_table_add_del(is_add=1, table_id=20)
- cls.pg4._local_ip4 = VppIpPrefix("172.16.255.1",
- cls.pg4.local_ip4_prefix.len)
+ cls.pg4._local_ip4 = "172.16.255.1"
+ cls.pg4._local_ip4n = socket.inet_pton(socket.AF_INET, i.local_ip4)
cls.pg4._remote_hosts[0]._ip4 = "172.16.255.2"
cls.pg4.set_table_ip4(10)
- cls.pg5._local_ip4 = VppIpPrefix("172.17.255.3",
- cls.pg5.local_ip4_prefix.len)
+ cls.pg5._local_ip4 = "172.17.255.3"
+ cls.pg5._local_ip4n = socket.inet_pton(socket.AF_INET, i.local_ip4)
cls.pg5._remote_hosts[0]._ip4 = "172.17.255.4"
cls.pg5.set_table_ip4(10)
- cls.pg6._local_ip4 = VppIpPrefix("172.16.255.1",
- cls.pg6.local_ip4_prefix.len)
+ cls.pg6._local_ip4 = "172.16.255.1"
+ cls.pg6._local_ip4n = socket.inet_pton(socket.AF_INET, i.local_ip4)
cls.pg6._remote_hosts[0]._ip4 = "172.16.255.2"
cls.pg6.set_table_ip4(20)
for i in cls.overlapping_interfaces:
@@ -1549,10 +1548,10 @@ class TestNAT44(MethodHolder):
cls.pg9.generate_remote_hosts(2)
cls.pg9.config_ip4()
+ ip_addr_n = socket.inet_pton(socket.AF_INET, "10.0.0.1")
cls.vapi.sw_interface_add_del_address(
- sw_if_index=cls.pg9.sw_if_index,
- prefix=VppIpPrefix("10.0.0.1", 24).encode())
-
+ sw_if_index=cls.pg9.sw_if_index, address=ip_addr_n,
+ address_length=24)
cls.pg9.admin_up()
cls.pg9.resolve_arp()
cls.pg9._remote_hosts[1]._ip4 = cls.pg9._remote_hosts[0]._ip4
@@ -4214,10 +4213,10 @@ class TestNAT44EndpointDependent(MethodHolder):
cls.pg4.generate_remote_hosts(2)
cls.pg4.config_ip4()
+ ip_addr_n = socket.inet_pton(socket.AF_INET, "10.0.0.1")
cls.vapi.sw_interface_add_del_address(
- sw_if_index=cls.pg4.sw_if_index,
- prefix=VppIpPrefix("10.0.0.1", 24).encode())
-
+ sw_if_index=cls.pg4.sw_if_index, address=ip_addr_n,
+ address_length=24)
cls.pg4.admin_up()
cls.pg4.resolve_arp()
cls.pg4._remote_hosts[1]._ip4 = cls.pg4._remote_hosts[0]._ip4
@@ -4226,8 +4225,9 @@ class TestNAT44EndpointDependent(MethodHolder):
zero_ip4n = socket.inet_pton(socket.AF_INET, "0.0.0.0")
cls.vapi.ip_table_add_del(is_add=1, table_id=1)
- cls.pg5._local_ip4 = VppIpPrefix("10.1.1.1",
- cls.pg5.local_ip4_prefix.len)
+ cls.pg5._local_ip4 = "10.1.1.1"
+ cls.pg5._local_ip4n = socket.inet_pton(socket.AF_INET,
+ cls.pg5.local_ip4)
cls.pg5._remote_hosts[0]._ip4 = "10.1.1.2"
cls.pg5._remote_hosts[0]._ip4n = socket.inet_pton(
socket.AF_INET, cls.pg5.remote_ip4)
@@ -4240,8 +4240,9 @@ class TestNAT44EndpointDependent(MethodHolder):
next_hop_sw_if_index=cls.pg5.sw_if_index,
table_id=1)
- cls.pg6._local_ip4 = VppIpPrefix("10.1.2.1",
- cls.pg6.local_ip4_prefix.len)
+ cls.pg6._local_ip4 = "10.1.2.1"
+ cls.pg6._local_ip4n = socket.inet_pton(socket.AF_INET,
+ cls.pg6.local_ip4)
cls.pg6._remote_hosts[0]._ip4 = "10.1.2.2"
cls.pg6._remote_hosts[0]._ip4n = socket.inet_pton(
socket.AF_INET, cls.pg6.remote_ip4)
diff --git a/test/test_span.py b/test/test_span.py
index dddd57f9b8f..b6f816e9cf2 100644
--- a/test/test_span.py
+++ b/test/test_span.py
@@ -233,7 +233,7 @@ class TestSpan(VppTestCase):
self.sub_if.admin_up()
self.vapi.sw_interface_set_flags(self.vxlan.sw_if_index,
- flags=1)
+ admin_up_down=1)
self.bridge(self.vxlan.sw_if_index, is_add=1)
# Create bi-directional cross-connects between pg0 subif and pg1
diff --git a/test/vpp_interface.py b/test/vpp_interface.py
index 4c4e4138479..d586c849b02 100644
--- a/test/vpp_interface.py
+++ b/test/vpp_interface.py
@@ -6,8 +6,7 @@ import six
from six import moves
from util import Host, mk_ll_addr
-from vpp_papi import mac_ntop, VppEnum
-from vpp_ip import VppIpAddress, VppIpPrefix
+from vpp_papi import mac_ntop
@six.add_metaclass(abc.ABCMeta)
@@ -38,25 +37,22 @@ class VppInterface(object):
return self._remote_addr
@property
- def local_ip4(self):
- """Local IPv4 address on VPP interface (string)."""
- return self._local_ip4.address
+ def local_addr_n(self):
+ return self._local_addr_n
@property
- def local_ip4_prefix_len(self):
- """Local IPv4 prefix length """
- return self._local_ip4.len
+ def remote_addr_n(self):
+ return self._remote_addr_n
@property
- def local_ip4_prefix(self):
- """Local IPv4 prefix """
+ def local_ip4(self):
+ """Local IPv4 address on VPP interface (string)."""
return self._local_ip4
@property
def local_ip4n(self):
- """DEPRECATED """
"""Local IPv4 address - raw, suitable as API parameter."""
- return socket.inet_pton(socket.AF_INET, self._local_ip4.address)
+ return socket.inet_pton(socket.AF_INET, self._local_ip4)
@property
def remote_ip4(self):
@@ -65,30 +61,18 @@ class VppInterface(object):
@property
def remote_ip4n(self):
- """DEPRECATED """
- """Local IPv6 address - raw, suitable as API parameter."""
- return socket.inet_pton(socket.AF_INET, self._remote_hosts[0].ip4)
+ """IPv4 address of remote peer - raw, suitable as API parameter."""
+ return socket.inet_pton(socket.AF_INET, self.remote_ip4)
@property
def local_ip6(self):
"""Local IPv6 address on VPP interface (string)."""
- return self._local_ip6.address
-
- @property
- def local_ip6_prefix_len(self):
- """Local IPv6 prefix length """
- return self._local_ip6.len
-
- @property
- def local_ip6_prefix(self):
- """Local IPv6 prefix """
return self._local_ip6
@property
def local_ip6n(self):
- """DEPRECATED """
"""Local IPv6 address - raw, suitable as API parameter."""
- return socket.inet_pton(socket.AF_INET6, self._local_ip6.address)
+ return socket.inet_pton(socket.AF_INET6, self.local_ip6)
@property
def remote_ip6(self):
@@ -97,20 +81,18 @@ class VppInterface(object):
@property
def remote_ip6n(self):
- """DEPRECATED """
- """Local IPv6 address - raw, suitable as API parameter."""
- return socket.inet_pton(socket.AF_INET6, self._remote_hosts[0].ip6)
+ """IPv6 address of remote peer - raw, suitable as API parameter"""
+ return socket.inet_pton(socket.AF_INET6, self.remote_ip6)
@property
def local_ip6_ll(self):
"""Local IPv6 link-local address on VPP interface (string)."""
- return self._local_ip6_ll.address
+ return self._local_ip6_ll
@property
def local_ip6n_ll(self):
- """DEPRECATED """
- """Local IPv6 link-local address on VPP interface (string)."""
- return socket.inet_pton(socket.AF_INET6, self._local_ip6_ll.address)
+ """Local IPv6 link-local address - raw, suitable as API parameter."""
+ return self._local_ip6n_ll
@property
def remote_ip6_ll(self):
@@ -120,9 +102,9 @@ class VppInterface(object):
@property
def remote_ip6n_ll(self):
- """DEPRECATED """
- """Local IPv6 link-local address on VPP interface (string)."""
- return socket.inet_pton(socket.AF_INET6, self._remote_ip6_ll)
+ """Link-local IPv6 address of remote peer
+ - raw, suitable as API parameter"""
+ return self._remote_ip6n_ll
@property
def name(self):
@@ -211,7 +193,7 @@ class VppInterface(object):
def set_mac(self, mac):
self._local_mac = str(mac)
- self._local_ip6_ll = VppIpAddress(mk_ll_addr(self._local_mac))
+ self._local_ip6_ll = mk_ll_addr(self._local_mac)
self.test.vapi.sw_interface_set_mac_address(
self.sw_if_index, mac.packed)
@@ -220,27 +202,39 @@ class VppInterface(object):
self.generate_remote_hosts()
- self._local_ip4 = VppIpPrefix("172.16.%u.1" % self.sw_if_index, 24)
+ self._local_ip4 = "172.16.%u.1" % self.sw_if_index
+ self._local_ip4n = socket.inet_pton(socket.AF_INET, self.local_ip4)
self._local_ip4_subnet = "172.16.%u.0" % self.sw_if_index
+ self._local_ip4n_subnet = socket.inet_pton(socket.AF_INET,
+ self._local_ip4_subnet)
self._local_ip4_bcast = "172.16.%u.255" % self.sw_if_index
+ self._local_ip4n_bcast = socket.inet_pton(socket.AF_INET,
+ self._local_ip4_bcast)
+ self.local_ip4_prefix_len = 24
self.has_ip4_config = False
self.ip4_table_id = 0
- self._local_ip6 = VppIpPrefix("fd01:%x::1" % self.sw_if_index, 64)
+ self._local_ip6 = "fd01:%x::1" % self.sw_if_index
+ self._local_ip6n = socket.inet_pton(socket.AF_INET6, self.local_ip6)
+ self.local_ip6_prefix_len = 64
self.has_ip6_config = False
self.ip6_table_id = 0
self._local_addr = {socket.AF_INET: self.local_ip4,
socket.AF_INET6: self.local_ip6}
+ self._local_addr_n = {socket.AF_INET: self.local_ip4n,
+ socket.AF_INET6: self.local_ip6n}
self._remote_addr = {socket.AF_INET: self.remote_ip4,
socket.AF_INET6: self.remote_ip6}
+ self._remote_addr_n = {socket.AF_INET: self.remote_ip4n,
+ socket.AF_INET6: self.remote_ip6n}
r = self.test.vapi.sw_interface_dump()
for intf in r:
if intf.sw_if_index == self.sw_if_index:
self._name = intf.interface_name.split(b'\0',
1)[0].decode('utf8')
- self._local_mac = bytes(intf.l2_address)
+ self._local_mac = mac_ntop(intf.l2_address)
self._dump = intf
break
else:
@@ -248,13 +242,18 @@ class VppInterface(object):
"Could not find interface with sw_if_index %d "
"in interface dump %s" %
(self.sw_if_index, moves.reprlib.repr(r)))
- self._local_ip6_ll = VppIpAddress(mk_ll_addr(self.local_mac))
+ self._local_ip6_ll = mk_ll_addr(self.local_mac)
+ self._local_ip6n_ll = socket.inet_pton(socket.AF_INET6,
+ self.local_ip6_ll)
self._remote_ip6_ll = mk_ll_addr(self.remote_mac)
+ self._remote_ip6n_ll = socket.inet_pton(socket.AF_INET6,
+ self.remote_ip6_ll)
def config_ip4(self):
"""Configure IPv4 address on the VPP interface."""
self.test.vapi.sw_interface_add_del_address(
- sw_if_index=self.sw_if_index, prefix=self._local_ip4.encode())
+ sw_if_index=self.sw_if_index, address=self.local_ip4n,
+ address_length=self.local_ip4_prefix_len)
self.has_ip4_config = True
def unconfig_ip4(self):
@@ -262,8 +261,8 @@ class VppInterface(object):
try:
if self.has_ip4_config:
self.test.vapi.sw_interface_add_del_address(
- sw_if_index=self.sw_if_index,
- prefix=self._local_ip4.encode(), is_add=0)
+ sw_if_index=self.sw_if_index, address=self.local_ip4n,
+ address_length=self.local_ip4_prefix_len, is_add=0)
except AttributeError:
self.has_ip4_config = False
self.has_ip4_config = False
@@ -281,7 +280,8 @@ class VppInterface(object):
def config_ip6(self):
"""Configure IPv6 address on the VPP interface."""
self.test.vapi.sw_interface_add_del_address(
- sw_if_index=self.sw_if_index, prefix=self._local_ip6.encode())
+ sw_if_index=self.sw_if_index, address=self._local_ip6n,
+ address_length=self.local_ip6_prefix_len, is_ipv6=1)
self.has_ip6_config = True
def unconfig_ip6(self):
@@ -289,8 +289,9 @@ class VppInterface(object):
try:
if self.has_ip6_config:
self.test.vapi.sw_interface_add_del_address(
- sw_if_index=self.sw_if_index,
- prefix=self._local_ip6.encode(), is_add=0)
+ sw_if_index=self.sw_if_index, address=self.local_ip6n,
+ address_length=self.local_ip6_prefix_len, is_ipv6=1,
+ is_add=0)
except AttributeError:
self.has_ip6_config = False
self.has_ip6_config = False
@@ -356,14 +357,13 @@ class VppInterface(object):
def admin_up(self):
"""Put interface ADMIN-UP."""
- self.test.vapi.sw_interface_set_flags(
- self.sw_if_index,
- flags=VppEnum.vl_api_if_status_flags_t.IF_STATUS_API_FLAG_ADMIN_UP)
+ self.test.vapi.sw_interface_set_flags(self.sw_if_index,
+ admin_up_down=1)
def admin_down(self):
"""Put interface ADMIN-down."""
self.test.vapi.sw_interface_set_flags(self.sw_if_index,
- flags=0)
+ admin_up_down=0)
def link_up(self):
"""Put interface link-state-UP."""
@@ -450,15 +450,15 @@ class VppInterface(object):
name='sw_interface_event')
self.test.assert_equal(event.sw_if_index, self.sw_if_index,
"sw_if_index")
- self.test.assert_equal((event.flags & 1), admin_up_down,
+ self.test.assert_equal(event.admin_up_down, admin_up_down,
"admin state")
- self.test.assert_equal((event.flags & 2), link_up_down,
+ self.test.assert_equal(event.link_up_down, link_up_down,
"link state")
dump = self.test.vapi.sw_interface_dump()
if_state = self.get_interface_config_from_dump(dump)
- self.test.assert_equal((if_state.flags & 1), admin_up_down,
+ self.test.assert_equal(if_state.admin_up_down, admin_up_down,
"admin state")
- self.test.assert_equal((if_state.flags & 2), link_up_down,
+ self.test.assert_equal(if_state.link_up_down, link_up_down,
"link state")
def __str__(self):
diff --git a/test/vpp_ip_route.py b/test/vpp_ip_route.py
index fbc00d394f5..b7ceb3474d4 100644
--- a/test/vpp_ip_route.py
+++ b/test/vpp_ip_route.py
@@ -161,13 +161,15 @@ class VppIpInterfaceAddress(VppObject):
def add_vpp_config(self):
self._test.vapi.sw_interface_add_del_address(
- sw_if_index=self.intf.sw_if_index, prefix=self.prefix.encode(),
+ sw_if_index=self.intf.sw_if_index, address=self.prefix.bytes,
+ address_length=self.prefix.length, is_ipv6=self.prefix.is_ip6,
is_add=1)
self._test.registry.register(self, self._test.logger)
def remove_vpp_config(self):
self._test.vapi.sw_interface_add_del_address(
- sw_if_index=self.intf.sw_if_index, prefix=self.prefix.encode(),
+ sw_if_index=self.intf.sw_if_index, address=self.prefix.bytes,
+ address_length=self.prefix.length, is_ipv6=self.prefix.is_ip6,
is_add=0)
def query_vpp_config(self):
diff --git a/test/vpp_memif.py b/test/vpp_memif.py
index 88b9189032d..4ad9ffde4d7 100644
--- a/test/vpp_memif.py
+++ b/test/vpp_memif.py
@@ -3,8 +3,6 @@ import socket
import six
from vpp_object import VppObject
-from vpp_ip import VppIpPrefix
-from vpp_papi import VppEnum
class MEMIF_ROLE:
@@ -89,8 +87,8 @@ 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.ip4_addr = "192.168.%d.%d" % (self.if_id + 1, self.role + 1)
+ self.ip4_addr_len = 24
def add_vpp_config(self):
rv = self._test.vapi.memif_create(self.role, self.mode, self.rx_queues,
@@ -103,13 +101,11 @@ class VppMemif(VppObject):
def admin_up(self):
if self.sw_if_index:
- return self._test.vapi.sw_interface_set_flags(
- sw_if_index=self.sw_if_index, flags=1)
+ return self._test.vapi.sw_interface_set_flags(self.sw_if_index, 1)
def admin_down(self):
if self.sw_if_index:
- return self._test.vapi.sw_interface_set_flags(
- sw_if_index=self.sw_if_index, flags=0)
+ return self._test.vapi.sw_interface_set_flags(self.sw_if_index, 0)
def wait_for_link_up(self, timeout, step=1):
if not self.sw_if_index:
@@ -125,7 +121,9 @@ 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, address=socket.inet_pton(
+ socket.AF_INET, self.ip4_addr),
+ address_length=self.ip4_addr_len)
def remove_vpp_config(self):
self._test.vapi.memif_delete(self.sw_if_index)
diff --git a/test/vpp_sub_interface.py b/test/vpp_sub_interface.py
index 90989291c1f..15cd6edb8e0 100644
--- a/test/vpp_sub_interface.py
+++ b/test/vpp_sub_interface.py
@@ -4,7 +4,6 @@ import six
from vpp_pg_interface import VppPGInterface
from vpp_papi_provider import L2_VTR_OP
from vpp_interface import VppInterface
-from vpp_papi import VppEnum
@six.add_metaclass(abc.ABCMeta)
@@ -172,13 +171,10 @@ class VppDot1ADSubint(VppSubInterface):
def __init__(self, test, parent, sub_id, outer_vlan, inner_vlan):
super(VppDot1ADSubint, self).__init__(test, parent, sub_id)
- flags = (VppEnum.vl_api_sub_if_flags_t.SUB_IF_API_FLAG_DOT1AD |
- VppEnum.vl_api_sub_if_flags_t.SUB_IF_API_FLAG_TWO_TAGS |
- VppEnum.vl_api_sub_if_flags_t.SUB_IF_API_FLAG_EXACT_MATCH)
r = test.vapi.create_subif(sw_if_index=parent.sw_if_index,
sub_id=sub_id, outer_vlan_id=outer_vlan,
- inner_vlan_id=inner_vlan,
- sub_if_flags=flags)
+ inner_vlan_id=inner_vlan, two_tags=1,
+ dot1ad=1, exact_match=1)
self.set_sw_if_index(r.sw_if_index)
self._outer_vlan = outer_vlan
self._inner_vlan = inner_vlan