]>
Commit | Line | Data |
---|---|---|
eab6aa62 VB |
1 | /* -*- mode: c; c-file-style: "openbsd" -*- */ |
2 | /* | |
3 | * Copyright (c) 2015 Vincent Bernat <bernat@luffy.cx> | |
4 | * | |
5 | * Permission to use, copy, modify, and/or distribute this software for any | |
6 | * purpose with or without fee is hereby granted, provided that the above | |
7 | * copyright notice and this permission notice appear in all copies. | |
8 | * | |
9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
16 | */ | |
17 | ||
4e22da4c VB |
18 | #include <check.h> |
19 | ||
4b292b55 VB |
20 | #include "../src/daemon/lldpd.h" |
21 | #include "../src/daemon/agent.h" | |
4e22da4c VB |
22 | |
23 | #include <net-snmp/net-snmp-config.h> | |
24 | #include <net-snmp/net-snmp-includes.h> | |
25 | #include <net-snmp/agent/net-snmp-agent-includes.h> | |
26 | #include <net-snmp/agent/snmp_vars.h> | |
27 | ||
28 | extern struct lldpd *agent_scfg; | |
29 | extern struct timeval starttime; | |
30 | extern struct variable8 agent_lldp_vars[]; | |
4e22da4c VB |
31 | |
32 | /* Our test config */ | |
33 | struct lldpd test_cfg = { | |
d79c3de4 | 34 | .g_config = { |
7f6a8ace JPT |
35 | .c_tx_interval = 30000, |
36 | .c_tx_hold = 2, | |
71b0f981 | 37 | .c_ttl = 60, |
d79c3de4 VB |
38 | .c_smart = 0 |
39 | } | |
4e22da4c VB |
40 | }; |
41 | struct timeval test_starttime = { .tv_sec = 100, .tv_usec = 0 }; | |
42 | ||
43 | /* First chassis */ | |
2eec5540 VB |
44 | struct lldpd_mgmt mgmt1 = { |
45 | .m_family = LLDPD_AF_IPV4, | |
6d3c1ce0 | 46 | .m_addr = { .octets = { 0xc0, 0, 0x2, 0xf } }, /* 192.0.2.15 */ |
2eec5540 VB |
47 | .m_addrsize = sizeof(struct in_addr), |
48 | .m_iface = 3 | |
49 | }; | |
4e22da4c VB |
50 | struct lldpd_chassis chassis1 = { |
51 | .c_index = 1, | |
52 | .c_protocol = LLDPD_MODE_LLDP, | |
53 | .c_id_subtype = LLDP_CHASSISID_SUBTYPE_LLADDR, | |
54 | .c_id = "AAA012", | |
55 | .c_id_len = 6, | |
56 | .c_name = "chassis1.example.com", | |
57 | .c_descr = "First chassis", | |
58 | .c_cap_available = LLDP_CAP_BRIDGE | LLDP_CAP_WLAN | LLDP_CAP_ROUTER, | |
59 | .c_cap_enabled = LLDP_CAP_ROUTER, | |
4e22da4c | 60 | #ifdef ENABLE_LLDPMED |
4b292b55 VB |
61 | .c_med_cap_available = LLDP_MED_CAP_CAP | LLDP_MED_CAP_IV | \ |
62 | LLDP_MED_CAP_LOCATION | LLDP_MED_CAP_POLICY | \ | |
63 | LLDP_MED_CAP_MDI_PSE | LLDP_MED_CAP_MDI_PD, | |
64 | .c_med_type = LLDP_MED_CLASS_II, | |
4e22da4c VB |
65 | .c_med_hw = "Hardware 1", |
66 | /* We skip c_med_fw */ | |
67 | .c_med_sw = "Software 1", | |
68 | .c_med_sn = "00-00-0000-AAAA", | |
69 | .c_med_manuf = "Manufacturer 1", | |
70 | .c_med_model = "Model 1", | |
71 | .c_med_asset = "Asset 1", | |
72 | #endif | |
73 | }; | |
74 | /* Second chassis */ | |
2eec5540 VB |
75 | struct lldpd_mgmt mgmt2 = { |
76 | .m_family = LLDPD_AF_IPV4, | |
6d3c1ce0 | 77 | .m_addr = { .octets = { 0xc0, 0, 0x2, 0x11 } }, /* 192.0.2.17 */ |
2eec5540 VB |
78 | .m_addrsize = sizeof(struct in_addr), |
79 | .m_iface = 5 | |
80 | }; | |
af3caa3b VB |
81 | struct lldpd_mgmt mgmt3 = { |
82 | .m_family = LLDPD_AF_IPV6, | |
83 | .m_addr = { .octets = { 0x20, 0x01, 0x0d, 0xb8, | |
84 | 0xca, 0xfe, 0x00, 0x00, | |
85 | 0x00, 0x00, 0x00, 0x00, | |
86 | 0x00, 0x00, 0x00, 0x17 } }, /* 2001:db8:cafe::17 */ | |
87 | .m_addrsize = sizeof(struct in6_addr), | |
88 | .m_iface = 5 | |
89 | }; | |
4e22da4c VB |
90 | struct lldpd_chassis chassis2 = { |
91 | .c_index = 4, | |
92 | .c_protocol = LLDPD_MODE_LLDP, | |
93 | .c_id_subtype = LLDP_CHASSISID_SUBTYPE_LOCAL, | |
94 | .c_id = "chassis2", | |
95 | .c_id_len = 6, | |
96 | .c_name = "chassis2.example.com", | |
97 | .c_descr = "Second chassis", | |
98 | .c_cap_available = LLDP_CAP_ROUTER, | |
99 | .c_cap_enabled = LLDP_CAP_ROUTER, | |
4e22da4c VB |
100 | #ifdef ENABLE_LLDPMED |
101 | .c_med_hw = "Hardware 2", | |
102 | /* We skip c_med_fw */ | |
103 | .c_med_sw = "Software 2", | |
104 | .c_med_sn = "00-00-0000-AAAC", | |
105 | .c_med_manuf = "Manufacturer 2", | |
106 | .c_med_model = "Model 2", | |
107 | .c_med_asset = "Asset 2", | |
108 | #endif | |
109 | }; | |
110 | ||
111 | /* First port of first chassis */ | |
112 | struct lldpd_hardware hardware1 = { | |
113 | .h_ifindex = 3, | |
114 | .h_tx_cnt = 1352, | |
115 | .h_rx_cnt = 1458, | |
116 | .h_rx_discarded_cnt = 5, | |
4e22da4c | 117 | .h_rx_unrecognized_cnt = 4, |
14052b61 VB |
118 | .h_insert_cnt = 100, |
119 | .h_delete_cnt = 5, | |
120 | .h_ageout_cnt = 20, | |
42589660 | 121 | .h_drop_cnt = 1, |
4e22da4c VB |
122 | .h_lport = { |
123 | .p_chassis = &chassis1, | |
124 | .p_lastchange = 200, | |
125 | .p_protocol = LLDPD_MODE_LLDP, | |
126 | .p_id_subtype = LLDP_PORTID_SUBTYPE_LLADDR, | |
127 | .p_id = "AAA012", | |
128 | .p_id_len = 6, | |
129 | .p_descr = "eth2", | |
130 | .p_mfs = 1600, | |
131 | #ifdef ENABLE_DOT3 | |
132 | .p_aggregid = 0, | |
133 | .p_macphy = { | |
134 | .autoneg_support = 1, | |
135 | .autoneg_enabled = 1, | |
136 | .autoneg_advertised = LLDP_DOT3_LINK_AUTONEG_100BASE_TX | LLDP_DOT3_LINK_AUTONEG_100BASE_TXFD, | |
137 | .mau_type = LLDP_DOT3_MAU_100BASETXFD, | |
138 | }, | |
139 | .p_power = { | |
140 | .devicetype = LLDP_DOT3_POWER_PD, | |
141 | .supported = 1, | |
142 | .enabled = 1, | |
143 | .paircontrol = 1, | |
144 | .pairs = 2, | |
145 | .class = 3, | |
146 | .powertype = LLDP_DOT3_POWER_8023AT_TYPE2, | |
147 | .source = LLDP_DOT3_POWER_SOURCE_BOTH, | |
148 | .priority = LLDP_DOT3_POWER_PRIO_LOW, | |
149 | .requested = 2000, | |
150 | .allocated = 2500, | |
151 | }, | |
152 | #endif | |
153 | #ifdef ENABLE_LLDPMED | |
4b292b55 VB |
154 | .p_med_cap_enabled = LLDP_MED_CAP_CAP | LLDP_MED_CAP_IV | LLDP_MED_CAP_MDI_PD | |
155 | LLDP_MED_CAP_POLICY | LLDP_MED_CAP_LOCATION, | |
4e22da4c VB |
156 | .p_med_policy = { |
157 | { .type = 0 }, { .type = 0 }, { | |
4b292b55 | 158 | .type = LLDP_MED_APPTYPE_GUESTVOICE, |
4e22da4c VB |
159 | .unknown = 1, |
160 | .tagged = 1, | |
161 | .vid = 475, | |
162 | .priority = 3, | |
163 | .dscp = 62 | |
164 | }, { .type = 0 }, { .type = 0 }, { .type = 0 }, { | |
4b292b55 | 165 | .type = LLDP_MED_APPTYPE_VIDEOSTREAM, |
4e22da4c VB |
166 | .unknown = 0, |
167 | .tagged = 1, | |
168 | .vid = 472, | |
169 | .priority = 1, | |
170 | .dscp = 60 | |
171 | }, { .type = 0 } | |
172 | }, | |
173 | .p_med_location = { | |
174 | { .format = 0 }, { | |
4b292b55 | 175 | .format = LLDP_MED_LOCFORMAT_CIVIC, |
4e22da4c | 176 | /* 2:FR:6:Commercial Rd:19:4 */ |
2d05a444 | 177 | .data = "\x15" "\x02" "FR" "\x06" "\x0d" "Commercial Rd" "\x13" "\x01" "4", |
4e22da4c VB |
178 | .data_len = 22, |
179 | }, { .format = 0 } | |
180 | }, | |
181 | .p_med_power = { | |
4b292b55 VB |
182 | .devicetype = LLDP_MED_POW_TYPE_PD, |
183 | .source = LLDP_MED_POW_SOURCE_LOCAL, | |
184 | .priority = LLDP_MED_POW_PRIO_HIGH, | |
4e22da4c VB |
185 | .val = 100 |
186 | }, | |
187 | #endif | |
188 | #ifdef ENABLE_DOT1 | |
189 | .p_pvid = 47, | |
190 | /* Remaining is done is snmp_config */ | |
191 | #endif | |
192 | } | |
193 | }; | |
194 | /* Second port of first chassis */ | |
195 | struct lldpd_hardware hardware2 = { | |
196 | .h_ifindex = 4, | |
197 | .h_tx_cnt = 11352, | |
198 | .h_rx_cnt = 11458, | |
199 | .h_rx_discarded_cnt = 55, | |
4e22da4c | 200 | .h_rx_unrecognized_cnt = 14, |
14052b61 VB |
201 | .h_insert_cnt = 1000, |
202 | .h_delete_cnt = 51, | |
203 | .h_ageout_cnt = 210, | |
42589660 | 204 | .h_drop_cnt = 1, |
4e22da4c VB |
205 | .h_lport = { |
206 | .p_chassis = &chassis1, | |
207 | .p_lastchange = 50, | |
208 | .p_protocol = LLDPD_MODE_LLDP, | |
209 | .p_id_subtype = LLDP_PORTID_SUBTYPE_IFNAME, | |
210 | .p_id = "eth4", | |
211 | .p_id_len = 4, | |
212 | .p_descr = "Intel 1000 GE", | |
213 | .p_mfs = 9000, | |
214 | #ifdef ENABLE_DOT3 | |
215 | .p_aggregid = 3, | |
216 | .p_macphy = { | |
217 | .autoneg_support = 1, | |
218 | .autoneg_enabled = 1, | |
219 | .autoneg_advertised = LLDP_DOT3_LINK_AUTONEG_100BASE_TXFD | LLDP_DOT3_LINK_AUTONEG_1000BASE_TFD, | |
220 | .mau_type = LLDP_DOT3_MAU_1000BASETFD, | |
221 | }, | |
222 | #endif | |
223 | #ifdef ENABLE_LLDPMED | |
4b292b55 VB |
224 | .p_med_cap_enabled = LLDP_MED_CAP_CAP | LLDP_MED_CAP_IV | LLDP_MED_CAP_MDI_PD | |
225 | LLDP_MED_CAP_MDI_PSE | LLDP_MED_CAP_POLICY | LLDP_MED_CAP_LOCATION, | |
4e22da4c VB |
226 | .p_med_policy = { |
227 | { .type = 0 }, { .type = 0 }, { | |
4b292b55 | 228 | .type = LLDP_MED_APPTYPE_GUESTVOICE, |
4e22da4c VB |
229 | .unknown = 1, |
230 | .tagged = 1, | |
231 | .vid = 475, | |
232 | .priority = 3, | |
233 | .dscp = 62 | |
234 | }, { .type = 0 }, { .type = 0 }, { | |
4b292b55 | 235 | .type = LLDP_MED_APPTYPE_VIDEOCONFERENCE, |
4e22da4c VB |
236 | .unknown = 0, |
237 | .tagged = 0, | |
238 | .vid = 1007, | |
239 | .priority = 1, | |
240 | .dscp = 49 | |
241 | }, { .type = 0 }, { .type = 0 } | |
242 | }, | |
243 | .p_med_location = { | |
244 | { | |
4b292b55 | 245 | .format = LLDP_MED_LOCFORMAT_COORD, |
4e22da4c VB |
246 | .data = "Not interpreted", |
247 | .data_len = 15, | |
248 | }, { .format = 0 }, { .format = 0 }, | |
249 | }, | |
8ca3da07 | 250 | #endif |
4e22da4c VB |
251 | } |
252 | }; | |
253 | ||
8ca3da07 VB |
254 | #ifdef ENABLE_CUSTOM |
255 | struct lldpd_custom custom1 = { | |
256 | .oui = { 33, 44, 55 }, | |
257 | .subtype = 44, | |
258 | .oui_info = (u_int8_t*)"OUI content", | |
259 | }; | |
260 | struct lldpd_custom custom2 = { | |
261 | .oui = { 33, 44, 55 }, | |
262 | .subtype = 44, | |
263 | .oui_info = (u_int8_t*)"More content", | |
264 | }; | |
265 | struct lldpd_custom custom3 = { | |
266 | .oui = { 33, 44, 55 }, | |
267 | .subtype = 45, | |
268 | .oui_info = (u_int8_t*)"More more content", | |
269 | }; | |
270 | struct lldpd_custom custom4 = { | |
271 | .oui = { 33, 44, 56 }, | |
272 | .subtype = 44, | |
273 | .oui_info = (u_int8_t*)"Even more content", | |
274 | }; | |
275 | struct lldpd_custom custom5 = { | |
276 | .oui = { 33, 44, 55 }, | |
277 | .subtype = 44, | |
278 | .oui_info = (u_int8_t*)"Still more content", | |
279 | }; | |
280 | #endif | |
281 | ||
4e22da4c VB |
282 | #ifdef ENABLE_DOT1 |
283 | struct lldpd_vlan vlan47 = { | |
284 | .v_name = "VLAN #47", | |
285 | .v_vid = 47, | |
286 | }; | |
287 | struct lldpd_vlan vlan49 = { | |
288 | .v_name = "VLAN #49", | |
289 | .v_vid = 49, | |
290 | }; | |
291 | struct lldpd_vlan vlan1449 = { | |
292 | .v_name = "VLAN #1449", | |
293 | .v_vid = 1449, | |
294 | }; | |
295 | struct lldpd_ppvid ppvid47 = { | |
4b292b55 | 296 | .p_cap_status = LLDP_PPVID_CAP_SUPPORTED | LLDP_PPVID_CAP_ENABLED, |
4e22da4c VB |
297 | .p_ppvid = 47, |
298 | }; | |
299 | struct lldpd_ppvid ppvid118 = { | |
4b292b55 | 300 | .p_cap_status = LLDP_PPVID_CAP_SUPPORTED | LLDP_PPVID_CAP_ENABLED, |
4e22da4c VB |
301 | .p_ppvid = 118, |
302 | }; | |
303 | struct lldpd_pi pi88cc = { | |
304 | .p_pi = "\x88\xcc", | |
305 | .p_pi_len = 2, | |
306 | }; | |
307 | struct lldpd_pi pi888e01 = { | |
c11e6765 | 308 | .p_pi = "\x88\x8e\x01", |
4e22da4c VB |
309 | .p_pi_len = 3, |
310 | }; | |
311 | #endif | |
312 | ||
313 | /* First port of second chassis */ | |
314 | struct lldpd_port port2 = { | |
315 | .p_chassis = &chassis2, | |
316 | .p_lastchange = 180, | |
317 | .p_protocol = LLDPD_MODE_LLDP, | |
318 | .p_id_subtype = LLDP_PORTID_SUBTYPE_IFALIAS, | |
319 | .p_id = "Giga1/7", | |
320 | .p_id_len = 7, | |
321 | .p_descr = "Gigabit Ethernet 1/7", | |
322 | }; | |
323 | ||
324 | void | |
325 | snmp_config() | |
326 | { | |
4e22da4c VB |
327 | starttime = test_starttime; |
328 | agent_scfg = &test_cfg; | |
329 | TAILQ_INIT(&test_cfg.g_chassis); | |
2eec5540 VB |
330 | TAILQ_INIT(&chassis1.c_mgmt); |
331 | TAILQ_INSERT_TAIL(&chassis1.c_mgmt, &mgmt1, m_entries); | |
4e22da4c | 332 | TAILQ_INSERT_TAIL(&test_cfg.g_chassis, &chassis1, c_entries); |
2eec5540 VB |
333 | TAILQ_INIT(&chassis2.c_mgmt); |
334 | TAILQ_INSERT_TAIL(&chassis2.c_mgmt, &mgmt2, m_entries); | |
af3caa3b | 335 | TAILQ_INSERT_TAIL(&chassis2.c_mgmt, &mgmt3, m_entries); |
4e22da4c VB |
336 | TAILQ_INSERT_TAIL(&test_cfg.g_chassis, &chassis2, c_entries); |
337 | TAILQ_INIT(&test_cfg.g_hardware); | |
338 | TAILQ_INSERT_TAIL(&test_cfg.g_hardware, &hardware1, h_entries); | |
339 | TAILQ_INSERT_TAIL(&test_cfg.g_hardware, &hardware2, h_entries); | |
8ca3da07 VB |
340 | #ifdef ENABLE_CUSTOM |
341 | custom1.oui_info_len = strlen((char*)custom1.oui_info); | |
342 | custom2.oui_info_len = strlen((char*)custom2.oui_info); | |
343 | custom3.oui_info_len = strlen((char*)custom3.oui_info); | |
344 | custom4.oui_info_len = strlen((char*)custom4.oui_info); | |
345 | custom5.oui_info_len = strlen((char*)custom5.oui_info); | |
346 | TAILQ_INIT(&hardware1.h_lport.p_custom_list); | |
347 | TAILQ_INIT(&hardware2.h_lport.p_custom_list); | |
348 | TAILQ_INIT(&port2.p_custom_list); | |
349 | TAILQ_INSERT_TAIL(&hardware2.h_lport.p_custom_list, &custom1, next); | |
350 | TAILQ_INSERT_TAIL(&hardware2.h_lport.p_custom_list, &custom2, next); | |
351 | TAILQ_INSERT_TAIL(&hardware2.h_lport.p_custom_list, &custom3, next); | |
352 | TAILQ_INSERT_TAIL(&hardware2.h_lport.p_custom_list, &custom4, next); | |
353 | TAILQ_INSERT_TAIL(&hardware1.h_lport.p_custom_list, &custom5, next); | |
354 | #endif | |
4e22da4c VB |
355 | #ifdef ENABLE_DOT1 |
356 | TAILQ_INIT(&hardware1.h_lport.p_vlans); | |
357 | TAILQ_INSERT_TAIL(&hardware1.h_lport.p_vlans, &vlan47, v_entries); | |
358 | TAILQ_INSERT_TAIL(&hardware1.h_lport.p_vlans, &vlan49, v_entries); | |
359 | TAILQ_INSERT_TAIL(&hardware1.h_lport.p_vlans, &vlan1449, v_entries); | |
360 | TAILQ_INIT(&hardware1.h_lport.p_ppvids); | |
361 | TAILQ_INSERT_TAIL(&hardware1.h_lport.p_ppvids, &ppvid47, p_entries); | |
362 | TAILQ_INSERT_TAIL(&hardware1.h_lport.p_ppvids, &ppvid118, p_entries); | |
363 | TAILQ_INIT(&hardware1.h_lport.p_pids); | |
364 | TAILQ_INSERT_TAIL(&hardware1.h_lport.p_pids, &pi88cc, p_entries); | |
365 | TAILQ_INSERT_TAIL(&hardware1.h_lport.p_pids, &pi888e01, p_entries); | |
366 | TAILQ_INIT(&hardware2.h_lport.p_vlans); | |
367 | TAILQ_INIT(&hardware2.h_lport.p_ppvids); | |
368 | TAILQ_INIT(&hardware2.h_lport.p_pids); | |
369 | TAILQ_INIT(&port2.p_vlans); | |
370 | TAILQ_INIT(&port2.p_ppvids); | |
371 | TAILQ_INIT(&port2.p_pids); | |
372 | #endif | |
373 | TAILQ_INIT(&hardware1.h_rports); | |
374 | TAILQ_INSERT_TAIL(&hardware1.h_rports, &port2, p_entries); | |
375 | TAILQ_INSERT_TAIL(&hardware1.h_rports, &hardware2.h_lport, p_entries); | |
376 | TAILQ_INIT(&hardware2.h_rports); | |
377 | TAILQ_INSERT_TAIL(&hardware2.h_rports, &hardware1.h_lport, p_entries); | |
4e22da4c VB |
378 | } |
379 | ||
380 | /* Convert OID to a string. Static buffer. */ | |
381 | char* | |
382 | snmp_oidrepr(oid *name, size_t namelen) | |
383 | { | |
384 | static char *buffer[4] = {NULL, NULL, NULL, NULL}; | |
385 | static int current = 0; | |
d99c2368 | 386 | size_t i; |
5fd6695c | 387 | |
4e22da4c | 388 | current = (current + 1)%4; |
81b171f4 | 389 | free(buffer[current]); buffer[current] = NULL; |
4e22da4c | 390 | |
4e22da4c VB |
391 | for (i = 0; i < namelen; i++) { |
392 | /* Not very efficient... */ | |
393 | char *newbuffer = NULL; | |
1e264e08 VB |
394 | if (asprintf(&newbuffer, "%s.%lu", buffer[current]?buffer[current]:"", |
395 | (unsigned long)name[i]) == -1) { | |
6a5334d4 VB |
396 | free(buffer[current]); |
397 | buffer[current] = NULL; | |
398 | return NULL; | |
399 | } | |
81b171f4 | 400 | free(buffer[current]); |
4e22da4c VB |
401 | buffer[current] = newbuffer; |
402 | } | |
403 | return buffer[current++]; | |
404 | } | |
405 | ||
406 | struct tree_node { | |
407 | oid name[MAX_OID_LEN]; | |
408 | size_t namelen; | |
409 | int type; /* ASN_* */ | |
410 | union { | |
411 | unsigned long int integer; | |
412 | struct { | |
413 | char *octet; | |
414 | size_t len; | |
415 | } string; | |
416 | } value; | |
417 | }; | |
418 | ||
419 | static oid zeroDotZero[2] = {0, 0}; | |
420 | struct tree_node snmp_tree[] = { | |
421 | { {1, 1, 1, 0}, 4, ASN_INTEGER, { .integer = 30 } }, /* lldpMessageTxInterval */ | |
422 | { {1, 1, 2, 0}, 4, ASN_INTEGER, { .integer = 2 } }, /* lldpMessageTxHoldMultiplier */ | |
423 | { {1, 1, 3, 0}, 4, ASN_INTEGER, { .integer = 1 } }, /* lldpReinitDelay */ | |
424 | { {1, 1, 4, 0}, 4, ASN_INTEGER, { .integer = 1 } }, /* lldpTxDelay */ | |
425 | { {1, 1, 5, 0}, 4, ASN_INTEGER, { .integer = 5 } }, /* lldpNotificationInterval */ | |
426 | { {1, 2, 1, 0}, 4, ASN_TIMETICKS, { .integer = 10000 } },/* lldpStatsRemTablesLastChangeTime */ | |
14052b61 VB |
427 | { {1, 2, 2, 0}, 4, ASN_GAUGE, { .integer = 1100 } }, /* lldpStatsRemTablesInserts */ |
428 | { {1, 2, 3, 0}, 4, ASN_GAUGE, { .integer = 56 } }, /* lldpStatsRemTablesDeletes */ | |
42589660 | 429 | { {1, 2, 4, 0}, 4, ASN_GAUGE, { .integer = 2 } }, /* lldpStatsRemTablesDrops */ |
14052b61 | 430 | { {1, 2, 5, 0}, 4, ASN_GAUGE, { .integer = 230 } }, /* lldpStatsRemTablesAgeouts */ |
4e22da4c VB |
431 | |
432 | { {1, 2, 6, 1, 2, 3}, 6, ASN_COUNTER, { .integer = 1352 } }, /* lldpStatsTxPortFramesTotal.3 */ | |
433 | { {1, 2, 6, 1, 2, 4}, 6, ASN_COUNTER, { .integer = 11352 } }, /* lldpStatsTxPortFramesTotal.4 */ | |
434 | { {1, 2, 7, 1, 2, 3}, 6, ASN_COUNTER, { .integer = 5 } }, /* lldpStatsRxPortFramesDiscardedTotal.3 */ | |
435 | { {1, 2, 7, 1, 2, 4}, 6, ASN_COUNTER, { .integer = 55 } }, /* lldpStatsRxPortFramesDiscardedTotal.4 */ | |
436 | { {1, 2, 7, 1, 3, 3}, 6, ASN_COUNTER, { .integer = 5 } }, /* lldpStatsRxPortFramesError.3 */ | |
437 | { {1, 2, 7, 1, 3, 4}, 6, ASN_COUNTER, { .integer = 55 } }, /* lldpStatsRxPortFramesError.4 */ | |
438 | { {1, 2, 7, 1, 4, 3}, 6, ASN_COUNTER, { .integer = 1458 } }, /* lldpStatsRxPortFramesTotal.3 */ | |
439 | { {1, 2, 7, 1, 4, 4}, 6, ASN_COUNTER, { .integer = 11458 } }, /* lldpStatsRxPortFramesTotal.4 */ | |
440 | { {1, 2, 7, 1, 5, 3}, 6, ASN_COUNTER, { .integer = 4 } }, /* lldpStatsRxPortTLVsDiscardedTotal.3 */ | |
441 | { {1, 2, 7, 1, 5, 4}, 6, ASN_COUNTER, { .integer = 14 } }, /* lldpStatsRxPortTLVsDiscardedTotal.4 */ | |
442 | { {1, 2, 7, 1, 6, 3}, 6, ASN_COUNTER, { .integer = 4 } }, /* lldpStatsRxPortTLVsUnrecognizedTotal.3 */ | |
443 | { {1, 2, 7, 1, 6, 4}, 6, ASN_COUNTER, { .integer = 14 } }, /* lldpStatsRxPortTLVsUnrecognizedTotal.4 */ | |
14052b61 VB |
444 | { {1, 2, 7, 1, 7, 3}, 6, ASN_GAUGE, { .integer = 20 } }, /* lldpStatsRxPortAgeoutsTotal.3 */ |
445 | { {1, 2, 7, 1, 7, 4}, 6, ASN_GAUGE, { .integer = 210 } }, /* lldpStatsRxPortAgeoutsTotal.4 */ | |
4e22da4c VB |
446 | |
447 | { {1, 3, 1, 0}, 4, ASN_INTEGER, { .integer = 4 } }, /* lldpLocChassisIdSubtype */ | |
448 | /* lldpLocChassisId */ | |
449 | { {1, 3, 2, 0}, 4, ASN_OCTET_STR, { .string = { .octet = "AAA012", | |
450 | .len = 6 } }}, | |
451 | /* lldpLocSysName */ | |
452 | { {1, 3, 3, 0}, 4, ASN_OCTET_STR, { .string = { .octet = "chassis1.example.com", | |
453 | .len = 20 } }}, | |
454 | /* lldpLocSysDesc */ | |
455 | { {1, 3, 4, 0}, 4, ASN_OCTET_STR, { .string = { .octet = "First chassis", | |
456 | .len = 13 } }}, | |
457 | /* lldpLocSysCapSupported */ | |
458 | { {1, 3, 5, 0}, 4, ASN_OCTET_STR, { .string = { .octet = "\x38", | |
459 | .len = 1 } }}, | |
460 | /* lldpLocSysCapEnabled */ | |
461 | { {1, 3, 6, 0}, 4, ASN_OCTET_STR, { .string = { .octet = "\x8", | |
462 | .len = 1 } }}, | |
463 | ||
464 | { {1, 3, 7, 1, 2, 3}, 6, ASN_INTEGER, { .integer = 3 } }, /* lldpLocPortIdSubtype.3 */ | |
465 | { {1, 3, 7, 1, 2, 4}, 6, ASN_INTEGER, { .integer = 5 } }, /* lldpLocPortIdSubtype.5 */ | |
466 | /* lldpLocPortId.3 */ | |
467 | { {1, 3, 7, 1, 3, 3}, 6, ASN_OCTET_STR, { .string = { .octet = "AAA012", | |
468 | .len = 6 } }}, | |
469 | /* lldpLocPortId.4 */ | |
470 | { {1, 3, 7, 1, 3, 4}, 6, ASN_OCTET_STR, { .string = { .octet = "eth4", | |
471 | .len = 4 } }}, | |
472 | /* lldpLocPortDesc.3 */ | |
473 | { {1, 3, 7, 1, 4, 3}, 6, ASN_OCTET_STR, { .string = { .octet = "eth2", | |
474 | .len = 4 } }}, | |
475 | /* lldpLocPortDesc.4 */ | |
476 | { {1, 3, 7, 1, 4, 4}, 6, ASN_OCTET_STR, { .string = { .octet = "Intel 1000 GE", | |
477 | .len = 13 } }}, | |
478 | ||
479 | { {1, 3, 8, 1, 3, 1, 4, 192, 0, 2, 15}, 11, ASN_INTEGER, { .integer = 5 } }, /* lldpLocManAddrLen */ | |
480 | { {1, 3, 8, 1, 4, 1, 4, 192, 0, 2, 15}, 11, ASN_INTEGER, { .integer = 2 } }, /* lldpLocManAddrIfSubtype */ | |
481 | { {1, 3, 8, 1, 5, 1, 4, 192, 0, 2, 15}, 11, ASN_INTEGER, { .integer = 3 } }, /* lldpLocManAddrIfId */ | |
482 | /* lldpLocManAddrOID */ | |
483 | { {1, 3, 8, 1, 6, 1, 4, 192, 0, 2, 15}, 11, ASN_OBJECT_ID, | |
484 | { .string = { .octet = (char *)zeroDotZero, | |
485 | .len = sizeof(zeroDotZero) }} }, | |
486 | ||
487 | /* lldpRemChassisIdSubtype */ | |
488 | { {1, 4, 1, 1, 4, 0, 3, 1 }, 8, ASN_INTEGER, { .integer = 4 } }, | |
489 | { {1, 4, 1, 1, 4, 8000, 3, 4}, 8, ASN_INTEGER, { .integer = 7 } }, | |
490 | { {1, 4, 1, 1, 4, 10000, 4, 1}, 8, ASN_INTEGER, { .integer = 4 } }, | |
491 | /* lldpRemChassisId */ | |
492 | { {1, 4, 1, 1, 5, 0, 3, 1 }, 8, ASN_OCTET_STR, { .string = { .octet = "AAA012", .len = 6 }} }, | |
493 | { {1, 4, 1, 1, 5, 8000, 3, 4}, 8, ASN_OCTET_STR, { .string = | |
494 | { .octet = "chassis2", | |
495 | .len = 6 }} }, | |
496 | { {1, 4, 1, 1, 5, 10000, 4, 1}, 8, ASN_OCTET_STR, { .string = { .octet = "AAA012", .len = 6 }} }, | |
497 | /* lldpRemPortIdSubtype */ | |
498 | { {1, 4, 1, 1, 6, 0, 3, 1 }, 8, ASN_INTEGER, { .integer = 5 } }, | |
499 | { {1, 4, 1, 1, 6, 8000, 3, 4}, 8, ASN_INTEGER, { .integer = 1 } }, | |
500 | { {1, 4, 1, 1, 6, 10000, 4, 1}, 8, ASN_INTEGER, { .integer = 3 } }, | |
501 | /* lldpRemPortId */ | |
502 | { {1, 4, 1, 1, 7, 0, 3, 1 }, 8, ASN_OCTET_STR, { .string = { .octet = "eth4", .len = 4 }} }, | |
503 | { {1, 4, 1, 1, 7, 8000, 3, 4}, 8, ASN_OCTET_STR, { .string = | |
504 | { .octet = "Giga1/7", .len = 7 }} }, | |
505 | { {1, 4, 1, 1, 7, 10000, 4, 1}, 8, ASN_OCTET_STR, { .string = { .octet = "AAA012", .len = 6 }} }, | |
506 | /* lldpRemPortDesc */ | |
507 | { {1, 4, 1, 1, 8, 0, 3, 1 }, 8, ASN_OCTET_STR, | |
508 | { .string = { .octet = "Intel 1000 GE", .len = 13 }} }, | |
509 | { {1, 4, 1, 1, 8, 8000, 3, 4}, 8, ASN_OCTET_STR, | |
510 | { .string = { .octet = "Gigabit Ethernet 1/7", .len = 20 }} }, | |
511 | { {1, 4, 1, 1, 8, 10000, 4, 1}, 8, ASN_OCTET_STR, | |
512 | { .string = { .octet = "eth2", .len = 4 }} }, | |
513 | /* lldpRemSysName */ | |
514 | { {1, 4, 1, 1, 9, 0, 3, 1 }, 8, ASN_OCTET_STR, | |
515 | { .string = { .octet = "chassis1.example.com", .len = 20 }} }, | |
516 | { {1, 4, 1, 1, 9, 8000, 3, 4}, 8, ASN_OCTET_STR, | |
517 | { .string = { .octet = "chassis2.example.com", .len = 20 }} }, | |
518 | { {1, 4, 1, 1, 9, 10000, 4, 1}, 8, ASN_OCTET_STR, | |
519 | { .string = { .octet = "chassis1.example.com", .len = 20 }} }, | |
520 | /* lldpRemSysDesc */ | |
521 | { {1, 4, 1, 1, 10, 0, 3, 1 }, 8, ASN_OCTET_STR, | |
522 | { .string = { .octet = "First chassis", .len = 13 }} }, | |
523 | { {1, 4, 1, 1, 10, 8000, 3, 4}, 8, ASN_OCTET_STR, | |
524 | { .string = { .octet = "Second chassis", .len = 14 }} }, | |
525 | { {1, 4, 1, 1, 10, 10000, 4, 1}, 8, ASN_OCTET_STR, | |
526 | { .string = { .octet = "First chassis", .len = 13 }} }, | |
527 | /* lldpRemSysCapSupported */ | |
528 | { {1, 4, 1, 1, 11, 0, 3, 1 }, 8, ASN_OCTET_STR, | |
529 | { .string = { .octet = "\x38", .len = 1 }} }, | |
530 | { {1, 4, 1, 1, 11, 8000, 3, 4}, 8, ASN_OCTET_STR, | |
531 | { .string = { .octet = "\x8", .len = 1 }} }, | |
532 | { {1, 4, 1, 1, 11, 10000, 4, 1}, 8, ASN_OCTET_STR, | |
533 | { .string = { .octet = "\x38", .len = 1 }} }, | |
534 | /* lldpRemSysCapEnabled */ | |
535 | { {1, 4, 1, 1, 12, 0, 3, 1 }, 8, ASN_OCTET_STR, | |
536 | { .string = { .octet = "\x8", .len = 1 }} }, | |
537 | { {1, 4, 1, 1, 12, 8000, 3, 4}, 8, ASN_OCTET_STR, | |
538 | { .string = { .octet = "\x8", .len = 1 }} }, | |
539 | { {1, 4, 1, 1, 12, 10000, 4, 1}, 8, ASN_OCTET_STR, | |
540 | { .string = { .octet = "\x8", .len = 1 }} }, | |
541 | ||
542 | /* lldpRemManAddrIfSubtype */ | |
543 | { {1, 4, 2, 1, 3, 0, 3, 1, 1, 4, 192, 0, 2, 15 }, 14, ASN_INTEGER, { .integer = 2 } }, | |
544 | { {1, 4, 2, 1, 3, 8000, 3, 4, 1, 4, 192, 0, 2, 17 }, 14, ASN_INTEGER, { .integer = 2 } }, | |
af3caa3b VB |
545 | { {1, 4, 2, 1, 3, 8000, 3, 4, 2, 16, |
546 | 0x20, 0x01, 0x0d, 0xb8, 0xca, 0xfe, 0x00, 0x00, | |
547 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17 }, 26, ASN_INTEGER, { .integer = 2 } }, | |
4e22da4c VB |
548 | { {1, 4, 2, 1, 3, 10000, 4, 1, 1, 4, 192, 0, 2, 15 }, 14, ASN_INTEGER, { .integer = 2 } }, |
549 | /* lldpRemManAddrIfId */ | |
550 | { {1, 4, 2, 1, 4, 0, 3, 1, 1, 4, 192, 0, 2, 15 }, 14, ASN_INTEGER, { .integer = 3 } }, | |
551 | { {1, 4, 2, 1, 4, 8000, 3, 4, 1, 4, 192, 0, 2, 17 }, 14, ASN_INTEGER, { .integer = 5 } }, | |
af3caa3b VB |
552 | { {1, 4, 2, 1, 4, 8000, 3, 4, 2, 16, |
553 | 0x20, 0x01, 0x0d, 0xb8, 0xca, 0xfe, 0x00, 0x00, | |
554 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17 }, 26, ASN_INTEGER, { .integer = 5 } }, | |
4e22da4c VB |
555 | { {1, 4, 2, 1, 4, 10000, 4, 1, 1, 4, 192, 0, 2, 15 }, 14, ASN_INTEGER, { .integer = 3 } }, |
556 | /* lldpRemManAddrOID */ | |
557 | { {1, 4, 2, 1, 5, 0, 3, 1, 1, 4, 192, 0, 2, 15 }, 14, ASN_OBJECT_ID, | |
558 | { .string = { .octet = (char *)zeroDotZero, | |
559 | .len = sizeof(zeroDotZero) }} }, | |
560 | { {1, 4, 2, 1, 5, 8000, 3, 4, 1, 4, 192, 0, 2, 17 }, 14, ASN_OBJECT_ID, | |
561 | { .string = { .octet = (char *)zeroDotZero, | |
562 | .len = sizeof(zeroDotZero) }} }, | |
af3caa3b VB |
563 | { {1, 4, 2, 1, 5, 8000, 3, 4, 2, 16, |
564 | 0x20, 0x01, 0x0d, 0xb8, 0xca, 0xfe, 0x00, 0x00, | |
565 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17 }, 26, ASN_OBJECT_ID, | |
566 | { .string = { .octet = (char *)zeroDotZero, | |
567 | .len = sizeof(zeroDotZero) }} }, | |
4e22da4c VB |
568 | { {1, 4, 2, 1, 5, 10000, 4, 1, 1, 4, 192, 0, 2, 15 }, 14, ASN_OBJECT_ID, |
569 | { .string = { .octet = (char *)zeroDotZero, | |
570 | .len = sizeof(zeroDotZero) }} }, | |
571 | ||
8ca3da07 VB |
572 | #ifdef ENABLE_CUSTOM |
573 | /* lldpRemOrgDefInfo */ | |
574 | { {1, 4, 4, 1, 4, 0, 3, 1, 33, 44, 55, 44, 1 }, 13, ASN_OCTET_STR, | |
575 | { .string = { .octet = "OUI content", .len = 11 }} }, | |
576 | { {1, 4, 4, 1, 4, 0, 3, 1, 33, 44, 55, 44, 2 }, 13, ASN_OCTET_STR, | |
577 | { .string = { .octet = "More content", .len = 12 }} }, | |
578 | { {1, 4, 4, 1, 4, 0, 3, 1, 33, 44, 55, 45, 3 }, 13, ASN_OCTET_STR, | |
579 | { .string = { .octet = "More more content", .len = 17 }} }, | |
580 | { {1, 4, 4, 1, 4, 0, 3, 1, 33, 44, 56, 44, 4 }, 13, ASN_OCTET_STR, | |
581 | { .string = { .octet = "Even more content", .len = 17 }} }, | |
582 | { {1, 4, 4, 1, 4, 10000, 4, 1, 33, 44, 55, 44, 1 }, 13, ASN_OCTET_STR, | |
583 | { .string = { .octet = "Still more content", .len = 18 }} }, | |
584 | #endif | |
585 | ||
4e22da4c VB |
586 | #ifdef ENABLE_DOT3 |
587 | /* lldpXdot3LocPortAutoNegSupported */ | |
588 | { {1, 5, 4623, 1, 2, 1, 1, 1, 3 }, 9, ASN_INTEGER, { .integer = 1 }}, | |
589 | { {1, 5, 4623, 1, 2, 1, 1, 1, 4 }, 9, ASN_INTEGER, { .integer = 1 }}, | |
590 | /* lldpXdot3LocPortAutoNegEnabled */ | |
591 | { {1, 5, 4623, 1, 2, 1, 1, 2, 3 }, 9, ASN_INTEGER, { .integer = 1 }}, | |
592 | { {1, 5, 4623, 1, 2, 1, 1, 2, 4 }, 9, ASN_INTEGER, { .integer = 1 }}, | |
593 | /* lldpXdot3LocPortAutoNegAdvertisedCap */ | |
594 | { {1, 5, 4623, 1, 2, 1, 1, 3, 3 }, 9, ASN_OCTET_STR, | |
595 | { .string = { .octet = "\x0c\x00", .len = 2 }} }, | |
596 | { {1, 5, 4623, 1, 2, 1, 1, 3, 4 }, 9, ASN_OCTET_STR, | |
597 | { .string = { .octet = "\x04\x01", .len = 2 }} }, | |
598 | /* lldpXdot3LocPortOperMauType */ | |
599 | { {1, 5, 4623, 1, 2, 1, 1, 4, 3 }, 9, ASN_INTEGER, { .integer = 16 }}, | |
600 | { {1, 5, 4623, 1, 2, 1, 1, 4, 4 }, 9, ASN_INTEGER, { .integer = 30 }}, | |
601 | ||
602 | /* lldpXdot3LocPowerPortClass */ | |
603 | { {1, 5, 4623, 1, 2, 2, 1, 1, 3 }, 9, ASN_INTEGER, { .integer = 2 }}, | |
604 | /* lldpXdot3LocPowerMDISupported */ | |
605 | { {1, 5, 4623, 1, 2, 2, 1, 2, 3 }, 9, ASN_INTEGER, { .integer = 1 }}, | |
606 | /* lldpXdot3LocPowerMDIEnabled */ | |
607 | { {1, 5, 4623, 1, 2, 2, 1, 3, 3 }, 9, ASN_INTEGER, { .integer = 1 }}, | |
608 | /* lldpXdot3LocPowerPairControlable */ | |
609 | { {1, 5, 4623, 1, 2, 2, 1, 4, 3 }, 9, ASN_INTEGER, { .integer = 1 }}, | |
610 | /* lldpXdot3LocPowerPairs */ | |
611 | { {1, 5, 4623, 1, 2, 2, 1, 5, 3 }, 9, ASN_INTEGER, { .integer = 2 }}, | |
612 | /* lldpXdot3LocPowerClass */ | |
613 | { {1, 5, 4623, 1, 2, 2, 1, 6, 3 }, 9, ASN_INTEGER, { .integer = 3 }}, | |
614 | /* As per 802.3at-2009, not sure of the OID... */ | |
615 | /* lldpXdot3LocPowerType */ | |
616 | { {1, 5, 4623, 1, 2, 2, 1, 7, 3 }, 9, ASN_OCTET_STR, | |
617 | { .string = { .octet = "\xC0", .len = 1 } }}, | |
618 | /* lldpXdot3LocPowerSource */ | |
619 | { {1, 5, 4623, 1, 2, 2, 1, 8, 3 }, 9, ASN_OCTET_STR, | |
620 | { .string = { .octet = "\xC0", .len = 1 } }}, | |
621 | /* lldpXdot3LocPowerPriority */ | |
622 | { {1, 5, 4623, 1, 2, 2, 1, 9, 3 }, 9, ASN_INTEGER, { .integer = 1 }}, | |
623 | /* lldpXdot3LocPDRequestedPowerValue */ | |
624 | { {1, 5, 4623, 1, 2, 2, 1, 10, 3 }, 9, ASN_INTEGER, { .integer = 2000 }}, | |
625 | /* lldpXdot3LocPSEAllocatedPowerValue */ | |
626 | { {1, 5, 4623, 1, 2, 2, 1, 11, 3 }, 9, ASN_INTEGER, { .integer = 2500 }}, | |
627 | ||
628 | /* lldpXdot3LocLinkAggStatus */ | |
629 | { {1, 5, 4623, 1, 2, 3, 1, 1, 3 }, 9, ASN_OCTET_STR, | |
630 | { .string = { .octet = "\x00", .len = 1 }} }, | |
631 | { {1, 5, 4623, 1, 2, 3, 1, 1, 4 }, 9, ASN_OCTET_STR, | |
632 | { .string = { .octet = "\xC0", .len = 1 }} }, | |
633 | /* lldpXdot3LocLinkAggPortId */ | |
634 | { {1, 5, 4623, 1, 2, 3, 1, 2, 3 }, 9, ASN_INTEGER, { .integer = 0 }}, | |
635 | { {1, 5, 4623, 1, 2, 3, 1, 2, 4 }, 9, ASN_INTEGER, { .integer = 3 }}, | |
636 | ||
637 | /* lldpXdot3LocMaxFrameSize */ | |
638 | { {1, 5, 4623, 1, 2, 4, 1, 1, 3 }, 9, ASN_INTEGER, { .integer = 1600 }}, | |
639 | { {1, 5, 4623, 1, 2, 4, 1, 1, 4 }, 9, ASN_INTEGER, { .integer = 9000 }}, | |
640 | ||
641 | /* lldpXdot3RemPortAutoNegSupported */ | |
642 | { {1, 5, 4623, 1, 3, 1, 1, 1, 0, 3, 1 }, 11, ASN_INTEGER, { .integer = 1 }}, | |
643 | { {1, 5, 4623, 1, 3, 1, 1, 1, 8000, 3, 4 }, 11, ASN_INTEGER, { .integer = 2 }}, | |
644 | { {1, 5, 4623, 1, 3, 1, 1, 1, 10000, 4, 1 }, 11, ASN_INTEGER, { .integer = 1 }}, | |
645 | /* lldpXdot3RemPortAutoNegEnabled */ | |
646 | { {1, 5, 4623, 1, 3, 1, 1, 2, 0, 3, 1 }, 11, ASN_INTEGER, { .integer = 1 }}, | |
647 | { {1, 5, 4623, 1, 3, 1, 1, 2, 8000, 3, 4 }, 11, ASN_INTEGER, { .integer = 2 }}, | |
648 | { {1, 5, 4623, 1, 3, 1, 1, 2, 10000, 4, 1 }, 11, ASN_INTEGER, { .integer = 1 }}, | |
649 | /* lldpXdot3RemPortAutoNegAdvertisedCap */ | |
650 | { {1, 5, 4623, 1, 3, 1, 1, 3, 0, 3, 1 }, 11, ASN_OCTET_STR, | |
651 | { .string = { .octet = "\x04\x01", .len = 2 }} }, | |
652 | { {1, 5, 4623, 1, 3, 1, 1, 3, 8000, 3, 4 }, 11, ASN_OCTET_STR, | |
653 | { .string = { .octet = "\x00\x00", .len = 2 }} }, | |
654 | { {1, 5, 4623, 1, 3, 1, 1, 3, 10000, 4, 1 }, 11, ASN_OCTET_STR, | |
655 | { .string = { .octet = "\x0c\x00", .len = 2 }} }, | |
656 | /* lldpXdot3RemPortOperMauType */ | |
657 | { {1, 5, 4623, 1, 3, 1, 1, 4, 0, 3, 1 }, 11, ASN_INTEGER, { .integer = 30 }}, | |
658 | { {1, 5, 4623, 1, 3, 1, 1, 4, 8000, 3, 4 }, 11, ASN_INTEGER, { .integer = 0 }}, | |
659 | { {1, 5, 4623, 1, 3, 1, 1, 4, 10000, 4, 1 }, 11, ASN_INTEGER, { .integer = 16 }}, | |
660 | ||
661 | /* lldpXdot3RemPowerPortClass */ | |
662 | { {1, 5, 4623, 1, 3, 2, 1, 1, 10000, 4, 1 }, 11, ASN_INTEGER, { .integer = 2 }}, | |
663 | /* lldpXdot3RemPowerMDISupported */ | |
664 | { {1, 5, 4623, 1, 3, 2, 1, 2, 10000, 4, 1 }, 11, ASN_INTEGER, { .integer = 1 }}, | |
665 | /* lldpXdot3RemPowerMDIEnabled */ | |
666 | { {1, 5, 4623, 1, 3, 2, 1, 3, 10000, 4, 1 }, 11, ASN_INTEGER, { .integer = 1 }}, | |
667 | /* lldpXdot3RemPowerPairControlable */ | |
668 | { {1, 5, 4623, 1, 3, 2, 1, 4, 10000, 4, 1 }, 11, ASN_INTEGER, { .integer = 1 }}, | |
669 | /* lldpXdot3RemPowerPairs */ | |
670 | { {1, 5, 4623, 1, 3, 2, 1, 5, 10000, 4, 1 }, 11, ASN_INTEGER, { .integer = 2 }}, | |
671 | /* lldpXdot3RemPowerClass */ | |
672 | { {1, 5, 4623, 1, 3, 2, 1, 6, 10000, 4, 1 }, 11, ASN_INTEGER, { .integer = 3 }}, | |
673 | /* As per 802.3at-2009, not sure of the OID... */ | |
674 | /* lldpXdot3RemPowerType */ | |
675 | { {1, 5, 4623, 1, 3, 2, 1, 7, 10000, 4, 1 }, 11, ASN_OCTET_STR, | |
676 | { .string = { .octet = "\xC0", .len = 1 } }}, | |
677 | /* lldpXdot3RemPowerSource */ | |
678 | { {1, 5, 4623, 1, 3, 2, 1, 8, 10000, 4, 1 }, 11, ASN_OCTET_STR, | |
679 | { .string = { .octet = "\xC0", .len = 1 } }}, | |
680 | /* lldpXdot3RemPowerPriority */ | |
681 | { {1, 5, 4623, 1, 3, 2, 1, 9, 10000, 4, 1 }, 11, ASN_INTEGER, { .integer = 1 }}, | |
682 | /* lldpXdot3RemPDRequestedPowerValue */ | |
683 | { {1, 5, 4623, 1, 3, 2, 1, 10, 10000, 4, 1 }, 11, ASN_INTEGER, { .integer = 2000 }}, | |
684 | /* lldpXdot3RemPSEAllocatedPowerValue */ | |
685 | { {1, 5, 4623, 1, 3, 2, 1, 11, 10000, 4, 1 }, 11, ASN_INTEGER, { .integer = 2500 }}, | |
686 | ||
687 | /* lldpXdot3RemLinkAggStatus */ | |
688 | { {1, 5, 4623, 1, 3, 3, 1, 1, 0, 3, 1 }, 11, ASN_OCTET_STR, | |
689 | { .string = { .octet = "\xC0", .len = 1 }} }, | |
690 | { {1, 5, 4623, 1, 3, 3, 1, 1, 8000, 3, 4 }, 11, ASN_OCTET_STR, | |
691 | { .string = { .octet = "\x00", .len = 1 }} }, | |
692 | { {1, 5, 4623, 1, 3, 3, 1, 1, 10000, 4, 1 }, 11, ASN_OCTET_STR, | |
693 | { .string = { .octet = "\x00", .len = 1 }} }, | |
694 | /* lldpXdot3RemLinkAggPortId */ | |
695 | { {1, 5, 4623, 1, 3, 3, 1, 2, 0, 3, 1 }, 11, ASN_INTEGER, { .integer = 3 }}, | |
696 | { {1, 5, 4623, 1, 3, 3, 1, 2, 8000, 3, 4 }, 11, ASN_INTEGER, { .integer = 0 }}, | |
697 | { {1, 5, 4623, 1, 3, 3, 1, 2, 10000, 4, 1 }, 11, ASN_INTEGER, { .integer = 0 }}, | |
698 | ||
699 | /* lldpXdot3RemMaxFrameSize */ | |
700 | { {1, 5, 4623, 1, 3, 4, 1, 1, 0, 3, 1 }, 11, ASN_INTEGER, { .integer = 9000 }}, | |
701 | { {1, 5, 4623, 1, 3, 4, 1, 1, 10000, 4, 1 }, 11, ASN_INTEGER, { .integer = 1600 }}, | |
702 | #endif | |
703 | #ifdef ENABLE_LLDPMED | |
704 | /* lldpXMedLocDeviceClass */ | |
705 | { {1, 5, 4795, 1, 1, 1, 0 }, 7, ASN_INTEGER, { .integer = 2 }}, | |
706 | ||
707 | /* lldpXMedLocMediaPolicyVlanID */ | |
708 | { {1, 5, 4795, 1, 2, 1, 1, 2, 3, 3 }, 10, ASN_INTEGER, { .integer = 475 }}, | |
709 | { {1, 5, 4795, 1, 2, 1, 1, 2, 3, 7 }, 10, ASN_INTEGER, { .integer = 472 }}, | |
710 | { {1, 5, 4795, 1, 2, 1, 1, 2, 4, 3 }, 10, ASN_INTEGER, { .integer = 475 }}, | |
711 | { {1, 5, 4795, 1, 2, 1, 1, 2, 4, 6 }, 10, ASN_INTEGER, { .integer = 1007 }}, | |
712 | /* lldpXMedLocMediaPolicyPriority */ | |
713 | { {1, 5, 4795, 1, 2, 1, 1, 3, 3, 3 }, 10, ASN_INTEGER, { .integer = 3 }}, | |
714 | { {1, 5, 4795, 1, 2, 1, 1, 3, 3, 7 }, 10, ASN_INTEGER, { .integer = 1 }}, | |
715 | { {1, 5, 4795, 1, 2, 1, 1, 3, 4, 3 }, 10, ASN_INTEGER, { .integer = 3 }}, | |
716 | { {1, 5, 4795, 1, 2, 1, 1, 3, 4, 6 }, 10, ASN_INTEGER, { .integer = 1 }}, | |
717 | /* lldpXMedLocMediaPolicyDscp */ | |
718 | { {1, 5, 4795, 1, 2, 1, 1, 4, 3, 3 }, 10, ASN_INTEGER, { .integer = 62 }}, | |
719 | { {1, 5, 4795, 1, 2, 1, 1, 4, 3, 7 }, 10, ASN_INTEGER, { .integer = 60 }}, | |
720 | { {1, 5, 4795, 1, 2, 1, 1, 4, 4, 3 }, 10, ASN_INTEGER, { .integer = 62 }}, | |
721 | { {1, 5, 4795, 1, 2, 1, 1, 4, 4, 6 }, 10, ASN_INTEGER, { .integer = 49 }}, | |
722 | /* lldpXMedLocMediaPolicyUnknown */ | |
723 | { {1, 5, 4795, 1, 2, 1, 1, 5, 3, 3 }, 10, ASN_INTEGER, { .integer = 1 }}, | |
724 | { {1, 5, 4795, 1, 2, 1, 1, 5, 3, 7 }, 10, ASN_INTEGER, { .integer = 2 }}, | |
725 | { {1, 5, 4795, 1, 2, 1, 1, 5, 4, 3 }, 10, ASN_INTEGER, { .integer = 1 }}, | |
726 | { {1, 5, 4795, 1, 2, 1, 1, 5, 4, 6 }, 10, ASN_INTEGER, { .integer = 2 }}, | |
727 | /* lldpXMedLocMediaPolicyTagged */ | |
728 | { {1, 5, 4795, 1, 2, 1, 1, 6, 3, 3 }, 10, ASN_INTEGER, { .integer = 1 }}, | |
729 | { {1, 5, 4795, 1, 2, 1, 1, 6, 3, 7 }, 10, ASN_INTEGER, { .integer = 1 }}, | |
730 | { {1, 5, 4795, 1, 2, 1, 1, 6, 4, 3 }, 10, ASN_INTEGER, { .integer = 1 }}, | |
731 | { {1, 5, 4795, 1, 2, 1, 1, 6, 4, 6 }, 10, ASN_INTEGER, { .integer = 2 }}, | |
732 | ||
733 | /* lldpXMedLocHardwareRev */ | |
734 | { {1, 5, 4795, 1, 2, 2, 0 }, 7, ASN_OCTET_STR, | |
735 | { .string = { .octet = "Hardware 1", .len = 10 }} }, | |
736 | /* lldpXMedLocSoftwareRev */ | |
737 | { {1, 5, 4795, 1, 2, 4, 0 }, 7, ASN_OCTET_STR, | |
738 | { .string = { .octet = "Software 1", .len = 10 }} }, | |
739 | /* lldpXMedLocSerialNum */ | |
740 | { {1, 5, 4795, 1, 2, 5, 0 }, 7, ASN_OCTET_STR, | |
741 | { .string = { .octet = "00-00-0000-AAAA", .len = 15 }} }, | |
742 | /* lldpXMedLocMfgName */ | |
743 | { {1, 5, 4795, 1, 2, 6, 0 }, 7, ASN_OCTET_STR, | |
744 | { .string = { .octet = "Manufacturer 1", .len = 14 }} }, | |
745 | /* lldpXMedLocModelName */ | |
746 | { {1, 5, 4795, 1, 2, 7, 0 }, 7, ASN_OCTET_STR, | |
747 | { .string = { .octet = "Model 1", .len = 7 }} }, | |
748 | /* lldpXMedLocAssetID */ | |
749 | { {1, 5, 4795, 1, 2, 8, 0 }, 7, ASN_OCTET_STR, | |
750 | { .string = { .octet = "Asset 1", .len = 7 }} }, | |
751 | ||
752 | /* lldpXMedLocLocationInfo */ | |
753 | { {1, 5, 4795, 1, 2, 9, 1, 2, 3, 3}, 10, ASN_OCTET_STR, | |
2d05a444 | 754 | { .string = { .octet = "\x15" "\x02" "FR" "\x06" "\x0d" "Commercial Rd" "\x13" "\x01" "4", .len = 22 }} }, |
4e22da4c VB |
755 | { {1, 5, 4795, 1, 2, 9, 1, 2, 4, 2}, 10, ASN_OCTET_STR, |
756 | { .string = { .octet = "Not interpreted", .len = 15 }} }, | |
757 | ||
758 | /* lldpXMedLocXPoEDeviceType */ | |
759 | { {1, 5, 4795, 1, 2, 10, 0 }, 7, ASN_INTEGER, { .integer = 3 }}, | |
760 | /* lldpXMedLocXPoEPDPowerReq */ | |
761 | { {1, 5, 4795, 1, 2, 13, 0 }, 7, ASN_GAUGE, { .integer = 100 }}, | |
762 | /* lldpXMedLocXPoEPDPowerSource */ | |
763 | { {1, 5, 4795, 1, 2, 14, 0 }, 7, ASN_INTEGER, { .integer = 3 }}, | |
764 | /* lldpXMedLocXPoEPDPowerPriority */ | |
765 | { {1, 5, 4795, 1, 2, 15, 0 }, 7, ASN_INTEGER, { .integer = 3 }}, | |
766 | ||
767 | /* lldpXMedRemCapSupported */ | |
768 | { {1, 5, 4795, 1, 3, 1, 1, 1, 0, 3, 1 }, 11, ASN_OCTET_STR, | |
769 | { .string = { .octet = "\xFC", .len = 1 }} }, | |
770 | { {1, 5, 4795, 1, 3, 1, 1, 1, 10000, 4, 1 }, 11, ASN_OCTET_STR, | |
771 | { .string = { .octet = "\xFC", .len = 1 }}}, | |
772 | /* lldpXMedRemCapCurrent */ | |
773 | { {1, 5, 4795, 1, 3, 1, 1, 2, 0, 3, 1 }, 11, ASN_OCTET_STR, | |
774 | { .string = { .octet = "\xFC", .len = 1 }} }, | |
775 | { {1, 5, 4795, 1, 3, 1, 1, 2, 10000, 4, 1 }, 11, ASN_OCTET_STR, | |
776 | { .string = { .octet = "\xEC", .len = 1 }}}, | |
777 | /* lldpXMedRemDeviceClass */ | |
778 | { {1, 5, 4795, 1, 3, 1, 1, 3, 0, 3, 1 }, 11, ASN_INTEGER, { .integer = 2 }}, | |
779 | { {1, 5, 4795, 1, 3, 1, 1, 3, 10000, 4, 1 }, 11, ASN_INTEGER, { .integer = 2 }}, | |
780 | ||
781 | /* lldpXMedRemMediaPolicyVlanID */ | |
782 | { {1, 5, 4795, 1, 3, 2, 1, 2, 0, 3, 1, 3 }, 12, ASN_INTEGER, { .integer = 475 }}, | |
783 | { {1, 5, 4795, 1, 3, 2, 1, 2, 0, 3, 1, 6 }, 12, ASN_INTEGER, { .integer = 1007 }}, | |
784 | { {1, 5, 4795, 1, 3, 2, 1, 2, 10000, 4, 1, 3 }, 12, ASN_INTEGER, { .integer = 475 }}, | |
785 | { {1, 5, 4795, 1, 3, 2, 1, 2, 10000, 4, 1, 7 }, 12, ASN_INTEGER, { .integer = 472 }}, | |
786 | /* lldpXMedRemMediaPolicyPriority */ | |
787 | { {1, 5, 4795, 1, 3, 2, 1, 3, 0, 3, 1, 3 }, 12, ASN_INTEGER, { .integer = 3 }}, | |
788 | { {1, 5, 4795, 1, 3, 2, 1, 3, 0, 3, 1, 6 }, 12, ASN_INTEGER, { .integer = 1 }}, | |
789 | { {1, 5, 4795, 1, 3, 2, 1, 3, 10000, 4, 1, 3 }, 12, ASN_INTEGER, { .integer = 3 }}, | |
790 | { {1, 5, 4795, 1, 3, 2, 1, 3, 10000, 4, 1, 7 }, 12, ASN_INTEGER, { .integer = 1 }}, | |
791 | /* lldpXMedLocMediaPolicyDscp */ | |
792 | { {1, 5, 4795, 1, 3, 2, 1, 4, 0, 3, 1, 3 }, 12, ASN_INTEGER, { .integer = 62 }}, | |
793 | { {1, 5, 4795, 1, 3, 2, 1, 4, 0, 3, 1, 6 }, 12, ASN_INTEGER, { .integer = 49 }}, | |
794 | { {1, 5, 4795, 1, 3, 2, 1, 4, 10000, 4, 1, 3 }, 12, ASN_INTEGER, { .integer = 62 }}, | |
795 | { {1, 5, 4795, 1, 3, 2, 1, 4, 10000, 4, 1, 7 }, 12, ASN_INTEGER, { .integer = 60 }}, | |
796 | /* lldpXMedLocMediaPolicyUnknown */ | |
797 | { {1, 5, 4795, 1, 3, 2, 1, 5, 0, 3, 1, 3 }, 12, ASN_INTEGER, { .integer = 1 }}, | |
798 | { {1, 5, 4795, 1, 3, 2, 1, 5, 0, 3, 1, 6 }, 12, ASN_INTEGER, { .integer = 2 }}, | |
799 | { {1, 5, 4795, 1, 3, 2, 1, 5, 10000, 4, 1, 3 }, 12, ASN_INTEGER, { .integer = 1 }}, | |
800 | { {1, 5, 4795, 1, 3, 2, 1, 5, 10000, 4, 1, 7 }, 12, ASN_INTEGER, { .integer = 2 }}, | |
801 | /* lldpXMedLocMediaPolicyTagged */ | |
802 | { {1, 5, 4795, 1, 3, 2, 1, 6, 0, 3, 1, 3 }, 12, ASN_INTEGER, { .integer = 1 }}, | |
803 | { {1, 5, 4795, 1, 3, 2, 1, 6, 0, 3, 1, 6 }, 12, ASN_INTEGER, { .integer = 2 }}, | |
804 | { {1, 5, 4795, 1, 3, 2, 1, 6, 10000, 4, 1, 3 }, 12, ASN_INTEGER, { .integer = 1 }}, | |
805 | { {1, 5, 4795, 1, 3, 2, 1, 6, 10000, 4, 1, 7 }, 12, ASN_INTEGER, { .integer = 1 }}, | |
806 | ||
807 | /* lldpXMedRemHardwareRev */ | |
808 | { {1, 5, 4795, 1, 3, 3, 1, 1, 0, 3, 1 }, 11, ASN_OCTET_STR, | |
809 | { .string = { .octet = "Hardware 1", .len = 10 }} }, | |
810 | { {1, 5, 4795, 1, 3, 3, 1, 1, 10000, 4, 1 }, 11, ASN_OCTET_STR, | |
811 | { .string = { .octet = "Hardware 1", .len = 10 }} }, | |
812 | /* lldpXMedRemSoftwareRev */ | |
813 | { {1, 5, 4795, 1, 3, 3, 1, 3, 0, 3, 1 }, 11, ASN_OCTET_STR, | |
814 | { .string = { .octet = "Software 1", .len = 10 }} }, | |
815 | { {1, 5, 4795, 1, 3, 3, 1, 3, 10000, 4, 1 }, 11, ASN_OCTET_STR, | |
816 | { .string = { .octet = "Software 1", .len = 10 }} }, | |
817 | /* lldpXMedRemSerialNum */ | |
818 | { {1, 5, 4795, 1, 3, 3, 1, 4, 0, 3, 1 }, 11, ASN_OCTET_STR, | |
819 | { .string = { .octet = "00-00-0000-AAAA", .len = 15 }} }, | |
820 | { {1, 5, 4795, 1, 3, 3, 1, 4, 10000, 4, 1 }, 11, ASN_OCTET_STR, | |
821 | { .string = { .octet = "00-00-0000-AAAA", .len = 15 }} }, | |
822 | /* lldpXMedRemMfgName */ | |
823 | { {1, 5, 4795, 1, 3, 3, 1, 5, 0, 3, 1 }, 11, ASN_OCTET_STR, | |
824 | { .string = { .octet = "Manufacturer 1", .len = 14 }} }, | |
825 | { {1, 5, 4795, 1, 3, 3, 1, 5, 10000, 4, 1 }, 11, ASN_OCTET_STR, | |
826 | { .string = { .octet = "Manufacturer 1", .len = 14 }} }, | |
827 | /* lldpXMedRemModelName */ | |
828 | { {1, 5, 4795, 1, 3, 3, 1, 6, 0, 3, 1 }, 11, ASN_OCTET_STR, | |
829 | { .string = { .octet = "Model 1", .len = 7 }} }, | |
830 | { {1, 5, 4795, 1, 3, 3, 1, 6, 10000, 4, 1 }, 11, ASN_OCTET_STR, | |
831 | { .string = { .octet = "Model 1", .len = 7 }} }, | |
832 | /* lldpXMedRemAssetID */ | |
833 | { {1, 5, 4795, 1, 3, 3, 1, 7, 0, 3, 1 }, 11, ASN_OCTET_STR, | |
834 | { .string = { .octet = "Asset 1", .len = 7 }} }, | |
835 | { {1, 5, 4795, 1, 3, 3, 1, 7, 10000, 4, 1 }, 11, ASN_OCTET_STR, | |
836 | { .string = { .octet = "Asset 1", .len = 7 }} }, | |
837 | ||
838 | /* lldpXMedLocLocationInfo */ | |
839 | { {1, 5, 4795, 1, 3, 4, 1, 2, 0, 3, 1, 2}, 12, ASN_OCTET_STR, | |
840 | { .string = { .octet = "Not interpreted", .len = 15 }} }, | |
841 | { {1, 5, 4795, 1, 3, 4, 1, 2, 10000, 4, 1, 3}, 12, ASN_OCTET_STR, | |
2d05a444 | 842 | { .string = { .octet = "\x15" "\x02" "FR" "\x06" "\x0d" "Commercial Rd" "\x13" "\x01" "4", .len = 22 }} }, |
4e22da4c VB |
843 | |
844 | /* lldpXMedRemXPoEDeviceType */ | |
845 | { {1, 5, 4795, 1, 3, 5, 1, 1, 0, 3, 1}, 11, ASN_INTEGER, { .integer = 4 }}, | |
846 | { {1, 5, 4795, 1, 3, 5, 1, 1, 10000, 4, 1}, 11, ASN_INTEGER, { .integer = 3 }}, | |
847 | ||
848 | /* lldpXMedRemXPoEPDPowerReq */ | |
849 | { {1, 5, 4795, 1, 3, 7, 1, 1, 10000, 4, 1}, 11, ASN_GAUGE, { .integer = 100 }}, | |
850 | /* lldpXMedRemXPoEPDPowerSource */ | |
851 | { {1, 5, 4795, 1, 3, 7, 1, 2, 10000, 4, 1}, 11, ASN_INTEGER, { .integer = 3 }}, | |
852 | /* lldpXMedRemXPoEPDPowerPriority */ | |
853 | { {1, 5, 4795, 1, 3, 7, 1, 3, 10000, 4, 1}, 11, ASN_INTEGER, { .integer = 3 }}, | |
854 | ||
855 | #endif | |
856 | #ifdef ENABLE_DOT1 | |
857 | /* lldpXdot1LocPortVlanId */ | |
858 | { { 1, 5, 32962, 1, 2, 1, 1, 1, 3}, 9, ASN_INTEGER, { .integer = 47 }}, | |
859 | { { 1, 5, 32962, 1, 2, 1, 1, 1, 4}, 9, ASN_INTEGER, { .integer = 0 }}, | |
860 | /* lldpXdot1LocProtoVlanSupported */ | |
861 | { { 1, 5, 32962, 1, 2, 2, 1, 2, 3, 47}, 10, ASN_INTEGER, { .integer = 1 }}, | |
862 | { { 1, 5, 32962, 1, 2, 2, 1, 2, 3, 118}, 10, ASN_INTEGER, { .integer = 1 }}, | |
863 | /* lldpXdot1LocProtoVlanEnabled */ | |
864 | { { 1, 5, 32962, 1, 2, 2, 1, 3, 3, 47}, 10, ASN_INTEGER, { .integer = 1 }}, | |
865 | { { 1, 5, 32962, 1, 2, 2, 1, 3, 3, 118}, 10, ASN_INTEGER, { .integer = 1 }}, | |
866 | /* lldpXdot1LocVlanName */ | |
867 | { { 1, 5, 32962, 1, 2, 3, 1, 2, 3, 47}, 10, ASN_OCTET_STR, | |
868 | { .string = { .octet = "VLAN #47", .len = 8 }} }, | |
869 | { { 1, 5, 32962, 1, 2, 3, 1, 2, 3, 49}, 10, ASN_OCTET_STR, | |
870 | { .string = { .octet = "VLAN #49", .len = 8 }} }, | |
871 | { { 1, 5, 32962, 1, 2, 3, 1, 2, 3, 1449}, 10, ASN_OCTET_STR, | |
872 | { .string = { .octet = "VLAN #1449", .len = 10 }} }, | |
873 | /* lldpXdot1LocProtocolId */ | |
c11e6765 VB |
874 | { { 1, 5, 32962, 1, 2, 4, 1, 2, 3, 30321}, 10, ASN_OCTET_STR, |
875 | { .string = { .octet = "\x88\x8e\x01", .len = 3 } }}, | |
876 | { { 1, 5, 32962, 1, 2, 4, 1, 2, 3, 30515}, 10, ASN_OCTET_STR, | |
4e22da4c | 877 | { .string = { .octet = "\x88\xcc", .len = 2 } }}, |
4e22da4c VB |
878 | |
879 | /* lldpXdot1RemPortVlanId */ | |
880 | { { 1, 5, 32962, 1, 3, 1, 1, 1, 0, 3, 1}, 11, ASN_INTEGER, { .integer = 0 }}, | |
881 | { { 1, 5, 32962, 1, 3, 1, 1, 1, 8000, 3, 4}, 11, ASN_INTEGER, { .integer = 0 }}, | |
882 | { { 1, 5, 32962, 1, 3, 1, 1, 1, 10000, 4, 1}, 11, ASN_INTEGER, { .integer = 47 }}, | |
883 | /* lldpXdot1RemProtoVlanSupported */ | |
884 | { { 1, 5, 32962, 1, 3, 2, 1, 2, 10000, 4, 1, 47}, 12, ASN_INTEGER, { .integer = 1 }}, | |
885 | { { 1, 5, 32962, 1, 3, 2, 1, 2, 10000, 4, 1, 118}, 12, ASN_INTEGER, { .integer = 1 }}, | |
886 | /* lldpXdot1RemProtoVlanEnabled */ | |
887 | { { 1, 5, 32962, 1, 3, 2, 1, 3, 10000, 4, 1, 47}, 12, ASN_INTEGER, { .integer = 1 }}, | |
888 | { { 1, 5, 32962, 1, 3, 2, 1, 3, 10000, 4, 1, 118}, 12, ASN_INTEGER, { .integer = 1 }}, | |
889 | /* lldpXdot1RemVlanName */ | |
890 | { { 1, 5, 32962, 1, 3, 3, 1, 2, 10000, 4, 1, 47}, 12, ASN_OCTET_STR, | |
891 | { .string = { .octet = "VLAN #47", .len = 8 }} }, | |
892 | { { 1, 5, 32962, 1, 3, 3, 1, 2, 10000, 4, 1, 49}, 12, ASN_OCTET_STR, | |
893 | { .string = { .octet = "VLAN #49", .len = 8 }} }, | |
894 | { { 1, 5, 32962, 1, 3, 3, 1, 2, 10000, 4, 1, 1449}, 12, ASN_OCTET_STR, | |
895 | { .string = { .octet = "VLAN #1449", .len = 10 }} }, | |
896 | /* lldpXdot1RemProtocolId */ | |
c11e6765 VB |
897 | { { 1, 5, 32962, 1, 3, 4, 1, 2, 10000, 4, 1, 30321}, 12, ASN_OCTET_STR, |
898 | { .string = { .octet = "\x88\x8e\x01", .len = 3 } }}, | |
899 | { { 1, 5, 32962, 1, 3, 4, 1, 2, 10000, 4, 1, 30515}, 12, ASN_OCTET_STR, | |
900 | { .string = { .octet = "\x88\xcc", .len = 2 } }} | |
4e22da4c VB |
901 | #endif |
902 | }; | |
903 | ||
069acc41 VB |
904 | char* |
905 | tohex(char *str, size_t len) | |
906 | { | |
907 | static char *hex[] = { NULL, NULL }; | |
908 | static int which = 0; | |
909 | free(hex[which]); hex[which] = NULL; | |
910 | hex[which] = malloc(len * 3 + 1); | |
911 | fail_unless(hex[which] != NULL, "Not enough memory?"); | |
912 | for (size_t i = 0; i < len; i++) | |
913 | snprintf(hex[which] + 3*i, 4, "%02X ", (unsigned char)str[i]); | |
914 | which = 1 - which; | |
915 | return hex[1 - which]; | |
916 | } | |
917 | ||
4e22da4c VB |
918 | int |
919 | snmp_is_prefix_of(struct variable8 *vp, struct tree_node *n, char *repr) | |
920 | { | |
921 | if (n->namelen < vp->namelen) return 0; | |
922 | if (memcmp(n->name, | |
923 | vp->name, | |
924 | vp->namelen * sizeof(oid))) | |
925 | return 0; | |
926 | fail_unless(n->type == vp->type, "Inappropriate type for OID %s", repr); | |
927 | return 1; | |
928 | } | |
929 | ||
930 | void | |
931 | snmp_merge(struct variable8 *v1, struct tree_node *n, struct variable *vp, | |
932 | oid *target, size_t *targetlen) | |
933 | { | |
934 | vp->magic = v1->magic; | |
935 | vp->type = v1->type; | |
936 | vp->acl = v1->acl; | |
937 | vp->findVar = v1->findVar; | |
d99c2368 | 938 | vp->namelen = v1->namelen + |
4e22da4c VB |
939 | sizeof(lldp_oid)/sizeof(oid); |
940 | memcpy(vp->name, lldp_oid, sizeof(lldp_oid)); | |
941 | memcpy(vp->name + sizeof(lldp_oid)/sizeof(oid), | |
942 | v1->name, | |
943 | v1->namelen*sizeof(oid)); | |
944 | *targetlen = n->namelen + | |
945 | sizeof(lldp_oid)/sizeof(oid); | |
946 | memcpy(target, lldp_oid, sizeof(lldp_oid)); | |
947 | memcpy(target + sizeof(lldp_oid)/sizeof(oid), | |
948 | n->name, | |
949 | n->namelen * sizeof(oid)); | |
950 | } | |
951 | ||
952 | void | |
953 | snmp_compare(struct tree_node *n, | |
954 | u_char *result, size_t varlen, | |
955 | oid *target, size_t targetlen, char *repr) | |
956 | { | |
47cd2807 | 957 | unsigned long int value; |
4e22da4c VB |
958 | fail_unless((targetlen == sizeof(lldp_oid)/sizeof(oid) + n->namelen) && |
959 | !memcmp(target, lldp_oid, sizeof(lldp_oid)) && | |
960 | !memcmp(target + sizeof(lldp_oid)/sizeof(oid), | |
961 | n->name, | |
962 | n->namelen * sizeof(oid)), | |
963 | "Bad OID returned when querying %s: got %s", repr, | |
964 | snmp_oidrepr(target, targetlen)); | |
965 | switch (n->type) { | |
966 | case ASN_INTEGER: | |
967 | case ASN_TIMETICKS: | |
968 | case ASN_GAUGE: | |
969 | case ASN_COUNTER: | |
970 | fail_unless(varlen == sizeof(unsigned long int), | |
971 | "Inappropriate length for integer type for OID %s", | |
972 | repr); | |
47cd2807 VB |
973 | memcpy(&value, result, sizeof(value)); |
974 | fail_unless(n->value.integer == value, | |
4e22da4c VB |
975 | "For OID %s, expected value %u but got %u instead", |
976 | repr, | |
977 | n->value.integer, | |
47cd2807 | 978 | value); |
4e22da4c VB |
979 | break; |
980 | default: | |
981 | fail_unless(((n->value.string.len == varlen) && | |
982 | !memcmp(n->value.string.octet, | |
983 | result, varlen)), | |
984 | "OID %s: wanted %s, got %s", | |
985 | repr, | |
986 | tohex(n->value.string.octet, n->value.string.len), | |
987 | tohex((char *)result, varlen)); | |
988 | } | |
989 | } | |
990 | ||
991 | START_TEST (test_variable_order) | |
992 | { | |
d99c2368 | 993 | size_t i; |
4e22da4c VB |
994 | for (i = 0; i < agent_lldp_vars_size() - 1; i++) { |
995 | fail_unless(snmp_oid_compare(agent_lldp_vars[i].name, | |
996 | agent_lldp_vars[i].namelen, | |
997 | agent_lldp_vars[i+1].name, | |
998 | agent_lldp_vars[i+1].namelen) < 0, | |
999 | "Registered OID are out of orders (see %s and next one)", | |
1000 | snmp_oidrepr(agent_lldp_vars[i].name, | |
1001 | agent_lldp_vars[i].namelen)); | |
1002 | } | |
1003 | } | |
1004 | END_TEST | |
1005 | ||
1006 | START_TEST (test_get) | |
1007 | { | |
d99c2368 | 1008 | size_t j; |
4e22da4c VB |
1009 | for (j = 0; |
1010 | j < sizeof(snmp_tree)/sizeof(struct tree_node); | |
1011 | j++) { | |
d99c2368 | 1012 | size_t i; |
4e22da4c VB |
1013 | int found = 0; |
1014 | struct variable vp; | |
1015 | oid target[MAX_OID_LEN]; | |
1016 | size_t targetlen; | |
1017 | size_t varlen; | |
1018 | u_char *result; | |
1019 | WriteMethod *wmethod; | |
1020 | char *repr = snmp_oidrepr(snmp_tree[j].name, | |
1021 | snmp_tree[j].namelen); | |
1022 | ||
1023 | for (i = 0; i < agent_lldp_vars_size(); i++) { | |
1024 | /* Search for the appropriate prefix. */ | |
1025 | if (!snmp_is_prefix_of(&agent_lldp_vars[i], &snmp_tree[j], | |
1026 | repr)) continue; | |
1027 | ||
1028 | /* We have our prefix. Fill out the vp struct | |
1029 | correctly. We need to complete OID with | |
1030 | LLDP prefix. */ | |
1031 | snmp_merge(&agent_lldp_vars[i], &snmp_tree[j], &vp, target, &targetlen); | |
1032 | ||
1033 | /* Invoke the function */ | |
1034 | result = vp.findVar(&vp, target, &targetlen, 1, &varlen, &wmethod); | |
d99c2368 | 1035 | |
4e22da4c VB |
1036 | /* Check the result */ |
1037 | fail_unless(result != NULL, | |
1038 | "No result when querying %s", repr); | |
1039 | snmp_compare(&snmp_tree[j], result, varlen, target, targetlen, repr); | |
1040 | ||
1041 | found = 1; | |
1042 | break; | |
1043 | } | |
1044 | if (!found) | |
1045 | fail("OID %s not found", repr); | |
1046 | } | |
1047 | } | |
1048 | END_TEST | |
1049 | ||
1050 | START_TEST (test_getnext) | |
1051 | { | |
d99c2368 VB |
1052 | size_t j; |
1053 | size_t end = sizeof(snmp_tree)/sizeof(struct tree_node); | |
4e22da4c VB |
1054 | for (j = 0; |
1055 | j < end; | |
1056 | j++) { | |
d99c2368 | 1057 | size_t i; |
4e22da4c VB |
1058 | struct variable vp; |
1059 | oid target[MAX_OID_LEN]; | |
1060 | size_t targetlen; | |
1061 | size_t varlen; | |
1062 | u_char *result = NULL; | |
1063 | WriteMethod *wmethod; | |
1064 | char *repr = snmp_oidrepr(snmp_tree[j].name, | |
1065 | snmp_tree[j].namelen); | |
1066 | for (i = 0; i < agent_lldp_vars_size(); i++) { | |
1067 | snmp_merge(&agent_lldp_vars[i], &snmp_tree[j], &vp, target, &targetlen); | |
1068 | result = vp.findVar(&vp, target, &targetlen, 0, &varlen, &wmethod); | |
1069 | if (result) /* Check next! */ | |
1070 | break; | |
1071 | } | |
1072 | if (!result) { | |
1073 | fail_unless(j == end - 1, | |
1074 | "No next result found for %s", repr); | |
1075 | return; | |
1076 | } | |
1077 | fail_unless(j < end - 1, | |
1078 | "More results after %s", repr); | |
1079 | ||
1080 | /* For unknown reasons, snmp_compare can be executed | |
1081 | even when the above test fails... */ | |
1082 | if (j < end - 1) | |
1083 | snmp_compare(&snmp_tree[j+1], result, varlen, target, targetlen, repr); | |
1084 | ||
1085 | } | |
1086 | } | |
1087 | END_TEST | |
1088 | ||
1089 | Suite * | |
1090 | snmp_suite(void) | |
1091 | { | |
1092 | Suite *s = suite_create("SNMP"); | |
1093 | ||
1094 | TCase *tc_snmp = tcase_create("SNMP"); | |
1095 | tcase_add_checked_fixture(tc_snmp, snmp_config, NULL); | |
1096 | tcase_add_test(tc_snmp, test_variable_order); | |
1097 | tcase_add_test(tc_snmp, test_get); | |
1098 | tcase_add_test(tc_snmp, test_getnext); | |
1099 | suite_add_tcase(s, tc_snmp); | |
1100 | ||
1101 | return s; | |
1102 | } | |
1103 | ||
1104 | int | |
1105 | main() | |
1106 | { | |
1107 | int number_failed; | |
1108 | Suite *s = snmp_suite(); | |
1109 | SRunner *sr = srunner_create(s); | |
1110 | srunner_run_all(sr, CK_ENV); | |
1111 | number_failed = srunner_ntests_failed(sr); | |
1112 | srunner_free(sr); | |
1113 | return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; | |
1114 | } |