From bc764c8bc26282445901dc9aa32223a13f18e8dc Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Wed, 19 Jun 2019 07:07:13 -0700 Subject: l2: BD ARP termination entry API update Type: refactor Change-Id: I492b6e88acadf0ab0e4d7b1c0c5d1cab84c1726f Signed-off-by: Neale Ranns --- test/vpp_l2.py | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'test/vpp_l2.py') 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): -- cgit 1.2.3-korg