0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-09-16 18:35:19 +00:00

ospf meta file temp

This commit is contained in:
Maria Matejka 2024-04-23 13:23:09 +02:00
parent e8a325313e
commit 080c9a7afe
3 changed files with 120 additions and 45 deletions

20
yang/show_memory_meta.c Normal file
View File

@ -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));
}
}
}

View File

@ -32,53 +32,55 @@ module show_ospf {
uses router;
uses distance;
list vlink {
key "vlink";
leaf vlink {
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;
}
}
}
list router_metric {
key "router";
uses router;
uses metric;
}
case router {
grouping router_metric {
uses router;
}
}
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;
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;
}
}
}
}
}
}

53
yang/show_ospf_meta.c Normal file
View File

@ -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;
}
}
}