blob: d10d1df670d0808229ace540346a900d3e5a9c9d [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"
hasso1e058382004-09-01 21:36:14 +000044#include "ospf6_flood.h"
hasso049207c2004-08-04 20:02:13 +000045#include "ospf6d.h"
paul718e3742002-12-13 20:15:29 +000046
hassoef1bbf52004-10-08 12:04:21 +000047#ifdef HAVE_SNMP
48#include "ospf6_snmp.h"
49#endif /*HAVE_SNMP*/
50
paul718e3742002-12-13 20:15:29 +000051char ospf6_daemon_version[] = OSPF6_DAEMON_VERSION;
52
paul718e3742002-12-13 20:15:29 +000053void
hasso508e53e2004-05-18 18:57:06 +000054ospf6_debug ()
paul718e3742002-12-13 20:15:29 +000055{
hasso508e53e2004-05-18 18:57:06 +000056}
paul718e3742002-12-13 20:15:29 +000057
hasso508e53e2004-05-18 18:57:06 +000058struct route_node *
59route_prev (struct route_node *node)
paul718e3742002-12-13 20:15:29 +000060{
hasso508e53e2004-05-18 18:57:06 +000061 struct route_node *end;
62 struct route_node *prev = NULL;
paul718e3742002-12-13 20:15:29 +000063
hasso508e53e2004-05-18 18:57:06 +000064 end = node;
65 node = node->parent;
hasso3b687352004-08-19 06:56:53 +000066 if (node)
67 route_lock_node (node);
hasso508e53e2004-05-18 18:57:06 +000068 while (node)
69 {
70 prev = node;
hasso3b687352004-08-19 06:56:53 +000071 node = route_next (node);
72 if (node == end)
73 {
74 route_unlock_node (node);
75 node = NULL;
76 }
hasso508e53e2004-05-18 18:57:06 +000077 }
78 route_unlock_node (end);
hasso3b687352004-08-19 06:56:53 +000079 if (prev)
80 route_lock_node (prev);
hasso508e53e2004-05-18 18:57:06 +000081
82 return prev;
paul718e3742002-12-13 20:15:29 +000083}
84
hasso6452df02004-08-15 05:52:07 +000085
86/* show database functions */
paul718e3742002-12-13 20:15:29 +000087DEFUN (show_version_ospf6,
88 show_version_ospf6_cmd,
89 "show version ospf6",
90 SHOW_STR
hasso508e53e2004-05-18 18:57:06 +000091 "Displays ospf6d version\n"
92 )
paul718e3742002-12-13 20:15:29 +000093{
94 vty_out (vty, "Zebra OSPF6d Version: %s%s",
hasso049207c2004-08-04 20:02:13 +000095 ospf6_daemon_version, VNL);
paul718e3742002-12-13 20:15:29 +000096
97 return CMD_SUCCESS;
98}
99
hasso508e53e2004-05-18 18:57:06 +0000100struct cmd_node debug_node =
paul718e3742002-12-13 20:15:29 +0000101{
hasso508e53e2004-05-18 18:57:06 +0000102 DEBUG_NODE,
hasso69b4a812004-08-26 18:10:36 +0000103 "",
104 1 /* VTYSH */
hasso508e53e2004-05-18 18:57:06 +0000105};
paul718e3742002-12-13 20:15:29 +0000106
107int
hasso508e53e2004-05-18 18:57:06 +0000108config_write_ospf6_debug (struct vty *vty)
paul718e3742002-12-13 20:15:29 +0000109{
hasso508e53e2004-05-18 18:57:06 +0000110 config_write_ospf6_debug_message (vty);
111 config_write_ospf6_debug_lsa (vty);
112 config_write_ospf6_debug_zebra (vty);
113 config_write_ospf6_debug_interface (vty);
114 config_write_ospf6_debug_neighbor (vty);
115 config_write_ospf6_debug_spf (vty);
116 config_write_ospf6_debug_route (vty);
117 config_write_ospf6_debug_asbr (vty);
hasso049207c2004-08-04 20:02:13 +0000118 config_write_ospf6_debug_abr (vty);
hasso1e058382004-09-01 21:36:14 +0000119 config_write_ospf6_debug_flood (vty);
hasso049207c2004-08-04 20:02:13 +0000120 vty_out (vty, "!%s", VNL);
paul718e3742002-12-13 20:15:29 +0000121 return 0;
122}
123
hasso049207c2004-08-04 20:02:13 +0000124#define AREA_LSDB_TITLE_FORMAT \
125 "%s Area Scoped Link State Database (Area %s)%s%s"
126#define IF_LSDB_TITLE_FORMAT \
127 "%s I/F Scoped Link State Database (I/F %s in Area %s)%s%s"
128#define AS_LSDB_TITLE_FORMAT \
129 "%s AS Scoped Link State Database%s%s"
130
131static int
paul0c083ee2004-10-10 12:54:58 +0000132parse_show_level (int argc, const char *argv[])
hasso049207c2004-08-04 20:02:13 +0000133{
hasso6452df02004-08-15 05:52:07 +0000134 int level = 0;
hasso049207c2004-08-04 20:02:13 +0000135 if (argc)
136 {
137 if (! strncmp (argv[0], "de", 2))
138 level = OSPF6_LSDB_SHOW_LEVEL_DETAIL;
139 else if (! strncmp (argv[0], "du", 2))
140 level = OSPF6_LSDB_SHOW_LEVEL_DUMP;
141 else if (! strncmp (argv[0], "in", 2))
142 level = OSPF6_LSDB_SHOW_LEVEL_INTERNAL;
143 }
144 else
145 level = OSPF6_LSDB_SHOW_LEVEL_NORMAL;
146 return level;
147}
148
149static u_int16_t
paul0c083ee2004-10-10 12:54:58 +0000150parse_type_spec (int argc, const char *argv[])
hasso049207c2004-08-04 20:02:13 +0000151{
hasso6452df02004-08-15 05:52:07 +0000152 u_int16_t type = 0;
hasso049207c2004-08-04 20:02:13 +0000153 assert (argc);
154 if (! strcmp (argv[0], "router"))
155 type = htons (OSPF6_LSTYPE_ROUTER);
156 else if (! strcmp (argv[0], "network"))
157 type = htons (OSPF6_LSTYPE_NETWORK);
158 else if (! strcmp (argv[0], "as-external"))
159 type = htons (OSPF6_LSTYPE_AS_EXTERNAL);
160 else if (! strcmp (argv[0], "intra-prefix"))
161 type = htons (OSPF6_LSTYPE_INTRA_PREFIX);
162 else if (! strcmp (argv[0], "inter-router"))
163 type = htons (OSPF6_LSTYPE_INTER_ROUTER);
164 else if (! strcmp (argv[0], "inter-prefix"))
165 type = htons (OSPF6_LSTYPE_INTER_PREFIX);
166 else if (! strcmp (argv[0], "link"))
167 type = htons (OSPF6_LSTYPE_LINK);
168 return type;
169}
170
hasso508e53e2004-05-18 18:57:06 +0000171DEFUN (show_ipv6_ospf6_database,
172 show_ipv6_ospf6_database_cmd,
173 "show ipv6 ospf6 database",
174 SHOW_STR
175 IPV6_STR
176 OSPF6_STR
177 "Display Link state database\n"
178 )
paul718e3742002-12-13 20:15:29 +0000179{
hasso049207c2004-08-04 20:02:13 +0000180 int level;
hasso52dc7ee2004-09-23 19:18:23 +0000181 struct listnode *i, *j;
hasso508e53e2004-05-18 18:57:06 +0000182 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +0000183 struct ospf6_area *oa;
184 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +0000185
186 OSPF6_CMD_CHECK_RUNNING ();
187
hasso049207c2004-08-04 20:02:13 +0000188 level = parse_show_level (argc, argv);
hasso508e53e2004-05-18 18:57:06 +0000189
hasso508e53e2004-05-18 18:57:06 +0000190 for (i = listhead (o->area_list); i; nextnode (i))
191 {
hasso049207c2004-08-04 20:02:13 +0000192 oa = (struct ospf6_area *) getdata (i);
193 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
194 ospf6_lsdb_show (vty, level, NULL, NULL, NULL, oa->lsdb);
hasso508e53e2004-05-18 18:57:06 +0000195 }
hasso049207c2004-08-04 20:02:13 +0000196
hasso508e53e2004-05-18 18:57:06 +0000197 for (i = listhead (o->area_list); i; nextnode (i))
198 {
hasso049207c2004-08-04 20:02:13 +0000199 oa = (struct ospf6_area *) getdata (i);
hasso508e53e2004-05-18 18:57:06 +0000200 for (j = listhead (oa->if_list); j; nextnode (j))
201 {
hasso049207c2004-08-04 20:02:13 +0000202 oi = (struct ospf6_interface *) getdata (j);
203 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
204 oi->interface->name, oa->name, VNL, VNL);
205 ospf6_lsdb_show (vty, level, NULL, NULL, NULL, oi->lsdb);
hasso508e53e2004-05-18 18:57:06 +0000206 }
207 }
208
hasso049207c2004-08-04 20:02:13 +0000209 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
210 ospf6_lsdb_show (vty, level, NULL, NULL, NULL, o->lsdb);
211
212 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +0000213 return CMD_SUCCESS;
214}
215
216ALIAS (show_ipv6_ospf6_database,
217 show_ipv6_ospf6_database_detail_cmd,
218 "show ipv6 ospf6 database (detail|dump|internal)",
219 SHOW_STR
220 IPV6_STR
221 OSPF6_STR
222 "Display Link state database\n"
223 "Display details of LSAs\n"
224 "Dump LSAs\n"
225 "Display LSA's internal information\n"
226 );
227
228DEFUN (show_ipv6_ospf6_database_type,
229 show_ipv6_ospf6_database_type_cmd,
230 "show ipv6 ospf6 database "
231 "(router|network|inter-prefix|inter-router|as-external|"
232 "group-membership|type-7|link|intra-prefix)",
233 SHOW_STR
234 IPV6_STR
235 OSPF6_STR
236 "Display Link state database\n"
237 "Display Router LSAs\n"
238 "Display Network LSAs\n"
239 "Display Inter-Area-Prefix LSAs\n"
240 "Display Inter-Area-Router LSAs\n"
241 "Display As-External LSAs\n"
242 "Display Group-Membership LSAs\n"
243 "Display Type-7 LSAs\n"
244 "Display Link LSAs\n"
245 "Display Intra-Area-Prefix LSAs\n"
246 )
247{
hasso049207c2004-08-04 20:02:13 +0000248 int level;
hasso52dc7ee2004-09-23 19:18:23 +0000249 struct listnode *i, *j;
hasso508e53e2004-05-18 18:57:06 +0000250 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +0000251 struct ospf6_area *oa;
252 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +0000253 u_int16_t type = 0;
254
255 OSPF6_CMD_CHECK_RUNNING ();
256
hasso049207c2004-08-04 20:02:13 +0000257 type = parse_type_spec (argc, argv);
258 argc--;
259 argv++;
260 level = parse_show_level (argc, argv);
hasso508e53e2004-05-18 18:57:06 +0000261
hasso049207c2004-08-04 20:02:13 +0000262 switch (OSPF6_LSA_SCOPE (type))
hasso508e53e2004-05-18 18:57:06 +0000263 {
hasso6452df02004-08-15 05:52:07 +0000264 case OSPF6_SCOPE_AREA:
hasso049207c2004-08-04 20:02:13 +0000265 for (i = listhead (o->area_list); i; nextnode (i))
266 {
267 oa = (struct ospf6_area *) getdata (i);
268 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
269 ospf6_lsdb_show (vty, level, &type, NULL, NULL, oa->lsdb);
270 }
271 break;
272
hasso6452df02004-08-15 05:52:07 +0000273 case OSPF6_SCOPE_LINKLOCAL:
hasso049207c2004-08-04 20:02:13 +0000274 for (i = listhead (o->area_list); i; nextnode (i))
275 {
276 oa = (struct ospf6_area *) getdata (i);
277 for (j = listhead (oa->if_list); j; nextnode (j))
278 {
279 oi = (struct ospf6_interface *) getdata (j);
280 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
281 oi->interface->name, oa->name, VNL, VNL);
282 ospf6_lsdb_show (vty, level, &type, NULL, NULL, oi->lsdb);
283 }
284 }
285 break;
286
hasso6452df02004-08-15 05:52:07 +0000287 case OSPF6_SCOPE_AS:
hasso049207c2004-08-04 20:02:13 +0000288 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
289 ospf6_lsdb_show (vty, level, &type, NULL, NULL, o->lsdb);
290 break;
291
292 default:
293 assert (0);
294 break;
hasso508e53e2004-05-18 18:57:06 +0000295 }
296
hasso049207c2004-08-04 20:02:13 +0000297 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +0000298 return CMD_SUCCESS;
299}
300
301ALIAS (show_ipv6_ospf6_database_type,
302 show_ipv6_ospf6_database_type_detail_cmd,
303 "show ipv6 ospf6 database "
304 "(router|network|inter-prefix|inter-router|as-external|"
305 "group-membership|type-7|link|intra-prefix) "
306 "(detail|dump|internal)",
307 SHOW_STR
308 IPV6_STR
309 OSPF6_STR
310 "Display Link state database\n"
311 "Display Router LSAs\n"
312 "Display Network LSAs\n"
313 "Display Inter-Area-Prefix LSAs\n"
314 "Display Inter-Area-Router LSAs\n"
315 "Display As-External LSAs\n"
316 "Display Group-Membership LSAs\n"
317 "Display Type-7 LSAs\n"
318 "Display Link LSAs\n"
319 "Display Intra-Area-Prefix LSAs\n"
320 "Display details of LSAs\n"
321 "Dump LSAs\n"
322 "Display LSA's internal information\n"
323 );
324
325DEFUN (show_ipv6_ospf6_database_id,
326 show_ipv6_ospf6_database_id_cmd,
327 "show ipv6 ospf6 database * A.B.C.D",
328 SHOW_STR
329 IPV6_STR
330 OSPF6_STR
331 "Display Link state database\n"
332 "Any Link state Type\n"
333 "Specify Link state ID as IPv4 address notation\n"
334 )
335{
hasso049207c2004-08-04 20:02:13 +0000336 int level;
hasso52dc7ee2004-09-23 19:18:23 +0000337 struct listnode *i, *j;
hasso508e53e2004-05-18 18:57:06 +0000338 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +0000339 struct ospf6_area *oa;
340 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +0000341 u_int32_t id = 0;
342
343 OSPF6_CMD_CHECK_RUNNING ();
344
hasso508e53e2004-05-18 18:57:06 +0000345 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
346 {
347 vty_out (vty, "Link State ID is not parsable: %s%s",
hasso049207c2004-08-04 20:02:13 +0000348 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000349 return CMD_SUCCESS;
350 }
351
hasso049207c2004-08-04 20:02:13 +0000352 argc--;
353 argv++;
354 level = parse_show_level (argc, argv);
355
hasso508e53e2004-05-18 18:57:06 +0000356 for (i = listhead (o->area_list); i; nextnode (i))
357 {
hasso049207c2004-08-04 20:02:13 +0000358 oa = (struct ospf6_area *) getdata (i);
359 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
360 ospf6_lsdb_show (vty, level, NULL, &id, NULL, oa->lsdb);
hasso508e53e2004-05-18 18:57:06 +0000361 }
hasso049207c2004-08-04 20:02:13 +0000362
hasso508e53e2004-05-18 18:57:06 +0000363 for (i = listhead (o->area_list); i; nextnode (i))
364 {
hasso049207c2004-08-04 20:02:13 +0000365 oa = (struct ospf6_area *) getdata (i);
hasso508e53e2004-05-18 18:57:06 +0000366 for (j = listhead (oa->if_list); j; nextnode (j))
367 {
hasso049207c2004-08-04 20:02:13 +0000368 oi = (struct ospf6_interface *) getdata (j);
369 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
370 oi->interface->name, oa->name, VNL, VNL);
371 ospf6_lsdb_show (vty, level, NULL, &id, NULL, oi->lsdb);
hasso508e53e2004-05-18 18:57:06 +0000372 }
373 }
374
hasso049207c2004-08-04 20:02:13 +0000375 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
376 ospf6_lsdb_show (vty, level, NULL, &id, NULL, o->lsdb);
377
378 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +0000379 return CMD_SUCCESS;
380}
381
382ALIAS (show_ipv6_ospf6_database_id,
383 show_ipv6_ospf6_database_id_detail_cmd,
384 "show ipv6 ospf6 database * A.B.C.D "
385 "(detail|dump|internal)",
386 SHOW_STR
387 IPV6_STR
388 OSPF6_STR
389 "Display Link state database\n"
390 "Any Link state Type\n"
hasso049207c2004-08-04 20:02:13 +0000391 "Specify Link state ID as IPv4 address notation\n"
392 "Display details of LSAs\n"
393 "Dump LSAs\n"
394 "Display LSA's internal information\n"
395 );
396
397ALIAS (show_ipv6_ospf6_database_id,
398 show_ipv6_ospf6_database_linkstate_id_cmd,
399 "show ipv6 ospf6 database linkstate-id A.B.C.D",
400 SHOW_STR
401 IPV6_STR
402 OSPF6_STR
403 "Display Link state database\n"
404 "Search by Link state ID\n"
405 "Specify Link state ID as IPv4 address notation\n"
406 );
407
408ALIAS (show_ipv6_ospf6_database_id,
409 show_ipv6_ospf6_database_linkstate_id_detail_cmd,
410 "show ipv6 ospf6 database linkstate-id A.B.C.D "
411 "(detail|dump|internal)",
412 SHOW_STR
413 IPV6_STR
414 OSPF6_STR
415 "Display Link state database\n"
416 "Search by Link state ID\n"
hasso508e53e2004-05-18 18:57:06 +0000417 "Specify Link state ID as IPv4 address notation\n"
418 "Display details of LSAs\n"
419 "Dump LSAs\n"
420 "Display LSA's internal information\n"
421 );
422
423DEFUN (show_ipv6_ospf6_database_router,
424 show_ipv6_ospf6_database_router_cmd,
425 "show ipv6 ospf6 database * * A.B.C.D",
426 SHOW_STR
427 IPV6_STR
428 OSPF6_STR
429 "Display Link state database\n"
430 "Any Link state Type\n"
431 "Any Link state ID\n"
432 "Specify Advertising Router as IPv4 address notation\n"
433 )
434{
hasso049207c2004-08-04 20:02:13 +0000435 int level;
hasso52dc7ee2004-09-23 19:18:23 +0000436 struct listnode *i, *j;
hasso508e53e2004-05-18 18:57:06 +0000437 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +0000438 struct ospf6_area *oa;
439 struct ospf6_interface *oi;
440 u_int32_t adv_router = 0;
hasso508e53e2004-05-18 18:57:06 +0000441
442 OSPF6_CMD_CHECK_RUNNING ();
443
hasso049207c2004-08-04 20:02:13 +0000444 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
hasso508e53e2004-05-18 18:57:06 +0000445 {
446 vty_out (vty, "Advertising Router is not parsable: %s%s",
hasso049207c2004-08-04 20:02:13 +0000447 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000448 return CMD_SUCCESS;
449 }
450
hasso049207c2004-08-04 20:02:13 +0000451 argc--;
452 argv++;
453 level = parse_show_level (argc, argv);
454
hasso508e53e2004-05-18 18:57:06 +0000455 for (i = listhead (o->area_list); i; nextnode (i))
456 {
hasso049207c2004-08-04 20:02:13 +0000457 oa = (struct ospf6_area *) getdata (i);
458 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
459 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oa->lsdb);
hasso508e53e2004-05-18 18:57:06 +0000460 }
hasso049207c2004-08-04 20:02:13 +0000461
hasso508e53e2004-05-18 18:57:06 +0000462 for (i = listhead (o->area_list); i; nextnode (i))
463 {
hasso049207c2004-08-04 20:02:13 +0000464 oa = (struct ospf6_area *) getdata (i);
hasso508e53e2004-05-18 18:57:06 +0000465 for (j = listhead (oa->if_list); j; nextnode (j))
466 {
hasso049207c2004-08-04 20:02:13 +0000467 oi = (struct ospf6_interface *) getdata (j);
468 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
469 oi->interface->name, oa->name, VNL, VNL);
470 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oi->lsdb);
hasso508e53e2004-05-18 18:57:06 +0000471 }
472 }
473
hasso049207c2004-08-04 20:02:13 +0000474 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
475 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, o->lsdb);
476
477 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +0000478 return CMD_SUCCESS;
479}
480
481ALIAS (show_ipv6_ospf6_database_router,
482 show_ipv6_ospf6_database_router_detail_cmd,
483 "show ipv6 ospf6 database * * A.B.C.D "
484 "(detail|dump|internal)",
485 SHOW_STR
486 IPV6_STR
487 OSPF6_STR
488 "Display Link state database\n"
489 "Any Link state Type\n"
490 "Any Link state ID\n"
491 "Specify Advertising Router as IPv4 address notation\n"
492 "Display details of LSAs\n"
493 "Dump LSAs\n"
494 "Display LSA's internal information\n"
495 );
496
hasso049207c2004-08-04 20:02:13 +0000497ALIAS (show_ipv6_ospf6_database_router,
498 show_ipv6_ospf6_database_adv_router_cmd,
499 "show ipv6 ospf6 database adv-router A.B.C.D",
500 SHOW_STR
501 IPV6_STR
502 OSPF6_STR
503 "Display Link state database\n"
504 "Search by Advertising Router\n"
505 "Specify Advertising Router as IPv4 address notation\n"
506 );
507
508ALIAS (show_ipv6_ospf6_database_router,
509 show_ipv6_ospf6_database_adv_router_detail_cmd,
510 "show ipv6 ospf6 database adv-router A.B.C.D "
511 "(detail|dump|internal)",
512 SHOW_STR
513 IPV6_STR
514 OSPF6_STR
515 "Display Link state database\n"
516 "Search by Advertising Router\n"
517 "Specify Advertising Router as IPv4 address notation\n"
518 "Display details of LSAs\n"
519 "Dump LSAs\n"
520 "Display LSA's internal information\n"
521 );
522
hasso508e53e2004-05-18 18:57:06 +0000523DEFUN (show_ipv6_ospf6_database_type_id,
524 show_ipv6_ospf6_database_type_id_cmd,
525 "show ipv6 ospf6 database "
526 "(router|network|inter-prefix|inter-router|as-external|"
527 "group-membership|type-7|link|intra-prefix) A.B.C.D",
528 SHOW_STR
529 IPV6_STR
530 OSPF6_STR
531 "Display Link state database\n"
532 "Display Router LSAs\n"
533 "Display Network LSAs\n"
534 "Display Inter-Area-Prefix LSAs\n"
535 "Display Inter-Area-Router LSAs\n"
536 "Display As-External LSAs\n"
537 "Display Group-Membership LSAs\n"
538 "Display Type-7 LSAs\n"
539 "Display Link LSAs\n"
540 "Display Intra-Area-Prefix LSAs\n"
541 "Specify Link state ID as IPv4 address notation\n"
542 )
543{
hasso049207c2004-08-04 20:02:13 +0000544 int level;
hasso52dc7ee2004-09-23 19:18:23 +0000545 struct listnode *i, *j;
hasso508e53e2004-05-18 18:57:06 +0000546 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +0000547 struct ospf6_area *oa;
548 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +0000549 u_int16_t type = 0;
550 u_int32_t id = 0;
551
552 OSPF6_CMD_CHECK_RUNNING ();
553
hasso049207c2004-08-04 20:02:13 +0000554 type = parse_type_spec (argc, argv);
555 argc--;
556 argv++;
hasso508e53e2004-05-18 18:57:06 +0000557
hasso049207c2004-08-04 20:02:13 +0000558 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
hasso508e53e2004-05-18 18:57:06 +0000559 {
560 vty_out (vty, "Link state ID is not parsable: %s%s",
hasso049207c2004-08-04 20:02:13 +0000561 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000562 return CMD_SUCCESS;
563 }
564
hasso049207c2004-08-04 20:02:13 +0000565 argc--;
566 argv++;
567 level = parse_show_level (argc, argv);
568
569 switch (OSPF6_LSA_SCOPE (type))
hasso508e53e2004-05-18 18:57:06 +0000570 {
hasso6452df02004-08-15 05:52:07 +0000571 case OSPF6_SCOPE_AREA:
hasso049207c2004-08-04 20:02:13 +0000572 for (i = listhead (o->area_list); i; nextnode (i))
573 {
574 oa = (struct ospf6_area *) getdata (i);
575 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
576 ospf6_lsdb_show (vty, level, &type, &id, NULL, oa->lsdb);
577 }
578 break;
579
hasso6452df02004-08-15 05:52:07 +0000580 case OSPF6_SCOPE_LINKLOCAL:
hasso049207c2004-08-04 20:02:13 +0000581 for (i = listhead (o->area_list); i; nextnode (i))
582 {
583 oa = (struct ospf6_area *) getdata (i);
584 for (j = listhead (oa->if_list); j; nextnode (j))
585 {
586 oi = (struct ospf6_interface *) getdata (j);
587 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
588 oi->interface->name, oa->name, VNL, VNL);
589 ospf6_lsdb_show (vty, level, &type, &id, NULL, oi->lsdb);
590 }
591 }
592 break;
593
hasso6452df02004-08-15 05:52:07 +0000594 case OSPF6_SCOPE_AS:
hasso049207c2004-08-04 20:02:13 +0000595 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
596 ospf6_lsdb_show (vty, level, &type, &id, NULL, o->lsdb);
597 break;
598
599 default:
600 assert (0);
601 break;
hasso508e53e2004-05-18 18:57:06 +0000602 }
603
hasso049207c2004-08-04 20:02:13 +0000604 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +0000605 return CMD_SUCCESS;
606}
607
608ALIAS (show_ipv6_ospf6_database_type_id,
609 show_ipv6_ospf6_database_type_id_detail_cmd,
610 "show ipv6 ospf6 database "
611 "(router|network|inter-prefix|inter-router|as-external|"
612 "group-membership|type-7|link|intra-prefix) A.B.C.D "
613 "(detail|dump|internal)",
614 SHOW_STR
615 IPV6_STR
616 OSPF6_STR
617 "Display Link state database\n"
618 "Display Router LSAs\n"
619 "Display Network LSAs\n"
620 "Display Inter-Area-Prefix LSAs\n"
621 "Display Inter-Area-Router LSAs\n"
622 "Display As-External LSAs\n"
623 "Display Group-Membership LSAs\n"
624 "Display Type-7 LSAs\n"
625 "Display Link LSAs\n"
626 "Display Intra-Area-Prefix LSAs\n"
627 "Specify Link state ID as IPv4 address notation\n"
628 "Display details of LSAs\n"
629 "Dump LSAs\n"
630 "Display LSA's internal information\n"
631 );
632
hasso049207c2004-08-04 20:02:13 +0000633ALIAS (show_ipv6_ospf6_database_type_id,
634 show_ipv6_ospf6_database_type_linkstate_id_cmd,
635 "show ipv6 ospf6 database "
636 "(router|network|inter-prefix|inter-router|as-external|"
637 "group-membership|type-7|link|intra-prefix) linkstate-id A.B.C.D",
638 SHOW_STR
639 IPV6_STR
640 OSPF6_STR
641 "Display Link state database\n"
642 "Display Router LSAs\n"
643 "Display Network LSAs\n"
644 "Display Inter-Area-Prefix LSAs\n"
645 "Display Inter-Area-Router LSAs\n"
646 "Display As-External LSAs\n"
647 "Display Group-Membership LSAs\n"
648 "Display Type-7 LSAs\n"
649 "Display Link LSAs\n"
650 "Display Intra-Area-Prefix LSAs\n"
651 "Search by Link state ID\n"
652 "Specify Link state ID as IPv4 address notation\n"
653 );
654
655ALIAS (show_ipv6_ospf6_database_type_id,
656 show_ipv6_ospf6_database_type_linkstate_id_detail_cmd,
657 "show ipv6 ospf6 database "
658 "(router|network|inter-prefix|inter-router|as-external|"
659 "group-membership|type-7|link|intra-prefix) linkstate-id A.B.C.D "
660 "(detail|dump|internal)",
661 SHOW_STR
662 IPV6_STR
663 OSPF6_STR
664 "Display Link state database\n"
665 "Display Router LSAs\n"
666 "Display Network LSAs\n"
667 "Display Inter-Area-Prefix LSAs\n"
668 "Display Inter-Area-Router LSAs\n"
669 "Display As-External LSAs\n"
670 "Display Group-Membership LSAs\n"
671 "Display Type-7 LSAs\n"
672 "Display Link LSAs\n"
673 "Display Intra-Area-Prefix LSAs\n"
674 "Search by Link state ID\n"
675 "Specify Link state ID as IPv4 address notation\n"
676 "Display details of LSAs\n"
677 "Dump LSAs\n"
678 "Display LSA's internal information\n"
679 );
680
hasso508e53e2004-05-18 18:57:06 +0000681DEFUN (show_ipv6_ospf6_database_type_router,
682 show_ipv6_ospf6_database_type_router_cmd,
683 "show ipv6 ospf6 database "
684 "(router|network|inter-prefix|inter-router|as-external|"
685 "group-membership|type-7|link|intra-prefix) * A.B.C.D",
686 SHOW_STR
687 IPV6_STR
688 OSPF6_STR
689 "Display Link state database\n"
690 "Display Router LSAs\n"
691 "Display Network LSAs\n"
692 "Display Inter-Area-Prefix LSAs\n"
693 "Display Inter-Area-Router LSAs\n"
694 "Display As-External LSAs\n"
695 "Display Group-Membership LSAs\n"
696 "Display Type-7 LSAs\n"
697 "Display Link LSAs\n"
698 "Display Intra-Area-Prefix LSAs\n"
699 "Any Link state ID\n"
700 "Specify Advertising Router as IPv4 address notation\n"
701 )
702{
hasso049207c2004-08-04 20:02:13 +0000703 int level;
hasso52dc7ee2004-09-23 19:18:23 +0000704 struct listnode *i, *j;
hasso508e53e2004-05-18 18:57:06 +0000705 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +0000706 struct ospf6_area *oa;
707 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +0000708 u_int16_t type = 0;
hasso049207c2004-08-04 20:02:13 +0000709 u_int32_t adv_router = 0;
hasso508e53e2004-05-18 18:57:06 +0000710
711 OSPF6_CMD_CHECK_RUNNING ();
712
hasso049207c2004-08-04 20:02:13 +0000713 type = parse_type_spec (argc, argv);
714 argc--;
715 argv++;
hasso508e53e2004-05-18 18:57:06 +0000716
hasso049207c2004-08-04 20:02:13 +0000717 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
hasso508e53e2004-05-18 18:57:06 +0000718 {
719 vty_out (vty, "Advertising Router is not parsable: %s%s",
hasso049207c2004-08-04 20:02:13 +0000720 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000721 return CMD_SUCCESS;
722 }
723
hasso049207c2004-08-04 20:02:13 +0000724 argc--;
725 argv++;
726 level = parse_show_level (argc, argv);
727
728 switch (OSPF6_LSA_SCOPE (type))
hasso508e53e2004-05-18 18:57:06 +0000729 {
hasso6452df02004-08-15 05:52:07 +0000730 case OSPF6_SCOPE_AREA:
hasso049207c2004-08-04 20:02:13 +0000731 for (i = listhead (o->area_list); i; nextnode (i))
732 {
733 oa = (struct ospf6_area *) getdata (i);
734 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
735 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oa->lsdb);
736 }
737 break;
738
hasso6452df02004-08-15 05:52:07 +0000739 case OSPF6_SCOPE_LINKLOCAL:
hasso049207c2004-08-04 20:02:13 +0000740 for (i = listhead (o->area_list); i; nextnode (i))
741 {
742 oa = (struct ospf6_area *) getdata (i);
743 for (j = listhead (oa->if_list); j; nextnode (j))
744 {
745 oi = (struct ospf6_interface *) getdata (j);
746 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
747 oi->interface->name, oa->name, VNL, VNL);
748 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oi->lsdb);
749 }
750 }
751 break;
752
hasso6452df02004-08-15 05:52:07 +0000753 case OSPF6_SCOPE_AS:
hasso049207c2004-08-04 20:02:13 +0000754 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
755 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, o->lsdb);
756 break;
757
758 default:
759 assert (0);
760 break;
hasso508e53e2004-05-18 18:57:06 +0000761 }
762
hasso049207c2004-08-04 20:02:13 +0000763 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +0000764 return CMD_SUCCESS;
765}
766
767ALIAS (show_ipv6_ospf6_database_type_router,
768 show_ipv6_ospf6_database_type_router_detail_cmd,
769 "show ipv6 ospf6 database "
770 "(router|network|inter-prefix|inter-router|as-external|"
771 "group-membership|type-7|link|intra-prefix) * A.B.C.D "
772 "(detail|dump|internal)",
773 SHOW_STR
774 IPV6_STR
775 OSPF6_STR
776 "Display Link state database\n"
777 "Display Router LSAs\n"
778 "Display Network LSAs\n"
779 "Display Inter-Area-Prefix LSAs\n"
780 "Display Inter-Area-Router LSAs\n"
781 "Display As-External LSAs\n"
782 "Display Group-Membership LSAs\n"
783 "Display Type-7 LSAs\n"
784 "Display Link LSAs\n"
785 "Display Intra-Area-Prefix LSAs\n"
786 "Any Link state ID\n"
787 "Specify Advertising Router as IPv4 address notation\n"
788 "Display details of LSAs\n"
789 "Dump LSAs\n"
790 "Display LSA's internal information\n"
791 );
792
hasso049207c2004-08-04 20:02:13 +0000793ALIAS (show_ipv6_ospf6_database_type_router,
794 show_ipv6_ospf6_database_type_adv_router_cmd,
795 "show ipv6 ospf6 database "
796 "(router|network|inter-prefix|inter-router|as-external|"
797 "group-membership|type-7|link|intra-prefix) adv-router A.B.C.D",
798 SHOW_STR
799 IPV6_STR
800 OSPF6_STR
801 "Display Link state database\n"
802 "Display Router LSAs\n"
803 "Display Network LSAs\n"
804 "Display Inter-Area-Prefix LSAs\n"
805 "Display Inter-Area-Router LSAs\n"
806 "Display As-External LSAs\n"
807 "Display Group-Membership LSAs\n"
808 "Display Type-7 LSAs\n"
809 "Display Link LSAs\n"
810 "Display Intra-Area-Prefix LSAs\n"
811 "Search by Advertising Router\n"
812 "Specify Advertising Router as IPv4 address notation\n"
813 );
814
815ALIAS (show_ipv6_ospf6_database_type_router,
816 show_ipv6_ospf6_database_type_adv_router_detail_cmd,
817 "show ipv6 ospf6 database "
818 "(router|network|inter-prefix|inter-router|as-external|"
819 "group-membership|type-7|link|intra-prefix) adv-router A.B.C.D "
820 "(detail|dump|internal)",
821 SHOW_STR
822 IPV6_STR
823 OSPF6_STR
824 "Display Link state database\n"
825 "Display Router LSAs\n"
826 "Display Network LSAs\n"
827 "Display Inter-Area-Prefix LSAs\n"
828 "Display Inter-Area-Router LSAs\n"
829 "Display As-External LSAs\n"
830 "Display Group-Membership LSAs\n"
831 "Display Type-7 LSAs\n"
832 "Display Link LSAs\n"
833 "Display Intra-Area-Prefix LSAs\n"
834 "Search by Advertising Router\n"
835 "Specify Advertising Router as IPv4 address notation\n"
836 "Display details of LSAs\n"
837 "Dump LSAs\n"
838 "Display LSA's internal information\n"
839 );
840
hasso508e53e2004-05-18 18:57:06 +0000841DEFUN (show_ipv6_ospf6_database_id_router,
842 show_ipv6_ospf6_database_id_router_cmd,
843 "show ipv6 ospf6 database * A.B.C.D A.B.C.D",
844 SHOW_STR
845 IPV6_STR
846 OSPF6_STR
847 "Display Link state database\n"
848 "Any Link state Type\n"
849 "Specify Link state ID as IPv4 address notation\n"
850 "Specify Advertising Router as IPv4 address notation\n"
851 )
852{
hasso049207c2004-08-04 20:02:13 +0000853 int level;
hasso52dc7ee2004-09-23 19:18:23 +0000854 struct listnode *i, *j;
hasso508e53e2004-05-18 18:57:06 +0000855 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +0000856 struct ospf6_area *oa;
857 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +0000858 u_int32_t id = 0;
hasso049207c2004-08-04 20:02:13 +0000859 u_int32_t adv_router = 0;
hasso508e53e2004-05-18 18:57:06 +0000860
861 OSPF6_CMD_CHECK_RUNNING ();
862
hasso508e53e2004-05-18 18:57:06 +0000863 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
864 {
865 vty_out (vty, "Link state ID is not parsable: %s%s",
hasso6452df02004-08-15 05:52:07 +0000866 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000867 return CMD_SUCCESS;
868 }
869
hasso049207c2004-08-04 20:02:13 +0000870 argc--;
871 argv++;
872
873 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
hasso508e53e2004-05-18 18:57:06 +0000874 {
875 vty_out (vty, "Advertising Router is not parsable: %s%s",
hasso049207c2004-08-04 20:02:13 +0000876 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000877 return CMD_SUCCESS;
878 }
879
hasso049207c2004-08-04 20:02:13 +0000880 argc--;
881 argv++;
882 level = parse_show_level (argc, argv);
883
hasso508e53e2004-05-18 18:57:06 +0000884 for (i = listhead (o->area_list); i; nextnode (i))
885 {
hasso049207c2004-08-04 20:02:13 +0000886 oa = (struct ospf6_area *) getdata (i);
887 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
888 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oa->lsdb);
hasso508e53e2004-05-18 18:57:06 +0000889 }
hasso049207c2004-08-04 20:02:13 +0000890
hasso508e53e2004-05-18 18:57:06 +0000891 for (i = listhead (o->area_list); i; nextnode (i))
892 {
hasso049207c2004-08-04 20:02:13 +0000893 oa = (struct ospf6_area *) getdata (i);
hasso508e53e2004-05-18 18:57:06 +0000894 for (j = listhead (oa->if_list); j; nextnode (j))
895 {
hasso049207c2004-08-04 20:02:13 +0000896 oi = (struct ospf6_interface *) getdata (j);
897 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
898 oi->interface->name, oa->name, VNL, VNL);
899 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oi->lsdb);
hasso508e53e2004-05-18 18:57:06 +0000900 }
901 }
902
hasso049207c2004-08-04 20:02:13 +0000903 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
904 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, o->lsdb);
905
906 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +0000907 return CMD_SUCCESS;
908}
909
910ALIAS (show_ipv6_ospf6_database_id_router,
911 show_ipv6_ospf6_database_id_router_detail_cmd,
912 "show ipv6 ospf6 database * A.B.C.D A.B.C.D "
913 "(detail|dump|internal)",
914 SHOW_STR
915 IPV6_STR
916 OSPF6_STR
917 "Display Link state database\n"
918 "Any Link state Type\n"
919 "Specify Link state ID as IPv4 address notation\n"
920 "Specify Advertising Router as IPv4 address notation\n"
921 "Display details of LSAs\n"
922 "Dump LSAs\n"
923 "Display LSA's internal information\n"
924 );
925
hasso049207c2004-08-04 20:02:13 +0000926DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id,
927 show_ipv6_ospf6_database_adv_router_linkstate_id_cmd,
928 "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D",
929 SHOW_STR
930 IPV6_STR
931 OSPF6_STR
932 "Display Link state database\n"
933 "Search by Advertising Router\n"
934 "Specify Advertising Router as IPv4 address notation\n"
935 "Search by Link state ID\n"
936 "Specify Link state ID as IPv4 address notation\n"
937 )
938{
939 int level;
hasso52dc7ee2004-09-23 19:18:23 +0000940 struct listnode *i, *j;
hasso049207c2004-08-04 20:02:13 +0000941 struct ospf6 *o = ospf6;
942 struct ospf6_area *oa;
943 struct ospf6_interface *oi;
944 u_int32_t id = 0;
945 u_int32_t adv_router = 0;
946
947 OSPF6_CMD_CHECK_RUNNING ();
948
949 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
950 {
951 vty_out (vty, "Advertising Router is not parsable: %s%s",
952 argv[0], VNL);
953 return CMD_SUCCESS;
954 }
955
956 argc--;
957 argv++;
958
959 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
960 {
961 vty_out (vty, "Link state ID is not parsable: %s%s",
hasso6452df02004-08-15 05:52:07 +0000962 argv[0], VNL);
hasso049207c2004-08-04 20:02:13 +0000963 return CMD_SUCCESS;
964 }
965
966 argc--;
967 argv++;
968 level = parse_show_level (argc, argv);
969
970 for (i = listhead (o->area_list); i; nextnode (i))
971 {
972 oa = (struct ospf6_area *) getdata (i);
973 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
974 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oa->lsdb);
975 }
976
977 for (i = listhead (o->area_list); i; nextnode (i))
978 {
979 oa = (struct ospf6_area *) getdata (i);
980 for (j = listhead (oa->if_list); j; nextnode (j))
981 {
982 oi = (struct ospf6_interface *) getdata (j);
983 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
984 oi->interface->name, oa->name, VNL, VNL);
985 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oi->lsdb);
986 }
987 }
988
989 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
990 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, o->lsdb);
991
992 vty_out (vty, "%s", VNL);
993 return CMD_SUCCESS;
994}
995
996ALIAS (show_ipv6_ospf6_database_adv_router_linkstate_id,
997 show_ipv6_ospf6_database_adv_router_linkstate_id_detail_cmd,
998 "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D "
999 "(detail|dump|internal)",
1000 SHOW_STR
1001 IPV6_STR
1002 OSPF6_STR
1003 "Display Link state database\n"
1004 "Search by Advertising Router\n"
1005 "Specify Advertising Router as IPv4 address notation\n"
1006 "Search by Link state ID\n"
1007 "Specify Link state ID as IPv4 address notation\n"
1008 "Display details of LSAs\n"
1009 "Dump LSAs\n"
1010 "Display LSA's internal information\n"
1011 );
1012
hasso508e53e2004-05-18 18:57:06 +00001013DEFUN (show_ipv6_ospf6_database_type_id_router,
1014 show_ipv6_ospf6_database_type_id_router_cmd,
1015 "show ipv6 ospf6 database "
1016 "(router|network|inter-prefix|inter-router|as-external|"
1017 "group-membership|type-7|link|intra-prefix) A.B.C.D A.B.C.D",
1018 SHOW_STR
1019 IPV6_STR
1020 OSPF6_STR
1021 "Display Link state database\n"
1022 "Display Router LSAs\n"
1023 "Display Network LSAs\n"
1024 "Display Inter-Area-Prefix LSAs\n"
1025 "Display Inter-Area-Router LSAs\n"
1026 "Display As-External LSAs\n"
1027 "Display Group-Membership LSAs\n"
1028 "Display Type-7 LSAs\n"
1029 "Display Link LSAs\n"
1030 "Display Intra-Area-Prefix LSAs\n"
1031 "Specify Link state ID as IPv4 address notation\n"
1032 "Specify Advertising Router as IPv4 address notation\n"
1033 )
1034{
hasso049207c2004-08-04 20:02:13 +00001035 int level;
hasso52dc7ee2004-09-23 19:18:23 +00001036 struct listnode *i, *j;
hasso508e53e2004-05-18 18:57:06 +00001037 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +00001038 struct ospf6_area *oa;
1039 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +00001040 u_int16_t type = 0;
1041 u_int32_t id = 0;
hasso049207c2004-08-04 20:02:13 +00001042 u_int32_t adv_router = 0;
hasso508e53e2004-05-18 18:57:06 +00001043
1044 OSPF6_CMD_CHECK_RUNNING ();
1045
hasso049207c2004-08-04 20:02:13 +00001046 type = parse_type_spec (argc, argv);
1047 argc--;
1048 argv++;
hasso508e53e2004-05-18 18:57:06 +00001049
hasso049207c2004-08-04 20:02:13 +00001050 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
hasso508e53e2004-05-18 18:57:06 +00001051 {
1052 vty_out (vty, "Link state ID is not parsable: %s%s",
hasso049207c2004-08-04 20:02:13 +00001053 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +00001054 return CMD_SUCCESS;
1055 }
1056
hasso049207c2004-08-04 20:02:13 +00001057 argc--;
1058 argv++;
1059
1060 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
hasso508e53e2004-05-18 18:57:06 +00001061 {
1062 vty_out (vty, "Advertising Router is not parsable: %s%s",
hasso049207c2004-08-04 20:02:13 +00001063 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +00001064 return CMD_SUCCESS;
1065 }
1066
hasso049207c2004-08-04 20:02:13 +00001067 argc--;
1068 argv++;
1069 level = parse_show_level (argc, argv);
1070
1071 switch (OSPF6_LSA_SCOPE (type))
hasso508e53e2004-05-18 18:57:06 +00001072 {
hasso6452df02004-08-15 05:52:07 +00001073 case OSPF6_SCOPE_AREA:
hasso049207c2004-08-04 20:02:13 +00001074 for (i = listhead (o->area_list); i; nextnode (i))
1075 {
1076 oa = (struct ospf6_area *) getdata (i);
1077 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1078 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1079 }
1080 break;
1081
hasso6452df02004-08-15 05:52:07 +00001082 case OSPF6_SCOPE_LINKLOCAL:
hasso049207c2004-08-04 20:02:13 +00001083 for (i = listhead (o->area_list); i; nextnode (i))
1084 {
1085 oa = (struct ospf6_area *) getdata (i);
1086 for (j = listhead (oa->if_list); j; nextnode (j))
1087 {
1088 oi = (struct ospf6_interface *) getdata (j);
1089 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1090 oi->interface->name, oa->name, VNL, VNL);
1091 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1092 }
1093 }
1094 break;
1095
hasso6452df02004-08-15 05:52:07 +00001096 case OSPF6_SCOPE_AS:
hasso049207c2004-08-04 20:02:13 +00001097 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1098 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1099 break;
1100
1101 default:
1102 assert (0);
1103 break;
hasso508e53e2004-05-18 18:57:06 +00001104 }
1105
hasso049207c2004-08-04 20:02:13 +00001106 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +00001107 return CMD_SUCCESS;
1108}
1109
1110ALIAS (show_ipv6_ospf6_database_type_id_router,
1111 show_ipv6_ospf6_database_type_id_router_detail_cmd,
1112 "show ipv6 ospf6 database "
1113 "(router|network|inter-prefix|inter-router|as-external|"
1114 "group-membership|type-7|link|intra-prefix) A.B.C.D A.B.C.D "
1115 "(dump|internal)",
1116 SHOW_STR
1117 IPV6_STR
1118 OSPF6_STR
1119 "Display Link state database\n"
1120 "Display Router LSAs\n"
1121 "Display Network LSAs\n"
1122 "Display Inter-Area-Prefix LSAs\n"
1123 "Display Inter-Area-Router LSAs\n"
1124 "Display As-External LSAs\n"
1125 "Display Group-Membership LSAs\n"
1126 "Display Type-7 LSAs\n"
1127 "Display Link LSAs\n"
1128 "Display Intra-Area-Prefix LSAs\n"
1129 "Specify Link state ID as IPv4 address notation\n"
1130 "Specify Advertising Router as IPv4 address notation\n"
hasso049207c2004-08-04 20:02:13 +00001131 "Dump LSAs\n"
1132 "Display LSA's internal information\n"
1133 );
1134
1135DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id,
1136 show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd,
1137 "show ipv6 ospf6 database "
1138 "(router|network|inter-prefix|inter-router|as-external|"
1139 "group-membership|type-7|link|intra-prefix) "
1140 "adv-router A.B.C.D linkstate-id A.B.C.D",
1141 SHOW_STR
1142 IPV6_STR
1143 OSPF6_STR
1144 "Display Link state database\n"
1145 "Display Router LSAs\n"
1146 "Display Network LSAs\n"
1147 "Display Inter-Area-Prefix LSAs\n"
1148 "Display Inter-Area-Router LSAs\n"
1149 "Display As-External LSAs\n"
1150 "Display Group-Membership LSAs\n"
1151 "Display Type-7 LSAs\n"
1152 "Display Link LSAs\n"
1153 "Display Intra-Area-Prefix LSAs\n"
1154 "Search by Advertising Router\n"
1155 "Specify Advertising Router as IPv4 address notation\n"
1156 "Search by Link state ID\n"
1157 "Specify Link state ID as IPv4 address notation\n"
1158 )
1159{
1160 int level;
hasso52dc7ee2004-09-23 19:18:23 +00001161 struct listnode *i, *j;
hasso049207c2004-08-04 20:02:13 +00001162 struct ospf6 *o = ospf6;
1163 struct ospf6_area *oa;
1164 struct ospf6_interface *oi;
1165 u_int16_t type = 0;
1166 u_int32_t id = 0;
1167 u_int32_t adv_router = 0;
1168
1169 OSPF6_CMD_CHECK_RUNNING ();
1170
1171 type = parse_type_spec (argc, argv);
1172 argc--;
1173 argv++;
1174
1175 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
1176 {
1177 vty_out (vty, "Advertising Router is not parsable: %s%s",
1178 argv[0], VNL);
1179 return CMD_SUCCESS;
1180 }
1181
1182 argc--;
1183 argv++;
1184
1185 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
1186 {
1187 vty_out (vty, "Link state ID is not parsable: %s%s",
1188 argv[0], VNL);
1189 return CMD_SUCCESS;
1190 }
1191
1192 argc--;
1193 argv++;
1194 level = parse_show_level (argc, argv);
1195
1196 switch (OSPF6_LSA_SCOPE (type))
1197 {
hasso6452df02004-08-15 05:52:07 +00001198 case OSPF6_SCOPE_AREA:
hasso049207c2004-08-04 20:02:13 +00001199 for (i = listhead (o->area_list); i; nextnode (i))
1200 {
1201 oa = (struct ospf6_area *) getdata (i);
1202 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1203 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1204 }
1205 break;
1206
hasso6452df02004-08-15 05:52:07 +00001207 case OSPF6_SCOPE_LINKLOCAL:
hasso049207c2004-08-04 20:02:13 +00001208 for (i = listhead (o->area_list); i; nextnode (i))
1209 {
1210 oa = (struct ospf6_area *) getdata (i);
1211 for (j = listhead (oa->if_list); j; nextnode (j))
1212 {
1213 oi = (struct ospf6_interface *) getdata (j);
1214 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1215 oi->interface->name, oa->name, VNL, VNL);
1216 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1217 }
1218 }
1219 break;
1220
hasso6452df02004-08-15 05:52:07 +00001221 case OSPF6_SCOPE_AS:
hasso049207c2004-08-04 20:02:13 +00001222 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1223 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1224 break;
1225
1226 default:
1227 assert (0);
1228 break;
1229 }
1230
1231 vty_out (vty, "%s", VNL);
1232 return CMD_SUCCESS;
1233}
1234
1235ALIAS (show_ipv6_ospf6_database_type_adv_router_linkstate_id,
1236 show_ipv6_ospf6_database_type_adv_router_linkstate_id_detail_cmd,
1237 "show ipv6 ospf6 database "
1238 "(router|network|inter-prefix|inter-router|as-external|"
1239 "group-membership|type-7|link|intra-prefix) "
1240 "adv-router A.B.C.D linkstate-id A.B.C.D "
1241 "(dump|internal)",
1242 SHOW_STR
1243 IPV6_STR
1244 OSPF6_STR
1245 "Display Link state database\n"
1246 "Display Router LSAs\n"
1247 "Display Network LSAs\n"
1248 "Display Inter-Area-Prefix LSAs\n"
1249 "Display Inter-Area-Router LSAs\n"
1250 "Display As-External LSAs\n"
1251 "Display Group-Membership LSAs\n"
1252 "Display Type-7 LSAs\n"
1253 "Display Link LSAs\n"
1254 "Display Intra-Area-Prefix LSAs\n"
1255 "Search by Advertising Router\n"
1256 "Specify Advertising Router as IPv4 address notation\n"
1257 "Search by Link state ID\n"
1258 "Specify Link state ID as IPv4 address notation\n"
hasso508e53e2004-05-18 18:57:06 +00001259 "Dump LSAs\n"
1260 "Display LSA's internal information\n"
1261 );
1262
1263DEFUN (show_ipv6_ospf6_database_self_originated,
1264 show_ipv6_ospf6_database_self_originated_cmd,
1265 "show ipv6 ospf6 database self-originated",
1266 SHOW_STR
1267 IPV6_STR
1268 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001269 "Display Self-originated LSAs\n"
1270 )
1271{
hasso049207c2004-08-04 20:02:13 +00001272 int level;
hasso52dc7ee2004-09-23 19:18:23 +00001273 struct listnode *i, *j;
hasso508e53e2004-05-18 18:57:06 +00001274 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +00001275 struct ospf6_area *oa;
1276 struct ospf6_interface *oi;
1277 u_int32_t adv_router = 0;
hasso508e53e2004-05-18 18:57:06 +00001278
1279 OSPF6_CMD_CHECK_RUNNING ();
1280
hasso049207c2004-08-04 20:02:13 +00001281 level = parse_show_level (argc, argv);
hasso508e53e2004-05-18 18:57:06 +00001282
hasso049207c2004-08-04 20:02:13 +00001283 adv_router = o->router_id;
hasso508e53e2004-05-18 18:57:06 +00001284
hasso508e53e2004-05-18 18:57:06 +00001285 for (i = listhead (o->area_list); i; nextnode (i))
1286 {
hasso049207c2004-08-04 20:02:13 +00001287 oa = (struct ospf6_area *) getdata (i);
1288 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1289 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oa->lsdb);
hasso508e53e2004-05-18 18:57:06 +00001290 }
hasso049207c2004-08-04 20:02:13 +00001291
hasso508e53e2004-05-18 18:57:06 +00001292 for (i = listhead (o->area_list); i; nextnode (i))
1293 {
hasso049207c2004-08-04 20:02:13 +00001294 oa = (struct ospf6_area *) getdata (i);
hasso508e53e2004-05-18 18:57:06 +00001295 for (j = listhead (oa->if_list); j; nextnode (j))
1296 {
hasso049207c2004-08-04 20:02:13 +00001297 oi = (struct ospf6_interface *) getdata (j);
1298 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1299 oi->interface->name, oa->name, VNL, VNL);
1300 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oi->lsdb);
hasso508e53e2004-05-18 18:57:06 +00001301 }
1302 }
1303
hasso049207c2004-08-04 20:02:13 +00001304 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1305 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, o->lsdb);
1306
1307 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +00001308 return CMD_SUCCESS;
1309}
1310
1311ALIAS (show_ipv6_ospf6_database_self_originated,
1312 show_ipv6_ospf6_database_self_originated_detail_cmd,
1313 "show ipv6 ospf6 database self-originated "
1314 "(detail|dump|internal)",
1315 SHOW_STR
1316 IPV6_STR
1317 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001318 "Display Self-originated LSAs\n"
1319 "Display details of LSAs\n"
1320 "Dump LSAs\n"
1321 "Display LSA's internal information\n"
hasso049207c2004-08-04 20:02:13 +00001322 )
hasso508e53e2004-05-18 18:57:06 +00001323
1324DEFUN (show_ipv6_ospf6_database_type_self_originated,
1325 show_ipv6_ospf6_database_type_self_originated_cmd,
1326 "show ipv6 ospf6 database "
1327 "(router|network|inter-prefix|inter-router|as-external|"
1328 "group-membership|type-7|link|intra-prefix) self-originated",
1329 SHOW_STR
1330 IPV6_STR
1331 OSPF6_STR
1332 "Display Link state database\n"
1333 "Display Router LSAs\n"
1334 "Display Network LSAs\n"
1335 "Display Inter-Area-Prefix LSAs\n"
1336 "Display Inter-Area-Router LSAs\n"
1337 "Display As-External LSAs\n"
1338 "Display Group-Membership LSAs\n"
1339 "Display Type-7 LSAs\n"
1340 "Display Link LSAs\n"
1341 "Display Intra-Area-Prefix LSAs\n"
1342 "Display Self-originated LSAs\n"
1343 )
1344{
hasso049207c2004-08-04 20:02:13 +00001345 int level;
hasso52dc7ee2004-09-23 19:18:23 +00001346 struct listnode *i, *j;
hasso508e53e2004-05-18 18:57:06 +00001347 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +00001348 struct ospf6_area *oa;
1349 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +00001350 u_int16_t type = 0;
hasso049207c2004-08-04 20:02:13 +00001351 u_int32_t adv_router = 0;
hasso508e53e2004-05-18 18:57:06 +00001352
1353 OSPF6_CMD_CHECK_RUNNING ();
1354
hasso049207c2004-08-04 20:02:13 +00001355 type = parse_type_spec (argc, argv);
1356 argc--;
1357 argv++;
1358 level = parse_show_level (argc, argv);
hasso508e53e2004-05-18 18:57:06 +00001359
hasso049207c2004-08-04 20:02:13 +00001360 adv_router = o->router_id;
hasso508e53e2004-05-18 18:57:06 +00001361
hasso049207c2004-08-04 20:02:13 +00001362 switch (OSPF6_LSA_SCOPE (type))
1363 {
hasso6452df02004-08-15 05:52:07 +00001364 case OSPF6_SCOPE_AREA:
hasso049207c2004-08-04 20:02:13 +00001365 for (i = listhead (o->area_list); i; nextnode (i))
1366 {
1367 oa = (struct ospf6_area *) getdata (i);
1368 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1369 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oa->lsdb);
1370 }
1371 break;
hasso508e53e2004-05-18 18:57:06 +00001372
hasso6452df02004-08-15 05:52:07 +00001373 case OSPF6_SCOPE_LINKLOCAL:
hasso049207c2004-08-04 20:02:13 +00001374 for (i = listhead (o->area_list); i; nextnode (i))
1375 {
1376 oa = (struct ospf6_area *) getdata (i);
1377 for (j = listhead (oa->if_list); j; nextnode (j))
1378 {
1379 oi = (struct ospf6_interface *) getdata (j);
1380 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1381 oi->interface->name, oa->name, VNL, VNL);
1382 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oi->lsdb);
1383 }
1384 }
1385 break;
1386
hasso6452df02004-08-15 05:52:07 +00001387 case OSPF6_SCOPE_AS:
hasso049207c2004-08-04 20:02:13 +00001388 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1389 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, o->lsdb);
1390 break;
1391
1392 default:
1393 assert (0);
1394 break;
hasso508e53e2004-05-18 18:57:06 +00001395 }
1396
hasso049207c2004-08-04 20:02:13 +00001397 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +00001398 return CMD_SUCCESS;
1399}
1400
1401ALIAS (show_ipv6_ospf6_database_type_self_originated,
1402 show_ipv6_ospf6_database_type_self_originated_detail_cmd,
1403 "show ipv6 ospf6 database "
1404 "(router|network|inter-prefix|inter-router|as-external|"
1405 "group-membership|type-7|link|intra-prefix) self-originated "
1406 "(detail|dump|internal)",
1407 SHOW_STR
1408 IPV6_STR
1409 OSPF6_STR
1410 "Display Link state database\n"
1411 "Display Router LSAs\n"
1412 "Display Network LSAs\n"
1413 "Display Inter-Area-Prefix LSAs\n"
1414 "Display Inter-Area-Router LSAs\n"
1415 "Display As-External LSAs\n"
1416 "Display Group-Membership LSAs\n"
1417 "Display Type-7 LSAs\n"
1418 "Display Link LSAs\n"
1419 "Display Intra-Area-Prefix LSAs\n"
1420 "Display Self-originated LSAs\n"
1421 "Display details of LSAs\n"
1422 "Dump LSAs\n"
1423 "Display LSA's internal information\n"
1424 );
1425
hasso049207c2004-08-04 20:02:13 +00001426DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id,
1427 show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd,
1428 "show ipv6 ospf6 database "
1429 "(router|network|inter-prefix|inter-router|as-external|"
1430 "group-membership|type-7|link|intra-prefix) self-originated "
1431 "linkstate-id A.B.C.D",
1432 SHOW_STR
1433 IPV6_STR
1434 OSPF6_STR
1435 "Display Link state database\n"
1436 "Display Router LSAs\n"
1437 "Display Network LSAs\n"
1438 "Display Inter-Area-Prefix LSAs\n"
1439 "Display Inter-Area-Router LSAs\n"
1440 "Display As-External LSAs\n"
1441 "Display Group-Membership LSAs\n"
1442 "Display Type-7 LSAs\n"
1443 "Display Link LSAs\n"
1444 "Display Intra-Area-Prefix LSAs\n"
1445 "Display Self-originated LSAs\n"
1446 "Search by Link state ID\n"
1447 "Specify Link state ID as IPv4 address notation\n"
1448 )
1449{
1450 int level;
hasso52dc7ee2004-09-23 19:18:23 +00001451 struct listnode *i, *j;
hasso049207c2004-08-04 20:02:13 +00001452 struct ospf6 *o = ospf6;
1453 struct ospf6_area *oa;
1454 struct ospf6_interface *oi;
1455 u_int16_t type = 0;
1456 u_int32_t adv_router = 0;
1457 u_int32_t id = 0;
1458
1459 OSPF6_CMD_CHECK_RUNNING ();
1460
1461 type = parse_type_spec (argc, argv);
1462 argc--;
1463 argv++;
1464
hasso6452df02004-08-15 05:52:07 +00001465 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
hasso049207c2004-08-04 20:02:13 +00001466 {
1467 vty_out (vty, "Link State ID is not parsable: %s%s",
1468 argv[0], VNL);
1469 return CMD_SUCCESS;
1470 }
1471
1472 argc--;
1473 argv++;
1474 level = parse_show_level (argc, argv);
1475
1476 adv_router = o->router_id;
1477
1478 switch (OSPF6_LSA_SCOPE (type))
1479 {
hasso6452df02004-08-15 05:52:07 +00001480 case OSPF6_SCOPE_AREA:
hasso049207c2004-08-04 20:02:13 +00001481 for (i = listhead (o->area_list); i; nextnode (i))
1482 {
1483 oa = (struct ospf6_area *) getdata (i);
1484 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1485 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1486 }
1487 break;
1488
hasso6452df02004-08-15 05:52:07 +00001489 case OSPF6_SCOPE_LINKLOCAL:
hasso049207c2004-08-04 20:02:13 +00001490 for (i = listhead (o->area_list); i; nextnode (i))
1491 {
1492 oa = (struct ospf6_area *) getdata (i);
1493 for (j = listhead (oa->if_list); j; nextnode (j))
1494 {
1495 oi = (struct ospf6_interface *) getdata (j);
1496 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1497 oi->interface->name, oa->name, VNL, VNL);
1498 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1499 }
1500 }
1501 break;
1502
hasso6452df02004-08-15 05:52:07 +00001503 case OSPF6_SCOPE_AS:
hasso049207c2004-08-04 20:02:13 +00001504 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1505 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1506 break;
1507
1508 default:
1509 assert (0);
1510 break;
1511 }
1512
1513 vty_out (vty, "%s", VNL);
1514 return CMD_SUCCESS;
1515}
1516
1517ALIAS (show_ipv6_ospf6_database_type_self_originated_linkstate_id,
1518 show_ipv6_ospf6_database_type_self_originated_linkstate_id_detail_cmd,
1519 "show ipv6 ospf6 database "
1520 "(router|network|inter-prefix|inter-router|as-external|"
1521 "group-membership|type-7|link|intra-prefix) self-originated "
1522 "linkstate-id A.B.C.D (detail|dump|internal)",
1523 SHOW_STR
1524 IPV6_STR
1525 OSPF6_STR
1526 "Display Link state database\n"
1527 "Display Router LSAs\n"
1528 "Display Network LSAs\n"
1529 "Display Inter-Area-Prefix LSAs\n"
1530 "Display Inter-Area-Router LSAs\n"
1531 "Display As-External LSAs\n"
1532 "Display Group-Membership LSAs\n"
1533 "Display Type-7 LSAs\n"
1534 "Display Link LSAs\n"
1535 "Display Intra-Area-Prefix LSAs\n"
1536 "Display Self-originated LSAs\n"
1537 "Search by Link state ID\n"
1538 "Specify Link state ID as IPv4 address notation\n"
1539 "Display details of LSAs\n"
1540 "Dump LSAs\n"
1541 "Display LSA's internal information\n"
1542 );
1543
hasso508e53e2004-05-18 18:57:06 +00001544DEFUN (show_ipv6_ospf6_database_type_id_self_originated,
1545 show_ipv6_ospf6_database_type_id_self_originated_cmd,
1546 "show ipv6 ospf6 database "
1547 "(router|network|inter-prefix|inter-router|as-external|"
1548 "group-membership|type-7|link|intra-prefix) A.B.C.D self-originated",
1549 SHOW_STR
1550 IPV6_STR
1551 OSPF6_STR
1552 "Display Link state database\n"
1553 "Display Router LSAs\n"
1554 "Display Network LSAs\n"
1555 "Display Inter-Area-Prefix LSAs\n"
1556 "Display Inter-Area-Router LSAs\n"
1557 "Display As-External LSAs\n"
1558 "Display Group-Membership LSAs\n"
1559 "Display Type-7 LSAs\n"
1560 "Display Link LSAs\n"
1561 "Display Intra-Area-Prefix LSAs\n"
1562 "Specify Link state ID as IPv4 address notation\n"
1563 "Display Self-originated LSAs\n"
1564 )
1565{
hasso049207c2004-08-04 20:02:13 +00001566 int level;
hasso52dc7ee2004-09-23 19:18:23 +00001567 struct listnode *i, *j;
hasso508e53e2004-05-18 18:57:06 +00001568 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +00001569 struct ospf6_area *oa;
1570 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +00001571 u_int16_t type = 0;
hasso049207c2004-08-04 20:02:13 +00001572 u_int32_t adv_router = 0;
hasso508e53e2004-05-18 18:57:06 +00001573 u_int32_t id = 0;
1574
1575 OSPF6_CMD_CHECK_RUNNING ();
1576
hasso049207c2004-08-04 20:02:13 +00001577 type = parse_type_spec (argc, argv);
1578 argc--;
1579 argv++;
hasso508e53e2004-05-18 18:57:06 +00001580
hasso6452df02004-08-15 05:52:07 +00001581 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
hasso508e53e2004-05-18 18:57:06 +00001582 {
1583 vty_out (vty, "Link State ID is not parsable: %s%s",
hasso049207c2004-08-04 20:02:13 +00001584 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +00001585 return CMD_SUCCESS;
1586 }
1587
hasso049207c2004-08-04 20:02:13 +00001588 argc--;
1589 argv++;
1590 level = parse_show_level (argc, argv);
1591
1592 adv_router = o->router_id;
1593
1594 switch (OSPF6_LSA_SCOPE (type))
hasso508e53e2004-05-18 18:57:06 +00001595 {
hasso6452df02004-08-15 05:52:07 +00001596 case OSPF6_SCOPE_AREA:
hasso049207c2004-08-04 20:02:13 +00001597 for (i = listhead (o->area_list); i; nextnode (i))
1598 {
1599 oa = (struct ospf6_area *) getdata (i);
1600 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1601 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1602 }
1603 break;
1604
hasso6452df02004-08-15 05:52:07 +00001605 case OSPF6_SCOPE_LINKLOCAL:
hasso049207c2004-08-04 20:02:13 +00001606 for (i = listhead (o->area_list); i; nextnode (i))
1607 {
1608 oa = (struct ospf6_area *) getdata (i);
1609 for (j = listhead (oa->if_list); j; nextnode (j))
1610 {
1611 oi = (struct ospf6_interface *) getdata (j);
1612 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1613 oi->interface->name, oa->name, VNL, VNL);
1614 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1615 }
1616 }
1617 break;
1618
hasso6452df02004-08-15 05:52:07 +00001619 case OSPF6_SCOPE_AS:
hasso049207c2004-08-04 20:02:13 +00001620 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1621 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1622 break;
1623
1624 default:
1625 assert (0);
1626 break;
hasso508e53e2004-05-18 18:57:06 +00001627 }
1628
hasso049207c2004-08-04 20:02:13 +00001629 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +00001630 return CMD_SUCCESS;
1631}
1632
1633ALIAS (show_ipv6_ospf6_database_type_id_self_originated,
1634 show_ipv6_ospf6_database_type_id_self_originated_detail_cmd,
1635 "show ipv6 ospf6 database "
1636 "(router|network|inter-prefix|inter-router|as-external|"
1637 "group-membership|type-7|link|intra-prefix) A.B.C.D self-originated "
hasso049207c2004-08-04 20:02:13 +00001638 "(detail|dump|internal)",
hasso508e53e2004-05-18 18:57:06 +00001639 SHOW_STR
1640 IPV6_STR
1641 OSPF6_STR
1642 "Display Link state database\n"
1643 "Display Router LSAs\n"
1644 "Display Network LSAs\n"
1645 "Display Inter-Area-Prefix LSAs\n"
1646 "Display Inter-Area-Router LSAs\n"
1647 "Display As-External LSAs\n"
1648 "Display Group-Membership LSAs\n"
1649 "Display Type-7 LSAs\n"
1650 "Display Link LSAs\n"
1651 "Display Intra-Area-Prefix LSAs\n"
hasso508e53e2004-05-18 18:57:06 +00001652 "Display Self-originated LSAs\n"
hasso049207c2004-08-04 20:02:13 +00001653 "Search by Link state ID\n"
1654 "Specify Link state ID as IPv4 address notation\n"
hasso508e53e2004-05-18 18:57:06 +00001655 "Display details of LSAs\n"
1656 "Dump LSAs\n"
1657 "Display LSA's internal information\n"
1658 );
1659
hasso6452df02004-08-15 05:52:07 +00001660
1661DEFUN (show_ipv6_ospf6_border_routers,
1662 show_ipv6_ospf6_border_routers_cmd,
1663 "show ipv6 ospf6 border-routers",
1664 SHOW_STR
1665 IP6_STR
1666 OSPF6_STR
1667 "Display routing table for ABR and ASBR\n"
1668 )
1669{
1670 u_int32_t adv_router;
1671 void (*showfunc) (struct vty *, struct ospf6_route *);
1672 struct ospf6_route *ro;
1673 struct prefix prefix;
1674
1675 OSPF6_CMD_CHECK_RUNNING ();
1676
1677 if (argc && ! strcmp ("detail", argv[0]))
1678 {
1679 showfunc = ospf6_route_show_detail;
1680 argc--;
1681 argv++;
1682 }
1683 else
1684 showfunc = ospf6_brouter_show;
1685
1686 if (argc)
1687 {
1688 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
1689 {
1690 vty_out (vty, "Router ID is not parsable: %s%s", argv[0], VNL);
1691 return CMD_SUCCESS;
1692 }
1693
1694 ospf6_linkstate_prefix (adv_router, 0, &prefix);
1695 ro = ospf6_route_lookup (&prefix, ospf6->brouter_table);
1696 ospf6_route_show_detail (vty, ro);
1697 return CMD_SUCCESS;
1698 }
1699
1700 if (showfunc == ospf6_brouter_show)
1701 ospf6_brouter_show_header (vty);
1702
1703 for (ro = ospf6_route_head (ospf6->brouter_table); ro;
1704 ro = ospf6_route_next (ro))
1705 (*showfunc) (vty, ro);
1706
1707 return CMD_SUCCESS;
1708}
1709
1710ALIAS (show_ipv6_ospf6_border_routers,
1711 show_ipv6_ospf6_border_routers_detail_cmd,
1712 "show ipv6 ospf6 border-routers (A.B.C.D|detail)",
1713 SHOW_STR
1714 IP6_STR
1715 OSPF6_STR
1716 "Display routing table for ABR and ASBR\n"
1717 "Specify Router-ID\n"
1718 "Display Detail\n"
1719 );
1720
hasso4846ef62004-09-03 06:04:00 +00001721DEFUN (show_ipv6_ospf6_linkstate,
1722 show_ipv6_ospf6_linkstate_cmd,
1723 "show ipv6 ospf6 linkstate",
1724 SHOW_STR
1725 IP6_STR
1726 OSPF6_STR
1727 "Display linkstate routing table\n"
1728 )
1729{
hasso52dc7ee2004-09-23 19:18:23 +00001730 struct listnode *node;
hasso4846ef62004-09-03 06:04:00 +00001731 struct ospf6_area *oa;
1732
1733 for (node = listhead (ospf6->area_list); node; nextnode (node))
1734 {
1735 oa = OSPF6_AREA (getdata (node));
1736
1737 vty_out (vty, "%s SPF Result in Area %s%s%s",
1738 VNL, oa->name, VNL, VNL);
1739 ospf6_linkstate_table_show (vty, argc, argv, oa->spf_table);
1740 }
1741
1742 vty_out (vty, "%s", VNL);
1743 return CMD_SUCCESS;
1744}
1745
1746ALIAS (show_ipv6_ospf6_linkstate,
1747 show_ipv6_ospf6_linkstate_router_cmd,
1748 "show ipv6 ospf6 linkstate router A.B.C.D",
1749 SHOW_STR
1750 IP6_STR
1751 OSPF6_STR
1752 "Display linkstate routing table\n"
1753 "Display Router Entry\n"
1754 "Specify Router ID as IPv4 address notation\n"
1755 );
1756
1757ALIAS (show_ipv6_ospf6_linkstate,
1758 show_ipv6_ospf6_linkstate_network_cmd,
1759 "show ipv6 ospf6 linkstate network A.B.C.D A.B.C.D",
1760 SHOW_STR
1761 IP6_STR
1762 OSPF6_STR
1763 "Display linkstate routing table\n"
1764 "Display Network Entry\n"
1765 "Specify Router ID as IPv4 address notation\n"
1766 "Specify Link state ID as IPv4 address notation\n"
1767 );
1768
1769DEFUN (show_ipv6_ospf6_linkstate_detail,
1770 show_ipv6_ospf6_linkstate_detail_cmd,
1771 "show ipv6 ospf6 linkstate detail",
1772 SHOW_STR
1773 IP6_STR
1774 OSPF6_STR
1775 "Display linkstate routing table\n"
1776 )
1777{
paul0c083ee2004-10-10 12:54:58 +00001778 const char *sargv[CMD_ARGC_MAX];
hasso4846ef62004-09-03 06:04:00 +00001779 int i, sargc;
hasso52dc7ee2004-09-23 19:18:23 +00001780 struct listnode *node;
hasso4846ef62004-09-03 06:04:00 +00001781 struct ospf6_area *oa;
1782
1783 /* copy argv to sargv and then append "detail" */
1784 for (i = 0; i < argc; i++)
1785 sargv[i] = argv[i];
1786 sargc = argc;
1787 sargv[sargc++] = "detail";
1788 sargv[sargc] = NULL;
1789
1790 for (node = listhead (ospf6->area_list); node; nextnode (node))
1791 {
1792 oa = OSPF6_AREA (getdata (node));
1793
1794 vty_out (vty, "%s SPF Result in Area %s%s%s",
1795 VNL, oa->name, VNL, VNL);
1796 ospf6_linkstate_table_show (vty, sargc, sargv, oa->spf_table);
1797 }
1798
1799 vty_out (vty, "%s", VNL);
1800 return CMD_SUCCESS;
1801}
hasso6452df02004-08-15 05:52:07 +00001802
paul718e3742002-12-13 20:15:29 +00001803/* Install ospf related commands. */
1804void
1805ospf6_init ()
1806{
hasso1e058382004-09-01 21:36:14 +00001807 ospf6_top_init ();
1808 ospf6_area_init ();
1809 ospf6_interface_init ();
1810 ospf6_neighbor_init ();
1811 ospf6_zebra_init ();
1812
1813 ospf6_lsa_init ();
1814 ospf6_spf_init ();
1815 ospf6_intra_init ();
1816 ospf6_asbr_init ();
1817 ospf6_abr_init ();
1818
hassoef1bbf52004-10-08 12:04:21 +00001819#ifdef HAVE_SNMP
paul0c083ee2004-10-10 12:54:58 +00001820 ospf6_snmp_init (master);
hassoef1bbf52004-10-08 12:04:21 +00001821#endif /*HAVE_SNMP*/
1822
hasso508e53e2004-05-18 18:57:06 +00001823 install_node (&debug_node, config_write_ospf6_debug);
paul718e3742002-12-13 20:15:29 +00001824
hasso508e53e2004-05-18 18:57:06 +00001825 install_element_ospf6_debug_message ();
1826 install_element_ospf6_debug_lsa ();
1827 install_element_ospf6_debug_interface ();
1828 install_element_ospf6_debug_neighbor ();
1829 install_element_ospf6_debug_zebra ();
1830 install_element_ospf6_debug_spf ();
1831 install_element_ospf6_debug_route ();
1832 install_element_ospf6_debug_asbr ();
hasso6452df02004-08-15 05:52:07 +00001833 install_element_ospf6_debug_abr ();
hasso1e058382004-09-01 21:36:14 +00001834 install_element_ospf6_debug_flood ();
hasso508e53e2004-05-18 18:57:06 +00001835
paul718e3742002-12-13 20:15:29 +00001836 install_element (VIEW_NODE, &show_version_ospf6_cmd);
paul718e3742002-12-13 20:15:29 +00001837 install_element (ENABLE_NODE, &show_version_ospf6_cmd);
hasso049207c2004-08-04 20:02:13 +00001838
hasso6452df02004-08-15 05:52:07 +00001839 install_element (VIEW_NODE, &show_ipv6_ospf6_border_routers_cmd);
1840 install_element (VIEW_NODE, &show_ipv6_ospf6_border_routers_detail_cmd);
1841 install_element (ENABLE_NODE, &show_ipv6_ospf6_border_routers_cmd);
1842 install_element (ENABLE_NODE, &show_ipv6_ospf6_border_routers_detail_cmd);
1843
hasso4846ef62004-09-03 06:04:00 +00001844 install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_cmd);
1845 install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_router_cmd);
1846 install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_network_cmd);
1847 install_element (VIEW_NODE, &show_ipv6_ospf6_linkstate_detail_cmd);
1848 install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_cmd);
1849 install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_router_cmd);
1850 install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_network_cmd);
1851 install_element (ENABLE_NODE, &show_ipv6_ospf6_linkstate_detail_cmd);
1852
hasso049207c2004-08-04 20:02:13 +00001853#define INSTALL(n,c) \
1854 install_element (n ## _NODE, &show_ipv6_ospf6_ ## c);
1855
1856 INSTALL (VIEW, database_cmd);
1857 INSTALL (VIEW, database_detail_cmd);
1858 INSTALL (VIEW, database_type_cmd);
1859 INSTALL (VIEW, database_type_detail_cmd);
1860 INSTALL (VIEW, database_id_cmd);
1861 INSTALL (VIEW, database_id_detail_cmd);
1862 INSTALL (VIEW, database_linkstate_id_cmd);
1863 INSTALL (VIEW, database_linkstate_id_detail_cmd);
1864 INSTALL (VIEW, database_router_cmd);
1865 INSTALL (VIEW, database_router_detail_cmd);
1866 INSTALL (VIEW, database_adv_router_cmd);
1867 INSTALL (VIEW, database_adv_router_detail_cmd);
1868 INSTALL (VIEW, database_type_id_cmd);
1869 INSTALL (VIEW, database_type_id_detail_cmd);
1870 INSTALL (VIEW, database_type_linkstate_id_cmd);
1871 INSTALL (VIEW, database_type_linkstate_id_detail_cmd);
1872 INSTALL (VIEW, database_type_router_cmd);
1873 INSTALL (VIEW, database_type_router_detail_cmd);
1874 INSTALL (VIEW, database_type_adv_router_cmd);
1875 INSTALL (VIEW, database_type_adv_router_detail_cmd);
1876 INSTALL (VIEW, database_adv_router_linkstate_id_cmd);
1877 INSTALL (VIEW, database_adv_router_linkstate_id_detail_cmd);
1878 INSTALL (VIEW, database_id_router_cmd);
1879 INSTALL (VIEW, database_id_router_detail_cmd);
1880 INSTALL (VIEW, database_type_id_router_cmd);
1881 INSTALL (VIEW, database_type_id_router_detail_cmd);
1882 INSTALL (VIEW, database_type_adv_router_linkstate_id_cmd);
1883 INSTALL (VIEW, database_type_adv_router_linkstate_id_detail_cmd);
1884 INSTALL (VIEW, database_self_originated_cmd);
1885 INSTALL (VIEW, database_self_originated_detail_cmd);
1886 INSTALL (VIEW, database_type_self_originated_cmd);
1887 INSTALL (VIEW, database_type_self_originated_detail_cmd);
1888 INSTALL (VIEW, database_type_id_self_originated_cmd);
1889 INSTALL (VIEW, database_type_id_self_originated_detail_cmd);
1890 INSTALL (VIEW, database_type_self_originated_linkstate_id_cmd);
1891 INSTALL (VIEW, database_type_self_originated_linkstate_id_detail_cmd);
1892 INSTALL (VIEW, database_type_id_self_originated_cmd);
1893 INSTALL (VIEW, database_type_id_self_originated_detail_cmd);
1894
1895 INSTALL (ENABLE, database_cmd);
1896 INSTALL (ENABLE, database_detail_cmd);
1897 INSTALL (ENABLE, database_type_cmd);
1898 INSTALL (ENABLE, database_type_detail_cmd);
1899 INSTALL (ENABLE, database_id_cmd);
1900 INSTALL (ENABLE, database_id_detail_cmd);
1901 INSTALL (ENABLE, database_linkstate_id_cmd);
1902 INSTALL (ENABLE, database_linkstate_id_detail_cmd);
1903 INSTALL (ENABLE, database_router_cmd);
1904 INSTALL (ENABLE, database_router_detail_cmd);
1905 INSTALL (ENABLE, database_adv_router_cmd);
1906 INSTALL (ENABLE, database_adv_router_detail_cmd);
1907 INSTALL (ENABLE, database_type_id_cmd);
1908 INSTALL (ENABLE, database_type_id_detail_cmd);
1909 INSTALL (ENABLE, database_type_linkstate_id_cmd);
1910 INSTALL (ENABLE, database_type_linkstate_id_detail_cmd);
1911 INSTALL (ENABLE, database_type_router_cmd);
1912 INSTALL (ENABLE, database_type_router_detail_cmd);
1913 INSTALL (ENABLE, database_type_adv_router_cmd);
1914 INSTALL (ENABLE, database_type_adv_router_detail_cmd);
1915 INSTALL (ENABLE, database_adv_router_linkstate_id_cmd);
1916 INSTALL (ENABLE, database_adv_router_linkstate_id_detail_cmd);
1917 INSTALL (ENABLE, database_id_router_cmd);
1918 INSTALL (ENABLE, database_id_router_detail_cmd);
1919 INSTALL (ENABLE, database_type_id_router_cmd);
1920 INSTALL (ENABLE, database_type_id_router_detail_cmd);
1921 INSTALL (ENABLE, database_type_adv_router_linkstate_id_cmd);
1922 INSTALL (ENABLE, database_type_adv_router_linkstate_id_detail_cmd);
1923 INSTALL (ENABLE, database_self_originated_cmd);
1924 INSTALL (ENABLE, database_self_originated_detail_cmd);
1925 INSTALL (ENABLE, database_type_self_originated_cmd);
1926 INSTALL (ENABLE, database_type_self_originated_detail_cmd);
1927 INSTALL (ENABLE, database_type_id_self_originated_cmd);
1928 INSTALL (ENABLE, database_type_id_self_originated_detail_cmd);
1929 INSTALL (ENABLE, database_type_self_originated_linkstate_id_cmd);
1930 INSTALL (ENABLE, database_type_self_originated_linkstate_id_detail_cmd);
1931 INSTALL (ENABLE, database_type_id_self_originated_cmd);
1932 INSTALL (ENABLE, database_type_id_self_originated_detail_cmd);
paul718e3742002-12-13 20:15:29 +00001933
hasso508e53e2004-05-18 18:57:06 +00001934 /* Make ospf protocol socket. */
1935 ospf6_serv_sock ();
1936 thread_add_read (master, ospf6_receive, NULL, ospf6_sock);
paul718e3742002-12-13 20:15:29 +00001937}
1938
paul718e3742002-12-13 20:15:29 +00001939