summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-06-19 07:07:13 -0700
committerOle Trøan <otroan@employees.org>2019-06-19 15:56:18 +0000
commitbc764c8bc26282445901dc9aa32223a13f18e8dc (patch)
tree5269531d092bb3d9f8ba9bad025d2057314dd473 /test
parent6a69b2483198de57ef304cb5e05a2ecfb960e68f (diff)
l2: BD ARP termination entry API update
Type: refactor Change-Id: I492b6e88acadf0ab0e4d7b1c0c5d1cab84c1726f Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'test')
-rw-r--r--test/test_gbp.py9
-rw-r--r--test/test_l2bd_arp_term.py7
-rw-r--r--test/vpp_l2.py42
3 files changed, 31 insertions, 27 deletions
diff --git a/test/test_gbp.py b/test/test_gbp.py
index 42defbf0d5c..0580fff2b6f 100644
--- a/test/test_gbp.py
+++ b/test/test_gbp.py
@@ -841,10 +841,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)
+ epg.bvi_ip4.address)
epg.bd_arp_ip6 = VppBridgeDomainArpEntry(self, epg.bd.bd,
str(self.router_mac),
- epg.bvi_ip6)
+ epg.bvi_ip6.address)
epg.bd_arp_ip4.add_vpp_config()
epg.bd_arp_ip6.add_vpp_config()
@@ -917,7 +917,8 @@ class TestGBP(VppTestCase):
# add the BD ARP termination entry for floating IP
for fip in ep.fips:
- ba = VppBridgeDomainArpEntry(self, epg_nat.bd.bd, ep.mac, fip)
+ ba = VppBridgeDomainArpEntry(self, epg_nat.bd.bd, ep.mac,
+ fip.address)
ba.add_vpp_config()
# floating IPs route via EPG recirc
@@ -2063,7 +2064,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)
+ epg.bvi_ip4.address)
epg.bd_arp_ip4.add_vpp_config()
# EPG in VPP
diff --git a/test/test_l2bd_arp_term.py b/test/test_l2bd_arp_term.py
index fa67acc18ec..bdf0a80caa7 100644
--- a/test/test_l2bd_arp_term.py
+++ b/test/test_l2bd_arp_term.py
@@ -78,8 +78,11 @@ class TestL2bdArpTerm(VppTestCase):
def add_del_arp_term_hosts(self, entries, bd_id=1, is_add=1, is_ipv6=0):
for e in entries:
ip = e.ip4 if is_ipv6 == 0 else e.ip6
- self.vapi.bd_ip_mac_add_del(bd_id=bd_id, is_add=is_add, ip=ip,
- mac=e.mac)
+ self.vapi.bd_ip_mac_add_del(is_add=is_add,
+ entry={
+ 'bd_id': bd_id,
+ 'ip': ip,
+ 'mac': e.mac})
@classmethod
def mac_list(cls, b6_range):
diff --git a/test/vpp_l2.py b/test/vpp_l2.py
index 90de91695f2..3ee0d35384e 100644
--- a/test/vpp_l2.py
+++ b/test/vpp_l2.py
@@ -8,6 +8,10 @@ from vpp_ip import VppIpAddress
from vpp_lo_interface import VppLoInterface
from vpp_papi import MACAddress
from vpp_sub_interface import L2_VTR_OP
+try:
+ text_type = unicode
+except NameError:
+ text_type = str
class L2_PORT_TYPE:
@@ -41,19 +45,11 @@ def find_bridge_domain_port(test, bd_id, sw_if_index):
def find_bridge_domain_arp_entry(test, bd_id, mac, ip):
- vmac = MACAddress(mac)
- vip = VppIpAddress(ip)
-
- if vip.version == 4:
- n = 4
- else:
- n = 16
-
arps = test.vapi.bd_ip_mac_dump(bd_id)
for arp in arps:
# do IP addr comparison too once .api is fixed...
- if vmac.packed == arp.mac_address and \
- vip.bytes == arp.ip_address[:n]:
+ if mac == str(arp.entry.mac) and \
+ ip == str(arp.entry.ip):
return True
return False
@@ -136,28 +132,32 @@ class VppBridgeDomainArpEntry(VppObject):
def __init__(self, test, bd, mac, ip):
self._test = test
self.bd = bd
- self.mac = MACAddress(mac)
- self.ip = VppIpAddress(ip)
+ self.mac = mac
+ self.ip = ip
def add_vpp_config(self):
- self._test.vapi.bd_ip_mac_add_del(bd_id=self.bd.bd_id, is_add=1,
- ip=self.ip.encode(),
- mac=self.mac.packed)
+ self._test.vapi.bd_ip_mac_add_del(is_add=1,
+ entry={
+ 'bd_id': self.bd.bd_id,
+ 'ip': self.ip,
+ 'mac': self.mac})
self._test.registry.register(self, self._test.logger)
def remove_vpp_config(self):
- self._test.vapi.bd_ip_mac_add_del(bd_id=self.bd.bd_id, is_add=0,
- ip=self.ip.encode(),
- mac=self.mac.packed)
+ self._test.vapi.bd_ip_mac_add_del(is_add=0,
+ entry={
+ 'bd_id': self.bd.bd_id,
+ 'ip': self.ip,
+ 'mac': self.mac})
def query_vpp_config(self):
return find_bridge_domain_arp_entry(self._test,
self.bd.bd_id,
- self.mac.packed,
- self.ip.address)
+ self.mac,
+ self.ip)
def object_id(self):
- return "BD-Arp-Entry-%s-%s-%s" % (self.bd, self.mac, self.ip.address)
+ return "BD-Arp-Entry-%s-%s-%s" % (self.bd, self.mac, self.ip)
class VppL2FibEntry(VppObject):