diff options
author | Ole Troan <ot@cisco.com> | 2018-10-22 09:30:26 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-10-22 11:52:20 +0000 |
commit | 31555a3475a37195938378217a635b3451e449de (patch) | |
tree | b330d858fe6d8f1a0b236b608e8970d5114e015c /test/test_svs.py | |
parent | 430634c457da5dd04f481da0118bab581ace732e (diff) |
PAPI: Add support for format/unformat functions.
With the introduction of new types, like vl_api_address_t
it is now possible to call a message using one of those
functions with a string representation. E.g. for an IP address
ip_add_address(address="1.1.1.1/24")
The language wrapper will automatically convert the string
into the vl_api_address_t representation. Currently
the caller must do the reverse conversion from the returned
named tuple with the unformat function.
rv = get_address_on_interface(sw_if_index=1)
print(VPPFormat.unformat(rv.address))
Change-Id: Ic872b4560b2f4836255bd5260289bfa38c75bc5d
Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'test/test_svs.py')
-rw-r--r-- | test/test_svs.py | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/test/test_svs.py b/test/test_svs.py index 8429f437ae1..cfbe75ed974 100644 --- a/test/test_svs.py +++ b/test/test_svs.py @@ -1,8 +1,6 @@ #!/usr/bin/env python from framework import VppTestCase, VppTestRunner -from vpp_ip import VppIpPrefix - from vpp_ip_route import VppIpTable from scapy.packet import Raw @@ -104,9 +102,7 @@ class TestSVS(VppTestCase): # for i in range(1, 4): self.vapi.svs_route_add_del( - table_id, - VppIpPrefix("%d.0.0.0" % i, 8).encode(), - i) + table_id, "%d.0.0.0/8" % i, i) # # Enable SVS on pg0/pg1 using table 1001/1002 @@ -173,8 +169,7 @@ class TestSVS(VppTestCase): for table_id in table_ids: for i in range(1, 4): self.vapi.svs_route_add_del( - table_id, - VppIpPrefix("%d.0.0.0" % i, 8).encode(), + table_id, "%d.0.0.0/8" % i, 0, is_add=0) self.vapi.svs_table_add_del( VppEnum.vl_api_address_family_t.ADDRESS_IP4, @@ -234,8 +229,7 @@ class TestSVS(VppTestCase): # for i in range(1, 4): self.vapi.svs_route_add_del( - table_id, - VppIpPrefix("2001:%d::" % i, 32).encode(), + table_id, "2001:%d::/32" % i, i) # @@ -304,8 +298,7 @@ class TestSVS(VppTestCase): for table_id in table_ids: for i in range(1, 4): self.vapi.svs_route_add_del( - table_id, - VppIpPrefix("2001:%d::" % i, 32).encode(), + table_id, "2001:%d::/32" % i, 0, is_add=0) self.vapi.svs_table_add_del( VppEnum.vl_api_address_family_t.ADDRESS_IP6, |