summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extras/vom/vom/api_types.cpp59
-rw-r--r--extras/vom/vom/api_types.hpp2
-rw-r--r--extras/vom/vom/bridge_domain_arp_entry_cmds.cpp4
-rw-r--r--extras/vom/vom/gbp_contract_cmds.cpp2
-rw-r--r--extras/vom/vom/gbp_endpoint_cmds.cpp2
-rw-r--r--extras/vom/vom/ip_punt_redirect_cmds.cpp4
-rw-r--r--src/plugins/igmp/igmp_api.c4
-rw-r--r--src/plugins/map/map_api.c2
-rw-r--r--src/vnet/ip/ip_types.api9
-rw-r--r--src/vnet/ip/ip_types_api.c4
-rw-r--r--src/vnet/syslog/syslog_api.c4
-rwxr-xr-xsrc/vpp-api/python/vpp_papi/tests/test_vpp_serializer.py21
-rw-r--r--src/vpp-api/python/vpp_papi/vpp_format.py16
-rw-r--r--src/vpp-api/python/vpp_papi/vpp_serializer.py8
-rwxr-xr-xsrc/vpp-api/vapi/vapi_c_gen.py14
-rw-r--r--src/vpp/api/types.c8
-rw-r--r--test/test_ip4.py2
-rw-r--r--test/test_ip6.py2
-rw-r--r--test/test_syslog.py4
-rw-r--r--test/vpp_igmp.py10
-rw-r--r--test/vpp_ip.py42
-rw-r--r--test/vpp_papi_provider.py11
-rw-r--r--test/vpp_vxlan_gbp_tunnel.py4
23 files changed, 94 insertions, 144 deletions
diff --git a/extras/vom/vom/api_types.cpp b/extras/vom/vom/api_types.cpp
index 1b9ff2913a1..1bde8be9dcc 100644
--- a/extras/vom/vom/api_types.cpp
+++ b/extras/vom/vom/api_types.cpp
@@ -17,47 +17,15 @@
namespace VOM {
-static vapi_type_ip4_address
-to_api(const boost::asio::ip::address_v4& a)
-{
- vapi_type_ip4_address v;
-
- std::copy_n(a.to_bytes().data(), 4, v.address);
-
- return v;
-}
-
-static vapi_type_ip6_address
-to_api(const boost::asio::ip::address_v6& a)
-{
- vapi_type_ip6_address v;
-
- std::copy_n(a.to_bytes().data(), 16, v.address);
-
- return v;
-}
-
-vapi_type_address
-to_api(const ip_address_t& a)
+void
+to_api(const ip_address_t& a, vapi_type_address& v)
{
if (a.is_v4()) {
- vapi_type_address v = {
- .af = ADDRESS_IP4,
- .un =
- {
- .ip4 = to_api(a.to_v4()),
- },
- };
- return (v);
+ v.af = ADDRESS_IP4;
+ memcpy(v.un.ip4, a.to_v4().to_bytes().data(), 4);
} else {
- vapi_type_address v = {
- .af = ADDRESS_IP6,
- .un =
- {
- .ip6 = to_api(a.to_v6()),
- },
- };
- return (v);
+ v.af = ADDRESS_IP6;
+ memcpy(v.un.ip6, a.to_v6().to_bytes().data(), 16);
}
}
@@ -68,12 +36,12 @@ from_api(const vapi_type_address& v)
if (ADDRESS_IP6 == v.af) {
std::array<uint8_t, 16> a;
- std::copy(v.un.ip6.address, v.un.ip6.address + 16, std::begin(a));
+ std::copy(v.un.ip6, v.un.ip6 + 16, std::begin(a));
boost::asio::ip::address_v6 v6(a);
addr = v6;
} else {
std::array<uint8_t, 4> a;
- std::copy(v.un.ip6.address, v.un.ip6.address + 4, std::begin(a));
+ std::copy(v.un.ip6, v.un.ip6 + 4, std::begin(a));
boost::asio::ip::address_v4 v4(a);
addr = v4;
}
@@ -103,14 +71,11 @@ from_api(const vapi_type_prefix& v)
return route::prefix_t(from_api(v.address), v.address_length);
}
-vapi_type_prefix
-to_api(const route::prefix_t& p)
+void
+to_api(const route::prefix_t& p, vapi_type_prefix& v)
{
- vapi_type_prefix v = {
- .address = to_api(p.address()), .address_length = p.mask_width(),
- };
-
- return v;
+ to_api(p.address(), v.address);
+ v.address_length = p.mask_width();
}
};
diff --git a/extras/vom/vom/api_types.hpp b/extras/vom/vom/api_types.hpp
index b555fc3c752..96e2c47f558 100644
--- a/extras/vom/vom/api_types.hpp
+++ b/extras/vom/vom/api_types.hpp
@@ -23,7 +23,7 @@ namespace VOM {
typedef boost::asio::ip::address ip_address_t;
-vapi_type_address to_api(const ip_address_t& a);
+void to_api(const ip_address_t& a, vapi_type_address& v);
ip_address_t from_api(const vapi_type_address& v);
diff --git a/extras/vom/vom/bridge_domain_arp_entry_cmds.cpp b/extras/vom/vom/bridge_domain_arp_entry_cmds.cpp
index 4e5dfb0f2f4..da5c547bb3b 100644
--- a/extras/vom/vom/bridge_domain_arp_entry_cmds.cpp
+++ b/extras/vom/vom/bridge_domain_arp_entry_cmds.cpp
@@ -46,7 +46,7 @@ create_cmd::issue(connection& con)
payload.bd_id = m_bd;
payload.is_add = 1;
payload.mac = to_api(m_mac);
- payload.ip = to_api(m_ip_addr);
+ to_api(m_ip_addr, payload.ip);
VAPI_CALL(req.execute());
@@ -91,7 +91,7 @@ delete_cmd::issue(connection& con)
payload.bd_id = m_bd;
payload.is_add = 0;
payload.mac = to_api(m_mac);
- payload.ip = to_api(m_ip_addr);
+ to_api(m_ip_addr, payload.ip);
VAPI_CALL(req.execute());
diff --git a/extras/vom/vom/gbp_contract_cmds.cpp b/extras/vom/vom/gbp_contract_cmds.cpp
index db49f9751f1..1a3975b832a 100644
--- a/extras/vom/vom/gbp_contract_cmds.cpp
+++ b/extras/vom/vom/gbp_contract_cmds.cpp
@@ -77,7 +77,7 @@ create_cmd::issue(connection& con)
payload.contract.rules[ii].nh_set.n_nhs = nh_size;
while (jj < nh_size) {
- payload.contract.rules[ii].nh_set.nhs[jj].ip = to_api(nh_it->getIp());
+ to_api(nh_it->getIp(), payload.contract.rules[ii].nh_set.nhs[jj].ip);
payload.contract.rules[ii].nh_set.nhs[jj].mac = to_api(nh_it->getMac());
payload.contract.rules[ii].nh_set.nhs[jj].bd_id = nh_it->getBdId();
payload.contract.rules[ii].nh_set.nhs[jj].rd_id = nh_it->getRdId();
diff --git a/extras/vom/vom/gbp_endpoint_cmds.cpp b/extras/vom/vom/gbp_endpoint_cmds.cpp
index 8d44c91ec61..b15b941b125 100644
--- a/extras/vom/vom/gbp_endpoint_cmds.cpp
+++ b/extras/vom/vom/gbp_endpoint_cmds.cpp
@@ -54,7 +54,7 @@ create_cmd::issue(connection& con)
payload.endpoint.n_ips = m_ip_addrs.size();
for (n = 0; n < payload.endpoint.n_ips; n++) {
- payload.endpoint.ips[n] = to_api(m_ip_addrs[n]);
+ to_api(m_ip_addrs[n], payload.endpoint.ips[n]);
}
payload.endpoint.mac = to_api(m_mac);
diff --git a/extras/vom/vom/ip_punt_redirect_cmds.cpp b/extras/vom/vom/ip_punt_redirect_cmds.cpp
index 135ef6a4e64..419e3f17fba 100644
--- a/extras/vom/vom/ip_punt_redirect_cmds.cpp
+++ b/extras/vom/vom/ip_punt_redirect_cmds.cpp
@@ -47,7 +47,7 @@ config_cmd::issue(connection& con)
payload.is_add = 1;
payload.punt.rx_sw_if_index = m_rx_itf.value();
payload.punt.tx_sw_if_index = m_tx_itf.value();
- payload.punt.nh = to_api(m_addr);
+ to_api(m_addr, payload.punt.nh);
VAPI_CALL(req.execute());
@@ -93,7 +93,7 @@ unconfig_cmd::issue(connection& con)
payload.is_add = 0;
payload.punt.rx_sw_if_index = m_rx_itf.value();
payload.punt.tx_sw_if_index = m_tx_itf.value();
- payload.punt.nh = to_api(m_addr);
+ to_api(m_addr, payload.punt.nh);
VAPI_CALL(req.execute());
diff --git a/src/plugins/igmp/igmp_api.c b/src/plugins/igmp/igmp_api.c
index 75a2daedd62..8c14fab4bc4 100644
--- a/src/plugins/igmp/igmp_api.c
+++ b/src/plugins/igmp/igmp_api.c
@@ -172,8 +172,8 @@ send_igmp_details (unix_shared_memory_queue_t * q, igmp_main_t * im,
mp->_vl_msg_id = htons (IGMP_MSG_ID (VL_API_IGMP_DETAILS));
mp->context = context;
mp->sw_if_index = htonl (config->sw_if_index);
- clib_memcpy (mp->saddr.address, &src->key->ip4, sizeof (src->key->ip4));
- clib_memcpy (mp->gaddr.address, &group->key->ip4, sizeof (group->key->ip4));
+ clib_memcpy (mp->saddr, &src->key->ip4, sizeof (src->key->ip4));
+ clib_memcpy (mp->gaddr, &group->key->ip4, sizeof (group->key->ip4));
vl_msg_api_send_shmem (q, (u8 *) & mp);
}
diff --git a/src/plugins/map/map_api.c b/src/plugins/map/map_api.c
index 28cfd9db389..0b17793e952 100644
--- a/src/plugins/map/map_api.c
+++ b/src/plugins/map/map_api.c
@@ -179,7 +179,7 @@ vl_api_map_rule_dump_t_handler (vl_api_map_rule_dump_t * mp)
clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_MAP_RULE_DETAILS + mm->msg_id_base);
rmp->psid = htons (i);
- clib_memcpy (rmp->ip6_dst.address, &dst, sizeof (rmp->ip6_dst.address));
+ clib_memcpy (rmp->ip6_dst, &dst, sizeof (rmp->ip6_dst));
rmp->context = mp->context;
vl_api_send_msg (reg, (u8 *) rmp);
}
diff --git a/src/vnet/ip/ip_types.api b/src/vnet/ip/ip_types.api
index ad24d6e65ce..29bd8ad37f5 100644
--- a/src/vnet/ip/ip_types.api
+++ b/src/vnet/ip/ip_types.api
@@ -14,13 +14,8 @@
* limitations under the License.
*/
-typedef ip4_address {
- u8 address[4];
-};
-
-typedef ip6_address {
- u8 address[16];
-};
+typedef u8 ip4_address[4];
+typedef u8 ip6_address[16];
enum address_family {
ADDRESS_IP4 = 0,
diff --git a/src/vnet/ip/ip_types_api.c b/src/vnet/ip/ip_types_api.c
index 3d1f8065f5d..168e6150d19 100644
--- a/src/vnet/ip/ip_types_api.c
+++ b/src/vnet/ip/ip_types_api.c
@@ -67,9 +67,9 @@ ip_address_union_encode (const ip46_address_t * in,
vl_api_address_union_t * out)
{
if (ADDRESS_IP6 == clib_net_to_host_u32 (af))
- memcpy (out->ip6.address, &in->ip6, sizeof (out->ip6));
+ memcpy (out->ip6, &in->ip6, sizeof (out->ip6));
else
- memcpy (out->ip4.address, &in->ip4, sizeof (out->ip4));
+ memcpy (out->ip4, &in->ip4, sizeof (out->ip4));
}
void
diff --git a/src/vnet/syslog/syslog_api.c b/src/vnet/syslog/syslog_api.c
index 8f94c72b291..cef7b607157 100644
--- a/src/vnet/syslog/syslog_api.c
+++ b/src/vnet/syslog/syslog_api.c
@@ -149,9 +149,9 @@ vl_api_syslog_get_sender_t_handler (vl_api_syslog_get_sender_t * mp)
/* *INDENT-OFF* */
REPLY_MACRO2 (VL_API_SYSLOG_GET_SENDER_REPLY,
({
- clib_memcpy (rmp->collector_address.address, &(sm->collector),
+ clib_memcpy (rmp->collector_address, &(sm->collector),
sizeof(ip4_address_t));
- clib_memcpy (rmp->src_address.address, &(sm->src_address),
+ clib_memcpy (rmp->src_address, &(sm->src_address),
sizeof(ip4_address_t));
rmp->collector_port = htons (sm->collector_port);
if (sm->fib_index == ~0)
diff --git a/src/vpp-api/python/vpp_papi/tests/test_vpp_serializer.py b/src/vpp-api/python/vpp_papi/tests/test_vpp_serializer.py
index 4b47e1eca7d..ba3190cadf9 100755
--- a/src/vpp-api/python/vpp_papi/tests/test_vpp_serializer.py
+++ b/src/vpp-api/python/vpp_papi/tests/test_vpp_serializer.py
@@ -3,6 +3,7 @@
import unittest
from vpp_papi.vpp_serializer import VPPType, VPPEnumType
from vpp_papi.vpp_serializer import VPPUnionType, VPPMessage
+from vpp_papi.vpp_serializer import VPPTypeAlias
from vpp_papi.vpp_format import VPPFormat
from socket import inet_pton, AF_INET, AF_INET6
import logging
@@ -94,8 +95,10 @@ class TestAddType(unittest.TestCase):
af = VPPEnumType('vl_api_address_family_t', [["ADDRESS_IP4", 0],
["ADDRESS_IP6", 1],
{"enumtype": "u32"}])
- ip4 = VPPType('vl_api_ip4_address_t', [['u8', 'address', 4]])
- ip6 = VPPType('vl_api_ip6_address_t', [['u8', 'address', 16]])
+ ip4 = VPPTypeAlias('vl_api_ip4_address_t', {'type': 'u8',
+ 'length': 4})
+ ip6 = VPPTypeAlias('vl_api_ip6_address_t', {'type': 'u8',
+ 'length': 16})
VPPUnionType('vl_api_address_union_t',
[["vl_api_ip4_address_t", "ip4"],
["vl_api_ip6_address_t", "ip6"]])
@@ -112,7 +115,6 @@ class TestAddType(unittest.TestCase):
message_addr = VPPMessage('svs_address',
[['vl_api_address_t', 'address']])
-
b = message_addr.pack({'address': "1::1"})
self.assertEqual(len(b), 20)
nt, size = message_addr.unpack(b)
@@ -127,6 +129,19 @@ class TestAddType(unittest.TestCase):
nt, size = message.unpack(b)
self.assertEqual("1.1.1.1/24", VPPFormat.unformat(nt.prefix))
+ message_array = VPPMessage('address_array',
+ [['vl_api_ip4_address_t',
+ 'addresses', 2]])
+ b = message_array.pack({'addresses': ["1::1", "2::2"]})
+ self.assertEqual(len(b), 8)
+
+ message_array_vla = VPPMessage('address_array_vla',
+ [['u32', 'num'],
+ ['vl_api_ip4_address_t',
+ 'addresses', 0, 'num']])
+ b = message_array_vla.pack({'addresses': ["1::1", "2::2"], 'num': 2})
+ self.assertEqual(len(b), 12)
+
def test_zero_vla(self):
'''Default zero'ed out for VLAs'''
list = VPPType('vl_api_list_t',
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
diff --git a/src/vpp-api/python/vpp_papi/vpp_serializer.py b/src/vpp-api/python/vpp_papi/vpp_serializer.py
index f78972979cd..13721ff88d4 100644
--- a/src/vpp-api/python/vpp_papi/vpp_serializer.py
+++ b/src/vpp-api/python/vpp_papi/vpp_serializer.py
@@ -79,7 +79,7 @@ class FixedList_u8(object):
self.packer = BaseTypes(field_type, num)
self.size = self.packer.size
- def pack(self, list, kwargs = None):
+ def pack(self, list, kwargs=None):
"""Packs a fixed length bytestring. Left-pads with zeros
if input data is too short."""
if not list:
@@ -290,7 +290,11 @@ def VPPTypeAlias(name, msgdef):
if 'length' in msgdef:
if msgdef['length'] == 0:
raise ValueError()
- types[name] = FixedList(name, msgdef['type'], msgdef['length'])
+ if msgdef['type'] == 'u8':
+ types[name] = FixedList_u8(name, msgdef['type'],
+ msgdef['length'])
+ else:
+ types[name] = FixedList(name, msgdef['type'], msgdef['length'])
else:
types[name] = t
diff --git a/src/vpp-api/vapi/vapi_c_gen.py b/src/vpp-api/vapi/vapi_c_gen.py
index 9939bc0556c..490b83028da 100755
--- a/src/vpp-api/vapi/vapi_c_gen.py
+++ b/src/vpp-api/vapi/vapi_c_gen.py
@@ -10,7 +10,7 @@ from vapi_json_parser import Field, Struct, Enum, Union, Message, JsonParser,\
class CField(Field):
def get_c_name(self):
- return self.name
+ return "vapi_type_%s" % self.name
def get_c_def(self):
if self.len is not None:
@@ -100,14 +100,14 @@ class CField(Field):
class CAlias(CField):
def get_c_name(self):
- return self.name
+ return "vapi_type_%s" % self.name
def get_c_def(self):
- return "typedef %s" % super(CAlias, self).get_c_def()
- # if self.len is not None:
- # return "typedef %s %s[%d];" % (self.type.get_c_name(), self.name, self.len)
- # else:
- # return "typedef %s %s;" % (self.type.get_c_name(), self.name)
+ if self.len is not None:
+ return "typedef %s vapi_type_%s[%d];" % (self.type.get_c_name(), self.name, self.len)
+ else:
+ return "typedef %s vapi_type_%s;" % (self.type.get_c_name(), self.name)
+ #return "typedef %s" % super(CAlias, self).get_c_def()
# def needs_byte_swap
diff --git a/src/vpp/api/types.c b/src/vpp/api/types.c
index b1f16564c59..1e36bf5fb69 100644
--- a/src/vpp/api/types.c
+++ b/src/vpp/api/types.c
@@ -25,9 +25,9 @@ format_vl_api_address (u8 * s, va_list * args)
const vl_api_address_t *addr = va_arg (*args, vl_api_address_t *);
if (ADDRESS_IP6 == clib_net_to_host_u32 (addr->af))
- s = format (s, "ip6:%U", format_ip6_address, addr->un.ip6.address);
+ s = format (s, "ip6:%U", format_ip6_address, addr->un.ip6);
else
- s = format (s, "ip4:%U", format_ip4_address, addr->un.ip4.address);
+ s = format (s, "ip4:%U", format_ip4_address, addr->un.ip4);
return s;
}
@@ -40,9 +40,9 @@ format_vl_api_address_union (u8 * s, va_list * args)
vl_api_address_family_t af = va_arg (*args, vl_api_address_family_t);
if (ADDRESS_IP6 == af)
- s = format (s, "ip6:%U", format_ip6_address, addr->ip6.address);
+ s = format (s, "ip6:%U", format_ip6_address, addr->ip6);
else
- s = format (s, "ip4:%U", format_ip4_address, addr->ip4.address);
+ s = format (s, "ip4:%U", format_ip4_address, addr->ip4);
return s;
}
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):