aboutsummaryrefslogtreecommitdiffstats
path: root/test/vpp_ip.py
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2018-11-27 10:05:23 +0100
committerOle Trøan <otroan@employees.org>2018-12-06 14:05:04 +0000
commit8c8acc027871f97370ee549306876690030c3bbb (patch)
tree36e3c8b05d8112105739a5e809ed7fa7d80ab785 /test/vpp_ip.py
parent1f0dd7a0664bc217b7d69773574ac7eae3813bd7 (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 'test/vpp_ip.py')
-rw-r--r--test/vpp_ip.py42
1 files changed, 9 insertions, 33 deletions
diff --git a/test/vpp_ip.py b/test/vpp_ip.py
index 2083e03b5e5..7f3a6b01e95 100644
--- a/test/vpp_ip.py
+++ b/test/vpp_ip.py
@@ -27,17 +27,9 @@ class VppIpAddressUnion():
def encode(self):
if self.version is 6:
- return {
- 'ip6': {
- 'address': self.ip_addr.packed
- },
- }
+ return {'ip6': self.ip_addr.packed}
else:
- return {
- 'ip4': {
- 'address': self.ip_addr.packed
- },
- }
+ return {'ip4': self.ip_addr.packed}
@property
def version(self):
@@ -64,9 +56,9 @@ class VppIpAddressUnion():
elif hasattr(other, "ip4") and hasattr(other, "ip6"):
# vl_api_address_union_t
if 4 is self.version:
- return self.ip_addr.packed == other.ip4.address
+ return self.ip_addr.packed == other.ip4
else:
- return self.ip_addr.packed == other.ip6.address
+ return self.ip_addr.packed == other.ip6
else:
raise Exception("Comparing VppIpAddresUnions:%s"
" with unknown type: %s" %
@@ -206,7 +198,7 @@ class VppIp6Prefix():
self.prefixlen = prefixlen
def encode(self):
- return {'prefix': {'address': self.ip_prefix.packed},
+ return {'prefix': self.ip_prefix.packed,
'len': self.prefixlen}
@@ -227,31 +219,15 @@ class VppIpMPrefix():
if 6 is self.ip_saddr.version:
prefix = {
'af': VppEnum.vl_api_address_family_t.ADDRESS_IP6,
- 'grp_address': {
- 'ip6': {
- 'address': self.ip_gaddr.packed
- },
- },
- 'src_address': {
- 'ip6': {
- 'address': self.ip_saddr.packed
- },
- },
+ 'grp_address': {'ip6': self.ip_gaddr.packed},
+ 'src_address': {'ip6': self.ip_saddr.packed},
'grp_address_length': self.len,
}
else:
prefix = {
'af': VppEnum.vl_api_address_family_t.ADDRESS_IP4,
- 'grp_address': {
- 'ip4': {
- 'address': self.ip_gaddr.packed
- },
- },
- 'src_address': {
- 'ip4': {
- 'address': self.ip_saddr.packed
- },
- },
+ 'grp_address': {'ip4': self.ip_gaddr.packed},
+ 'src_address': {'ip4': self.ip_saddr.packed},
'grp_address_length': self.len,
}
return prefix