summaryrefslogtreecommitdiffstats
path: root/test/test_ip4.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_ip4.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_ip4.py')
-rw-r--r--test/test_ip4.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/test_ip4.py b/test/test_ip4.py
index 54090445dac..685d0894aec 100644
--- a/test/test_ip4.py
+++ b/test/test_ip4.py
@@ -14,7 +14,7 @@ from framework import VppTestCase, VppTestRunner
from util import ppp
from vpp_ip_route import VppIpRoute, VppRoutePath, VppIpMRoute, \
VppMRoutePath, MRouteItfFlags, MRouteEntryFlags, VppMplsIpBind, \
- VppMplsTable, VppIpTable, VppIpAddress
+ VppMplsTable, VppIpTable
from vpp_sub_interface import VppSubInterface, VppDot1QSubint, VppDot1ADSubint
@@ -1123,7 +1123,7 @@ class TestIPPunt(VppTestCase):
#
# Configure a punt redirect via pg1.
#
- nh_addr = VppIpAddress(self.pg1.remote_ip4).encode()
+ nh_addr = self.pg1.remote_ip4
self.vapi.ip_punt_redirect(self.pg0.sw_if_index,
self.pg1.sw_if_index,
nh_addr)
@@ -1187,7 +1187,7 @@ class TestIPPunt(VppTestCase):
#
# Configure a punt redirects
#
- nh_address = VppIpAddress(self.pg3.remote_ip4).encode()
+ nh_address = self.pg3.remote_ip4
self.vapi.ip_punt_redirect(self.pg0.sw_if_index,
self.pg3.sw_if_index,
nh_address)
@@ -1196,7 +1196,7 @@ class TestIPPunt(VppTestCase):
nh_address)
self.vapi.ip_punt_redirect(self.pg2.sw_if_index,
self.pg3.sw_if_index,
- VppIpAddress('0.0.0.0').encode())
+ '0.0.0.0')
#
# Dump pg0 punt redirects
@@ -1212,8 +1212,8 @@ class TestIPPunt(VppTestCase):
self.assertEqual(len(punts), 3)
for p in punts:
self.assertEqual(p.punt.tx_sw_if_index, self.pg3.sw_if_index)
- self.assertNotEqual(punts[1].punt.nh.un.ip4, self.pg3.remote_ip4)
- self.assertEqual(punts[2].punt.nh.un.ip4, '\x00'*4)
+ self.assertNotEqual(punts[1].punt.nh, self.pg3.remote_ip4)
+ self.assertEqual(str(punts[2].punt.nh), '0.0.0.0')
class TestIPDeag(VppTestCase):