]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
ospf meta file temp
authorMaria Matejka <mq@ucw.cz>
Tue, 23 Apr 2024 11:23:09 +0000 (13:23 +0200)
committerMaria Matejka <mq@ucw.cz>
Tue, 23 Apr 2024 11:23:09 +0000 (13:23 +0200)
yang/show_memory_meta.c [new file with mode: 0644]
yang/show_ospf.yang
yang/show_ospf_meta.c [new file with mode: 0644]

diff --git a/yang/show_memory_meta.c b/yang/show_memory_meta.c
new file mode 100644 (file)
index 0000000..8d2b6a3
--- /dev/null
@@ -0,0 +1,20 @@
+
+UYTC_MODULE(show_memory) {
+  UYTC_GROUPING(memory, resmem) {
+    UYTC_LEAF(effective, resmem.effective);
+    UYTC_LEAF(overhead, resmem.overhead);
+  }
+
+  UYTC_CONTAINER(message, msg) {
+    UYTC_LEAF(header, "BIRD memory usage");
+    UYTC_CONTAINER(body, body) {
+      UYTC_LEAF(routing_tables, rmemsize(rt_table_pool));
+      UYTC_LEAF(route_attributes, rmemsize(rta_pool));
+      ...;
+#ifdef HAVE_MMAP
+      UYTC_LEAF(standby_memory, (struct resmem) { .overhead = page_size * *pages_kept });
+#endif
+      UYTC_LEAF(total, rmemsize(&root_pool));
+    }
+  }
+}
index cf8d808cb12495bd8aaefa068fd9577262654f36..b8b328896a4124e9427b6aa07d3f4ab7d6648d23 100644 (file)
@@ -32,53 +32,55 @@ module show_ospf {
       uses router;
       uses distance;
 
-      list vlink {
-        key "vlink";
-        leaf vlink {
-          type int32;
-        }
-        uses metric;
-      }
-
-      list router_metric {
-        key "router";
-        uses router;
-        uses metric;
-      }
-
-      list network {
-        key "dummy_yang_id";
-        leaf dummy_yang_id {
-          type int32;
-        }
-        leaf network {
-          type int32;
-        }
-        choice len_nif {
-          case len {
-            leaf len {
-              type int32;
-            }
-          }
-          case nif {
-            leaf nif {
-              type int32;
-            }
-          }
-        }
-        leaf metric {
-          mandatory false;
-          type int32;
-        }
-        list stubnet {
-          key "stubnet";
-          leaf stubnet {
-            type int32;
-          }
-          leaf len {
-            type int32;
-          }
-          uses metric;
+      list rt {
+       key "dummy_yang_id";
+       leaf dummy_yang_id {
+         type int32;
+       }
+       leaf metric {
+         type int32;
+       }
+       choice rt_type {
+         case vlink {
+           grouping vlink {
+             leaf vlink {
+               type int32;
+             }
+           }
+         }
+
+         case router {
+           grouping router_metric {
+             uses router;
+           }
+         }
+
+         case network {
+           grouping network {
+             leaf network {
+               type ipv4;
+             }
+             leaf len {
+               type int32;
+               mandatory false;
+             }
+             leaf nif {
+               type int32;
+               mandatory false;
+             }
+           }
+         }
+
+         case stubnet {
+           grouping stubnet {
+             leaf stubnet {
+               type ipv4;
+             }
+             leaf len {
+               type int32;
+             }
+           }
+         }
         }
       }
     }
diff --git a/yang/show_ospf_meta.c b/yang/show_ospf_meta.c
new file mode 100644 (file)
index 0000000..acf3c5b
--- /dev/null
@@ -0,0 +1,53 @@
+static inline void
+show_lsa_router_cbor(UYTC_CONTEXT_TYPE UYTC_CONTEXT, struct top_hash_entry *he, int verbose)
+{
+  UYTC_GROUPING(lsa_router) {
+    UYTC_ITEM(router, he->lsa.rt);
+    
+    ...;
+
+    lsa_walk_rt_init(p, he, &rtl);
+    int i = 0;
+    while (lsa_walk_rt(&rtl))
+    {
+      i++;
+      UYTC_LIST_ITEM(rt) {
+       UYTC_LEAF(dummy_yang_id, i);
+       UYTC_LEAF(metric, rtl.metric);
+       switch (rtl.type) {
+         case LSART_VLNK:
+           UYTC_CHOICE_ITEM(rt_type, vlink) {
+             UYTC_GROUPING(vlink) {
+               UYTC_LEAF(vlink, rtl.id);
+               UYTC_LEAF(name, rtl.name);
+             }
+           }
+           break;
+
+         case LSART_PTP:
+           ...;
+       }
+      }
+    }
+  }
+}
+
+
+for (i = 0; i < j1; i++) {
+  UYTC_LIST_ITEM(areas) {
+    struct top_hash_entry *he = hea[i];
+    UYTC_LEAF(dummy_yang_id, i);
+    UYTC_LEAF(area, he->domain);
+
+    switch (he->lsa_type)
+    {
+      case LSA_T_RT:
+       UYTC_CHOICE_ITEM(lsa_type, rt, show_lsa_router_cbor(UYTC_CONTEXT, he));
+       break;
+
+      case LSA_T_NET:
+       UYTC_CHOICE_ITEM(lsa_type, net, show_lsa_network_cbor(UYTC_CONTEXT, he, ospf2));
+       break;
+    }
+  }
+}