}
/* start ospf6 */
-DEFUN_NOSH (router_ospf6,
- router_ospf6_cmd,
- "router ospf6",
- ROUTER_STR
- OSPF6_STR)
+DEFUN_NOSH(router_ospf6, router_ospf6_cmd, "router ospf6 [vrf NAME]",
+ ROUTER_STR OSPF6_STR VRF_CMD_HELP_STR)
{
struct ospf6 *ospf6;
+ const char *vrf_name = VRF_DEFAULT_NAME;
+ int idx_vrf = 0;
- ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME);
+ if (argv_find(argv, argc, "vrf", &idx_vrf)) {
+ vrf_name = argv[idx_vrf + 1]->arg;
+ }
+
+ ospf6 = ospf6_lookup_by_vrf_name(vrf_name);
if (ospf6 == NULL)
- ospf6 = ospf6_instance_create(VRF_DEFAULT_NAME);
+ ospf6 = ospf6_instance_create(vrf_name);
/* set current ospf point. */
VTY_PUSH_CONTEXT(OSPF6_NODE, ospf6);
}
/* stop ospf6 */
-DEFUN (no_router_ospf6,
- no_router_ospf6_cmd,
- "no router ospf6",
- NO_STR
- ROUTER_STR
- OSPF6_STR)
+DEFUN(no_router_ospf6, no_router_ospf6_cmd, "no router ospf6 [vrf NAME]",
+ NO_STR ROUTER_STR OSPF6_STR VRF_CMD_HELP_STR)
{
struct ospf6 *ospf6;
+ const char *vrf_name = VRF_DEFAULT_NAME;
+ int idx_vrf = 0;
- ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME);
+ if (argv_find(argv, argc, "vrf", &idx_vrf)) {
+ vrf_name = argv[idx_vrf + 1]->arg;
+ }
+
+ ospf6 = ospf6_lookup_by_vrf_name(vrf_name);
if (ospf6 == NULL)
vty_out(vty, "OSPFv3 is not configured\n");
else {
"OSPF6 area ID in decimal notation\n"
)
{
+ VTY_DECLVAR_CONTEXT(ospf6, ospf6);
int idx_ifname = 1;
int idx_ipv4 = 3;
struct ospf6_area *oa;
struct ospf6_interface *oi;
struct interface *ifp;
+ vrf_id_t vrf_id = VRF_DEFAULT;
- VTY_DECLVAR_CONTEXT(ospf6, ospf6);
+ if (ospf6->vrf_id != VRF_UNKNOWN)
+ vrf_id = ospf6->vrf_id;
/* find/create ospf6 interface */
- ifp = if_get_by_name(argv[idx_ifname]->arg, VRF_DEFAULT);
+ ifp = if_get_by_name(argv[idx_ifname]->arg, vrf_id);
oi = (struct ospf6_interface *)ifp->info;
if (oi == NULL)
oi = ospf6_interface_create(ifp);
"OSPF6 area ID in decimal notation\n"
)
{
+ VTY_DECLVAR_CONTEXT(ospf6, ospf6);
int idx_ifname = 2;
int idx_ipv4 = 4;
struct ospf6_interface *oi;
struct ospf6_area *oa;
struct interface *ifp;
uint32_t area_id;
+ vrf_id_t vrf_id = VRF_DEFAULT;
+
+ if (ospf6->vrf_id != VRF_UNKNOWN)
+ vrf_id = ospf6->vrf_id;
+
+ /* find/create ospf6 interface */
+ ifp = if_get_by_name(argv[idx_ifname]->arg, vrf_id);
- ifp = if_lookup_by_name(argv[idx_ifname]->arg, VRF_DEFAULT);
if (ifp == NULL) {
vty_out(vty, "No such interface %s\n", argv[idx_ifname]->arg);
return CMD_SUCCESS;
}
/* show top level structures */
-DEFUN(show_ipv6_ospf6,
- show_ipv6_ospf6_cmd,
- "show ipv6 ospf6 [json]",
- SHOW_STR
- IP6_STR
- OSPF6_STR
- JSON_STR)
+DEFUN(show_ipv6_ospf6, show_ipv6_ospf6_cmd,
+ "show ipv6 ospf6 [vrf <NAME|all>] [json]",
+ SHOW_STR IP6_STR OSPF6_STR VRF_CMD_HELP_STR "All VRFs\n" JSON_STR)
{
struct ospf6 *ospf6;
+ struct listnode *node;
+ const char *vrf_name = NULL;
+ bool all_vrf = false;
+ int idx_vrf = 0;
+
bool uj = use_json(argc, argv);
json_object *json = NULL;
- 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 (uj)
- json = json_object_new_object();
+ for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) {
+ if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) {
+ if (uj)
+ json = json_object_new_object();
+ ospf6_show(vty, ospf6, json, uj);
- ospf6_show(vty, ospf6, json, uj);
+ if (!all_vrf)
+ break;
+ }
+ }
if (uj)
json_object_free(json);
+
return CMD_SUCCESS;
}
-DEFUN (show_ipv6_ospf6_route,
- show_ipv6_ospf6_route_cmd,
- "show ipv6 ospf6 route [<intra-area|inter-area|external-1|external-2|X:X::X:X|X:X::X:X/M|detail|summary>] [json]",
- SHOW_STR
- IP6_STR
- OSPF6_STR
- ROUTE_STR
- "Display Intra-Area routes\n"
- "Display Inter-Area routes\n"
- "Display Type-1 External routes\n"
- "Display Type-2 External routes\n"
- "Specify IPv6 address\n"
- "Specify IPv6 prefix\n"
- "Detailed information\n"
- "Summary of route table\n"
- JSON_STR)
+DEFUN(show_ipv6_ospf6_route, show_ipv6_ospf6_route_cmd,
+ "show ipv6 ospf6 [vrf <NAME|all>] route [<intra-area|inter-area|external-1|external-2|X:X::X:X|X:X::X:X/M|detail|summary>] [json]",
+ SHOW_STR IP6_STR OSPF6_STR VRF_CMD_HELP_STR
+ "All VRFs\n" ROUTE_STR
+ "Display Intra-Area routes\n"
+ "Display Inter-Area routes\n"
+ "Display Type-1 External routes\n"
+ "Display Type-2 External routes\n"
+ "Specify IPv6 address\n"
+ "Specify IPv6 prefix\n"
+ "Detailed information\n"
+ "Summary of route table\n" JSON_STR)
{
struct ospf6 *ospf6;
+ struct listnode *node;
+ const char *vrf_name = NULL;
+ bool all_vrf = false;
+ int idx_vrf = 0;
+ int idx_arg_start = 4;
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_arg_start += 2;
+
+ for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) {
+ if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) {
+ ospf6_route_table_show(vty, idx_arg_start, argc, argv,
+ ospf6->route_table, uj);
+
+ if (!all_vrf)
+ break;
+ }
+ }
- ospf6_route_table_show(vty, 4, argc, argv, ospf6->route_table, uj);
return CMD_SUCCESS;
}
-DEFUN (show_ipv6_ospf6_route_match,
- show_ipv6_ospf6_route_match_cmd,
- "show ipv6 ospf6 route X:X::X:X/M <match|longer> [json]",
- SHOW_STR
- IP6_STR
- OSPF6_STR
- ROUTE_STR
- "Specify IPv6 prefix\n"
- "Display routes which match the specified route\n"
- "Display routes longer than the specified route\n"
- JSON_STR)
+DEFUN(show_ipv6_ospf6_route_match, show_ipv6_ospf6_route_match_cmd,
+ "show ipv6 ospf6 [vrf <NAME|all>] route X:X::X:X/M <match|longer> [json]",
+ SHOW_STR IP6_STR OSPF6_STR VRF_CMD_HELP_STR
+ "All VRFs\n" ROUTE_STR
+ "Specify IPv6 prefix\n"
+ "Display routes which match the specified route\n"
+ "Display routes longer than the specified route\n" JSON_STR)
{
struct ospf6 *ospf6;
+ struct listnode *node;
+ const char *vrf_name = NULL;
+ bool all_vrf = false;
+ int idx_vrf = 0;
+ int idx_start_arg = 4;
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_start_arg += 2;
+
+ for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) {
+ if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) {
+ ospf6_route_table_show(vty, idx_start_arg, argc, argv,
+ ospf6->route_table, uj);
+
+ if (!all_vrf)
+ break;
+ }
+ }
- ospf6_route_table_show(vty, 4, argc, argv, ospf6->route_table, uj);
return CMD_SUCCESS;
}
-DEFUN (show_ipv6_ospf6_route_match_detail,
- show_ipv6_ospf6_route_match_detail_cmd,
- "show ipv6 ospf6 route X:X::X:X/M match detail [json]",
- SHOW_STR
- IP6_STR
- OSPF6_STR
- ROUTE_STR
- "Specify IPv6 prefix\n"
- "Display routes which match the specified route\n"
- "Detailed information\n"
- JSON_STR)
+DEFUN(show_ipv6_ospf6_route_match_detail,
+ show_ipv6_ospf6_route_match_detail_cmd,
+ "show ipv6 ospf6 [vrf <NAME|all>] route X:X::X:X/M match detail [json]",
+ SHOW_STR IP6_STR OSPF6_STR VRF_CMD_HELP_STR
+ "All VRFs\n" ROUTE_STR
+ "Specify IPv6 prefix\n"
+ "Display routes which match the specified route\n"
+ "Detailed information\n" JSON_STR)
{
struct ospf6 *ospf6;
+ struct listnode *node;
+ const char *vrf_name = NULL;
+ bool all_vrf = false;
+ int idx_vrf = 0;
+ int idx_start_arg = 4;
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_start_arg += 2;
+
+ for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) {
+ if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) {
+ ospf6_route_table_show(vty, idx_start_arg, argc, argv,
+ ospf6->route_table, uj);
+
+ if (!all_vrf)
+ break;
+ }
+ }
- ospf6_route_table_show(vty, 4, argc, argv, ospf6->route_table, uj);
return CMD_SUCCESS;
}
-
-DEFUN (show_ipv6_ospf6_route_type_detail,
- show_ipv6_ospf6_route_type_detail_cmd,
- "show ipv6 ospf6 route <intra-area|inter-area|external-1|external-2> detail [json]",
- SHOW_STR
- IP6_STR
- OSPF6_STR
- ROUTE_STR
- "Display Intra-Area routes\n"
- "Display Inter-Area routes\n"
- "Display Type-1 External routes\n"
- "Display Type-2 External routes\n"
- "Detailed information\n"
- JSON_STR)
+DEFUN(show_ipv6_ospf6_route_type_detail, show_ipv6_ospf6_route_type_detail_cmd,
+ "show ipv6 ospf6 [vrf <NAME|all>] route <intra-area|inter-area|external-1|external-2> detail [json]",
+ SHOW_STR IP6_STR OSPF6_STR VRF_CMD_HELP_STR
+ "All VRFs\n" ROUTE_STR
+ "Display Intra-Area routes\n"
+ "Display Inter-Area routes\n"
+ "Display Type-1 External routes\n"
+ "Display Type-2 External routes\n"
+ "Detailed information\n" JSON_STR)
{
struct ospf6 *ospf6;
+ struct listnode *node;
+ const char *vrf_name = NULL;
+ bool all_vrf = false;
+ int idx_vrf = 0;
+ int idx_start_arg = 4;
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_start_arg += 2;
+
+ for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) {
+ if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) {
+ ospf6_route_table_show(vty, idx_start_arg, argc, argv,
+ ospf6->route_table, uj);
+
+ if (!all_vrf)
+ break;
+ }
+ }
- ospf6_route_table_show(vty, 4, argc, argv, ospf6->route_table, uj);
return CMD_SUCCESS;
}
return CMD_SUCCESS;
for (ALL_LIST_ELEMENTS(om6->ospf6, node, nnode, ospf6)) {
- vty_out(vty, "router ospf6\n");
+ if (ospf6->name && strcmp(ospf6->name, VRF_DEFAULT_NAME))
+ vty_out(vty, "router ospf6 vrf %s\n", ospf6->name);
+ else
+ vty_out(vty, "router ospf6\n");
+
if (ospf6->router_id_static != 0)
vty_out(vty, " ospf6 router-id %pI4\n",
&ospf6->router_id_static);