]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospf6d: complete SNMP implementation of ospfv3AreaTable
authorVincent Bernat <bernat@luffy.cx>
Mon, 4 Jun 2012 08:29:49 +0000 (10:29 +0200)
committerVincent Bernat <bernat@luffy.cx>
Mon, 25 Jun 2012 17:05:17 +0000 (19:05 +0200)
ospf6d/ospf6_area.h
ospf6d/ospf6_snmp.c
ospf6d/ospf6_spf.c

index c7c5ee35881ceaa8e0229093d52cdbff86748e65..e8a4fbd87887977ab7852812cde45d181cd79784 100644 (file)
@@ -57,6 +57,7 @@ struct ospf6_area
 
   struct thread  *thread_spf_calculation;
   struct thread  *thread_route_calculation;
+  u_int32_t spf_calculation;   /* SPF calculation count */
 
   struct thread *thread_router_lsa;
   struct thread *thread_intra_prefix_lsa;
index 9f333a816c7dc176269cec6e3ffbd954e3589ab8..293d66a12a9d4f2f1d3af21c2294527a06689da5 100644 (file)
@@ -449,10 +449,14 @@ ospfv3AreaEntry (struct variable *v, oid *name, size_t *length,
                  int exact, size_t *var_len, WriteMethod **write_method)
 {
   struct ospf6_area *oa, *area = NULL;
+  struct ospf6_lsa *lsa = NULL;
   u_int32_t area_id = 0;
+  u_int32_t count;
+  u_int16_t sum;
   struct listnode *node;
   unsigned int len;
   char a[16];
+  struct ospf6_route *ro;
 
   if (ospf6 == NULL)
     return NULL;
@@ -498,15 +502,37 @@ ospfv3AreaEntry (struct variable *v, oid *name, size_t *length,
   switch (v->magic)
     {
     case OSPFv3IMPORTASEXTERN:
-      return SNMP_INTEGER (ospf6->external_table->count);
-      break;
+      /* No NSSA support */
+      return SNMP_INTEGER (IS_AREA_STUB(area)?2:1);
     case OSPFv3AREASPFRUNS:
+      return SNMP_INTEGER (area->spf_calculation);
     case OSPFv3AREABDRRTRCOUNT:
     case OSPFv3AREAASBDRRTRCOUNT:
+      count = 0;
+      for (ro = ospf6_route_head (ospf6->brouter_table); ro;
+          ro = ospf6_route_next (ro))
+        {
+          if (ntohl (ro->path.area_id) != ntohl (area->area_id)) continue;
+          if (v->magic == OSPFv3AREABDRRTRCOUNT &&
+              CHECK_FLAG (ro->path.router_bits, OSPF6_ROUTER_BIT_B))
+            count++;
+          if (v->magic == OSPFv3AREAASBDRRTRCOUNT &&
+              CHECK_FLAG (ro->path.router_bits, OSPF6_ROUTER_BIT_E))
+            count++;
+        }
+      return SNMP_INTEGER (count);
     case OSPFv3AREASCOPELSACOUNT:
+      return SNMP_INTEGER (area->lsdb->count);
     case OSPFv3AREASCOPELSACKSUMSUM:
+      for (sum = 0, lsa = ospf6_lsdb_head (area->lsdb);
+          lsa;
+          lsa = ospf6_lsdb_next (lsa))
+       sum += ntohs (lsa->header->checksum);
+      return SNMP_INTEGER (sum);
     case OSPFv3AREASUMMARY:
+      return SNMP_INTEGER (2); /* sendAreaSummary */
     case OSPFv3AREAROWSTATUS:
+      return SNMP_INTEGER (1); /* Active */
     case OSPFv3AREASTUBMETRIC:
     case OSPFv3AREANSSATRANSLATORROLE:
     case OSPFv3AREANSSATRANSLATORSTATE:
index a4a5b7218428d9903d169c0fe0fbebf3cf7e4c5f..da0ee131b7fa3ea5c996d310d15dbf3a96702928 100644 (file)
@@ -473,6 +473,8 @@ ospf6_spf_calculation (u_int32_t router_id,
     }
 
   pqueue_delete (candidate_list);
+
+  oa->spf_calculation++;
 }
 
 static void