aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/pppoe/pppoe.api29
-rw-r--r--src/plugins/pppoe/pppoe_api.c12
-rw-r--r--src/plugins/pppoe/pppoe_test.c13
-rw-r--r--src/plugins/pppoe/test/vpp_pppoe_interface.py8
-rw-r--r--test/vpp_papi_provider.py2
5 files changed, 30 insertions, 34 deletions
diff --git a/src/plugins/pppoe/pppoe.api b/src/plugins/pppoe/pppoe.api
index 5f0423384eb..fcbbf8a2f97 100644
--- a/src/plugins/pppoe/pppoe.api
+++ b/src/plugins/pppoe/pppoe.api
@@ -13,13 +13,15 @@
* limitations under the License.
*/
-option version = "1.0.0";
+option version = "2.0.0";
+import "vnet/interface_types.api";
+import "vnet/ethernet/ethernet_types.api";
+import "vnet/ip/ip_types.api";
/** \brief Set or delete an PPPOE session
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@param is_add - add address if non-zero, else delete
- @param is_ipv6 - client_ip and dst_address is ipv6 or not
@param session_id - PPPoE session ID
@param client_ip - PPPOE session's client address.
@param decap_vrf_id - the vrf index for pppoe decaped packet
@@ -29,12 +31,11 @@ define pppoe_add_del_session
{
u32 client_index;
u32 context;
- u8 is_add;
- u8 is_ipv6;
+ bool is_add;
u16 session_id;
- u8 client_ip[16];
+ vl_api_address_t client_ip;
u32 decap_vrf_id;
- u8 client_mac[6];
+ vl_api_mac_address_t client_mac;
option vat_help = "client-addr <client-addr> session-id <nn> [encap-if-index <nn>] [decap-next [ip4|ip6|node <name>]] local-mac <local-mac> client-mac <client-mac> [del]";
};
@@ -47,7 +48,7 @@ define pppoe_add_del_session_reply
{
u32 context;
i32 retval;
- u32 sw_if_index;
+ vl_api_interface_index_t sw_if_index;
};
/** \brief Dump PPPOE session
@@ -59,14 +60,13 @@ define pppoe_session_dump
{
u32 client_index;
u32 context;
- u32 sw_if_index;
+ vl_api_interface_index_t sw_if_index;
option vat_help = "[<intfc> | sw_if_index <nn>]";
};
/** \brief dump details of an PPPOE session
@param context - sender context, to match reply w/ request
@param sw_if_index - software index of the interface
- @param is_ipv6 - client_ip and dst_address is ipv6 or not
@param session_id - PPPoE session ID
@param client_ip - PPPOE session's client address.
@param encap_if_index - the index of tx interface for pppoe encaped packet
@@ -77,14 +77,13 @@ define pppoe_session_dump
define pppoe_session_details
{
u32 context;
- u32 sw_if_index;
- u8 is_ipv6;
+ vl_api_interface_index_t sw_if_index;
u16 session_id;
- u8 client_ip[16];
- u32 encap_if_index;
+ vl_api_address_t client_ip;
+ vl_api_interface_index_t encap_if_index;
u32 decap_vrf_id;
- u8 local_mac[6];
- u8 client_mac[6];
+ vl_api_mac_address_t local_mac;
+ vl_api_mac_address_t client_mac;
};
/*
diff --git a/src/plugins/pppoe/pppoe_api.c b/src/plugins/pppoe/pppoe_api.c
index ccff405c677..ca9223779de 100644
--- a/src/plugins/pppoe/pppoe_api.c
+++ b/src/plugins/pppoe/pppoe_api.c
@@ -21,13 +21,14 @@
#include <vnet/api_errno.h>
#include <vnet/feature/feature.h>
#include <vnet/fib/fib_table.h>
-
+#include <vnet/ip/ip_types_api.h>
#include <vppinfra/byte_order.h>
#include <vlibmemory/api.h>
#include <pppoe/pppoe.h>
+#include <vnet/format_fns.h>
#include <pppoe/pppoe.api_enum.h>
#include <pppoe/pppoe.api_types.h>
@@ -53,11 +54,10 @@ static void vl_api_pppoe_add_del_session_t_handler
vnet_pppoe_add_del_session_args_t a = {
.is_add = mp->is_add,
- .is_ip6 = mp->is_ipv6,
.decap_fib_index = decap_fib_index,
.session_id = ntohs (mp->session_id),
- .client_ip = to_ip46 (mp->is_ipv6, mp->client_ip),
};
+ ip_address_decode (&mp->client_ip, &a.client_ip);
clib_memcpy (a.client_mac, mp->client_mac, 6);
u32 sw_if_index = ~0;
@@ -83,14 +83,15 @@ static void send_pppoe_session_details
rmp = vl_msg_api_alloc (sizeof (*rmp));
clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_PPPOE_SESSION_DETAILS);
+ ip_address_encode (&t->client_ip, is_ipv6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4,
+ &rmp->client_ip);
+
if (is_ipv6)
{
- memcpy (rmp->client_ip, t->client_ip.ip6.as_u8, 16);
rmp->decap_vrf_id = htonl (im6->fibs[t->decap_fib_index].ft_table_id);
}
else
{
- memcpy (rmp->client_ip, t->client_ip.ip4.as_u8, 4);
rmp->decap_vrf_id = htonl (im4->fibs[t->decap_fib_index].ft_table_id);
}
rmp->session_id = htons (t->session_id);
@@ -98,7 +99,6 @@ static void send_pppoe_session_details
clib_memcpy (rmp->local_mac, t->local_mac, 6);
clib_memcpy (rmp->client_mac, t->client_mac, 6);
rmp->sw_if_index = htonl (t->sw_if_index);
- rmp->is_ipv6 = is_ipv6;
rmp->context = context;
vl_api_send_msg (reg, (u8 *) rmp);
diff --git a/src/plugins/pppoe/pppoe_test.c b/src/plugins/pppoe/pppoe_test.c
index 72d186546e7..d66eab1ba63 100644
--- a/src/plugins/pppoe/pppoe_test.c
+++ b/src/plugins/pppoe/pppoe_test.c
@@ -19,6 +19,9 @@
#include <vppinfra/error.h>
#include <pppoe/pppoe.h>
+#include <vnet/format_fns.h>
+
+#include <vnet/ip/ip_types_api.h>
#define __plugin_msg_base pppoe_test_main.msg_id_base
#include <vlibapi/vat_helper_macros.h>
@@ -158,19 +161,19 @@ api_pppoe_add_del_session (vat_main_t * vam)
M (PPPOE_ADD_DEL_SESSION, mp);
+
if (ipv6_set)
{
- clib_memcpy (mp->client_ip, &client_ip.ip6, sizeof (client_ip.ip6));
+ ip_address_encode(&client_ip, IP46_TYPE_IP6, &mp->client_ip);
}
else
{
- clib_memcpy (mp->client_ip, &client_ip.ip4, sizeof (client_ip.ip4));
+ ip_address_encode(&client_ip, IP46_TYPE_IP4, &mp->client_ip);
}
mp->decap_vrf_id = ntohl (decap_vrf_id);
mp->session_id = ntohl (session_id);
mp->is_add = is_add;
- mp->is_ipv6 = ipv6_set;
memcpy (mp->client_mac, client_mac, 6);
S (mp);
@@ -182,8 +185,8 @@ static void vl_api_pppoe_session_details_t_handler
(vl_api_pppoe_session_details_t * mp)
{
vat_main_t *vam = &vat_main;
- ip46_address_t client_ip = to_ip46 (mp->is_ipv6, mp->client_ip);
-
+ ip46_address_t client_ip;
+ ip_address_decode(&mp->client_ip, &client_ip);
print (vam->ofp, "%11d%14d%24U%14d%14d%30U%30U",
ntohl (mp->sw_if_index), ntohl (mp->session_id),
format_ip46_address, &client_ip, IP46_TYPE_ANY,
diff --git a/src/plugins/pppoe/test/vpp_pppoe_interface.py b/src/plugins/pppoe/test/vpp_pppoe_interface.py
index 9be92327dcf..3767aa1d086 100644
--- a/src/plugins/pppoe/test/vpp_pppoe_interface.py
+++ b/src/plugins/pppoe/test/vpp_pppoe_interface.py
@@ -19,21 +19,17 @@ class VppPppoeInterface(VppInterface):
self.decap_vrf_id = decap_vrf_id
def add_vpp_config(self):
- cip = socket.inet_pton(socket.AF_INET, self.client_ip)
- cmac = mac_pton(self.client_mac)
r = self.test.vapi.pppoe_add_del_session(
- cip, cmac,
+ self.client_ip, self.client_mac,
session_id=self.session_id,
decap_vrf_id=self.decap_vrf_id)
self.set_sw_if_index(r.sw_if_index)
self.generate_remote_hosts()
def remove_vpp_config(self):
- cip = socket.inet_pton(socket.AF_INET, self.client_ip)
- cmac = mac_pton(self.client_mac)
self.unconfig()
self.test.vapi.pppoe_add_del_session(
- cip, cmac,
+ self.client_ip, self.client_mac,
session_id=self.session_id,
decap_vrf_id=self.decap_vrf_id,
is_add=0)
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index 65b58f15f52..109ae0edcd2 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -995,7 +995,6 @@ class VppPapiProvider(object):
client_mac,
session_id=0,
is_add=1,
- is_ipv6=0,
decap_vrf_id=0):
"""
@@ -1009,7 +1008,6 @@ class VppPapiProvider(object):
"""
return self.api(self.papi.pppoe_add_del_session,
{'is_add': is_add,
- 'is_ipv6': is_ipv6,
'session_id': session_id,
'client_ip': client_ip,
'decap_vrf_id': decap_vrf_id,