summaryrefslogtreecommitdiffstats
path: root/test/test_map.py
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2018-12-11 13:04:01 +0100
committerDamjan Marion <dmarion@me.com>2018-12-12 00:34:43 +0000
commit0bcad32b3870f9998fa1393418081cdda685272f (patch)
tree0fcb518ffa5553bbec94c219cbc33fef48dbede3 /test/test_map.py
parent41b25cf6380d1420b24e191cd7e95cbce1e7cfdc (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/test_map.py')
-rw-r--r--test/test_map.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/test/test_map.py b/test/test_map.py
index 3d02853dd8b..e98532e9df7 100644
--- a/test/test_map.py
+++ b/test/test_map.py
@@ -6,7 +6,7 @@ import socket
from framework import VppTestCase, VppTestRunner
from vpp_ip import *
from vpp_ip_route import VppIpRoute, VppRoutePath
-
+from ipaddress import IPv6Network, IPv4Network
from scapy.layers.l2 import Ether, Raw
from scapy.layers.inet import IP, UDP, ICMP, TCP, fragment
from scapy.layers.inet6 import IPv6, ICMPv6TimeExceeded
@@ -76,9 +76,9 @@ class TestMAP(VppTestCase):
#
# Add a domain that maps from pg0 to pg1
#
- map_dst = VppIp6Prefix(map_br_pfx, map_br_pfx_len).encode()
- map_src = VppIp6Prefix("3000::1", 128).encode()
- client_pfx = VppIp4Prefix("192.168.0.0", 16).encode()
+ map_dst = '{}/{}'.format(map_br_pfx, map_br_pfx_len)
+ map_src = '3000::1/128'
+ client_pfx = '192.168.0.0/16'
self.vapi.map_add_domain(map_dst, map_src, client_pfx)
#
@@ -168,10 +168,10 @@ class TestMAP(VppTestCase):
#
# Add a domain that maps from pg0 to pg1
#
- map_dst = VppIp6Prefix("2001:db8::", 32).encode()
- map_src = VppIp6Prefix("1234:5678:90ab:cdef::", 64).encode()
- ip4_pfx = VppIp4Prefix("192.168.0.0", 24).encode()
- self.vapi.map_add_domain(map_dst, map_src, ip4_pfx, 16, 6, 4, 1)
+ self.vapi.map_add_domain('2001:db8::/32',
+ '1234:5678:90ab:cdef::/64',
+ '192.168.0.0/24',
+ 16, 6, 4, 1)
# Enable MAP-T on interfaces.