lldp: dump api
[vpp.git] / src / plugins / lldp / lldp.api
1 /*
2  * Copyright (c) 2017 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16 option version = "2.0.0";
17
18 import "vnet/interface_types.api";
19 import "vnet/ip/ip_types.api";
20
21 /** \brief configure global parameter for LLDP
22     @param client_index - opaque cookie to identify the sender
23     @param context - sender context, to match reply w/ request
24     @param system_name - VPP system name
25     @param tx_hold - multiplier for tx_interval when setting time-to-live (TTL)
26                      value in the LLDP packets
27     @param tx_interval - time interval, in seconds, between each LLDP frames
28 */
29 autoreply define lldp_config
30 {
31   u32 client_index;
32   u32 context;
33   u32 tx_hold;
34   u32 tx_interval;
35   string system_name[];
36 };
37
38 /** \brief Interface set LLDP request
39     @param client_index - opaque cookie to identify the sender
40     @param context - sender context, to match reply w/ request
41     @param sw_if_index - interface for which to enable/disable LLDP
42     @param mgmt_ip4_addr - management ip4 address of the interface
43     @param mgmt_ip6_addr - management ip6 address of the interface
44     @param mgmt_oid - OID(Object Identifier) of the interface
45     @param enable - if non-zero enable, else disable
46     @param port_desc - local port description
47 */
48 autoreply define sw_interface_set_lldp
49 {
50   u32 client_index;
51   u32 context;
52   vl_api_interface_index_t sw_if_index;
53   vl_api_ip4_address_t mgmt_ip4;
54   vl_api_ip6_address_t mgmt_ip6;
55   u8 mgmt_oid[128];
56   bool enable [default=true];
57   string port_desc[];
58 };
59
60 /** \brief Dump lldp neighbors
61     @param client_index - opaque cookie to identify the sender
62     @param context - sender context, to match reply w/ request
63 */
64 autoendian define lldp_dump
65 {
66   u32 client_index;
67   u32 context;
68   u32 cursor;
69 };
70
71 autoendian define lldp_dump_reply
72 {
73   u32 context;
74   i32 retval;
75   u32 cursor;
76 };
77
78 enum port_id_subtype
79 {
80   PORT_ID_SUBTYPE_RESERVED = 0x00,
81   PORT_ID_SUBTYPE_INTF_ALIAS = 0x01,
82   PORT_ID_SUBTYPE_PORT_COMP = 0x02,
83   PORT_ID_SUBTYPE_MAC_ADDR = 0x03,
84   PORT_ID_SUBTYPE_NET_ADDR = 0x04,
85   PORT_ID_SUBTYPE_INTF_NAME = 0x05,
86   PORT_ID_SUBTYPE_AGENT_CIRCUIT_ID = 0x06,
87   PORT_ID_SUBTYPE_LOCAL = 0x07,
88 };
89
90 enum chassis_id_subtype
91 {
92   CHASSIS_ID_SUBTYPE_RESERVED = 0x00,
93   CHASSIS_ID_SUBTYPE_CHASSIS_COMP = 0x01,
94   CHASSIS_ID_SUBTYPE_INTF_ALIAS = 0x02,
95   CHASSIS_ID_SUBTYPE_PORT_COMP = 0x03,
96   CHASSIS_ID_SUBTYPE_MAC_ADDR = 0x04,
97   CHASSIS_ID_SUBTYPE_NET_ADDR = 0x05,
98   CHASSIS_ID_SUBTYPE_INTF_NAME = 0x06,
99   CHASSIS_ID_SUBTYPE_LOCAL = 0x07,
100 };
101
102 /** \brief Details about neighbor
103     @param context - returned sender context, to match reply w/ request
104     @param sw_if_index - interface where neighbor was discovered
105     @param last_heard - last heard time
106     @param last_sent - last sent time
107     @param chassis_id - chassis id value
108     @param chassis_id_len - length for chassis id
109     @param port_id - port id value
110     @param port_id_len - length for port id
111     @param ttl - time to length for the neighbour
112     @param port_id_subtype - subtype for port_id
113     @param chassis_id_sybtype - sybtype for chassis_id
114 */
115 autoendian define lldp_details
116 {
117   u32 context;
118   vl_api_interface_index_t sw_if_index;
119   f64 last_heard;
120   f64 last_sent;
121   u8 chassis_id[64];
122   u8 chassis_id_len;
123   u8 port_id[64];
124   u8 port_id_len;
125   u16 ttl;
126   vl_api_port_id_subtype_t port_id_subtype;
127   vl_api_chassis_id_subtype_t chassis_id_subtype;
128   option status="in_progress";
129 };
130
131 service {
132   rpc lldp_dump returns lldp_dump_reply
133     stream lldp_details;
134 };