aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2019-03-07 11:28:32 +0100
committerPaul Vinciguerra <pvinci@vinciconsulting.com>2019-03-07 11:36:35 +0000
commit48ae19e9096fab98b14eaddaaa73e1b54bcbda8d (patch)
tree0f4399001b10d23b8ae1a22ad73b03006d47cda1 /src
parent9b309b61d2c9c8780d94d09f706f5ecd9b808c62 (diff)
API: Add python2.7 support for enum flags via aenum
Change-Id: I77a43bfb37d827727c331cd65eee77536cc15953 Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vnet/ip/ip.api1
-rw-r--r--src/vpp-api/python/setup.py2
-rw-r--r--src/vpp-api/python/vpp_papi/vpp_serializer.py10
3 files changed, 8 insertions, 5 deletions
diff --git a/src/vnet/ip/ip.api b/src/vnet/ip/ip.api
index b67e2e5f0c8..39d394f709d 100644
--- a/src/vnet/ip/ip.api
+++ b/src/vnet/ip/ip.api
@@ -114,7 +114,6 @@ enum ip_neighbor_flags
IP_API_NEIGHBOR_FLAG_NONE = 0,
IP_API_NEIGHBOR_FLAG_STATIC = 0x1,
IP_API_NEIGHBOR_FLAG_NO_FIB_ENTRY = 0x2,
- IP_API_NEIGHBOR_FLAG_FIX_ME_OLE = 0x3,
};
/** \brief IP neighbor
diff --git a/src/vpp-api/python/setup.py b/src/vpp-api/python/setup.py
index 952944578c8..b5fc11a590a 100644
--- a/src/vpp-api/python/setup.py
+++ b/src/vpp-api/python/setup.py
@@ -30,7 +30,7 @@ setup(
license='Apache-2.0',
test_suite='vpp_papi.tests',
install_requires=['cffi >= 1.6'] if stdlib_enum else
- ['cffi >= 1.6', 'enum34'],
+ ['cffi >= 1.6', 'aenum'],
packages=find_packages(),
long_description='''VPP Python language binding.''',
zip_safe=True)
diff --git a/src/vpp-api/python/vpp_papi/vpp_serializer.py b/src/vpp-api/python/vpp_papi/vpp_serializer.py
index d62e3a4a57a..e6012018f08 100644
--- a/src/vpp-api/python/vpp_papi/vpp_serializer.py
+++ b/src/vpp-api/python/vpp_papi/vpp_serializer.py
@@ -15,11 +15,15 @@
import struct
import collections
-from enum import IntEnum
+import sys
+if sys.version[0] == '2':
+ from aenum import IntEnum, IntFlag
+else:
+ from enum import IntEnum, IntFlag
import logging
from . import vpp_format
import ipaddress
-import sys
+
import socket
#
@@ -276,7 +280,7 @@ class VPPEnumType(object):
continue
ename, evalue = f
e_hash[ename] = evalue
- self.enum = IntEnum(name, e_hash)
+ self.enum = IntFlag(name, e_hash)
types[name] = self
def __getattr__(self, name):