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