blob: 6cc0764a322348c078e08dd6dd7e1811e3a29e8a [file] [log] [blame]
paul718e3742002-12-13 20:15:29 +00001/*
hasso508e53e2004-05-18 18:57:06 +00002 * Copyright (C) 2003 Yasuhiro Ohara
paul718e3742002-12-13 20:15:29 +00003 *
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 *
16 * You should have received a copy of the GNU General Public License
17 * along with GNU Zebra; see the file COPYING. If not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
20 */
21
hasso508e53e2004-05-18 18:57:06 +000022#include <zebra.h>
23
24#include "thread.h"
25#include "linklist.h"
26#include "vty.h"
27#include "command.h"
28
hasso508e53e2004-05-18 18:57:06 +000029#include "ospf6_proto.h"
30#include "ospf6_network.h"
31#include "ospf6_lsa.h"
32#include "ospf6_lsdb.h"
33#include "ospf6_message.h"
34#include "ospf6_route.h"
35#include "ospf6_zebra.h"
36#include "ospf6_spf.h"
37#include "ospf6_top.h"
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"
hasso049207c2004-08-04 20:02:13 +000043#include "ospf6_abr.h"
44#include "ospf6d.h"
paul718e3742002-12-13 20:15:29 +000045
46char ospf6_daemon_version[] = OSPF6_DAEMON_VERSION;
47
paul718e3742002-12-13 20:15:29 +000048void
hasso508e53e2004-05-18 18:57:06 +000049ospf6_debug ()
paul718e3742002-12-13 20:15:29 +000050{
hasso508e53e2004-05-18 18:57:06 +000051}
paul718e3742002-12-13 20:15:29 +000052
hasso508e53e2004-05-18 18:57:06 +000053static struct route_node *
54_route_next_until (struct route_node *node, struct route_node *limit)
55{
56 struct route_node *next;
57 struct route_node *start;
58
59 /* Node may be deleted from route_unlock_node so we have to preserve
60 next node's pointer. */
61
62 if (node->l_left)
paul718e3742002-12-13 20:15:29 +000063 {
hasso508e53e2004-05-18 18:57:06 +000064 next = node->l_left;
65 if (next == limit)
66 {
67 route_unlock_node (node);
68 return NULL;
69 }
70 route_lock_node (next);
71 route_unlock_node (node);
72 return next;
73 }
74 if (node->l_right)
75 {
76 next = node->l_right;
77 if (next == limit)
78 {
79 route_unlock_node (node);
80 return NULL;
81 }
82 route_lock_node (next);
83 route_unlock_node (node);
84 return next;
paul718e3742002-12-13 20:15:29 +000085 }
86
hasso508e53e2004-05-18 18:57:06 +000087 start = node;
88 while (node->parent)
paul718e3742002-12-13 20:15:29 +000089 {
hasso508e53e2004-05-18 18:57:06 +000090 if (node->parent->l_left == node && node->parent->l_right)
91 {
92 next = node->parent->l_right;
93 if (next == limit)
94 {
95 route_unlock_node (start);
96 return NULL;
97 }
98 route_lock_node (next);
99 route_unlock_node (start);
100 return next;
101 }
102 node = node->parent;
paul718e3742002-12-13 20:15:29 +0000103 }
104
hasso508e53e2004-05-18 18:57:06 +0000105 route_unlock_node (start);
106 return NULL;
paul718e3742002-12-13 20:15:29 +0000107}
108
hasso508e53e2004-05-18 18:57:06 +0000109struct route_node *
110route_prev (struct route_node *node)
paul718e3742002-12-13 20:15:29 +0000111{
hasso508e53e2004-05-18 18:57:06 +0000112 struct route_node *end;
113 struct route_node *prev = NULL;
paul718e3742002-12-13 20:15:29 +0000114
hasso508e53e2004-05-18 18:57:06 +0000115 if (node->parent == NULL)
116 {
117 route_unlock_node (node);
118 return NULL;
119 }
paul718e3742002-12-13 20:15:29 +0000120
hasso508e53e2004-05-18 18:57:06 +0000121 if (node->parent->l_left == node)
122 {
123 prev = node->parent;
124 route_lock_node (prev);
125 route_unlock_node (node);
126 return prev;
127 }
128
129 end = node;
130 node = node->parent;
131 route_lock_node (node);
132 while (node)
133 {
134 prev = node;
135 node = _route_next_until (node, end);
136 }
137 route_unlock_node (end);
138 route_lock_node (prev);
139
140 return prev;
paul718e3742002-12-13 20:15:29 +0000141}
142
hasso6452df02004-08-15 05:52:07 +0000143
144/* show database functions */
paul718e3742002-12-13 20:15:29 +0000145DEFUN (show_version_ospf6,
146 show_version_ospf6_cmd,
147 "show version ospf6",
148 SHOW_STR
hasso508e53e2004-05-18 18:57:06 +0000149 "Displays ospf6d version\n"
150 )
paul718e3742002-12-13 20:15:29 +0000151{
152 vty_out (vty, "Zebra OSPF6d Version: %s%s",
hasso049207c2004-08-04 20:02:13 +0000153 ospf6_daemon_version, VNL);
paul718e3742002-12-13 20:15:29 +0000154
155 return CMD_SUCCESS;
156}
157
hasso508e53e2004-05-18 18:57:06 +0000158struct cmd_node debug_node =
paul718e3742002-12-13 20:15:29 +0000159{
hasso508e53e2004-05-18 18:57:06 +0000160 DEBUG_NODE,
161 ""
162};
paul718e3742002-12-13 20:15:29 +0000163
164int
hasso508e53e2004-05-18 18:57:06 +0000165config_write_ospf6_debug (struct vty *vty)
paul718e3742002-12-13 20:15:29 +0000166{
hasso508e53e2004-05-18 18:57:06 +0000167 config_write_ospf6_debug_message (vty);
168 config_write_ospf6_debug_lsa (vty);
169 config_write_ospf6_debug_zebra (vty);
170 config_write_ospf6_debug_interface (vty);
171 config_write_ospf6_debug_neighbor (vty);
172 config_write_ospf6_debug_spf (vty);
173 config_write_ospf6_debug_route (vty);
174 config_write_ospf6_debug_asbr (vty);
hasso049207c2004-08-04 20:02:13 +0000175 config_write_ospf6_debug_abr (vty);
176 vty_out (vty, "!%s", VNL);
paul718e3742002-12-13 20:15:29 +0000177 return 0;
178}
179
hasso049207c2004-08-04 20:02:13 +0000180#define AREA_LSDB_TITLE_FORMAT \
181 "%s Area Scoped Link State Database (Area %s)%s%s"
182#define IF_LSDB_TITLE_FORMAT \
183 "%s I/F Scoped Link State Database (I/F %s in Area %s)%s%s"
184#define AS_LSDB_TITLE_FORMAT \
185 "%s AS Scoped Link State Database%s%s"
186
187static int
188parse_show_level (int argc, char **argv)
189{
hasso6452df02004-08-15 05:52:07 +0000190 int level = 0;
hasso049207c2004-08-04 20:02:13 +0000191 if (argc)
192 {
193 if (! strncmp (argv[0], "de", 2))
194 level = OSPF6_LSDB_SHOW_LEVEL_DETAIL;
195 else if (! strncmp (argv[0], "du", 2))
196 level = OSPF6_LSDB_SHOW_LEVEL_DUMP;
197 else if (! strncmp (argv[0], "in", 2))
198 level = OSPF6_LSDB_SHOW_LEVEL_INTERNAL;
199 }
200 else
201 level = OSPF6_LSDB_SHOW_LEVEL_NORMAL;
202 return level;
203}
204
205static u_int16_t
206parse_type_spec (int argc, char **argv)
207{
hasso6452df02004-08-15 05:52:07 +0000208 u_int16_t type = 0;
hasso049207c2004-08-04 20:02:13 +0000209 assert (argc);
210 if (! strcmp (argv[0], "router"))
211 type = htons (OSPF6_LSTYPE_ROUTER);
212 else if (! strcmp (argv[0], "network"))
213 type = htons (OSPF6_LSTYPE_NETWORK);
214 else if (! strcmp (argv[0], "as-external"))
215 type = htons (OSPF6_LSTYPE_AS_EXTERNAL);
216 else if (! strcmp (argv[0], "intra-prefix"))
217 type = htons (OSPF6_LSTYPE_INTRA_PREFIX);
218 else if (! strcmp (argv[0], "inter-router"))
219 type = htons (OSPF6_LSTYPE_INTER_ROUTER);
220 else if (! strcmp (argv[0], "inter-prefix"))
221 type = htons (OSPF6_LSTYPE_INTER_PREFIX);
222 else if (! strcmp (argv[0], "link"))
223 type = htons (OSPF6_LSTYPE_LINK);
224 return type;
225}
226
hasso508e53e2004-05-18 18:57:06 +0000227DEFUN (show_ipv6_ospf6_database,
228 show_ipv6_ospf6_database_cmd,
229 "show ipv6 ospf6 database",
230 SHOW_STR
231 IPV6_STR
232 OSPF6_STR
233 "Display Link state database\n"
234 )
paul718e3742002-12-13 20:15:29 +0000235{
hasso049207c2004-08-04 20:02:13 +0000236 int level;
hasso508e53e2004-05-18 18:57:06 +0000237 listnode i, j;
238 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +0000239 struct ospf6_area *oa;
240 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +0000241
242 OSPF6_CMD_CHECK_RUNNING ();
243
hasso049207c2004-08-04 20:02:13 +0000244 level = parse_show_level (argc, argv);
hasso508e53e2004-05-18 18:57:06 +0000245
hasso508e53e2004-05-18 18:57:06 +0000246 for (i = listhead (o->area_list); i; nextnode (i))
247 {
hasso049207c2004-08-04 20:02:13 +0000248 oa = (struct ospf6_area *) getdata (i);
249 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
250 ospf6_lsdb_show (vty, level, NULL, NULL, NULL, oa->lsdb);
hasso508e53e2004-05-18 18:57:06 +0000251 }
hasso049207c2004-08-04 20:02:13 +0000252
hasso508e53e2004-05-18 18:57:06 +0000253 for (i = listhead (o->area_list); i; nextnode (i))
254 {
hasso049207c2004-08-04 20:02:13 +0000255 oa = (struct ospf6_area *) getdata (i);
hasso508e53e2004-05-18 18:57:06 +0000256 for (j = listhead (oa->if_list); j; nextnode (j))
257 {
hasso049207c2004-08-04 20:02:13 +0000258 oi = (struct ospf6_interface *) getdata (j);
259 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
260 oi->interface->name, oa->name, VNL, VNL);
261 ospf6_lsdb_show (vty, level, NULL, NULL, NULL, oi->lsdb);
hasso508e53e2004-05-18 18:57:06 +0000262 }
263 }
264
hasso049207c2004-08-04 20:02:13 +0000265 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
266 ospf6_lsdb_show (vty, level, NULL, NULL, NULL, o->lsdb);
267
268 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +0000269 return CMD_SUCCESS;
270}
271
272ALIAS (show_ipv6_ospf6_database,
273 show_ipv6_ospf6_database_detail_cmd,
274 "show ipv6 ospf6 database (detail|dump|internal)",
275 SHOW_STR
276 IPV6_STR
277 OSPF6_STR
278 "Display Link state database\n"
279 "Display details of LSAs\n"
280 "Dump LSAs\n"
281 "Display LSA's internal information\n"
282 );
283
284DEFUN (show_ipv6_ospf6_database_type,
285 show_ipv6_ospf6_database_type_cmd,
286 "show ipv6 ospf6 database "
287 "(router|network|inter-prefix|inter-router|as-external|"
288 "group-membership|type-7|link|intra-prefix)",
289 SHOW_STR
290 IPV6_STR
291 OSPF6_STR
292 "Display Link state database\n"
293 "Display Router LSAs\n"
294 "Display Network LSAs\n"
295 "Display Inter-Area-Prefix LSAs\n"
296 "Display Inter-Area-Router LSAs\n"
297 "Display As-External LSAs\n"
298 "Display Group-Membership LSAs\n"
299 "Display Type-7 LSAs\n"
300 "Display Link LSAs\n"
301 "Display Intra-Area-Prefix LSAs\n"
302 )
303{
hasso049207c2004-08-04 20:02:13 +0000304 int level;
hasso508e53e2004-05-18 18:57:06 +0000305 listnode i, j;
306 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +0000307 struct ospf6_area *oa;
308 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +0000309 u_int16_t type = 0;
310
311 OSPF6_CMD_CHECK_RUNNING ();
312
hasso049207c2004-08-04 20:02:13 +0000313 type = parse_type_spec (argc, argv);
314 argc--;
315 argv++;
316 level = parse_show_level (argc, argv);
hasso508e53e2004-05-18 18:57:06 +0000317
hasso049207c2004-08-04 20:02:13 +0000318 switch (OSPF6_LSA_SCOPE (type))
hasso508e53e2004-05-18 18:57:06 +0000319 {
hasso6452df02004-08-15 05:52:07 +0000320 case OSPF6_SCOPE_AREA:
hasso049207c2004-08-04 20:02:13 +0000321 for (i = listhead (o->area_list); i; nextnode (i))
322 {
323 oa = (struct ospf6_area *) getdata (i);
324 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
325 ospf6_lsdb_show (vty, level, &type, NULL, NULL, oa->lsdb);
326 }
327 break;
328
hasso6452df02004-08-15 05:52:07 +0000329 case OSPF6_SCOPE_LINKLOCAL:
hasso049207c2004-08-04 20:02:13 +0000330 for (i = listhead (o->area_list); i; nextnode (i))
331 {
332 oa = (struct ospf6_area *) getdata (i);
333 for (j = listhead (oa->if_list); j; nextnode (j))
334 {
335 oi = (struct ospf6_interface *) getdata (j);
336 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
337 oi->interface->name, oa->name, VNL, VNL);
338 ospf6_lsdb_show (vty, level, &type, NULL, NULL, oi->lsdb);
339 }
340 }
341 break;
342
hasso6452df02004-08-15 05:52:07 +0000343 case OSPF6_SCOPE_AS:
hasso049207c2004-08-04 20:02:13 +0000344 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
345 ospf6_lsdb_show (vty, level, &type, NULL, NULL, o->lsdb);
346 break;
347
348 default:
349 assert (0);
350 break;
hasso508e53e2004-05-18 18:57:06 +0000351 }
352
hasso049207c2004-08-04 20:02:13 +0000353 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +0000354 return CMD_SUCCESS;
355}
356
357ALIAS (show_ipv6_ospf6_database_type,
358 show_ipv6_ospf6_database_type_detail_cmd,
359 "show ipv6 ospf6 database "
360 "(router|network|inter-prefix|inter-router|as-external|"
361 "group-membership|type-7|link|intra-prefix) "
362 "(detail|dump|internal)",
363 SHOW_STR
364 IPV6_STR
365 OSPF6_STR
366 "Display Link state database\n"
367 "Display Router LSAs\n"
368 "Display Network LSAs\n"
369 "Display Inter-Area-Prefix LSAs\n"
370 "Display Inter-Area-Router LSAs\n"
371 "Display As-External LSAs\n"
372 "Display Group-Membership LSAs\n"
373 "Display Type-7 LSAs\n"
374 "Display Link LSAs\n"
375 "Display Intra-Area-Prefix LSAs\n"
376 "Display details of LSAs\n"
377 "Dump LSAs\n"
378 "Display LSA's internal information\n"
379 );
380
381DEFUN (show_ipv6_ospf6_database_id,
382 show_ipv6_ospf6_database_id_cmd,
383 "show ipv6 ospf6 database * A.B.C.D",
384 SHOW_STR
385 IPV6_STR
386 OSPF6_STR
387 "Display Link state database\n"
388 "Any Link state Type\n"
389 "Specify Link state ID as IPv4 address notation\n"
390 )
391{
hasso049207c2004-08-04 20:02:13 +0000392 int level;
hasso508e53e2004-05-18 18:57:06 +0000393 listnode i, j;
394 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +0000395 struct ospf6_area *oa;
396 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +0000397 u_int32_t id = 0;
398
399 OSPF6_CMD_CHECK_RUNNING ();
400
hasso508e53e2004-05-18 18:57:06 +0000401 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
402 {
403 vty_out (vty, "Link State ID is not parsable: %s%s",
hasso049207c2004-08-04 20:02:13 +0000404 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000405 return CMD_SUCCESS;
406 }
407
hasso049207c2004-08-04 20:02:13 +0000408 argc--;
409 argv++;
410 level = parse_show_level (argc, argv);
411
hasso508e53e2004-05-18 18:57:06 +0000412 for (i = listhead (o->area_list); i; nextnode (i))
413 {
hasso049207c2004-08-04 20:02:13 +0000414 oa = (struct ospf6_area *) getdata (i);
415 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
416 ospf6_lsdb_show (vty, level, NULL, &id, NULL, oa->lsdb);
hasso508e53e2004-05-18 18:57:06 +0000417 }
hasso049207c2004-08-04 20:02:13 +0000418
hasso508e53e2004-05-18 18:57:06 +0000419 for (i = listhead (o->area_list); i; nextnode (i))
420 {
hasso049207c2004-08-04 20:02:13 +0000421 oa = (struct ospf6_area *) getdata (i);
hasso508e53e2004-05-18 18:57:06 +0000422 for (j = listhead (oa->if_list); j; nextnode (j))
423 {
hasso049207c2004-08-04 20:02:13 +0000424 oi = (struct ospf6_interface *) getdata (j);
425 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
426 oi->interface->name, oa->name, VNL, VNL);
427 ospf6_lsdb_show (vty, level, NULL, &id, NULL, oi->lsdb);
hasso508e53e2004-05-18 18:57:06 +0000428 }
429 }
430
hasso049207c2004-08-04 20:02:13 +0000431 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
432 ospf6_lsdb_show (vty, level, NULL, &id, NULL, o->lsdb);
433
434 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +0000435 return CMD_SUCCESS;
436}
437
438ALIAS (show_ipv6_ospf6_database_id,
439 show_ipv6_ospf6_database_id_detail_cmd,
440 "show ipv6 ospf6 database * A.B.C.D "
441 "(detail|dump|internal)",
442 SHOW_STR
443 IPV6_STR
444 OSPF6_STR
445 "Display Link state database\n"
446 "Any Link state Type\n"
hasso049207c2004-08-04 20:02:13 +0000447 "Specify Link state ID as IPv4 address notation\n"
448 "Display details of LSAs\n"
449 "Dump LSAs\n"
450 "Display LSA's internal information\n"
451 );
452
453ALIAS (show_ipv6_ospf6_database_id,
454 show_ipv6_ospf6_database_linkstate_id_cmd,
455 "show ipv6 ospf6 database linkstate-id A.B.C.D",
456 SHOW_STR
457 IPV6_STR
458 OSPF6_STR
459 "Display Link state database\n"
460 "Search by Link state ID\n"
461 "Specify Link state ID as IPv4 address notation\n"
462 );
463
464ALIAS (show_ipv6_ospf6_database_id,
465 show_ipv6_ospf6_database_linkstate_id_detail_cmd,
466 "show ipv6 ospf6 database linkstate-id A.B.C.D "
467 "(detail|dump|internal)",
468 SHOW_STR
469 IPV6_STR
470 OSPF6_STR
471 "Display Link state database\n"
472 "Search by Link state ID\n"
hasso508e53e2004-05-18 18:57:06 +0000473 "Specify Link state ID as IPv4 address notation\n"
474 "Display details of LSAs\n"
475 "Dump LSAs\n"
476 "Display LSA's internal information\n"
477 );
478
479DEFUN (show_ipv6_ospf6_database_router,
480 show_ipv6_ospf6_database_router_cmd,
481 "show ipv6 ospf6 database * * A.B.C.D",
482 SHOW_STR
483 IPV6_STR
484 OSPF6_STR
485 "Display Link state database\n"
486 "Any Link state Type\n"
487 "Any Link state ID\n"
488 "Specify Advertising Router as IPv4 address notation\n"
489 )
490{
hasso049207c2004-08-04 20:02:13 +0000491 int level;
hasso508e53e2004-05-18 18:57:06 +0000492 listnode i, j;
493 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +0000494 struct ospf6_area *oa;
495 struct ospf6_interface *oi;
496 u_int32_t adv_router = 0;
hasso508e53e2004-05-18 18:57:06 +0000497
498 OSPF6_CMD_CHECK_RUNNING ();
499
hasso049207c2004-08-04 20:02:13 +0000500 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
hasso508e53e2004-05-18 18:57:06 +0000501 {
502 vty_out (vty, "Advertising Router is not parsable: %s%s",
hasso049207c2004-08-04 20:02:13 +0000503 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000504 return CMD_SUCCESS;
505 }
506
hasso049207c2004-08-04 20:02:13 +0000507 argc--;
508 argv++;
509 level = parse_show_level (argc, argv);
510
hasso508e53e2004-05-18 18:57:06 +0000511 for (i = listhead (o->area_list); i; nextnode (i))
512 {
hasso049207c2004-08-04 20:02:13 +0000513 oa = (struct ospf6_area *) getdata (i);
514 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
515 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oa->lsdb);
hasso508e53e2004-05-18 18:57:06 +0000516 }
hasso049207c2004-08-04 20:02:13 +0000517
hasso508e53e2004-05-18 18:57:06 +0000518 for (i = listhead (o->area_list); i; nextnode (i))
519 {
hasso049207c2004-08-04 20:02:13 +0000520 oa = (struct ospf6_area *) getdata (i);
hasso508e53e2004-05-18 18:57:06 +0000521 for (j = listhead (oa->if_list); j; nextnode (j))
522 {
hasso049207c2004-08-04 20:02:13 +0000523 oi = (struct ospf6_interface *) getdata (j);
524 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
525 oi->interface->name, oa->name, VNL, VNL);
526 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oi->lsdb);
hasso508e53e2004-05-18 18:57:06 +0000527 }
528 }
529
hasso049207c2004-08-04 20:02:13 +0000530 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
531 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, o->lsdb);
532
533 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +0000534 return CMD_SUCCESS;
535}
536
537ALIAS (show_ipv6_ospf6_database_router,
538 show_ipv6_ospf6_database_router_detail_cmd,
539 "show ipv6 ospf6 database * * A.B.C.D "
540 "(detail|dump|internal)",
541 SHOW_STR
542 IPV6_STR
543 OSPF6_STR
544 "Display Link state database\n"
545 "Any Link state Type\n"
546 "Any Link state ID\n"
547 "Specify Advertising Router as IPv4 address notation\n"
548 "Display details of LSAs\n"
549 "Dump LSAs\n"
550 "Display LSA's internal information\n"
551 );
552
hasso049207c2004-08-04 20:02:13 +0000553ALIAS (show_ipv6_ospf6_database_router,
554 show_ipv6_ospf6_database_adv_router_cmd,
555 "show ipv6 ospf6 database adv-router A.B.C.D",
556 SHOW_STR
557 IPV6_STR
558 OSPF6_STR
559 "Display Link state database\n"
560 "Search by Advertising Router\n"
561 "Specify Advertising Router as IPv4 address notation\n"
562 );
563
564ALIAS (show_ipv6_ospf6_database_router,
565 show_ipv6_ospf6_database_adv_router_detail_cmd,
566 "show ipv6 ospf6 database adv-router A.B.C.D "
567 "(detail|dump|internal)",
568 SHOW_STR
569 IPV6_STR
570 OSPF6_STR
571 "Display Link state database\n"
572 "Search by Advertising Router\n"
573 "Specify Advertising Router as IPv4 address notation\n"
574 "Display details of LSAs\n"
575 "Dump LSAs\n"
576 "Display LSA's internal information\n"
577 );
578
hasso508e53e2004-05-18 18:57:06 +0000579DEFUN (show_ipv6_ospf6_database_type_id,
580 show_ipv6_ospf6_database_type_id_cmd,
581 "show ipv6 ospf6 database "
582 "(router|network|inter-prefix|inter-router|as-external|"
583 "group-membership|type-7|link|intra-prefix) A.B.C.D",
584 SHOW_STR
585 IPV6_STR
586 OSPF6_STR
587 "Display Link state database\n"
588 "Display Router LSAs\n"
589 "Display Network LSAs\n"
590 "Display Inter-Area-Prefix LSAs\n"
591 "Display Inter-Area-Router LSAs\n"
592 "Display As-External LSAs\n"
593 "Display Group-Membership LSAs\n"
594 "Display Type-7 LSAs\n"
595 "Display Link LSAs\n"
596 "Display Intra-Area-Prefix LSAs\n"
597 "Specify Link state ID as IPv4 address notation\n"
598 )
599{
hasso049207c2004-08-04 20:02:13 +0000600 int level;
hasso508e53e2004-05-18 18:57:06 +0000601 listnode i, j;
602 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +0000603 struct ospf6_area *oa;
604 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +0000605 u_int16_t type = 0;
606 u_int32_t id = 0;
607
608 OSPF6_CMD_CHECK_RUNNING ();
609
hasso049207c2004-08-04 20:02:13 +0000610 type = parse_type_spec (argc, argv);
611 argc--;
612 argv++;
hasso508e53e2004-05-18 18:57:06 +0000613
hasso049207c2004-08-04 20:02:13 +0000614 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
hasso508e53e2004-05-18 18:57:06 +0000615 {
616 vty_out (vty, "Link state ID is not parsable: %s%s",
hasso049207c2004-08-04 20:02:13 +0000617 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000618 return CMD_SUCCESS;
619 }
620
hasso049207c2004-08-04 20:02:13 +0000621 argc--;
622 argv++;
623 level = parse_show_level (argc, argv);
624
625 switch (OSPF6_LSA_SCOPE (type))
hasso508e53e2004-05-18 18:57:06 +0000626 {
hasso6452df02004-08-15 05:52:07 +0000627 case OSPF6_SCOPE_AREA:
hasso049207c2004-08-04 20:02:13 +0000628 for (i = listhead (o->area_list); i; nextnode (i))
629 {
630 oa = (struct ospf6_area *) getdata (i);
631 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
632 ospf6_lsdb_show (vty, level, &type, &id, NULL, oa->lsdb);
633 }
634 break;
635
hasso6452df02004-08-15 05:52:07 +0000636 case OSPF6_SCOPE_LINKLOCAL:
hasso049207c2004-08-04 20:02:13 +0000637 for (i = listhead (o->area_list); i; nextnode (i))
638 {
639 oa = (struct ospf6_area *) getdata (i);
640 for (j = listhead (oa->if_list); j; nextnode (j))
641 {
642 oi = (struct ospf6_interface *) getdata (j);
643 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
644 oi->interface->name, oa->name, VNL, VNL);
645 ospf6_lsdb_show (vty, level, &type, &id, NULL, oi->lsdb);
646 }
647 }
648 break;
649
hasso6452df02004-08-15 05:52:07 +0000650 case OSPF6_SCOPE_AS:
hasso049207c2004-08-04 20:02:13 +0000651 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
652 ospf6_lsdb_show (vty, level, &type, &id, NULL, o->lsdb);
653 break;
654
655 default:
656 assert (0);
657 break;
hasso508e53e2004-05-18 18:57:06 +0000658 }
659
hasso049207c2004-08-04 20:02:13 +0000660 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +0000661 return CMD_SUCCESS;
662}
663
664ALIAS (show_ipv6_ospf6_database_type_id,
665 show_ipv6_ospf6_database_type_id_detail_cmd,
666 "show ipv6 ospf6 database "
667 "(router|network|inter-prefix|inter-router|as-external|"
668 "group-membership|type-7|link|intra-prefix) A.B.C.D "
669 "(detail|dump|internal)",
670 SHOW_STR
671 IPV6_STR
672 OSPF6_STR
673 "Display Link state database\n"
674 "Display Router LSAs\n"
675 "Display Network LSAs\n"
676 "Display Inter-Area-Prefix LSAs\n"
677 "Display Inter-Area-Router LSAs\n"
678 "Display As-External LSAs\n"
679 "Display Group-Membership LSAs\n"
680 "Display Type-7 LSAs\n"
681 "Display Link LSAs\n"
682 "Display Intra-Area-Prefix LSAs\n"
683 "Specify Link state ID as IPv4 address notation\n"
684 "Display details of LSAs\n"
685 "Dump LSAs\n"
686 "Display LSA's internal information\n"
687 );
688
hasso049207c2004-08-04 20:02:13 +0000689ALIAS (show_ipv6_ospf6_database_type_id,
690 show_ipv6_ospf6_database_type_linkstate_id_cmd,
691 "show ipv6 ospf6 database "
692 "(router|network|inter-prefix|inter-router|as-external|"
693 "group-membership|type-7|link|intra-prefix) linkstate-id A.B.C.D",
694 SHOW_STR
695 IPV6_STR
696 OSPF6_STR
697 "Display Link state database\n"
698 "Display Router LSAs\n"
699 "Display Network LSAs\n"
700 "Display Inter-Area-Prefix LSAs\n"
701 "Display Inter-Area-Router LSAs\n"
702 "Display As-External LSAs\n"
703 "Display Group-Membership LSAs\n"
704 "Display Type-7 LSAs\n"
705 "Display Link LSAs\n"
706 "Display Intra-Area-Prefix LSAs\n"
707 "Search by Link state ID\n"
708 "Specify Link state ID as IPv4 address notation\n"
709 );
710
711ALIAS (show_ipv6_ospf6_database_type_id,
712 show_ipv6_ospf6_database_type_linkstate_id_detail_cmd,
713 "show ipv6 ospf6 database "
714 "(router|network|inter-prefix|inter-router|as-external|"
715 "group-membership|type-7|link|intra-prefix) linkstate-id A.B.C.D "
716 "(detail|dump|internal)",
717 SHOW_STR
718 IPV6_STR
719 OSPF6_STR
720 "Display Link state database\n"
721 "Display Router LSAs\n"
722 "Display Network LSAs\n"
723 "Display Inter-Area-Prefix LSAs\n"
724 "Display Inter-Area-Router LSAs\n"
725 "Display As-External LSAs\n"
726 "Display Group-Membership LSAs\n"
727 "Display Type-7 LSAs\n"
728 "Display Link LSAs\n"
729 "Display Intra-Area-Prefix LSAs\n"
730 "Search by Link state ID\n"
731 "Specify Link state ID as IPv4 address notation\n"
732 "Display details of LSAs\n"
733 "Dump LSAs\n"
734 "Display LSA's internal information\n"
735 );
736
hasso508e53e2004-05-18 18:57:06 +0000737DEFUN (show_ipv6_ospf6_database_type_router,
738 show_ipv6_ospf6_database_type_router_cmd,
739 "show ipv6 ospf6 database "
740 "(router|network|inter-prefix|inter-router|as-external|"
741 "group-membership|type-7|link|intra-prefix) * A.B.C.D",
742 SHOW_STR
743 IPV6_STR
744 OSPF6_STR
745 "Display Link state database\n"
746 "Display Router LSAs\n"
747 "Display Network LSAs\n"
748 "Display Inter-Area-Prefix LSAs\n"
749 "Display Inter-Area-Router LSAs\n"
750 "Display As-External LSAs\n"
751 "Display Group-Membership LSAs\n"
752 "Display Type-7 LSAs\n"
753 "Display Link LSAs\n"
754 "Display Intra-Area-Prefix LSAs\n"
755 "Any Link state ID\n"
756 "Specify Advertising Router as IPv4 address notation\n"
757 )
758{
hasso049207c2004-08-04 20:02:13 +0000759 int level;
hasso508e53e2004-05-18 18:57:06 +0000760 listnode i, j;
761 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +0000762 struct ospf6_area *oa;
763 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +0000764 u_int16_t type = 0;
hasso049207c2004-08-04 20:02:13 +0000765 u_int32_t adv_router = 0;
hasso508e53e2004-05-18 18:57:06 +0000766
767 OSPF6_CMD_CHECK_RUNNING ();
768
hasso049207c2004-08-04 20:02:13 +0000769 type = parse_type_spec (argc, argv);
770 argc--;
771 argv++;
hasso508e53e2004-05-18 18:57:06 +0000772
hasso049207c2004-08-04 20:02:13 +0000773 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
hasso508e53e2004-05-18 18:57:06 +0000774 {
775 vty_out (vty, "Advertising Router is not parsable: %s%s",
hasso049207c2004-08-04 20:02:13 +0000776 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000777 return CMD_SUCCESS;
778 }
779
hasso049207c2004-08-04 20:02:13 +0000780 argc--;
781 argv++;
782 level = parse_show_level (argc, argv);
783
784 switch (OSPF6_LSA_SCOPE (type))
hasso508e53e2004-05-18 18:57:06 +0000785 {
hasso6452df02004-08-15 05:52:07 +0000786 case OSPF6_SCOPE_AREA:
hasso049207c2004-08-04 20:02:13 +0000787 for (i = listhead (o->area_list); i; nextnode (i))
788 {
789 oa = (struct ospf6_area *) getdata (i);
790 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
791 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oa->lsdb);
792 }
793 break;
794
hasso6452df02004-08-15 05:52:07 +0000795 case OSPF6_SCOPE_LINKLOCAL:
hasso049207c2004-08-04 20:02:13 +0000796 for (i = listhead (o->area_list); i; nextnode (i))
797 {
798 oa = (struct ospf6_area *) getdata (i);
799 for (j = listhead (oa->if_list); j; nextnode (j))
800 {
801 oi = (struct ospf6_interface *) getdata (j);
802 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
803 oi->interface->name, oa->name, VNL, VNL);
804 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oi->lsdb);
805 }
806 }
807 break;
808
hasso6452df02004-08-15 05:52:07 +0000809 case OSPF6_SCOPE_AS:
hasso049207c2004-08-04 20:02:13 +0000810 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
811 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, o->lsdb);
812 break;
813
814 default:
815 assert (0);
816 break;
hasso508e53e2004-05-18 18:57:06 +0000817 }
818
hasso049207c2004-08-04 20:02:13 +0000819 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +0000820 return CMD_SUCCESS;
821}
822
823ALIAS (show_ipv6_ospf6_database_type_router,
824 show_ipv6_ospf6_database_type_router_detail_cmd,
825 "show ipv6 ospf6 database "
826 "(router|network|inter-prefix|inter-router|as-external|"
827 "group-membership|type-7|link|intra-prefix) * A.B.C.D "
828 "(detail|dump|internal)",
829 SHOW_STR
830 IPV6_STR
831 OSPF6_STR
832 "Display Link state database\n"
833 "Display Router LSAs\n"
834 "Display Network LSAs\n"
835 "Display Inter-Area-Prefix LSAs\n"
836 "Display Inter-Area-Router LSAs\n"
837 "Display As-External LSAs\n"
838 "Display Group-Membership LSAs\n"
839 "Display Type-7 LSAs\n"
840 "Display Link LSAs\n"
841 "Display Intra-Area-Prefix LSAs\n"
842 "Any Link state ID\n"
843 "Specify Advertising Router as IPv4 address notation\n"
844 "Display details of LSAs\n"
845 "Dump LSAs\n"
846 "Display LSA's internal information\n"
847 );
848
hasso049207c2004-08-04 20:02:13 +0000849ALIAS (show_ipv6_ospf6_database_type_router,
850 show_ipv6_ospf6_database_type_adv_router_cmd,
851 "show ipv6 ospf6 database "
852 "(router|network|inter-prefix|inter-router|as-external|"
853 "group-membership|type-7|link|intra-prefix) adv-router A.B.C.D",
854 SHOW_STR
855 IPV6_STR
856 OSPF6_STR
857 "Display Link state database\n"
858 "Display Router LSAs\n"
859 "Display Network LSAs\n"
860 "Display Inter-Area-Prefix LSAs\n"
861 "Display Inter-Area-Router LSAs\n"
862 "Display As-External LSAs\n"
863 "Display Group-Membership LSAs\n"
864 "Display Type-7 LSAs\n"
865 "Display Link LSAs\n"
866 "Display Intra-Area-Prefix LSAs\n"
867 "Search by Advertising Router\n"
868 "Specify Advertising Router as IPv4 address notation\n"
869 );
870
871ALIAS (show_ipv6_ospf6_database_type_router,
872 show_ipv6_ospf6_database_type_adv_router_detail_cmd,
873 "show ipv6 ospf6 database "
874 "(router|network|inter-prefix|inter-router|as-external|"
875 "group-membership|type-7|link|intra-prefix) adv-router A.B.C.D "
876 "(detail|dump|internal)",
877 SHOW_STR
878 IPV6_STR
879 OSPF6_STR
880 "Display Link state database\n"
881 "Display Router LSAs\n"
882 "Display Network LSAs\n"
883 "Display Inter-Area-Prefix LSAs\n"
884 "Display Inter-Area-Router LSAs\n"
885 "Display As-External LSAs\n"
886 "Display Group-Membership LSAs\n"
887 "Display Type-7 LSAs\n"
888 "Display Link LSAs\n"
889 "Display Intra-Area-Prefix LSAs\n"
890 "Search by Advertising Router\n"
891 "Specify Advertising Router as IPv4 address notation\n"
892 "Display details of LSAs\n"
893 "Dump LSAs\n"
894 "Display LSA's internal information\n"
895 );
896
hasso508e53e2004-05-18 18:57:06 +0000897DEFUN (show_ipv6_ospf6_database_id_router,
898 show_ipv6_ospf6_database_id_router_cmd,
899 "show ipv6 ospf6 database * A.B.C.D A.B.C.D",
900 SHOW_STR
901 IPV6_STR
902 OSPF6_STR
903 "Display Link state database\n"
904 "Any Link state Type\n"
905 "Specify Link state ID as IPv4 address notation\n"
906 "Specify Advertising Router as IPv4 address notation\n"
907 )
908{
hasso049207c2004-08-04 20:02:13 +0000909 int level;
hasso508e53e2004-05-18 18:57:06 +0000910 listnode i, j;
911 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +0000912 struct ospf6_area *oa;
913 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +0000914 u_int32_t id = 0;
hasso049207c2004-08-04 20:02:13 +0000915 u_int32_t adv_router = 0;
hasso508e53e2004-05-18 18:57:06 +0000916
917 OSPF6_CMD_CHECK_RUNNING ();
918
hasso508e53e2004-05-18 18:57:06 +0000919 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
920 {
921 vty_out (vty, "Link state ID is not parsable: %s%s",
hasso6452df02004-08-15 05:52:07 +0000922 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000923 return CMD_SUCCESS;
924 }
925
hasso049207c2004-08-04 20:02:13 +0000926 argc--;
927 argv++;
928
929 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
hasso508e53e2004-05-18 18:57:06 +0000930 {
931 vty_out (vty, "Advertising Router is not parsable: %s%s",
hasso049207c2004-08-04 20:02:13 +0000932 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000933 return CMD_SUCCESS;
934 }
935
hasso049207c2004-08-04 20:02:13 +0000936 argc--;
937 argv++;
938 level = parse_show_level (argc, argv);
939
hasso508e53e2004-05-18 18:57:06 +0000940 for (i = listhead (o->area_list); i; nextnode (i))
941 {
hasso049207c2004-08-04 20:02:13 +0000942 oa = (struct ospf6_area *) getdata (i);
943 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
944 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oa->lsdb);
hasso508e53e2004-05-18 18:57:06 +0000945 }
hasso049207c2004-08-04 20:02:13 +0000946
hasso508e53e2004-05-18 18:57:06 +0000947 for (i = listhead (o->area_list); i; nextnode (i))
948 {
hasso049207c2004-08-04 20:02:13 +0000949 oa = (struct ospf6_area *) getdata (i);
hasso508e53e2004-05-18 18:57:06 +0000950 for (j = listhead (oa->if_list); j; nextnode (j))
951 {
hasso049207c2004-08-04 20:02:13 +0000952 oi = (struct ospf6_interface *) getdata (j);
953 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
954 oi->interface->name, oa->name, VNL, VNL);
955 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oi->lsdb);
hasso508e53e2004-05-18 18:57:06 +0000956 }
957 }
958
hasso049207c2004-08-04 20:02:13 +0000959 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
960 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, o->lsdb);
961
962 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +0000963 return CMD_SUCCESS;
964}
965
966ALIAS (show_ipv6_ospf6_database_id_router,
967 show_ipv6_ospf6_database_id_router_detail_cmd,
968 "show ipv6 ospf6 database * A.B.C.D A.B.C.D "
969 "(detail|dump|internal)",
970 SHOW_STR
971 IPV6_STR
972 OSPF6_STR
973 "Display Link state database\n"
974 "Any Link state Type\n"
975 "Specify Link state ID as IPv4 address notation\n"
976 "Specify Advertising Router as IPv4 address notation\n"
977 "Display details of LSAs\n"
978 "Dump LSAs\n"
979 "Display LSA's internal information\n"
980 );
981
hasso049207c2004-08-04 20:02:13 +0000982DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id,
983 show_ipv6_ospf6_database_adv_router_linkstate_id_cmd,
984 "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D",
985 SHOW_STR
986 IPV6_STR
987 OSPF6_STR
988 "Display Link state database\n"
989 "Search by Advertising Router\n"
990 "Specify Advertising Router as IPv4 address notation\n"
991 "Search by Link state ID\n"
992 "Specify Link state ID as IPv4 address notation\n"
993 )
994{
995 int level;
996 listnode i, j;
997 struct ospf6 *o = ospf6;
998 struct ospf6_area *oa;
999 struct ospf6_interface *oi;
1000 u_int32_t id = 0;
1001 u_int32_t adv_router = 0;
1002
1003 OSPF6_CMD_CHECK_RUNNING ();
1004
1005 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
1006 {
1007 vty_out (vty, "Advertising Router is not parsable: %s%s",
1008 argv[0], VNL);
1009 return CMD_SUCCESS;
1010 }
1011
1012 argc--;
1013 argv++;
1014
1015 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
1016 {
1017 vty_out (vty, "Link state ID is not parsable: %s%s",
hasso6452df02004-08-15 05:52:07 +00001018 argv[0], VNL);
hasso049207c2004-08-04 20:02:13 +00001019 return CMD_SUCCESS;
1020 }
1021
1022 argc--;
1023 argv++;
1024 level = parse_show_level (argc, argv);
1025
1026 for (i = listhead (o->area_list); i; nextnode (i))
1027 {
1028 oa = (struct ospf6_area *) getdata (i);
1029 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1030 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oa->lsdb);
1031 }
1032
1033 for (i = listhead (o->area_list); i; nextnode (i))
1034 {
1035 oa = (struct ospf6_area *) getdata (i);
1036 for (j = listhead (oa->if_list); j; nextnode (j))
1037 {
1038 oi = (struct ospf6_interface *) getdata (j);
1039 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1040 oi->interface->name, oa->name, VNL, VNL);
1041 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oi->lsdb);
1042 }
1043 }
1044
1045 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1046 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, o->lsdb);
1047
1048 vty_out (vty, "%s", VNL);
1049 return CMD_SUCCESS;
1050}
1051
1052ALIAS (show_ipv6_ospf6_database_adv_router_linkstate_id,
1053 show_ipv6_ospf6_database_adv_router_linkstate_id_detail_cmd,
1054 "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D "
1055 "(detail|dump|internal)",
1056 SHOW_STR
1057 IPV6_STR
1058 OSPF6_STR
1059 "Display Link state database\n"
1060 "Search by Advertising Router\n"
1061 "Specify Advertising Router as IPv4 address notation\n"
1062 "Search by Link state ID\n"
1063 "Specify Link state ID as IPv4 address notation\n"
1064 "Display details of LSAs\n"
1065 "Dump LSAs\n"
1066 "Display LSA's internal information\n"
1067 );
1068
hasso508e53e2004-05-18 18:57:06 +00001069DEFUN (show_ipv6_ospf6_database_type_id_router,
1070 show_ipv6_ospf6_database_type_id_router_cmd,
1071 "show ipv6 ospf6 database "
1072 "(router|network|inter-prefix|inter-router|as-external|"
1073 "group-membership|type-7|link|intra-prefix) A.B.C.D A.B.C.D",
1074 SHOW_STR
1075 IPV6_STR
1076 OSPF6_STR
1077 "Display Link state database\n"
1078 "Display Router LSAs\n"
1079 "Display Network LSAs\n"
1080 "Display Inter-Area-Prefix LSAs\n"
1081 "Display Inter-Area-Router LSAs\n"
1082 "Display As-External LSAs\n"
1083 "Display Group-Membership LSAs\n"
1084 "Display Type-7 LSAs\n"
1085 "Display Link LSAs\n"
1086 "Display Intra-Area-Prefix LSAs\n"
1087 "Specify Link state ID as IPv4 address notation\n"
1088 "Specify Advertising Router as IPv4 address notation\n"
1089 )
1090{
hasso049207c2004-08-04 20:02:13 +00001091 int level;
hasso508e53e2004-05-18 18:57:06 +00001092 listnode i, j;
1093 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +00001094 struct ospf6_area *oa;
1095 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +00001096 u_int16_t type = 0;
1097 u_int32_t id = 0;
hasso049207c2004-08-04 20:02:13 +00001098 u_int32_t adv_router = 0;
hasso508e53e2004-05-18 18:57:06 +00001099
1100 OSPF6_CMD_CHECK_RUNNING ();
1101
hasso049207c2004-08-04 20:02:13 +00001102 type = parse_type_spec (argc, argv);
1103 argc--;
1104 argv++;
hasso508e53e2004-05-18 18:57:06 +00001105
hasso049207c2004-08-04 20:02:13 +00001106 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
hasso508e53e2004-05-18 18:57:06 +00001107 {
1108 vty_out (vty, "Link state ID is not parsable: %s%s",
hasso049207c2004-08-04 20:02:13 +00001109 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +00001110 return CMD_SUCCESS;
1111 }
1112
hasso049207c2004-08-04 20:02:13 +00001113 argc--;
1114 argv++;
1115
1116 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
hasso508e53e2004-05-18 18:57:06 +00001117 {
1118 vty_out (vty, "Advertising Router is not parsable: %s%s",
hasso049207c2004-08-04 20:02:13 +00001119 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +00001120 return CMD_SUCCESS;
1121 }
1122
hasso049207c2004-08-04 20:02:13 +00001123 argc--;
1124 argv++;
1125 level = parse_show_level (argc, argv);
1126
1127 switch (OSPF6_LSA_SCOPE (type))
hasso508e53e2004-05-18 18:57:06 +00001128 {
hasso6452df02004-08-15 05:52:07 +00001129 case OSPF6_SCOPE_AREA:
hasso049207c2004-08-04 20:02:13 +00001130 for (i = listhead (o->area_list); i; nextnode (i))
1131 {
1132 oa = (struct ospf6_area *) getdata (i);
1133 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1134 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1135 }
1136 break;
1137
hasso6452df02004-08-15 05:52:07 +00001138 case OSPF6_SCOPE_LINKLOCAL:
hasso049207c2004-08-04 20:02:13 +00001139 for (i = listhead (o->area_list); i; nextnode (i))
1140 {
1141 oa = (struct ospf6_area *) getdata (i);
1142 for (j = listhead (oa->if_list); j; nextnode (j))
1143 {
1144 oi = (struct ospf6_interface *) getdata (j);
1145 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1146 oi->interface->name, oa->name, VNL, VNL);
1147 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1148 }
1149 }
1150 break;
1151
hasso6452df02004-08-15 05:52:07 +00001152 case OSPF6_SCOPE_AS:
hasso049207c2004-08-04 20:02:13 +00001153 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1154 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1155 break;
1156
1157 default:
1158 assert (0);
1159 break;
hasso508e53e2004-05-18 18:57:06 +00001160 }
1161
hasso049207c2004-08-04 20:02:13 +00001162 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +00001163 return CMD_SUCCESS;
1164}
1165
1166ALIAS (show_ipv6_ospf6_database_type_id_router,
1167 show_ipv6_ospf6_database_type_id_router_detail_cmd,
1168 "show ipv6 ospf6 database "
1169 "(router|network|inter-prefix|inter-router|as-external|"
1170 "group-membership|type-7|link|intra-prefix) A.B.C.D A.B.C.D "
1171 "(dump|internal)",
1172 SHOW_STR
1173 IPV6_STR
1174 OSPF6_STR
1175 "Display Link state database\n"
1176 "Display Router LSAs\n"
1177 "Display Network LSAs\n"
1178 "Display Inter-Area-Prefix LSAs\n"
1179 "Display Inter-Area-Router LSAs\n"
1180 "Display As-External LSAs\n"
1181 "Display Group-Membership LSAs\n"
1182 "Display Type-7 LSAs\n"
1183 "Display Link LSAs\n"
1184 "Display Intra-Area-Prefix LSAs\n"
1185 "Specify Link state ID as IPv4 address notation\n"
1186 "Specify Advertising Router as IPv4 address notation\n"
hasso049207c2004-08-04 20:02:13 +00001187 "Dump LSAs\n"
1188 "Display LSA's internal information\n"
1189 );
1190
1191DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id,
1192 show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd,
1193 "show ipv6 ospf6 database "
1194 "(router|network|inter-prefix|inter-router|as-external|"
1195 "group-membership|type-7|link|intra-prefix) "
1196 "adv-router A.B.C.D linkstate-id A.B.C.D",
1197 SHOW_STR
1198 IPV6_STR
1199 OSPF6_STR
1200 "Display Link state database\n"
1201 "Display Router LSAs\n"
1202 "Display Network LSAs\n"
1203 "Display Inter-Area-Prefix LSAs\n"
1204 "Display Inter-Area-Router LSAs\n"
1205 "Display As-External LSAs\n"
1206 "Display Group-Membership LSAs\n"
1207 "Display Type-7 LSAs\n"
1208 "Display Link LSAs\n"
1209 "Display Intra-Area-Prefix LSAs\n"
1210 "Search by Advertising Router\n"
1211 "Specify Advertising Router as IPv4 address notation\n"
1212 "Search by Link state ID\n"
1213 "Specify Link state ID as IPv4 address notation\n"
1214 )
1215{
1216 int level;
1217 listnode i, j;
1218 struct ospf6 *o = ospf6;
1219 struct ospf6_area *oa;
1220 struct ospf6_interface *oi;
1221 u_int16_t type = 0;
1222 u_int32_t id = 0;
1223 u_int32_t adv_router = 0;
1224
1225 OSPF6_CMD_CHECK_RUNNING ();
1226
1227 type = parse_type_spec (argc, argv);
1228 argc--;
1229 argv++;
1230
1231 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
1232 {
1233 vty_out (vty, "Advertising Router is not parsable: %s%s",
1234 argv[0], VNL);
1235 return CMD_SUCCESS;
1236 }
1237
1238 argc--;
1239 argv++;
1240
1241 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
1242 {
1243 vty_out (vty, "Link state ID is not parsable: %s%s",
1244 argv[0], VNL);
1245 return CMD_SUCCESS;
1246 }
1247
1248 argc--;
1249 argv++;
1250 level = parse_show_level (argc, argv);
1251
1252 switch (OSPF6_LSA_SCOPE (type))
1253 {
hasso6452df02004-08-15 05:52:07 +00001254 case OSPF6_SCOPE_AREA:
hasso049207c2004-08-04 20:02:13 +00001255 for (i = listhead (o->area_list); i; nextnode (i))
1256 {
1257 oa = (struct ospf6_area *) getdata (i);
1258 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1259 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1260 }
1261 break;
1262
hasso6452df02004-08-15 05:52:07 +00001263 case OSPF6_SCOPE_LINKLOCAL:
hasso049207c2004-08-04 20:02:13 +00001264 for (i = listhead (o->area_list); i; nextnode (i))
1265 {
1266 oa = (struct ospf6_area *) getdata (i);
1267 for (j = listhead (oa->if_list); j; nextnode (j))
1268 {
1269 oi = (struct ospf6_interface *) getdata (j);
1270 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1271 oi->interface->name, oa->name, VNL, VNL);
1272 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1273 }
1274 }
1275 break;
1276
hasso6452df02004-08-15 05:52:07 +00001277 case OSPF6_SCOPE_AS:
hasso049207c2004-08-04 20:02:13 +00001278 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1279 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1280 break;
1281
1282 default:
1283 assert (0);
1284 break;
1285 }
1286
1287 vty_out (vty, "%s", VNL);
1288 return CMD_SUCCESS;
1289}
1290
1291ALIAS (show_ipv6_ospf6_database_type_adv_router_linkstate_id,
1292 show_ipv6_ospf6_database_type_adv_router_linkstate_id_detail_cmd,
1293 "show ipv6 ospf6 database "
1294 "(router|network|inter-prefix|inter-router|as-external|"
1295 "group-membership|type-7|link|intra-prefix) "
1296 "adv-router A.B.C.D linkstate-id A.B.C.D "
1297 "(dump|internal)",
1298 SHOW_STR
1299 IPV6_STR
1300 OSPF6_STR
1301 "Display Link state database\n"
1302 "Display Router LSAs\n"
1303 "Display Network LSAs\n"
1304 "Display Inter-Area-Prefix LSAs\n"
1305 "Display Inter-Area-Router LSAs\n"
1306 "Display As-External LSAs\n"
1307 "Display Group-Membership LSAs\n"
1308 "Display Type-7 LSAs\n"
1309 "Display Link LSAs\n"
1310 "Display Intra-Area-Prefix LSAs\n"
1311 "Search by Advertising Router\n"
1312 "Specify Advertising Router as IPv4 address notation\n"
1313 "Search by Link state ID\n"
1314 "Specify Link state ID as IPv4 address notation\n"
hasso508e53e2004-05-18 18:57:06 +00001315 "Dump LSAs\n"
1316 "Display LSA's internal information\n"
1317 );
1318
1319DEFUN (show_ipv6_ospf6_database_self_originated,
1320 show_ipv6_ospf6_database_self_originated_cmd,
1321 "show ipv6 ospf6 database self-originated",
1322 SHOW_STR
1323 IPV6_STR
1324 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001325 "Display Self-originated LSAs\n"
1326 )
1327{
hasso049207c2004-08-04 20:02:13 +00001328 int level;
hasso508e53e2004-05-18 18:57:06 +00001329 listnode i, j;
1330 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +00001331 struct ospf6_area *oa;
1332 struct ospf6_interface *oi;
1333 u_int32_t adv_router = 0;
hasso508e53e2004-05-18 18:57:06 +00001334
1335 OSPF6_CMD_CHECK_RUNNING ();
1336
hasso049207c2004-08-04 20:02:13 +00001337 level = parse_show_level (argc, argv);
hasso508e53e2004-05-18 18:57:06 +00001338
hasso049207c2004-08-04 20:02:13 +00001339 adv_router = o->router_id;
hasso508e53e2004-05-18 18:57:06 +00001340
hasso508e53e2004-05-18 18:57:06 +00001341 for (i = listhead (o->area_list); i; nextnode (i))
1342 {
hasso049207c2004-08-04 20:02:13 +00001343 oa = (struct ospf6_area *) getdata (i);
1344 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1345 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oa->lsdb);
hasso508e53e2004-05-18 18:57:06 +00001346 }
hasso049207c2004-08-04 20:02:13 +00001347
hasso508e53e2004-05-18 18:57:06 +00001348 for (i = listhead (o->area_list); i; nextnode (i))
1349 {
hasso049207c2004-08-04 20:02:13 +00001350 oa = (struct ospf6_area *) getdata (i);
hasso508e53e2004-05-18 18:57:06 +00001351 for (j = listhead (oa->if_list); j; nextnode (j))
1352 {
hasso049207c2004-08-04 20:02:13 +00001353 oi = (struct ospf6_interface *) getdata (j);
1354 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1355 oi->interface->name, oa->name, VNL, VNL);
1356 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oi->lsdb);
hasso508e53e2004-05-18 18:57:06 +00001357 }
1358 }
1359
hasso049207c2004-08-04 20:02:13 +00001360 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1361 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, o->lsdb);
1362
1363 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +00001364 return CMD_SUCCESS;
1365}
1366
1367ALIAS (show_ipv6_ospf6_database_self_originated,
1368 show_ipv6_ospf6_database_self_originated_detail_cmd,
1369 "show ipv6 ospf6 database self-originated "
1370 "(detail|dump|internal)",
1371 SHOW_STR
1372 IPV6_STR
1373 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001374 "Display Self-originated LSAs\n"
1375 "Display details of LSAs\n"
1376 "Dump LSAs\n"
1377 "Display LSA's internal information\n"
hasso049207c2004-08-04 20:02:13 +00001378 )
hasso508e53e2004-05-18 18:57:06 +00001379
1380DEFUN (show_ipv6_ospf6_database_type_self_originated,
1381 show_ipv6_ospf6_database_type_self_originated_cmd,
1382 "show ipv6 ospf6 database "
1383 "(router|network|inter-prefix|inter-router|as-external|"
1384 "group-membership|type-7|link|intra-prefix) self-originated",
1385 SHOW_STR
1386 IPV6_STR
1387 OSPF6_STR
1388 "Display Link state database\n"
1389 "Display Router LSAs\n"
1390 "Display Network LSAs\n"
1391 "Display Inter-Area-Prefix LSAs\n"
1392 "Display Inter-Area-Router LSAs\n"
1393 "Display As-External LSAs\n"
1394 "Display Group-Membership LSAs\n"
1395 "Display Type-7 LSAs\n"
1396 "Display Link LSAs\n"
1397 "Display Intra-Area-Prefix LSAs\n"
1398 "Display Self-originated LSAs\n"
1399 )
1400{
hasso049207c2004-08-04 20:02:13 +00001401 int level;
hasso508e53e2004-05-18 18:57:06 +00001402 listnode i, j;
1403 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +00001404 struct ospf6_area *oa;
1405 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +00001406 u_int16_t type = 0;
hasso049207c2004-08-04 20:02:13 +00001407 u_int32_t adv_router = 0;
hasso508e53e2004-05-18 18:57:06 +00001408
1409 OSPF6_CMD_CHECK_RUNNING ();
1410
hasso049207c2004-08-04 20:02:13 +00001411 type = parse_type_spec (argc, argv);
1412 argc--;
1413 argv++;
1414 level = parse_show_level (argc, argv);
hasso508e53e2004-05-18 18:57:06 +00001415
hasso049207c2004-08-04 20:02:13 +00001416 adv_router = o->router_id;
hasso508e53e2004-05-18 18:57:06 +00001417
hasso049207c2004-08-04 20:02:13 +00001418 switch (OSPF6_LSA_SCOPE (type))
1419 {
hasso6452df02004-08-15 05:52:07 +00001420 case OSPF6_SCOPE_AREA:
hasso049207c2004-08-04 20:02:13 +00001421 for (i = listhead (o->area_list); i; nextnode (i))
1422 {
1423 oa = (struct ospf6_area *) getdata (i);
1424 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1425 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oa->lsdb);
1426 }
1427 break;
hasso508e53e2004-05-18 18:57:06 +00001428
hasso6452df02004-08-15 05:52:07 +00001429 case OSPF6_SCOPE_LINKLOCAL:
hasso049207c2004-08-04 20:02:13 +00001430 for (i = listhead (o->area_list); i; nextnode (i))
1431 {
1432 oa = (struct ospf6_area *) getdata (i);
1433 for (j = listhead (oa->if_list); j; nextnode (j))
1434 {
1435 oi = (struct ospf6_interface *) getdata (j);
1436 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1437 oi->interface->name, oa->name, VNL, VNL);
1438 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oi->lsdb);
1439 }
1440 }
1441 break;
1442
hasso6452df02004-08-15 05:52:07 +00001443 case OSPF6_SCOPE_AS:
hasso049207c2004-08-04 20:02:13 +00001444 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1445 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, o->lsdb);
1446 break;
1447
1448 default:
1449 assert (0);
1450 break;
hasso508e53e2004-05-18 18:57:06 +00001451 }
1452
hasso049207c2004-08-04 20:02:13 +00001453 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +00001454 return CMD_SUCCESS;
1455}
1456
1457ALIAS (show_ipv6_ospf6_database_type_self_originated,
1458 show_ipv6_ospf6_database_type_self_originated_detail_cmd,
1459 "show ipv6 ospf6 database "
1460 "(router|network|inter-prefix|inter-router|as-external|"
1461 "group-membership|type-7|link|intra-prefix) self-originated "
1462 "(detail|dump|internal)",
1463 SHOW_STR
1464 IPV6_STR
1465 OSPF6_STR
1466 "Display Link state database\n"
1467 "Display Router LSAs\n"
1468 "Display Network LSAs\n"
1469 "Display Inter-Area-Prefix LSAs\n"
1470 "Display Inter-Area-Router LSAs\n"
1471 "Display As-External LSAs\n"
1472 "Display Group-Membership LSAs\n"
1473 "Display Type-7 LSAs\n"
1474 "Display Link LSAs\n"
1475 "Display Intra-Area-Prefix LSAs\n"
1476 "Display Self-originated LSAs\n"
1477 "Display details of LSAs\n"
1478 "Dump LSAs\n"
1479 "Display LSA's internal information\n"
1480 );
1481
hasso049207c2004-08-04 20:02:13 +00001482DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id,
1483 show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd,
1484 "show ipv6 ospf6 database "
1485 "(router|network|inter-prefix|inter-router|as-external|"
1486 "group-membership|type-7|link|intra-prefix) self-originated "
1487 "linkstate-id A.B.C.D",
1488 SHOW_STR
1489 IPV6_STR
1490 OSPF6_STR
1491 "Display Link state database\n"
1492 "Display Router LSAs\n"
1493 "Display Network LSAs\n"
1494 "Display Inter-Area-Prefix LSAs\n"
1495 "Display Inter-Area-Router LSAs\n"
1496 "Display As-External LSAs\n"
1497 "Display Group-Membership LSAs\n"
1498 "Display Type-7 LSAs\n"
1499 "Display Link LSAs\n"
1500 "Display Intra-Area-Prefix LSAs\n"
1501 "Display Self-originated LSAs\n"
1502 "Search by Link state ID\n"
1503 "Specify Link state ID as IPv4 address notation\n"
1504 )
1505{
1506 int level;
1507 listnode i, j;
1508 struct ospf6 *o = ospf6;
1509 struct ospf6_area *oa;
1510 struct ospf6_interface *oi;
1511 u_int16_t type = 0;
1512 u_int32_t adv_router = 0;
1513 u_int32_t id = 0;
1514
1515 OSPF6_CMD_CHECK_RUNNING ();
1516
1517 type = parse_type_spec (argc, argv);
1518 argc--;
1519 argv++;
1520
hasso6452df02004-08-15 05:52:07 +00001521 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
hasso049207c2004-08-04 20:02:13 +00001522 {
1523 vty_out (vty, "Link State ID is not parsable: %s%s",
1524 argv[0], VNL);
1525 return CMD_SUCCESS;
1526 }
1527
1528 argc--;
1529 argv++;
1530 level = parse_show_level (argc, argv);
1531
1532 adv_router = o->router_id;
1533
1534 switch (OSPF6_LSA_SCOPE (type))
1535 {
hasso6452df02004-08-15 05:52:07 +00001536 case OSPF6_SCOPE_AREA:
hasso049207c2004-08-04 20:02:13 +00001537 for (i = listhead (o->area_list); i; nextnode (i))
1538 {
1539 oa = (struct ospf6_area *) getdata (i);
1540 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1541 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1542 }
1543 break;
1544
hasso6452df02004-08-15 05:52:07 +00001545 case OSPF6_SCOPE_LINKLOCAL:
hasso049207c2004-08-04 20:02:13 +00001546 for (i = listhead (o->area_list); i; nextnode (i))
1547 {
1548 oa = (struct ospf6_area *) getdata (i);
1549 for (j = listhead (oa->if_list); j; nextnode (j))
1550 {
1551 oi = (struct ospf6_interface *) getdata (j);
1552 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1553 oi->interface->name, oa->name, VNL, VNL);
1554 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1555 }
1556 }
1557 break;
1558
hasso6452df02004-08-15 05:52:07 +00001559 case OSPF6_SCOPE_AS:
hasso049207c2004-08-04 20:02:13 +00001560 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1561 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1562 break;
1563
1564 default:
1565 assert (0);
1566 break;
1567 }
1568
1569 vty_out (vty, "%s", VNL);
1570 return CMD_SUCCESS;
1571}
1572
1573ALIAS (show_ipv6_ospf6_database_type_self_originated_linkstate_id,
1574 show_ipv6_ospf6_database_type_self_originated_linkstate_id_detail_cmd,
1575 "show ipv6 ospf6 database "
1576 "(router|network|inter-prefix|inter-router|as-external|"
1577 "group-membership|type-7|link|intra-prefix) self-originated "
1578 "linkstate-id A.B.C.D (detail|dump|internal)",
1579 SHOW_STR
1580 IPV6_STR
1581 OSPF6_STR
1582 "Display Link state database\n"
1583 "Display Router LSAs\n"
1584 "Display Network LSAs\n"
1585 "Display Inter-Area-Prefix LSAs\n"
1586 "Display Inter-Area-Router LSAs\n"
1587 "Display As-External LSAs\n"
1588 "Display Group-Membership LSAs\n"
1589 "Display Type-7 LSAs\n"
1590 "Display Link LSAs\n"
1591 "Display Intra-Area-Prefix LSAs\n"
1592 "Display Self-originated LSAs\n"
1593 "Search by Link state ID\n"
1594 "Specify Link state ID as IPv4 address notation\n"
1595 "Display details of LSAs\n"
1596 "Dump LSAs\n"
1597 "Display LSA's internal information\n"
1598 );
1599
hasso508e53e2004-05-18 18:57:06 +00001600DEFUN (show_ipv6_ospf6_database_type_id_self_originated,
1601 show_ipv6_ospf6_database_type_id_self_originated_cmd,
1602 "show ipv6 ospf6 database "
1603 "(router|network|inter-prefix|inter-router|as-external|"
1604 "group-membership|type-7|link|intra-prefix) A.B.C.D self-originated",
1605 SHOW_STR
1606 IPV6_STR
1607 OSPF6_STR
1608 "Display Link state database\n"
1609 "Display Router LSAs\n"
1610 "Display Network LSAs\n"
1611 "Display Inter-Area-Prefix LSAs\n"
1612 "Display Inter-Area-Router LSAs\n"
1613 "Display As-External LSAs\n"
1614 "Display Group-Membership LSAs\n"
1615 "Display Type-7 LSAs\n"
1616 "Display Link LSAs\n"
1617 "Display Intra-Area-Prefix LSAs\n"
1618 "Specify Link state ID as IPv4 address notation\n"
1619 "Display Self-originated LSAs\n"
1620 )
1621{
hasso049207c2004-08-04 20:02:13 +00001622 int level;
hasso508e53e2004-05-18 18:57:06 +00001623 listnode i, j;
1624 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +00001625 struct ospf6_area *oa;
1626 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +00001627 u_int16_t type = 0;
hasso049207c2004-08-04 20:02:13 +00001628 u_int32_t adv_router = 0;
hasso508e53e2004-05-18 18:57:06 +00001629 u_int32_t id = 0;
1630
1631 OSPF6_CMD_CHECK_RUNNING ();
1632
hasso049207c2004-08-04 20:02:13 +00001633 type = parse_type_spec (argc, argv);
1634 argc--;
1635 argv++;
hasso508e53e2004-05-18 18:57:06 +00001636
hasso6452df02004-08-15 05:52:07 +00001637 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
hasso508e53e2004-05-18 18:57:06 +00001638 {
1639 vty_out (vty, "Link State ID is not parsable: %s%s",
hasso049207c2004-08-04 20:02:13 +00001640 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +00001641 return CMD_SUCCESS;
1642 }
1643
hasso049207c2004-08-04 20:02:13 +00001644 argc--;
1645 argv++;
1646 level = parse_show_level (argc, argv);
1647
1648 adv_router = o->router_id;
1649
1650 switch (OSPF6_LSA_SCOPE (type))
hasso508e53e2004-05-18 18:57:06 +00001651 {
hasso6452df02004-08-15 05:52:07 +00001652 case OSPF6_SCOPE_AREA:
hasso049207c2004-08-04 20:02:13 +00001653 for (i = listhead (o->area_list); i; nextnode (i))
1654 {
1655 oa = (struct ospf6_area *) getdata (i);
1656 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1657 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1658 }
1659 break;
1660
hasso6452df02004-08-15 05:52:07 +00001661 case OSPF6_SCOPE_LINKLOCAL:
hasso049207c2004-08-04 20:02:13 +00001662 for (i = listhead (o->area_list); i; nextnode (i))
1663 {
1664 oa = (struct ospf6_area *) getdata (i);
1665 for (j = listhead (oa->if_list); j; nextnode (j))
1666 {
1667 oi = (struct ospf6_interface *) getdata (j);
1668 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1669 oi->interface->name, oa->name, VNL, VNL);
1670 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1671 }
1672 }
1673 break;
1674
hasso6452df02004-08-15 05:52:07 +00001675 case OSPF6_SCOPE_AS:
hasso049207c2004-08-04 20:02:13 +00001676 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1677 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1678 break;
1679
1680 default:
1681 assert (0);
1682 break;
hasso508e53e2004-05-18 18:57:06 +00001683 }
1684
hasso049207c2004-08-04 20:02:13 +00001685 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +00001686 return CMD_SUCCESS;
1687}
1688
1689ALIAS (show_ipv6_ospf6_database_type_id_self_originated,
1690 show_ipv6_ospf6_database_type_id_self_originated_detail_cmd,
1691 "show ipv6 ospf6 database "
1692 "(router|network|inter-prefix|inter-router|as-external|"
1693 "group-membership|type-7|link|intra-prefix) A.B.C.D self-originated "
hasso049207c2004-08-04 20:02:13 +00001694 "(detail|dump|internal)",
hasso508e53e2004-05-18 18:57:06 +00001695 SHOW_STR
1696 IPV6_STR
1697 OSPF6_STR
1698 "Display Link state database\n"
1699 "Display Router LSAs\n"
1700 "Display Network LSAs\n"
1701 "Display Inter-Area-Prefix LSAs\n"
1702 "Display Inter-Area-Router LSAs\n"
1703 "Display As-External LSAs\n"
1704 "Display Group-Membership LSAs\n"
1705 "Display Type-7 LSAs\n"
1706 "Display Link LSAs\n"
1707 "Display Intra-Area-Prefix LSAs\n"
hasso508e53e2004-05-18 18:57:06 +00001708 "Display Self-originated LSAs\n"
hasso049207c2004-08-04 20:02:13 +00001709 "Search by Link state ID\n"
1710 "Specify Link state ID as IPv4 address notation\n"
hasso508e53e2004-05-18 18:57:06 +00001711 "Display details of LSAs\n"
1712 "Dump LSAs\n"
1713 "Display LSA's internal information\n"
1714 );
1715
hasso6452df02004-08-15 05:52:07 +00001716
1717DEFUN (show_ipv6_ospf6_border_routers,
1718 show_ipv6_ospf6_border_routers_cmd,
1719 "show ipv6 ospf6 border-routers",
1720 SHOW_STR
1721 IP6_STR
1722 OSPF6_STR
1723 "Display routing table for ABR and ASBR\n"
1724 )
1725{
1726 u_int32_t adv_router;
1727 void (*showfunc) (struct vty *, struct ospf6_route *);
1728 struct ospf6_route *ro;
1729 struct prefix prefix;
1730
1731 OSPF6_CMD_CHECK_RUNNING ();
1732
1733 if (argc && ! strcmp ("detail", argv[0]))
1734 {
1735 showfunc = ospf6_route_show_detail;
1736 argc--;
1737 argv++;
1738 }
1739 else
1740 showfunc = ospf6_brouter_show;
1741
1742 if (argc)
1743 {
1744 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
1745 {
1746 vty_out (vty, "Router ID is not parsable: %s%s", argv[0], VNL);
1747 return CMD_SUCCESS;
1748 }
1749
1750 ospf6_linkstate_prefix (adv_router, 0, &prefix);
1751 ro = ospf6_route_lookup (&prefix, ospf6->brouter_table);
1752 ospf6_route_show_detail (vty, ro);
1753 return CMD_SUCCESS;
1754 }
1755
1756 if (showfunc == ospf6_brouter_show)
1757 ospf6_brouter_show_header (vty);
1758
1759 for (ro = ospf6_route_head (ospf6->brouter_table); ro;
1760 ro = ospf6_route_next (ro))
1761 (*showfunc) (vty, ro);
1762
1763 return CMD_SUCCESS;
1764}
1765
1766ALIAS (show_ipv6_ospf6_border_routers,
1767 show_ipv6_ospf6_border_routers_detail_cmd,
1768 "show ipv6 ospf6 border-routers (A.B.C.D|detail)",
1769 SHOW_STR
1770 IP6_STR
1771 OSPF6_STR
1772 "Display routing table for ABR and ASBR\n"
1773 "Specify Router-ID\n"
1774 "Display Detail\n"
1775 );
1776
1777
paul718e3742002-12-13 20:15:29 +00001778/* Install ospf related commands. */
1779void
1780ospf6_init ()
1781{
hasso508e53e2004-05-18 18:57:06 +00001782 install_node (&debug_node, config_write_ospf6_debug);
paul718e3742002-12-13 20:15:29 +00001783
hasso508e53e2004-05-18 18:57:06 +00001784 install_element_ospf6_debug_message ();
1785 install_element_ospf6_debug_lsa ();
1786 install_element_ospf6_debug_interface ();
1787 install_element_ospf6_debug_neighbor ();
1788 install_element_ospf6_debug_zebra ();
1789 install_element_ospf6_debug_spf ();
1790 install_element_ospf6_debug_route ();
1791 install_element_ospf6_debug_asbr ();
hasso6452df02004-08-15 05:52:07 +00001792 install_element_ospf6_debug_abr ();
hasso508e53e2004-05-18 18:57:06 +00001793
paul718e3742002-12-13 20:15:29 +00001794 install_element (VIEW_NODE, &show_version_ospf6_cmd);
paul718e3742002-12-13 20:15:29 +00001795 install_element (ENABLE_NODE, &show_version_ospf6_cmd);
hasso049207c2004-08-04 20:02:13 +00001796
hasso6452df02004-08-15 05:52:07 +00001797 install_element (VIEW_NODE, &show_ipv6_ospf6_border_routers_cmd);
1798 install_element (VIEW_NODE, &show_ipv6_ospf6_border_routers_detail_cmd);
1799 install_element (ENABLE_NODE, &show_ipv6_ospf6_border_routers_cmd);
1800 install_element (ENABLE_NODE, &show_ipv6_ospf6_border_routers_detail_cmd);
1801
hasso049207c2004-08-04 20:02:13 +00001802#define INSTALL(n,c) \
1803 install_element (n ## _NODE, &show_ipv6_ospf6_ ## c);
1804
1805 INSTALL (VIEW, database_cmd);
1806 INSTALL (VIEW, database_detail_cmd);
1807 INSTALL (VIEW, database_type_cmd);
1808 INSTALL (VIEW, database_type_detail_cmd);
1809 INSTALL (VIEW, database_id_cmd);
1810 INSTALL (VIEW, database_id_detail_cmd);
1811 INSTALL (VIEW, database_linkstate_id_cmd);
1812 INSTALL (VIEW, database_linkstate_id_detail_cmd);
1813 INSTALL (VIEW, database_router_cmd);
1814 INSTALL (VIEW, database_router_detail_cmd);
1815 INSTALL (VIEW, database_adv_router_cmd);
1816 INSTALL (VIEW, database_adv_router_detail_cmd);
1817 INSTALL (VIEW, database_type_id_cmd);
1818 INSTALL (VIEW, database_type_id_detail_cmd);
1819 INSTALL (VIEW, database_type_linkstate_id_cmd);
1820 INSTALL (VIEW, database_type_linkstate_id_detail_cmd);
1821 INSTALL (VIEW, database_type_router_cmd);
1822 INSTALL (VIEW, database_type_router_detail_cmd);
1823 INSTALL (VIEW, database_type_adv_router_cmd);
1824 INSTALL (VIEW, database_type_adv_router_detail_cmd);
1825 INSTALL (VIEW, database_adv_router_linkstate_id_cmd);
1826 INSTALL (VIEW, database_adv_router_linkstate_id_detail_cmd);
1827 INSTALL (VIEW, database_id_router_cmd);
1828 INSTALL (VIEW, database_id_router_detail_cmd);
1829 INSTALL (VIEW, database_type_id_router_cmd);
1830 INSTALL (VIEW, database_type_id_router_detail_cmd);
1831 INSTALL (VIEW, database_type_adv_router_linkstate_id_cmd);
1832 INSTALL (VIEW, database_type_adv_router_linkstate_id_detail_cmd);
1833 INSTALL (VIEW, database_self_originated_cmd);
1834 INSTALL (VIEW, database_self_originated_detail_cmd);
1835 INSTALL (VIEW, database_type_self_originated_cmd);
1836 INSTALL (VIEW, database_type_self_originated_detail_cmd);
1837 INSTALL (VIEW, database_type_id_self_originated_cmd);
1838 INSTALL (VIEW, database_type_id_self_originated_detail_cmd);
1839 INSTALL (VIEW, database_type_self_originated_linkstate_id_cmd);
1840 INSTALL (VIEW, database_type_self_originated_linkstate_id_detail_cmd);
1841 INSTALL (VIEW, database_type_id_self_originated_cmd);
1842 INSTALL (VIEW, database_type_id_self_originated_detail_cmd);
1843
1844 INSTALL (ENABLE, database_cmd);
1845 INSTALL (ENABLE, database_detail_cmd);
1846 INSTALL (ENABLE, database_type_cmd);
1847 INSTALL (ENABLE, database_type_detail_cmd);
1848 INSTALL (ENABLE, database_id_cmd);
1849 INSTALL (ENABLE, database_id_detail_cmd);
1850 INSTALL (ENABLE, database_linkstate_id_cmd);
1851 INSTALL (ENABLE, database_linkstate_id_detail_cmd);
1852 INSTALL (ENABLE, database_router_cmd);
1853 INSTALL (ENABLE, database_router_detail_cmd);
1854 INSTALL (ENABLE, database_adv_router_cmd);
1855 INSTALL (ENABLE, database_adv_router_detail_cmd);
1856 INSTALL (ENABLE, database_type_id_cmd);
1857 INSTALL (ENABLE, database_type_id_detail_cmd);
1858 INSTALL (ENABLE, database_type_linkstate_id_cmd);
1859 INSTALL (ENABLE, database_type_linkstate_id_detail_cmd);
1860 INSTALL (ENABLE, database_type_router_cmd);
1861 INSTALL (ENABLE, database_type_router_detail_cmd);
1862 INSTALL (ENABLE, database_type_adv_router_cmd);
1863 INSTALL (ENABLE, database_type_adv_router_detail_cmd);
1864 INSTALL (ENABLE, database_adv_router_linkstate_id_cmd);
1865 INSTALL (ENABLE, database_adv_router_linkstate_id_detail_cmd);
1866 INSTALL (ENABLE, database_id_router_cmd);
1867 INSTALL (ENABLE, database_id_router_detail_cmd);
1868 INSTALL (ENABLE, database_type_id_router_cmd);
1869 INSTALL (ENABLE, database_type_id_router_detail_cmd);
1870 INSTALL (ENABLE, database_type_adv_router_linkstate_id_cmd);
1871 INSTALL (ENABLE, database_type_adv_router_linkstate_id_detail_cmd);
1872 INSTALL (ENABLE, database_self_originated_cmd);
1873 INSTALL (ENABLE, database_self_originated_detail_cmd);
1874 INSTALL (ENABLE, database_type_self_originated_cmd);
1875 INSTALL (ENABLE, database_type_self_originated_detail_cmd);
1876 INSTALL (ENABLE, database_type_id_self_originated_cmd);
1877 INSTALL (ENABLE, database_type_id_self_originated_detail_cmd);
1878 INSTALL (ENABLE, database_type_self_originated_linkstate_id_cmd);
1879 INSTALL (ENABLE, database_type_self_originated_linkstate_id_detail_cmd);
1880 INSTALL (ENABLE, database_type_id_self_originated_cmd);
1881 INSTALL (ENABLE, database_type_id_self_originated_detail_cmd);
paul718e3742002-12-13 20:15:29 +00001882
1883 ospf6_top_init ();
1884 ospf6_area_init ();
1885 ospf6_interface_init ();
1886 ospf6_neighbor_init ();
1887 ospf6_zebra_init ();
1888
hasso508e53e2004-05-18 18:57:06 +00001889 ospf6_lsa_init ();
paul718e3742002-12-13 20:15:29 +00001890 ospf6_spf_init ();
paul718e3742002-12-13 20:15:29 +00001891 ospf6_intra_init ();
paul718e3742002-12-13 20:15:29 +00001892 ospf6_asbr_init ();
hasso049207c2004-08-04 20:02:13 +00001893 ospf6_abr_init ();
hasso508e53e2004-05-18 18:57:06 +00001894
1895 /* Make ospf protocol socket. */
1896 ospf6_serv_sock ();
1897 thread_add_read (master, ospf6_receive, NULL, ospf6_sock);
paul718e3742002-12-13 20:15:29 +00001898}
1899
paul718e3742002-12-13 20:15:29 +00001900