vam->result_ready = 1;
}
+
+static void vl_api_lisp_add_del_locator_set_reply_t_handler
+ (vl_api_lisp_add_del_locator_set_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ i32 retval = ntohl (mp->retval);
+ if (vam->async_mode)
+ {
+ vam->async_errors += (retval < 0);
+ }
+ else
+ {
+ vam->retval = retval;
+ vam->result_ready = 1;
+ }
+}
+
+static void vl_api_lisp_add_del_locator_set_reply_t_handler_json
+ (vl_api_lisp_add_del_locator_set_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ vat_json_node_t node;
+
+ vat_json_init_object (&node);
+ vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
+ vat_json_object_add_uint (&node, "locator_set_index", ntohl (mp->ls_index));
+
+ vat_json_print (vam->ofp, &node);
+ vat_json_free (&node);
+
+ vam->retval = ntohl (mp->retval);
+ vam->result_ready = 1;
+}
+
static void vl_api_vxlan_add_del_tunnel_reply_t_handler
(vl_api_vxlan_add_del_tunnel_reply_t * mp)
{
}
static void
-vl_api_lisp_eid_table_details_t_handler (vl_api_lisp_eid_table_details_t * mp)
+add_lisp_eid_table_entry (vat_main_t * vam,
+ vl_api_lisp_eid_table_details_t * mp)
{
- vat_main_t *vam = &vat_main;
eid_table_t eid_table;
memset (&eid_table, 0, sizeof (eid_table));
eid_table.is_local = mp->is_local;
- eid_table.locator_set_index = mp->locator_set_index;
+ eid_table.locator_set_index = clib_net_to_host_u32 (mp->locator_set_index);
eid_table.eid_type = mp->eid_type;
- eid_table.vni = mp->vni;
+ eid_table.vni = clib_net_to_host_u32 (mp->vni);
eid_table.eid_prefix_len = mp->eid_prefix_len;
- eid_table.ttl = mp->ttl;
+ eid_table.ttl = clib_net_to_host_u32 (mp->ttl);
+ eid_table.action = mp->action;
eid_table.authoritative = mp->authoritative;
clib_memcpy (eid_table.eid, mp->eid, sizeof (eid_table.eid));
vec_add1 (vam->eid_tables, eid_table);
}
+static void
+vl_api_lisp_eid_table_details_t_handler (vl_api_lisp_eid_table_details_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ add_lisp_eid_table_entry (vam, mp);
+}
+
static void
vl_api_lisp_eid_table_details_t_handler_json (vl_api_lisp_eid_table_details_t
* mp)
{
vat_main_t *vam = &vat_main;
- eid_table_t eid_table;
-
- memset (&eid_table, 0, sizeof (eid_table));
- eid_table.is_local = mp->is_local;
- eid_table.locator_set_index = mp->locator_set_index;
- eid_table.eid_type = mp->eid_type;
- eid_table.vni = mp->vni;
- eid_table.eid_prefix_len = mp->eid_prefix_len;
- eid_table.ttl = mp->ttl;
- eid_table.authoritative = mp->authoritative;
- clib_memcpy (eid_table.eid, mp->eid, sizeof (eid_table.eid));
- vec_add1 (vam->eid_tables, eid_table);
+ add_lisp_eid_table_entry (vam, mp);
}
static void
u8 *line = format (0, "%=10d%=10d",
clib_net_to_host_u32 (mp->vni),
- clib_net_to_host_u32 (mp->vrf));
+ clib_net_to_host_u32 (mp->dp_table));
fformat (vam->ofp, "%v\n", line);
vec_free (line);
}
}
node = vat_json_array_add (&vam->json_tree);
vat_json_init_object (node);
- vat_json_object_add_uint (node, "vrf", clib_net_to_host_u32 (mp->vrf));
+ vat_json_object_add_uint (node, "dp_table",
+ clib_net_to_host_u32 (mp->dp_table));
vat_json_object_add_uint (node, "vni", clib_net_to_host_u32 (mp->vni));
}
+static void
+ vl_api_lisp_eid_table_vni_details_t_handler
+ (vl_api_lisp_eid_table_vni_details_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+
+ u8 *line = format (0, "%d", clib_net_to_host_u32 (mp->vni));
+ fformat (vam->ofp, "%v\n", line);
+ vec_free (line);
+}
+static void
+ vl_api_lisp_eid_table_vni_details_t_handler_json
+ (vl_api_lisp_eid_table_vni_details_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ vat_json_node_t *node = NULL;
+
+ if (VAT_JSON_ARRAY != vam->json_tree.type)
+ {
+ ASSERT (VAT_JSON_NONE == vam->json_tree.type);
+ vat_json_init_array (&vam->json_tree);
+ }
+ node = vat_json_array_add (&vam->json_tree);
+ vat_json_init_object (node);
+ vat_json_object_add_uint (node, "vni", clib_net_to_host_u32 (mp->vni));
+}
static u8 *
format_decap_next (u8 * s, va_list * args)
_(trace_profile_add_reply) \
_(trace_profile_apply_reply) \
_(trace_profile_del_reply) \
-_(lisp_add_del_locator_set_reply) \
_(lisp_add_del_locator_reply) \
_(lisp_add_del_local_eid_reply) \
_(lisp_add_del_remote_mapping_reply) \
_(LISP_LOCATOR_DETAILS, lisp_locator_details) \
_(LISP_EID_TABLE_DETAILS, lisp_eid_table_details) \
_(LISP_EID_TABLE_MAP_DETAILS, lisp_eid_table_map_details) \
+_(LISP_EID_TABLE_VNI_DETAILS, lisp_eid_table_vni_details) \
_(LISP_GPE_TUNNEL_DETAILS, lisp_gpe_tunnel_details) \
_(LISP_MAP_RESOLVER_DETAILS, lisp_map_resolver_details) \
_(SHOW_LISP_STATUS_REPLY, show_lisp_status_reply) \
0, psid_length = 0;
u8 is_translation = 0;
u32 mtu = 0;
- u8 ip6_src_len = 128;
+ u32 ip6_src_len = 128;
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
}
}
- if (num_m_args != 6)
+ if (num_m_args < 3)
{
errmsg ("mandatory argument(s) missing\n");
return -99;
vec_len (locator_set_name));
vec_free (locator_set_name);
- mp->locator_num = vec_len (locators);
+ mp->locator_num = clib_host_to_net_u32 (vec_len (locators));
if (locators)
clib_memcpy (mp->locators, locators,
(sizeof (ls_locator_t) * vec_len (locators)));
mp->eid_type = eid->type;
lisp_eid_put_vat (mp->eid, eid->addr, eid->type);
- mp->rloc_num = vec_len (rlocs);
+ mp->rloc_num = clib_host_to_net_u32 (vec_len (rlocs));
clib_memcpy (mp->rlocs, rlocs, (sizeof (rloc_t) * vec_len (rlocs)));
vec_free (rlocs);
static int
api_lisp_eid_table_map_dump (vat_main_t * vam)
{
+ u8 is_l2 = 0;
+ u8 mode_set = 0;
+ unformat_input_t *input = vam->input;
vl_api_lisp_eid_table_map_dump_t *mp;
f64 timeout = ~0;
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "l2"))
+ {
+ is_l2 = 1;
+ mode_set = 1;
+ }
+ else if (unformat (input, "l3"))
+ {
+ is_l2 = 0;
+ mode_set = 1;
+ }
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if (!mode_set)
+ {
+ errmsg ("expected one of 'l2' or 'l3' parameter!\n");
+ return -99;
+ }
+
if (!vam->json_output)
{
- fformat (vam->ofp, "%=10s%=10s\n", "VNI", "VRF");
+ fformat (vam->ofp, "%=10s%=10s\n", "VNI", is_l2 ? "BD" : "VRF");
}
M (LISP_EID_TABLE_MAP_DUMP, lisp_eid_table_map_dump);
+ mp->is_l2 = is_l2;
+
+ /* send it... */
+ S;
+
+ /* Use a control ping for synchronization */
+ {
+ vl_api_control_ping_t *mp;
+ M (CONTROL_PING, control_ping);
+ S;
+ }
+ /* Wait for a reply... */
+ W;
+
+ /* NOTREACHED */
+ return 0;
+}
+
+static int
+api_lisp_eid_table_vni_dump (vat_main_t * vam)
+{
+ vl_api_lisp_eid_table_vni_dump_t *mp;
+ f64 timeout = ~0;
+
+ if (!vam->json_output)
+ {
+ fformat (vam->ofp, "VNI\n");
+ }
+
+ M (LISP_EID_TABLE_VNI_DUMP, lisp_eid_table_vni_dump);
/* send it... */
S;
case 1:
format_eid = (eid_table->eid_type ? format_ip6_address :
format_ip4_address);
- str = format (0, "[%d] %U/%d",
- clib_net_to_host_u32 (eid_table->vni),
+ str = format (0, "[%d] %U/%d", eid_table->vni,
format_eid, eid_table->eid, eid_table->eid_prefix_len);
break;
case 2:
- str = format (0, "[%d] %U",
- clib_net_to_host_u32 (eid_table->vni),
+ str = format (0, "[%d] %U", eid_table->vni,
format_ethernet_address, eid_table->eid);
break;
default:
ASSERT (vam != NULL);
ASSERT (eid_table != NULL);
+ if (~0 == eid_table->locator_set_index)
+ {
+ return format (0, "action: %d\n", eid_table->action);
+ }
+
vec_foreach (loc, vam->locator_msg)
{
if (!first_line)
vec_foreach (eid_table, vam->eid_tables)
{
- ret = lisp_locator_dump_send_msg (vam, eid_table->locator_set_index, 0);
- if (ret)
+ if (~0 != eid_table->locator_set_index)
{
- vec_free (vam->locator_msg);
- clean_locator_set_message (vam);
- vec_free (vam->eid_tables);
- return ret;
+ ret = lisp_locator_dump_send_msg (vam, eid_table->locator_set_index,
+ 0);
+ if (ret)
+ {
+ vec_free (vam->locator_msg);
+ clean_locator_set_message (vam);
+ vec_free (vam->eid_tables);
+ return ret;
+ }
}
tmp_str2 = format_eid_for_eid_table (vam, tmp_str2, eid_table, &ret);
"locator-set <loc-set-name>] [local | remote]")\
_(lisp_eid_table_dump, "[eid <ipv4|ipv6>/<prefix> | <mac>] [vni] " \
"[local] | [remote]") \
-_(lisp_eid_table_map_dump, "") \
+_(lisp_eid_table_vni_dump, "") \
+_(lisp_eid_table_map_dump, "l2|l3") \
_(lisp_gpe_tunnel_dump, "") \
_(lisp_map_resolver_dump, "") \
_(show_lisp_status, "") \