api: L2 XConnect API (VPP-438)
[vpp.git] / vpp-api-test / vat / api_format.c
index 0bbed5c..e93c89b 100644 (file)
@@ -3786,7 +3786,8 @@ _(PUNT_REPLY, punt_reply)                                               \
 _(IP_FIB_DETAILS, ip_fib_details)                                       \
 _(IP6_FIB_DETAILS, ip6_fib_details)                                     \
 _(FEATURE_ENABLE_DISABLE_REPLY, feature_enable_disable_reply)          \
-_(SW_INTERFACE_TAG_ADD_DEL_REPLY, sw_interface_tag_add_del_reply)
+_(SW_INTERFACE_TAG_ADD_DEL_REPLY, sw_interface_tag_add_del_reply)      \
+_(L2_XCONNECT_DETAILS, l2_xconnect_details)
 
 /* M: construct, but don't yet send a message */
 
@@ -16304,6 +16305,59 @@ api_sw_interface_tag_add_del (vat_main_t * vam)
   W;
 }
 
+static void vl_api_l2_xconnect_details_t_handler
+  (vl_api_l2_xconnect_details_t * mp)
+{
+  vat_main_t *vam = &vat_main;
+
+  fformat (vam->ofp, "%15d%15d\n",
+          ntohl (mp->rx_sw_if_index), ntohl (mp->tx_sw_if_index));
+}
+
+static void vl_api_l2_xconnect_details_t_handler_json
+  (vl_api_l2_xconnect_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, "rx_sw_if_index",
+                           ntohl (mp->rx_sw_if_index));
+  vat_json_object_add_uint (node, "tx_sw_if_index",
+                           ntohl (mp->tx_sw_if_index));
+}
+
+static int
+api_l2_xconnect_dump (vat_main_t * vam)
+{
+  vl_api_l2_xconnect_dump_t *mp;
+  f64 timeout;
+
+  if (!vam->json_output)
+    {
+      fformat (vam->ofp, "%15s%15s\n", "rx_sw_if_index", "tx_sw_if_index");
+    }
+
+  M (L2_XCONNECT_DUMP, l2_xconnect_dump);
+
+  S;
+
+  /* Use a control ping for synchronization */
+  {
+    vl_api_control_ping_t *mp;
+    M (CONTROL_PING, control_ping);
+    S;
+  }
+  W;
+}
+
 static int
 q_or_quit (vat_main_t * vam)
 {
@@ -16976,7 +17030,8 @@ _(ip6_fib_dump, "")                                                     \
 _(feature_enable_disable, "arc_name <arc_name> "                        \
   "feature_name <feature_name> <intfc> | sw_if_index <nn> [disable]")  \
 _(sw_interface_tag_add_del, "<intfc> | sw_if_index <nn> tag <text>"    \
-"[disable]")
+"[disable]")                                                           \
+_(l2_xconnect_dump, "")
 
 /* List of command functions, CLI names map directly to functions */
 #define foreach_cli_function                                    \