]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospfd: OSPFv2 VRF, vrf in show command output
authorChirag Shah <chirag@cumulusnetworks.com>
Sun, 17 Sep 2017 22:44:39 +0000 (15:44 -0700)
committerChirag Shah <chirag@cumulusnetworks.com>
Tue, 10 Oct 2017 16:36:48 +0000 (09:36 -0700)
Add VRF name in both vtysh and json format of
show commands.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
ospfd/ospf_lsa.c
ospfd/ospf_vty.c

index 1795225ca7d51d0557a78434b85e37ff8e44e38d..74d5178f55cded09649b7552d6a2a41a38601788 100644 (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
                        the
                        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
                        which belong to the NSSA.  If no such addresses exist,
                        then
index 3840bc41708ae3b2bbbe7b4d23152a71db8967a3..7d6f40bfe7fe99c09dbe412fa6dd20f42c26aadb 100644 (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. */
        if (use_json) {
                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);
        }
 
+       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))
                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);
        }
 
+       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_all_vrf(argv[arg_base]->arg);
        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);
        }
 
+       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);
        if (!ret) {
                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);
        }
 
+       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)) {
                struct route_node *rn;
                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);
        }
 
+       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)) {
                struct route_node *rn;
                struct ospf_neighbor *nbr;
@@ -5591,6 +5633,9 @@ static int show_ip_ospf_database_common(struct vty *vty, struct ospf *ospf,
        if (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",
                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)
                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",
                inet_ntoa(ospf->router_id));
 
@@ -8368,6 +8416,9 @@ static int show_ip_ospf_border_routers_common(struct vty *vty,
        if (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) {
                vty_out(vty, "No OSPF routing information exist\n");
                return CMD_SUCCESS;
@@ -8460,6 +8511,9 @@ static int show_ip_ospf_route_common(struct vty *vty, struct ospf *ospf)
        if (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) {
                vty_out(vty, "No OSPF routing information exist\n");
                return CMD_SUCCESS;