ospfd: OSPFv2 VRF, vrf in show command output

Add VRF name in both vtysh and json format of
show commands.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
This commit is contained in:
Chirag Shah 2017-09-17 15:44:39 -07:00
parent 5d920111b9
commit 87bd50e857
2 changed files with 55 additions and 1 deletions

View File

@ -1702,7 +1702,7 @@ static void ospf_install_flood_nssa(struct ospf *ospf, struct ospf_lsa *lsa,
not adversited into OSPF as an internal OSPF route and not adversited into OSPF as an internal OSPF route and
the the
type-7 LSA's P-bit is set a forwarding address should be type-7 LSA's P-bit is set a forwarding address should be
selected from one of the router's active OSPF inteface selected from one of the router's active OSPF interface
addresses addresses
which belong to the NSSA. If no such addresses exist, which belong to the NSSA. If no such addresses exist,
then then

View File

@ -2890,6 +2890,13 @@ static int show_ip_ospf_common(struct vty *vty, struct ospf *ospf,
} }
} }
if (ospf->name) {
if (use_json)
json_object_string_add(json, "vrfName", ospf->name);
else
vty_out(vty, "OSPF vrfName: %s\n", ospf->name);
}
/* Show Router ID. */ /* Show Router ID. */
if (use_json) { if (use_json) {
json_object_string_add(json, "routerId", json_object_string_add(json, "routerId",
@ -3857,6 +3864,13 @@ static int show_ip_ospf_neighbor_common(struct vty *vty, struct ospf *ospf,
vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance); vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance);
} }
if (ospf->name) {
if (use_json)
json_object_string_add(json, "vrfName", ospf->name);
else
vty_out(vty, "OSPF vrfName: %s\n", ospf->name);
}
for (ALL_LIST_ELEMENTS_RO(ospf->oiflist, node, oi)) for (ALL_LIST_ELEMENTS_RO(ospf->oiflist, node, oi))
show_ip_ospf_neighbor_sub(vty, oi, json, use_json); show_ip_ospf_neighbor_sub(vty, oi, json, use_json);
@ -4146,6 +4160,13 @@ static int show_ip_ospf_neighbor_int_common(struct vty *vty, struct ospf *ospf,
vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance); vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance);
} }
if (ospf->name) {
if (use_json)
json_object_string_add(json, "vrfName", ospf->name);
else
vty_out(vty, "OSPF vrfName: %s\n", ospf->name);
}
/*ifp = if_lookup_by_name(argv[arg_base]->arg, ospf->vrf_id);*/ /*ifp = if_lookup_by_name(argv[arg_base]->arg, ospf->vrf_id);*/
ifp = if_lookup_by_name_all_vrf(argv[arg_base]->arg); ifp = if_lookup_by_name_all_vrf(argv[arg_base]->arg);
if (!ifp) { if (!ifp) {
@ -4558,6 +4579,13 @@ static int show_ip_ospf_neighbor_id_common(struct vty *vty, struct ospf *ospf,
vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance); vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance);
} }
if (ospf->name) {
if (use_json)
json_object_string_add(json, "vrfName", ospf->name);
else
vty_out(vty, "OSPF vrfName: %s\n", ospf->name);
}
ret = inet_aton(argv[arg_base]->arg, &router_id); ret = inet_aton(argv[arg_base]->arg, &router_id);
if (!ret) { if (!ret) {
if (!use_json) if (!use_json)
@ -4657,6 +4685,13 @@ static int show_ip_ospf_neighbor_detail_common(struct vty *vty,
vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance); vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance);
} }
if (ospf->name) {
if (use_json)
json_object_string_add(json, "vrfName", ospf->name);
else
vty_out(vty, "OSPF vrfName: %s\n", ospf->name);
}
for (ALL_LIST_ELEMENTS_RO(ospf->oiflist, node, oi)) { for (ALL_LIST_ELEMENTS_RO(ospf->oiflist, node, oi)) {
struct route_node *rn; struct route_node *rn;
struct ospf_neighbor *nbr; struct ospf_neighbor *nbr;
@ -4781,6 +4816,13 @@ static int show_ip_ospf_neighbor_detail_all_common(struct vty *vty,
vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance); vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance);
} }
if (ospf->name) {
if (use_json)
json_object_string_add(json, "vrfName", ospf->name);
else
vty_out(vty, "OSPF vrfName: %s\n", ospf->name);
}
for (ALL_LIST_ELEMENTS_RO(ospf->oiflist, node, oi)) { for (ALL_LIST_ELEMENTS_RO(ospf->oiflist, node, oi)) {
struct route_node *rn; struct route_node *rn;
struct ospf_neighbor *nbr; struct ospf_neighbor *nbr;
@ -5591,6 +5633,9 @@ static int show_ip_ospf_database_common(struct vty *vty, struct ospf *ospf,
if (ospf->instance) if (ospf->instance)
vty_out(vty, "\nOSPF Instance: %d\n", ospf->instance); vty_out(vty, "\nOSPF Instance: %d\n", ospf->instance);
if (ospf->name)
vty_out(vty, "OSPF vrfName: %s\n", ospf->name);
vty_out(vty, "\n OSPF Router with ID (%s)\n\n", vty_out(vty, "\n OSPF Router with ID (%s)\n\n",
inet_ntoa(ospf->router_id)); inet_ntoa(ospf->router_id));
@ -5812,6 +5857,9 @@ static int show_ip_ospf_database_type_adv_router_common(struct vty *vty,
if (ospf->instance) if (ospf->instance)
vty_out(vty, "\nOSPF Instance: %d\n", ospf->instance); vty_out(vty, "\nOSPF Instance: %d\n", ospf->instance);
if (ospf->name)
vty_out(vty, "OSPF vrfName: %s\n", ospf->name);
vty_out(vty, "\n OSPF Router with ID (%s)\n\n", vty_out(vty, "\n OSPF Router with ID (%s)\n\n",
inet_ntoa(ospf->router_id)); inet_ntoa(ospf->router_id));
@ -8368,6 +8416,9 @@ static int show_ip_ospf_border_routers_common(struct vty *vty,
if (ospf->instance) if (ospf->instance)
vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance); vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance);
if (ospf->name)
vty_out(vty, "OSPF vrfName: %s\n", ospf->name);
if (ospf->new_table == NULL) { if (ospf->new_table == NULL) {
vty_out(vty, "No OSPF routing information exist\n"); vty_out(vty, "No OSPF routing information exist\n");
return CMD_SUCCESS; return CMD_SUCCESS;
@ -8460,6 +8511,9 @@ static int show_ip_ospf_route_common(struct vty *vty, struct ospf *ospf)
if (ospf->instance) if (ospf->instance)
vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance); vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance);
if (ospf->name)
vty_out(vty, "OSPF vrfName: %s\n", ospf->name);
if (ospf->new_table == NULL) { if (ospf->new_table == NULL) {
vty_out(vty, "No OSPF routing information exist\n"); vty_out(vty, "No OSPF routing information exist\n");
return CMD_SUCCESS; return CMD_SUCCESS;