diff options
Diffstat (limited to 'ospf6d/ospf6d.c')
| -rw-r--r-- | ospf6d/ospf6d.c | 1053 | 
1 files changed, 664 insertions, 389 deletions
diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index ab8adce2ee..da8c695f65 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -389,161 +389,190 @@ static void ospf6_lsdb_type_show_wrapper(struct vty *vty,  		vty_out(vty, "\n");  } -DEFUN (show_ipv6_ospf6_database, -       show_ipv6_ospf6_database_cmd, -       "show ipv6 ospf6 database [<detail|dump|internal>] [json]", -       SHOW_STR -       IPV6_STR -       OSPF6_STR -       "Display Link state database\n" -       "Display details of LSAs\n" -       "Dump LSAs\n" -       "Display LSA's internal information\n" -        JSON_STR) +DEFUN(show_ipv6_ospf6_database, show_ipv6_ospf6_database_cmd, +      "show ipv6 ospf6 [vrf <NAME|all>] database [<detail|dump|internal>] [json]", +      SHOW_STR IPV6_STR OSPF6_STR VRF_CMD_HELP_STR +      "All VRFs\n" +      "Display Link state database\n" +      "Display details of LSAs\n" +      "Dump LSAs\n" +      "Display LSA's internal information\n" JSON_STR)  { -	int idx_level = 4;  	int level; -	bool uj = use_json(argc, argv); +	int idx_level = 4; +	struct listnode *node;  	struct ospf6 *ospf6; +	const char *vrf_name = NULL; +	bool all_vrf = false; +	int idx_vrf = 0; +	bool uj = use_json(argc, argv); -	ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); -	OSPF6_CMD_CHECK_RUNNING(ospf6); +	OSPF6_CMD_CHECK_RUNNING(); +	OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); +	if (idx_vrf > 0) +		idx_level += 2;  	level = parse_show_level(idx_level, argc, argv); -	ospf6_lsdb_show_wrapper(vty, level, NULL, NULL, NULL, uj, ospf6); +	for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) { +		if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) { +			ospf6_lsdb_show_wrapper(vty, level, NULL, NULL, NULL, +						uj, ospf6); +			if (!all_vrf) +				break; +		} +	} +  	return CMD_SUCCESS;  } -DEFUN (show_ipv6_ospf6_database_type, show_ipv6_ospf6_database_type_cmd, -       "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> [<detail|dump|internal>] [json]", -       SHOW_STR -       IPV6_STR -       OSPF6_STR -       "Display Link state database\n" -       "Display Router LSAs\n" -       "Display Network LSAs\n" -       "Display Inter-Area-Prefix LSAs\n" -       "Display Inter-Area-Router LSAs\n" -       "Display As-External LSAs\n" -       "Display Group-Membership LSAs\n" -       "Display Type-7 LSAs\n" -       "Display Link LSAs\n" -       "Display Intra-Area-Prefix LSAs\n" -       "Display details of LSAs\n" -       "Dump LSAs\n" -       "Display LSA's internal information\n" -       JSON_STR) +DEFUN(show_ipv6_ospf6_database_type, show_ipv6_ospf6_database_type_cmd, +      "show ipv6 ospf6 [vrf <NAME|all>] database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> [<detail|dump|internal>] [json]", +      SHOW_STR IPV6_STR OSPF6_STR VRF_CMD_HELP_STR +      "All VRFs\n" +      "Display Link state database\n" +      "Display Router LSAs\n" +      "Display Network LSAs\n" +      "Display Inter-Area-Prefix LSAs\n" +      "Display Inter-Area-Router LSAs\n" +      "Display As-External LSAs\n" +      "Display Group-Membership LSAs\n" +      "Display Type-7 LSAs\n" +      "Display Link LSAs\n" +      "Display Intra-Area-Prefix LSAs\n" +      "Display details of LSAs\n" +      "Dump LSAs\n" +      "Display LSA's internal information\n" JSON_STR)  {  	int idx_lsa = 4;  	int idx_level = 5;  	int level; -	uint16_t type = 0;  	bool uj = use_json(argc, argv); +	struct listnode *node;  	struct ospf6 *ospf6; - - -	ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); -	OSPF6_CMD_CHECK_RUNNING(ospf6); +	uint16_t type = 0; +	const char *vrf_name = NULL; +	bool all_vrf = false; +	int idx_vrf = 0; + +	OSPF6_CMD_CHECK_RUNNING(); +	OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); +	if (idx_vrf > 0) { +		idx_lsa += 2; +		idx_level += 2; +	}  	type = parse_type_spec(idx_lsa, argc, argv);  	level = parse_show_level(idx_level, argc, argv); -	ospf6_lsdb_type_show_wrapper(vty, level, &type, NULL, NULL, uj, ospf6); +	for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) { +		if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) { +			ospf6_lsdb_type_show_wrapper(vty, level, &type, NULL, +						     NULL, uj, ospf6); +			if (!all_vrf) +				break; +		} +	} +  	return CMD_SUCCESS;  } -DEFUN (show_ipv6_ospf6_database_id, -       show_ipv6_ospf6_database_id_cmd, -       "show ipv6 ospf6 database <*|linkstate-id> A.B.C.D [<detail|dump|internal>] [json]", -       SHOW_STR -       IPV6_STR -       OSPF6_STR -       "Display Link state database\n" -       "Any Link state Type\n" -       "Search by Link state ID\n" -       "Specify Link state ID as IPv4 address notation\n" -       "Display details of LSAs\n" -       "Dump LSAs\n" -       "Display LSA's internal information\n" -       JSON_STR) +DEFUN(show_ipv6_ospf6_database_id, show_ipv6_ospf6_database_id_cmd, +      "show ipv6 ospf6 [vrf <NAME|all>] database <*|linkstate-id> A.B.C.D [<detail|dump|internal>] [json]", +      SHOW_STR IPV6_STR OSPF6_STR VRF_CMD_HELP_STR +      "All VRFs\n" +      "Display Link state database\n" +      "Any Link state Type\n" +      "Search by Link state ID\n" +      "Specify Link state ID as IPv4 address notation\n" +      "Display details of LSAs\n" +      "Dump LSAs\n" +      "Display LSA's internal information\n" JSON_STR)  {  	int idx_ipv4 = 5;  	int idx_level = 6;  	int level; -	uint32_t id = 0;  	bool uj = use_json(argc, argv); +	struct listnode *node;  	struct ospf6 *ospf6; +	uint32_t id = 0; +	const char *vrf_name = NULL; +	bool all_vrf = false; +	int idx_vrf = 0; - -	ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); -	OSPF6_CMD_CHECK_RUNNING(ospf6); - +	OSPF6_CMD_CHECK_RUNNING(); +	OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);  	if (argv[idx_ipv4]->type == IPV4_TKN)  		inet_pton(AF_INET, argv[idx_ipv4]->arg, &id);  	level = parse_show_level(idx_level, argc, argv); -	ospf6_lsdb_show_wrapper(vty, level, NULL, &id, NULL, uj, ospf6); + +	for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) { +		if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) { +			ospf6_lsdb_show_wrapper(vty, level, NULL, &id, NULL, uj, +						ospf6); +			if (!all_vrf) +				break; +		} +	}  	return CMD_SUCCESS;  } -DEFUN (show_ipv6_ospf6_database_router, -       show_ipv6_ospf6_database_router_cmd, -       "show ipv6 ospf6 database <*|adv-router> * A.B.C.D <detail|dump|internal> [json]", -       SHOW_STR -       IPV6_STR -       OSPF6_STR -       "Display Link state database\n" -       "Any Link state Type\n" -       "Search by Advertising Router\n" -       "Any Link state ID\n" -       "Specify Advertising Router as IPv4 address notation\n" -       "Display details of LSAs\n" -       "Dump LSAs\n" -       "Display LSA's internal information\n" -       JSON_STR) +DEFUN(show_ipv6_ospf6_database_router, show_ipv6_ospf6_database_router_cmd, +      "show ipv6 ospf6 [vrf <NAME|all>] database <*|adv-router> * A.B.C.D <detail|dump|internal> [json]", +      SHOW_STR IPV6_STR OSPF6_STR VRF_CMD_HELP_STR +      "All VRFs\n" +      "Display Link state database\n" +      "Any Link state Type\n" +      "Search by Advertising Router\n" +      "Any Link state ID\n" +      "Specify Advertising Router as IPv4 address notation\n" +      "Display details of LSAs\n" +      "Dump LSAs\n" +      "Display LSA's internal information\n" JSON_STR)  {  	int idx_ipv4 = 6;  	int idx_level = 7;  	int level; +	struct listnode *node; +	struct ospf6 *ospf6;  	uint32_t adv_router = 0; +	const char *vrf_name = NULL; +	bool all_vrf = false; +	int idx_vrf = 0;  	bool uj = use_json(argc, argv); -	struct ospf6 *ospf6; +	OSPF6_CMD_CHECK_RUNNING(); +	OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); +	if (idx_vrf > 0) { +		idx_ipv4 += 2; +		idx_level += 2; +	} -	ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); -	OSPF6_CMD_CHECK_RUNNING(ospf6);  	inet_pton(AF_INET, argv[idx_ipv4]->arg, &adv_router);  	level = parse_show_level(idx_level, argc, argv); -	ospf6_lsdb_show_wrapper(vty, level, NULL, NULL, &adv_router, uj, ospf6); +	for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) { +		if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) { +			ospf6_lsdb_show_wrapper(vty, level, NULL, NULL, +						&adv_router, uj, ospf6); +			if (!all_vrf) +				break; +		} +	} +  	return CMD_SUCCESS;  } -DEFUN_HIDDEN (show_ipv6_ospf6_database_aggr_router, -       show_ipv6_ospf6_database_aggr_router_cmd, -       "show ipv6 ospf6 database aggr adv-router A.B.C.D", -       SHOW_STR -       IPV6_STR -       OSPF6_STR -       "Display Link state database\n" -       "Aggregated Router LSA\n" -       "Search by Advertising Router\n" -       "Specify Advertising Router as IPv4 address notation\n") +static int ipv6_ospf6_database_aggr_router_common(struct vty *vty, +						  uint32_t adv_router, +						  struct ospf6 *ospf6)  {  	int level = OSPF6_LSDB_SHOW_LEVEL_DETAIL;  	uint16_t type = htons(OSPF6_LSTYPE_ROUTER); -	int idx_ipv4 = 6;  	struct listnode *i; -	struct ospf6 *ospf6;  	struct ospf6_area *oa;  	struct ospf6_lsdb *lsdb; -	uint32_t adv_router = 0; - -	ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); -	OSPF6_CMD_CHECK_RUNNING(ospf6); - -	inet_pton(AF_INET, argv[idx_ipv4]->arg, &adv_router);  	for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) {  		if (adv_router == ospf6->router_id) @@ -562,225 +591,338 @@ DEFUN_HIDDEN (show_ipv6_ospf6_database_aggr_router,  	}  	vty_out(vty, "\n"); +	return CMD_SUCCESS; +} + +DEFUN_HIDDEN( +	show_ipv6_ospf6_database_aggr_router, +	show_ipv6_ospf6_database_aggr_router_cmd, +	"show ipv6 ospf6 [vrf <NAME|all>] database aggr adv-router A.B.C.D", +	SHOW_STR IPV6_STR OSPF6_STR VRF_CMD_HELP_STR +	"All VRFs\n" +	"Display Link state database\n" +	"Aggregated Router LSA\n" +	"Search by Advertising Router\n" +	"Specify Advertising Router as IPv4 address notation\n") +{ +	int idx_ipv4 = 6; +	struct listnode *node; +	struct ospf6 *ospf6; +	uint32_t adv_router = 0; +	const char *vrf_name = NULL; +	bool all_vrf = false; +	int idx_vrf = 0; + +	OSPF6_CMD_CHECK_RUNNING(); +	OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); +	if (idx_vrf > 0) +		idx_ipv4 += 2; + +	inet_pton(AF_INET, argv[idx_ipv4]->arg, &adv_router); + +	for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) { +		if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) { +			ipv6_ospf6_database_aggr_router_common(vty, adv_router, +							       ospf6); + +			if (!all_vrf) +				break; +		} +	}  	return CMD_SUCCESS;  } -DEFUN (show_ipv6_ospf6_database_type_id, -       show_ipv6_ospf6_database_type_id_cmd, -       "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> linkstate-id A.B.C.D [<detail|dump|internal>] [json]", -       SHOW_STR -       IPV6_STR -       OSPF6_STR -       "Display Link state database\n" -       "Display Router LSAs\n" -       "Display Network LSAs\n" -       "Display Inter-Area-Prefix LSAs\n" -       "Display Inter-Area-Router LSAs\n" -       "Display As-External LSAs\n" -       "Display Group-Membership LSAs\n" -       "Display Type-7 LSAs\n" -       "Display Link LSAs\n" -       "Display Intra-Area-Prefix LSAs\n" -       "Search by Link state ID\n" -       "Specify Link state ID as IPv4 address notation\n" -       "Display details of LSAs\n" -       "Dump LSAs\n" -       "Display LSA's internal information\n" -       JSON_STR) +DEFUN(show_ipv6_ospf6_database_type_id, show_ipv6_ospf6_database_type_id_cmd, +      "show ipv6 ospf6 [vrf <NAME|all>] database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> linkstate-id A.B.C.D [<detail|dump|internal>] [json]", +      SHOW_STR IPV6_STR OSPF6_STR VRF_CMD_HELP_STR +      "All VRFs\n" +      "Display Link state database\n" +      "Display Router LSAs\n" +      "Display Network LSAs\n" +      "Display Inter-Area-Prefix LSAs\n" +      "Display Inter-Area-Router LSAs\n" +      "Display As-External LSAs\n" +      "Display Group-Membership LSAs\n" +      "Display Type-7 LSAs\n" +      "Display Link LSAs\n" +      "Display Intra-Area-Prefix LSAs\n" +      "Search by Link state ID\n" +      "Specify Link state ID as IPv4 address notation\n" +      "Display details of LSAs\n" +      "Dump LSAs\n" +      "Display LSA's internal information\n" JSON_STR)  {  	int idx_lsa = 4;  	int idx_ipv4 = 6;  	int idx_level = 7;  	int level; -	uint16_t type = 0; -	uint32_t id = 0;  	bool uj = use_json(argc, argv); +	struct listnode *node;  	struct ospf6 *ospf6; - - -	ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); -	OSPF6_CMD_CHECK_RUNNING(ospf6); +	uint16_t type = 0; +	uint32_t id = 0; +	const char *vrf_name = NULL; +	bool all_vrf = false; +	int idx_vrf = 0; + +	OSPF6_CMD_CHECK_RUNNING(); +	OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); +	if (idx_vrf > 0) { +		idx_lsa += 2; +		idx_ipv4 += 2; +		idx_level += 2; +	}  	type = parse_type_spec(idx_lsa, argc, argv);  	inet_pton(AF_INET, argv[idx_ipv4]->arg, &id);  	level = parse_show_level(idx_level, argc, argv); -	ospf6_lsdb_type_show_wrapper(vty, level, &type, &id, NULL, uj, ospf6); +	for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) { +		if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) { +			ospf6_lsdb_type_show_wrapper(vty, level, &type, &id, +						     NULL, uj, ospf6); +			if (!all_vrf) +				break; +		} +	} +  	return CMD_SUCCESS;  } -DEFUN (show_ipv6_ospf6_database_type_router, -       show_ipv6_ospf6_database_type_router_cmd, -       "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> <*|adv-router> A.B.C.D [<detail|dump|internal>] [json]", -       SHOW_STR -       IPV6_STR -       OSPF6_STR -       "Display Link state database\n" -       "Display Router LSAs\n" -       "Display Network LSAs\n" -       "Display Inter-Area-Prefix LSAs\n" -       "Display Inter-Area-Router LSAs\n" -       "Display As-External LSAs\n" -       "Display Group-Membership LSAs\n" -       "Display Type-7 LSAs\n" -       "Display Link LSAs\n" -       "Display Intra-Area-Prefix LSAs\n" -       "Any Link state ID\n" -       "Search by Advertising Router\n" -       "Specify Advertising Router as IPv4 address notation\n" -       "Display details of LSAs\n" -       "Dump LSAs\n" -       "Display LSA's internal information\n" -       JSON_STR) +DEFUN(show_ipv6_ospf6_database_type_router, +      show_ipv6_ospf6_database_type_router_cmd, +      "show ipv6 ospf6 [vrf <NAME|all>] database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> <*|adv-router> A.B.C.D [<detail|dump|internal>] [json]", +      SHOW_STR IPV6_STR OSPF6_STR VRF_CMD_HELP_STR +      "All VRFs\n" +      "Display Link state database\n" +      "Display Router LSAs\n" +      "Display Network LSAs\n" +      "Display Inter-Area-Prefix LSAs\n" +      "Display Inter-Area-Router LSAs\n" +      "Display As-External LSAs\n" +      "Display Group-Membership LSAs\n" +      "Display Type-7 LSAs\n" +      "Display Link LSAs\n" +      "Display Intra-Area-Prefix LSAs\n" +      "Any Link state ID\n" +      "Search by Advertising Router\n" +      "Specify Advertising Router as IPv4 address notation\n" +      "Display details of LSAs\n" +      "Dump LSAs\n" +      "Display LSA's internal information\n" JSON_STR)  {  	int idx_lsa = 4;  	int idx_ipv4 = 6;  	int idx_level = 7;  	int level; -	uint16_t type = 0; -	uint32_t adv_router = 0;  	bool uj = use_json(argc, argv); +	struct listnode *node;  	struct ospf6 *ospf6; +	uint16_t type = 0; +	uint32_t adv_router = 0; +	const char *vrf_name = NULL; +	bool all_vrf = false; +	int idx_vrf = 0; + +	OSPF6_CMD_CHECK_RUNNING(); +	OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); +	if (idx_vrf > 0) { +		idx_lsa += 2; +		idx_ipv4 += 2; +		idx_level += 2; +	} - -	ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); -	OSPF6_CMD_CHECK_RUNNING(ospf6);  	type = parse_type_spec(idx_lsa, argc, argv);  	inet_pton(AF_INET, argv[idx_ipv4]->arg, &adv_router);  	level = parse_show_level(idx_level, argc, argv); -	ospf6_lsdb_type_show_wrapper(vty, level, &type, NULL, &adv_router, uj, -				     ospf6); +	for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) { +		if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) { +			ospf6_lsdb_type_show_wrapper(vty, level, &type, NULL, +						     &adv_router, uj, ospf6); + +			if (!all_vrf) +				break; +		} +	} +  	return CMD_SUCCESS;  } - -DEFUN (show_ipv6_ospf6_database_id_router, -       show_ipv6_ospf6_database_id_router_cmd, -       "show ipv6 ospf6 database * A.B.C.D A.B.C.D [<detail|dump|internal>] [json]", -       SHOW_STR -       IPV6_STR -       OSPF6_STR -       "Display Link state database\n" -       "Any Link state Type\n" -       "Specify Link state ID as IPv4 address notation\n" -       "Specify Advertising Router as IPv4 address notation\n" -       "Display details of LSAs\n" -       "Dump LSAs\n" -       "Display LSA's internal information\n" -       JSON_STR) +DEFUN(show_ipv6_ospf6_database_id_router, +      show_ipv6_ospf6_database_id_router_cmd, +      "show ipv6 ospf6 [vrf <NAME|all>] database * A.B.C.D A.B.C.D [<detail|dump|internal>] [json]", +      SHOW_STR IPV6_STR OSPF6_STR VRF_CMD_HELP_STR +      "All VRFs\n" +      "Display Link state database\n" +      "Any Link state Type\n" +      "Specify Link state ID as IPv4 address notation\n" +      "Specify Advertising Router as IPv4 address notation\n" +      "Display details of LSAs\n" +      "Dump LSAs\n" +      "Display LSA's internal information\n" JSON_STR)  {  	int idx_ls_id = 5;  	int idx_adv_rtr = 6;  	int idx_level = 7;  	int level; -	uint32_t id = 0; -	uint32_t adv_router = 0;  	bool uj = use_json(argc, argv); +	struct listnode *node;  	struct ospf6 *ospf6; +	uint32_t id = 0; +	uint32_t adv_router = 0; +	const char *vrf_name = NULL; +	bool all_vrf = false; +	int idx_vrf = 0; + +	OSPF6_CMD_CHECK_RUNNING(); +	OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); +	if (idx_vrf > 0) { +		idx_ls_id += 2; +		idx_adv_rtr += 2; +		idx_level += 2; +	} -	ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); -	OSPF6_CMD_CHECK_RUNNING(ospf6);  	inet_pton(AF_INET, argv[idx_ls_id]->arg, &id);  	inet_pton(AF_INET, argv[idx_adv_rtr]->arg, &adv_router);  	level = parse_show_level(idx_level, argc, argv); -	ospf6_lsdb_show_wrapper(vty, level, NULL, &id, &adv_router, uj, ospf6); +	for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) { +		if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) { +			ospf6_lsdb_show_wrapper(vty, level, NULL, &id, +						&adv_router, uj, ospf6); +			if (!all_vrf) +				break; +		} +	} +  	return CMD_SUCCESS;  } - -DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id, -       show_ipv6_ospf6_database_adv_router_linkstate_id_cmd, -       "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D [<detail|dump|internal>] [json]", -       SHOW_STR -       IPV6_STR -       OSPF6_STR -       "Display Link state database\n" -       "Search by Advertising Router\n" -       "Specify Advertising Router as IPv4 address notation\n" -       "Search by Link state ID\n" -       "Specify Link state ID as IPv4 address notation\n" -       "Display details of LSAs\n" -       "Dump LSAs\n" -       "Display LSA's internal information\n" -       JSON_STR) +DEFUN(show_ipv6_ospf6_database_adv_router_linkstate_id, +      show_ipv6_ospf6_database_adv_router_linkstate_id_cmd, +      "show ipv6 ospf6 [vrf <NAME|all>] database adv-router A.B.C.D linkstate-id A.B.C.D [<detail|dump|internal>] [json]", +      SHOW_STR IPV6_STR OSPF6_STR VRF_CMD_HELP_STR +      "All VRFs\n" +      "Display Link state database\n" +      "Search by Advertising Router\n" +      "Specify Advertising Router as IPv4 address notation\n" +      "Search by Link state ID\n" +      "Specify Link state ID as IPv4 address notation\n" +      "Display details of LSAs\n" +      "Dump LSAs\n" +      "Display LSA's internal information\n" JSON_STR)  {  	int idx_adv_rtr = 5;  	int idx_ls_id = 7;  	int idx_level = 8;  	int level; -	uint32_t id = 0; -	uint32_t adv_router = 0;  	bool uj = use_json(argc, argv); +	struct listnode *node;  	struct ospf6 *ospf6; +	uint32_t id = 0; +	uint32_t adv_router = 0; +	const char *vrf_name = NULL; +	bool all_vrf = false; +	int idx_vrf = 0; -	ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); -	OSPF6_CMD_CHECK_RUNNING(ospf6); +	OSPF6_CMD_CHECK_RUNNING(); +	OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); +	if (idx_vrf > 0) { +		idx_adv_rtr += 2; +		idx_ls_id += 2; +		idx_level += 2; +	}  	inet_pton(AF_INET, argv[idx_adv_rtr]->arg, &adv_router);  	inet_pton(AF_INET, argv[idx_ls_id]->arg, &id);  	level = parse_show_level(idx_level, argc, argv); -	ospf6_lsdb_show_wrapper(vty, level, NULL, &id, &adv_router, uj, ospf6); +	for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) { +		if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) { +			ospf6_lsdb_type_show_wrapper(vty, level, NULL, &id, +						     &adv_router, uj, ospf6); + +			if (!all_vrf) +				break; +		} +	} +  	return CMD_SUCCESS;  } -DEFUN (show_ipv6_ospf6_database_type_id_router, -       show_ipv6_ospf6_database_type_id_router_cmd, -       "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> A.B.C.D A.B.C.D [<dump|internal>] [json]", -       SHOW_STR -       IPV6_STR -       OSPF6_STR -       "Display Link state database\n" -       "Display Router LSAs\n" -       "Display Network LSAs\n" -       "Display Inter-Area-Prefix LSAs\n" -       "Display Inter-Area-Router LSAs\n" -       "Display As-External LSAs\n" -       "Display Group-Membership LSAs\n" -       "Display Type-7 LSAs\n" -       "Display Link LSAs\n" -       "Display Intra-Area-Prefix LSAs\n" -       "Specify Link state ID as IPv4 address notation\n" -       "Specify Advertising Router as IPv4 address notation\n" -       "Dump LSAs\n" -       "Display LSA's internal information\n" -       JSON_STR) +DEFUN(show_ipv6_ospf6_database_type_id_router, +      show_ipv6_ospf6_database_type_id_router_cmd, +      "show ipv6 ospf6 [vrf <NAME|all>] database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> A.B.C.D A.B.C.D [<dump|internal>] [json]", +      SHOW_STR IPV6_STR OSPF6_STR VRF_CMD_HELP_STR +      "All VRFs\n" +      "Display Link state database\n" +      "Display Router LSAs\n" +      "Display Network LSAs\n" +      "Display Inter-Area-Prefix LSAs\n" +      "Display Inter-Area-Router LSAs\n" +      "Display As-External LSAs\n" +      "Display Group-Membership LSAs\n" +      "Display Type-7 LSAs\n" +      "Display Link LSAs\n" +      "Display Intra-Area-Prefix LSAs\n" +      "Specify Link state ID as IPv4 address notation\n" +      "Specify Advertising Router as IPv4 address notation\n" +      "Dump LSAs\n" +      "Display LSA's internal information\n" JSON_STR)  {  	int idx_lsa = 4;  	int idx_ls_id = 5;  	int idx_adv_rtr = 6;  	int idx_level = 7;  	int level; +	bool uj = use_json(argc, argv); +	struct listnode *node; +	struct ospf6 *ospf6;  	uint16_t type = 0;  	uint32_t id = 0;  	uint32_t adv_router = 0; -	bool uj = use_json(argc, argv); -	struct ospf6 *ospf6; - - -	ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); -	OSPF6_CMD_CHECK_RUNNING(ospf6); +	const char *vrf_name = NULL; +	bool all_vrf = false; +	int idx_vrf = 0; + +	OSPF6_CMD_CHECK_RUNNING(); +	OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); +	if (idx_vrf > 0) { +		idx_lsa += 2; +		idx_ls_id += 2; +		idx_adv_rtr += 2; +		idx_level += 2; +	}  	type = parse_type_spec(idx_lsa, argc, argv);  	inet_pton(AF_INET, argv[idx_ls_id]->arg, &id);  	inet_pton(AF_INET, argv[idx_adv_rtr]->arg, &adv_router);  	level = parse_show_level(idx_level, argc, argv); -	ospf6_lsdb_type_show_wrapper(vty, level, &type, &id, &adv_router, uj, -				     ospf6); +	for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) { +		if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) { +			ospf6_lsdb_type_show_wrapper(vty, level, &type, &id, +						     &adv_router, uj, ospf6); + +			if (!all_vrf) +				break; +		} +	} +  	return CMD_SUCCESS;  }  DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id,         show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd, -       "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> adv-router A.B.C.D linkstate-id A.B.C.D [<dump|internal>] [json]", +       "show ipv6 ospf6 [vrf <NAME|all>] database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> adv-router A.B.C.D linkstate-id A.B.C.D [<dump|internal>] [json]",         SHOW_STR         IPV6_STR         OSPF6_STR +       VRF_CMD_HELP_STR +       "All VRFs\n"         "Display Link state database\n"         "Display Router LSAs\n"         "Display Network LSAs\n" @@ -804,208 +946,278 @@ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id,  	int idx_ls_id = 8;  	int idx_level = 9;  	int level; +	bool uj = use_json(argc, argv); +	struct listnode *node; +	struct ospf6 *ospf6;  	uint16_t type = 0;  	uint32_t id = 0;  	uint32_t adv_router = 0; -	bool uj = use_json(argc, argv); -	struct ospf6 *ospf6; - - -	ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); -	OSPF6_CMD_CHECK_RUNNING(ospf6); +	const char *vrf_name = NULL; +	bool all_vrf = false; +	int idx_vrf = 0; + +	OSPF6_CMD_CHECK_RUNNING(); +	OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); +	if (idx_vrf > 0) { +		idx_lsa += 2; +		idx_adv_rtr += 2; +		idx_ls_id += 2; +		idx_level += 2; +	}  	type = parse_type_spec(idx_lsa, argc, argv);  	inet_pton(AF_INET, argv[idx_adv_rtr]->arg, &adv_router);  	inet_pton(AF_INET, argv[idx_ls_id]->arg, &id);  	level = parse_show_level(idx_level, argc, argv); -	ospf6_lsdb_type_show_wrapper(vty, level, &type, &id, &adv_router, uj, -				     ospf6); +	for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) { +		if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) { +			ospf6_lsdb_type_show_wrapper(vty, level, &type, &id, +						     &adv_router, uj, ospf6); + +			if (!all_vrf) +				break; +		} +	} +  	return CMD_SUCCESS;  } -DEFUN (show_ipv6_ospf6_database_self_originated, -       show_ipv6_ospf6_database_self_originated_cmd, -       "show ipv6 ospf6 database self-originated [<detail|dump|internal>] [json]", -       SHOW_STR -       IPV6_STR -       OSPF6_STR -       "Display Link state database\n" -       "Display Self-originated LSAs\n" -       "Display details of LSAs\n" -       "Dump LSAs\n" -       "Display LSA's internal information\n" -       JSON_STR) +DEFUN(show_ipv6_ospf6_database_self_originated, +      show_ipv6_ospf6_database_self_originated_cmd, +      "show ipv6 ospf6 [vrf <NAME|all>] database self-originated [<detail|dump|internal>] [json]", +      SHOW_STR IPV6_STR OSPF6_STR VRF_CMD_HELP_STR +      "All VRFs\n" +      "Display Link state database\n" +      "Display Self-originated LSAs\n" +      "Display details of LSAs\n" +      "Dump LSAs\n" +      "Display LSA's internal information\n" JSON_STR)  {  	int idx_level = 5;  	int level; +	struct listnode *node; +	struct ospf6 *ospf6; +	const char *vrf_name = NULL; +	bool all_vrf = false; +	int idx_vrf = 0;  	uint32_t adv_router = 0;  	bool uj = use_json(argc, argv); -	struct ospf6 *ospf6; -	ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); -	OSPF6_CMD_CHECK_RUNNING(ospf6); +	OSPF6_CMD_CHECK_RUNNING(); +	OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); +	if (idx_vrf > 0) +		idx_level += 2; +  	level = parse_show_level(idx_level, argc, argv); -	adv_router = ospf6->router_id; -	ospf6_lsdb_show_wrapper(vty, level, NULL, NULL, &adv_router, uj, ospf6); +	for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) { +		adv_router = ospf6->router_id; +		if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) { +			ospf6_lsdb_show_wrapper(vty, level, NULL, NULL, +						&adv_router, uj, ospf6); + +			if (!all_vrf) +				break; +		} +	} +  	return CMD_SUCCESS;  } -DEFUN (show_ipv6_ospf6_database_type_self_originated, -       show_ipv6_ospf6_database_type_self_originated_cmd, -       "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated [<detail|dump|internal>] [json]", -       SHOW_STR -       IPV6_STR -       OSPF6_STR -       "Display Link state database\n" -       "Display Router LSAs\n" -       "Display Network LSAs\n" -       "Display Inter-Area-Prefix LSAs\n" -       "Display Inter-Area-Router LSAs\n" -       "Display As-External LSAs\n" -       "Display Group-Membership LSAs\n" -       "Display Type-7 LSAs\n" -       "Display Link LSAs\n" -       "Display Intra-Area-Prefix LSAs\n" -       "Display Self-originated LSAs\n" -       "Display details of LSAs\n" -       "Dump LSAs\n" -       "Display LSA's internal information\n" -       JSON_STR) +DEFUN(show_ipv6_ospf6_database_type_self_originated, +      show_ipv6_ospf6_database_type_self_originated_cmd, +      "show ipv6 ospf6 [vrf <NAME|all>] database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated [<detail|dump|internal>]  [json]", +      SHOW_STR IPV6_STR OSPF6_STR VRF_CMD_HELP_STR +      "All VRFs\n" +      "Display Link state database\n" +      "Display Router LSAs\n" +      "Display Network LSAs\n" +      "Display Inter-Area-Prefix LSAs\n" +      "Display Inter-Area-Router LSAs\n" +      "Display As-External LSAs\n" +      "Display Group-Membership LSAs\n" +      "Display Type-7 LSAs\n" +      "Display Link LSAs\n" +      "Display Intra-Area-Prefix LSAs\n" +      "Display Self-originated LSAs\n" +      "Display details of LSAs\n" +      "Dump LSAs\n" +      "Display LSA's internal information\n" JSON_STR)  {  	int idx_lsa = 4;  	int idx_level = 6;  	int level; +	struct listnode *node; +	struct ospf6 *ospf6;  	uint16_t type = 0;  	uint32_t adv_router = 0;  	bool uj = use_json(argc, argv); -	struct ospf6 *ospf6; -	ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); -	OSPF6_CMD_CHECK_RUNNING(ospf6); +	const char *vrf_name = NULL; +	bool all_vrf = false; +	int idx_vrf = 0; + +	OSPF6_CMD_CHECK_RUNNING(); +	OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); +	if (idx_vrf > 0) { +		idx_lsa += 2; +		idx_level += 2; +	} +  	type = parse_type_spec(idx_lsa, argc, argv);  	level = parse_show_level(idx_level, argc, argv); -	adv_router = ospf6->router_id; +	for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) { +		if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) { +			adv_router = ospf6->router_id; +			ospf6_lsdb_type_show_wrapper(vty, level, &type, NULL, +						     &adv_router, uj, ospf6); + +			if (!all_vrf) +				break; +		} +	} -	ospf6_lsdb_type_show_wrapper(vty, level, &type, NULL, &adv_router, uj, -				     ospf6);  	return CMD_SUCCESS;  } -DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, -       show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd, -       "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated linkstate-id A.B.C.D [<detail|dump|internal>] [json]", -       SHOW_STR -       IPV6_STR -       OSPF6_STR -       "Display Link state database\n" -       "Display Router LSAs\n" -       "Display Network LSAs\n" -       "Display Inter-Area-Prefix LSAs\n" -       "Display Inter-Area-Router LSAs\n" -       "Display As-External LSAs\n" -       "Display Group-Membership LSAs\n" -       "Display Type-7 LSAs\n" -       "Display Link LSAs\n" -       "Display Intra-Area-Prefix LSAs\n" -       "Display Self-originated LSAs\n" -       "Search by Link state ID\n" -       "Specify Link state ID as IPv4 address notation\n" -       "Display details of LSAs\n" -       "Dump LSAs\n" -       "Display LSA's internal information\n" -       JSON_STR) +DEFUN(show_ipv6_ospf6_database_type_self_originated_linkstate_id, +      show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd, +      "show ipv6 ospf6 [vrf <NAME|all>] database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated linkstate-id A.B.C.D [<detail|dump|internal>] [json]", +      SHOW_STR IPV6_STR OSPF6_STR VRF_CMD_HELP_STR +      "All VRFs\n" +      "Display Link state database\n" +      "Display Router LSAs\n" +      "Display Network LSAs\n" +      "Display Inter-Area-Prefix LSAs\n" +      "Display Inter-Area-Router LSAs\n" +      "Display As-External LSAs\n" +      "Display Group-Membership LSAs\n" +      "Display Type-7 LSAs\n" +      "Display Link LSAs\n" +      "Display Intra-Area-Prefix LSAs\n" +      "Display Self-originated LSAs\n" +      "Search by Link state ID\n" +      "Specify Link state ID as IPv4 address notation\n" +      "Display details of LSAs\n" +      "Dump LSAs\n" +      "Display LSA's internal information\n" JSON_STR)  {  	int idx_lsa = 4;  	int idx_ls_id = 7;  	int idx_level = 8;  	int level; +	bool uj = use_json(argc, argv); +	struct listnode *node; +	struct ospf6 *ospf6;  	uint16_t type = 0;  	uint32_t adv_router = 0;  	uint32_t id = 0; -	bool uj = use_json(argc, argv); -	struct ospf6 *ospf6; +	const char *vrf_name = NULL; +	bool all_vrf = false; +	int idx_vrf = 0; + +	OSPF6_CMD_CHECK_RUNNING(); +	OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); +	if (idx_vrf > 0) { +		idx_lsa += 2; +		idx_ls_id += 2; +		idx_level += 2; +	} + -	ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); -	OSPF6_CMD_CHECK_RUNNING(ospf6);  	type = parse_type_spec(idx_lsa, argc, argv);  	inet_pton(AF_INET, argv[idx_ls_id]->arg, &id);  	level = parse_show_level(idx_level, argc, argv); -	adv_router = ospf6->router_id; -	ospf6_lsdb_type_show_wrapper(vty, level, &type, &id, &adv_router, uj, -				     ospf6); +	for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) { +		if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) { +			adv_router = ospf6->router_id; +			ospf6_lsdb_type_show_wrapper(vty, level, &type, &id, +						     &adv_router, uj, ospf6); + +			if (!all_vrf) +				break; +		} +	} +  	return CMD_SUCCESS;  } -DEFUN (show_ipv6_ospf6_database_type_id_self_originated, -       show_ipv6_ospf6_database_type_id_self_originated_cmd, -       "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> A.B.C.D self-originated [<detail|dump|internal>] [json]", -       SHOW_STR -       IPV6_STR -       OSPF6_STR -       "Display Link state database\n" -       "Display Router LSAs\n" -       "Display Network LSAs\n" -       "Display Inter-Area-Prefix LSAs\n" -       "Display Inter-Area-Router LSAs\n" -       "Display As-External LSAs\n" -       "Display Group-Membership LSAs\n" -       "Display Type-7 LSAs\n" -       "Display Link LSAs\n" -       "Display Intra-Area-Prefix LSAs\n" -       "Specify Link state ID as IPv4 address notation\n" -       "Display Self-originated LSAs\n" -       "Display details of LSAs\n" -       "Dump LSAs\n" -       "Display LSA's internal information\n" -       JSON_STR) +DEFUN(show_ipv6_ospf6_database_type_id_self_originated, +      show_ipv6_ospf6_database_type_id_self_originated_cmd, +      "show ipv6 ospf6  [vrf <NAME|all>] database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> A.B.C.D self-originated [<detail|dump|internal>] [json]", +      SHOW_STR IPV6_STR OSPF6_STR VRF_CMD_HELP_STR +      "All VRFs\n" +      "Display Link state database\n" +      "Display Router LSAs\n" +      "Display Network LSAs\n" +      "Display Inter-Area-Prefix LSAs\n" +      "Display Inter-Area-Router LSAs\n" +      "Display As-External LSAs\n" +      "Display Group-Membership LSAs\n" +      "Display Type-7 LSAs\n" +      "Display Link LSAs\n" +      "Display Intra-Area-Prefix LSAs\n" +      "Specify Link state ID as IPv4 address notation\n" +      "Display Self-originated LSAs\n" +      "Display details of LSAs\n" +      "Dump LSAs\n" +      "Display LSA's internal information\n" JSON_STR)  {  	int idx_lsa = 4;  	int idx_ls_id = 5;  	int idx_level = 7;  	int level; +	bool uj = use_json(argc, argv); +	struct listnode *node; +	struct ospf6 *ospf6;  	uint16_t type = 0;  	uint32_t adv_router = 0;  	uint32_t id = 0; -	bool uj = use_json(argc, argv); -	struct ospf6 *ospf6; +	const char *vrf_name = NULL; +	bool all_vrf = false; +	int idx_vrf = 0; + +	OSPF6_CMD_CHECK_RUNNING(); +	OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); +	if (idx_vrf > 0) { +		idx_lsa += 2; +		idx_ls_id += 2; +		idx_level += 2; +	} -	ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); -	OSPF6_CMD_CHECK_RUNNING(ospf6);  	type = parse_type_spec(idx_lsa, argc, argv);  	inet_pton(AF_INET, argv[idx_ls_id]->arg, &id);  	level = parse_show_level(idx_level, argc, argv); -	adv_router = ospf6->router_id; -	ospf6_lsdb_type_show_wrapper(vty, level, &type, &id, &adv_router, uj, -				     ospf6); +	for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) { +		if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) { +			adv_router = ospf6->router_id; +			ospf6_lsdb_type_show_wrapper(vty, level, &type, &id, +						     &adv_router, uj, ospf6); + +			if (!all_vrf) +				break; +		} +	} +  	return CMD_SUCCESS;  } -DEFUN (show_ipv6_ospf6_border_routers, -       show_ipv6_ospf6_border_routers_cmd, -       "show ipv6 ospf6 border-routers [<A.B.C.D|detail>]", -       SHOW_STR -       IP6_STR -       OSPF6_STR -       "Display routing table for ABR and ASBR\n" -       "Router ID\n" -       "Show detailed output\n") +static int show_ospf6_border_routers_common(struct vty *vty, int argc, +					    struct cmd_token **argv, +					    struct ospf6 *ospf6, int idx_ipv4, +					    int idx_argc)  { -	int idx_ipv4 = 4;  	uint32_t adv_router;  	struct ospf6_route *ro;  	struct prefix prefix; -	struct ospf6 *ospf6 = NULL; -	ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); -	OSPF6_CMD_CHECK_RUNNING(ospf6); -	if (argc == 5) { +	if (argc == idx_argc) {  		if (strmatch(argv[idx_ipv4]->text, "detail")) {  			for (ro = ospf6_route_head(ospf6->brouter_table); ro;  			     ro = ospf6_route_next(ro)) @@ -1018,7 +1230,7 @@ DEFUN (show_ipv6_ospf6_border_routers,  			if (!ro) {  				vty_out(vty,  					"No Route found for Router ID: %s\n", -					argv[4]->arg); +					argv[idx_ipv4]->arg);  				return CMD_SUCCESS;  			} @@ -1036,62 +1248,125 @@ DEFUN (show_ipv6_ospf6_border_routers,  	return CMD_SUCCESS;  } +DEFUN(show_ipv6_ospf6_border_routers, show_ipv6_ospf6_border_routers_cmd, +      "show ipv6 ospf6 [vrf <NAME|all>] border-routers [<A.B.C.D|detail>]", +      SHOW_STR IP6_STR OSPF6_STR VRF_CMD_HELP_STR +      "All VRFs\n" +      "Display routing table for ABR and ASBR\n" +      "Router ID\n" +      "Show detailed output\n") +{ +	int idx_ipv4 = 4; +	struct ospf6 *ospf6 = NULL; +	struct listnode *node; +	const char *vrf_name = NULL; +	bool all_vrf = false; +	int idx_vrf = 0; +	int idx_argc = 5; + +	OSPF6_CMD_CHECK_RUNNING(); +	OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); +	if (idx_vrf > 0) { +		idx_argc += 2; +		idx_ipv4 += 2; +	} -DEFUN (show_ipv6_ospf6_linkstate, -       show_ipv6_ospf6_linkstate_cmd, -       "show ipv6 ospf6 linkstate <router A.B.C.D|network A.B.C.D A.B.C.D>", -       SHOW_STR -       IP6_STR -       OSPF6_STR -       "Display linkstate routing table\n" -       "Display Router Entry\n" -       "Specify Router ID as IPv4 address notation\n" -       "Display Network Entry\n" -       "Specify Router ID as IPv4 address notation\n" -       "Specify Link state ID as IPv4 address notation\n") +	for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) { +		if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) { +			show_ospf6_border_routers_common(vty, argc, argv, ospf6, +							 idx_ipv4, idx_argc); + +			if (!all_vrf) +				break; +		} +	} + +	return CMD_SUCCESS; +} + + +DEFUN(show_ipv6_ospf6_linkstate, show_ipv6_ospf6_linkstate_cmd, +      "show ipv6 ospf6 [vrf <NAME|all>] linkstate <router A.B.C.D|network A.B.C.D A.B.C.D>", +      SHOW_STR IP6_STR OSPF6_STR VRF_CMD_HELP_STR +      "All VRFs\n" +      "Display linkstate routing table\n" +      "Display Router Entry\n" +      "Specify Router ID as IPv4 address notation\n" +      "Display Network Entry\n" +      "Specify Router ID as IPv4 address notation\n" +      "Specify Link state ID as IPv4 address notation\n")  {  	int idx_ipv4 = 5; -	struct listnode *node; +	struct listnode *node, *nnode;  	struct ospf6_area *oa;  	struct ospf6 *ospf6 = NULL; +	const char *vrf_name = NULL; +	bool all_vrf = false; +	int idx_vrf = 0; + +	OSPF6_CMD_CHECK_RUNNING(); +	OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); +	if (idx_vrf > 0) +		idx_ipv4 += 2; + +	for (ALL_LIST_ELEMENTS_RO(om6->ospf6, nnode, ospf6)) { +		if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) { +			for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) { +				vty_out(vty, +					"\n        SPF Result in Area %s\n\n", +					oa->name); +				ospf6_linkstate_table_show(vty, idx_ipv4, argc, +							   argv, oa->spf_table); +			} +			vty_out(vty, "\n"); -	ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); -	OSPF6_CMD_CHECK_RUNNING(ospf6); -	for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) { -		vty_out(vty, "\n        SPF Result in Area %s\n\n", oa->name); -		ospf6_linkstate_table_show(vty, idx_ipv4, argc, argv, -					   oa->spf_table); +			if (!all_vrf) +				break; +		}  	} -	vty_out(vty, "\n");  	return CMD_SUCCESS;  } -DEFUN (show_ipv6_ospf6_linkstate_detail, -       show_ipv6_ospf6_linkstate_detail_cmd, -       "show ipv6 ospf6 linkstate detail", -       SHOW_STR -       IP6_STR -       OSPF6_STR -       "Display linkstate routing table\n" -       "Display detailed information\n") +DEFUN(show_ipv6_ospf6_linkstate_detail, show_ipv6_ospf6_linkstate_detail_cmd, +      "show ipv6 ospf6 [vrf <NAME|all>] linkstate detail", +      SHOW_STR IP6_STR OSPF6_STR VRF_CMD_HELP_STR +      "All VRFs\n" +      "Display linkstate routing table\n" +      "Display detailed information\n")  {  	int idx_detail = 4;  	struct listnode *node;  	struct ospf6_area *oa;  	struct ospf6 *ospf6 = NULL; +	const char *vrf_name = NULL; +	bool all_vrf = false; +	int idx_vrf = 0; + -	ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); -	OSPF6_CMD_CHECK_RUNNING(ospf6); +	OSPF6_CMD_CHECK_RUNNING(); +	OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); +	if (idx_vrf > 0) +		idx_detail += 2; -	for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) { -		vty_out(vty, "\n        SPF Result in Area %s\n\n", oa->name); -		ospf6_linkstate_table_show(vty, idx_detail, argc, argv, -					   oa->spf_table); +	for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) { +		if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) { +			for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) { +				vty_out(vty, +					"\n        SPF Result in Area %s\n\n", +					oa->name); +				ospf6_linkstate_table_show(vty, idx_detail, +							   argc, argv, +							   oa->spf_table); +			} +			vty_out(vty, "\n"); + +			if (!all_vrf) +				break; +		}  	} -	vty_out(vty, "\n");  	return CMD_SUCCESS;  }  | 
