]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* |
508e53e2 | 2 | * Copyright (C) 2003 Yasuhiro Ohara |
718e3744 | 3 | * |
4 | * This file is part of GNU Zebra. | |
5 | * | |
6 | * GNU Zebra is free software; you can redistribute it and/or modify it | |
7 | * under the terms of the GNU General Public License as published by the | |
8 | * Free Software Foundation; either version 2, or (at your option) any | |
9 | * later version. | |
10 | * | |
11 | * GNU Zebra is distributed in the hope that it will be useful, but | |
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | * General Public License for more details. | |
15 | * | |
896014f4 DL |
16 | * You should have received a copy of the GNU General Public License along |
17 | * with this program; see the file COPYING; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
718e3744 | 19 | */ |
20 | ||
508e53e2 | 21 | #include <zebra.h> |
718e3744 | 22 | |
508e53e2 | 23 | #include "thread.h" |
24 | #include "linklist.h" | |
25 | #include "vty.h" | |
26 | #include "command.h" | |
427f8e61 | 27 | #include "plist.h" |
718e3744 | 28 | |
508e53e2 | 29 | #include "ospf6_proto.h" |
c527acf1 | 30 | #include "ospf6_top.h" |
508e53e2 | 31 | #include "ospf6_network.h" |
32 | #include "ospf6_lsa.h" | |
33 | #include "ospf6_lsdb.h" | |
34 | #include "ospf6_message.h" | |
35 | #include "ospf6_route.h" | |
36 | #include "ospf6_zebra.h" | |
37 | #include "ospf6_spf.h" | |
508e53e2 | 38 | #include "ospf6_area.h" |
39 | #include "ospf6_interface.h" | |
40 | #include "ospf6_neighbor.h" | |
41 | #include "ospf6_intra.h" | |
42 | #include "ospf6_asbr.h" | |
049207c3 | 43 | #include "ospf6_abr.h" |
1e05838a | 44 | #include "ospf6_flood.h" |
049207c3 | 45 | #include "ospf6d.h" |
7f342629 | 46 | #include "ospf6_bfd.h" |
de851bf2 | 47 | #include "lib/json.h" |
718e3744 | 48 | |
d62a17ae | 49 | struct route_node *route_prev(struct route_node *node) |
718e3744 | 50 | { |
d62a17ae | 51 | struct route_node *end; |
52 | struct route_node *prev = NULL; | |
53 | ||
54 | end = node; | |
55 | node = node->parent; | |
56 | if (node) | |
57 | route_lock_node(node); | |
58 | while (node) { | |
59 | prev = node; | |
60 | node = route_next(node); | |
61 | if (node == end) { | |
62 | route_unlock_node(node); | |
63 | node = NULL; | |
64 | } | |
65 | } | |
66 | route_unlock_node(end); | |
67 | if (prev) | |
68 | route_lock_node(prev); | |
69 | ||
70 | return prev; | |
718e3744 | 71 | } |
72 | ||
612c2c15 | 73 | static int config_write_ospf6_debug(struct vty *vty); |
d62a17ae | 74 | static struct cmd_node debug_node = { |
f4b8291f | 75 | .name = "debug", |
62b346ee DL |
76 | .node = DEBUG_NODE, |
77 | .prompt = "", | |
612c2c15 | 78 | .config_write = config_write_ospf6_debug, |
508e53e2 | 79 | }; |
718e3744 | 80 | |
d62a17ae | 81 | static int config_write_ospf6_debug(struct vty *vty) |
508e53e2 | 82 | { |
d62a17ae | 83 | config_write_ospf6_debug_message(vty); |
84 | config_write_ospf6_debug_lsa(vty); | |
85 | config_write_ospf6_debug_zebra(vty); | |
86 | config_write_ospf6_debug_interface(vty); | |
87 | config_write_ospf6_debug_neighbor(vty); | |
88 | config_write_ospf6_debug_spf(vty); | |
89 | config_write_ospf6_debug_route(vty); | |
90 | config_write_ospf6_debug_brouter(vty); | |
91 | config_write_ospf6_debug_asbr(vty); | |
92 | config_write_ospf6_debug_abr(vty); | |
93 | config_write_ospf6_debug_flood(vty); | |
87f6dc50 | 94 | |
d62a17ae | 95 | return 0; |
718e3744 | 96 | } |
97 | ||
87f6dc50 DS |
98 | DEFUN_NOSH (show_debugging_ospf6, |
99 | show_debugging_ospf6_cmd, | |
100 | "show debugging [ospf6]", | |
101 | SHOW_STR | |
102 | DEBUG_STR | |
103 | OSPF6_STR) | |
104 | { | |
257660b4 | 105 | vty_out(vty, "OSPF6 debugging status:\n"); |
87f6dc50 DS |
106 | |
107 | config_write_ospf6_debug(vty); | |
108 | ||
109 | return CMD_SUCCESS; | |
110 | } | |
111 | ||
d62a17ae | 112 | #define AREA_LSDB_TITLE_FORMAT \ |
113 | "\n Area Scoped Link State Database (Area %s)\n\n" | |
114 | #define IF_LSDB_TITLE_FORMAT \ | |
115 | "\n I/F Scoped Link State Database (I/F %s in Area %s)\n\n" | |
116 | #define AS_LSDB_TITLE_FORMAT "\n AS Scoped Link State Database\n\n" | |
049207c3 | 117 | |
d62a17ae | 118 | static int parse_show_level(int idx_level, int argc, struct cmd_token **argv) |
049207c3 | 119 | { |
d62a17ae | 120 | int level = OSPF6_LSDB_SHOW_LEVEL_NORMAL; |
121 | ||
122 | if (argc > idx_level) { | |
123 | if (strmatch(argv[idx_level]->text, "detail")) | |
124 | level = OSPF6_LSDB_SHOW_LEVEL_DETAIL; | |
125 | else if (strmatch(argv[idx_level]->text, "dump")) | |
126 | level = OSPF6_LSDB_SHOW_LEVEL_DUMP; | |
127 | else if (strmatch(argv[idx_level]->text, "internal")) | |
128 | level = OSPF6_LSDB_SHOW_LEVEL_INTERNAL; | |
129 | } | |
130 | ||
131 | return level; | |
049207c3 | 132 | } |
133 | ||
d7c0a89a | 134 | static uint16_t parse_type_spec(int idx_lsa, int argc, struct cmd_token **argv) |
049207c3 | 135 | { |
d7c0a89a | 136 | uint16_t type = 0; |
d62a17ae | 137 | |
138 | if (argc > idx_lsa) { | |
139 | if (strmatch(argv[idx_lsa]->text, "router")) | |
140 | type = htons(OSPF6_LSTYPE_ROUTER); | |
141 | else if (strmatch(argv[idx_lsa]->text, "network")) | |
142 | type = htons(OSPF6_LSTYPE_NETWORK); | |
143 | else if (strmatch(argv[idx_lsa]->text, "as-external")) | |
144 | type = htons(OSPF6_LSTYPE_AS_EXTERNAL); | |
145 | else if (strmatch(argv[idx_lsa]->text, "intra-prefix")) | |
146 | type = htons(OSPF6_LSTYPE_INTRA_PREFIX); | |
147 | else if (strmatch(argv[idx_lsa]->text, "inter-router")) | |
148 | type = htons(OSPF6_LSTYPE_INTER_ROUTER); | |
149 | else if (strmatch(argv[idx_lsa]->text, "inter-prefix")) | |
150 | type = htons(OSPF6_LSTYPE_INTER_PREFIX); | |
151 | else if (strmatch(argv[idx_lsa]->text, "link")) | |
152 | type = htons(OSPF6_LSTYPE_LINK); | |
153 | } | |
154 | ||
155 | return type; | |
049207c3 | 156 | } |
157 | ||
de851bf2 YR |
158 | void ospf6_lsdb_show(struct vty *vty, enum ospf_lsdb_show_level level, |
159 | uint16_t *type, uint32_t *id, uint32_t *adv_router, | |
e4bacbaa YR |
160 | struct ospf6_lsdb *lsdb, json_object *json_obj, |
161 | bool use_json) | |
de851bf2 YR |
162 | { |
163 | struct ospf6_lsa *lsa; | |
164 | const struct route_node *end = NULL; | |
e4bacbaa YR |
165 | void (*showfunc)(struct vty *, struct ospf6_lsa *, json_object *, |
166 | bool) = NULL; | |
167 | json_object *json_array = NULL; | |
de851bf2 YR |
168 | |
169 | switch (level) { | |
170 | case OSPF6_LSDB_SHOW_LEVEL_DETAIL: | |
171 | showfunc = ospf6_lsa_show; | |
172 | break; | |
173 | case OSPF6_LSDB_SHOW_LEVEL_INTERNAL: | |
174 | showfunc = ospf6_lsa_show_internal; | |
175 | break; | |
176 | case OSPF6_LSDB_SHOW_LEVEL_DUMP: | |
177 | showfunc = ospf6_lsa_show_dump; | |
178 | break; | |
179 | case OSPF6_LSDB_SHOW_LEVEL_NORMAL: | |
180 | default: | |
181 | showfunc = ospf6_lsa_show_summary; | |
182 | } | |
183 | ||
e4bacbaa YR |
184 | if (use_json) |
185 | json_array = json_object_new_array(); | |
186 | ||
de851bf2 YR |
187 | if (type && id && adv_router) { |
188 | lsa = ospf6_lsdb_lookup(*type, *id, *adv_router, lsdb); | |
189 | if (lsa) { | |
190 | if (level == OSPF6_LSDB_SHOW_LEVEL_NORMAL) | |
e4bacbaa | 191 | ospf6_lsa_show(vty, lsa, json_array, use_json); |
de851bf2 | 192 | else |
e4bacbaa | 193 | (*showfunc)(vty, lsa, json_array, use_json); |
de851bf2 | 194 | } |
e4bacbaa YR |
195 | |
196 | if (use_json) | |
197 | json_object_object_add(json_obj, "lsa", json_array); | |
de851bf2 YR |
198 | return; |
199 | } | |
200 | ||
e4bacbaa | 201 | if ((level == OSPF6_LSDB_SHOW_LEVEL_NORMAL) && !use_json) |
de851bf2 YR |
202 | ospf6_lsa_show_summary_header(vty); |
203 | ||
204 | end = ospf6_lsdb_head(lsdb, !!type + !!(type && adv_router), | |
205 | type ? *type : 0, adv_router ? *adv_router : 0, | |
206 | &lsa); | |
207 | while (lsa) { | |
208 | if ((!adv_router || lsa->header->adv_router == *adv_router) | |
209 | && (!id || lsa->header->id == *id)) | |
e4bacbaa | 210 | (*showfunc)(vty, lsa, json_array, use_json); |
de851bf2 YR |
211 | lsa = ospf6_lsdb_next(end, lsa); |
212 | } | |
e4bacbaa YR |
213 | |
214 | if (use_json) | |
215 | json_object_object_add(json_obj, "lsa", json_array); | |
de851bf2 YR |
216 | } |
217 | ||
218 | static void ospf6_lsdb_show_wrapper(struct vty *vty, | |
219 | enum ospf_lsdb_show_level level, | |
220 | uint16_t *type, uint32_t *id, | |
221 | uint32_t *adv_router, bool uj, | |
222 | struct ospf6 *ospf6) | |
223 | { | |
224 | struct listnode *i, *j; | |
225 | struct ospf6 *o = ospf6; | |
226 | struct ospf6_area *oa; | |
227 | struct ospf6_interface *oi; | |
228 | json_object *json = NULL; | |
229 | json_object *json_array = NULL; | |
230 | json_object *json_obj = NULL; | |
231 | ||
232 | if (uj) { | |
233 | json = json_object_new_object(); | |
234 | json_array = json_object_new_array(); | |
235 | } | |
236 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
237 | if (uj) { | |
238 | json_obj = json_object_new_object(); | |
239 | json_object_string_add(json_obj, "areaId", oa->name); | |
240 | } else | |
241 | vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); | |
e4bacbaa YR |
242 | ospf6_lsdb_show(vty, level, type, id, adv_router, oa->lsdb, |
243 | json_obj, uj); | |
de851bf2 YR |
244 | if (uj) |
245 | json_object_array_add(json_array, json_obj); | |
246 | } | |
247 | if (uj) | |
248 | json_object_object_add(json, "areaScopedLinkStateDb", | |
249 | json_array); | |
250 | ||
251 | if (uj) | |
252 | json_array = json_object_new_array(); | |
253 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
254 | for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { | |
255 | if (uj) { | |
256 | json_obj = json_object_new_object(); | |
257 | json_object_string_add(json_obj, "areaId", | |
258 | oa->name); | |
259 | json_object_string_add(json_obj, "interface", | |
260 | oi->interface->name); | |
261 | } else | |
262 | vty_out(vty, IF_LSDB_TITLE_FORMAT, | |
263 | oi->interface->name, oa->name); | |
264 | ospf6_lsdb_show(vty, level, type, id, adv_router, | |
e4bacbaa | 265 | oi->lsdb, json_obj, uj); |
de851bf2 YR |
266 | if (uj) |
267 | json_object_array_add(json_array, json_obj); | |
268 | } | |
269 | } | |
270 | if (uj) | |
271 | json_object_object_add(json, "interfaceScopedLinkStateDb", | |
272 | json_array); | |
273 | if (uj) { | |
274 | json_array = json_object_new_array(); | |
275 | json_obj = json_object_new_object(); | |
276 | } else | |
277 | vty_out(vty, AS_LSDB_TITLE_FORMAT); | |
278 | ||
e4bacbaa YR |
279 | ospf6_lsdb_show(vty, level, type, id, adv_router, o->lsdb, json_obj, |
280 | uj); | |
de851bf2 YR |
281 | |
282 | if (uj) { | |
283 | json_object_array_add(json_array, json_obj); | |
284 | json_object_object_add(json, "asScopedLinkStateDb", json_array); | |
285 | ||
286 | vty_out(vty, "%s\n", | |
287 | json_object_to_json_string_ext( | |
288 | json, JSON_C_TO_STRING_PRETTY)); | |
289 | json_object_free(json); | |
290 | } else | |
291 | vty_out(vty, "\n"); | |
292 | } | |
293 | ||
294 | static void ospf6_lsdb_type_show_wrapper(struct vty *vty, | |
295 | enum ospf_lsdb_show_level level, | |
296 | uint16_t *type, uint32_t *id, | |
297 | uint32_t *adv_router, bool uj, | |
298 | struct ospf6 *ospf6) | |
299 | { | |
300 | struct listnode *i, *j; | |
301 | struct ospf6 *o = ospf6; | |
302 | struct ospf6_area *oa; | |
303 | struct ospf6_interface *oi; | |
304 | json_object *json = NULL; | |
305 | json_object *json_array = NULL; | |
306 | json_object *json_obj = NULL; | |
307 | ||
308 | if (uj) { | |
309 | json = json_object_new_object(); | |
310 | json_array = json_object_new_array(); | |
311 | } | |
312 | ||
313 | switch (OSPF6_LSA_SCOPE(*type)) { | |
314 | case OSPF6_SCOPE_AREA: | |
315 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
316 | if (uj) { | |
317 | json_obj = json_object_new_object(); | |
318 | json_object_string_add(json_obj, "areaId", | |
319 | oa->name); | |
320 | } else | |
321 | vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); | |
322 | ||
323 | ospf6_lsdb_show(vty, level, type, id, adv_router, | |
e4bacbaa | 324 | oa->lsdb, json_obj, uj); |
de851bf2 YR |
325 | if (uj) |
326 | json_object_array_add(json_array, json_obj); | |
327 | } | |
328 | if (uj) | |
329 | json_object_object_add(json, "areaScopedLinkStateDb", | |
330 | json_array); | |
331 | break; | |
332 | ||
333 | case OSPF6_SCOPE_LINKLOCAL: | |
334 | for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { | |
335 | for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { | |
336 | if (uj) { | |
337 | json_obj = json_object_new_object(); | |
338 | json_object_string_add( | |
339 | json_obj, "areaId", oa->name); | |
340 | json_object_string_add( | |
341 | json_obj, "interface", | |
342 | oi->interface->name); | |
343 | } else | |
344 | vty_out(vty, IF_LSDB_TITLE_FORMAT, | |
345 | oi->interface->name, oa->name); | |
346 | ||
347 | ospf6_lsdb_show(vty, level, type, id, | |
e4bacbaa YR |
348 | adv_router, oi->lsdb, json_obj, |
349 | uj); | |
de851bf2 YR |
350 | |
351 | if (uj) | |
352 | json_object_array_add(json_array, | |
353 | json_obj); | |
354 | } | |
355 | } | |
356 | if (uj) | |
357 | json_object_object_add( | |
358 | json, "interfaceScopedLinkStateDb", json_array); | |
359 | break; | |
360 | ||
361 | case OSPF6_SCOPE_AS: | |
362 | if (uj) | |
363 | json_obj = json_object_new_object(); | |
364 | else | |
365 | vty_out(vty, AS_LSDB_TITLE_FORMAT); | |
366 | ||
e4bacbaa YR |
367 | ospf6_lsdb_show(vty, level, type, id, adv_router, o->lsdb, |
368 | json_obj, uj); | |
de851bf2 YR |
369 | if (uj) { |
370 | json_object_array_add(json_array, json_obj); | |
371 | json_object_object_add(json, "asScopedLinkStateDb", | |
372 | json_array); | |
373 | } | |
374 | break; | |
375 | ||
376 | default: | |
377 | assert(0); | |
378 | break; | |
379 | } | |
380 | if (uj) { | |
381 | vty_out(vty, "%s\n", | |
382 | json_object_to_json_string_ext( | |
383 | json, JSON_C_TO_STRING_PRETTY)); | |
384 | json_object_free(json); | |
385 | } else | |
386 | vty_out(vty, "\n"); | |
387 | } | |
388 | ||
508e53e2 | 389 | DEFUN (show_ipv6_ospf6_database, |
390 | show_ipv6_ospf6_database_cmd, | |
de851bf2 | 391 | "show ipv6 ospf6 database [<detail|dump|internal>] [json]", |
508e53e2 | 392 | SHOW_STR |
393 | IPV6_STR | |
394 | OSPF6_STR | |
395 | "Display Link state database\n" | |
14b16482 DW |
396 | "Display details of LSAs\n" |
397 | "Dump LSAs\n" | |
de851bf2 YR |
398 | "Display LSA's internal information\n" |
399 | JSON_STR) | |
718e3744 | 400 | { |
d62a17ae | 401 | int idx_level = 4; |
402 | int level; | |
de851bf2 | 403 | bool uj = use_json(argc, argv); |
beadc736 | 404 | struct ospf6 *ospf6; |
beadc736 | 405 | |
406 | ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); | |
407 | OSPF6_CMD_CHECK_RUNNING(ospf6); | |
d62a17ae | 408 | |
409 | level = parse_show_level(idx_level, argc, argv); | |
de851bf2 | 410 | ospf6_lsdb_show_wrapper(vty, level, NULL, NULL, NULL, uj, ospf6); |
d62a17ae | 411 | return CMD_SUCCESS; |
718e3744 | 412 | } |
413 | ||
de851bf2 YR |
414 | DEFUN (show_ipv6_ospf6_database_type, show_ipv6_ospf6_database_type_cmd, |
415 | "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> [<detail|dump|internal>] [json]", | |
718e3744 | 416 | SHOW_STR |
508e53e2 | 417 | IPV6_STR |
418 | OSPF6_STR | |
419 | "Display Link state database\n" | |
420 | "Display Router LSAs\n" | |
421 | "Display Network LSAs\n" | |
422 | "Display Inter-Area-Prefix LSAs\n" | |
423 | "Display Inter-Area-Router LSAs\n" | |
424 | "Display As-External LSAs\n" | |
425 | "Display Group-Membership LSAs\n" | |
426 | "Display Type-7 LSAs\n" | |
427 | "Display Link LSAs\n" | |
428 | "Display Intra-Area-Prefix LSAs\n" | |
14b16482 DW |
429 | "Display details of LSAs\n" |
430 | "Dump LSAs\n" | |
431 | "Display LSA's internal information\n" | |
de851bf2 | 432 | JSON_STR) |
718e3744 | 433 | { |
d62a17ae | 434 | int idx_lsa = 4; |
435 | int idx_level = 5; | |
436 | int level; | |
d7c0a89a | 437 | uint16_t type = 0; |
de851bf2 YR |
438 | bool uj = use_json(argc, argv); |
439 | struct ospf6 *ospf6; | |
d62a17ae | 440 | |
beadc736 | 441 | |
442 | ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); | |
443 | OSPF6_CMD_CHECK_RUNNING(ospf6); | |
d62a17ae | 444 | |
445 | type = parse_type_spec(idx_lsa, argc, argv); | |
446 | level = parse_show_level(idx_level, argc, argv); | |
447 | ||
de851bf2 | 448 | ospf6_lsdb_type_show_wrapper(vty, level, &type, NULL, NULL, uj, ospf6); |
d62a17ae | 449 | return CMD_SUCCESS; |
718e3744 | 450 | } |
451 | ||
508e53e2 | 452 | DEFUN (show_ipv6_ospf6_database_id, |
453 | show_ipv6_ospf6_database_id_cmd, | |
de851bf2 | 454 | "show ipv6 ospf6 database <*|linkstate-id> A.B.C.D [<detail|dump|internal>] [json]", |
718e3744 | 455 | SHOW_STR |
508e53e2 | 456 | IPV6_STR |
718e3744 | 457 | OSPF6_STR |
508e53e2 | 458 | "Display Link state database\n" |
459 | "Any Link state Type\n" | |
093d7a3a | 460 | "Search by Link state ID\n" |
508e53e2 | 461 | "Specify Link state ID as IPv4 address notation\n" |
093d7a3a DW |
462 | "Display details of LSAs\n" |
463 | "Dump LSAs\n" | |
de851bf2 YR |
464 | "Display LSA's internal information\n" |
465 | JSON_STR) | |
718e3744 | 466 | { |
d62a17ae | 467 | int idx_ipv4 = 5; |
468 | int idx_level = 6; | |
469 | int level; | |
d7c0a89a | 470 | uint32_t id = 0; |
de851bf2 YR |
471 | bool uj = use_json(argc, argv); |
472 | struct ospf6 *ospf6; | |
d62a17ae | 473 | |
beadc736 | 474 | |
475 | ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); | |
476 | OSPF6_CMD_CHECK_RUNNING(ospf6); | |
d62a17ae | 477 | |
478 | if (argv[idx_ipv4]->type == IPV4_TKN) | |
479 | inet_pton(AF_INET, argv[idx_ipv4]->arg, &id); | |
480 | ||
481 | level = parse_show_level(idx_level, argc, argv); | |
de851bf2 | 482 | ospf6_lsdb_show_wrapper(vty, level, NULL, &id, NULL, uj, ospf6); |
d62a17ae | 483 | |
d62a17ae | 484 | return CMD_SUCCESS; |
718e3744 | 485 | } |
486 | ||
508e53e2 | 487 | DEFUN (show_ipv6_ospf6_database_router, |
488 | show_ipv6_ospf6_database_router_cmd, | |
de851bf2 | 489 | "show ipv6 ospf6 database <*|adv-router> * A.B.C.D <detail|dump|internal> [json]", |
508e53e2 | 490 | SHOW_STR |
491 | IPV6_STR | |
492 | OSPF6_STR | |
493 | "Display Link state database\n" | |
494 | "Any Link state Type\n" | |
093d7a3a | 495 | "Search by Advertising Router\n" |
508e53e2 | 496 | "Any Link state ID\n" |
497 | "Specify Advertising Router as IPv4 address notation\n" | |
093d7a3a DW |
498 | "Display details of LSAs\n" |
499 | "Dump LSAs\n" | |
de851bf2 YR |
500 | "Display LSA's internal information\n" |
501 | JSON_STR) | |
718e3744 | 502 | { |
d62a17ae | 503 | int idx_ipv4 = 6; |
504 | int idx_level = 7; | |
505 | int level; | |
d7c0a89a | 506 | uint32_t adv_router = 0; |
de851bf2 YR |
507 | bool uj = use_json(argc, argv); |
508 | struct ospf6 *ospf6; | |
d62a17ae | 509 | |
beadc736 | 510 | |
511 | ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); | |
512 | OSPF6_CMD_CHECK_RUNNING(ospf6); | |
d62a17ae | 513 | inet_pton(AF_INET, argv[idx_ipv4]->arg, &adv_router); |
514 | level = parse_show_level(idx_level, argc, argv); | |
515 | ||
de851bf2 | 516 | ospf6_lsdb_show_wrapper(vty, level, NULL, NULL, &adv_router, uj, ospf6); |
d62a17ae | 517 | return CMD_SUCCESS; |
508e53e2 | 518 | } |
519 | ||
da086a3b CS |
520 | DEFUN_HIDDEN (show_ipv6_ospf6_database_aggr_router, |
521 | show_ipv6_ospf6_database_aggr_router_cmd, | |
522 | "show ipv6 ospf6 database aggr adv-router A.B.C.D", | |
523 | SHOW_STR | |
524 | IPV6_STR | |
525 | OSPF6_STR | |
526 | "Display Link state database\n" | |
527 | "Aggregated Router LSA\n" | |
528 | "Search by Advertising Router\n" | |
529 | "Specify Advertising Router as IPv4 address notation\n") | |
530 | { | |
531 | int level = OSPF6_LSDB_SHOW_LEVEL_DETAIL; | |
532 | uint16_t type = htons(OSPF6_LSTYPE_ROUTER); | |
533 | int idx_ipv4 = 6; | |
534 | struct listnode *i; | |
beadc736 | 535 | struct ospf6 *ospf6; |
da086a3b CS |
536 | struct ospf6_area *oa; |
537 | struct ospf6_lsdb *lsdb; | |
538 | uint32_t adv_router = 0; | |
539 | ||
beadc736 | 540 | ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); |
541 | OSPF6_CMD_CHECK_RUNNING(ospf6); | |
542 | ||
da086a3b CS |
543 | inet_pton(AF_INET, argv[idx_ipv4]->arg, &adv_router); |
544 | ||
beadc736 | 545 | for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { |
546 | if (adv_router == ospf6->router_id) | |
da086a3b CS |
547 | lsdb = oa->lsdb_self; |
548 | else | |
549 | lsdb = oa->lsdb; | |
996c9314 LB |
550 | if (ospf6_create_single_router_lsa(oa, lsdb, adv_router) |
551 | == NULL) { | |
da086a3b CS |
552 | vty_out(vty, "Adv router is not found in LSDB."); |
553 | return CMD_SUCCESS; | |
554 | } | |
555 | ospf6_lsdb_show(vty, level, &type, NULL, NULL, | |
e4bacbaa | 556 | oa->temp_router_lsa_lsdb, NULL, false); |
da086a3b CS |
557 | /* Remove the temp cache */ |
558 | ospf6_remove_temp_router_lsa(oa); | |
559 | } | |
560 | ||
561 | vty_out(vty, "\n"); | |
562 | ||
563 | return CMD_SUCCESS; | |
564 | } | |
565 | ||
508e53e2 | 566 | DEFUN (show_ipv6_ospf6_database_type_id, |
567 | show_ipv6_ospf6_database_type_id_cmd, | |
de851bf2 | 568 | "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> linkstate-id A.B.C.D [<detail|dump|internal>] [json]", |
508e53e2 | 569 | SHOW_STR |
570 | IPV6_STR | |
571 | OSPF6_STR | |
572 | "Display Link state database\n" | |
573 | "Display Router LSAs\n" | |
574 | "Display Network LSAs\n" | |
575 | "Display Inter-Area-Prefix LSAs\n" | |
576 | "Display Inter-Area-Router LSAs\n" | |
577 | "Display As-External LSAs\n" | |
578 | "Display Group-Membership LSAs\n" | |
579 | "Display Type-7 LSAs\n" | |
580 | "Display Link LSAs\n" | |
581 | "Display Intra-Area-Prefix LSAs\n" | |
093d7a3a | 582 | "Search by Link state ID\n" |
508e53e2 | 583 | "Specify Link state ID as IPv4 address notation\n" |
093d7a3a DW |
584 | "Display details of LSAs\n" |
585 | "Dump LSAs\n" | |
586 | "Display LSA's internal information\n" | |
de851bf2 | 587 | JSON_STR) |
508e53e2 | 588 | { |
d62a17ae | 589 | int idx_lsa = 4; |
590 | int idx_ipv4 = 6; | |
591 | int idx_level = 7; | |
592 | int level; | |
d7c0a89a QY |
593 | uint16_t type = 0; |
594 | uint32_t id = 0; | |
de851bf2 YR |
595 | bool uj = use_json(argc, argv); |
596 | struct ospf6 *ospf6; | |
d62a17ae | 597 | |
beadc736 | 598 | |
599 | ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); | |
600 | OSPF6_CMD_CHECK_RUNNING(ospf6); | |
d62a17ae | 601 | |
602 | type = parse_type_spec(idx_lsa, argc, argv); | |
603 | inet_pton(AF_INET, argv[idx_ipv4]->arg, &id); | |
604 | level = parse_show_level(idx_level, argc, argv); | |
605 | ||
de851bf2 | 606 | ospf6_lsdb_type_show_wrapper(vty, level, &type, &id, NULL, uj, ospf6); |
d62a17ae | 607 | return CMD_SUCCESS; |
718e3744 | 608 | } |
609 | ||
508e53e2 | 610 | DEFUN (show_ipv6_ospf6_database_type_router, |
611 | show_ipv6_ospf6_database_type_router_cmd, | |
de851bf2 | 612 | "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> <*|adv-router> A.B.C.D [<detail|dump|internal>] [json]", |
508e53e2 | 613 | SHOW_STR |
614 | IPV6_STR | |
615 | OSPF6_STR | |
616 | "Display Link state database\n" | |
617 | "Display Router LSAs\n" | |
618 | "Display Network LSAs\n" | |
619 | "Display Inter-Area-Prefix LSAs\n" | |
620 | "Display Inter-Area-Router LSAs\n" | |
621 | "Display As-External LSAs\n" | |
622 | "Display Group-Membership LSAs\n" | |
623 | "Display Type-7 LSAs\n" | |
624 | "Display Link LSAs\n" | |
625 | "Display Intra-Area-Prefix LSAs\n" | |
626 | "Any Link state ID\n" | |
093d7a3a | 627 | "Search by Advertising Router\n" |
508e53e2 | 628 | "Specify Advertising Router as IPv4 address notation\n" |
093d7a3a DW |
629 | "Display details of LSAs\n" |
630 | "Dump LSAs\n" | |
631 | "Display LSA's internal information\n" | |
de851bf2 | 632 | JSON_STR) |
718e3744 | 633 | { |
d62a17ae | 634 | int idx_lsa = 4; |
635 | int idx_ipv4 = 6; | |
636 | int idx_level = 7; | |
637 | int level; | |
d7c0a89a QY |
638 | uint16_t type = 0; |
639 | uint32_t adv_router = 0; | |
de851bf2 YR |
640 | bool uj = use_json(argc, argv); |
641 | struct ospf6 *ospf6; | |
d62a17ae | 642 | |
d62a17ae | 643 | |
beadc736 | 644 | ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); |
645 | OSPF6_CMD_CHECK_RUNNING(ospf6); | |
d62a17ae | 646 | type = parse_type_spec(idx_lsa, argc, argv); |
647 | inet_pton(AF_INET, argv[idx_ipv4]->arg, &adv_router); | |
648 | level = parse_show_level(idx_level, argc, argv); | |
649 | ||
de851bf2 YR |
650 | ospf6_lsdb_type_show_wrapper(vty, level, &type, NULL, &adv_router, uj, |
651 | ospf6); | |
d62a17ae | 652 | return CMD_SUCCESS; |
718e3744 | 653 | } |
654 | ||
508e53e2 | 655 | |
049207c3 | 656 | DEFUN (show_ipv6_ospf6_database_id_router, |
657 | show_ipv6_ospf6_database_id_router_cmd, | |
de851bf2 | 658 | "show ipv6 ospf6 database * A.B.C.D A.B.C.D [<detail|dump|internal>] [json]", |
049207c3 | 659 | SHOW_STR |
660 | IPV6_STR | |
661 | OSPF6_STR | |
662 | "Display Link state database\n" | |
663 | "Any Link state Type\n" | |
664 | "Specify Link state ID as IPv4 address notation\n" | |
665 | "Specify Advertising Router as IPv4 address notation\n" | |
14b16482 DW |
666 | "Display details of LSAs\n" |
667 | "Dump LSAs\n" | |
668 | "Display LSA's internal information\n" | |
de851bf2 | 669 | JSON_STR) |
049207c3 | 670 | { |
d62a17ae | 671 | int idx_ls_id = 5; |
672 | int idx_adv_rtr = 6; | |
673 | int idx_level = 7; | |
674 | int level; | |
d7c0a89a QY |
675 | uint32_t id = 0; |
676 | uint32_t adv_router = 0; | |
de851bf2 YR |
677 | bool uj = use_json(argc, argv); |
678 | struct ospf6 *ospf6; | |
d62a17ae | 679 | |
beadc736 | 680 | ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); |
681 | OSPF6_CMD_CHECK_RUNNING(ospf6); | |
d62a17ae | 682 | inet_pton(AF_INET, argv[idx_ls_id]->arg, &id); |
683 | inet_pton(AF_INET, argv[idx_adv_rtr]->arg, &adv_router); | |
684 | level = parse_show_level(idx_level, argc, argv); | |
685 | ||
de851bf2 | 686 | ospf6_lsdb_show_wrapper(vty, level, NULL, &id, &adv_router, uj, ospf6); |
d62a17ae | 687 | return CMD_SUCCESS; |
718e3744 | 688 | } |
689 | ||
508e53e2 | 690 | |
049207c3 | 691 | DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id, |
692 | show_ipv6_ospf6_database_adv_router_linkstate_id_cmd, | |
de851bf2 | 693 | "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D [<detail|dump|internal>] [json]", |
049207c3 | 694 | SHOW_STR |
695 | IPV6_STR | |
696 | OSPF6_STR | |
697 | "Display Link state database\n" | |
698 | "Search by Advertising Router\n" | |
699 | "Specify Advertising Router as IPv4 address notation\n" | |
700 | "Search by Link state ID\n" | |
701 | "Specify Link state ID as IPv4 address notation\n" | |
14b16482 DW |
702 | "Display details of LSAs\n" |
703 | "Dump LSAs\n" | |
de851bf2 YR |
704 | "Display LSA's internal information\n" |
705 | JSON_STR) | |
049207c3 | 706 | { |
d62a17ae | 707 | int idx_adv_rtr = 5; |
708 | int idx_ls_id = 7; | |
709 | int idx_level = 8; | |
710 | int level; | |
d7c0a89a QY |
711 | uint32_t id = 0; |
712 | uint32_t adv_router = 0; | |
de851bf2 YR |
713 | bool uj = use_json(argc, argv); |
714 | struct ospf6 *ospf6; | |
d62a17ae | 715 | |
beadc736 | 716 | |
717 | ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); | |
718 | OSPF6_CMD_CHECK_RUNNING(ospf6); | |
d62a17ae | 719 | inet_pton(AF_INET, argv[idx_adv_rtr]->arg, &adv_router); |
720 | inet_pton(AF_INET, argv[idx_ls_id]->arg, &id); | |
721 | level = parse_show_level(idx_level, argc, argv); | |
722 | ||
de851bf2 | 723 | ospf6_lsdb_show_wrapper(vty, level, NULL, &id, &adv_router, uj, ospf6); |
d62a17ae | 724 | return CMD_SUCCESS; |
049207c3 | 725 | } |
726 | ||
508e53e2 | 727 | DEFUN (show_ipv6_ospf6_database_type_id_router, |
728 | show_ipv6_ospf6_database_type_id_router_cmd, | |
de851bf2 | 729 | "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> A.B.C.D A.B.C.D [<dump|internal>] [json]", |
508e53e2 | 730 | SHOW_STR |
731 | IPV6_STR | |
732 | OSPF6_STR | |
733 | "Display Link state database\n" | |
734 | "Display Router LSAs\n" | |
735 | "Display Network LSAs\n" | |
736 | "Display Inter-Area-Prefix LSAs\n" | |
737 | "Display Inter-Area-Router LSAs\n" | |
738 | "Display As-External LSAs\n" | |
739 | "Display Group-Membership LSAs\n" | |
740 | "Display Type-7 LSAs\n" | |
741 | "Display Link LSAs\n" | |
742 | "Display Intra-Area-Prefix LSAs\n" | |
743 | "Specify Link state ID as IPv4 address notation\n" | |
744 | "Specify Advertising Router as IPv4 address notation\n" | |
14b16482 | 745 | "Dump LSAs\n" |
de851bf2 YR |
746 | "Display LSA's internal information\n" |
747 | JSON_STR) | |
718e3744 | 748 | { |
d62a17ae | 749 | int idx_lsa = 4; |
750 | int idx_ls_id = 5; | |
751 | int idx_adv_rtr = 6; | |
752 | int idx_level = 7; | |
753 | int level; | |
d7c0a89a QY |
754 | uint16_t type = 0; |
755 | uint32_t id = 0; | |
756 | uint32_t adv_router = 0; | |
de851bf2 YR |
757 | bool uj = use_json(argc, argv); |
758 | struct ospf6 *ospf6; | |
d62a17ae | 759 | |
beadc736 | 760 | |
761 | ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); | |
762 | OSPF6_CMD_CHECK_RUNNING(ospf6); | |
d62a17ae | 763 | |
764 | type = parse_type_spec(idx_lsa, argc, argv); | |
765 | inet_pton(AF_INET, argv[idx_ls_id]->arg, &id); | |
766 | inet_pton(AF_INET, argv[idx_adv_rtr]->arg, &adv_router); | |
767 | level = parse_show_level(idx_level, argc, argv); | |
768 | ||
de851bf2 YR |
769 | ospf6_lsdb_type_show_wrapper(vty, level, &type, &id, &adv_router, uj, |
770 | ospf6); | |
d62a17ae | 771 | return CMD_SUCCESS; |
718e3744 | 772 | } |
773 | ||
049207c3 | 774 | |
775 | DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, | |
776 | show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd, | |
de851bf2 | 777 | "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> adv-router A.B.C.D linkstate-id A.B.C.D [<dump|internal>] [json]", |
049207c3 | 778 | SHOW_STR |
779 | IPV6_STR | |
780 | OSPF6_STR | |
781 | "Display Link state database\n" | |
782 | "Display Router LSAs\n" | |
783 | "Display Network LSAs\n" | |
784 | "Display Inter-Area-Prefix LSAs\n" | |
785 | "Display Inter-Area-Router LSAs\n" | |
786 | "Display As-External LSAs\n" | |
787 | "Display Group-Membership LSAs\n" | |
788 | "Display Type-7 LSAs\n" | |
789 | "Display Link LSAs\n" | |
790 | "Display Intra-Area-Prefix LSAs\n" | |
791 | "Search by Advertising Router\n" | |
792 | "Specify Advertising Router as IPv4 address notation\n" | |
793 | "Search by Link state ID\n" | |
794 | "Specify Link state ID as IPv4 address notation\n" | |
14b16482 | 795 | "Dump LSAs\n" |
de851bf2 YR |
796 | "Display LSA's internal information\n" |
797 | JSON_STR) | |
049207c3 | 798 | { |
d62a17ae | 799 | int idx_lsa = 4; |
800 | int idx_adv_rtr = 6; | |
801 | int idx_ls_id = 8; | |
802 | int idx_level = 9; | |
803 | int level; | |
d7c0a89a QY |
804 | uint16_t type = 0; |
805 | uint32_t id = 0; | |
806 | uint32_t adv_router = 0; | |
de851bf2 YR |
807 | bool uj = use_json(argc, argv); |
808 | struct ospf6 *ospf6; | |
d62a17ae | 809 | |
beadc736 | 810 | |
811 | ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); | |
812 | OSPF6_CMD_CHECK_RUNNING(ospf6); | |
d62a17ae | 813 | |
814 | type = parse_type_spec(idx_lsa, argc, argv); | |
815 | inet_pton(AF_INET, argv[idx_adv_rtr]->arg, &adv_router); | |
816 | inet_pton(AF_INET, argv[idx_ls_id]->arg, &id); | |
817 | level = parse_show_level(idx_level, argc, argv); | |
818 | ||
de851bf2 YR |
819 | ospf6_lsdb_type_show_wrapper(vty, level, &type, &id, &adv_router, uj, |
820 | ospf6); | |
d62a17ae | 821 | return CMD_SUCCESS; |
049207c3 | 822 | } |
823 | ||
508e53e2 | 824 | DEFUN (show_ipv6_ospf6_database_self_originated, |
825 | show_ipv6_ospf6_database_self_originated_cmd, | |
de851bf2 | 826 | "show ipv6 ospf6 database self-originated [<detail|dump|internal>] [json]", |
508e53e2 | 827 | SHOW_STR |
828 | IPV6_STR | |
829 | OSPF6_STR | |
16cedbb0 | 830 | "Display Link state database\n" |
508e53e2 | 831 | "Display Self-originated LSAs\n" |
14b16482 DW |
832 | "Display details of LSAs\n" |
833 | "Dump LSAs\n" | |
de851bf2 YR |
834 | "Display LSA's internal information\n" |
835 | JSON_STR) | |
718e3744 | 836 | { |
d62a17ae | 837 | int idx_level = 5; |
838 | int level; | |
d7c0a89a | 839 | uint32_t adv_router = 0; |
de851bf2 YR |
840 | bool uj = use_json(argc, argv); |
841 | struct ospf6 *ospf6; | |
d62a17ae | 842 | |
beadc736 | 843 | ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); |
844 | OSPF6_CMD_CHECK_RUNNING(ospf6); | |
d62a17ae | 845 | level = parse_show_level(idx_level, argc, argv); |
beadc736 | 846 | adv_router = ospf6->router_id; |
d62a17ae | 847 | |
de851bf2 | 848 | ospf6_lsdb_show_wrapper(vty, level, NULL, NULL, &adv_router, uj, ospf6); |
d62a17ae | 849 | return CMD_SUCCESS; |
718e3744 | 850 | } |
851 | ||
508e53e2 | 852 | |
853 | DEFUN (show_ipv6_ospf6_database_type_self_originated, | |
854 | show_ipv6_ospf6_database_type_self_originated_cmd, | |
de851bf2 | 855 | "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated [<detail|dump|internal>] [json]", |
508e53e2 | 856 | SHOW_STR |
857 | IPV6_STR | |
858 | OSPF6_STR | |
859 | "Display Link state database\n" | |
860 | "Display Router LSAs\n" | |
861 | "Display Network LSAs\n" | |
862 | "Display Inter-Area-Prefix LSAs\n" | |
863 | "Display Inter-Area-Router LSAs\n" | |
864 | "Display As-External LSAs\n" | |
865 | "Display Group-Membership LSAs\n" | |
866 | "Display Type-7 LSAs\n" | |
867 | "Display Link LSAs\n" | |
868 | "Display Intra-Area-Prefix LSAs\n" | |
869 | "Display Self-originated LSAs\n" | |
14b16482 DW |
870 | "Display details of LSAs\n" |
871 | "Dump LSAs\n" | |
de851bf2 YR |
872 | "Display LSA's internal information\n" |
873 | JSON_STR) | |
718e3744 | 874 | { |
d62a17ae | 875 | int idx_lsa = 4; |
876 | int idx_level = 6; | |
877 | int level; | |
d7c0a89a QY |
878 | uint16_t type = 0; |
879 | uint32_t adv_router = 0; | |
de851bf2 YR |
880 | bool uj = use_json(argc, argv); |
881 | struct ospf6 *ospf6; | |
d62a17ae | 882 | |
beadc736 | 883 | ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); |
884 | OSPF6_CMD_CHECK_RUNNING(ospf6); | |
d62a17ae | 885 | type = parse_type_spec(idx_lsa, argc, argv); |
886 | level = parse_show_level(idx_level, argc, argv); | |
887 | ||
beadc736 | 888 | adv_router = ospf6->router_id; |
d62a17ae | 889 | |
de851bf2 YR |
890 | ospf6_lsdb_type_show_wrapper(vty, level, &type, NULL, &adv_router, uj, |
891 | ospf6); | |
d62a17ae | 892 | return CMD_SUCCESS; |
049207c3 | 893 | } |
508e53e2 | 894 | |
049207c3 | 895 | DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, |
896 | show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd, | |
de851bf2 | 897 | "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated linkstate-id A.B.C.D [<detail|dump|internal>] [json]", |
049207c3 | 898 | SHOW_STR |
899 | IPV6_STR | |
900 | OSPF6_STR | |
901 | "Display Link state database\n" | |
902 | "Display Router LSAs\n" | |
903 | "Display Network LSAs\n" | |
904 | "Display Inter-Area-Prefix LSAs\n" | |
905 | "Display Inter-Area-Router LSAs\n" | |
906 | "Display As-External LSAs\n" | |
907 | "Display Group-Membership LSAs\n" | |
908 | "Display Type-7 LSAs\n" | |
909 | "Display Link LSAs\n" | |
910 | "Display Intra-Area-Prefix LSAs\n" | |
911 | "Display Self-originated LSAs\n" | |
912 | "Search by Link state ID\n" | |
913 | "Specify Link state ID as IPv4 address notation\n" | |
14b16482 DW |
914 | "Display details of LSAs\n" |
915 | "Dump LSAs\n" | |
de851bf2 YR |
916 | "Display LSA's internal information\n" |
917 | JSON_STR) | |
049207c3 | 918 | { |
d62a17ae | 919 | int idx_lsa = 4; |
920 | int idx_ls_id = 7; | |
921 | int idx_level = 8; | |
922 | int level; | |
d7c0a89a QY |
923 | uint16_t type = 0; |
924 | uint32_t adv_router = 0; | |
925 | uint32_t id = 0; | |
de851bf2 YR |
926 | bool uj = use_json(argc, argv); |
927 | struct ospf6 *ospf6; | |
d62a17ae | 928 | |
beadc736 | 929 | ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); |
930 | OSPF6_CMD_CHECK_RUNNING(ospf6); | |
d62a17ae | 931 | type = parse_type_spec(idx_lsa, argc, argv); |
932 | inet_pton(AF_INET, argv[idx_ls_id]->arg, &id); | |
933 | level = parse_show_level(idx_level, argc, argv); | |
beadc736 | 934 | adv_router = ospf6->router_id; |
d62a17ae | 935 | |
de851bf2 YR |
936 | ospf6_lsdb_type_show_wrapper(vty, level, &type, &id, &adv_router, uj, |
937 | ospf6); | |
d62a17ae | 938 | return CMD_SUCCESS; |
718e3744 | 939 | } |
718e3744 | 940 | |
508e53e2 | 941 | DEFUN (show_ipv6_ospf6_database_type_id_self_originated, |
942 | show_ipv6_ospf6_database_type_id_self_originated_cmd, | |
de851bf2 | 943 | "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> A.B.C.D self-originated [<detail|dump|internal>] [json]", |
508e53e2 | 944 | SHOW_STR |
945 | IPV6_STR | |
946 | OSPF6_STR | |
947 | "Display Link state database\n" | |
948 | "Display Router LSAs\n" | |
949 | "Display Network LSAs\n" | |
950 | "Display Inter-Area-Prefix LSAs\n" | |
951 | "Display Inter-Area-Router LSAs\n" | |
952 | "Display As-External LSAs\n" | |
953 | "Display Group-Membership LSAs\n" | |
954 | "Display Type-7 LSAs\n" | |
955 | "Display Link LSAs\n" | |
956 | "Display Intra-Area-Prefix LSAs\n" | |
957 | "Specify Link state ID as IPv4 address notation\n" | |
958 | "Display Self-originated LSAs\n" | |
14b16482 DW |
959 | "Display details of LSAs\n" |
960 | "Dump LSAs\n" | |
de851bf2 YR |
961 | "Display LSA's internal information\n" |
962 | JSON_STR) | |
718e3744 | 963 | { |
d62a17ae | 964 | int idx_lsa = 4; |
965 | int idx_ls_id = 5; | |
966 | int idx_level = 7; | |
967 | int level; | |
d7c0a89a QY |
968 | uint16_t type = 0; |
969 | uint32_t adv_router = 0; | |
970 | uint32_t id = 0; | |
de851bf2 YR |
971 | bool uj = use_json(argc, argv); |
972 | struct ospf6 *ospf6; | |
d62a17ae | 973 | |
beadc736 | 974 | ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); |
975 | OSPF6_CMD_CHECK_RUNNING(ospf6); | |
d62a17ae | 976 | type = parse_type_spec(idx_lsa, argc, argv); |
977 | inet_pton(AF_INET, argv[idx_ls_id]->arg, &id); | |
978 | level = parse_show_level(idx_level, argc, argv); | |
beadc736 | 979 | adv_router = ospf6->router_id; |
d62a17ae | 980 | |
de851bf2 YR |
981 | ospf6_lsdb_type_show_wrapper(vty, level, &type, &id, &adv_router, uj, |
982 | ospf6); | |
d62a17ae | 983 | return CMD_SUCCESS; |
718e3744 | 984 | } |
985 | ||
6452df09 | 986 | DEFUN (show_ipv6_ospf6_border_routers, |
987 | show_ipv6_ospf6_border_routers_cmd, | |
14b16482 | 988 | "show ipv6 ospf6 border-routers [<A.B.C.D|detail>]", |
6452df09 | 989 | SHOW_STR |
990 | IP6_STR | |
991 | OSPF6_STR | |
992 | "Display routing table for ABR and ASBR\n" | |
16cedbb0 QY |
993 | "Router ID\n" |
994 | "Show detailed output\n") | |
6452df09 | 995 | { |
d62a17ae | 996 | int idx_ipv4 = 4; |
d7c0a89a | 997 | uint32_t adv_router; |
d62a17ae | 998 | struct ospf6_route *ro; |
999 | struct prefix prefix; | |
beadc736 | 1000 | struct ospf6 *ospf6 = NULL; |
d62a17ae | 1001 | |
d62a17ae | 1002 | |
beadc736 | 1003 | ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); |
1004 | OSPF6_CMD_CHECK_RUNNING(ospf6); | |
d62a17ae | 1005 | if (argc == 5) { |
1006 | if (strmatch(argv[idx_ipv4]->text, "detail")) { | |
1007 | for (ro = ospf6_route_head(ospf6->brouter_table); ro; | |
1008 | ro = ospf6_route_next(ro)) | |
1009 | ospf6_route_show_detail(vty, ro); | |
1010 | } else { | |
1011 | inet_pton(AF_INET, argv[idx_ipv4]->arg, &adv_router); | |
1012 | ||
1013 | ospf6_linkstate_prefix(adv_router, 0, &prefix); | |
1014 | ro = ospf6_route_lookup(&prefix, ospf6->brouter_table); | |
1015 | if (!ro) { | |
1016 | vty_out(vty, | |
1017 | "No Route found for Router ID: %s\n", | |
1018 | argv[4]->arg); | |
1019 | return CMD_SUCCESS; | |
1020 | } | |
1021 | ||
1022 | ospf6_route_show_detail(vty, ro); | |
1023 | return CMD_SUCCESS; | |
1024 | } | |
1025 | } else { | |
1026 | ospf6_brouter_show_header(vty); | |
1027 | ||
1028 | for (ro = ospf6_route_head(ospf6->brouter_table); ro; | |
1029 | ro = ospf6_route_next(ro)) | |
1030 | ospf6_brouter_show(vty, ro); | |
1031 | } | |
1032 | ||
1033 | return CMD_SUCCESS; | |
6452df09 | 1034 | } |
1035 | ||
6452df09 | 1036 | |
4846ef64 | 1037 | DEFUN (show_ipv6_ospf6_linkstate, |
1038 | show_ipv6_ospf6_linkstate_cmd, | |
093d7a3a | 1039 | "show ipv6 ospf6 linkstate <router A.B.C.D|network A.B.C.D A.B.C.D>", |
4846ef64 | 1040 | SHOW_STR |
1041 | IP6_STR | |
1042 | OSPF6_STR | |
1043 | "Display linkstate routing table\n" | |
093d7a3a DW |
1044 | "Display Router Entry\n" |
1045 | "Specify Router ID as IPv4 address notation\n" | |
1046 | "Display Network Entry\n" | |
1047 | "Specify Router ID as IPv4 address notation\n" | |
3a2d747c | 1048 | "Specify Link state ID as IPv4 address notation\n") |
4846ef64 | 1049 | { |
2026b8af | 1050 | int idx_ipv4 = 5; |
d62a17ae | 1051 | struct listnode *node; |
1052 | struct ospf6_area *oa; | |
beadc736 | 1053 | struct ospf6 *ospf6 = NULL; |
4846ef64 | 1054 | |
beadc736 | 1055 | ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); |
1056 | OSPF6_CMD_CHECK_RUNNING(ospf6); | |
d62a17ae | 1057 | for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) { |
1058 | vty_out(vty, "\n SPF Result in Area %s\n\n", oa->name); | |
1059 | ospf6_linkstate_table_show(vty, idx_ipv4, argc, argv, | |
1060 | oa->spf_table); | |
1061 | } | |
4846ef64 | 1062 | |
d62a17ae | 1063 | vty_out(vty, "\n"); |
1064 | return CMD_SUCCESS; | |
4846ef64 | 1065 | } |
1066 | ||
4846ef64 | 1067 | |
4846ef64 | 1068 | DEFUN (show_ipv6_ospf6_linkstate_detail, |
1069 | show_ipv6_ospf6_linkstate_detail_cmd, | |
1070 | "show ipv6 ospf6 linkstate detail", | |
1071 | SHOW_STR | |
1072 | IP6_STR | |
1073 | OSPF6_STR | |
1074 | "Display linkstate routing table\n" | |
3a2d747c | 1075 | "Display detailed information\n") |
4846ef64 | 1076 | { |
d62a17ae | 1077 | int idx_detail = 4; |
1078 | struct listnode *node; | |
1079 | struct ospf6_area *oa; | |
beadc736 | 1080 | struct ospf6 *ospf6 = NULL; |
4846ef64 | 1081 | |
beadc736 | 1082 | ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); |
1083 | OSPF6_CMD_CHECK_RUNNING(ospf6); | |
b52a8a52 | 1084 | |
d62a17ae | 1085 | for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) { |
1086 | vty_out(vty, "\n SPF Result in Area %s\n\n", oa->name); | |
1087 | ospf6_linkstate_table_show(vty, idx_detail, argc, argv, | |
1088 | oa->spf_table); | |
1089 | } | |
4846ef64 | 1090 | |
d62a17ae | 1091 | vty_out(vty, "\n"); |
1092 | return CMD_SUCCESS; | |
4846ef64 | 1093 | } |
6452df09 | 1094 | |
427f8e61 DL |
1095 | static void ospf6_plist_add(struct prefix_list *plist) |
1096 | { | |
1097 | if (prefix_list_afi(plist) != AFI_IP6) | |
1098 | return; | |
1099 | ospf6_area_plist_update(plist, 1); | |
1100 | } | |
1101 | ||
1102 | static void ospf6_plist_del(struct prefix_list *plist) | |
1103 | { | |
1104 | if (prefix_list_afi(plist) != AFI_IP6) | |
1105 | return; | |
1106 | ospf6_area_plist_update(plist, 0); | |
1107 | } | |
1108 | ||
718e3744 | 1109 | /* Install ospf related commands. */ |
beadc736 | 1110 | void ospf6_init(struct thread_master *master) |
718e3744 | 1111 | { |
d62a17ae | 1112 | ospf6_top_init(); |
1113 | ospf6_area_init(); | |
1114 | ospf6_interface_init(); | |
1115 | ospf6_neighbor_init(); | |
1116 | ospf6_zebra_init(master); | |
1117 | ||
1118 | ospf6_lsa_init(); | |
1119 | ospf6_spf_init(); | |
1120 | ospf6_intra_init(); | |
1121 | ospf6_asbr_init(); | |
1122 | ospf6_abr_init(); | |
1123 | ||
427f8e61 DL |
1124 | prefix_list_add_hook(ospf6_plist_add); |
1125 | prefix_list_delete_hook(ospf6_plist_del); | |
1126 | ||
d62a17ae | 1127 | ospf6_bfd_init(); |
612c2c15 | 1128 | install_node(&debug_node); |
d62a17ae | 1129 | |
1130 | install_element_ospf6_debug_message(); | |
1131 | install_element_ospf6_debug_lsa(); | |
1132 | install_element_ospf6_debug_interface(); | |
1133 | install_element_ospf6_debug_neighbor(); | |
1134 | install_element_ospf6_debug_zebra(); | |
1135 | install_element_ospf6_debug_spf(); | |
1136 | install_element_ospf6_debug_route(); | |
1137 | install_element_ospf6_debug_brouter(); | |
1138 | install_element_ospf6_debug_asbr(); | |
1139 | install_element_ospf6_debug_abr(); | |
1140 | install_element_ospf6_debug_flood(); | |
1141 | ||
1142 | install_element_ospf6_clear_interface(); | |
1143 | ||
dd73744d | 1144 | install_element(ENABLE_NODE, &show_debugging_ospf6_cmd); |
87f6dc50 | 1145 | |
d62a17ae | 1146 | install_element(VIEW_NODE, &show_ipv6_ospf6_border_routers_cmd); |
1147 | ||
1148 | install_element(VIEW_NODE, &show_ipv6_ospf6_linkstate_cmd); | |
1149 | install_element(VIEW_NODE, &show_ipv6_ospf6_linkstate_detail_cmd); | |
1150 | ||
1151 | install_element(VIEW_NODE, &show_ipv6_ospf6_database_cmd); | |
1152 | install_element(VIEW_NODE, &show_ipv6_ospf6_database_type_cmd); | |
1153 | install_element(VIEW_NODE, &show_ipv6_ospf6_database_id_cmd); | |
1154 | install_element(VIEW_NODE, &show_ipv6_ospf6_database_router_cmd); | |
1155 | install_element(VIEW_NODE, &show_ipv6_ospf6_database_type_id_cmd); | |
1156 | install_element(VIEW_NODE, &show_ipv6_ospf6_database_type_router_cmd); | |
1157 | install_element(VIEW_NODE, | |
1158 | &show_ipv6_ospf6_database_adv_router_linkstate_id_cmd); | |
1159 | install_element(VIEW_NODE, &show_ipv6_ospf6_database_id_router_cmd); | |
1160 | install_element(VIEW_NODE, | |
1161 | &show_ipv6_ospf6_database_type_id_router_cmd); | |
1162 | install_element( | |
1163 | VIEW_NODE, | |
1164 | &show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd); | |
1165 | install_element(VIEW_NODE, | |
1166 | &show_ipv6_ospf6_database_self_originated_cmd); | |
1167 | install_element(VIEW_NODE, | |
1168 | &show_ipv6_ospf6_database_type_self_originated_cmd); | |
1169 | install_element(VIEW_NODE, | |
1170 | &show_ipv6_ospf6_database_type_id_self_originated_cmd); | |
1171 | install_element( | |
1172 | VIEW_NODE, | |
1173 | &show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd); | |
da086a3b | 1174 | install_element(VIEW_NODE, &show_ipv6_ospf6_database_aggr_router_cmd); |
92300491 | 1175 | } |