diff options
author | Ole Troan <ot@cisco.com> | 2018-11-27 10:05:23 +0100 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2018-12-06 14:05:04 +0000 |
commit | 8c8acc027871f97370ee549306876690030c3bbb (patch) | |
tree | 36e3c8b05d8112105739a5e809ed7fa7d80ab785 /src/vpp-api/python/vpp_papi/vpp_format.py | |
parent | 1f0dd7a0664bc217b7d69773574ac7eae3813bd7 (diff) |
API: Change ip4_address and ip6_address to use type alias.
Change-Id: Id8669bbadd1d6b2054865a310a654e9b38d1667d
Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/vpp-api/python/vpp_papi/vpp_format.py')
-rw-r--r-- | src/vpp-api/python/vpp_papi/vpp_format.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/vpp-api/python/vpp_papi/vpp_format.py b/src/vpp-api/python/vpp_papi/vpp_format.py index c6f9477e03f..908606a92cc 100644 --- a/src/vpp-api/python/vpp_papi/vpp_format.py +++ b/src/vpp-api/python/vpp_papi/vpp_format.py @@ -32,7 +32,7 @@ class VPPFormat(object): @staticmethod def unformat_vl_api_ip6_prefix_t(args): - return "{}/{}".format(inet_ntop(AF_INET6, args.prefix.address), + return "{}/{}".format(inet_ntop(AF_INET6, args.prefix), args.len) @staticmethod @@ -43,7 +43,7 @@ class VPPFormat(object): @staticmethod def unformat_vl_api_ip4_prefix_t(args): - return "{}/{}".format(inet_ntop(AF_INET, args.prefix.address), + return "{}/{}".format(inet_ntop(AF_INET, args.prefix), args.len) @staticmethod @@ -57,18 +57,18 @@ class VPPFormat(object): @staticmethod def format_vl_api_address_t(args): try: - return {'un': {'ip6': {'address': inet_pton(AF_INET6, args)}}, + return {'un': {'ip6': inet_pton(AF_INET6, args)}, 'af': int(1)} except socket.error as e: - return {'un': {'ip4': {'address': inet_pton(AF_INET, args)}}, + return {'un': {'ip4': inet_pton(AF_INET, args)}, 'af': int(0)} @staticmethod def unformat_vl_api_address_t(arg): if arg.af == 1: - return inet_ntop(AF_INET6, arg.un.ip6.address) + return inet_ntop(AF_INET6, arg.un.ip6) if arg.af == 0: - return inet_ntop(AF_INET, arg.un.ip4.address) + return inet_ntop(AF_INET, arg.un.ip4) raise VPPFormatError @staticmethod @@ -81,11 +81,11 @@ class VPPFormat(object): def unformat_vl_api_prefix_t(arg): if arg.address.af == 1: return "{}/{}".format(inet_ntop(AF_INET6, - arg.address.un.ip6.address), + arg.address.un.ip6), arg.address_length) if arg.address.af == 0: return "{}/{}".format(inet_ntop(AF_INET, - arg.address.un.ip4.address), + arg.address.un.ip4), arg.address_length) raise VPPFormatError |