aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--src/plugins/dns/test/test_dns.py3
-rw-r--r--src/plugins/gbp/test/test_gbp.py478
-rw-r--r--src/plugins/map/test/test_map.py1
-rw-r--r--src/plugins/memif/test/test_memif.py8
-rw-r--r--src/plugins/memif/test/vpp_memif.py9
-rw-r--r--src/plugins/nat/test/test_nat.py20
-rw-r--r--src/vnet/ip/ip_format_fns.h4
-rw-r--r--test/bfd.py37
-rw-r--r--test/test_bond.py3
-rw-r--r--test/test_interface_crud.py4
-rw-r--r--test/test_ip4.py38
-rw-r--r--test/test_ip6.py19
-rw-r--r--test/test_vxlan_gbp.py9
-rw-r--r--test/vpp_interface.py49
-rw-r--r--test/vpp_ip.py163
-rw-r--r--test/vpp_ip_route.py76
-rw-r--r--test/vpp_l2.py1
-rw-r--r--test/vpp_papi_provider.py9
-rw-r--r--test/vpp_vxlan_gbp_tunnel.py20
19 files changed, 410 insertions, 541 deletions
diff --git a/src/plugins/dns/test/test_dns.py b/src/plugins/dns/test/test_dns.py
index 55923e26057..fb8958c511b 100644
--- a/src/plugins/dns/test/test_dns.py
+++ b/src/plugins/dns/test/test_dns.py
@@ -4,7 +4,6 @@ import unittest
from framework import VppTestCase, VppTestRunner
from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath
-from vpp_ip import VppIpPrefix
from ipaddress import *
import scapy.compat
@@ -88,7 +87,7 @@ class TestDns(VppTestCase):
# Configure 127.0.0.1/8 on the pg interface
self.vapi.sw_interface_add_del_address(
sw_if_index=self.pg0.sw_if_index,
- prefix=VppIpPrefix("127.0.0.1", 8).encode())
+ prefix="127.0.0.1/8")
# Send a couple of DNS request packets, one for bozo.clown.org
# and one for no.clown.org which won't resolve
diff --git a/src/plugins/gbp/test/test_gbp.py b/src/plugins/gbp/test/test_gbp.py
index 315e1667b6e..ab4e3a59abd 100644
--- a/src/plugins/gbp/test/test_gbp.py
+++ b/src/plugins/gbp/test/test_gbp.py
@@ -2,6 +2,7 @@
from socket import AF_INET, AF_INET6
import unittest
+from ipaddress import ip_address, IPv4Network, IPv6Network
from scapy.packet import Raw
from scapy.layers.l2 import Ether, ARP, Dot1Q
@@ -22,7 +23,7 @@ from vpp_ip_route import VppIpRoute, VppRoutePath, VppIpTable, \
from vpp_l2 import VppBridgeDomain, VppBridgeDomainPort, \
VppBridgeDomainArpEntry, VppL2FibEntry, find_bridge_domain_port, VppL2Vtr
from vpp_sub_interface import L2_VTR_OP, VppDot1QSubint
-from vpp_ip import VppIpAddress, VppIpPrefix, DpoProto
+from vpp_ip import DpoProto, get_dpo_proto
from vpp_papi import VppEnum, MACAddress
from vpp_vxlan_gbp_tunnel import find_vxlan_gbp_tunnel, INDEX_INVALID, \
VppVxlanGbpTunnel
@@ -38,7 +39,7 @@ NUM_PKTS = 67
def find_gbp_endpoint(test, sw_if_index=None, ip=None, mac=None,
tep=None, sclass=None):
if ip:
- vip = VppIpAddress(ip)
+ vip = ip
if mac:
vmac = MACAddress(mac)
@@ -46,9 +47,10 @@ def find_gbp_endpoint(test, sw_if_index=None, ip=None, mac=None,
for ep in eps:
if tep:
- src = VppIpAddress(tep[0])
- dst = VppIpAddress(tep[1])
- if src != ep.endpoint.tun.src or dst != ep.endpoint.tun.dst:
+ src = tep[0]
+ dst = tep[1]
+ if src != str(ep.endpoint.tun.src) or \
+ dst != str(ep.endpoint.tun.dst):
continue
if sw_if_index:
if ep.endpoint.sw_if_index != sw_if_index:
@@ -58,10 +60,10 @@ def find_gbp_endpoint(test, sw_if_index=None, ip=None, mac=None,
continue
if ip:
for eip in ep.endpoint.ips:
- if vip == eip:
+ if vip == str(eip):
return True
if mac:
- if vmac.packed == ep.endpoint.mac:
+ if vmac == ep.endpoint.mac:
return True
return False
@@ -118,10 +120,10 @@ class VppGbpEndpoint(VppObject):
self.epg = epg
self.recirc = recirc
- self._ip4 = VppIpAddress(ip4)
- self._fip4 = VppIpAddress(fip4)
- self._ip6 = VppIpAddress(ip6)
- self._fip6 = VppIpAddress(fip6)
+ self._ip4 = ip4
+ self._fip4 = fip4
+ self._ip6 = ip6
+ self._fip6 = fip6
if mac:
self.vmac = MACAddress(self.itf.remote_mac)
@@ -129,18 +131,18 @@ class VppGbpEndpoint(VppObject):
self.vmac = MACAddress("00:00:00:00:00:00")
self.flags = flags
- self.tun_src = VppIpAddress(tun_src)
- self.tun_dst = VppIpAddress(tun_dst)
+ self.tun_src = tun_src
+ self.tun_dst = tun_dst
def add_vpp_config(self):
res = self._test.vapi.gbp_endpoint_add(
self.itf.sw_if_index,
- [self.ip4.encode(), self.ip6.encode()],
+ [self.ip4, self.ip6],
self.vmac.packed,
self.epg.sclass,
self.flags,
- self.tun_src.encode(),
- self.tun_dst.encode())
+ self.tun_src,
+ self.tun_dst)
self.handle = res.handle
self._test.registry.register(self, self._test.logger)
@@ -150,13 +152,13 @@ class VppGbpEndpoint(VppObject):
def object_id(self):
return "gbp-endpoint:[%d==%d:%s:%d]" % (self.handle,
self.itf.sw_if_index,
- self.ip4.address,
+ self.ip4,
self.epg.sclass)
def query_vpp_config(self):
return find_gbp_endpoint(self._test,
self.itf.sw_if_index,
- self.ip4.address)
+ self.ip4)
class VppGbpRecirc(VppObject):
@@ -238,7 +240,13 @@ class VppGbpSubnet(VppObject):
type, sw_if_index=None, sclass=None):
self._test = test
self.rd_id = rd.rd_id
- self.prefix = VppIpPrefix(address, address_len)
+ a = ip_address(address)
+ if 4 == a.version:
+ self.prefix = IPv4Network("%s/%d" % (address, address_len),
+ strict=False)
+ else:
+ self.prefix = IPv6Network("%s/%d" % (address, address_len),
+ strict=False)
self.type = type
self.sw_if_index = sw_if_index
self.sclass = sclass
@@ -247,7 +255,7 @@ class VppGbpSubnet(VppObject):
self._test.vapi.gbp_subnet_add_del(
1,
self.rd_id,
- self.prefix.encode(),
+ self.prefix,
self.type,
sw_if_index=self.sw_if_index if self.sw_if_index else 0xffffffff,
sclass=self.sclass if self.sclass else 0xffff)
@@ -257,7 +265,7 @@ class VppGbpSubnet(VppObject):
self._test.vapi.gbp_subnet_add_del(
0,
self.rd_id,
- self.prefix.encode(),
+ self.prefix,
self.type)
def object_id(self):
@@ -292,8 +300,8 @@ class VppGbpEndpointGroup(VppObject):
self._test = test
self.uplink = uplink
self.bvi = bvi
- self.bvi_ip4 = VppIpAddress(bvi_ip4)
- self.bvi_ip6 = VppIpAddress(bvi_ip6)
+ self.bvi_ip4 = bvi_ip4
+ self.bvi_ip6 = bvi_ip6
self.vnid = vnid
self.bd = bd
self.rd = rd
@@ -424,7 +432,7 @@ class VppGbpContractNextHop():
self.rd = rd
def encode(self):
- return {'ip': self.ip.encode(),
+ return {'ip': self.ip,
'mac': self.mac.packed,
'bd_id': self.bd.bd.bd_id,
'rd_id': self.rd.rd_id}
@@ -898,10 +906,10 @@ class TestGBP(VppTestCase):
# add the BD ARP termination entry for BVI IP
epg.bd_arp_ip4 = VppBridgeDomainArpEntry(self, epg.bd.bd,
str(self.router_mac),
- epg.bvi_ip4.address)
+ epg.bvi_ip4)
epg.bd_arp_ip6 = VppBridgeDomainArpEntry(self, epg.bd.bd,
str(self.router_mac),
- epg.bvi_ip6.address)
+ epg.bvi_ip6)
epg.bd_arp_ip4.add_vpp_config()
epg.bd_arp_ip6.add_vpp_config()
@@ -938,19 +946,19 @@ class TestGBP(VppTestCase):
#
for (ip, fip) in zip(ep.ips, ep.fips):
# Add static mappings for each EP from the 10/8 to 11/8 network
- if ip.af == AF_INET:
+ if ip_address(ip).version == 4:
flags = self.config_flags.NAT_IS_ADDR_ONLY
self.vapi.nat44_add_del_static_mapping(
is_add=1,
- local_ip_address=ip.bytes,
- external_ip_address=fip.bytes,
+ local_ip_address=ip,
+ external_ip_address=fip,
external_sw_if_index=0xFFFFFFFF,
vrf_id=0,
flags=flags)
else:
self.vapi.nat66_add_del_static_mapping(
- local_ip_address=ip.bytes,
- external_ip_address=fip.bytes,
+ local_ip_address=ip,
+ external_ip_address=fip,
vrf_id=0, is_add=1)
# VPP EP create ...
@@ -964,27 +972,27 @@ class TestGBP(VppTestCase):
for ii, ip in enumerate(ep.ips):
p = rx[ii]
- if ip.is_ip6:
+ if ip_address(ip).version == 6:
self.assertTrue(p.haslayer(ICMPv6ND_NA))
- self.assertEqual(p[ICMPv6ND_NA].tgt, ip.address)
+ self.assertEqual(p[ICMPv6ND_NA].tgt, ip)
else:
self.assertTrue(p.haslayer(ARP))
- self.assertEqual(p[ARP].psrc, ip.address)
- self.assertEqual(p[ARP].pdst, ip.address)
+ self.assertEqual(p[ARP].psrc, ip)
+ self.assertEqual(p[ARP].pdst, ip)
# add the BD ARP termination entry for floating IP
for fip in ep.fips:
ba = VppBridgeDomainArpEntry(self, epg_nat.bd.bd, ep.mac,
- fip.address)
+ fip)
ba.add_vpp_config()
# floating IPs route via EPG recirc
r = VppIpRoute(
- self, fip.address, fip.length,
- [VppRoutePath(fip.address,
+ self, fip, ip_address(fip).max_prefixlen,
+ [VppRoutePath(fip,
ep.recirc.recirc.sw_if_index,
type=FibPathType.FIB_PATH_TYPE_DVR,
- proto=fip.dpo_proto)],
+ proto=get_dpo_proto(fip))],
table_id=20)
r.add_vpp_config()
@@ -1021,17 +1029,17 @@ class TestGBP(VppTestCase):
ARP(op="who-has",
hwdst="ff:ff:ff:ff:ff:ff",
hwsrc=self.pg0.remote_mac,
- pdst=epgs[0].bvi_ip4.address,
- psrc=eps[0].ip4.address))
+ pdst=epgs[0].bvi_ip4,
+ psrc=eps[0].ip4))
self.send_and_expect(self.pg0, [pkt_arp], self.pg0)
- nsma = in6_getnsma(inet_pton(AF_INET6, eps[0].ip6.address))
+ nsma = in6_getnsma(inet_pton(AF_INET6, eps[0].ip6))
d = inet_ntop(AF_INET6, nsma)
pkt_nd = (Ether(dst=in6_getnsmac(nsma),
src=self.pg0.remote_mac) /
- IPv6(dst=d, src=eps[0].ip6.address) /
- ICMPv6ND_NS(tgt=epgs[0].bvi_ip6.address) /
+ IPv6(dst=d, src=eps[0].ip6) /
+ ICMPv6ND_NS(tgt=epgs[0].bvi_ip6) /
ICMPv6NDOptSrcLLAddr(lladdr=self.pg0.remote_mac))
self.send_and_expect(self.pg0, [pkt_nd], self.pg0)
@@ -1040,7 +1048,7 @@ class TestGBP(VppTestCase):
#
pkt_bcast = (Ether(dst="ff:ff:ff:ff:ff:ff",
src=self.pg0.remote_mac) /
- IP(src=eps[0].ip4.address, dst="232.1.1.1") /
+ IP(src=eps[0].ip4, dst="232.1.1.1") /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -1060,13 +1068,13 @@ class TestGBP(VppTestCase):
#
pkt_intra_epg_220_ip4 = (Ether(src=self.pg0.remote_mac,
dst=str(self.router_mac)) /
- IP(src=eps[0].ip4.address,
+ IP(src=eps[0].ip4,
dst="10.0.0.99") /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
pkt_inter_epg_222_ip4 = (Ether(src=self.pg0.remote_mac,
dst=str(self.router_mac)) /
- IP(src=eps[0].ip4.address,
+ IP(src=eps[0].ip4,
dst="10.0.1.99") /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -1076,7 +1084,7 @@ class TestGBP(VppTestCase):
pkt_inter_epg_222_ip6 = (Ether(src=self.pg0.remote_mac,
dst=str(self.router_mac)) /
- IPv6(src=eps[0].ip6.address,
+ IPv6(src=eps[0].ip6,
dst="2001:10::99") /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -1137,7 +1145,7 @@ class TestGBP(VppTestCase):
#
pkt_intra_epg_220_to_uplink = (Ether(src=self.pg0.remote_mac,
dst="00:00:00:33:44:55") /
- IP(src=eps[0].ip4.address,
+ IP(src=eps[0].ip4,
dst="10.0.0.99") /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -1151,7 +1159,7 @@ class TestGBP(VppTestCase):
pkt_intra_epg_221_to_uplink = (Ether(src=self.pg2.remote_mac,
dst="00:00:00:33:44:66") /
- IP(src=eps[0].ip4.address,
+ IP(src=eps[0].ip4,
dst="10.0.0.99") /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -1165,7 +1173,7 @@ class TestGBP(VppTestCase):
#
pkt_intra_epg_220_from_uplink = (Ether(src="00:00:00:33:44:55",
dst=self.pg0.remote_mac) /
- IP(src=eps[0].ip4.address,
+ IP(src=eps[0].ip4,
dst="10.0.0.99") /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -1180,8 +1188,8 @@ class TestGBP(VppTestCase):
#
pkt_intra_epg = (Ether(src=self.pg0.remote_mac,
dst=self.pg1.remote_mac) /
- IP(src=eps[0].ip4.address,
- dst=eps[1].ip4.address) /
+ IP(src=eps[0].ip4,
+ dst=eps[1].ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -1195,20 +1203,20 @@ class TestGBP(VppTestCase):
#
pkt_inter_epg_220_to_221 = (Ether(src=self.pg0.remote_mac,
dst=self.pg2.remote_mac) /
- IP(src=eps[0].ip4.address,
- dst=eps[2].ip4.address) /
+ IP(src=eps[0].ip4,
+ dst=eps[2].ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
pkt_inter_epg_221_to_220 = (Ether(src=self.pg2.remote_mac,
dst=self.pg0.remote_mac) /
- IP(src=eps[2].ip4.address,
- dst=eps[0].ip4.address) /
+ IP(src=eps[2].ip4,
+ dst=eps[0].ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
pkt_inter_epg_220_to_222 = (Ether(src=self.pg0.remote_mac,
dst=str(self.router_mac)) /
- IP(src=eps[0].ip4.address,
- dst=eps[3].ip4.address) /
+ IP(src=eps[0].ip4,
+ dst=eps[3].ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -1380,7 +1388,7 @@ class TestGBP(VppTestCase):
#
pkt_inter_epg_220_to_global = (Ether(src=self.pg0.remote_mac,
dst=str(self.router_mac)) /
- IP(src=eps[0].ip4.address,
+ IP(src=eps[0].ip4,
dst="1.1.1.1") /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -1413,11 +1421,11 @@ class TestGBP(VppTestCase):
self.send_and_expect_natted(eps[0].itf,
pkt_inter_epg_220_to_global * NUM_PKTS,
self.pg7,
- eps[0].fip4.address)
+ eps[0].fip4)
pkt_inter_epg_220_to_global = (Ether(src=self.pg0.remote_mac,
dst=str(self.router_mac)) /
- IPv6(src=eps[0].ip6.address,
+ IPv6(src=eps[0].ip6,
dst="6001::1") /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -1425,14 +1433,14 @@ class TestGBP(VppTestCase):
self.send_and_expect_natted6(self.pg0,
pkt_inter_epg_220_to_global * NUM_PKTS,
self.pg7,
- eps[0].fip6.address)
+ eps[0].fip6)
#
# From a global address to an EP: OUT2IN
#
pkt_inter_epg_220_from_global = (Ether(src=str(self.router_mac),
dst=self.pg0.remote_mac) /
- IP(dst=eps[0].fip4.address,
+ IP(dst=eps[0].fip4,
src="1.1.1.1") /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -1456,11 +1464,11 @@ class TestGBP(VppTestCase):
self.send_and_expect_unnatted(self.pg7,
pkt_inter_epg_220_from_global * NUM_PKTS,
eps[0].itf,
- eps[0].ip4.address)
+ eps[0].ip4)
pkt_inter_epg_220_from_global = (Ether(src=str(self.router_mac),
dst=self.pg0.remote_mac) /
- IPv6(dst=eps[0].fip6.address,
+ IPv6(dst=eps[0].fip6,
src="6001::1") /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -1469,7 +1477,7 @@ class TestGBP(VppTestCase):
self.pg7,
pkt_inter_epg_220_from_global * NUM_PKTS,
eps[0].itf,
- eps[0].ip6.address)
+ eps[0].ip6)
#
# From a local VM to another local VM using resp. public addresses:
@@ -1477,21 +1485,21 @@ class TestGBP(VppTestCase):
#
pkt_intra_epg_220_global = (Ether(src=self.pg0.remote_mac,
dst=str(self.router_mac)) /
- IP(src=eps[0].ip4.address,
- dst=eps[1].fip4.address) /
+ IP(src=eps[0].ip4,
+ dst=eps[1].fip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
self.send_and_expect_double_natted(eps[0].itf,
pkt_intra_epg_220_global * NUM_PKTS,
eps[1].itf,
- eps[0].fip4.address,
- eps[1].ip4.address)
+ eps[0].fip4,
+ eps[1].ip4)
pkt_intra_epg_220_global = (Ether(src=self.pg0.remote_mac,
dst=str(self.router_mac)) /
- IPv6(src=eps[0].ip6.address,
- dst=eps[1].fip6.address) /
+ IPv6(src=eps[0].ip6,
+ dst=eps[1].fip6) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -1499,8 +1507,8 @@ class TestGBP(VppTestCase):
eps[0].itf,
pkt_intra_epg_220_global * NUM_PKTS,
eps[1].itf,
- eps[0].fip6.address,
- eps[1].ip6.address)
+ eps[0].fip6,
+ eps[1].ip6)
#
# cleanup
@@ -1510,14 +1518,14 @@ class TestGBP(VppTestCase):
flags = self.config_flags.NAT_IS_ADDR_ONLY
self.vapi.nat44_add_del_static_mapping(
is_add=0,
- local_ip_address=ep.ip4.bytes,
- external_ip_address=ep.fip4.bytes,
+ local_ip_address=ep.ip4,
+ external_ip_address=ep.fip4,
external_sw_if_index=0xFFFFFFFF,
vrf_id=0,
flags=flags)
self.vapi.nat66_add_del_static_mapping(
- local_ip_address=ep.ip6.bytes,
- external_ip_address=ep.fip6.bytes,
+ local_ip_address=ep.ip6,
+ external_ip_address=ep.fip6,
vrf_id=0, is_add=0)
for epg in epgs:
@@ -1651,7 +1659,7 @@ class TestGBP(VppTestCase):
"2001:10::1", "3001::1")
ep.add_vpp_config()
- self.assertTrue(find_route(self, ep.ip4.address, 32, table_id=1))
+ self.assertTrue(find_route(self, ep.ip4, 32, table_id=1))
# a packet with an sclass from an unknown EPG
p = (Ether(src=self.pg2.remote_mac,
@@ -1661,7 +1669,7 @@ class TestGBP(VppTestCase):
UDP(sport=1234, dport=48879) /
VXLAN(vni=99, gpid=88, flags=0x88) /
Ether(src=learnt[0]["mac"], dst=ep.mac) /
- IP(src=learnt[0]["ip"], dst=ep.ip4.address) /
+ IP(src=learnt[0]["ip"], dst=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -1698,7 +1706,7 @@ class TestGBP(VppTestCase):
UDP(sport=1234, dport=48879) /
VXLAN(vni=99, gpid=112, flags=0x88) /
Ether(src=l['mac'], dst=ep.mac) /
- IP(src=l['ip'], dst=ep.ip4.address) /
+ IP(src=l['ip'], dst=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -1841,7 +1849,7 @@ class TestGBP(VppTestCase):
UDP(sport=1234, dport=48879) /
VXLAN(vni=99, gpid=112, flags=0x88, gpflags="D") /
Ether(src=l['mac'], dst=ep.mac) /
- IP(src=l['ip'], dst=ep.ip4.address) /
+ IP(src=l['ip'], dst=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -1866,7 +1874,7 @@ class TestGBP(VppTestCase):
UDP(sport=1234, dport=48879) /
VXLAN(vni=99, gpid=112, flags=0xc8) /
Ether(src=l['mac'], dst=ep.mac) /
- IP(src=l['ip'], dst=ep.ip4.address) /
+ IP(src=l['ip'], dst=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -1882,7 +1890,7 @@ class TestGBP(VppTestCase):
self.logger.info(self.vapi.cli("sh l2fib bd_id 1"))
for l in learnt:
p = (Ether(src=ep.mac, dst=l['mac']) /
- IP(dst=l['ip'], src=ep.ip4.address) /
+ IP(dst=l['ip'], src=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -1918,7 +1926,7 @@ class TestGBP(VppTestCase):
UDP(sport=1234, dport=48879) /
VXLAN(vni=99, gpid=113, flags=0x88, gpflags='A') /
Ether(src=l['mac'], dst=ep.mac) /
- IP(src=l['ip'], dst=ep.ip4.address) /
+ IP(src=l['ip'], dst=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -1933,7 +1941,7 @@ class TestGBP(VppTestCase):
# only test 1 EP as the others could timeout
#
p = (Ether(src=ep.mac, dst=l['mac']) /
- IP(dst=learnt[0]['ip'], src=ep.ip4.address) /
+ IP(dst=learnt[0]['ip'], src=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -1951,7 +1959,7 @@ class TestGBP(VppTestCase):
UDP(sport=1234, dport=48879) /
VXLAN(vni=99, gpid=113, flags=0x88, gpflags='A') /
Ether(src=l['mac'], dst=ep.mac) /
- IP(src=l['ip'], dst=ep.ip4.address) /
+ IP(src=l['ip'], dst=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -1983,7 +1991,7 @@ class TestGBP(VppTestCase):
for l in learnt:
p = (Ether(src=ep.mac, dst=l['mac']) /
- IP(dst=l['ip'], src=ep.ip4.address) /
+ IP(dst=l['ip'], src=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -1995,7 +2003,7 @@ class TestGBP(VppTestCase):
self.logger.info(self.vapi.cli("sh gbp bridge"))
self.logger.info(self.vapi.cli("sh bridge-domain 1 detail"))
p_uu = (Ether(src=ep.mac, dst="00:11:11:11:11:11") /
- IP(dst="10.0.0.133", src=ep.ip4.address) /
+ IP(dst="10.0.0.133", src=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
rxs = self.send_and_expect(ep.itf, [p_uu], gbd1.uu_fwd)
@@ -2003,7 +2011,7 @@ class TestGBP(VppTestCase):
self.logger.info(self.vapi.cli("sh bridge 1 detail"))
p_bm = (Ether(src=ep.mac, dst="ff:ff:ff:ff:ff:ff") /
- IP(dst="10.0.0.133", src=ep.ip4.address) /
+ IP(dst="10.0.0.133", src=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
rxs = self.send_and_expect_only(ep.itf, [p_bm], tun_bm.mcast_itf)
@@ -2052,7 +2060,7 @@ class TestGBP(VppTestCase):
UDP(sport=1234, dport=48879) /
VXLAN(vni=99, gpid=113, flags=0x88) /
Ether(src=l['mac'], dst=ep.mac) /
- IPv6(src=l['ip6'], dst=ep.ip6.address) /
+ IPv6(src=l['ip6'], dst=ep.ip6) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -2084,7 +2092,7 @@ class TestGBP(VppTestCase):
UDP(sport=1234, dport=48879) /
VXLAN(vni=99, gpid=113, flags=0x88) /
Ether(src=l['mac'], dst=ep.mac) /
- IPv6(src=l['ip6'], dst=ep.ip6.address) /
+ IPv6(src=l['ip6'], dst=ep.ip6) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -2104,7 +2112,7 @@ class TestGBP(VppTestCase):
#
for l in learnt:
p = (Ether(src=ep.mac, dst=l['mac']) /
- IPv6(dst=l['ip6'], src=ep.ip6.address) /
+ IPv6(dst=l['ip6'], src=ep.ip6) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -2135,7 +2143,7 @@ class TestGBP(VppTestCase):
UDP(sport=1234, dport=48879) /
VXLAN(vni=99, gpid=112, flags=0x88) /
Ether(src=l['mac'], dst=ep.mac) /
- IPv6(src=l['ip6'], dst=ep.ip6.address) /
+ IPv6(src=l['ip6'], dst=ep.ip6) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -2158,7 +2166,7 @@ class TestGBP(VppTestCase):
for l in learnt:
p = (Ether(src=ep.mac, dst=l['mac']) /
- IPv6(dst=l['ip6'], src=ep.ip6.address) /
+ IPv6(dst=l['ip6'], src=ep.ip6) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -2272,7 +2280,7 @@ class TestGBP(VppTestCase):
# add the BD ARP termination entry for BVI IP
epg.bd_arp_ip4 = VppBridgeDomainArpEntry(self, epg.bd.bd,
str(self.router_mac),
- epg.bvi_ip4.address)
+ epg.bvi_ip4)
epg.bd_arp_ip4.add_vpp_config()
# EPG in VPP
@@ -2293,8 +2301,8 @@ class TestGBP(VppTestCase):
#
pkt_intra_epg_220_to_220 = (Ether(src=self.pg0.remote_mac,
dst=self.pg1.remote_mac) /
- IP(src=eps[0].ip4.address,
- dst=eps[1].ip4.address) /
+ IP(src=eps[0].ip4,
+ dst=eps[1].ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -2304,8 +2312,8 @@ class TestGBP(VppTestCase):
pkt_intra_epg_220_to_220 = (Ether(src=self.pg0.remote_mac,
dst=self.pg1.remote_mac) /
- IPv6(src=eps[0].ip6.address,
- dst=eps[1].ip6.address) /
+ IPv6(src=eps[0].ip6,
+ dst=eps[1].ip6) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -2318,8 +2326,8 @@ class TestGBP(VppTestCase):
#
pkt_inter_epg_220_to_221 = (Ether(src=self.pg0.remote_mac,
dst=self.pg2.remote_mac) /
- IP(src=eps[0].ip4.address,
- dst=eps[2].ip4.address) /
+ IP(src=eps[0].ip4,
+ dst=eps[2].ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -2356,8 +2364,8 @@ class TestGBP(VppTestCase):
pkt_inter_epg_220_to_222 = (Ether(src=self.pg0.remote_mac,
dst=str(self.router_mac)) /
- IP(src=eps[0].ip4.address,
- dst=eps[3].ip4.address) /
+ IP(src=eps[0].ip4,
+ dst=eps[3].ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
self.send_and_assert_no_replies(eps[0].itf,
@@ -2368,16 +2376,16 @@ class TestGBP(VppTestCase):
#
pkt_router_ping_220_to_221 = (Ether(src=self.pg0.remote_mac,
dst=str(self.router_mac)) /
- IP(src=eps[0].ip4.address,
- dst=epgs[1].bvi_ip4.address) /
+ IP(src=eps[0].ip4,
+ dst=epgs[1].bvi_ip4) /
ICMP(type='echo-request'))
self.send_and_expect(self.pg0, [pkt_router_ping_220_to_221], self.pg0)
pkt_router_ping_220_to_221 = (Ether(src=self.pg0.remote_mac,
dst=str(self.router_mac)) /
- IPv6(src=eps[0].ip6.address,
- dst=epgs[1].bvi_ip6.address) /
+ IPv6(src=eps[0].ip6,
+ dst=epgs[1].bvi_ip6) /
ICMPv6EchoRequest())
self.send_and_expect(self.pg0, [pkt_router_ping_220_to_221], self.pg0)
@@ -2403,8 +2411,8 @@ class TestGBP(VppTestCase):
eps[2].itf)
pkt_inter_epg_221_to_220 = (Ether(src=self.pg2.remote_mac,
dst=self.pg0.remote_mac) /
- IP(src=eps[2].ip4.address,
- dst=eps[0].ip4.address) /
+ IP(src=eps[2].ip4,
+ dst=eps[0].ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
self.send_and_expect_bridged(eps[2].itf,
@@ -2412,8 +2420,8 @@ class TestGBP(VppTestCase):
eps[0].itf)
pkt_inter_epg_221_to_220 = (Ether(src=self.pg2.remote_mac,
dst=str(self.router_mac)) /
- IP(src=eps[2].ip4.address,
- dst=eps[0].ip4.address) /
+ IP(src=eps[2].ip4,
+ dst=eps[0].ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
self.send_and_expect_routed(eps[2].itf,
@@ -2422,8 +2430,8 @@ class TestGBP(VppTestCase):
str(self.router_mac))
pkt_inter_epg_221_to_220 = (Ether(src=self.pg2.remote_mac,
dst=str(self.router_mac)) /
- IPv6(src=eps[2].ip6.address,
- dst=eps[0].ip6.address) /
+ IPv6(src=eps[2].ip6,
+ dst=eps[0].ip6) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
self.send_and_expect_routed6(eps[2].itf,
@@ -2511,13 +2519,13 @@ class TestGBP(VppTestCase):
self.logger.info(self.vapi.cli("sh bridge 1 detail"))
self.logger.info(self.vapi.cli("sh gbp bridge"))
p_uu = (Ether(src=ep.mac, dst="00:11:11:11:11:11") /
- IP(dst="10.0.0.133", src=ep.ip4.address) /
+ IP(dst="10.0.0.133", src=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
self.send_and_assert_no_replies(ep.itf, [p_uu])
p_bm = (Ether(src=ep.mac, dst="ff:ff:ff:ff:ff:ff") /
- IP(dst="10.0.0.133", src=ep.ip4.address) /
+ IP(dst="10.0.0.133", src=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
self.send_and_assert_no_replies(ep.itf, [p_bm])
@@ -2592,7 +2600,7 @@ class TestGBP(VppTestCase):
self.logger.info(self.vapi.cli("sh gbp bridge"))
p_arp = (Ether(src=ep.mac, dst="ff:ff:ff:ff:ff:ff") /
ARP(op="who-has",
- psrc=ep.ip4.address, pdst="10.0.0.99",
+ psrc=ep.ip4, pdst="10.0.0.99",
hwsrc=ep.mac,
hwdst="ff:ff:ff:ff:ff:ff"))
self.send_and_expect(ep.itf, [p_arp], self.pg4)
@@ -2692,7 +2700,7 @@ class TestGBP(VppTestCase):
"2001:10::1", "3001::1")
ep.add_vpp_config()
- self.assertTrue(find_route(self, ep.ip4.address, 32, table_id=1))
+ self.assertTrue(find_route(self, ep.ip4, 32, table_id=1))
#
# Send to the static EP
@@ -2707,7 +2715,7 @@ class TestGBP(VppTestCase):
UDP(sport=1234, dport=48879) /
VXLAN(vni=99, gpid=441, flags=0x88) /
Ether(src=l['mac'], dst=ep.mac) /
- IP(src=l['ip'], dst=ep.ip4.address) /
+ IP(src=l['ip'], dst=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -2742,7 +2750,7 @@ class TestGBP(VppTestCase):
for l in learnt:
p = (Ether(src=ep.mac, dst=l['mac']) /
Dot1Q(vlan=11) /
- IP(dst=l['ip'], src=ep.ip4.address) /
+ IP(dst=l['ip'], src=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -2880,7 +2888,7 @@ class TestGBP(VppTestCase):
UDP(sport=1234, dport=48879) /
VXLAN(vni=101, gpid=441, flags=0x88) /
Ether(src=l['mac'], dst="00:00:00:11:11:11") /
- IP(src=l['ip'], dst=ep.ip4.address) /
+ IP(src=l['ip'], dst=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -2904,7 +2912,7 @@ class TestGBP(VppTestCase):
#
for l in learnt:
p = (Ether(src=ep.mac, dst=self.loop0.local_mac) /
- IP(dst=l['ip'], src=ep.ip4.address) /
+ IP(dst=l['ip'], src=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -2926,7 +2934,7 @@ class TestGBP(VppTestCase):
self.assertEqual(inner[Ether].src, routed_src_mac)
self.assertEqual(inner[Ether].dst, routed_dst_mac)
- self.assertEqual(inner[IP].src, ep.ip4.address)
+ self.assertEqual(inner[IP].src, ep.ip4)
self.assertEqual(inner[IP].dst, l['ip'])
for l in learnt:
@@ -2947,7 +2955,7 @@ class TestGBP(VppTestCase):
UDP(sport=1234, dport=48879) /
VXLAN(vni=101, gpid=441, flags=0x88) /
Ether(src=l['mac'], dst="00:00:00:11:11:11") /
- IPv6(src=l['ip6'], dst=ep.ip6.address) /
+ IPv6(src=l['ip6'], dst=ep.ip6) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -2977,7 +2985,7 @@ class TestGBP(VppTestCase):
#
for l in learnt:
p = (Ether(src=ep.mac, dst=self.loop0.local_mac) /
- IPv6(dst=l['ip6'], src=ep.ip6.address) /
+ IPv6(dst=l['ip6'], src=ep.ip6) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -2999,7 +3007,7 @@ class TestGBP(VppTestCase):
self.assertEqual(inner[Ether].src, routed_src_mac)
self.assertEqual(inner[Ether].dst, routed_dst_mac)
- self.assertEqual(inner[IPv6].src, ep.ip6.address)
+ self.assertEqual(inner[IPv6].src, ep.ip6)
self.assertEqual(inner[IPv6].dst, l['ip6'])
self.logger.info(self.vapi.cli("sh gbp endpoint"))
@@ -3010,7 +3018,7 @@ class TestGBP(VppTestCase):
# Static sends to unknown EP with no route
#
p = (Ether(src=ep.mac, dst=self.loop0.local_mac) /
- IP(dst="10.0.0.99", src=ep.ip4.address) /
+ IP(dst="10.0.0.99", src=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -3028,14 +3036,14 @@ class TestGBP(VppTestCase):
# static pings router
#
p = (Ether(src=ep.mac, dst=self.loop0.local_mac) /
- IP(dst=epg_220.bvi_ip4.address, src=ep.ip4.address) /
+ IP(dst=epg_220.bvi_ip4, src=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
self.send_and_expect(self.pg0, p * NUM_PKTS, self.pg0)
p = (Ether(src=ep.mac, dst=self.loop0.local_mac) /
- IPv6(dst=epg_220.bvi_ip6.address, src=ep.ip6.address) /
+ IPv6(dst=epg_220.bvi_ip6, src=ep.ip6) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -3045,7 +3053,7 @@ class TestGBP(VppTestCase):
# packets to address in the subnet are sent on the uu-fwd
#
p = (Ether(src=ep.mac, dst=self.loop0.local_mac) /
- IP(dst="10.0.0.99", src=ep.ip4.address) /
+ IP(dst="10.0.0.99", src=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -3076,7 +3084,7 @@ class TestGBP(VppTestCase):
UDP(sport=1234, dport=48879) /
VXLAN(vni=101, gpid=441, flags=0x88) /
Ether(src=l['mac'], dst="00:00:00:11:11:11") /
- IP(src=l['ip'], dst=ep.ip4.address) /
+ IP(src=l['ip'], dst=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -3137,7 +3145,7 @@ class TestGBP(VppTestCase):
ips = ["10.0.0.88", learnt[0]['ip']]
for ip in ips:
p = (Ether(src=ep.mac, dst=self.loop0.local_mac) /
- IP(dst=ip, src=ep.ip4.address) /
+ IP(dst=ip, src=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -3159,7 +3167,7 @@ class TestGBP(VppTestCase):
self.assertEqual(inner[Ether].src, routed_src_mac)
self.assertEqual(inner[Ether].dst, routed_dst_mac)
- self.assertEqual(inner[IP].src, ep.ip4.address)
+ self.assertEqual(inner[IP].src, ep.ip4)
self.assertEqual(inner[IP].dst, ip)
#
@@ -3169,18 +3177,18 @@ class TestGBP(VppTestCase):
rep_88.remove_vpp_config()
rep_2.remove_vpp_config()
- self.assertTrue(find_gbp_endpoint(self, ip=rep_2.ip4.address))
+ self.assertTrue(find_gbp_endpoint(self, ip=rep_2.ip4))
p = (Ether(src=ep.mac, dst=self.loop0.local_mac) /
- IP(src=ep.ip4.address, dst=rep_2.ip4.address) /
+ IP(src=ep.ip4, dst=rep_2.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
rxs = self.send_and_expect(self.pg0, [p], self.pg2)
- self.assertFalse(find_gbp_endpoint(self, ip=rep_88.ip4.address))
+ self.assertFalse(find_gbp_endpoint(self, ip=rep_88.ip4))
p = (Ether(src=ep.mac, dst=self.loop0.local_mac) /
- IP(src=ep.ip4.address, dst=rep_88.ip4.address) /
+ IP(src=ep.ip4, dst=rep_88.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
rxs = self.send_and_expect(self.pg0, [p], self.pg4)
@@ -3190,8 +3198,8 @@ class TestGBP(VppTestCase):
# present (because it's DP learnt) when the TC ends so wait until
# it is removed
#
- self.wait_for_ep_timeout(ip=rep_88.ip4.address)
- self.wait_for_ep_timeout(ip=rep_2.ip4.address)
+ self.wait_for_ep_timeout(ip=rep_88.ip4)
+ self.wait_for_ep_timeout(ip=rep_2.ip4)
#
# Same as above, learn a remote EP via CP and DP
@@ -3214,19 +3222,19 @@ class TestGBP(VppTestCase):
UDP(sport=1234, dport=48879) /
VXLAN(vni=101, gpid=441, flags=0x88) /
Ether(src=l['mac'], dst="00:00:00:11:11:11") /
- IP(src="10.0.1.4", dst=ep.ip4.address) /
+ IP(src="10.0.1.4", dst=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
rxs = self.send_and_expect(self.pg2, p * NUM_PKTS, self.pg0)
self.assertTrue(find_gbp_endpoint(self,
vx_tun_l3._sw_if_index,
- ip=rep_3.ip4.address,
+ ip=rep_3.ip4,
tep=[self.pg2.local_ip4,
self.pg2.remote_hosts[2].ip4]))
p = (Ether(src=ep.mac, dst=self.loop0.local_mac) /
- IP(dst="10.0.1.4", src=ep.ip4.address) /
+ IP(dst="10.0.1.4", src=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
rxs = self.send_and_expect(self.pg0, p * NUM_PKTS, self.pg2)
@@ -3236,7 +3244,7 @@ class TestGBP(VppTestCase):
self.assertEqual(rx[IP].src, self.pg2.local_ip4)
self.assertEqual(rx[IP].dst, self.pg2.remote_hosts[2].ip4)
- self.wait_for_ep_timeout(ip=rep_3.ip4.address,
+ self.wait_for_ep_timeout(ip=rep_3.ip4,
tep=[self.pg2.local_ip4,
self.pg2.remote_hosts[2].ip4])
@@ -3257,7 +3265,7 @@ class TestGBP(VppTestCase):
UDP(sport=1234, dport=48879) /
VXLAN(vni=101, gpid=441, flags=0x88) /
Ether(src=l['mac'], dst="00:00:00:11:11:11") /
- IP(src=learnt[1]['ip'], dst=ep.ip4.address) /
+ IP(src=learnt[1]['ip'], dst=ep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -3447,19 +3455,19 @@ class TestGBP(VppTestCase):
# different dest ports on each so the are LB hashed differently
#
p4 = [(Ether(src=ep1.mac, dst=ep3.mac) /
- IP(src=ep1.ip4.address, dst=ep3.ip4.address) /
+ IP(src=ep1.ip4, dst=ep3.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100)),
(Ether(src=ep3.mac, dst=ep1.mac) /
- IP(src=ep3.ip4.address, dst=ep1.ip4.address) /
+ IP(src=ep3.ip4, dst=ep1.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))]
p6 = [(Ether(src=ep1.mac, dst=ep3.mac) /
- IPv6(src=ep1.ip6.address, dst=ep3.ip6.address) /
+ IPv6(src=ep1.ip6, dst=ep3.ip6) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100)),
(Ether(src=ep3.mac, dst=ep1.mac) /
- IPv6(src=ep3.ip6.address, dst=ep1.ip6.address) /
+ IPv6(src=ep3.ip6, dst=ep1.ip6) /
UDP(sport=1234, dport=1230) /
Raw(b'\xa5' * 100))]
@@ -3526,16 +3534,16 @@ class TestGBP(VppTestCase):
for rx in rxs:
self.assertEqual(rx[Ether].src, routed_src_mac)
self.assertEqual(rx[Ether].dst, sep1.mac)
- self.assertEqual(rx[IP].src, ep1.ip4.address)
- self.assertEqual(rx[IP].dst, ep3.ip4.address)
+ self.assertEqual(rx[IP].src, ep1.ip4)
+ self.assertEqual(rx[IP].dst, ep3.ip4)
rxs = self.send_and_expect(self.pg2, p4[1] * 17, sep2.itf)
for rx in rxs:
self.assertEqual(rx[Ether].src, routed_src_mac)
self.assertEqual(rx[Ether].dst, sep2.mac)
- self.assertEqual(rx[IP].src, ep3.ip4.address)
- self.assertEqual(rx[IP].dst, ep1.ip4.address)
+ self.assertEqual(rx[IP].src, ep3.ip4)
+ self.assertEqual(rx[IP].dst, ep1.ip4)
rxs = self.send_and_expect(self.pg0, p6[0] * 17, self.pg7)
@@ -3555,16 +3563,16 @@ class TestGBP(VppTestCase):
self.assertEqual(inner[Ether].src, routed_src_mac)
self.assertEqual(inner[Ether].dst, sep4.mac)
- self.assertEqual(inner[IPv6].src, ep1.ip6.address)
- self.assertEqual(inner[IPv6].dst, ep3.ip6.address)
+ self.assertEqual(inner[IPv6].src, ep1.ip6)
+ self.assertEqual(inner[IPv6].dst, ep3.ip6)
rxs = self.send_and_expect(self.pg2, p6[1] * 17, sep3.itf)
for rx in rxs:
self.assertEqual(rx[Ether].src, routed_src_mac)
self.assertEqual(rx[Ether].dst, sep3.mac)
- self.assertEqual(rx[IPv6].src, ep3.ip6.address)
- self.assertEqual(rx[IPv6].dst, ep1.ip6.address)
+ self.assertEqual(rx[IPv6].src, ep3.ip6)
+ self.assertEqual(rx[IPv6].dst, ep1.ip6)
#
# programme the unknown EP
@@ -3576,8 +3584,8 @@ class TestGBP(VppTestCase):
for rx in rxs:
self.assertEqual(rx[Ether].src, routed_src_mac)
self.assertEqual(rx[Ether].dst, sep4.mac)
- self.assertEqual(rx[IPv6].src, ep1.ip6.address)
- self.assertEqual(rx[IPv6].dst, ep3.ip6.address)
+ self.assertEqual(rx[IPv6].src, ep1.ip6)
+ self.assertEqual(rx[IPv6].dst, ep3.ip6)
#
# and revert back to unprogrammed
@@ -3602,8 +3610,8 @@ class TestGBP(VppTestCase):
self.assertEqual(inner[Ether].src, routed_src_mac)
self.assertEqual(inner[Ether].dst, sep4.mac)
- self.assertEqual(inner[IPv6].src, ep1.ip6.address)
- self.assertEqual(inner[IPv6].dst, ep3.ip6.address)
+ self.assertEqual(inner[IPv6].src, ep1.ip6)
+ self.assertEqual(inner[IPv6].dst, ep3.ip6)
c1.remove_vpp_config()
c2.remove_vpp_config()
@@ -3658,16 +3666,16 @@ class TestGBP(VppTestCase):
for rx in rxs:
self.assertEqual(rx[Ether].src, routed_src_mac)
self.assertEqual(rx[Ether].dst, sep1.mac)
- self.assertEqual(rx[IP].src, ep1.ip4.address)
- self.assertEqual(rx[IP].dst, ep3.ip4.address)
+ self.assertEqual(rx[IP].src, ep1.ip4)
+ self.assertEqual(rx[IP].dst, ep3.ip4)
rxs = self.send_and_expect(self.pg2, p4[1] * 17, sep1.itf)
for rx in rxs:
self.assertEqual(rx[Ether].src, routed_src_mac)
self.assertEqual(rx[Ether].dst, sep1.mac)
- self.assertEqual(rx[IP].src, ep3.ip4.address)
- self.assertEqual(rx[IP].dst, ep1.ip4.address)
+ self.assertEqual(rx[IP].src, ep3.ip4)
+ self.assertEqual(rx[IP].dst, ep1.ip4)
#
# programme the unknown EP for the L3 tests
@@ -3679,19 +3687,19 @@ class TestGBP(VppTestCase):
# different dest ports on each so the are LB hashed differently
#
p4 = [(Ether(src=ep1.mac, dst=str(self.router_mac)) /
- IP(src=ep1.ip4.address, dst=ep2.ip4.address) /
+ IP(src=ep1.ip4, dst=ep2.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100)),
(Ether(src=ep2.mac, dst=str(self.router_mac)) /
- IP(src=ep2.ip4.address, dst=ep1.ip4.address) /
+ IP(src=ep2.ip4, dst=ep1.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))]
p6 = [(Ether(src=ep1.mac, dst=str(self.router_mac)) /
- IPv6(src=ep1.ip6.address, dst=ep2.ip6.address) /
+ IPv6(src=ep1.ip6, dst=ep2.ip6) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100)),
(Ether(src=ep2.mac, dst=str(self.router_mac)) /
- IPv6(src=ep2.ip6.address, dst=ep1.ip6.address) /
+ IPv6(src=ep2.ip6, dst=ep1.ip6) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))]
@@ -3719,8 +3727,8 @@ class TestGBP(VppTestCase):
for rx in rxs:
self.assertEqual(rx[Ether].src, routed_src_mac)
self.assertEqual(rx[Ether].dst, sep1.mac)
- self.assertEqual(rx[IP].src, ep1.ip4.address)
- self.assertEqual(rx[IP].dst, ep2.ip4.address)
+ self.assertEqual(rx[IP].src, ep1.ip4)
+ self.assertEqual(rx[IP].dst, ep2.ip4)
#
# learn a remote EP in EPG 221
@@ -3758,7 +3766,7 @@ class TestGBP(VppTestCase):
UDP(sport=1234, dport=48879) /
VXLAN(vni=444, gpid=441, flags=0x88) /
Ether(src="00:22:22:22:22:33", dst=str(self.router_mac)) /
- IP(src="10.0.0.88", dst=ep1.ip4.address) /
+ IP(src="10.0.0.88", dst=ep1.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -3769,7 +3777,7 @@ class TestGBP(VppTestCase):
self.assertEqual(rx[Ether].src, routed_src_mac)
self.assertEqual(rx[Ether].dst, sep1.mac)
self.assertEqual(rx[IP].src, "10.0.0.88")
- self.assertEqual(rx[IP].dst, ep1.ip4.address)
+ self.assertEqual(rx[IP].dst, ep1.ip4)
# endpoint learnt via the parent GBP-vxlan interface
self.assertTrue(find_gbp_endpoint(self,
@@ -3783,7 +3791,7 @@ class TestGBP(VppTestCase):
UDP(sport=1234, dport=48879) /
VXLAN(vni=444, gpid=441, flags=0x88) /
Ether(src="00:22:22:22:22:33", dst=str(self.router_mac)) /
- IPv6(src="2001:10::88", dst=ep1.ip6.address) /
+ IPv6(src="2001:10::88", dst=ep1.ip6) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -3794,7 +3802,7 @@ class TestGBP(VppTestCase):
self.assertEqual(rx[Ether].src, routed_src_mac)
self.assertEqual(rx[Ether].dst, sep3.mac)
self.assertEqual(rx[IPv6].src, "2001:10::88")
- self.assertEqual(rx[IPv6].dst, ep1.ip6.address)
+ self.assertEqual(rx[IPv6].dst, ep1.ip6)
# endpoint learnt via the parent GBP-vxlan interface
self.assertTrue(find_gbp_endpoint(self,
@@ -3805,11 +3813,11 @@ class TestGBP(VppTestCase):
# L3 switch from local to remote EP
#
p4 = [(Ether(src=ep1.mac, dst=str(self.router_mac)) /
- IP(src=ep1.ip4.address, dst="10.0.0.88") /
+ IP(src=ep1.ip4, dst="10.0.0.88") /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))]
p6 = [(Ether(src=ep1.mac, dst=str(self.router_mac)) /
- IPv6(src=ep1.ip6.address, dst="2001:10::88") /
+ IPv6(src=ep1.ip6, dst="2001:10::88") /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))]
@@ -3818,7 +3826,7 @@ class TestGBP(VppTestCase):
for rx in rxs:
self.assertEqual(rx[Ether].src, routed_src_mac)
self.assertEqual(rx[Ether].dst, sep1.mac)
- self.assertEqual(rx[IP].src, ep1.ip4.address)
+ self.assertEqual(rx[IP].src, ep1.ip4)
self.assertEqual(rx[IP].dst, "10.0.0.88")
rxs = self.send_and_expect(self.pg0, p6[0] * 17, sep4.itf)
@@ -3826,7 +3834,7 @@ class TestGBP(VppTestCase):
for rx in rxs:
self.assertEqual(rx[Ether].src, routed_src_mac)
self.assertEqual(rx[Ether].dst, sep4.mac)
- self.assertEqual(rx[IPv6].src, ep1.ip6.address)
+ self.assertEqual(rx[IPv6].src, ep1.ip6)
self.assertEqual(rx[IPv6].dst, "2001:10::88")
#
@@ -3856,7 +3864,7 @@ class TestGBP(VppTestCase):
for rx in rxs:
self.assertEqual(rx[Ether].src, routed_src_mac)
self.assertEqual(rx[Ether].dst, sep1.mac)
- self.assertEqual(rx[IP].src, ep1.ip4.address)
+ self.assertEqual(rx[IP].src, ep1.ip4)
self.assertEqual(rx[IP].dst, "10.0.0.88")
rxs = self.send_and_expect(self.pg0, p6[0] * 17, sep3.itf)
@@ -3864,7 +3872,7 @@ class TestGBP(VppTestCase):
for rx in rxs:
self.assertEqual(rx[Ether].src, routed_src_mac)
self.assertEqual(rx[Ether].dst, sep3.mac)
- self.assertEqual(rx[IPv6].src, ep1.ip6.address)
+ self.assertEqual(rx[IPv6].src, ep1.ip6)
self.assertEqual(rx[IPv6].dst, "2001:10::88")
#
@@ -3941,25 +3949,25 @@ class TestGBP(VppTestCase):
# external subnets reachable though eep1 and eep2 respectively
VppIpRoute(self, "10.220.0.0", 24,
- [VppRoutePath(eep1.ip4.address, eep1.epg.bvi.sw_if_index)],
+ [VppRoutePath(eep1.ip4, eep1.epg.bvi.sw_if_index)],
table_id=t4.table_id).add_vpp_config()
VppGbpSubnet(self, rd1, "10.220.0.0", 24,
VppEnum.vl_api_gbp_subnet_type_t.GBP_API_SUBNET_L3_OUT,
sclass=4220).add_vpp_config()
VppIpRoute(self, "10:220::", 64,
- [VppRoutePath(eep1.ip6.address, eep1.epg.bvi.sw_if_index)],
+ [VppRoutePath(eep1.ip6, eep1.epg.bvi.sw_if_index)],
table_id=t6.table_id).add_vpp_config()
VppGbpSubnet(self, rd1, "10:220::", 64,
VppEnum.vl_api_gbp_subnet_type_t.GBP_API_SUBNET_L3_OUT,
sclass=4220).add_vpp_config()
VppIpRoute(self, "10.221.0.0", 24,
- [VppRoutePath(eep2.ip4.address, eep2.epg.bvi.sw_if_index)],
+ [VppRoutePath(eep2.ip4, eep2.epg.bvi.sw_if_index)],
table_id=t4.table_id).add_vpp_config()
VppGbpSubnet(self, rd1, "10.221.0.0", 24,
VppEnum.vl_api_gbp_subnet_type_t.GBP_API_SUBNET_L3_OUT,
sclass=4221).add_vpp_config()
VppIpRoute(self, "10:221::", 64,
- [VppRoutePath(eep2.ip6.address, eep2.epg.bvi.sw_if_index)],
+ [VppRoutePath(eep2.ip6, eep2.epg.bvi.sw_if_index)],
table_id=t6.table_id).add_vpp_config()
VppGbpSubnet(self, rd1, "10:221::", 64,
VppEnum.vl_api_gbp_subnet_type_t.GBP_API_SUBNET_L3_OUT,
@@ -4102,11 +4110,11 @@ class TestGBP(VppTestCase):
VXLAN(vni=444, gpid=441, flags=0x88) /
Ether(src="00:22:22:22:22:44", dst=str(self.router_mac)))
p = [(base /
- IP(src="10.0.1.100", dst=ep3.ip4.address) /
+ IP(src="10.0.1.100", dst=ep3.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100)),
(base /
- IPv6(src="2001:10::100", dst=ep3.ip6.address) /
+ IPv6(src="2001:10::100", dst=ep3.ip6) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))]
@@ -4358,19 +4366,19 @@ class TestGBP(VppTestCase):
# one node and service endpoint in another node)
#
p4 = [(Ether(src=ep1.mac, dst=str(self.router_mac)) /
- IP(src=ep1.ip4.address, dst=ep2.ip4.address) /
+ IP(src=ep1.ip4, dst=ep2.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100)),
(Ether(src=ep2.mac, dst=str(self.router_mac)) /
- IP(src=ep2.ip4.address, dst=ep1.ip4.address) /
+ IP(src=ep2.ip4, dst=ep1.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))]
p6 = [(Ether(src=ep1.mac, dst=str(self.router_mac)) /
- IPv6(src=ep1.ip6.address, dst=ep2.ip6.address) /
+ IPv6(src=ep1.ip6, dst=ep2.ip6) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100)),
(Ether(src=ep2.mac, dst=str(self.router_mac)) /
- IPv6(src=ep2.ip6.address, dst=ep1.ip6.address) /
+ IPv6(src=ep2.ip6, dst=ep1.ip6) /
UDP(sport=1234, dport=1230) /
Raw(b'\xa5' * 100))]
@@ -4442,8 +4450,8 @@ class TestGBP(VppTestCase):
self.assertEqual(inner[Ether].src, routed_src_mac)
self.assertEqual(inner[Ether].dst, sep1.mac)
- self.assertEqual(inner[IP].src, ep1.ip4.address)
- self.assertEqual(inner[IP].dst, ep2.ip4.address)
+ self.assertEqual(inner[IP].src, ep1.ip4)
+ self.assertEqual(inner[IP].dst, ep2.ip4)
rxs = self.send_and_expect(self.pg1, p4[1] * 17, self.pg7)
@@ -4463,8 +4471,8 @@ class TestGBP(VppTestCase):
self.assertEqual(inner[Ether].src, routed_src_mac)
self.assertEqual(inner[Ether].dst, sep1.mac)
- self.assertEqual(inner[IP].src, ep2.ip4.address)
- self.assertEqual(inner[IP].dst, ep1.ip4.address)
+ self.assertEqual(inner[IP].src, ep2.ip4)
+ self.assertEqual(inner[IP].dst, ep1.ip4)
rxs = self.send_and_expect(self.pg0, p6[0] * 17, self.pg7)
@@ -4481,8 +4489,8 @@ class TestGBP(VppTestCase):
self.assertEqual(inner[Ether].src, routed_src_mac)
self.assertEqual(inner[Ether].dst, sep1.mac)
- self.assertEqual(inner[IPv6].src, ep1.ip6.address)
- self.assertEqual(inner[IPv6].dst, ep2.ip6.address)
+ self.assertEqual(inner[IPv6].src, ep1.ip6)
+ self.assertEqual(inner[IPv6].dst, ep2.ip6)
rxs = self.send_and_expect(self.pg1, p6[1] * 17, self.pg7)
@@ -4502,8 +4510,8 @@ class TestGBP(VppTestCase):
self.assertEqual(inner[Ether].src, routed_src_mac)
self.assertEqual(inner[Ether].dst, sep1.mac)
- self.assertEqual(inner[IPv6].src, ep2.ip6.address)
- self.assertEqual(inner[IPv6].dst, ep1.ip6.address)
+ self.assertEqual(inner[IPv6].src, ep2.ip6)
+ self.assertEqual(inner[IPv6].dst, ep1.ip6)
# configure sep1: it is now local
# packets between ep1 and ep2 are redirected locally
@@ -4514,16 +4522,16 @@ class TestGBP(VppTestCase):
for rx in rxs:
self.assertEqual(rx[Ether].src, routed_src_mac)
self.assertEqual(rx[Ether].dst, sep1.mac)
- self.assertEqual(rx[IP].src, ep1.ip4.address)
- self.assertEqual(rx[IP].dst, ep2.ip4.address)
+ self.assertEqual(rx[IP].src, ep1.ip4)
+ self.assertEqual(rx[IP].dst, ep2.ip4)
rxs = self.send_and_expect(self.pg1, p6[1] * 17, sep1.itf)
for rx in rxs:
self.assertEqual(rx[Ether].src, routed_src_mac)
self.assertEqual(rx[Ether].dst, sep1.mac)
- self.assertEqual(rx[IPv6].src, ep2.ip6.address)
- self.assertEqual(rx[IPv6].dst, ep1.ip6.address)
+ self.assertEqual(rx[IPv6].src, ep2.ip6)
+ self.assertEqual(rx[IPv6].dst, ep1.ip6)
# packet coming from the l2 spine-proxy to sep1
p = (Ether(src=self.pg7.remote_mac,
@@ -4533,7 +4541,7 @@ class TestGBP(VppTestCase):
UDP(sport=1234, dport=48879) /
VXLAN(vni=116, gpid=440, gpflags=0x08, flags=0x88) /
Ether(src=str(self.router_mac), dst=sep1.mac) /
- IP(src=ep1.ip4.address, dst=ep2.ip4.address) /
+ IP(src=ep1.ip4, dst=ep2.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -4542,8 +4550,8 @@ class TestGBP(VppTestCase):
for rx in rxs:
self.assertEqual(rx[Ether].src, str(self.router_mac))
self.assertEqual(rx[Ether].dst, sep1.mac)
- self.assertEqual(rx[IP].src, ep1.ip4.address)
- self.assertEqual(rx[IP].dst, ep2.ip4.address)
+ self.assertEqual(rx[IP].src, ep1.ip4)
+ self.assertEqual(rx[IP].dst, ep2.ip4)
# contract for SEP to communicate with dst EP
c3 = VppGbpContract(
@@ -4565,7 +4573,7 @@ class TestGBP(VppTestCase):
# the rd UU (packet is routed)
p1 = (Ether(src=sep1.mac, dst=self.router_mac) /
- IP(src=ep1.ip4.address, dst=ep2.ip4.address) /
+ IP(src=ep1.ip4, dst=ep2.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -4583,8 +4591,8 @@ class TestGBP(VppTestCase):
inner = rx[VXLAN].payload
self.assertEqual(inner[Ether].src, routed_src_mac)
self.assertEqual(inner[Ether].dst, routed_dst_mac)
- self.assertEqual(inner[IP].src, ep1.ip4.address)
- self.assertEqual(inner[IP].dst, ep2.ip4.address)
+ self.assertEqual(inner[IP].src, ep1.ip4)
+ self.assertEqual(inner[IP].dst, ep2.ip4)
self.logger.info(self.vapi.cli("show bridge 3 detail"))
sep1.remove_vpp_config()
@@ -4603,7 +4611,7 @@ class TestGBP(VppTestCase):
UDP(sport=1234, dport=48879) /
VXLAN(vni=114, gpid=441, gpflags=0x09, flags=0x88) /
Ether(src=str(self.router_mac), dst=self.router_mac) /
- IP(src=ep1.ip4.address, dst=ep2.ip4.address) /
+ IP(src=ep1.ip4, dst=ep2.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -4612,8 +4620,8 @@ class TestGBP(VppTestCase):
for rx in rxs:
self.assertEqual(rx[Ether].src, str(self.router_mac))
self.assertEqual(rx[Ether].dst, self.pg1.remote_mac)
- self.assertEqual(rx[IP].src, ep1.ip4.address)
- self.assertEqual(rx[IP].dst, ep2.ip4.address)
+ self.assertEqual(rx[IP].src, ep1.ip4)
+ self.assertEqual(rx[IP].dst, ep2.ip4)
#
# bd_uu2.add_vpp_config()
@@ -4771,7 +4779,7 @@ class TestGBP(VppTestCase):
p_arp = (Ether(src=eep1.mac, dst="ff:ff:ff:ff:ff:ff") /
Dot1Q(vlan=100) /
ARP(op="who-has",
- psrc=eep1.ip4.address, pdst="10.0.0.128",
+ psrc=eep1.ip4, pdst="10.0.0.128",
hwsrc=eep1.mac, hwdst="ff:ff:ff:ff:ff:ff"))
rxs = self.send_and_expect(self.pg0, p_arp * 1, self.pg0)
@@ -4781,7 +4789,7 @@ class TestGBP(VppTestCase):
p_arp = (Ether(src=eep3.mac, dst="ff:ff:ff:ff:ff:ff") /
Dot1Q(vlan=102) /
ARP(op="who-has",
- psrc=eep3.ip4.address, pdst="10.0.0.128",
+ psrc=eep3.ip4, pdst="10.0.0.128",
hwsrc=eep3.mac, hwdst="ff:ff:ff:ff:ff:ff"))
rxs = self.send_and_expect(self.pg0, p_arp * 1, self.pg0)
@@ -4840,7 +4848,7 @@ class TestGBP(VppTestCase):
#
p = (Ether(src=eep1.mac, dst=str(self.router_mac)) /
Dot1Q(vlan=100) /
- IP(src=eep1.ip4.address, dst="10.0.0.128") /
+ IP(src=eep1.ip4, dst="10.0.0.128") /
ICMP(type='echo-request'))
rxs = self.send_and_expect(self.pg0, p * 1, self.pg0)
@@ -4855,7 +4863,7 @@ class TestGBP(VppTestCase):
#
p = (Ether(src=eep1.mac, dst=eep2.mac) /
Dot1Q(vlan=100) /
- IP(src=eep1.ip4.address, dst=eep2.ip4.address) /
+ IP(src=eep1.ip4, dst=eep2.ip4) /
ICMP(type='echo-request'))
rxs = self.send_and_expect(self.pg0, p * 1, self.pg0)
@@ -4870,7 +4878,7 @@ class TestGBP(VppTestCase):
#
p = (Ether(src=eep3.mac, dst=str(self.router_mac)) /
Dot1Q(vlan=102) /
- IP(src=eep3.ip4.address, dst="10.0.0.128") /
+ IP(src=eep3.ip4, dst="10.0.0.128") /
ICMP(type='echo-request'))
rxs = self.send_and_expect(self.pg0, p * 1, self.pg0)
@@ -4883,7 +4891,7 @@ class TestGBP(VppTestCase):
# A ip4 subnet reachable through the external EP1
#
ip_220 = VppIpRoute(self, "10.220.0.0", 24,
- [VppRoutePath(eep1.ip4.address,
+ [VppRoutePath(eep1.ip4,
eep1.epg.bvi.sw_if_index)],
table_id=t4.table_id)
ip_220.add_vpp_config()
@@ -4898,7 +4906,7 @@ class TestGBP(VppTestCase):
# An ip6 subnet reachable through the external EP1
#
ip6_220 = VppIpRoute(self, "10:220::", 64,
- [VppRoutePath(eep1.ip6.address,
+ [VppRoutePath(eep1.ip6,
eep1.epg.bvi.sw_if_index)],
table_id=t6.table_id)
ip6_220.add_vpp_config()
@@ -4913,7 +4921,7 @@ class TestGBP(VppTestCase):
# A subnet reachable through the external EP2
#
ip_221 = VppIpRoute(self, "10.221.0.0", 24,
- [VppRoutePath(eep2.ip4.address,
+ [VppRoutePath(eep2.ip4,
eep2.epg.bvi.sw_if_index)],
table_id=t4.table_id)
ip_221.add_vpp_config()
@@ -5042,7 +5050,7 @@ class TestGBP(VppTestCase):
#
p = (Ether(src=eep1.mac, dst=str(self.router_mac)) /
Dot1Q(vlan=100) /
- IP(src="10.220.0.1", dst=rep.ip4.address) /
+ IP(src="10.220.0.1", dst=rep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -5064,7 +5072,7 @@ class TestGBP(VppTestCase):
self.assertTrue(rx[VXLAN].gpflags.D)
inner = rx[VXLAN].payload
self.assertEqual(inner[IP].src, "10.220.0.1")
- self.assertEqual(inner[IP].dst, rep.ip4.address)
+ self.assertEqual(inner[IP].dst, rep.ip4)
#
# An external subnet reachable via the remote external EP
@@ -5309,7 +5317,7 @@ class TestGBP(VppTestCase):
#
p = (Ether(src=lep1.mac, dst=str(self.router_mac)) /
Dot1Q(vlan=144) /
- IP(src=lep1.ip4.address, dst="10.220.0.1") /
+ IP(src=lep1.ip4, dst="10.220.0.1") /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -5325,7 +5333,7 @@ class TestGBP(VppTestCase):
#
p = (Ether(src=lep1.mac, dst=str(self.router_mac)) /
Dot1Q(vlan=144) /
- IPv6(src=lep1.ip6.address, dst="10:220::1") /
+ IPv6(src=lep1.ip6, dst="10:220::1") /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -5340,9 +5348,9 @@ class TestGBP(VppTestCase):
# ip4 and ip6 subnets that load-balance
#
ip_20 = VppIpRoute(self, "10.20.0.0", 24,
- [VppRoutePath(eep1.ip4.address,
+ [VppRoutePath(eep1.ip4,
eep1.epg.bvi.sw_if_index),
- VppRoutePath(eep2.ip4.address,
+ VppRoutePath(eep2.ip4,
eep2.epg.bvi.sw_if_index)],
table_id=t4.table_id)
ip_20.add_vpp_config()
@@ -5354,9 +5362,9 @@ class TestGBP(VppTestCase):
l3o_20.add_vpp_config()
ip6_20 = VppIpRoute(self, "10:20::", 64,
- [VppRoutePath(eep1.ip6.address,
+ [VppRoutePath(eep1.ip6,
eep1.epg.bvi.sw_if_index),
- VppRoutePath(eep2.ip6.address,
+ VppRoutePath(eep2.ip6,
eep2.epg.bvi.sw_if_index)],
table_id=t6.table_id)
ip6_20.add_vpp_config()
@@ -5373,12 +5381,12 @@ class TestGBP(VppTestCase):
# two ip6 packets whose port are chosen so they load-balance
p = [(Ether(src=lep1.mac, dst=str(self.router_mac)) /
Dot1Q(vlan=144) /
- IPv6(src=lep1.ip6.address, dst="10:20::1") /
+ IPv6(src=lep1.ip6, dst="10:20::1") /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100)),
(Ether(src=lep1.mac, dst=str(self.router_mac)) /
Dot1Q(vlan=144) /
- IPv6(src=lep1.ip6.address, dst="10:20::1") /
+ IPv6(src=lep1.ip6, dst="10:20::1") /
UDP(sport=124, dport=1230) /
Raw(b'\xa5' * 100))]
@@ -5390,12 +5398,12 @@ class TestGBP(VppTestCase):
# two ip4 packets whose port are chosen so they load-balance
p = [(Ether(src=lep1.mac, dst=str(self.router_mac)) /
Dot1Q(vlan=144) /
- IP(src=lep1.ip4.address, dst="10.20.0.1") /
+ IP(src=lep1.ip4, dst="10.20.0.1") /
UDP(sport=1235, dport=1235) /
Raw(b'\xa5' * 100)),
(Ether(src=lep1.mac, dst=str(self.router_mac)) /
Dot1Q(vlan=144) /
- IP(src=lep1.ip4.address, dst="10.20.0.1") /
+ IP(src=lep1.ip4, dst="10.20.0.1") /
UDP(sport=124, dport=1230) /
Raw(b'\xa5' * 100))]
@@ -5705,7 +5713,7 @@ class TestGBP(VppTestCase):
UDP(sport=1234, dport=48879) /
VXLAN(vni=444, gpid=113, flags=0x88) /
Ether(src=self.pg0.remote_mac, dst=str(self.router_mac)) /
- IP(src=rep.ip4.address, dst="10.220.0.1") /
+ IP(src=rep.ip4, dst="10.220.0.1") /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -5716,7 +5724,7 @@ class TestGBP(VppTestCase):
#
p = (Ether(src=self.vlan_100.remote_mac, dst=str(self.router_mac)) /
Dot1Q(vlan=100) /
- IP(src="10.220.0.1", dst=rep.ip4.address) /
+ IP(src="10.220.0.1", dst=rep.ip4) /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
@@ -5738,7 +5746,7 @@ class TestGBP(VppTestCase):
self.assertTrue(rx[VXLAN].gpflags.D)
inner = rx[VXLAN].payload
self.assertEqual(inner[IP].src, "10.220.0.1")
- self.assertEqual(inner[IP].dst, rep.ip4.address)
+ self.assertEqual(inner[IP].dst, rep.ip4)
#
# An external subnet reachable via the remote external EP
diff --git a/src/plugins/map/test/test_map.py b/src/plugins/map/test/test_map.py
index c1fe05e1150..0bb7a859f8b 100644
--- a/src/plugins/map/test/test_map.py
+++ b/src/plugins/map/test/test_map.py
@@ -2,7 +2,6 @@
import ipaddress
import unittest
-from ipaddress import IPv6Network, IPv4Network
from framework import VppTestCase, VppTestRunner
from vpp_ip import DpoProto
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)
diff --git a/src/plugins/nat/test/test_nat.py b/src/plugins/nat/test/test_nat.py
index d430c5111a9..803f1b093af 100644
--- a/src/plugins/nat/test/test_nat.py
+++ b/src/plugins/nat/test/test_nat.py
@@ -27,7 +27,6 @@ from io import BytesIO
from vpp_papi import VppEnum
from vpp_ip_route import VppIpRoute, VppRoutePath, FibPathType
from vpp_neighbor import VppNeighbor
-from vpp_ip import VppIpAddress, VppIpPrefix
from scapy.all import bind_layers, Packet, ByteEnumField, ShortField, \
IPField, IntField, LongField, XByteField, FlagsField, FieldLenField, \
PacketListField
@@ -1505,16 +1504,13 @@ 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._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._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._remote_hosts[0]._ip4 = "172.16.255.2"
cls.pg6.set_table_ip4(20)
for i in cls.overlapping_interfaces:
@@ -1529,7 +1525,7 @@ class TestNAT44(MethodHolder):
cls.pg9.config_ip4()
cls.vapi.sw_interface_add_del_address(
sw_if_index=cls.pg9.sw_if_index,
- prefix=VppIpPrefix("10.0.0.1", 24).encode())
+ prefix="10.0.0.1/24")
cls.pg9.admin_up()
cls.pg9.resolve_arp()
@@ -4431,7 +4427,7 @@ class TestNAT44EndpointDependent(MethodHolder):
cls.pg4.config_ip4()
cls.vapi.sw_interface_add_del_address(
sw_if_index=cls.pg4.sw_if_index,
- prefix=VppIpPrefix("10.0.0.1", 24).encode())
+ prefix="10.0.0.1/24")
cls.pg4.admin_up()
cls.pg4.resolve_arp()
@@ -4441,8 +4437,7 @@ class TestNAT44EndpointDependent(MethodHolder):
zero_ip4 = 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._remote_hosts[0]._ip4 = "10.1.1.2"
cls.pg5.set_table_ip4(1)
cls.pg5.config_ip4()
@@ -4454,8 +4449,7 @@ class TestNAT44EndpointDependent(MethodHolder):
register=False)
r1.add_vpp_config()
- 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._remote_hosts[0]._ip4 = "10.1.2.2"
cls.pg6.set_table_ip4(1)
cls.pg6.config_ip4()
diff --git a/src/vnet/ip/ip_format_fns.h b/src/vnet/ip/ip_format_fns.h
index 0c2e0661ba0..810a866dc54 100644
--- a/src/vnet/ip/ip_format_fns.h
+++ b/src/vnet/ip/ip_format_fns.h
@@ -64,13 +64,13 @@ format_vl_api_address_t (u8 * s, va_list * args)
vl_api_address_t *a = va_arg (*args, vl_api_address_t *);
u32 indent __attribute__((unused)) = va_arg (*args, u32);
- switch (a->af) {
+ switch (clib_host_to_net_u32 (a->af)) {
case ADDRESS_IP4:
return format(s, "%U", format_ip4_address, &a->un.ip4);
case ADDRESS_IP6:
return format(s, "%U", format_ip6_address, &a->un.ip6);
}
- return format (s, "");
+ return format (s, "unknown-af");
}
static inline u8 *
diff --git a/test/bfd.py b/test/bfd.py
index e096284fbd7..9d44425ec9f 100644
--- a/test/bfd.py
+++ b/test/bfd.py
@@ -9,7 +9,6 @@ from scapy.fields import BitField, BitEnumField, XByteField, FlagsField,\
ConditionalField, StrField
from vpp_object import VppObject
from util import NumericConstant
-from vpp_ip import VppIpAddress
from vpp_papi import VppEnum
@@ -236,10 +235,10 @@ class VppBFDUDPSession(VppObject):
self._interface = interface
self._af = af
if local_addr:
- self._local_addr = VppIpAddress(local_addr)
+ self._local_addr = local_addr
else:
self._local_addr = None
- self._peer_addr = VppIpAddress(peer_addr)
+ self._peer_addr = peer_addr
self._desired_min_tx = desired_min_tx
self._required_min_rx = required_min_rx
self._detect_mult = detect_mult
@@ -275,12 +274,12 @@ class VppBFDUDPSession(VppObject):
return self._interface.local_ip6
else:
raise Exception("Unexpected af '%s'" % self.af)
- return self._local_addr.address
+ return self._local_addr
@property
def peer_addr(self):
""" BFD session peer address """
- return self._peer_addr.address
+ return self._peer_addr
def get_bfd_udp_session_dump_entry(self):
""" get the namedtuple entry from bfd udp session dump """
@@ -343,8 +342,8 @@ class VppBFDUDPSession(VppObject):
is_delayed = 1 if delayed else 0
self.test.vapi.bfd_udp_auth_activate(
sw_if_index=self._interface.sw_if_index,
- local_addr=self.local_addr.encode(),
- peer_addr=self.peer_addr.encode(),
+ local_addr=self.local_addr,
+ peer_addr=self.peer_addr,
bfd_key_id=self._bfd_key_id,
conf_key_id=conf_key_id,
is_delayed=is_delayed)
@@ -356,8 +355,8 @@ class VppBFDUDPSession(VppObject):
is_delayed = 1 if delayed else 0
self.test.vapi.bfd_udp_auth_deactivate(
sw_if_index=self._interface.sw_if_index,
- local_addr=self.local_addr.encode(),
- peer_addr=self.peer_addr.encode(),
+ local_addr=self.local_addr,
+ peer_addr=self.peer_addr,
is_delayed=is_delayed)
def modify_parameters(self,
@@ -375,8 +374,8 @@ class VppBFDUDPSession(VppObject):
desired_min_tx=self.desired_min_tx,
required_min_rx=self.required_min_rx,
detect_mult=self.detect_mult,
- local_addr=self.local_addr.encode(),
- peer_addr=self.peer_addr.encode())
+ local_addr=self.local_addr,
+ peer_addr=self.peer_addr)
def add_vpp_config(self):
bfd_key_id = self._bfd_key_id if self._sha1_key else None
@@ -386,8 +385,8 @@ class VppBFDUDPSession(VppObject):
desired_min_tx=self.desired_min_tx,
required_min_rx=self.required_min_rx,
detect_mult=self.detect_mult,
- local_addr=self.local_addr.encode(),
- peer_addr=self.peer_addr.encode(),
+ local_addr=self.local_addr,
+ peer_addr=self.peer_addr,
bfd_key_id=bfd_key_id,
conf_key_id=conf_key_id,
is_authenticated=is_authenticated)
@@ -399,8 +398,8 @@ class VppBFDUDPSession(VppObject):
def remove_vpp_config(self):
self.test.vapi.bfd_udp_del(self._interface.sw_if_index,
- local_addr=self.local_addr.encode(),
- peer_addr=self.peer_addr.encode())
+ local_addr=self.local_addr,
+ peer_addr=self.peer_addr)
def object_id(self):
return "bfd-udp-%s-%s-%s-%s" % (self._interface.sw_if_index,
@@ -413,12 +412,12 @@ class VppBFDUDPSession(VppObject):
self.test.vapi.bfd_udp_session_set_flags(
flags=VppEnum.vl_api_if_status_flags_t.IF_STATUS_API_FLAG_ADMIN_UP,
sw_if_index=self._interface.sw_if_index,
- local_addr=self.local_addr.encode(),
- peer_addr=self.peer_addr.encode())
+ local_addr=self.local_addr,
+ peer_addr=self.peer_addr)
def admin_down(self):
""" set bfd session admin-down """
self.test.vapi.bfd_udp_session_set_flags(
flags=0, sw_if_index=self._interface.sw_if_index,
- local_addr=self.local_addr.encode(),
- peer_addr=self.peer_addr.encode())
+ local_addr=self.local_addr,
+ peer_addr=self.peer_addr)
diff --git a/test/test_bond.py b/test/test_bond.py
index 1b6c10b14ae..29ad33d7a4e 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):
@@ -73,7 +72,7 @@ class TestBondInterface(VppTestCase):
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())
+ prefix="10.10.10.1/24")
self.pg2.config_ip4()
self.pg2.resolve_arp()
diff --git a/test/test_interface_crud.py b/test/test_interface_crud.py
index f701e2735a6..3ab83c95e98 100644
--- a/test/test_interface_crud.py
+++ b/test/test_interface_crud.py
@@ -85,7 +85,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()
@@ -132,7 +132,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 0f37e73fceb..5c268a8be2c 100644
--- a/test/test_ip4.py
+++ b/test/test_ip4.py
@@ -13,12 +13,10 @@ from six import moves
from framework import VppTestCase, VppTestRunner
from util import ppp
-from vpp_ip import VppIpPrefix
from vpp_ip_route import VppIpRoute, VppRoutePath, VppIpMRoute, \
VppMRoutePath, MRouteItfFlags, MRouteEntryFlags, VppMplsIpBind, \
VppMplsTable, VppIpTable, FibPathType, find_route, \
VppIpInterfaceAddress
-from vpp_ip import VppIpAddress
from vpp_sub_interface import VppSubInterface, VppDot1QSubint, VppDot1ADSubint
from vpp_papi import VppEnum
from vpp_neighbor import VppNeighbor
@@ -258,11 +256,9 @@ class TestIPv4IfAddrRoute(VppTestCase):
"""
# create two addresses, verify route not present
- if_addr1 = VppIpInterfaceAddress(self, self.pg0,
- VppIpAddress("10.10.10.10"), 24)
- if_addr2 = VppIpInterfaceAddress(self, self.pg0,
- VppIpAddress("10.10.10.20"), 24)
- self.assertFalse(if_addr1.query_vpp_config()) # 10.10.10.0/24
+ if_addr1 = VppIpInterfaceAddress(self, self.pg0, "10.10.10.10", 24)
+ if_addr2 = VppIpInterfaceAddress(self, self.pg0, "10.10.10.20", 24)
+ self.assertFalse(if_addr1.query_vpp_config()) # 10.10.10.10/24
self.assertFalse(find_route(self, "10.10.10.10", 32))
self.assertFalse(find_route(self, "10.10.10.20", 32))
self.assertFalse(find_route(self, "10.10.10.255", 32))
@@ -270,7 +266,7 @@ class TestIPv4IfAddrRoute(VppTestCase):
# configure first address, verify route present
if_addr1.add_vpp_config()
- self.assertTrue(if_addr1.query_vpp_config()) # 10.10.10.0/24
+ self.assertTrue(if_addr1.query_vpp_config()) # 10.10.10.10/24
self.assertTrue(find_route(self, "10.10.10.10", 32))
self.assertFalse(find_route(self, "10.10.10.20", 32))
self.assertTrue(find_route(self, "10.10.10.255", 32))
@@ -279,7 +275,8 @@ class TestIPv4IfAddrRoute(VppTestCase):
# configure second address, delete first, verify route not removed
if_addr2.add_vpp_config()
if_addr1.remove_vpp_config()
- self.assertTrue(if_addr1.query_vpp_config()) # 10.10.10.0/24
+ self.assertFalse(if_addr1.query_vpp_config()) # 10.10.10.10/24
+ self.assertTrue(if_addr2.query_vpp_config()) # 10.10.10.20/24
self.assertFalse(find_route(self, "10.10.10.10", 32))
self.assertTrue(find_route(self, "10.10.10.20", 32))
self.assertTrue(find_route(self, "10.10.10.255", 32))
@@ -287,7 +284,7 @@ class TestIPv4IfAddrRoute(VppTestCase):
# delete second address, verify route removed
if_addr2.remove_vpp_config()
- self.assertFalse(if_addr1.query_vpp_config()) # 10.10.10.0/24
+ self.assertFalse(if_addr2.query_vpp_config()) # 10.10.10.20/24
self.assertFalse(find_route(self, "10.10.10.10", 32))
self.assertFalse(find_route(self, "10.10.10.20", 32))
self.assertFalse(find_route(self, "10.10.10.255", 32))
@@ -451,11 +448,11 @@ class TestIPv4FibCrud(VppTestCase):
pkts = []
for _ in range(count):
- dst_addr = random.choice(routes).prefix.address
+ dst_addr = random.choice(routes).prefix.network_address
info = self.create_packet_info(src_if, dst_if)
payload = self.info_to_payload(info)
p = (Ether(dst=src_if.local_mac, src=src_if.remote_mac) /
- IP(src=src_if.remote_ip4, dst=dst_addr) /
+ IP(src=src_if.remote_ip4, dst=str(dst_addr)) /
UDP(sport=1234, dport=1234) /
Raw(payload))
info.data = p.copy()
@@ -491,11 +488,15 @@ class TestIPv4FibCrud(VppTestCase):
def verify_route_dump(self, routes):
for r in routes:
- self.assertTrue(find_route(self, r.prefix.address, r.prefix.len))
+ self.assertTrue(find_route(self,
+ r.prefix.network_address,
+ r.prefix.prefixlen))
def verify_not_in_route_dump(self, routes):
for r in routes:
- self.assertFalse(find_route(self, r.prefix.address, r.prefix.len))
+ self.assertFalse(find_route(self,
+ r.prefix.network_address,
+ r.prefix.prefixlen))
@classmethod
def setUpClass(cls):
@@ -923,7 +924,7 @@ class TestIPSubNets(VppTestCase):
self.vapi.sw_interface_add_del_address(
sw_if_index=self.pg0.sw_if_index,
- prefix=VppIpPrefix("10.10.10.10", 16).encode())
+ prefix="10.10.10.10/16")
pn = (Ether(src=self.pg1.remote_mac,
dst=self.pg1.local_mac) /
@@ -942,7 +943,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)
+ prefix="10.10.10.10/16",
+ is_add=0)
self.pg1.add_stream(pn)
self.pg_enable_capture(self.pg_interfaces)
@@ -961,7 +963,7 @@ class TestIPSubNets(VppTestCase):
self.vapi.sw_interface_add_del_address(
sw_if_index=self.pg0.sw_if_index,
- prefix=VppIpPrefix("10.10.10.10", 31).encode())
+ prefix="10.10.10.10/31")
pn = (Ether(src=self.pg1.remote_mac,
dst=self.pg1.local_mac) /
@@ -978,7 +980,7 @@ 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)
+ prefix="10.10.10.10/31", is_add=0)
self.pg1.add_stream(pn)
self.pg_enable_capture(self.pg_interfaces)
diff --git a/test/test_ip6.py b/test/test_ip6.py
index 4cd0828127d..36532cedf12 100644
--- a/test/test_ip6.py
+++ b/test/test_ip6.py
@@ -20,7 +20,7 @@ from six import moves
from framework import VppTestCase, VppTestRunner
from util import ppp, ip6_normalize, mk_ll_addr
-from vpp_ip import DpoProto, VppIpAddress
+from vpp_ip import DpoProto
from vpp_ip_route import VppIpRoute, VppRoutePath, find_route, VppIpMRoute, \
VppMRoutePath, MRouteItfFlags, MRouteEntryFlags, VppMplsIpBind, \
VppMplsRoute, VppMplsTable, VppIpTable, FibPathType, \
@@ -28,7 +28,7 @@ from vpp_ip_route import VppIpRoute, VppRoutePath, find_route, VppIpMRoute, \
from vpp_neighbor import find_nbr, VppNeighbor
from vpp_pg_interface import is_ipv6_misc
from vpp_sub_interface import VppSubInterface, VppDot1QSubint
-from ipaddress import IPv6Network, IPv4Network, IPv6Address
+from ipaddress import IPv6Network, IPv6Address
AF_INET6 = socket.AF_INET6
@@ -982,30 +982,29 @@ class TestIPv6IfAddrRoute(VppTestCase):
addr1 = "2001:10::10"
addr2 = "2001:10::20"
- if_addr1 = VppIpInterfaceAddress(self, self.pg0,
- VppIpAddress(addr1), 64)
- if_addr2 = VppIpInterfaceAddress(self, self.pg0,
- VppIpAddress(addr2), 64)
- self.assertFalse(if_addr1.query_vpp_config()) # 2001:10::/64
+ if_addr1 = VppIpInterfaceAddress(self, self.pg0, addr1, 64)
+ if_addr2 = VppIpInterfaceAddress(self, self.pg0, addr2, 64)
+ self.assertFalse(if_addr1.query_vpp_config())
self.assertFalse(find_route(self, addr1, 128))
self.assertFalse(find_route(self, addr2, 128))
# configure first address, verify route present
if_addr1.add_vpp_config()
- self.assertTrue(if_addr1.query_vpp_config()) # 2001:10::/64
+ self.assertTrue(if_addr1.query_vpp_config())
self.assertTrue(find_route(self, addr1, 128))
self.assertFalse(find_route(self, addr2, 128))
# configure second address, delete first, verify route not removed
if_addr2.add_vpp_config()
if_addr1.remove_vpp_config()
- self.assertTrue(if_addr1.query_vpp_config()) # 2001:10::/64
+ self.assertFalse(if_addr1.query_vpp_config())
+ self.assertTrue(if_addr2.query_vpp_config())
self.assertFalse(find_route(self, addr1, 128))
self.assertTrue(find_route(self, addr2, 128))
# delete second address, verify route removed
if_addr2.remove_vpp_config()
- self.assertFalse(if_addr1.query_vpp_config()) # 2001:10::/64
+ self.assertFalse(if_addr1.query_vpp_config())
self.assertFalse(find_route(self, addr1, 128))
self.assertFalse(find_route(self, addr2, 128))
diff --git a/test/test_vxlan_gbp.py b/test/test_vxlan_gbp.py
index 64e51b016cb..17ee66205b6 100644
--- a/test/test_vxlan_gbp.py
+++ b/test/test_vxlan_gbp.py
@@ -5,7 +5,6 @@ from util import ip4_range, reassemble4_ether
import unittest
from framework import VppTestCase, VppTestRunner
from template_bd import BridgeDomain
-from vpp_ip import VppIpAddress
from scapy.layers.l2 import Ether, Raw
from scapy.layers.inet import IP, UDP
@@ -104,8 +103,8 @@ class TestVxlanGbp(VppTestCase):
rip.add_vpp_config()
r = cls.vapi.vxlan_gbp_tunnel_add_del(
tunnel={
- 'src': VppIpAddress(cls.pg0.local_ip4).encode(),
- 'dst': VppIpAddress(dest_ip4).encode(),
+ 'src': cls.pg0.local_ip4,
+ 'dst': dest_ip4,
'vni': vni,
'instance': INVALID_INDEX,
'mcast_sw_if_index': INVALID_INDEX,
@@ -147,8 +146,8 @@ class TestVxlanGbp(VppTestCase):
cls.single_tunnel_bd = 1
r = cls.vapi.vxlan_gbp_tunnel_add_del(
tunnel={
- 'src': VppIpAddress(cls.pg0.local_ip4).encode(),
- 'dst': VppIpAddress(cls.pg0.remote_ip4).encode(),
+ 'src': cls.pg0.local_ip4,
+ 'dst': cls.pg0.remote_ip4,
'vni': cls.single_tunnel_bd,
'instance': INVALID_INDEX,
'mcast_sw_if_index': INVALID_INDEX,
diff --git a/test/vpp_interface.py b/test/vpp_interface.py
index a5f6f45fdaf..9bfa880e1c9 100644
--- a/test/vpp_interface.py
+++ b/test/vpp_interface.py
@@ -7,8 +7,7 @@ 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 ipaddress import IPv4Network
+from ipaddress import IPv4Network, IPv6Network
try:
text_type = unicode
@@ -46,31 +45,31 @@ class VppInterface(object):
@property
def local_ip4(self):
"""Local IPv4 address on VPP interface (string)."""
- return self._local_ip4.address
+ return self._local_ip4
@local_ip4.setter
def local_ip4(self, value):
- self._local_ip4.address = value
+ self._local_ip4 = value
@property
def local_ip4_prefix_len(self):
"""Local IPv4 prefix length """
- return self._local_ip4.len
+ return self._local_ip4_len
@local_ip4_prefix_len.setter
def local_ip4_prefix_len(self, value):
- self._local_ip4.len = value
+ self._local_ip4_len = value
@property
def local_ip4_prefix(self):
"""Local IPv4 prefix """
- return self._local_ip4
+ return ("%s/%d" % (self._local_ip4, self._local_ip4_len))
@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):
@@ -86,31 +85,31 @@ class VppInterface(object):
@property
def local_ip6(self):
"""Local IPv6 address on VPP interface (string)."""
- return self._local_ip6.address
+ return self._local_ip6
@local_ip6.setter
def local_ip6(self, value):
- self._local_ip6.address = value
+ self._local_ip6
@property
def local_ip6_prefix_len(self):
"""Local IPv6 prefix length """
- return self._local_ip6.len
+ return self._local_ip6_len
@local_ip6_prefix_len.setter
def local_ip6_prefix_len(self, value):
- self._local_ip6.len = value
+ self._local_ip6_len = value
@property
def local_ip6_prefix(self):
- """Local IPv6 prefix """
- return self._local_ip6
+ """Local IPv4 prefix """
+ return ("%s/%d" % (self._local_ip6, self._local_ip6_len))
@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):
@@ -126,7 +125,7 @@ class VppInterface(object):
@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):
@@ -233,7 +232,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)
@@ -242,13 +241,15 @@ 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_ip4_len = 24
self._local_ip4_subnet = "172.16.%u.0" % self.sw_if_index
self._local_ip4_bcast = "172.16.%u.255" % self.sw_if_index
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_ip6_len = 64
self.has_ip6_config = False
self.ip6_table_id = 0
@@ -269,13 +270,13 @@ 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._remote_ip6_ll = mk_ll_addr(self.remote_mac)
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, prefix=self.local_ip4_prefix)
self.has_ip4_config = True
def unconfig_ip4(self):
@@ -284,7 +285,7 @@ class VppInterface(object):
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)
+ prefix=self.local_ip4_prefix, is_add=0)
except AttributeError:
self.has_ip4_config = False
self.has_ip4_config = False
@@ -302,7 +303,7 @@ 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, prefix=self.local_ip6_prefix)
self.has_ip6_config = True
def unconfig_ip6(self):
@@ -311,7 +312,7 @@ class VppInterface(object):
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)
+ prefix=self.local_ip6_prefix, is_add=0)
except AttributeError:
self.has_ip6_config = False
self.has_ip6_config = False
diff --git a/test/vpp_ip.py b/test/vpp_ip.py
index 3bdfa62d223..8c3bbba307a 100644
--- a/test/vpp_ip.py
+++ b/test/vpp_ip.py
@@ -27,6 +27,13 @@ class DpoProto:
INVALID_INDEX = 0xffffffff
+def get_dpo_proto(addr):
+ if ip_address(addr).version == 6:
+ return DpoProto.DPO_PROTO_IP6
+ else:
+ return DpoProto.DPO_PROTO_IP4
+
+
class VppIpAddressUnion():
def __init__(self, addr):
self.addr = addr
@@ -73,148 +80,18 @@ class VppIpAddressUnion():
return str(self.ip_addr)
-class VppIpAddress():
- def __init__(self, addr):
- self.addr = VppIpAddressUnion(addr)
-
- def encode(self):
- if self.addr.version == 6:
- return {
- 'af': VppEnum.vl_api_address_family_t.ADDRESS_IP6,
- 'un': self.addr.encode()
- }
- else:
- return {
- 'af': VppEnum.vl_api_address_family_t.ADDRESS_IP4,
- 'un': self.addr.encode()
- }
-
- def __eq__(self, other):
- if isinstance(other, self.__class__):
- return self.addr == other.addr
- elif hasattr(other, "af") and hasattr(other, "un"):
- # a vp_api_address_t
- if 4 == self.version:
- return other.af == \
- VppEnum.vl_api_address_family_t.ADDRESS_IP4 and \
- other.un == self.addr
- else:
- return other.af == \
- VppEnum.vl_api_address_family_t.ADDRESS_IP6 and \
- other.un == self.addr
- else:
- _log.error(
- "Comparing VppIpAddress:<%s> %s with incomparable "
- "type: <%s> %s",
- self.__class__.__name__, self,
- other.__class__.__name__, other)
- return NotImplemented
-
- def __ne__(self, other):
- return not (self == other)
-
- def __str__(self):
- return self.address
-
- @property
- def bytes(self):
- return self.addr.bytes
-
- @property
- def address(self):
- return self.addr.address
-
- @property
- def length(self):
- return self.addr.length
-
- @property
- def version(self):
- return self.addr.version
-
- @property
- def is_ip6(self):
- return (self.version == 6)
-
- @property
- def af(self):
- if self.version == 6:
- return AF_INET6
- else:
- return AF_INET
-
- @property
- def dpo_proto(self):
- if self.version == 6:
- return DpoProto.DPO_PROTO_IP6
- else:
- return DpoProto.DPO_PROTO_IP4
-
-
-class VppIpPrefix():
- def __init__(self, addr, len):
- self.addr = VppIpAddress(addr)
- self.len = len
-
- def __eq__(self, other):
- if self.address == other.address and self.len == other.len:
- return True
- return False
-
- def encode(self):
- return {'address': self.addr.encode(),
- 'len': self.len}
-
- @property
- def version(self):
- return self.addr.version
-
- @property
- def address(self):
- return self.addr.address
-
- @property
- def bytes(self):
- return self.addr.bytes
-
- @property
- def length(self):
- return self.len
-
- @property
- def is_ip6(self):
- return self.addr.is_ip6
-
- def __str__(self):
- return "%s/%d" % (self.address, self.length)
-
- def __eq__(self, other):
- if isinstance(other, self.__class__):
- return (self.len == other.len and self.addr == other.addr)
- elif hasattr(other, "address") and hasattr(other, "len"):
- # vl_api_prefix_t
- return self.len == other.len and \
- self.addr == other.address
- else:
- _log.error(
- "Comparing VppIpPrefix:%s with incomparable type: %s" %
- (self, other))
- return NotImplemented
-
-
class VppIpMPrefix():
def __init__(self, saddr, gaddr, glen):
self.saddr = saddr
self.gaddr = gaddr
self.glen = glen
- self.ip_saddr = VppIpAddressUnion(text_type(self.saddr))
- self.ip_gaddr = VppIpAddressUnion(text_type(self.gaddr))
- if self.ip_saddr.version != self.ip_gaddr.version:
+ if ip_address(self.saddr).version != \
+ ip_address(self.gaddr).version:
raise ValueError('Source and group addresses must be of the '
'same address family.')
def encode(self):
- if 6 == self.ip_saddr.version:
+ if 6 == self.version:
prefix = {
'af': VppEnum.vl_api_address_family_t.ADDRESS_IP6,
'grp_address': {
@@ -244,7 +121,7 @@ class VppIpMPrefix():
@property
def version(self):
- return self.ip_gaddr.version
+ return ip_address(self.gaddr).version
def __str__(self):
return "(%s,%s)/%d" % (self.saddr, self.gaddr, self.glen)
@@ -252,22 +129,20 @@ class VppIpMPrefix():
def __eq__(self, other):
if isinstance(other, self.__class__):
return (self.glen == other.glen and
- self.ip_saddr == other.ip_gaddr and
- self.ip_saddr == other.ip_saddr)
+ self.saddr == other.gaddr and
+ self.saddr == other.saddr)
elif (hasattr(other, "grp_address_length") and
hasattr(other, "grp_address") and
hasattr(other, "src_address")):
# vl_api_mprefix_t
- if 4 == self.ip_saddr.version:
- if self.glen == other.grp_address_length and \
- self.gaddr == str(other.grp_address.ip4) and \
- self.saddr == str(other.src_address.ip4):
- return True
- return False
+ if 4 == self.version:
+ return (self.glen == other.grp_address_length and
+ self.gaddr == str(other.grp_address.ip4) and
+ self.saddr == str(other.src_address.ip4))
else:
return (self.glen == other.grp_address_length and
- self.gaddr == other.grp_address.ip6 and
- self.saddr == other.src_address.ip6)
+ self.gaddr == str(other.grp_address.ip6) and
+ self.saddr == str(other.src_address.ip6))
else:
raise Exception("Comparing VppIpPrefix:%s with unknown type: %s" %
(self, other))
diff --git a/test/vpp_ip_route.py b/test/vpp_ip_route.py
index 8f9d51a7d2a..d6004756d34 100644
--- a/test/vpp_ip_route.py
+++ b/test/vpp_ip_route.py
@@ -6,7 +6,7 @@
from vpp_object import VppObject
from socket import inet_pton, inet_ntop, AF_INET, AF_INET6
-from vpp_ip import DpoProto, VppIpPrefix, INVALID_INDEX, VppIpAddressUnion, \
+from vpp_ip import DpoProto, INVALID_INDEX, VppIpAddressUnion, \
VppIpMPrefix
from ipaddress import ip_address, IPv4Network, IPv6Network
@@ -72,6 +72,13 @@ class MplsLspMode:
UNIFORM = 1
+def mk_network(addr, len):
+ if ip_address(text_type(addr)).version == 4:
+ return IPv4Network("%s/%d" % (addr, len), strict=False)
+ else:
+ return IPv6Network("%s/%d" % (addr, len), strict=False)
+
+
def ip_to_dpo_proto(addr):
if addr.version == 6:
return DpoProto.DPO_PROTO_IP6
@@ -87,18 +94,16 @@ def address_proto(ip_addr):
def find_route(test, addr, len, table_id=0):
- ip_addr = ip_address(text_type(addr))
+ prefix = mk_network(addr, len)
- if 4 is ip_addr.version:
+ if 4 is prefix.version:
routes = test.vapi.ip_route_dump(table_id, False)
- prefix = IPv4Network("%s/%d" % (text_type(addr), len), strict=False)
else:
routes = test.vapi.ip_route_dump(table_id, True)
- prefix = IPv6Network("%s/%d" % (text_type(addr), len), strict=False)
for e in routes:
if table_id == e.route.table_id \
- and prefix == e.route.prefix:
+ and str(e.route.prefix) == str(prefix):
return True
return False
@@ -138,22 +143,16 @@ def find_mpls_route(test, table_id, label, eos_bit, paths=None):
return False
-def fib_interface_ip_prefix(test, address, length, sw_if_index):
- ip_addr = ip_address(text_type(address))
-
- if 4 is ip_addr.version:
- addrs = test.vapi.ip_address_dump(sw_if_index)
- prefix = IPv4Network("%s/%d" % (text_type(address), length),
- strict=False)
- else:
- addrs = test.vapi.ip_address_dump(sw_if_index, is_ipv6=1)
- prefix = IPv6Network("%s/%d" % (text_type(address), length),
- strict=False)
+def fib_interface_ip_prefix(test, addr, len, sw_if_index):
+ # can't use python net here since we need the host bits in the prefix
+ prefix = "%s/%d" % (addr, len)
+ addrs = test.vapi.ip_address_dump(
+ sw_if_index,
+ is_ipv6=(6 == ip_address(addr).version))
- # TODO: refactor this to VppIpPrefix.__eq__
for a in addrs:
if a.sw_if_index == sw_if_index and \
- a.prefix.network == prefix:
+ str(a.prefix) == prefix:
return True
return False
@@ -198,23 +197,25 @@ class VppIpInterfaceAddress(VppObject):
def __init__(self, test, intf, addr, len):
self._test = test
self.intf = intf
- self.prefix = VppIpPrefix(addr, len)
+ self.addr = addr
+ self.len = len
+ self.prefix = "%s/%d" % (addr, len)
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, prefix=self.prefix,
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, prefix=self.prefix,
is_add=0)
def query_vpp_config(self):
return fib_interface_ip_prefix(self._test,
- self.prefix.address,
- self.prefix.length,
+ self.addr,
+ self.len,
self.intf.sw_if_index)
def object_id(self):
@@ -424,7 +425,7 @@ class VppIpRoute(VppObject):
self._test = test
self.paths = paths
self.table_id = table_id
- self.prefix = VppIpPrefix(dest_addr, dest_addr_len)
+ self.prefix = mk_network(dest_addr, dest_addr_len)
self.register = register
self.stats_index = None
self.modified = False
@@ -447,7 +448,7 @@ class VppIpRoute(VppObject):
self.modified = True
self._test.vapi.ip_route_add_del(route={'table_id': self.table_id,
- 'prefix': self.prefix.encode(),
+ 'prefix': self.prefix,
'n_paths': len(
self.encoded_paths),
'paths': self.encoded_paths,
@@ -458,7 +459,7 @@ class VppIpRoute(VppObject):
def add_vpp_config(self):
r = self._test.vapi.ip_route_add_del(
route={'table_id': self.table_id,
- 'prefix': self.prefix.encode(),
+ 'prefix': self.prefix,
'n_paths': len(self.encoded_paths),
'paths': self.encoded_paths,
},
@@ -476,7 +477,7 @@ class VppIpRoute(VppObject):
if self.modified:
self._test.vapi.ip_route_add_del(
route={'table_id': self.table_id,
- 'prefix': self.prefix.encode(),
+ 'prefix': self.prefix,
'n_paths': len(
self.encoded_paths),
'paths': self.encoded_paths},
@@ -485,23 +486,22 @@ class VppIpRoute(VppObject):
else:
self._test.vapi.ip_route_add_del(
route={'table_id': self.table_id,
- 'prefix': self.prefix.encode(),
+ 'prefix': self.prefix,
'n_paths': 0},
is_add=0,
is_multipath=0)
def query_vpp_config(self):
return find_route(self._test,
- self.prefix.address,
- self.prefix.len,
+ self.prefix.network_address,
+ self.prefix.prefixlen,
self.table_id)
def object_id(self):
- return ("%s:table-%d-%s/%d" % (
- 'ip6-route' if self.prefix.addr.version == 6 else 'ip-route',
+ return ("%s:table-%d-%s" % (
+ 'ip6-route' if self.prefix.version == 6 else 'ip-route',
self.table_id,
- self.prefix.address,
- self.prefix.len))
+ self.prefix))
def get_stats_to(self):
c = self._test.statistics.get_counter("/net/route/to")
@@ -627,18 +627,18 @@ class VppMplsIpBind(VppObject):
self.local_label = local_label
self.table_id = table_id
self.ip_table_id = ip_table_id
- self.prefix = VppIpPrefix(dest_addr, dest_addr_len)
+ self.prefix = mk_network(dest_addr, dest_addr_len)
def add_vpp_config(self):
self._test.vapi.mpls_ip_bind_unbind(self.local_label,
- self.prefix.encode(),
+ self.prefix,
table_id=self.table_id,
ip_table_id=self.ip_table_id)
self._test.registry.register(self, self._test.logger)
def remove_vpp_config(self):
self._test.vapi.mpls_ip_bind_unbind(self.local_label,
- self.prefix.encode(),
+ self.prefix,
table_id=self.table_id,
ip_table_id=self.ip_table_id,
is_bind=0)
diff --git a/test/vpp_l2.py b/test/vpp_l2.py
index 3ee0d35384e..114b1c734d7 100644
--- a/test/vpp_l2.py
+++ b/test/vpp_l2.py
@@ -4,7 +4,6 @@
"""
from vpp_object import VppObject
-from vpp_ip import VppIpAddress
from vpp_lo_interface import VppLoInterface
from vpp_papi import MACAddress
from vpp_sub_interface import L2_VTR_OP
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index cc7771e9c9e..a440312d892 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -1092,8 +1092,7 @@ class VppPapiProvider(object):
def vxlan_gbp_tunnel_dump(self, sw_if_index=0xffffffff):
return self.api(self.papi.vxlan_gbp_tunnel_dump,
- {'sw_if_index': sw_if_index,
- '_no_type_conversion': True})
+ {'sw_if_index': sw_if_index})
def pppoe_add_del_session(
self,
@@ -1802,8 +1801,7 @@ class VppPapiProvider(object):
def gbp_endpoint_dump(self):
""" GBP endpoint Dump """
- return self.api(self.papi.gbp_endpoint_dump,
- {'_no_type_conversion': True})
+ return self.api(self.papi.gbp_endpoint_dump, {})
def gbp_endpoint_group_add(self, vnid, sclass, bd,
rd, uplink_sw_if_index,
@@ -1912,8 +1910,7 @@ class VppPapiProvider(object):
def gbp_subnet_dump(self):
""" GBP Subnet Dump """
- return self.api(self.papi.gbp_subnet_dump,
- {'_no_type_conversion': True})
+ return self.api(self.papi.gbp_subnet_dump, {})
def gbp_contract_dump(self):
""" GBP contract Dump """
diff --git a/test/vpp_vxlan_gbp_tunnel.py b/test/vpp_vxlan_gbp_tunnel.py
index 5352d6ebf31..22555858d12 100644
--- a/test/vpp_vxlan_gbp_tunnel.py
+++ b/test/vpp_vxlan_gbp_tunnel.py
@@ -1,6 +1,5 @@
from vpp_interface import VppInterface
-from vpp_ip import VppIpAddress
from vpp_papi import VppEnum
@@ -8,13 +7,10 @@ INDEX_INVALID = 0xffffffff
def find_vxlan_gbp_tunnel(test, src, dst, vni):
- vsrc = VppIpAddress(src)
- vdst = VppIpAddress(dst)
-
ts = test.vapi.vxlan_gbp_tunnel_dump(INDEX_INVALID)
for t in ts:
- if vsrc == t.tunnel.src and \
- vdst == t.tunnel.dst and \
+ if src == str(t.tunnel.src) and \
+ dst == str(t.tunnel.dst) and \
t.tunnel.vni == vni:
return t.tunnel.sw_if_index
return INDEX_INVALID
@@ -29,8 +25,8 @@ class VppVxlanGbpTunnel(VppInterface):
is_ipv6=None, encap_table_id=None, instance=0xffffffff):
""" Create VXLAN-GBP Tunnel interface """
super(VppVxlanGbpTunnel, self).__init__(test)
- self.src = VppIpAddress(src)
- self.dst = VppIpAddress(dst)
+ self.src = src
+ self.dst = dst
self.vni = vni
self.mcast_itf = mcast_itf
self.ipv6 = is_ipv6
@@ -49,8 +45,8 @@ class VppVxlanGbpTunnel(VppInterface):
reply = self.test.vapi.vxlan_gbp_tunnel_add_del(
is_add=1,
tunnel={
- 'src': self.src.encode(),
- 'dst': self.dst.encode(),
+ 'src': self.src,
+ 'dst': self.dst,
'mode': self.mode,
'vni': self.vni,
'mcast_sw_if_index': mcast_sw_if_index,
@@ -67,8 +63,8 @@ class VppVxlanGbpTunnel(VppInterface):
self.test.vapi.vxlan_gbp_tunnel_add_del(
is_add=0,
tunnel={
- 'src': self.src.encode(),
- 'dst': self.dst.encode(),
+ 'src': self.src,
+ 'dst': self.dst,
'mode': self.mode,
'vni': self.vni,
'mcast_sw_if_index': mcast_sw_if_index,