]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
cbor_parse, cbor_cmds: looks like show_status and show_symbols work (show_symbols...
authorKaterina Kubecova <katerina.kubecova@nic.cz>
Wed, 29 Nov 2023 14:14:16 +0000 (15:14 +0100)
committerKaterina Kubecova <katerina.kubecova@nic.cz>
Wed, 29 Nov 2023 14:14:16 +0000 (15:14 +0100)
15 files changed:
nest/cbor.c
nest/cbor_cmds.c
nest/cbor_parse.c
nest/cbor_shortcuts.c
nest/cmds.c
nest/proto.c
nest/protocol.h
yang/command.cbor
yang/command.json
yang/command.yang
yang/show_memory.cbor
yang/show_status.json
yang/show_status.yang
yang/show_symbols.cbor [new file with mode: 0644]
yang/yang-library.json

index c8edcc4533ee748b958975275aaa2310e81def2c..2c1524395e0e1de70d33dadb4dcde0d4286910a2 100644 (file)
@@ -14,7 +14,8 @@ void check_memory(struct cbor_writer *writer, int add_size);
 
 
 
-struct cbor_writer *cbor_init(byte *buff, uint capacity, struct linpool *lp) {
+struct cbor_writer *cbor_init(byte *buff, uint capacity, struct linpool *lp)
+{
   struct cbor_writer *writer = (struct cbor_writer*)lp_alloc(lp, sizeof(struct cbor_writer));
   writer->cbor = buff;
   writer->capacity = capacity;
@@ -29,41 +30,50 @@ void cbor_open_block(struct cbor_writer *writer) { // We will need to close the
   writer->pt++;
 }
 
-void cbor_open_list(struct cbor_writer *writer) {
+void cbor_open_list(struct cbor_writer *writer)
+{
   check_memory(writer, 2);
   writer->cbor[writer->pt] = 0x9f;
   writer->pt++;
 }
 
-void cbor_close_block_or_list(struct cbor_writer *writer) {
+void cbor_close_block_or_list(struct cbor_writer *writer)
+{
   check_memory(writer, 2);
   writer->cbor[writer->pt] = 0xff;
   writer->pt++;
 }
 
-void cbor_open_block_with_length(struct cbor_writer *writer, int length) {
+void cbor_open_block_with_length(struct cbor_writer *writer, int length)
+{
   write_item(writer, 5, length);
 }
 
-void cbor_open_list_with_length(struct cbor_writer *writer, int length) {
+void cbor_open_list_with_length(struct cbor_writer *writer, int length)
+{
   write_item(writer, 4, length);
 }
 
 
-void cbor_add_int(struct cbor_writer *writer, int item) {
-  if (item >= 0) {
+void cbor_add_int(struct cbor_writer *writer, int item)
+{
+  if (item >= 0)
+  {
     write_item(writer, 0, item); // 0 is the "major" (three bits) introducing positive int, 1 is for negative
   }
-  else {
+  else
+  {
     write_item(writer, 1, item);
   }
 }
 
-void cbor_add_tag(struct cbor_writer *writer, int item) {
+void cbor_add_tag(struct cbor_writer *writer, int item)
+{
   write_item(writer, 6, item);
 }
 
-void cbor_add_string(struct cbor_writer *writer, char *string) {
+void cbor_add_string(struct cbor_writer *writer, const char *string)
+{
   int length = strlen(string);
   write_item(writer, 3, length);  // 3 is major, then goes length of string and string
   check_memory(writer, length);
@@ -71,32 +81,38 @@ void cbor_add_string(struct cbor_writer *writer, char *string) {
   writer->pt+=length;
 }
 
-void write_item(struct cbor_writer *writer, int8_t major, int num) {
+void write_item(struct cbor_writer *writer, int8_t major, int num)
+{
   major = major<<5;
   check_memory(writer, 10);
-  if (num > (1<<(2*8))-1) { // We need 4 bytes to encode the num
+  if (num > (1<<(2*8))-1)
+  { // We need 4 bytes to encode the num
     major += 0x1a; // reserving those bytes
     writer->cbor[writer->pt] = major;
     writer->pt++;
-    for (int i = 3; i>=0; i--) { // write n-th byte of num
+    for (int i = 3; i>=0; i--)
+    { // write n-th byte of num
       uint8_t to_write = (num>>(i*8)) & 0xff;
       writer->cbor[writer->pt] = to_write;
       writer->pt++;
     }
     return;
   }
-  if (num > (1<<(8))-1) { // We need 2 bytes to encode the num
+  if (num > (1<<(8))-1)
+  { // We need 2 bytes to encode the num
     major += 0x19; // reserving those bytes
     writer->cbor[writer->pt] = major;
     writer->pt++;
-    for (int i = 1; i>=0; i--) { // write n-th byte of num
+    for (int i = 1; i>=0; i--)
+    { // write n-th byte of num
       uint8_t to_write = (num>>(i*8)) & 0xff;
       writer->cbor[writer->pt] = to_write;
       writer->pt++;
     }
     return;
   }
-  if (num > 23) { // byte is enough, but aditional value would be too big
+  if (num > 23)
+  { // byte is enough, but aditional value would be too big
     major += 0x18; // reserving that byte
     writer->cbor[writer->pt] = major;
     writer->pt++;
@@ -110,8 +126,10 @@ void write_item(struct cbor_writer *writer, int8_t major, int num) {
   writer->pt++;
 }
 
-void check_memory(struct cbor_writer *writer, int add_size) {
-  if (writer->capacity - writer->pt-add_size < 0) {
+void check_memory(struct cbor_writer *writer, int add_size)
+{
+  if (writer->capacity - writer->pt-add_size < 0)
+  {
     bug("There is not enough space for cbor response in given buffer");
   }
 }
index 680c4f882a5124786e49d1d976b57e33510a2d91..9a029227d77811b8c23ae6182b0114ddf151c5e6 100644 (file)
@@ -5,16 +5,35 @@
 #include "nest/cli.h"
 #include "conf/conf.h"
 #include "lib/string.h"
-#include "lib/resource.h"
 #include "filter/filter.h"
 
 
+struct cbor_show_data {
+  int type;    /* Symbols type to show */
+  int name_length;
+  char *name;
+};
+
+uint compare_str(byte *str1, uint length, char *str2) {
+  if (length != strlen(str2)) {
+    return 0;
+  }
+  for (size_t i = 0; i < length; i++) {
+    if (str1[i]!=str2[i]) {
+      return 0;
+    }
+  }
+  return 1;
+}
+
+
 extern pool *rt_table_pool;
 extern pool *rta_pool;
 extern uint *pages_kept;
 
 uint
-cmd_show_memory_cbor(byte *tbuf, uint capacity) {
+cmd_show_memory_cbor(byte *tbuf, uint capacity)
+{
   log("in cmd_show_memory_cbor");
   struct cbor_writer *w = cbor_init(tbuf, capacity, lp_new(proto_pool));
   cbor_open_block_with_length(w, 1);
@@ -51,3 +70,104 @@ cmd_show_memory_cbor(byte *tbuf, uint capacity) {
   cbor_write_to_file(w, "show_memory.cbor");
   return w->pt;
 }
+
+extern int shutting_down;
+extern int configuring;
+
+uint
+cmd_show_status_cbor(byte *tbuf, uint capacity)
+{
+  struct cbor_writer *w = cbor_init(tbuf, capacity, lp_new(proto_pool));
+  cbor_open_block_with_length(w, 1);
+  cbor_add_string(w, "show_status:message");
+
+  cbor_open_block_with_length(w, 3);
+  cbor_string_string(w, "version", BIRD_VERSION);
+  cbor_add_string(w, "body");
+  cbor_open_block(w);
+  cbor_string_int(w, "router_id", config->router_id);
+  cbor_string_string(w, "hostname", config->hostname);
+  cbor_string_int(w, "server_time", current_time());
+  cbor_string_int(w, "last_reboot", boot_time);
+  cbor_string_int(w, "last_reconfiguration", config->load_time);
+  if (is_gr_active())
+  {
+    cbor_add_string(w, "gr_restart");
+    cbor_open_block_with_length(w, 2);
+    cbor_string_int(w, "waiting_for_n_channels_to_recover", get_graceful_restart_locks_num());
+    cbor_add_string(w, "wait_timer");
+    cbor_open_block_with_length(w, 2);
+    cbor_string_int(w, "remains", get_tm_remains_gr_wait_timer());
+    cbor_string_int(w, "count_time", get_config_gr_wait());
+  }
+  cbor_close_block_or_list(w);
+  cbor_add_string(w, "state");
+  if (shutting_down)
+    cbor_add_string(w, "Shutdown in progress");
+  else if (configuring)
+    cbor_add_string(w, "Reconfiguration in progress");
+  else
+    cbor_add_string(w, "Daemon is up and running");
+  cbor_write_to_file(w, "test.cbor");
+  return w->pt;
+}
+
+int
+cmd_show_symbols_cbor(byte *tbuf, uint capacity, struct cbor_show_data show)
+{
+  struct cbor_writer *w = cbor_init(tbuf, capacity, lp_new(proto_pool));
+  cbor_open_block_with_length(w, 1);
+  cbor_add_string(w, "show_symbols:message");
+  cbor_open_block_with_length(w, 1);
+
+  if (show.type == -1)
+  {
+    cbor_add_string(w, "table");
+    cbor_open_list_with_length(w, 1);
+    cbor_open_block_with_length(w, 2);
+
+    for (const struct sym_scope *scope = config->root_scope; scope; scope = scope->next)
+    {
+      HASH_WALK(scope->hash, next, sym)
+      {
+       if (compare_str(show.name, show.name_length, sym->name))
+       {
+         cbor_string_string(w, "name", show.name);
+         cbor_string_string(w, "type", cf_symbol_class_name(sym));
+         return w->pt;
+        }
+      }
+      HASH_WALK_END;
+    }
+    cbor_string_string(w, "name", show.name);
+    cbor_string_string(w, "type", "symbol not known");
+    return w->pt;
+  }
+
+  else
+  {
+    cbor_add_string(w, "table");
+    cbor_open_list(w);
+    for (const struct sym_scope *scope = config->root_scope; scope; scope = scope->next)
+      HASH_WALK(scope->hash, next, sym)
+      {
+        if (!sym->scope->active)
+          continue;
+
+        if (show.type != SYM_VOID && (sym->class != show.type))
+          continue;
+
+        cbor_open_block_with_length(w, 2);
+       cbor_string_string(w, "name", sym->name);
+        cbor_string_string(w, "type", cf_symbol_class_name(sym));
+      }
+      HASH_WALK_END;
+
+    cbor_close_block_or_list(w);
+    return w->pt;
+  }
+}
+
+
+
+
index 80b82c844ccf109bbc82f89d518506e2afb1050f..3bc62e4e6934d7cbb5fe660bebf2ba4d2930bd5b 100644 (file)
@@ -1,8 +1,9 @@
 #include "nest/cbor_cmds.c"
 
 enum functions {
-  SHOW_STATUS=0,
-  SHOW_MEMORY=1,
+  SHOW_STATUS = 0,
+  SHOW_MEMORY = 1,
+  SHOW_SYMBOLS = 2,
 };
 
 enum cbor_majors {
@@ -28,9 +29,21 @@ struct buff_reader {
   uint size;
 };
 
+uint compare_buff_str(struct buff_reader *buf_read, uint length, char *string) {
+  if (length != strlen(string)) {
+    return 0;
+  }
+  for (size_t i = 0; i < strlen(string); i++) {
+    if (buf_read->buff[i+buf_read->pt]!=string[i]) {
+      return 0;
+    }
+  }
+  return 1;
+}
 
 struct value
-get_value(struct buff_reader *reader) {
+get_value(struct buff_reader *reader)
+{
   struct value val;
   byte *buff = reader->buff;
   val.major = buff[reader->pt]>>5;
@@ -39,65 +52,153 @@ get_value(struct buff_reader *reader) {
   if (first_byte_val <=23) {
     val.val = first_byte_val;
     reader->pt++;
-  } else if (first_byte_val == 0x18) {
+  } else if (first_byte_val == 0x18)
+  {
     val.val = buff[reader->pt+1];
     reader->pt+=2;
-  } else if (first_byte_val == 0x19) {
+  } else if (first_byte_val == 0x19)
+  {
     val.val = buff[reader->pt+1]>>8 + buff[reader->pt+2];
     reader->pt+=3;
-  } else if (first_byte_val == 0x1a) {
+  } else if (first_byte_val == 0x1a)
+  {
     val.val = buff[reader->pt+1]>>24 + buff[reader->pt+2]>>16 + buff[reader->pt+3]>>8 + buff[reader->pt+4];
     reader->pt+=5;
-  } else if (first_byte_val == 0xff) {
+  } else if (first_byte_val == 0xff)
+  {
     val.val = -1;
     reader->pt++;
   }
   return val;
 }
 
-uint compare_str(struct buff_reader *buf_read, uint length, char *string) {
-  if (length != strlen(string)) {
-    return 0;
+
+int val_is_break(struct value val)
+{
+  return val.major == FLOAT && val.val == -1; // break code is 0xff, so the major is same for float and break
+}
+
+void skip_optional_args(struct buff_reader *rbuf_read, int items_in_block)
+{
+  // We are skipping sequence <"args":{}> or empty sequence <>. It can might empty in block length 1 (items_in_block == 0), or undefined length block. "args" might be empty the same way.
+  if (items_in_block == 0)
+  {
+    return;
   }
-  for (size_t i = 0; i < strlen(string); i++) {
-    if (buf_read->buff[i+buf_read->pt]!=string[i]) {
-      return 0;
+  struct value val = get_value(rbuf_read);
+  if (val.major == TEXT)
+  {  //Since the list args is optional, we need to know if it is here and check if it is empty.
+    ASSERT(compare_buff_str(rbuf_read, val.val, "args"));
+    rbuf_read->pt+=val.val;
+    val = get_value(rbuf_read);
+    ASSERT(val.major == ARRAY);
+    ASSERT(val.val <=0);
+    if (val.val ==-1)
+    { // list open with unspecified size, but we know there should be none for show memory (but, of course, we know it because of the show memory function, not because of yang)
+      val = get_value(rbuf_read);
+      ASSERT(val_is_break(val));
     }
+  } else
+  {
+    ASSERT(items_in_block == -1); // assert the  block was not open to exact num of items, because it cant be just for command (we would returned) and we did not find more items.
+    rbuf_read->pt--; // we read one byte from future, we need to shift pointer back. The val should be break, but we are not going to close the block, because it was not opened here.
   }
-  return 1;
 }
 
-int val_is_break(struct value val) {
-  return val.major == FLOAT && val.val == -1; // break code is 0xff, so the major is same for float and break
+void parse_show_symbols_args(struct buff_reader *rbuf_read, int items_in_block, struct cbor_show_data *arg)
+{
+  log("parse symbols args");
+  char *params[] = {"table", "filter", "function", "protocol", "template"};
+  int param_vals[] = {SYM_TABLE, SYM_FILTER, SYM_FUNCTION, SYM_PROTO, SYM_TEMPLATE};  // defined in conf.h
+  arg->type = SYM_VOID; // default option
+  arg->name = NULL;
+  if (items_in_block == 0)
+  { // there should not be arg array
+    return;
+  }
+  struct value val = get_value(rbuf_read);
+  if (val.major == TEXT)
+  {
+    log("text");
+    ASSERT(compare_buff_str(rbuf_read, val.val, "args"));
+    log("args");
+    rbuf_read->pt+=val.val;
+    val = get_value(rbuf_read);
+    ASSERT(val.major == ARRAY);
+    int num_array_items = val.val;
+    log("num arr items %i", num_array_items);
+    for (int i = 0; i<num_array_items || (num_array_items == -1 && !val_is_break(val)); i++)
+    {
+      // There will be only one argument in struct cbor_show_data arg after parsing the array of args. Current bird cli is behaving this way too.
+      val = get_value(rbuf_read);
+      if (val_is_break(val))
+      {
+        rbuf_read->pt--;
+      }
+      else if (val.major == BLOCK)
+      {
+        int wait_close = val.val == -1;
+        if (!wait_close)
+        {
+          ASSERT(val.val==1);
+        }
+        val = get_value(rbuf_read);
+        ASSERT(compare_buff_str(rbuf_read, val.val, "arg"));
+        rbuf_read->pt+=val.val;
+        val = get_value(rbuf_read);
+        ASSERT(val.major == TEXT);
+        int found = 0;
+        for (size_t j = 0; j < sizeof(params)/sizeof(char*) && found == 0; j++)
+        {
+          if (compare_buff_str(rbuf_read, val.val, params[j]))
+          {
+            arg->type = param_vals[j];
+            found = 1;
+            log("found %s, on %i val %i", params[j], j, param_vals[j]);
+          }
+        }
+        if (found == 0)
+        {
+          arg->type = -1;
+          arg->name = rbuf_read->buff + rbuf_read->pt;
+          arg->name_length = val.val;
+        }
+        rbuf_read->pt+=val.val;
+        if (wait_close)
+        {
+          val = get_value(rbuf_read);
+          ASSERT(val_is_break(val));
+        }
+      }
+      else
+      {
+        ASSERT(0);
+      }
+    }
+  } else
+  {
+    ASSERT(items_in_block == -1); // assert the  block was not open to exact num of items, because it cant be just for command (we would returned) and we did not find more items.
+    rbuf_read->pt--; // we read one byte from future, we need to shift pointer back
+  }
 }
 
 uint
-do_command(struct buff_reader *rbuf_read, struct buff_reader *tbuf_read, int items_in_block) {
-  struct value val= get_value(rbuf_read);
+do_command(struct buff_reader *rbuf_read, struct buff_reader *tbuf_read, int items_in_block)
+{
+  struct value val = get_value(rbuf_read);
   ASSERT(val.major == UINT);
   switch (val.val)
   {
     case SHOW_MEMORY:
-      if (items_in_block != 0) {
-        val = get_value(rbuf_read);
-        if (val.major == TEXT) {  //Since the list args is optional, we need to know if it is here and check if it is empty.
-          ASSERT(compare_str(rbuf_read, val.val, "args"));
-          rbuf_read->pt+=val.val;
-          val = get_value(rbuf_read);
-          ASSERT(val.major == ARRAY);
-          ASSERT(val.val <=0);
-          if (val.val ==-1) { // list open with unspecified size, but we know there should be none for show memory (but, of course, we know it because of the show memory function, not because of yang) 
-            val = get_value(rbuf_read);
-            ASSERT(val_is_break(val)); 
-          }
-        } else {
-          ASSERT(items_in_block == -1); // assert the  block was not open to exactly two items (we do not have args list and there is no chance to have another item in the block)
-          rbuf_read->pt--; // we read one byte from future, we need to shift pointer back
-        }
-      }
+      skip_optional_args(rbuf_read, items_in_block);
       return cmd_show_memory_cbor(tbuf_read->buff, tbuf_read->size);
     case SHOW_STATUS:
-      return 0;
+      skip_optional_args(rbuf_read, items_in_block);
+      return cmd_show_status_cbor(tbuf_read->buff, tbuf_read->size);
+    case SHOW_SYMBOLS:
+      struct cbor_show_data arg;
+      parse_show_symbols_args(rbuf_read, items_in_block, &arg);
+      return cmd_show_symbols_cbor(tbuf_read->buff, tbuf_read->size, arg);
     default:
       return 0;
   }
@@ -105,7 +206,8 @@ do_command(struct buff_reader *rbuf_read, struct buff_reader *tbuf_read, int ite
 
 
 uint
-parse_cbor(uint size, byte *rbuf, byte *tbuf, uint tbsize) {
+parse_cbor(uint size, byte *rbuf, byte *tbuf, uint tbsize)
+{
   log("cbor parse");
   struct buff_reader rbuf_read;
   struct buff_reader tbuf_read;
@@ -116,18 +218,21 @@ parse_cbor(uint size, byte *rbuf, byte *tbuf, uint tbsize) {
   rbuf_read.pt = 0;
   tbuf_read.pt = 0;
 
-  if (size == 0) {
+  if (size == 0)
+  {
     return 0;
   }
   struct value val = get_value(&rbuf_read);
   ASSERT(val.major == BLOCK);
   ASSERT(val.val <=1);
   int wait_for_end_main_block = val.val == -1;
-  if (val.val != 0) {
+  if (val.val != 0)
+  {
     val = get_value(&rbuf_read);
-    if ( !( wait_for_end_main_block == -1 && val_is_break(val) )) {
+    if ( !( wait_for_end_main_block == -1 && val_is_break(val) ))
+    {
       ASSERT(val.major == TEXT);
-      ASSERT(compare_str(&rbuf_read, val.val, "command:do"));
+      ASSERT(compare_buff_str(&rbuf_read, val.val, "command:do")); // this should be mandatory in yang, but when i marked it mandatory, it destroyed all other yangs (required command in all other modules)
       rbuf_read.pt+=val.val;
 
       val = get_value(&rbuf_read);
@@ -138,11 +243,12 @@ parse_cbor(uint size, byte *rbuf, byte *tbuf, uint tbsize) {
       val = get_value(&rbuf_read);
       ASSERT(val.major == TEXT);
       items_in_block--;
-      ASSERT(compare_str(&rbuf_read, val.val, "command"));
+      ASSERT(compare_buff_str(&rbuf_read, val.val, "command"));
       rbuf_read.pt+=val.val;
 
       tbuf_read.pt = do_command(&rbuf_read, &tbuf_read, items_in_block);
-      if (items_in_block == -1) {
+      if (items_in_block == -1)
+      {
         val = get_value(&rbuf_read);
         ASSERT(val.major == FLOAT && val.val == -1);
       }
index cf283125c3fe74d5529d90b7630b5332d6a350bf..5c8955cae905d137cba45dff8726871dc9a12bf3 100644 (file)
@@ -4,7 +4,7 @@
 #include "nest/cbor.c"
 
 
-void cbor_string_string(struct cbor_writer *writer, char *key, char *value) {
+void cbor_string_string(struct cbor_writer *writer, char *key, const char *value) {
   cbor_add_string(writer, key);
   cbor_add_string(writer, value);
 }
index 609235d17ec321b39771ec9fc59b3f22ee1d72a4..8214db5fb93e7b29aeefc2bfc913faadb0e12cc5 100644 (file)
@@ -42,33 +42,6 @@ cmd_show_status(void)
     cli_msg(13, "Reconfiguration in progress");
   else
     cli_msg(13, "Daemon is up and running");
-
-
-  /*struct cbor_writer *w = cbor_init(lp_new(proto_pool), 1000);
-  cbor_open_block_with_length(w, 1);
-  cbor_add_string(w, "show_status:message");
-
-  cbor_open_block_with_length(w, 3);
-  cbor_string_string(w, "BIRD", BIRD_VERSION);
-  cbor_add_string(w, "body");
-  cbor_open_block(w);
-  cbor_string_int(w, "router_id", config->router_id);
-  cbor_string_string(w, "hostname", config->hostname);
-  cbor_string_string(w, "server_time", current_time());
-  tm_format_time(time, &config->tf_base, boot_time);
-  cbor_string_int(w, "last_reboot", boot_time);
-  cbor_string_string(w, "last_reconfiguration", config->load_time);
-  
-  // TODO graceful restart
-  cbor_close_block_or_list(w);
-  cbor_add_string(w, "state");
-  if (shutting_down)
-    cbor_add_string(w, "Shutdown in progress");
-  else if (configuring)
-    cbor_add_string(w, "Reconfiguration in progress");
-  else
-    cbor_add_string(w, "Daemon is up and running");
-  cbor_write_to_file(w, "test.cbor");*/
 }
 
 void
index 88f4813ef572de5ca5a92cd360e4ca3dbf062815..04b53b06ce8fc68cbfa48e4a453b8262386111f6 100644 (file)
@@ -1630,6 +1630,30 @@ graceful_restart_show_status(void)
   cli_msg(-24, "  Wait timer is %t/%u", tm_remains(gr_wait_timer), config->gr_wait);
 }
 
+int
+is_gr_active(void)
+{
+  return graceful_restart_state == GRS_ACTIVE;
+}
+
+int
+get_graceful_restart_locks_num(void)
+{
+  return graceful_restart_locks;
+}
+
+int
+get_tm_remains_gr_wait_timer(void)
+{
+  return tm_remains(gr_wait_timer);
+}
+
+int
+get_config_gr_wait(void)
+{
+  return config->gr_wait;
+}
+
 /**
  * channel_graceful_restart_lock - lock graceful restart by channel
  * @p: channel instance
index c87d38148005deaea1ced73545fb291540031335..c8ba68e1eb178913f412e3b3d82208d9f8541c97 100644 (file)
@@ -277,6 +277,10 @@ void proto_set_message(struct proto *p, char *msg, int len);
 void graceful_restart_recovery(void);
 void graceful_restart_init(void);
 void graceful_restart_show_status(void);
+int is_gr_active(void);
+int get_graceful_restart_locks_num(void);
+int get_tm_remains_gr_wait_timer(void);
+int get_config_gr_wait(void);
 void channel_graceful_restart_lock(struct channel *c);
 void channel_graceful_restart_unlock(struct channel *c);
 
index 2959c55e34c01c2f1e50871f95ace1158497f153..b32db975ca6200e8bfc0213a42f5c36510c16345 100644 (file)
@@ -1 +1 @@
-¡jcommand:do¢gcommand\ 1dargs\80
\ No newline at end of file
+¡jcommand:do¢gcommand\ 2dargs\81¡carghprotocol
\ No newline at end of file
index b2db15485c6486080982cbe5ffad01870225c39f..e43f8f3ce80ba1ce7ed08a5b84ae3da9292238ad 100644 (file)
@@ -1,2 +1,2 @@
-{"command:do":{"command": 1, "args":[]}}
+{"command:do":{"command": 2, "args":[{"arg":"protocol"}]}}
 
index c7602106a7a77bccfc6381f8b699ede7d6e4b837..c1ec21713cd27e7a535b4ab04de2ea7622e5f916 100644 (file)
@@ -1,12 +1,11 @@
 module command {
 
-  namespace ".";
+  namespace "command";
   
   prefix "command";
 
   container do {
     leaf command {
-      mandatory true;
       type uint32;
     }
     list args {
index 3c524475c83c1766a2a9f5f5de8fbe87cff8fafa..7c2070223ae66bdee9064b4eb95ded24cfad915e 100644 (file)
Binary files a/yang/show_memory.cbor and b/yang/show_memory.cbor differ
index 4f06d1d15f097ca56fa6e52018418a840de7757a..546605cedc0e7c03a1940c9a3ead7a90bd64cd74 100644 (file)
@@ -1,31 +1,13 @@
 {
-  "show_memory:message": {
-    "header": "BIRD memory usage",
+  "show_status:message": {
+    "version": "v2.14-23-gd91390e2-x",
     "body": {
-      "routing_tables": {
-        "effective": 34604,
-        "overhead": 2848
-      },
-      "route_attributes": {
-        "effective": 26826,
-        "overhead": 13448
-      },
-      "protocols": {
-        "effective": 63564,
-        "overhead": 15312
-      },
-      "current_config": {
-        "effective": 299744,
-        "overhead": 2152
-      },
-      "standby_memory": {
-        "effective": 0,
-        "overhead": 348160
-      },
-      "total": {
-        "effective": 506754,
-        "overhead": 388960
-      }
-    }
+      "router_id": 167772417,
+      "hostname": "kkubecova-ntb",
+      "server_time": 208154921,
+      "last_reboot": 197746045,
+      "last_reconfiguration": 197746045
+    },
+    "state": "Daemon is up and running"
   }
 }
\ No newline at end of file
index e89be0ed749cc09fb40a7aab97b7c8c5b1271863..14a42da08f57b0c48ad1ad9f276f428feeb228d1 100644 (file)
@@ -2,7 +2,7 @@ module show_status {
 
   namespace ".";
   
-  prefix "status";
+  prefix "show_status";
 
   description "cli show status format";
 
@@ -15,40 +15,33 @@ module show_status {
 
   grouping timer {
     leaf remains {
-      type decimal64 {
-        fraction-digits 3;
-      }
+      type uint64;
     }
     leaf count_time {
-      type uint32;
+      type uint64;
     }
   }
 
 
   container message {
-    container header {
-      leaf bird {
-        type string;
-      }
-      leaf version {
-        type string;
-      }
+    leaf version {
+      type string;
     }
     container body {
       leaf router_id {
-        type string;
+        type int32;
       }
       leaf hostname {
         type string;
       }
       leaf server_time {
-        type date-and-time;
+        type int32;
       }
       leaf last_reboot {
-        type date-and-time;
+        type int32;
       }
       leaf last_reconfiguration {
-        type date-and-time;
+        type int32;
       }
       container gr_restart {
         leaf waiting_for_n_channels_to_recover {
diff --git a/yang/show_symbols.cbor b/yang/show_symbols.cbor
new file mode 100644 (file)
index 0000000..6dd443c
--- /dev/null
@@ -0,0 +1 @@
+¡tshow_symbols:message¡etable\9f¢dnamegebgp4_1dtypehprotocol¢dnamegebgp6_1dtypehprotocol¢dnamegebgp4_2dtypehprotocol¢dnamegebgp6_2dtypehprotocol¢dnamegstatic6dtypehprotocol¢dnamegstatic4dtypehprotocol¢dnamegkernel6dtypehprotocol¢dnamegkernel4dtypehprotocol¢dnamegdevice1dtypehprotocolÿ
\ No newline at end of file
index 5d3bf135d6c27dc8b088dd79d05f6e0d709608c5..216545c372435e4378bfa13c0335008079fb29a9 100644 (file)
         "revision": "",
         "conformance-type": "implement"
       },
+      {
+        "name": "show_symbols",
+       "namespace": "https://bird.nic.cz/yang/v2.15/cli-debug",
+        "revision": "",
+        "conformance-type": "implement"
+      },
       {
         "name": "show_protocols",
        "namespace": "https://bird.nic.cz/yang/v2.15/cli-debug",