summaryrefslogtreecommitdiffstats
path: root/lib/affinitymap_cli.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/affinitymap_cli.c')
-rw-r--r--lib/affinitymap_cli.c44
1 files changed, 17 insertions, 27 deletions
diff --git a/lib/affinitymap_cli.c b/lib/affinitymap_cli.c
index a2d5e8e..73b91e7 100644
--- a/lib/affinitymap_cli.c
+++ b/lib/affinitymap_cli.c
@@ -30,15 +30,6 @@
#include "lib/affinitymap.h"
#include "lib/affinitymap_cli_clippy.c"
-/* Route map node structure. */
-static int affinity_map_config_write(struct vty *vty);
-static struct cmd_node affinitymap_node = {
- .name = "affinity-map",
- .node = AFFMAP_NODE,
- .prompt = "",
- .config_write = affinity_map_config_write,
-};
-
/* max value is EXT_ADMIN_GROUP_MAX_POSITIONS - 1 */
DEFPY_YANG_NOSH(affinity_map, affinity_map_cmd,
"affinity-map NAME$name bit-position (0-1023)$position",
@@ -75,33 +66,32 @@ DEFPY_YANG_NOSH(no_affinity_map, no_affinity_map_cmd,
return nb_cli_apply_changes(vty, NULL);
}
-static int affinity_map_config_write(struct vty *vty)
-{
- const struct lyd_node *dnode;
- int written = 0;
-
- dnode = yang_dnode_get(running_config->dnode, "/frr-affinity-map:lib");
- if (dnode) {
- nb_cli_show_dnode_cmds(vty, dnode, false);
- written = 1;
- }
-
- return written;
-}
-
-void cli_show_affinity_map(struct vty *vty, const struct lyd_node *dnode,
+static void cli_show_affinity_map(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults __attribute__((__unused__)))
{
vty_out(vty, "affinity-map %s bit-position %u\n",
- yang_dnode_get_string(dnode, "./name"),
- yang_dnode_get_uint16(dnode, "./value"));
+ yang_dnode_get_string(dnode, "name"),
+ yang_dnode_get_uint16(dnode, "value"));
}
+const struct frr_yang_module_info frr_affinity_map_cli_info = {
+ .name = "frr-affinity-map",
+ .ignore_cfg_cbs = true,
+ .nodes = {
+ {
+ .xpath = "/frr-affinity-map:lib/affinity-maps/affinity-map",
+ .cbs.cli_show = cli_show_affinity_map,
+ },
+ {
+ .xpath = NULL,
+ },
+ }
+};
+
/* Initialization of affinity map vector. */
void affinity_map_init(void)
{
/* CLI commands. */
- install_node(&affinitymap_node);
install_element(CONFIG_NODE, &affinity_map_cmd);
install_element(CONFIG_NODE, &no_affinity_map_cmd);
}