summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/python/vpp_papi/vpp_papi.py
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2018-10-22 09:30:26 +0200
committerDamjan Marion <dmarion@me.com>2018-10-22 11:52:20 +0000
commit31555a3475a37195938378217a635b3451e449de (patch)
treeb330d858fe6d8f1a0b236b608e8970d5114e015c /src/vpp-api/python/vpp_papi/vpp_papi.py
parent430634c457da5dd04f481da0118bab581ace732e (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 'src/vpp-api/python/vpp_papi/vpp_papi.py')
-rw-r--r--src/vpp-api/python/vpp_papi/vpp_papi.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/vpp-api/python/vpp_papi/vpp_papi.py b/src/vpp-api/python/vpp_papi/vpp_papi.py
index 5e98f92cecd..2310cd1e455 100644
--- a/src/vpp-api/python/vpp_papi/vpp_papi.py
+++ b/src/vpp-api/python/vpp_papi/vpp_papi.py
@@ -28,6 +28,7 @@ import weakref
import atexit
from . vpp_serializer import VPPType, VPPEnumType, VPPUnionType, BaseTypes
from . vpp_serializer import VPPMessage, vpp_get_type
+from . vpp_format import VPPFormat
if sys.version[0] == '2':
import Queue as queue