aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2019-09-27 13:44:28 +0200
committerNeale Ranns <nranns@cisco.com>2019-10-09 11:08:49 +0000
commitde312c2d5fd709e2562955f0a57a56ea91455d7d (patch)
tree6583b0e79ae0c9ddbc791ec5cabe959870160839
parent2429f8bdac28cae419d8d95ee4f039554f95d9a5 (diff)
interface: dump the interface device type
Type: feature Change-Id: I22e2ef34631c9432311ff6457504e0649e0512b4 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
-rw-r--r--src/vat/api_format.c2
-rw-r--r--src/vnet/interface.api2
-rw-r--r--src/vnet/interface_api.c6
-rw-r--r--src/vpp/api/test_client.c7
4 files changed, 14 insertions, 3 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index 9f02507e4f7..1a2fca1622e 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -1029,6 +1029,8 @@ static void vl_api_sw_interface_details_t_handler_json
sizeof (mp->l2_address));
vat_json_object_add_string_copy (node, "interface_name",
mp->interface_name);
+ vat_json_object_add_string_copy (node, "interface_dev_type",
+ mp->interface_dev_type);
vat_json_object_add_uint (node, "flags", mp->flags);
vat_json_object_add_uint (node, "link_duplex", mp->link_duplex);
vat_json_object_add_uint (node, "link_speed", mp->link_speed);
diff --git a/src/vnet/interface.api b/src/vnet/interface.api
index 02d7a505a51..1db5ef34c3a 100644
--- a/src/vnet/interface.api
+++ b/src/vnet/interface.api
@@ -131,6 +131,7 @@ autoreply define want_interface_events
@param pbb_b_vlanid - B-tag vlanid
@param pbb_i_sid - I-tag service id
@param interface_name - name of the interface
+ @param interface_dev_type - device type of the interface
@param tag - an ascii tag
*/
define sw_interface_details
@@ -186,6 +187,7 @@ define sw_interface_details
/* Interface name */
string interface_name[64];
+ string interface_dev_type[64];
string tag[64];
};
diff --git a/src/vnet/interface_api.c b/src/vnet/interface_api.c
index 4d5dab30f38..b24c2a1cb52 100644
--- a/src/vnet/interface_api.c
+++ b/src/vnet/interface_api.c
@@ -202,6 +202,8 @@ send_sw_interface_details (vpe_api_main_t * am,
{
vnet_hw_interface_t *hi =
vnet_get_sup_hw_interface (am->vnet_main, swif->sw_if_index);
+ vnet_device_class_t *dev_class =
+ vnet_get_device_class (am->vnet_main, hi->dev_class_index);
vl_api_sw_interface_details_t *mp = vl_msg_api_alloc (sizeof (*mp));
clib_memset (mp, 0, sizeof (*mp));
@@ -245,6 +247,10 @@ send_sw_interface_details (vpe_api_main_t * am,
strncpy ((char *) mp->interface_name,
(char *) interface_name, ARRAY_LEN (mp->interface_name) - 1);
+ if (dev_class && dev_class->name)
+ strncpy ((char *) mp->interface_dev_type, (char *) dev_class->name,
+ ARRAY_LEN (mp->interface_dev_type) - 1);
+
/* Send the L2 address for ethernet physical intfcs */
if (swif->sup_sw_if_index == swif->sw_if_index
&& hi->hw_class_index == ethernet_hw_interface_class.index)
diff --git a/src/vpp/api/test_client.c b/src/vpp/api/test_client.c
index 1239732ec8e..14f98cdeb1e 100644
--- a/src/vpp/api/test_client.c
+++ b/src/vpp/api/test_client.c
@@ -164,9 +164,10 @@ vl_api_sw_interface_details_t_handler (vl_api_sw_interface_details_t * mp)
speed = "bogus";
break;
}
- fformat (stdout, "details: %s sw_if_index %d sup_sw_if_index %d "
- "link_duplex %s link_speed %s",
- mp->interface_name, ntohl (mp->sw_if_index),
+ fformat (stdout,
+ "details: %s device_type %s sw_if_index %d sup_sw_if_index %d "
+ "link_duplex %s link_speed %s", mp->interface_name,
+ mp->interface_dev_type, ntohl (mp->sw_if_index),
ntohl (mp->sup_sw_if_index), duplex, speed);
if (mp->l2_address_length)