diff options
Diffstat (limited to 'lib/if.c')
| -rw-r--r-- | lib/if.c | 33 |
1 files changed, 27 insertions, 6 deletions
@@ -423,7 +423,7 @@ struct interface *if_lookup_by_name_vrf(const char *name, struct vrf *vrf) return RB_FIND(if_name_head, &vrf->ifaces_by_name, &if_tmp); } -struct interface *if_lookup_by_name_all_vrf(const char *name) +static struct interface *if_lookup_by_name_all_vrf(const char *name) { struct vrf *vrf; struct interface *ifp; @@ -1255,8 +1255,8 @@ DEFPY_YANG (no_interface, ifname, vrf_name); } -static void cli_show_interface(struct vty *vty, struct lyd_node *dnode, - bool show_defaults) +static void cli_show_interface(struct vty *vty, const struct lyd_node *dnode, + bool show_defaults) { const char *vrf; @@ -1269,7 +1269,8 @@ static void cli_show_interface(struct vty *vty, struct lyd_node *dnode, vty_out(vty, "\n"); } -static void cli_show_interface_end(struct vty *vty, struct lyd_node *dnode) +static void cli_show_interface_end(struct vty *vty, + const struct lyd_node *dnode) { vty_out(vty, "exit\n"); } @@ -1305,8 +1306,9 @@ DEFPY_YANG (no_interface_desc, return nb_cli_apply_changes(vty, NULL); } -static void cli_show_interface_desc(struct vty *vty, struct lyd_node *dnode, - bool show_defaults) +static void cli_show_interface_desc(struct vty *vty, + const struct lyd_node *dnode, + bool show_defaults) { vty_out(vty, " description %s\n", yang_dnode_get_string(dnode, NULL)); } @@ -1339,6 +1341,20 @@ static struct cmd_node interface_node = { .prompt = "%s(config-if)# ", }; +static int if_config_write_single(const struct lyd_node *dnode, void *arg) +{ + nb_cli_show_dnode_cmds(arg, dnode, false); + + return YANG_ITER_CONTINUE; +} + +static int if_nb_config_write(struct vty *vty) +{ + yang_dnode_iterate(if_config_write_single, vty, running_config->dnode, + "/frr-interface:lib/interface"); + return 1; +} + void if_cmd_init(int (*config_write)(struct vty *)) { cmd_variable_handler_register(if_var_handlers); @@ -1354,6 +1370,11 @@ void if_cmd_init(int (*config_write)(struct vty *)) install_element(INTERFACE_NODE, &no_interface_desc_cmd); } +void if_cmd_init_default(void) +{ + if_cmd_init(if_nb_config_write); +} + void if_zapi_callbacks(int (*create)(struct interface *ifp), int (*up)(struct interface *ifp), int (*down)(struct interface *ifp), |
