]> git.puffer.fish Git - mirror/frr.git/commitdiff
[ospfd] Additional NSM neighbour state change stats/information
authorPaul Jakma <paul.jakma@sun.com>
Tue, 25 Jul 2006 20:44:12 +0000 (20:44 +0000)
committerPaul Jakma <paul.jakma@sun.com>
Tue, 25 Jul 2006 20:44:12 +0000 (20:44 +0000)
2006-07-25 Paul Jakma <paul.jakma@sun.com>

* ospf_neigbor.h: (struct ospf_neighbor) Add some additional
  neighbour state statistics fields, timestamps for progressive
  and regressive state changes, and pointer to event string
  for the latter state change.
* ospf_nsm.c: (nsm_notice_state_change) Update new state changs
  history as required.
* ospf_vty.c: (show_ip_ospf_neighbor_detail_sub) Print out above
  new per-neighbour state change stats.

ospfd/ChangeLog
ospfd/ospf_neighbor.h
ospfd/ospf_nsm.c
ospfd/ospf_vty.c

index 1564bdbf738e3157597e81b77c587fabde7331e1..2c23774adb9573825d6b12607272c3b5f922054d 100644 (file)
@@ -1,3 +1,14 @@
+2006-07-25 Paul Jakma <paul.jakma@sun.com>
+
+       * ospf_neigbor.h: (struct ospf_neighbor) Add some additional
+         neighbour state statistics fields, timestamps for progressive
+         and regressive state changes, and pointer to event string
+         for the latter state change.
+       * ospf_nsm.c: (nsm_notice_state_change) Update new state changs
+         history as required.
+       * ospf_vty.c: (show_ip_ospf_neighbor_detail_sub) Print out above
+         new per-neighbour state change stats.
+
 2006-07-10 Paul Jakma <paul.jakma@sun.com>
 
        * ospf_nsm.c: (nsm_change_state) call nsm_clear_adj for all
index 9b7ff36e179a13020b0e629cc572a15564a1e12e..25f135242c73335db34e613fc80d7838b3578c55 100644 (file)
@@ -80,11 +80,14 @@ struct ospf_neighbor
   struct thread *t_ls_upd;
   struct thread *t_hello_reply;
 
-  /* Statistics Field */
-  u_int32_t state_change;
-  struct timeval ts_last_change;
-  const char *last_event_str;
+  /* NBMA configured neighbour */
   struct ospf_nbr_nbma *nbr_nbma;
+
+  /* Statistics */
+  struct timeval ts_last_progress;  /* last advance of NSM            */
+  struct timeval ts_last_regress;   /* last regressive NSM change     */
+  const char *last_regress_str;     /* Event which last regressed NSM */
+  u_int32_t state_change;           /* NSM state change counter       */
 };
 
 /* Macros. */
index ff0a52d09ce14ad89c8b1edf0978932c64827889..8329a4f36a8c090d740264b7c258db2a67f89c20 100644 (file)
@@ -615,8 +615,14 @@ nsm_notice_state_change (struct ospf_neighbor *nbr, int next_state, int event)
                 LOOKUP (ospf_nsm_state_msg, next_state),
                 ospf_nsm_event_str [event]);
 
-  nbr->ts_last_change = recent_time;
-  nbr->last_event_str = ospf_nsm_event_str [event];
+  /* Advance in NSM */
+  if (next_state > nbr->state)
+    nbr->ts_last_progress = recent_time;
+  else /* regression in NSM */
+    {
+      nbr->ts_last_regress = recent_time;
+      nbr->last_regress_str = ospf_nsm_event_str [event];
+    }
 
 #ifdef HAVE_SNMP
   /* Terminal state or regression */ 
index 44049d8c469f31da769c1db5b9144ede0345fd05..912f1d09c847547a9a7e71616c2bf203bef1e212 100644 (file)
@@ -3155,12 +3155,21 @@ show_ip_ospf_neighbor_detail_sub (struct vty *vty, struct ospf_interface *oi,
           nbr->priority, LOOKUP (ospf_nsm_state_msg, nbr->state));
   /* Show state changes. */
   vty_out (vty, " %d state changes%s", nbr->state_change, VTY_NEWLINE);
-  if (nbr->ts_last_change.tv_sec || nbr->ts_last_change.tv_usec)
+  if (nbr->ts_last_progress.tv_sec || nbr->ts_last_progress.tv_usec)
     {
-      struct timeval res = tv_sub (recent_time, nbr->ts_last_change);
-      vty_out (vty, "    Last state change %s ago, due to %s%s",
+      struct timeval res = tv_sub (recent_time, nbr->ts_last_progress);
+      vty_out (vty, "    Most recent state change statistics:%s",
+               VTY_NEWLINE);
+      vty_out (vty, "      Progressive change %s ago%s",
+               ospf_timeval_dump (&res, timebuf, sizeof(timebuf)),
+               VTY_NEWLINE);
+    }
+  if (nbr->ts_last_regress.tv_sec || nbr->ts_last_regress.tv_usec)
+    {
+      struct timeval res = tv_sub (recent_time, nbr->ts_last_regress);
+      vty_out (vty, "      Regressive change %s ago, due to %s%s",
                ospf_timeval_dump (&res, timebuf, sizeof(timebuf)),
-               (nbr->last_event_str ? nbr->last_event_str : "??"),
+               (nbr->last_regress_str ? nbr->last_regress_str : "??"),
                VTY_NEWLINE);
     }
   /* Show Designated Rotuer ID. */