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 /test | |
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 'test')
-rw-r--r-- | test/test_ip4.py | 2 | ||||
-rw-r--r-- | test/test_ip6.py | 2 | ||||
-rw-r--r-- | test/test_syslog.py | 4 | ||||
-rw-r--r-- | test/vpp_igmp.py | 10 | ||||
-rw-r--r-- | test/vpp_ip.py | 42 | ||||
-rw-r--r-- | test/vpp_papi_provider.py | 11 | ||||
-rw-r--r-- | test/vpp_vxlan_gbp_tunnel.py | 4 |
7 files changed, 23 insertions, 52 deletions
diff --git a/test/test_ip4.py b/test/test_ip4.py index c18ce4caa0a..c13024115e0 100644 --- a/test/test_ip4.py +++ b/test/test_ip4.py @@ -1213,7 +1213,7 @@ class TestIPPunt(VppTestCase): for p in punts: self.assertEqual(p.punt.tx_sw_if_index, self.pg3.sw_if_index) self.assertNotEqual(punts[1].punt.nh.un.ip4, self.pg3.remote_ip4) - self.assertEqual(punts[2].punt.nh.un.ip4.address, '\x00'*4) + self.assertEqual(punts[2].punt.nh.un.ip4, '\x00'*4) class TestIPDeag(VppTestCase): diff --git a/test/test_ip6.py b/test/test_ip6.py index df2364213d4..3a9e88c2bf3 100644 --- a/test/test_ip6.py +++ b/test/test_ip6.py @@ -2040,7 +2040,7 @@ class TestIP6Punt(VppTestCase): for p in punts: self.assertEqual(p.punt.tx_sw_if_index, self.pg3.sw_if_index) self.assertNotEqual(punts[1].punt.nh.un.ip6, self.pg3.remote_ip6) - self.assertEqual(punts[2].punt.nh.un.ip6.address, '\x00'*16) + self.assertEqual(punts[2].punt.nh.un.ip6, '\x00'*16) class TestIPDeag(VppTestCase): diff --git a/test/test_syslog.py b/test/test_syslog.py index db7d7bef2c7..a54513027e9 100644 --- a/test/test_syslog.py +++ b/test/test_syslog.py @@ -94,10 +94,10 @@ class TestSyslog(VppTestCase): """ Syslog Protocol test """ self.vapi.syslog_set_sender(self.pg0.remote_ip4n, self.pg0.local_ip4n) config = self.vapi.syslog_get_sender() - self.assertEqual(config.collector_address.address, + self.assertEqual(config.collector_address, self.pg0.remote_ip4n) self.assertEqual(config.collector_port, 514) - self.assertEqual(config.src_address.address, self.pg0.local_ip4n) + self.assertEqual(config.src_address, self.pg0.local_ip4n) self.assertEqual(config.vrf_id, 0) self.assertEqual(config.max_msg_size, 480) diff --git a/test/vpp_igmp.py b/test/vpp_igmp.py index 8f0191644bd..c4cbab13a0c 100644 --- a/test/vpp_igmp.py +++ b/test/vpp_igmp.py @@ -16,8 +16,8 @@ class IGMP_FILTER: def find_igmp_state(states, itf, gaddr, saddr): for s in states: if s.sw_if_index == itf.sw_if_index and \ - s.gaddr.address == socket.inet_pton(socket.AF_INET, gaddr) and \ - s.saddr.address == socket.inet_pton(socket.AF_INET, saddr): + s.gaddr == socket.inet_pton(socket.AF_INET, gaddr) and \ + s.saddr == socket.inet_pton(socket.AF_INET, saddr): return True return False @@ -25,8 +25,8 @@ def find_igmp_state(states, itf, gaddr, saddr): def wait_for_igmp_event(test, timeout, itf, gaddr, saddr, ff): ev = test.vapi.wait_for_event(timeout, "igmp_event") if ev.sw_if_index == itf.sw_if_index and \ - ev.gaddr.address == socket.inet_pton(socket.AF_INET, gaddr) and \ - ev.saddr.address == socket.inet_pton(socket.AF_INET, saddr) and \ + ev.gaddr == socket.inet_pton(socket.AF_INET, gaddr) and \ + ev.saddr == socket.inet_pton(socket.AF_INET, saddr) and \ ev.filter == ff: return True return False @@ -42,7 +42,7 @@ class IgmpSG(): for s in saddrs: ss = socket.inet_pton(socket.AF_INET, s) self.saddrs_p.append(ss) - self.saddrs_encoded.append({'address': ss}) + self.saddrs_encoded.append(ss) class IgmpRecord(): 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 diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py index 130f17868b3..6cbde71633e 100644 --- a/test/vpp_papi_provider.py +++ b/test/vpp_papi_provider.py @@ -3800,10 +3800,7 @@ class VppPapiProvider(object): 'sw_if_index': sw_if_index, 'n_srcs': len(saddrs), 'saddrs': saddrs, - 'gaddr': - { - 'address': gaddr - } + 'gaddr': gaddr } }) @@ -4071,10 +4068,8 @@ class VppPapiProvider(object): :param max_msg_size: maximum message length (Default value = 480) """ return self.api(self.papi.syslog_set_sender, - {'collector_address': { - 'address': collector}, - 'src_address': { - 'address': src}, + {'collector_address': collector, + 'src_address': src, 'collector_port': collector_port, 'vrf_id': vrf_id, 'max_msg_size': max_msg_size}) diff --git a/test/vpp_vxlan_gbp_tunnel.py b/test/vpp_vxlan_gbp_tunnel.py index 805d4c5f3e2..73f951718a4 100644 --- a/test/vpp_vxlan_gbp_tunnel.py +++ b/test/vpp_vxlan_gbp_tunnel.py @@ -57,8 +57,8 @@ class VppVxlanGbpTunnel(VppInterface): def query_vpp_config(self): return (INDEX_INVALID != find_vxlan_gbp_tunnel(self._test, - self.src.address, - self.dst.address, + self.src, + self.dst, self.vni)) def __str__(self): |