diff options
author | Ole Troan <ot@cisco.com> | 2018-12-11 13:04:01 +0100 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-12-12 00:34:43 +0000 |
commit | 0bcad32b3870f9998fa1393418081cdda685272f (patch) | |
tree | 0fcb518ffa5553bbec94c219cbc33fef48dbede3 /test/vpp_udp_encap.py | |
parent | 41b25cf6380d1420b24e191cd7e95cbce1e7cfdc (diff) |
PAPI: Allow ipaddress object as argument and return values from API calls
The API calls that use any of vl_api_address_t, vl_api_ip4_address,
vl_api_ip6_address_t, vl_api_prefix_t, vl_api_ip4_prefix_t,
vl_api_ip6_prefix_t now accepts either the old style dictionary,
a text string (2001:db8::/32) or an ipaddress ojbect.
Unless it is called with '_no_type_conversion':True, it will
also return an appropriate ipaddress object.
Change-Id: I84e4a1577bd57f6b5ae725f316a523988b6a955b
Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'test/vpp_udp_encap.py')
-rw-r--r-- | test/vpp_udp_encap.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/test/vpp_udp_encap.py b/test/vpp_udp_encap.py index 209115f2c3f..5e2df7646a6 100644 --- a/test/vpp_udp_encap.py +++ b/test/vpp_udp_encap.py @@ -5,15 +5,14 @@ from vpp_object import * from socket import inet_pton, inet_ntop, AF_INET, AF_INET6 -from vpp_ip import * def find_udp_encap(test, ue): encaps = test.vapi.udp_encap_dump() for e in encaps: if ue.id == e.udp_encap.id \ - and ue.src_ip == e.udp_encap.src_ip \ - and ue.dst_ip == e.udp_encap.dst_ip \ + and ue.src_ip == str(e.udp_encap.src_ip) \ + and ue.dst_ip == str(e.udp_encap.dst_ip) \ and e.udp_encap.dst_port == ue.dst_port \ and e.udp_encap.src_port == ue.src_port: return True @@ -34,15 +33,15 @@ class VppUdpEncap(VppObject): self.table_id = table_id self.src_ip_s = src_ip self.dst_ip_s = dst_ip - self.src_ip = VppIpAddress(src_ip) - self.dst_ip = VppIpAddress(dst_ip) + self.src_ip = src_ip + self.dst_ip = dst_ip self.src_port = src_port self.dst_port = dst_port def add_vpp_config(self): r = self._test.vapi.udp_encap_add( - self.src_ip.encode(), - self.dst_ip.encode(), + self.src_ip, + self.dst_ip, self.src_port, self.dst_port, self.table_id) |