summaryrefslogtreecommitdiffstats
path: root/vpp-api-test/vat
diff options
context:
space:
mode:
authorAndrej Kozemcak <akozemca@cisco.com>2016-07-27 10:33:38 +0200
committerFlorin Coras <florin.coras@gmail.com>2016-07-27 13:23:24 +0000
commita8691754d2f7cdd960c3d8dc5fbff6367e9c36b8 (patch)
treeb1715a03db89657278630c21b6e4363a905e55e4 /vpp-api-test/vat
parent683d3ee1b136060ef38290b6ab3a21c9a4730c4f (diff)
VAT add_locator_set api support multiple locators
Change-Id: I22df3d4407bd7fdd953783f00605380a2d6fb46e Signed-off-by: Andrej Kozemcak <akozemca@cisco.com>
Diffstat (limited to 'vpp-api-test/vat')
-rw-r--r--vpp-api-test/vat/api_format.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/vpp-api-test/vat/api_format.c b/vpp-api-test/vat/api_format.c
index 3b2c91cf449..a2200660798 100644
--- a/vpp-api-test/vat/api_format.c
+++ b/vpp-api-test/vat/api_format.c
@@ -10488,6 +10488,14 @@ static int api_get_node_graph (vat_main_t * vam)
W;
}
+/** Used for transferring locators via VPP API */
+typedef CLIB_PACKED(struct
+{
+ u32 sw_if_index; /**< locator sw_if_index */
+ u8 priority; /**< locator priority */
+ u8 weight; /**< locator weight */
+}) ls_locator_t;
+
static int
api_lisp_add_del_locator_set(vat_main_t * vam)
{
@@ -10497,6 +10505,8 @@ api_lisp_add_del_locator_set(vat_main_t * vam)
u8 is_add = 1;
u8 *locator_set_name = NULL;
u8 locator_set_name_set = 0;
+ ls_locator_t locator, * locators = 0;
+ u32 sw_if_index, priority, weight;
/* Parse args required to build the message */
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) {
@@ -10504,18 +10514,32 @@ api_lisp_add_del_locator_set(vat_main_t * vam)
is_add = 0;
} else if (unformat(input, "locator-set %s", &locator_set_name)) {
locator_set_name_set = 1;
+ } else if (unformat(input, "sw_if_index %u p %u w %u",
+ &sw_if_index, &priority, &weight)) {
+ locator.sw_if_index = htonl(sw_if_index);
+ locator.priority = priority;
+ locator.weight = weight;
+ vec_add1(locators, locator);
+ } else if (unformat(input, "iface %U p %u w %u", unformat_sw_if_index,
+ vam, &sw_if_index, &priority, &weight)) {
+ locator.sw_if_index = htonl(sw_if_index);
+ locator.priority = priority;
+ locator.weight = weight;
+ vec_add1(locators, locator);
} else
break;
}
if (locator_set_name_set == 0) {
errmsg ("missing locator-set name");
+ vec_free(locators);
return -99;
}
if (vec_len(locator_set_name) > 64) {
errmsg ("locator-set name too long\n");
vec_free(locator_set_name);
+ vec_free(locators);
return -99;
}
vec_add1(locator_set_name, 0);
@@ -10528,6 +10552,11 @@ api_lisp_add_del_locator_set(vat_main_t * vam)
vec_len(locator_set_name));
vec_free(locator_set_name);
+ mp->locator_num = vec_len (locators);
+ clib_memcpy (mp->locators, locators,
+ (sizeof (ls_locator_t) * vec_len (locators)));
+ vec_free (locators);
+
/* send it... */
S;
@@ -13147,7 +13176,9 @@ _(trace_profile_add, "id <nn> trace-type <0x1f|0x3|0x9|0x11|0x19> " \
_(trace_profile_apply, "id <nn> <ip6-address>/<width>" \
" vrf_id <nn> add | pop | none") \
_(trace_profile_del, "") \
-_(lisp_add_del_locator_set, "locator-set <locator_name> [del]") \
+_(lisp_add_del_locator_set, "locator-set <locator_name> [iface <intf> |"\
+ " sw_if_index <sw_if_index> p <priority> " \
+ "w <weight>] [del]") \
_(lisp_add_del_locator, "locator-set <locator_name> " \
"iface <intf> | sw_if_index <sw_if_index> " \
"p <priority> w <weight> [del]") \