blob: 28e6b94559c2d978ab3f457d021a4fc662f81397 [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 +000053struct route_node *
54route_prev (struct route_node *node)
paul718e3742002-12-13 20:15:29 +000055{
hasso508e53e2004-05-18 18:57:06 +000056 struct route_node *end;
57 struct route_node *prev = NULL;
paul718e3742002-12-13 20:15:29 +000058
hasso508e53e2004-05-18 18:57:06 +000059 end = node;
60 node = node->parent;
hasso3b687352004-08-19 06:56:53 +000061 if (node)
62 route_lock_node (node);
hasso508e53e2004-05-18 18:57:06 +000063 while (node)
64 {
65 prev = node;
hasso3b687352004-08-19 06:56:53 +000066 node = route_next (node);
67 if (node == end)
68 {
69 route_unlock_node (node);
70 node = NULL;
71 }
hasso508e53e2004-05-18 18:57:06 +000072 }
73 route_unlock_node (end);
hasso3b687352004-08-19 06:56:53 +000074 if (prev)
75 route_lock_node (prev);
hasso508e53e2004-05-18 18:57:06 +000076
77 return prev;
paul718e3742002-12-13 20:15:29 +000078}
79
hasso6452df02004-08-15 05:52:07 +000080
81/* show database functions */
paul718e3742002-12-13 20:15:29 +000082DEFUN (show_version_ospf6,
83 show_version_ospf6_cmd,
84 "show version ospf6",
85 SHOW_STR
hasso508e53e2004-05-18 18:57:06 +000086 "Displays ospf6d version\n"
87 )
paul718e3742002-12-13 20:15:29 +000088{
89 vty_out (vty, "Zebra OSPF6d Version: %s%s",
hasso049207c2004-08-04 20:02:13 +000090 ospf6_daemon_version, VNL);
paul718e3742002-12-13 20:15:29 +000091
92 return CMD_SUCCESS;
93}
94
hasso508e53e2004-05-18 18:57:06 +000095struct cmd_node debug_node =
paul718e3742002-12-13 20:15:29 +000096{
hasso508e53e2004-05-18 18:57:06 +000097 DEBUG_NODE,
98 ""
99};
paul718e3742002-12-13 20:15:29 +0000100
101int
hasso508e53e2004-05-18 18:57:06 +0000102config_write_ospf6_debug (struct vty *vty)
paul718e3742002-12-13 20:15:29 +0000103{
hasso508e53e2004-05-18 18:57:06 +0000104 config_write_ospf6_debug_message (vty);
105 config_write_ospf6_debug_lsa (vty);
106 config_write_ospf6_debug_zebra (vty);
107 config_write_ospf6_debug_interface (vty);
108 config_write_ospf6_debug_neighbor (vty);
109 config_write_ospf6_debug_spf (vty);
110 config_write_ospf6_debug_route (vty);
111 config_write_ospf6_debug_asbr (vty);
hasso049207c2004-08-04 20:02:13 +0000112 config_write_ospf6_debug_abr (vty);
113 vty_out (vty, "!%s", VNL);
paul718e3742002-12-13 20:15:29 +0000114 return 0;
115}
116
hasso049207c2004-08-04 20:02:13 +0000117#define AREA_LSDB_TITLE_FORMAT \
118 "%s Area Scoped Link State Database (Area %s)%s%s"
119#define IF_LSDB_TITLE_FORMAT \
120 "%s I/F Scoped Link State Database (I/F %s in Area %s)%s%s"
121#define AS_LSDB_TITLE_FORMAT \
122 "%s AS Scoped Link State Database%s%s"
123
124static int
125parse_show_level (int argc, char **argv)
126{
hasso6452df02004-08-15 05:52:07 +0000127 int level = 0;
hasso049207c2004-08-04 20:02:13 +0000128 if (argc)
129 {
130 if (! strncmp (argv[0], "de", 2))
131 level = OSPF6_LSDB_SHOW_LEVEL_DETAIL;
132 else if (! strncmp (argv[0], "du", 2))
133 level = OSPF6_LSDB_SHOW_LEVEL_DUMP;
134 else if (! strncmp (argv[0], "in", 2))
135 level = OSPF6_LSDB_SHOW_LEVEL_INTERNAL;
136 }
137 else
138 level = OSPF6_LSDB_SHOW_LEVEL_NORMAL;
139 return level;
140}
141
142static u_int16_t
143parse_type_spec (int argc, char **argv)
144{
hasso6452df02004-08-15 05:52:07 +0000145 u_int16_t type = 0;
hasso049207c2004-08-04 20:02:13 +0000146 assert (argc);
147 if (! strcmp (argv[0], "router"))
148 type = htons (OSPF6_LSTYPE_ROUTER);
149 else if (! strcmp (argv[0], "network"))
150 type = htons (OSPF6_LSTYPE_NETWORK);
151 else if (! strcmp (argv[0], "as-external"))
152 type = htons (OSPF6_LSTYPE_AS_EXTERNAL);
153 else if (! strcmp (argv[0], "intra-prefix"))
154 type = htons (OSPF6_LSTYPE_INTRA_PREFIX);
155 else if (! strcmp (argv[0], "inter-router"))
156 type = htons (OSPF6_LSTYPE_INTER_ROUTER);
157 else if (! strcmp (argv[0], "inter-prefix"))
158 type = htons (OSPF6_LSTYPE_INTER_PREFIX);
159 else if (! strcmp (argv[0], "link"))
160 type = htons (OSPF6_LSTYPE_LINK);
161 return type;
162}
163
hasso508e53e2004-05-18 18:57:06 +0000164DEFUN (show_ipv6_ospf6_database,
165 show_ipv6_ospf6_database_cmd,
166 "show ipv6 ospf6 database",
167 SHOW_STR
168 IPV6_STR
169 OSPF6_STR
170 "Display Link state database\n"
171 )
paul718e3742002-12-13 20:15:29 +0000172{
hasso049207c2004-08-04 20:02:13 +0000173 int level;
hasso508e53e2004-05-18 18:57:06 +0000174 listnode i, j;
175 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +0000176 struct ospf6_area *oa;
177 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +0000178
179 OSPF6_CMD_CHECK_RUNNING ();
180
hasso049207c2004-08-04 20:02:13 +0000181 level = parse_show_level (argc, argv);
hasso508e53e2004-05-18 18:57:06 +0000182
hasso508e53e2004-05-18 18:57:06 +0000183 for (i = listhead (o->area_list); i; nextnode (i))
184 {
hasso049207c2004-08-04 20:02:13 +0000185 oa = (struct ospf6_area *) getdata (i);
186 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
187 ospf6_lsdb_show (vty, level, NULL, NULL, NULL, oa->lsdb);
hasso508e53e2004-05-18 18:57:06 +0000188 }
hasso049207c2004-08-04 20:02:13 +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);
hasso508e53e2004-05-18 18:57:06 +0000193 for (j = listhead (oa->if_list); j; nextnode (j))
194 {
hasso049207c2004-08-04 20:02:13 +0000195 oi = (struct ospf6_interface *) getdata (j);
196 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
197 oi->interface->name, oa->name, VNL, VNL);
198 ospf6_lsdb_show (vty, level, NULL, NULL, NULL, oi->lsdb);
hasso508e53e2004-05-18 18:57:06 +0000199 }
200 }
201
hasso049207c2004-08-04 20:02:13 +0000202 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
203 ospf6_lsdb_show (vty, level, NULL, NULL, NULL, o->lsdb);
204
205 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +0000206 return CMD_SUCCESS;
207}
208
209ALIAS (show_ipv6_ospf6_database,
210 show_ipv6_ospf6_database_detail_cmd,
211 "show ipv6 ospf6 database (detail|dump|internal)",
212 SHOW_STR
213 IPV6_STR
214 OSPF6_STR
215 "Display Link state database\n"
216 "Display details of LSAs\n"
217 "Dump LSAs\n"
218 "Display LSA's internal information\n"
219 );
220
221DEFUN (show_ipv6_ospf6_database_type,
222 show_ipv6_ospf6_database_type_cmd,
223 "show ipv6 ospf6 database "
224 "(router|network|inter-prefix|inter-router|as-external|"
225 "group-membership|type-7|link|intra-prefix)",
226 SHOW_STR
227 IPV6_STR
228 OSPF6_STR
229 "Display Link state database\n"
230 "Display Router LSAs\n"
231 "Display Network LSAs\n"
232 "Display Inter-Area-Prefix LSAs\n"
233 "Display Inter-Area-Router LSAs\n"
234 "Display As-External LSAs\n"
235 "Display Group-Membership LSAs\n"
236 "Display Type-7 LSAs\n"
237 "Display Link LSAs\n"
238 "Display Intra-Area-Prefix LSAs\n"
239 )
240{
hasso049207c2004-08-04 20:02:13 +0000241 int level;
hasso508e53e2004-05-18 18:57:06 +0000242 listnode i, j;
243 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +0000244 struct ospf6_area *oa;
245 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +0000246 u_int16_t type = 0;
247
248 OSPF6_CMD_CHECK_RUNNING ();
249
hasso049207c2004-08-04 20:02:13 +0000250 type = parse_type_spec (argc, argv);
251 argc--;
252 argv++;
253 level = parse_show_level (argc, argv);
hasso508e53e2004-05-18 18:57:06 +0000254
hasso049207c2004-08-04 20:02:13 +0000255 switch (OSPF6_LSA_SCOPE (type))
hasso508e53e2004-05-18 18:57:06 +0000256 {
hasso6452df02004-08-15 05:52:07 +0000257 case OSPF6_SCOPE_AREA:
hasso049207c2004-08-04 20:02:13 +0000258 for (i = listhead (o->area_list); i; nextnode (i))
259 {
260 oa = (struct ospf6_area *) getdata (i);
261 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
262 ospf6_lsdb_show (vty, level, &type, NULL, NULL, oa->lsdb);
263 }
264 break;
265
hasso6452df02004-08-15 05:52:07 +0000266 case OSPF6_SCOPE_LINKLOCAL:
hasso049207c2004-08-04 20:02:13 +0000267 for (i = listhead (o->area_list); i; nextnode (i))
268 {
269 oa = (struct ospf6_area *) getdata (i);
270 for (j = listhead (oa->if_list); j; nextnode (j))
271 {
272 oi = (struct ospf6_interface *) getdata (j);
273 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
274 oi->interface->name, oa->name, VNL, VNL);
275 ospf6_lsdb_show (vty, level, &type, NULL, NULL, oi->lsdb);
276 }
277 }
278 break;
279
hasso6452df02004-08-15 05:52:07 +0000280 case OSPF6_SCOPE_AS:
hasso049207c2004-08-04 20:02:13 +0000281 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
282 ospf6_lsdb_show (vty, level, &type, NULL, NULL, o->lsdb);
283 break;
284
285 default:
286 assert (0);
287 break;
hasso508e53e2004-05-18 18:57:06 +0000288 }
289
hasso049207c2004-08-04 20:02:13 +0000290 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +0000291 return CMD_SUCCESS;
292}
293
294ALIAS (show_ipv6_ospf6_database_type,
295 show_ipv6_ospf6_database_type_detail_cmd,
296 "show ipv6 ospf6 database "
297 "(router|network|inter-prefix|inter-router|as-external|"
298 "group-membership|type-7|link|intra-prefix) "
299 "(detail|dump|internal)",
300 SHOW_STR
301 IPV6_STR
302 OSPF6_STR
303 "Display Link state database\n"
304 "Display Router LSAs\n"
305 "Display Network LSAs\n"
306 "Display Inter-Area-Prefix LSAs\n"
307 "Display Inter-Area-Router LSAs\n"
308 "Display As-External LSAs\n"
309 "Display Group-Membership LSAs\n"
310 "Display Type-7 LSAs\n"
311 "Display Link LSAs\n"
312 "Display Intra-Area-Prefix LSAs\n"
313 "Display details of LSAs\n"
314 "Dump LSAs\n"
315 "Display LSA's internal information\n"
316 );
317
318DEFUN (show_ipv6_ospf6_database_id,
319 show_ipv6_ospf6_database_id_cmd,
320 "show ipv6 ospf6 database * A.B.C.D",
321 SHOW_STR
322 IPV6_STR
323 OSPF6_STR
324 "Display Link state database\n"
325 "Any Link state Type\n"
326 "Specify Link state ID as IPv4 address notation\n"
327 )
328{
hasso049207c2004-08-04 20:02:13 +0000329 int level;
hasso508e53e2004-05-18 18:57:06 +0000330 listnode i, j;
331 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +0000332 struct ospf6_area *oa;
333 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +0000334 u_int32_t id = 0;
335
336 OSPF6_CMD_CHECK_RUNNING ();
337
hasso508e53e2004-05-18 18:57:06 +0000338 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
339 {
340 vty_out (vty, "Link State ID is not parsable: %s%s",
hasso049207c2004-08-04 20:02:13 +0000341 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000342 return CMD_SUCCESS;
343 }
344
hasso049207c2004-08-04 20:02:13 +0000345 argc--;
346 argv++;
347 level = parse_show_level (argc, argv);
348
hasso508e53e2004-05-18 18:57:06 +0000349 for (i = listhead (o->area_list); i; nextnode (i))
350 {
hasso049207c2004-08-04 20:02:13 +0000351 oa = (struct ospf6_area *) getdata (i);
352 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
353 ospf6_lsdb_show (vty, level, NULL, &id, NULL, oa->lsdb);
hasso508e53e2004-05-18 18:57:06 +0000354 }
hasso049207c2004-08-04 20:02:13 +0000355
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);
hasso508e53e2004-05-18 18:57:06 +0000359 for (j = listhead (oa->if_list); j; nextnode (j))
360 {
hasso049207c2004-08-04 20:02:13 +0000361 oi = (struct ospf6_interface *) getdata (j);
362 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
363 oi->interface->name, oa->name, VNL, VNL);
364 ospf6_lsdb_show (vty, level, NULL, &id, NULL, oi->lsdb);
hasso508e53e2004-05-18 18:57:06 +0000365 }
366 }
367
hasso049207c2004-08-04 20:02:13 +0000368 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
369 ospf6_lsdb_show (vty, level, NULL, &id, NULL, o->lsdb);
370
371 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +0000372 return CMD_SUCCESS;
373}
374
375ALIAS (show_ipv6_ospf6_database_id,
376 show_ipv6_ospf6_database_id_detail_cmd,
377 "show ipv6 ospf6 database * A.B.C.D "
378 "(detail|dump|internal)",
379 SHOW_STR
380 IPV6_STR
381 OSPF6_STR
382 "Display Link state database\n"
383 "Any Link state Type\n"
hasso049207c2004-08-04 20:02:13 +0000384 "Specify Link state ID as IPv4 address notation\n"
385 "Display details of LSAs\n"
386 "Dump LSAs\n"
387 "Display LSA's internal information\n"
388 );
389
390ALIAS (show_ipv6_ospf6_database_id,
391 show_ipv6_ospf6_database_linkstate_id_cmd,
392 "show ipv6 ospf6 database linkstate-id A.B.C.D",
393 SHOW_STR
394 IPV6_STR
395 OSPF6_STR
396 "Display Link state database\n"
397 "Search by Link state ID\n"
398 "Specify Link state ID as IPv4 address notation\n"
399 );
400
401ALIAS (show_ipv6_ospf6_database_id,
402 show_ipv6_ospf6_database_linkstate_id_detail_cmd,
403 "show ipv6 ospf6 database linkstate-id A.B.C.D "
404 "(detail|dump|internal)",
405 SHOW_STR
406 IPV6_STR
407 OSPF6_STR
408 "Display Link state database\n"
409 "Search by Link state ID\n"
hasso508e53e2004-05-18 18:57:06 +0000410 "Specify Link state ID as IPv4 address notation\n"
411 "Display details of LSAs\n"
412 "Dump LSAs\n"
413 "Display LSA's internal information\n"
414 );
415
416DEFUN (show_ipv6_ospf6_database_router,
417 show_ipv6_ospf6_database_router_cmd,
418 "show ipv6 ospf6 database * * A.B.C.D",
419 SHOW_STR
420 IPV6_STR
421 OSPF6_STR
422 "Display Link state database\n"
423 "Any Link state Type\n"
424 "Any Link state ID\n"
425 "Specify Advertising Router as IPv4 address notation\n"
426 )
427{
hasso049207c2004-08-04 20:02:13 +0000428 int level;
hasso508e53e2004-05-18 18:57:06 +0000429 listnode i, j;
430 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +0000431 struct ospf6_area *oa;
432 struct ospf6_interface *oi;
433 u_int32_t adv_router = 0;
hasso508e53e2004-05-18 18:57:06 +0000434
435 OSPF6_CMD_CHECK_RUNNING ();
436
hasso049207c2004-08-04 20:02:13 +0000437 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
hasso508e53e2004-05-18 18:57:06 +0000438 {
439 vty_out (vty, "Advertising Router is not parsable: %s%s",
hasso049207c2004-08-04 20:02:13 +0000440 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000441 return CMD_SUCCESS;
442 }
443
hasso049207c2004-08-04 20:02:13 +0000444 argc--;
445 argv++;
446 level = parse_show_level (argc, argv);
447
hasso508e53e2004-05-18 18:57:06 +0000448 for (i = listhead (o->area_list); i; nextnode (i))
449 {
hasso049207c2004-08-04 20:02:13 +0000450 oa = (struct ospf6_area *) getdata (i);
451 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
452 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oa->lsdb);
hasso508e53e2004-05-18 18:57:06 +0000453 }
hasso049207c2004-08-04 20:02:13 +0000454
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);
hasso508e53e2004-05-18 18:57:06 +0000458 for (j = listhead (oa->if_list); j; nextnode (j))
459 {
hasso049207c2004-08-04 20:02:13 +0000460 oi = (struct ospf6_interface *) getdata (j);
461 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
462 oi->interface->name, oa->name, VNL, VNL);
463 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oi->lsdb);
hasso508e53e2004-05-18 18:57:06 +0000464 }
465 }
466
hasso049207c2004-08-04 20:02:13 +0000467 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
468 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, o->lsdb);
469
470 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +0000471 return CMD_SUCCESS;
472}
473
474ALIAS (show_ipv6_ospf6_database_router,
475 show_ipv6_ospf6_database_router_detail_cmd,
476 "show ipv6 ospf6 database * * A.B.C.D "
477 "(detail|dump|internal)",
478 SHOW_STR
479 IPV6_STR
480 OSPF6_STR
481 "Display Link state database\n"
482 "Any Link state Type\n"
483 "Any Link state ID\n"
484 "Specify Advertising Router as IPv4 address notation\n"
485 "Display details of LSAs\n"
486 "Dump LSAs\n"
487 "Display LSA's internal information\n"
488 );
489
hasso049207c2004-08-04 20:02:13 +0000490ALIAS (show_ipv6_ospf6_database_router,
491 show_ipv6_ospf6_database_adv_router_cmd,
492 "show ipv6 ospf6 database adv-router A.B.C.D",
493 SHOW_STR
494 IPV6_STR
495 OSPF6_STR
496 "Display Link state database\n"
497 "Search by Advertising Router\n"
498 "Specify Advertising Router as IPv4 address notation\n"
499 );
500
501ALIAS (show_ipv6_ospf6_database_router,
502 show_ipv6_ospf6_database_adv_router_detail_cmd,
503 "show ipv6 ospf6 database adv-router A.B.C.D "
504 "(detail|dump|internal)",
505 SHOW_STR
506 IPV6_STR
507 OSPF6_STR
508 "Display Link state database\n"
509 "Search by Advertising Router\n"
510 "Specify Advertising Router as IPv4 address notation\n"
511 "Display details of LSAs\n"
512 "Dump LSAs\n"
513 "Display LSA's internal information\n"
514 );
515
hasso508e53e2004-05-18 18:57:06 +0000516DEFUN (show_ipv6_ospf6_database_type_id,
517 show_ipv6_ospf6_database_type_id_cmd,
518 "show ipv6 ospf6 database "
519 "(router|network|inter-prefix|inter-router|as-external|"
520 "group-membership|type-7|link|intra-prefix) A.B.C.D",
521 SHOW_STR
522 IPV6_STR
523 OSPF6_STR
524 "Display Link state database\n"
525 "Display Router LSAs\n"
526 "Display Network LSAs\n"
527 "Display Inter-Area-Prefix LSAs\n"
528 "Display Inter-Area-Router LSAs\n"
529 "Display As-External LSAs\n"
530 "Display Group-Membership LSAs\n"
531 "Display Type-7 LSAs\n"
532 "Display Link LSAs\n"
533 "Display Intra-Area-Prefix LSAs\n"
534 "Specify Link state ID as IPv4 address notation\n"
535 )
536{
hasso049207c2004-08-04 20:02:13 +0000537 int level;
hasso508e53e2004-05-18 18:57:06 +0000538 listnode i, j;
539 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +0000540 struct ospf6_area *oa;
541 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +0000542 u_int16_t type = 0;
543 u_int32_t id = 0;
544
545 OSPF6_CMD_CHECK_RUNNING ();
546
hasso049207c2004-08-04 20:02:13 +0000547 type = parse_type_spec (argc, argv);
548 argc--;
549 argv++;
hasso508e53e2004-05-18 18:57:06 +0000550
hasso049207c2004-08-04 20:02:13 +0000551 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
hasso508e53e2004-05-18 18:57:06 +0000552 {
553 vty_out (vty, "Link state ID is not parsable: %s%s",
hasso049207c2004-08-04 20:02:13 +0000554 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000555 return CMD_SUCCESS;
556 }
557
hasso049207c2004-08-04 20:02:13 +0000558 argc--;
559 argv++;
560 level = parse_show_level (argc, argv);
561
562 switch (OSPF6_LSA_SCOPE (type))
hasso508e53e2004-05-18 18:57:06 +0000563 {
hasso6452df02004-08-15 05:52:07 +0000564 case OSPF6_SCOPE_AREA:
hasso049207c2004-08-04 20:02:13 +0000565 for (i = listhead (o->area_list); i; nextnode (i))
566 {
567 oa = (struct ospf6_area *) getdata (i);
568 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
569 ospf6_lsdb_show (vty, level, &type, &id, NULL, oa->lsdb);
570 }
571 break;
572
hasso6452df02004-08-15 05:52:07 +0000573 case OSPF6_SCOPE_LINKLOCAL:
hasso049207c2004-08-04 20:02:13 +0000574 for (i = listhead (o->area_list); i; nextnode (i))
575 {
576 oa = (struct ospf6_area *) getdata (i);
577 for (j = listhead (oa->if_list); j; nextnode (j))
578 {
579 oi = (struct ospf6_interface *) getdata (j);
580 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
581 oi->interface->name, oa->name, VNL, VNL);
582 ospf6_lsdb_show (vty, level, &type, &id, NULL, oi->lsdb);
583 }
584 }
585 break;
586
hasso6452df02004-08-15 05:52:07 +0000587 case OSPF6_SCOPE_AS:
hasso049207c2004-08-04 20:02:13 +0000588 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
589 ospf6_lsdb_show (vty, level, &type, &id, NULL, o->lsdb);
590 break;
591
592 default:
593 assert (0);
594 break;
hasso508e53e2004-05-18 18:57:06 +0000595 }
596
hasso049207c2004-08-04 20:02:13 +0000597 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +0000598 return CMD_SUCCESS;
599}
600
601ALIAS (show_ipv6_ospf6_database_type_id,
602 show_ipv6_ospf6_database_type_id_detail_cmd,
603 "show ipv6 ospf6 database "
604 "(router|network|inter-prefix|inter-router|as-external|"
605 "group-membership|type-7|link|intra-prefix) A.B.C.D "
606 "(detail|dump|internal)",
607 SHOW_STR
608 IPV6_STR
609 OSPF6_STR
610 "Display Link state database\n"
611 "Display Router LSAs\n"
612 "Display Network LSAs\n"
613 "Display Inter-Area-Prefix LSAs\n"
614 "Display Inter-Area-Router LSAs\n"
615 "Display As-External LSAs\n"
616 "Display Group-Membership LSAs\n"
617 "Display Type-7 LSAs\n"
618 "Display Link LSAs\n"
619 "Display Intra-Area-Prefix LSAs\n"
620 "Specify Link state ID as IPv4 address notation\n"
621 "Display details of LSAs\n"
622 "Dump LSAs\n"
623 "Display LSA's internal information\n"
624 );
625
hasso049207c2004-08-04 20:02:13 +0000626ALIAS (show_ipv6_ospf6_database_type_id,
627 show_ipv6_ospf6_database_type_linkstate_id_cmd,
628 "show ipv6 ospf6 database "
629 "(router|network|inter-prefix|inter-router|as-external|"
630 "group-membership|type-7|link|intra-prefix) linkstate-id A.B.C.D",
631 SHOW_STR
632 IPV6_STR
633 OSPF6_STR
634 "Display Link state database\n"
635 "Display Router LSAs\n"
636 "Display Network LSAs\n"
637 "Display Inter-Area-Prefix LSAs\n"
638 "Display Inter-Area-Router LSAs\n"
639 "Display As-External LSAs\n"
640 "Display Group-Membership LSAs\n"
641 "Display Type-7 LSAs\n"
642 "Display Link LSAs\n"
643 "Display Intra-Area-Prefix LSAs\n"
644 "Search by Link state ID\n"
645 "Specify Link state ID as IPv4 address notation\n"
646 );
647
648ALIAS (show_ipv6_ospf6_database_type_id,
649 show_ipv6_ospf6_database_type_linkstate_id_detail_cmd,
650 "show ipv6 ospf6 database "
651 "(router|network|inter-prefix|inter-router|as-external|"
652 "group-membership|type-7|link|intra-prefix) linkstate-id A.B.C.D "
653 "(detail|dump|internal)",
654 SHOW_STR
655 IPV6_STR
656 OSPF6_STR
657 "Display Link state database\n"
658 "Display Router LSAs\n"
659 "Display Network LSAs\n"
660 "Display Inter-Area-Prefix LSAs\n"
661 "Display Inter-Area-Router LSAs\n"
662 "Display As-External LSAs\n"
663 "Display Group-Membership LSAs\n"
664 "Display Type-7 LSAs\n"
665 "Display Link LSAs\n"
666 "Display Intra-Area-Prefix LSAs\n"
667 "Search by Link state ID\n"
668 "Specify Link state ID as IPv4 address notation\n"
669 "Display details of LSAs\n"
670 "Dump LSAs\n"
671 "Display LSA's internal information\n"
672 );
673
hasso508e53e2004-05-18 18:57:06 +0000674DEFUN (show_ipv6_ospf6_database_type_router,
675 show_ipv6_ospf6_database_type_router_cmd,
676 "show ipv6 ospf6 database "
677 "(router|network|inter-prefix|inter-router|as-external|"
678 "group-membership|type-7|link|intra-prefix) * A.B.C.D",
679 SHOW_STR
680 IPV6_STR
681 OSPF6_STR
682 "Display Link state database\n"
683 "Display Router LSAs\n"
684 "Display Network LSAs\n"
685 "Display Inter-Area-Prefix LSAs\n"
686 "Display Inter-Area-Router LSAs\n"
687 "Display As-External LSAs\n"
688 "Display Group-Membership LSAs\n"
689 "Display Type-7 LSAs\n"
690 "Display Link LSAs\n"
691 "Display Intra-Area-Prefix LSAs\n"
692 "Any Link state ID\n"
693 "Specify Advertising Router as IPv4 address notation\n"
694 )
695{
hasso049207c2004-08-04 20:02:13 +0000696 int level;
hasso508e53e2004-05-18 18:57:06 +0000697 listnode i, j;
698 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +0000699 struct ospf6_area *oa;
700 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +0000701 u_int16_t type = 0;
hasso049207c2004-08-04 20:02:13 +0000702 u_int32_t adv_router = 0;
hasso508e53e2004-05-18 18:57:06 +0000703
704 OSPF6_CMD_CHECK_RUNNING ();
705
hasso049207c2004-08-04 20:02:13 +0000706 type = parse_type_spec (argc, argv);
707 argc--;
708 argv++;
hasso508e53e2004-05-18 18:57:06 +0000709
hasso049207c2004-08-04 20:02:13 +0000710 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
hasso508e53e2004-05-18 18:57:06 +0000711 {
712 vty_out (vty, "Advertising Router is not parsable: %s%s",
hasso049207c2004-08-04 20:02:13 +0000713 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000714 return CMD_SUCCESS;
715 }
716
hasso049207c2004-08-04 20:02:13 +0000717 argc--;
718 argv++;
719 level = parse_show_level (argc, argv);
720
721 switch (OSPF6_LSA_SCOPE (type))
hasso508e53e2004-05-18 18:57:06 +0000722 {
hasso6452df02004-08-15 05:52:07 +0000723 case OSPF6_SCOPE_AREA:
hasso049207c2004-08-04 20:02:13 +0000724 for (i = listhead (o->area_list); i; nextnode (i))
725 {
726 oa = (struct ospf6_area *) getdata (i);
727 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
728 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oa->lsdb);
729 }
730 break;
731
hasso6452df02004-08-15 05:52:07 +0000732 case OSPF6_SCOPE_LINKLOCAL:
hasso049207c2004-08-04 20:02:13 +0000733 for (i = listhead (o->area_list); i; nextnode (i))
734 {
735 oa = (struct ospf6_area *) getdata (i);
736 for (j = listhead (oa->if_list); j; nextnode (j))
737 {
738 oi = (struct ospf6_interface *) getdata (j);
739 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
740 oi->interface->name, oa->name, VNL, VNL);
741 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oi->lsdb);
742 }
743 }
744 break;
745
hasso6452df02004-08-15 05:52:07 +0000746 case OSPF6_SCOPE_AS:
hasso049207c2004-08-04 20:02:13 +0000747 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
748 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, o->lsdb);
749 break;
750
751 default:
752 assert (0);
753 break;
hasso508e53e2004-05-18 18:57:06 +0000754 }
755
hasso049207c2004-08-04 20:02:13 +0000756 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +0000757 return CMD_SUCCESS;
758}
759
760ALIAS (show_ipv6_ospf6_database_type_router,
761 show_ipv6_ospf6_database_type_router_detail_cmd,
762 "show ipv6 ospf6 database "
763 "(router|network|inter-prefix|inter-router|as-external|"
764 "group-membership|type-7|link|intra-prefix) * A.B.C.D "
765 "(detail|dump|internal)",
766 SHOW_STR
767 IPV6_STR
768 OSPF6_STR
769 "Display Link state database\n"
770 "Display Router LSAs\n"
771 "Display Network LSAs\n"
772 "Display Inter-Area-Prefix LSAs\n"
773 "Display Inter-Area-Router LSAs\n"
774 "Display As-External LSAs\n"
775 "Display Group-Membership LSAs\n"
776 "Display Type-7 LSAs\n"
777 "Display Link LSAs\n"
778 "Display Intra-Area-Prefix LSAs\n"
779 "Any Link state ID\n"
780 "Specify Advertising Router as IPv4 address notation\n"
781 "Display details of LSAs\n"
782 "Dump LSAs\n"
783 "Display LSA's internal information\n"
784 );
785
hasso049207c2004-08-04 20:02:13 +0000786ALIAS (show_ipv6_ospf6_database_type_router,
787 show_ipv6_ospf6_database_type_adv_router_cmd,
788 "show ipv6 ospf6 database "
789 "(router|network|inter-prefix|inter-router|as-external|"
790 "group-membership|type-7|link|intra-prefix) adv-router A.B.C.D",
791 SHOW_STR
792 IPV6_STR
793 OSPF6_STR
794 "Display Link state database\n"
795 "Display Router LSAs\n"
796 "Display Network LSAs\n"
797 "Display Inter-Area-Prefix LSAs\n"
798 "Display Inter-Area-Router LSAs\n"
799 "Display As-External LSAs\n"
800 "Display Group-Membership LSAs\n"
801 "Display Type-7 LSAs\n"
802 "Display Link LSAs\n"
803 "Display Intra-Area-Prefix LSAs\n"
804 "Search by Advertising Router\n"
805 "Specify Advertising Router as IPv4 address notation\n"
806 );
807
808ALIAS (show_ipv6_ospf6_database_type_router,
809 show_ipv6_ospf6_database_type_adv_router_detail_cmd,
810 "show ipv6 ospf6 database "
811 "(router|network|inter-prefix|inter-router|as-external|"
812 "group-membership|type-7|link|intra-prefix) adv-router A.B.C.D "
813 "(detail|dump|internal)",
814 SHOW_STR
815 IPV6_STR
816 OSPF6_STR
817 "Display Link state database\n"
818 "Display Router LSAs\n"
819 "Display Network LSAs\n"
820 "Display Inter-Area-Prefix LSAs\n"
821 "Display Inter-Area-Router LSAs\n"
822 "Display As-External LSAs\n"
823 "Display Group-Membership LSAs\n"
824 "Display Type-7 LSAs\n"
825 "Display Link LSAs\n"
826 "Display Intra-Area-Prefix LSAs\n"
827 "Search by Advertising Router\n"
828 "Specify Advertising Router as IPv4 address notation\n"
829 "Display details of LSAs\n"
830 "Dump LSAs\n"
831 "Display LSA's internal information\n"
832 );
833
hasso508e53e2004-05-18 18:57:06 +0000834DEFUN (show_ipv6_ospf6_database_id_router,
835 show_ipv6_ospf6_database_id_router_cmd,
836 "show ipv6 ospf6 database * A.B.C.D A.B.C.D",
837 SHOW_STR
838 IPV6_STR
839 OSPF6_STR
840 "Display Link state database\n"
841 "Any Link state Type\n"
842 "Specify Link state ID as IPv4 address notation\n"
843 "Specify Advertising Router as IPv4 address notation\n"
844 )
845{
hasso049207c2004-08-04 20:02:13 +0000846 int level;
hasso508e53e2004-05-18 18:57:06 +0000847 listnode i, j;
848 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +0000849 struct ospf6_area *oa;
850 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +0000851 u_int32_t id = 0;
hasso049207c2004-08-04 20:02:13 +0000852 u_int32_t adv_router = 0;
hasso508e53e2004-05-18 18:57:06 +0000853
854 OSPF6_CMD_CHECK_RUNNING ();
855
hasso508e53e2004-05-18 18:57:06 +0000856 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
857 {
858 vty_out (vty, "Link state ID is not parsable: %s%s",
hasso6452df02004-08-15 05:52:07 +0000859 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000860 return CMD_SUCCESS;
861 }
862
hasso049207c2004-08-04 20:02:13 +0000863 argc--;
864 argv++;
865
866 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
hasso508e53e2004-05-18 18:57:06 +0000867 {
868 vty_out (vty, "Advertising Router is not parsable: %s%s",
hasso049207c2004-08-04 20:02:13 +0000869 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +0000870 return CMD_SUCCESS;
871 }
872
hasso049207c2004-08-04 20:02:13 +0000873 argc--;
874 argv++;
875 level = parse_show_level (argc, argv);
876
hasso508e53e2004-05-18 18:57:06 +0000877 for (i = listhead (o->area_list); i; nextnode (i))
878 {
hasso049207c2004-08-04 20:02:13 +0000879 oa = (struct ospf6_area *) getdata (i);
880 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
881 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oa->lsdb);
hasso508e53e2004-05-18 18:57:06 +0000882 }
hasso049207c2004-08-04 20:02:13 +0000883
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);
hasso508e53e2004-05-18 18:57:06 +0000887 for (j = listhead (oa->if_list); j; nextnode (j))
888 {
hasso049207c2004-08-04 20:02:13 +0000889 oi = (struct ospf6_interface *) getdata (j);
890 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
891 oi->interface->name, oa->name, VNL, VNL);
892 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oi->lsdb);
hasso508e53e2004-05-18 18:57:06 +0000893 }
894 }
895
hasso049207c2004-08-04 20:02:13 +0000896 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
897 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, o->lsdb);
898
899 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +0000900 return CMD_SUCCESS;
901}
902
903ALIAS (show_ipv6_ospf6_database_id_router,
904 show_ipv6_ospf6_database_id_router_detail_cmd,
905 "show ipv6 ospf6 database * A.B.C.D A.B.C.D "
906 "(detail|dump|internal)",
907 SHOW_STR
908 IPV6_STR
909 OSPF6_STR
910 "Display Link state database\n"
911 "Any Link state Type\n"
912 "Specify Link state ID as IPv4 address notation\n"
913 "Specify Advertising Router as IPv4 address notation\n"
914 "Display details of LSAs\n"
915 "Dump LSAs\n"
916 "Display LSA's internal information\n"
917 );
918
hasso049207c2004-08-04 20:02:13 +0000919DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id,
920 show_ipv6_ospf6_database_adv_router_linkstate_id_cmd,
921 "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D",
922 SHOW_STR
923 IPV6_STR
924 OSPF6_STR
925 "Display Link state database\n"
926 "Search by Advertising Router\n"
927 "Specify Advertising Router as IPv4 address notation\n"
928 "Search by Link state ID\n"
929 "Specify Link state ID as IPv4 address notation\n"
930 )
931{
932 int level;
933 listnode i, j;
934 struct ospf6 *o = ospf6;
935 struct ospf6_area *oa;
936 struct ospf6_interface *oi;
937 u_int32_t id = 0;
938 u_int32_t adv_router = 0;
939
940 OSPF6_CMD_CHECK_RUNNING ();
941
942 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
943 {
944 vty_out (vty, "Advertising Router is not parsable: %s%s",
945 argv[0], VNL);
946 return CMD_SUCCESS;
947 }
948
949 argc--;
950 argv++;
951
952 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
953 {
954 vty_out (vty, "Link state ID is not parsable: %s%s",
hasso6452df02004-08-15 05:52:07 +0000955 argv[0], VNL);
hasso049207c2004-08-04 20:02:13 +0000956 return CMD_SUCCESS;
957 }
958
959 argc--;
960 argv++;
961 level = parse_show_level (argc, argv);
962
963 for (i = listhead (o->area_list); i; nextnode (i))
964 {
965 oa = (struct ospf6_area *) getdata (i);
966 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
967 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oa->lsdb);
968 }
969
970 for (i = listhead (o->area_list); i; nextnode (i))
971 {
972 oa = (struct ospf6_area *) getdata (i);
973 for (j = listhead (oa->if_list); j; nextnode (j))
974 {
975 oi = (struct ospf6_interface *) getdata (j);
976 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
977 oi->interface->name, oa->name, VNL, VNL);
978 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, oi->lsdb);
979 }
980 }
981
982 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
983 ospf6_lsdb_show (vty, level, NULL, &id, &adv_router, o->lsdb);
984
985 vty_out (vty, "%s", VNL);
986 return CMD_SUCCESS;
987}
988
989ALIAS (show_ipv6_ospf6_database_adv_router_linkstate_id,
990 show_ipv6_ospf6_database_adv_router_linkstate_id_detail_cmd,
991 "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D "
992 "(detail|dump|internal)",
993 SHOW_STR
994 IPV6_STR
995 OSPF6_STR
996 "Display Link state database\n"
997 "Search by Advertising Router\n"
998 "Specify Advertising Router as IPv4 address notation\n"
999 "Search by Link state ID\n"
1000 "Specify Link state ID as IPv4 address notation\n"
1001 "Display details of LSAs\n"
1002 "Dump LSAs\n"
1003 "Display LSA's internal information\n"
1004 );
1005
hasso508e53e2004-05-18 18:57:06 +00001006DEFUN (show_ipv6_ospf6_database_type_id_router,
1007 show_ipv6_ospf6_database_type_id_router_cmd,
1008 "show ipv6 ospf6 database "
1009 "(router|network|inter-prefix|inter-router|as-external|"
1010 "group-membership|type-7|link|intra-prefix) A.B.C.D A.B.C.D",
1011 SHOW_STR
1012 IPV6_STR
1013 OSPF6_STR
1014 "Display Link state database\n"
1015 "Display Router LSAs\n"
1016 "Display Network LSAs\n"
1017 "Display Inter-Area-Prefix LSAs\n"
1018 "Display Inter-Area-Router LSAs\n"
1019 "Display As-External LSAs\n"
1020 "Display Group-Membership LSAs\n"
1021 "Display Type-7 LSAs\n"
1022 "Display Link LSAs\n"
1023 "Display Intra-Area-Prefix LSAs\n"
1024 "Specify Link state ID as IPv4 address notation\n"
1025 "Specify Advertising Router as IPv4 address notation\n"
1026 )
1027{
hasso049207c2004-08-04 20:02:13 +00001028 int level;
hasso508e53e2004-05-18 18:57:06 +00001029 listnode i, j;
1030 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +00001031 struct ospf6_area *oa;
1032 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +00001033 u_int16_t type = 0;
1034 u_int32_t id = 0;
hasso049207c2004-08-04 20:02:13 +00001035 u_int32_t adv_router = 0;
hasso508e53e2004-05-18 18:57:06 +00001036
1037 OSPF6_CMD_CHECK_RUNNING ();
1038
hasso049207c2004-08-04 20:02:13 +00001039 type = parse_type_spec (argc, argv);
1040 argc--;
1041 argv++;
hasso508e53e2004-05-18 18:57:06 +00001042
hasso049207c2004-08-04 20:02:13 +00001043 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
hasso508e53e2004-05-18 18:57:06 +00001044 {
1045 vty_out (vty, "Link state ID is not parsable: %s%s",
hasso049207c2004-08-04 20:02:13 +00001046 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +00001047 return CMD_SUCCESS;
1048 }
1049
hasso049207c2004-08-04 20:02:13 +00001050 argc--;
1051 argv++;
1052
1053 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
hasso508e53e2004-05-18 18:57:06 +00001054 {
1055 vty_out (vty, "Advertising Router is not parsable: %s%s",
hasso049207c2004-08-04 20:02:13 +00001056 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +00001057 return CMD_SUCCESS;
1058 }
1059
hasso049207c2004-08-04 20:02:13 +00001060 argc--;
1061 argv++;
1062 level = parse_show_level (argc, argv);
1063
1064 switch (OSPF6_LSA_SCOPE (type))
hasso508e53e2004-05-18 18:57:06 +00001065 {
hasso6452df02004-08-15 05:52:07 +00001066 case OSPF6_SCOPE_AREA:
hasso049207c2004-08-04 20:02:13 +00001067 for (i = listhead (o->area_list); i; nextnode (i))
1068 {
1069 oa = (struct ospf6_area *) getdata (i);
1070 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1071 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1072 }
1073 break;
1074
hasso6452df02004-08-15 05:52:07 +00001075 case OSPF6_SCOPE_LINKLOCAL:
hasso049207c2004-08-04 20:02:13 +00001076 for (i = listhead (o->area_list); i; nextnode (i))
1077 {
1078 oa = (struct ospf6_area *) getdata (i);
1079 for (j = listhead (oa->if_list); j; nextnode (j))
1080 {
1081 oi = (struct ospf6_interface *) getdata (j);
1082 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1083 oi->interface->name, oa->name, VNL, VNL);
1084 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1085 }
1086 }
1087 break;
1088
hasso6452df02004-08-15 05:52:07 +00001089 case OSPF6_SCOPE_AS:
hasso049207c2004-08-04 20:02:13 +00001090 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1091 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1092 break;
1093
1094 default:
1095 assert (0);
1096 break;
hasso508e53e2004-05-18 18:57:06 +00001097 }
1098
hasso049207c2004-08-04 20:02:13 +00001099 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +00001100 return CMD_SUCCESS;
1101}
1102
1103ALIAS (show_ipv6_ospf6_database_type_id_router,
1104 show_ipv6_ospf6_database_type_id_router_detail_cmd,
1105 "show ipv6 ospf6 database "
1106 "(router|network|inter-prefix|inter-router|as-external|"
1107 "group-membership|type-7|link|intra-prefix) A.B.C.D A.B.C.D "
1108 "(dump|internal)",
1109 SHOW_STR
1110 IPV6_STR
1111 OSPF6_STR
1112 "Display Link state database\n"
1113 "Display Router LSAs\n"
1114 "Display Network LSAs\n"
1115 "Display Inter-Area-Prefix LSAs\n"
1116 "Display Inter-Area-Router LSAs\n"
1117 "Display As-External LSAs\n"
1118 "Display Group-Membership LSAs\n"
1119 "Display Type-7 LSAs\n"
1120 "Display Link LSAs\n"
1121 "Display Intra-Area-Prefix LSAs\n"
1122 "Specify Link state ID as IPv4 address notation\n"
1123 "Specify Advertising Router as IPv4 address notation\n"
hasso049207c2004-08-04 20:02:13 +00001124 "Dump LSAs\n"
1125 "Display LSA's internal information\n"
1126 );
1127
1128DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id,
1129 show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd,
1130 "show ipv6 ospf6 database "
1131 "(router|network|inter-prefix|inter-router|as-external|"
1132 "group-membership|type-7|link|intra-prefix) "
1133 "adv-router A.B.C.D linkstate-id A.B.C.D",
1134 SHOW_STR
1135 IPV6_STR
1136 OSPF6_STR
1137 "Display Link state database\n"
1138 "Display Router LSAs\n"
1139 "Display Network LSAs\n"
1140 "Display Inter-Area-Prefix LSAs\n"
1141 "Display Inter-Area-Router LSAs\n"
1142 "Display As-External LSAs\n"
1143 "Display Group-Membership LSAs\n"
1144 "Display Type-7 LSAs\n"
1145 "Display Link LSAs\n"
1146 "Display Intra-Area-Prefix LSAs\n"
1147 "Search by Advertising Router\n"
1148 "Specify Advertising Router as IPv4 address notation\n"
1149 "Search by Link state ID\n"
1150 "Specify Link state ID as IPv4 address notation\n"
1151 )
1152{
1153 int level;
1154 listnode i, j;
1155 struct ospf6 *o = ospf6;
1156 struct ospf6_area *oa;
1157 struct ospf6_interface *oi;
1158 u_int16_t type = 0;
1159 u_int32_t id = 0;
1160 u_int32_t adv_router = 0;
1161
1162 OSPF6_CMD_CHECK_RUNNING ();
1163
1164 type = parse_type_spec (argc, argv);
1165 argc--;
1166 argv++;
1167
1168 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
1169 {
1170 vty_out (vty, "Advertising Router is not parsable: %s%s",
1171 argv[0], VNL);
1172 return CMD_SUCCESS;
1173 }
1174
1175 argc--;
1176 argv++;
1177
1178 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
1179 {
1180 vty_out (vty, "Link state ID is not parsable: %s%s",
1181 argv[0], VNL);
1182 return CMD_SUCCESS;
1183 }
1184
1185 argc--;
1186 argv++;
1187 level = parse_show_level (argc, argv);
1188
1189 switch (OSPF6_LSA_SCOPE (type))
1190 {
hasso6452df02004-08-15 05:52:07 +00001191 case OSPF6_SCOPE_AREA:
hasso049207c2004-08-04 20:02:13 +00001192 for (i = listhead (o->area_list); i; nextnode (i))
1193 {
1194 oa = (struct ospf6_area *) getdata (i);
1195 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1196 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1197 }
1198 break;
1199
hasso6452df02004-08-15 05:52:07 +00001200 case OSPF6_SCOPE_LINKLOCAL:
hasso049207c2004-08-04 20:02:13 +00001201 for (i = listhead (o->area_list); i; nextnode (i))
1202 {
1203 oa = (struct ospf6_area *) getdata (i);
1204 for (j = listhead (oa->if_list); j; nextnode (j))
1205 {
1206 oi = (struct ospf6_interface *) getdata (j);
1207 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1208 oi->interface->name, oa->name, VNL, VNL);
1209 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1210 }
1211 }
1212 break;
1213
hasso6452df02004-08-15 05:52:07 +00001214 case OSPF6_SCOPE_AS:
hasso049207c2004-08-04 20:02:13 +00001215 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1216 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1217 break;
1218
1219 default:
1220 assert (0);
1221 break;
1222 }
1223
1224 vty_out (vty, "%s", VNL);
1225 return CMD_SUCCESS;
1226}
1227
1228ALIAS (show_ipv6_ospf6_database_type_adv_router_linkstate_id,
1229 show_ipv6_ospf6_database_type_adv_router_linkstate_id_detail_cmd,
1230 "show ipv6 ospf6 database "
1231 "(router|network|inter-prefix|inter-router|as-external|"
1232 "group-membership|type-7|link|intra-prefix) "
1233 "adv-router A.B.C.D linkstate-id A.B.C.D "
1234 "(dump|internal)",
1235 SHOW_STR
1236 IPV6_STR
1237 OSPF6_STR
1238 "Display Link state database\n"
1239 "Display Router LSAs\n"
1240 "Display Network LSAs\n"
1241 "Display Inter-Area-Prefix LSAs\n"
1242 "Display Inter-Area-Router LSAs\n"
1243 "Display As-External LSAs\n"
1244 "Display Group-Membership LSAs\n"
1245 "Display Type-7 LSAs\n"
1246 "Display Link LSAs\n"
1247 "Display Intra-Area-Prefix LSAs\n"
1248 "Search by Advertising Router\n"
1249 "Specify Advertising Router as IPv4 address notation\n"
1250 "Search by Link state ID\n"
1251 "Specify Link state ID as IPv4 address notation\n"
hasso508e53e2004-05-18 18:57:06 +00001252 "Dump LSAs\n"
1253 "Display LSA's internal information\n"
1254 );
1255
1256DEFUN (show_ipv6_ospf6_database_self_originated,
1257 show_ipv6_ospf6_database_self_originated_cmd,
1258 "show ipv6 ospf6 database self-originated",
1259 SHOW_STR
1260 IPV6_STR
1261 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001262 "Display Self-originated LSAs\n"
1263 )
1264{
hasso049207c2004-08-04 20:02:13 +00001265 int level;
hasso508e53e2004-05-18 18:57:06 +00001266 listnode i, j;
1267 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +00001268 struct ospf6_area *oa;
1269 struct ospf6_interface *oi;
1270 u_int32_t adv_router = 0;
hasso508e53e2004-05-18 18:57:06 +00001271
1272 OSPF6_CMD_CHECK_RUNNING ();
1273
hasso049207c2004-08-04 20:02:13 +00001274 level = parse_show_level (argc, argv);
hasso508e53e2004-05-18 18:57:06 +00001275
hasso049207c2004-08-04 20:02:13 +00001276 adv_router = o->router_id;
hasso508e53e2004-05-18 18:57:06 +00001277
hasso508e53e2004-05-18 18:57:06 +00001278 for (i = listhead (o->area_list); i; nextnode (i))
1279 {
hasso049207c2004-08-04 20:02:13 +00001280 oa = (struct ospf6_area *) getdata (i);
1281 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1282 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oa->lsdb);
hasso508e53e2004-05-18 18:57:06 +00001283 }
hasso049207c2004-08-04 20:02:13 +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);
hasso508e53e2004-05-18 18:57:06 +00001288 for (j = listhead (oa->if_list); j; nextnode (j))
1289 {
hasso049207c2004-08-04 20:02:13 +00001290 oi = (struct ospf6_interface *) getdata (j);
1291 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1292 oi->interface->name, oa->name, VNL, VNL);
1293 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, oi->lsdb);
hasso508e53e2004-05-18 18:57:06 +00001294 }
1295 }
1296
hasso049207c2004-08-04 20:02:13 +00001297 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1298 ospf6_lsdb_show (vty, level, NULL, NULL, &adv_router, o->lsdb);
1299
1300 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +00001301 return CMD_SUCCESS;
1302}
1303
1304ALIAS (show_ipv6_ospf6_database_self_originated,
1305 show_ipv6_ospf6_database_self_originated_detail_cmd,
1306 "show ipv6 ospf6 database self-originated "
1307 "(detail|dump|internal)",
1308 SHOW_STR
1309 IPV6_STR
1310 OSPF6_STR
hasso508e53e2004-05-18 18:57:06 +00001311 "Display Self-originated LSAs\n"
1312 "Display details of LSAs\n"
1313 "Dump LSAs\n"
1314 "Display LSA's internal information\n"
hasso049207c2004-08-04 20:02:13 +00001315 )
hasso508e53e2004-05-18 18:57:06 +00001316
1317DEFUN (show_ipv6_ospf6_database_type_self_originated,
1318 show_ipv6_ospf6_database_type_self_originated_cmd,
1319 "show ipv6 ospf6 database "
1320 "(router|network|inter-prefix|inter-router|as-external|"
1321 "group-membership|type-7|link|intra-prefix) self-originated",
1322 SHOW_STR
1323 IPV6_STR
1324 OSPF6_STR
1325 "Display Link state database\n"
1326 "Display Router LSAs\n"
1327 "Display Network LSAs\n"
1328 "Display Inter-Area-Prefix LSAs\n"
1329 "Display Inter-Area-Router LSAs\n"
1330 "Display As-External LSAs\n"
1331 "Display Group-Membership LSAs\n"
1332 "Display Type-7 LSAs\n"
1333 "Display Link LSAs\n"
1334 "Display Intra-Area-Prefix LSAs\n"
1335 "Display Self-originated LSAs\n"
1336 )
1337{
hasso049207c2004-08-04 20:02:13 +00001338 int level;
hasso508e53e2004-05-18 18:57:06 +00001339 listnode i, j;
1340 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +00001341 struct ospf6_area *oa;
1342 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +00001343 u_int16_t type = 0;
hasso049207c2004-08-04 20:02:13 +00001344 u_int32_t adv_router = 0;
hasso508e53e2004-05-18 18:57:06 +00001345
1346 OSPF6_CMD_CHECK_RUNNING ();
1347
hasso049207c2004-08-04 20:02:13 +00001348 type = parse_type_spec (argc, argv);
1349 argc--;
1350 argv++;
1351 level = parse_show_level (argc, argv);
hasso508e53e2004-05-18 18:57:06 +00001352
hasso049207c2004-08-04 20:02:13 +00001353 adv_router = o->router_id;
hasso508e53e2004-05-18 18:57:06 +00001354
hasso049207c2004-08-04 20:02:13 +00001355 switch (OSPF6_LSA_SCOPE (type))
1356 {
hasso6452df02004-08-15 05:52:07 +00001357 case OSPF6_SCOPE_AREA:
hasso049207c2004-08-04 20:02:13 +00001358 for (i = listhead (o->area_list); i; nextnode (i))
1359 {
1360 oa = (struct ospf6_area *) getdata (i);
1361 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1362 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oa->lsdb);
1363 }
1364 break;
hasso508e53e2004-05-18 18:57:06 +00001365
hasso6452df02004-08-15 05:52:07 +00001366 case OSPF6_SCOPE_LINKLOCAL:
hasso049207c2004-08-04 20:02:13 +00001367 for (i = listhead (o->area_list); i; nextnode (i))
1368 {
1369 oa = (struct ospf6_area *) getdata (i);
1370 for (j = listhead (oa->if_list); j; nextnode (j))
1371 {
1372 oi = (struct ospf6_interface *) getdata (j);
1373 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1374 oi->interface->name, oa->name, VNL, VNL);
1375 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, oi->lsdb);
1376 }
1377 }
1378 break;
1379
hasso6452df02004-08-15 05:52:07 +00001380 case OSPF6_SCOPE_AS:
hasso049207c2004-08-04 20:02:13 +00001381 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1382 ospf6_lsdb_show (vty, level, &type, NULL, &adv_router, o->lsdb);
1383 break;
1384
1385 default:
1386 assert (0);
1387 break;
hasso508e53e2004-05-18 18:57:06 +00001388 }
1389
hasso049207c2004-08-04 20:02:13 +00001390 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +00001391 return CMD_SUCCESS;
1392}
1393
1394ALIAS (show_ipv6_ospf6_database_type_self_originated,
1395 show_ipv6_ospf6_database_type_self_originated_detail_cmd,
1396 "show ipv6 ospf6 database "
1397 "(router|network|inter-prefix|inter-router|as-external|"
1398 "group-membership|type-7|link|intra-prefix) self-originated "
1399 "(detail|dump|internal)",
1400 SHOW_STR
1401 IPV6_STR
1402 OSPF6_STR
1403 "Display Link state database\n"
1404 "Display Router LSAs\n"
1405 "Display Network LSAs\n"
1406 "Display Inter-Area-Prefix LSAs\n"
1407 "Display Inter-Area-Router LSAs\n"
1408 "Display As-External LSAs\n"
1409 "Display Group-Membership LSAs\n"
1410 "Display Type-7 LSAs\n"
1411 "Display Link LSAs\n"
1412 "Display Intra-Area-Prefix LSAs\n"
1413 "Display Self-originated LSAs\n"
1414 "Display details of LSAs\n"
1415 "Dump LSAs\n"
1416 "Display LSA's internal information\n"
1417 );
1418
hasso049207c2004-08-04 20:02:13 +00001419DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id,
1420 show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd,
1421 "show ipv6 ospf6 database "
1422 "(router|network|inter-prefix|inter-router|as-external|"
1423 "group-membership|type-7|link|intra-prefix) self-originated "
1424 "linkstate-id A.B.C.D",
1425 SHOW_STR
1426 IPV6_STR
1427 OSPF6_STR
1428 "Display Link state database\n"
1429 "Display Router LSAs\n"
1430 "Display Network LSAs\n"
1431 "Display Inter-Area-Prefix LSAs\n"
1432 "Display Inter-Area-Router LSAs\n"
1433 "Display As-External LSAs\n"
1434 "Display Group-Membership LSAs\n"
1435 "Display Type-7 LSAs\n"
1436 "Display Link LSAs\n"
1437 "Display Intra-Area-Prefix LSAs\n"
1438 "Display Self-originated LSAs\n"
1439 "Search by Link state ID\n"
1440 "Specify Link state ID as IPv4 address notation\n"
1441 )
1442{
1443 int level;
1444 listnode i, j;
1445 struct ospf6 *o = ospf6;
1446 struct ospf6_area *oa;
1447 struct ospf6_interface *oi;
1448 u_int16_t type = 0;
1449 u_int32_t adv_router = 0;
1450 u_int32_t id = 0;
1451
1452 OSPF6_CMD_CHECK_RUNNING ();
1453
1454 type = parse_type_spec (argc, argv);
1455 argc--;
1456 argv++;
1457
hasso6452df02004-08-15 05:52:07 +00001458 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
hasso049207c2004-08-04 20:02:13 +00001459 {
1460 vty_out (vty, "Link State ID is not parsable: %s%s",
1461 argv[0], VNL);
1462 return CMD_SUCCESS;
1463 }
1464
1465 argc--;
1466 argv++;
1467 level = parse_show_level (argc, argv);
1468
1469 adv_router = o->router_id;
1470
1471 switch (OSPF6_LSA_SCOPE (type))
1472 {
hasso6452df02004-08-15 05:52:07 +00001473 case OSPF6_SCOPE_AREA:
hasso049207c2004-08-04 20:02:13 +00001474 for (i = listhead (o->area_list); i; nextnode (i))
1475 {
1476 oa = (struct ospf6_area *) getdata (i);
1477 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1478 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1479 }
1480 break;
1481
hasso6452df02004-08-15 05:52:07 +00001482 case OSPF6_SCOPE_LINKLOCAL:
hasso049207c2004-08-04 20:02:13 +00001483 for (i = listhead (o->area_list); i; nextnode (i))
1484 {
1485 oa = (struct ospf6_area *) getdata (i);
1486 for (j = listhead (oa->if_list); j; nextnode (j))
1487 {
1488 oi = (struct ospf6_interface *) getdata (j);
1489 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1490 oi->interface->name, oa->name, VNL, VNL);
1491 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1492 }
1493 }
1494 break;
1495
hasso6452df02004-08-15 05:52:07 +00001496 case OSPF6_SCOPE_AS:
hasso049207c2004-08-04 20:02:13 +00001497 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1498 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1499 break;
1500
1501 default:
1502 assert (0);
1503 break;
1504 }
1505
1506 vty_out (vty, "%s", VNL);
1507 return CMD_SUCCESS;
1508}
1509
1510ALIAS (show_ipv6_ospf6_database_type_self_originated_linkstate_id,
1511 show_ipv6_ospf6_database_type_self_originated_linkstate_id_detail_cmd,
1512 "show ipv6 ospf6 database "
1513 "(router|network|inter-prefix|inter-router|as-external|"
1514 "group-membership|type-7|link|intra-prefix) self-originated "
1515 "linkstate-id A.B.C.D (detail|dump|internal)",
1516 SHOW_STR
1517 IPV6_STR
1518 OSPF6_STR
1519 "Display Link state database\n"
1520 "Display Router LSAs\n"
1521 "Display Network LSAs\n"
1522 "Display Inter-Area-Prefix LSAs\n"
1523 "Display Inter-Area-Router LSAs\n"
1524 "Display As-External LSAs\n"
1525 "Display Group-Membership LSAs\n"
1526 "Display Type-7 LSAs\n"
1527 "Display Link LSAs\n"
1528 "Display Intra-Area-Prefix LSAs\n"
1529 "Display Self-originated LSAs\n"
1530 "Search by Link state ID\n"
1531 "Specify Link state ID as IPv4 address notation\n"
1532 "Display details of LSAs\n"
1533 "Dump LSAs\n"
1534 "Display LSA's internal information\n"
1535 );
1536
hasso508e53e2004-05-18 18:57:06 +00001537DEFUN (show_ipv6_ospf6_database_type_id_self_originated,
1538 show_ipv6_ospf6_database_type_id_self_originated_cmd,
1539 "show ipv6 ospf6 database "
1540 "(router|network|inter-prefix|inter-router|as-external|"
1541 "group-membership|type-7|link|intra-prefix) A.B.C.D self-originated",
1542 SHOW_STR
1543 IPV6_STR
1544 OSPF6_STR
1545 "Display Link state database\n"
1546 "Display Router LSAs\n"
1547 "Display Network LSAs\n"
1548 "Display Inter-Area-Prefix LSAs\n"
1549 "Display Inter-Area-Router LSAs\n"
1550 "Display As-External LSAs\n"
1551 "Display Group-Membership LSAs\n"
1552 "Display Type-7 LSAs\n"
1553 "Display Link LSAs\n"
1554 "Display Intra-Area-Prefix LSAs\n"
1555 "Specify Link state ID as IPv4 address notation\n"
1556 "Display Self-originated LSAs\n"
1557 )
1558{
hasso049207c2004-08-04 20:02:13 +00001559 int level;
hasso508e53e2004-05-18 18:57:06 +00001560 listnode i, j;
1561 struct ospf6 *o = ospf6;
hasso049207c2004-08-04 20:02:13 +00001562 struct ospf6_area *oa;
1563 struct ospf6_interface *oi;
hasso508e53e2004-05-18 18:57:06 +00001564 u_int16_t type = 0;
hasso049207c2004-08-04 20:02:13 +00001565 u_int32_t adv_router = 0;
hasso508e53e2004-05-18 18:57:06 +00001566 u_int32_t id = 0;
1567
1568 OSPF6_CMD_CHECK_RUNNING ();
1569
hasso049207c2004-08-04 20:02:13 +00001570 type = parse_type_spec (argc, argv);
1571 argc--;
1572 argv++;
hasso508e53e2004-05-18 18:57:06 +00001573
hasso6452df02004-08-15 05:52:07 +00001574 if ((inet_pton (AF_INET, argv[0], &id)) != 1)
hasso508e53e2004-05-18 18:57:06 +00001575 {
1576 vty_out (vty, "Link State ID is not parsable: %s%s",
hasso049207c2004-08-04 20:02:13 +00001577 argv[0], VNL);
hasso508e53e2004-05-18 18:57:06 +00001578 return CMD_SUCCESS;
1579 }
1580
hasso049207c2004-08-04 20:02:13 +00001581 argc--;
1582 argv++;
1583 level = parse_show_level (argc, argv);
1584
1585 adv_router = o->router_id;
1586
1587 switch (OSPF6_LSA_SCOPE (type))
hasso508e53e2004-05-18 18:57:06 +00001588 {
hasso6452df02004-08-15 05:52:07 +00001589 case OSPF6_SCOPE_AREA:
hasso049207c2004-08-04 20:02:13 +00001590 for (i = listhead (o->area_list); i; nextnode (i))
1591 {
1592 oa = (struct ospf6_area *) getdata (i);
1593 vty_out (vty, AREA_LSDB_TITLE_FORMAT, VNL, oa->name, VNL, VNL);
1594 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oa->lsdb);
1595 }
1596 break;
1597
hasso6452df02004-08-15 05:52:07 +00001598 case OSPF6_SCOPE_LINKLOCAL:
hasso049207c2004-08-04 20:02:13 +00001599 for (i = listhead (o->area_list); i; nextnode (i))
1600 {
1601 oa = (struct ospf6_area *) getdata (i);
1602 for (j = listhead (oa->if_list); j; nextnode (j))
1603 {
1604 oi = (struct ospf6_interface *) getdata (j);
1605 vty_out (vty, IF_LSDB_TITLE_FORMAT, VNL,
1606 oi->interface->name, oa->name, VNL, VNL);
1607 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, oi->lsdb);
1608 }
1609 }
1610 break;
1611
hasso6452df02004-08-15 05:52:07 +00001612 case OSPF6_SCOPE_AS:
hasso049207c2004-08-04 20:02:13 +00001613 vty_out (vty, AS_LSDB_TITLE_FORMAT, VNL, VNL, VNL);
1614 ospf6_lsdb_show (vty, level, &type, &id, &adv_router, o->lsdb);
1615 break;
1616
1617 default:
1618 assert (0);
1619 break;
hasso508e53e2004-05-18 18:57:06 +00001620 }
1621
hasso049207c2004-08-04 20:02:13 +00001622 vty_out (vty, "%s", VNL);
hasso508e53e2004-05-18 18:57:06 +00001623 return CMD_SUCCESS;
1624}
1625
1626ALIAS (show_ipv6_ospf6_database_type_id_self_originated,
1627 show_ipv6_ospf6_database_type_id_self_originated_detail_cmd,
1628 "show ipv6 ospf6 database "
1629 "(router|network|inter-prefix|inter-router|as-external|"
1630 "group-membership|type-7|link|intra-prefix) A.B.C.D self-originated "
hasso049207c2004-08-04 20:02:13 +00001631 "(detail|dump|internal)",
hasso508e53e2004-05-18 18:57:06 +00001632 SHOW_STR
1633 IPV6_STR
1634 OSPF6_STR
1635 "Display Link state database\n"
1636 "Display Router LSAs\n"
1637 "Display Network LSAs\n"
1638 "Display Inter-Area-Prefix LSAs\n"
1639 "Display Inter-Area-Router LSAs\n"
1640 "Display As-External LSAs\n"
1641 "Display Group-Membership LSAs\n"
1642 "Display Type-7 LSAs\n"
1643 "Display Link LSAs\n"
1644 "Display Intra-Area-Prefix LSAs\n"
hasso508e53e2004-05-18 18:57:06 +00001645 "Display Self-originated LSAs\n"
hasso049207c2004-08-04 20:02:13 +00001646 "Search by Link state ID\n"
1647 "Specify Link state ID as IPv4 address notation\n"
hasso508e53e2004-05-18 18:57:06 +00001648 "Display details of LSAs\n"
1649 "Dump LSAs\n"
1650 "Display LSA's internal information\n"
1651 );
1652
hasso6452df02004-08-15 05:52:07 +00001653
1654DEFUN (show_ipv6_ospf6_border_routers,
1655 show_ipv6_ospf6_border_routers_cmd,
1656 "show ipv6 ospf6 border-routers",
1657 SHOW_STR
1658 IP6_STR
1659 OSPF6_STR
1660 "Display routing table for ABR and ASBR\n"
1661 )
1662{
1663 u_int32_t adv_router;
1664 void (*showfunc) (struct vty *, struct ospf6_route *);
1665 struct ospf6_route *ro;
1666 struct prefix prefix;
1667
1668 OSPF6_CMD_CHECK_RUNNING ();
1669
1670 if (argc && ! strcmp ("detail", argv[0]))
1671 {
1672 showfunc = ospf6_route_show_detail;
1673 argc--;
1674 argv++;
1675 }
1676 else
1677 showfunc = ospf6_brouter_show;
1678
1679 if (argc)
1680 {
1681 if ((inet_pton (AF_INET, argv[0], &adv_router)) != 1)
1682 {
1683 vty_out (vty, "Router ID is not parsable: %s%s", argv[0], VNL);
1684 return CMD_SUCCESS;
1685 }
1686
1687 ospf6_linkstate_prefix (adv_router, 0, &prefix);
1688 ro = ospf6_route_lookup (&prefix, ospf6->brouter_table);
1689 ospf6_route_show_detail (vty, ro);
1690 return CMD_SUCCESS;
1691 }
1692
1693 if (showfunc == ospf6_brouter_show)
1694 ospf6_brouter_show_header (vty);
1695
1696 for (ro = ospf6_route_head (ospf6->brouter_table); ro;
1697 ro = ospf6_route_next (ro))
1698 (*showfunc) (vty, ro);
1699
1700 return CMD_SUCCESS;
1701}
1702
1703ALIAS (show_ipv6_ospf6_border_routers,
1704 show_ipv6_ospf6_border_routers_detail_cmd,
1705 "show ipv6 ospf6 border-routers (A.B.C.D|detail)",
1706 SHOW_STR
1707 IP6_STR
1708 OSPF6_STR
1709 "Display routing table for ABR and ASBR\n"
1710 "Specify Router-ID\n"
1711 "Display Detail\n"
1712 );
1713
1714
paul718e3742002-12-13 20:15:29 +00001715/* Install ospf related commands. */
1716void
1717ospf6_init ()
1718{
hasso508e53e2004-05-18 18:57:06 +00001719 install_node (&debug_node, config_write_ospf6_debug);
paul718e3742002-12-13 20:15:29 +00001720
hasso508e53e2004-05-18 18:57:06 +00001721 install_element_ospf6_debug_message ();
1722 install_element_ospf6_debug_lsa ();
1723 install_element_ospf6_debug_interface ();
1724 install_element_ospf6_debug_neighbor ();
1725 install_element_ospf6_debug_zebra ();
1726 install_element_ospf6_debug_spf ();
1727 install_element_ospf6_debug_route ();
1728 install_element_ospf6_debug_asbr ();
hasso6452df02004-08-15 05:52:07 +00001729 install_element_ospf6_debug_abr ();
hasso508e53e2004-05-18 18:57:06 +00001730
paul718e3742002-12-13 20:15:29 +00001731 install_element (VIEW_NODE, &show_version_ospf6_cmd);
paul718e3742002-12-13 20:15:29 +00001732 install_element (ENABLE_NODE, &show_version_ospf6_cmd);
hasso049207c2004-08-04 20:02:13 +00001733
hasso6452df02004-08-15 05:52:07 +00001734 install_element (VIEW_NODE, &show_ipv6_ospf6_border_routers_cmd);
1735 install_element (VIEW_NODE, &show_ipv6_ospf6_border_routers_detail_cmd);
1736 install_element (ENABLE_NODE, &show_ipv6_ospf6_border_routers_cmd);
1737 install_element (ENABLE_NODE, &show_ipv6_ospf6_border_routers_detail_cmd);
1738
hasso049207c2004-08-04 20:02:13 +00001739#define INSTALL(n,c) \
1740 install_element (n ## _NODE, &show_ipv6_ospf6_ ## c);
1741
1742 INSTALL (VIEW, database_cmd);
1743 INSTALL (VIEW, database_detail_cmd);
1744 INSTALL (VIEW, database_type_cmd);
1745 INSTALL (VIEW, database_type_detail_cmd);
1746 INSTALL (VIEW, database_id_cmd);
1747 INSTALL (VIEW, database_id_detail_cmd);
1748 INSTALL (VIEW, database_linkstate_id_cmd);
1749 INSTALL (VIEW, database_linkstate_id_detail_cmd);
1750 INSTALL (VIEW, database_router_cmd);
1751 INSTALL (VIEW, database_router_detail_cmd);
1752 INSTALL (VIEW, database_adv_router_cmd);
1753 INSTALL (VIEW, database_adv_router_detail_cmd);
1754 INSTALL (VIEW, database_type_id_cmd);
1755 INSTALL (VIEW, database_type_id_detail_cmd);
1756 INSTALL (VIEW, database_type_linkstate_id_cmd);
1757 INSTALL (VIEW, database_type_linkstate_id_detail_cmd);
1758 INSTALL (VIEW, database_type_router_cmd);
1759 INSTALL (VIEW, database_type_router_detail_cmd);
1760 INSTALL (VIEW, database_type_adv_router_cmd);
1761 INSTALL (VIEW, database_type_adv_router_detail_cmd);
1762 INSTALL (VIEW, database_adv_router_linkstate_id_cmd);
1763 INSTALL (VIEW, database_adv_router_linkstate_id_detail_cmd);
1764 INSTALL (VIEW, database_id_router_cmd);
1765 INSTALL (VIEW, database_id_router_detail_cmd);
1766 INSTALL (VIEW, database_type_id_router_cmd);
1767 INSTALL (VIEW, database_type_id_router_detail_cmd);
1768 INSTALL (VIEW, database_type_adv_router_linkstate_id_cmd);
1769 INSTALL (VIEW, database_type_adv_router_linkstate_id_detail_cmd);
1770 INSTALL (VIEW, database_self_originated_cmd);
1771 INSTALL (VIEW, database_self_originated_detail_cmd);
1772 INSTALL (VIEW, database_type_self_originated_cmd);
1773 INSTALL (VIEW, database_type_self_originated_detail_cmd);
1774 INSTALL (VIEW, database_type_id_self_originated_cmd);
1775 INSTALL (VIEW, database_type_id_self_originated_detail_cmd);
1776 INSTALL (VIEW, database_type_self_originated_linkstate_id_cmd);
1777 INSTALL (VIEW, database_type_self_originated_linkstate_id_detail_cmd);
1778 INSTALL (VIEW, database_type_id_self_originated_cmd);
1779 INSTALL (VIEW, database_type_id_self_originated_detail_cmd);
1780
1781 INSTALL (ENABLE, database_cmd);
1782 INSTALL (ENABLE, database_detail_cmd);
1783 INSTALL (ENABLE, database_type_cmd);
1784 INSTALL (ENABLE, database_type_detail_cmd);
1785 INSTALL (ENABLE, database_id_cmd);
1786 INSTALL (ENABLE, database_id_detail_cmd);
1787 INSTALL (ENABLE, database_linkstate_id_cmd);
1788 INSTALL (ENABLE, database_linkstate_id_detail_cmd);
1789 INSTALL (ENABLE, database_router_cmd);
1790 INSTALL (ENABLE, database_router_detail_cmd);
1791 INSTALL (ENABLE, database_adv_router_cmd);
1792 INSTALL (ENABLE, database_adv_router_detail_cmd);
1793 INSTALL (ENABLE, database_type_id_cmd);
1794 INSTALL (ENABLE, database_type_id_detail_cmd);
1795 INSTALL (ENABLE, database_type_linkstate_id_cmd);
1796 INSTALL (ENABLE, database_type_linkstate_id_detail_cmd);
1797 INSTALL (ENABLE, database_type_router_cmd);
1798 INSTALL (ENABLE, database_type_router_detail_cmd);
1799 INSTALL (ENABLE, database_type_adv_router_cmd);
1800 INSTALL (ENABLE, database_type_adv_router_detail_cmd);
1801 INSTALL (ENABLE, database_adv_router_linkstate_id_cmd);
1802 INSTALL (ENABLE, database_adv_router_linkstate_id_detail_cmd);
1803 INSTALL (ENABLE, database_id_router_cmd);
1804 INSTALL (ENABLE, database_id_router_detail_cmd);
1805 INSTALL (ENABLE, database_type_id_router_cmd);
1806 INSTALL (ENABLE, database_type_id_router_detail_cmd);
1807 INSTALL (ENABLE, database_type_adv_router_linkstate_id_cmd);
1808 INSTALL (ENABLE, database_type_adv_router_linkstate_id_detail_cmd);
1809 INSTALL (ENABLE, database_self_originated_cmd);
1810 INSTALL (ENABLE, database_self_originated_detail_cmd);
1811 INSTALL (ENABLE, database_type_self_originated_cmd);
1812 INSTALL (ENABLE, database_type_self_originated_detail_cmd);
1813 INSTALL (ENABLE, database_type_id_self_originated_cmd);
1814 INSTALL (ENABLE, database_type_id_self_originated_detail_cmd);
1815 INSTALL (ENABLE, database_type_self_originated_linkstate_id_cmd);
1816 INSTALL (ENABLE, database_type_self_originated_linkstate_id_detail_cmd);
1817 INSTALL (ENABLE, database_type_id_self_originated_cmd);
1818 INSTALL (ENABLE, database_type_id_self_originated_detail_cmd);
paul718e3742002-12-13 20:15:29 +00001819
1820 ospf6_top_init ();
1821 ospf6_area_init ();
1822 ospf6_interface_init ();
1823 ospf6_neighbor_init ();
1824 ospf6_zebra_init ();
1825
hasso508e53e2004-05-18 18:57:06 +00001826 ospf6_lsa_init ();
paul718e3742002-12-13 20:15:29 +00001827 ospf6_spf_init ();
paul718e3742002-12-13 20:15:29 +00001828 ospf6_intra_init ();
paul718e3742002-12-13 20:15:29 +00001829 ospf6_asbr_init ();
hasso049207c2004-08-04 20:02:13 +00001830 ospf6_abr_init ();
hasso508e53e2004-05-18 18:57:06 +00001831
1832 /* Make ospf protocol socket. */
1833 ospf6_serv_sock ();
1834 thread_add_read (master, ospf6_receive, NULL, ospf6_sock);
paul718e3742002-12-13 20:15:29 +00001835}
1836
paul718e3742002-12-13 20:15:29 +00001837