]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospfd: Fix the 'show ip ospf int ...' command
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 8 Apr 2017 12:47:59 +0000 (08:47 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 8 Apr 2017 12:47:59 +0000 (08:47 -0400)
Fixed output:

robot.cumulusnetworks.com# show ip ospf int
enp0s3 is up
  ifindex 2, MTU 1500 bytes, BW 0 Mbit <UP,BROADCAST,RUNNING,MULTICAST>
  Internet Address 10.0.2.15/24, Broadcast 10.0.2.255, Area 0.0.0.0
  MTU mismatch detection:enabled
  Router ID 192.168.0.1, Network Type BROADCAST, Cost: 10
  Transmit Delay is 1 sec, State Waiting, Priority 1
  No backup designated router on this network
  Multicast group memberships: OSPFAllRouters
  Timer intervals configured, Hello 10s, Dead 40s, Wait 40s, Retransmit 5
    Hello due in 9.611s
  Neighbor Count is 0, Adjacent neighbor count is 0
enp0s10 is up
  ifindex 7, MTU 1500 bytes, BW 0 Mbit <UP,BROADCAST,RUNNING,MULTICAST>
  Internet Address 192.168.201.146/24, Broadcast 192.168.201.255, Area 0.0.0.0
  MTU mismatch detection:enabled
  Router ID 192.168.0.1, Network Type BROADCAST, Cost: 10
  Transmit Delay is 1 sec, State Waiting, Priority 1
  No backup designated router on this network
  Multicast group memberships: OSPFAllRouters
  Timer intervals configured, Hello 10s, Dead 40s, Wait 40s, Retransmit 5
    Hello due in 7.241s
  Neighbor Count is 0, Adjacent neighbor count is 0

robot.cumulusnetworks.com# show ip ospf int enp0s3
enp0s3 is up
  ifindex 2, MTU 1500 bytes, BW 0 Mbit <UP,BROADCAST,RUNNING,MULTICAST>
  Internet Address 10.0.2.15/24, Broadcast 10.0.2.255, Area 0.0.0.0
  MTU mismatch detection:enabled
  Router ID 192.168.0.1, Network Type BROADCAST, Cost: 10
  Transmit Delay is 1 sec, State Waiting, Priority 1
  No backup designated router on this network
  Multicast group memberships: OSPFAllRouters
  Timer intervals configured, Hello 10s, Dead 40s, Wait 40s, Retransmit 5
    Hello due in 2.915s
  Neighbor Count is 0, Adjacent neighbor count is 0

robot.cumulusnetworks.com# show ip ospf int enp0s10 json
{
  "enp0s10":{
    "ifUp":true,
    "ifIndex":7,
    "mtuBytes":1500,
    "bandwidthMbit":0,
    "ifFlags":"<UP,BROADCAST,RUNNING,MULTICAST>",
    "ospfEnabled":true,
    "ipAddress":"192.168.201.146",
    "ipAddressPrefixlen":24,
    "ospfIfType":"Broadcast",
    "localIfUsed":"192.168.201.255",
    "area":"0.0.0.0",
    "routerId":"192.168.0.1",
    "networkType":"BROADCAST",
    "cost":10,
    "transmitDelayMsecs":1000,
    "state":"Waiting",
    "priority":1,
    "mcastMemberOspfAllRouters":true,
    "timerMsecs":100,
    "timerDeadMsecs":25,
    "timerWaitMsecs":25,
    "timerRetransmit":200,
    "timerHelloInMsecs":2106,
    "nbrCount":0,
    "nbrAdjacentCount":0
  }
}
robot.cumulusnetworks.com#

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
ospfd/ospf_vty.c

index 49474df82626649fbb32591fe1d3354582bd6a8e..b4c456e0aa8532a62d09bb3ef2ee4be3d417dae3 100644 (file)
@@ -3557,7 +3557,7 @@ show_ip_ospf_interface_common (struct vty *vty, struct ospf *ospf, int argc,
                  VTY_NEWLINE, VTY_NEWLINE);
     }
 
-  if (argc == (iface_argv + 1))
+  if (argc == iface_argv)
     {
       /* Show All Interfaces.*/
       for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
@@ -3570,25 +3570,6 @@ show_ip_ospf_interface_common (struct vty *vty, struct ospf *ospf, int argc,
             }
         }
     }
-  else if (argv[iface_argv] && strcmp(argv[iface_argv]->arg, "json") == 0)
-    {
-      if (!use_json)
-       {
-         json = json_object_new_object();
-         json_interface_sub = json_object_new_object ();
-         use_json = 1;
-       }
-      /* Show All Interfaces. */
-      for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
-        {
-          if (ospf_oi_count(ifp))
-            {
-              show_ip_ospf_interface_sub (vty, ospf, ifp, json_interface_sub, use_json);
-             if (use_json)
-               json_object_object_add(json, ifp->name, json_interface_sub);
-           }
-       }
-    }
   else
     {
       /* Interface name is specified. */
@@ -3634,7 +3615,10 @@ DEFUN (show_ip_ospf_interface,
   if ((ospf = ospf_lookup()) == NULL || !ospf->oi_running)
     return CMD_SUCCESS;
 
-  return show_ip_ospf_interface_common(vty, ospf, argc, argv, 0, uj);
+  if (uj)
+    argc--;
+
+  return show_ip_ospf_interface_common(vty, ospf, argc, argv, 4, uj);
 }
 
 DEFUN (show_ip_ospf_instance_interface,
@@ -3657,7 +3641,10 @@ DEFUN (show_ip_ospf_instance_interface,
   if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
     return CMD_SUCCESS;
 
-  return show_ip_ospf_interface_common(vty, ospf, argc, argv, 1, uj);
+  if (uj)
+    argc--;
+
+  return show_ip_ospf_interface_common(vty, ospf, argc, argv, 5, uj);
 }
 
 static void