aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp-api/python/vpp_papi/vpp_serializer.py
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2018-10-16 14:42:50 +0200
committerNeale Ranns <nranns@cisco.com>2018-10-18 10:16:49 +0000
commit0685da4a6db8195d1a86f3466fcd3395b0ccb83e (patch)
treec77bf5b08aade685beadc01972f601e795685ba8 /src/vpp-api/python/vpp_papi/vpp_serializer.py
parent5fcca2a124ac828b01633a3ad237a6435e8ff603 (diff)
PAPI: Expose API enums to tests / applications
e.g: from vpp_papi import VppEnum VppEnum.vl_api_address_family_t.ADDRESS_IP4 Change-Id: I10c22d57234a1a06e98a889cf80b19085b468ed3 Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/vpp-api/python/vpp_papi/vpp_serializer.py')
-rw-r--r--src/vpp-api/python/vpp_papi/vpp_serializer.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/vpp-api/python/vpp_papi/vpp_serializer.py b/src/vpp-api/python/vpp_papi/vpp_serializer.py
index cac6dd61791..240912d96ba 100644
--- a/src/vpp-api/python/vpp_papi/vpp_serializer.py
+++ b/src/vpp-api/python/vpp_papi/vpp_serializer.py
@@ -62,6 +62,13 @@ types['f64'] = BaseTypes('f64')
types['bool'] = BaseTypes('bool')
+def vpp_get_type(name):
+ try:
+ return types[name]
+ except KeyError:
+ return None
+
+
class FixedList_u8():
def __init__(self, name, field_type, num):
self.name = name
@@ -202,6 +209,9 @@ class VPPEnumType():
def __getattr__(self, name):
return self.enum[name]
+ def __nonzero__(self):
+ return True
+
def pack(self, data, kwargs=None):
return types['u32'].pack(data, kwargs)