tests: implement ipaddress convenience methods

Add vpp specific properties to ip addresses for use in the api.
  .vapi_af  -- returns [ADDRESS_IP4, ADDRESS_IP6]
  .vapi_af_name -- returns the string ['ip4', 'ip6']

  Update tests to demonstrate usage.

Type: feature

Change-Id: I43447a1522769d99f89debdc714c51700068d771
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
This commit is contained in:
Paul Vinciguerra
2020-04-28 00:27:38 -04:00
parent 58db6e16cf
commit e64e5fff4d
8 changed files with 82 additions and 94 deletions

View File

@ -16,11 +16,8 @@ except NameError:
def find_nbr(test, sw_if_index, nbr_addr, is_static=0, mac=None):
ip_addr = ip_address(text_type(nbr_addr))
e = VppEnum.vl_api_ip_neighbor_flags_t
if 6 == ip_addr.version:
af = VppEnum.vl_api_address_family_t.ADDRESS_IP6
else:
af = VppEnum.vl_api_address_family_t.ADDRESS_IP4
nbrs = test.vapi.ip_neighbor_dump(sw_if_index=sw_if_index, af=af)
nbrs = test.vapi.ip_neighbor_dump(sw_if_index=sw_if_index,
af=ip_addr.vapi_af)
for n in nbrs:
if ip_addr == n.neighbor.ip_address and \