summaryrefslogtreecommitdiffstats
path: root/src/vat/api_format.c
diff options
context:
space:
mode:
authorSteven Luong <sluong@cisco.com>2020-07-15 08:44:54 -0700
committerDave Barach <openvpp@barachs.net>2020-07-28 12:13:49 +0000
commit4c4223edfd46841062340fe449cd97a93dccc498 (patch)
tree8daedd7264e235e273a4e23d209a2baca80781d0 /src/vat/api_format.c
parent4d1423c5ace249f6609a41fadec9e4b9c4b323de (diff)
bonding lacp: replace slave string with member
- Replace textual string slave with member except APIs. - For APIs, mark the existing APIs as deprecated and introduce new APIs - While introducing sw_bond_interface_dump, add the optional filter by sw_if_index and enhance the testcases to make use of it. Type: improvement Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Ib6626c514e45350308aeeda0decb70f3aba2f63e
Diffstat (limited to 'src/vat/api_format.c')
-rw-r--r--src/vat/api_format.c96
1 files changed, 55 insertions, 41 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index d95fb8e9ee0..cc0f5bef8e4 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -1930,7 +1930,7 @@ static void vl_api_bond_delete_reply_t_handler_json
}
static void
-vl_api_bond_enslave_reply_t_handler (vl_api_bond_enslave_reply_t * mp)
+vl_api_bond_add_member_reply_t_handler (vl_api_bond_add_member_reply_t * mp)
{
vat_main_t *vam = &vat_main;
i32 retval = ntohl (mp->retval);
@@ -1946,8 +1946,8 @@ vl_api_bond_enslave_reply_t_handler (vl_api_bond_enslave_reply_t * mp)
}
}
-static void vl_api_bond_enslave_reply_t_handler_json
- (vl_api_bond_enslave_reply_t * mp)
+static void vl_api_bond_add_member_reply_t_handler_json
+ (vl_api_bond_add_member_reply_t * mp)
{
vat_main_t *vam = &vat_main;
vat_json_node_t node;
@@ -1963,8 +1963,8 @@ static void vl_api_bond_enslave_reply_t_handler_json
}
static void
-vl_api_bond_detach_slave_reply_t_handler (vl_api_bond_detach_slave_reply_t *
- mp)
+vl_api_bond_detach_member_reply_t_handler (vl_api_bond_detach_member_reply_t *
+ mp)
{
vat_main_t *vam = &vat_main;
i32 retval = ntohl (mp->retval);
@@ -1980,8 +1980,8 @@ vl_api_bond_detach_slave_reply_t_handler (vl_api_bond_detach_slave_reply_t *
}
}
-static void vl_api_bond_detach_slave_reply_t_handler_json
- (vl_api_bond_detach_slave_reply_t * mp)
+static void vl_api_bond_detach_member_reply_t_handler_json
+ (vl_api_bond_detach_member_reply_t * mp)
{
vat_main_t *vam = &vat_main;
vat_json_node_t node;
@@ -2039,8 +2039,8 @@ api_sw_interface_set_bond_weight (vat_main_t * vam)
return ret;
}
-static void vl_api_sw_interface_bond_details_t_handler
- (vl_api_sw_interface_bond_details_t * mp)
+static void vl_api_sw_bond_interface_details_t_handler
+ (vl_api_sw_bond_interface_details_t * mp)
{
vat_main_t *vam = &vat_main;
@@ -2048,11 +2048,11 @@ static void vl_api_sw_interface_bond_details_t_handler
"%-16s %-12d %-12U %-13U %-14u %-14u",
mp->interface_name, ntohl (mp->sw_if_index),
format_bond_mode, ntohl (mp->mode), format_bond_load_balance,
- ntohl (mp->lb), ntohl (mp->active_slaves), ntohl (mp->slaves));
+ ntohl (mp->lb), ntohl (mp->active_members), ntohl (mp->members));
}
-static void vl_api_sw_interface_bond_details_t_handler_json
- (vl_api_sw_interface_bond_details_t * mp)
+static void vl_api_sw_bond_interface_details_t_handler_json
+ (vl_api_sw_bond_interface_details_t * mp)
{
vat_main_t *vam = &vat_main;
vat_json_node_t *node = NULL;
@@ -2070,24 +2070,38 @@ static void vl_api_sw_interface_bond_details_t_handler_json
mp->interface_name);
vat_json_object_add_uint (node, "mode", ntohl (mp->mode));
vat_json_object_add_uint (node, "load_balance", ntohl (mp->lb));
- vat_json_object_add_uint (node, "active_slaves", ntohl (mp->active_slaves));
- vat_json_object_add_uint (node, "slaves", ntohl (mp->slaves));
+ vat_json_object_add_uint (node, "active_members",
+ ntohl (mp->active_members));
+ vat_json_object_add_uint (node, "members", ntohl (mp->members));
}
static int
-api_sw_interface_bond_dump (vat_main_t * vam)
+api_sw_bond_interface_dump (vat_main_t * vam)
{
- vl_api_sw_interface_bond_dump_t *mp;
+ unformat_input_t *i = vam->input;
+ vl_api_sw_bond_interface_dump_t *mp;
vl_api_control_ping_t *mp_ping;
int ret;
+ u32 sw_if_index = ~0;
+
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
+ ;
+ else if (unformat (i, "sw_if_index %d", &sw_if_index))
+ ;
+ else
+ break;
+ }
print (vam->ofp,
"\n%-16s %-12s %-12s %-13s %-14s %-14s",
"interface name", "sw_if_index", "mode", "load balance",
- "active slaves", "slaves");
+ "active members", "members");
/* Get list of bond interfaces */
- M (SW_INTERFACE_BOND_DUMP, mp);
+ M (SW_BOND_INTERFACE_DUMP, mp);
+ mp->sw_if_index = ntohl (sw_if_index);
S (mp);
/* Use a control ping for synchronization */
@@ -2098,8 +2112,8 @@ api_sw_interface_bond_dump (vat_main_t * vam)
return ret;
}
-static void vl_api_sw_interface_slave_details_t_handler
- (vl_api_sw_interface_slave_details_t * mp)
+static void vl_api_sw_member_interface_details_t_handler
+ (vl_api_sw_member_interface_details_t * mp)
{
vat_main_t *vam = &vat_main;
@@ -2109,8 +2123,8 @@ static void vl_api_sw_interface_slave_details_t_handler
ntohl (mp->weight), mp->is_local_numa);
}
-static void vl_api_sw_interface_slave_details_t_handler_json
- (vl_api_sw_interface_slave_details_t * mp)
+static void vl_api_sw_member_interface_details_t_handler_json
+ (vl_api_sw_member_interface_details_t * mp)
{
vat_main_t *vam = &vat_main;
vat_json_node_t *node = NULL;
@@ -2133,10 +2147,10 @@ static void vl_api_sw_interface_slave_details_t_handler_json
}
static int
-api_sw_interface_slave_dump (vat_main_t * vam)
+api_sw_member_interface_dump (vat_main_t * vam)
{
unformat_input_t *i = vam->input;
- vl_api_sw_interface_slave_dump_t *mp;
+ vl_api_sw_member_interface_dump_t *mp;
vl_api_control_ping_t *mp_ping;
u32 sw_if_index = ~0;
u8 sw_if_index_set = 0;
@@ -2161,11 +2175,11 @@ api_sw_interface_slave_dump (vat_main_t * vam)
print (vam->ofp,
"\n%-25s %-12s %-7s %-12s %-10s %-10s",
- "slave interface name", "sw_if_index", "passive", "long_timeout",
+ "member interface name", "sw_if_index", "passive", "long_timeout",
"weight", "local numa");
/* Get list of bond interfaces */
- M (SW_INTERFACE_SLAVE_DUMP, mp);
+ M (SW_MEMBER_INTERFACE_DUMP, mp);
mp->sw_if_index = ntohl (sw_if_index);
S (mp);
@@ -5230,11 +5244,11 @@ _(VIRTIO_PCI_DELETE_REPLY, virtio_pci_delete_reply) \
_(SW_INTERFACE_VIRTIO_PCI_DETAILS, sw_interface_virtio_pci_details) \
_(BOND_CREATE_REPLY, bond_create_reply) \
_(BOND_DELETE_REPLY, bond_delete_reply) \
-_(BOND_ENSLAVE_REPLY, bond_enslave_reply) \
-_(BOND_DETACH_SLAVE_REPLY, bond_detach_slave_reply) \
+_(BOND_ADD_MEMBER_REPLY, bond_add_member_reply) \
+_(BOND_DETACH_MEMBER_REPLY, bond_detach_member_reply) \
_(SW_INTERFACE_SET_BOND_WEIGHT_REPLY, sw_interface_set_bond_weight_reply) \
-_(SW_INTERFACE_BOND_DETAILS, sw_interface_bond_details) \
-_(SW_INTERFACE_SLAVE_DETAILS, sw_interface_slave_details) \
+_(SW_BOND_INTERFACE_DETAILS, sw_bond_interface_details) \
+_(SW_MEMBER_INTERFACE_DETAILS, sw_member_interface_details) \
_(IP_ROUTE_ADD_DEL_REPLY, ip_route_add_del_reply) \
_(IP_TABLE_ADD_DEL_REPLY, ip_table_add_del_reply) \
_(IP_TABLE_REPLACE_BEGIN_REPLY, ip_table_replace_begin_reply) \
@@ -7747,10 +7761,10 @@ api_bond_delete (vat_main_t * vam)
}
static int
-api_bond_enslave (vat_main_t * vam)
+api_bond_add_member (vat_main_t * vam)
{
unformat_input_t *i = vam->input;
- vl_api_bond_enslave_t *mp;
+ vl_api_bond_add_member_t *mp;
u32 bond_sw_if_index;
int ret;
u8 is_passive;
@@ -7781,12 +7795,12 @@ api_bond_enslave (vat_main_t * vam)
}
if (sw_if_index_is_set == 0)
{
- errmsg ("Missing slave sw_if_index. ");
+ errmsg ("Missing member sw_if_index. ");
return -99;
}
/* Construct the API message */
- M (BOND_ENSLAVE, mp);
+ M (BOND_ADD_MEMBER, mp);
mp->bond_sw_if_index = ntohl (bond_sw_if_index);
mp->sw_if_index = ntohl (sw_if_index);
@@ -7802,10 +7816,10 @@ api_bond_enslave (vat_main_t * vam)
}
static int
-api_bond_detach_slave (vat_main_t * vam)
+api_bond_detach_member (vat_main_t * vam)
{
unformat_input_t *i = vam->input;
- vl_api_bond_detach_slave_t *mp;
+ vl_api_bond_detach_member_t *mp;
u32 sw_if_index = ~0;
u8 sw_if_index_set = 0;
int ret;
@@ -7828,7 +7842,7 @@ api_bond_detach_slave (vat_main_t * vam)
}
/* Construct the API message */
- M (BOND_DETACH_SLAVE, mp);
+ M (BOND_DETACH_MEMBER, mp);
mp->sw_if_index = ntohl (sw_if_index);
@@ -20618,13 +20632,13 @@ _(bond_create, \
"[id <if-id>]") \
_(bond_delete, \
"<vpp-if-name> | sw_if_index <id>") \
-_(bond_enslave, \
+_(bond_add_member, \
"sw_if_index <n> bond <sw_if_index> [is_passive] [is_long_timeout]") \
-_(bond_detach_slave, \
+_(bond_detach_member, \
"sw_if_index <n>") \
_(sw_interface_set_bond_weight, "<intfc> | sw_if_index <nn> weight <value>") \
-_(sw_interface_bond_dump, "") \
-_(sw_interface_slave_dump, \
+ _(sw_bond_interface_dump, "<intfc> | sw_if_index <nn>") \
+ _(sw_member_interface_dump, \
"<vpp-if-name> | sw_if_index <id>") \
_(ip_table_add_del, \
"table <n> [ipv6] [add | del]\n") \