mirror of
				https://git.proxmox.com/git/mirror_frr
				synced 2025-11-03 23:47:16 +00:00 
			
		
		
		
	isisd: retrofit the 'dynamic-hostname' command
Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
This commit is contained in:
		
							parent
							
								
									e6bdae69de
								
							
						
					
					
						commit
						6bb043cd0f
					
				@ -383,6 +383,29 @@ void cli_show_isis_is_type(struct vty *vty, struct lyd_node *dnode,
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * XPath: /frr-isisd:isis/instance/dynamic-hostname
 | 
			
		||||
 */
 | 
			
		||||
DEFPY(dynamic_hostname, dynamic_hostname_cmd, "[no] hostname dynamic",
 | 
			
		||||
      NO_STR
 | 
			
		||||
      "Dynamic hostname for IS-IS\n"
 | 
			
		||||
      "Dynamic hostname\n")
 | 
			
		||||
{
 | 
			
		||||
	nb_cli_enqueue_change(vty, "./dynamic-hostname", NB_OP_MODIFY,
 | 
			
		||||
			      no ? "false" : "true");
 | 
			
		||||
 | 
			
		||||
	return nb_cli_apply_changes(vty, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void cli_show_isis_dynamic_hostname(struct vty *vty, struct lyd_node *dnode,
 | 
			
		||||
				    bool show_defaults)
 | 
			
		||||
{
 | 
			
		||||
	if (!yang_dnode_get_bool(dnode, NULL))
 | 
			
		||||
		vty_out(vty, " no");
 | 
			
		||||
 | 
			
		||||
	vty_out(vty, " hostname dynamic\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void isis_cli_init(void)
 | 
			
		||||
{
 | 
			
		||||
	install_element(CONFIG_NODE, &router_isis_cmd);
 | 
			
		||||
@ -396,6 +419,8 @@ void isis_cli_init(void)
 | 
			
		||||
 | 
			
		||||
	install_element(ISIS_NODE, &is_type_cmd);
 | 
			
		||||
	install_element(ISIS_NODE, &no_is_type_cmd);
 | 
			
		||||
 | 
			
		||||
	install_element(ISIS_NODE, &dynamic_hostname_cmd);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif /* ifndef FABRICD */
 | 
			
		||||
 | 
			
		||||
@ -31,5 +31,7 @@ void cli_show_isis_area_address(struct vty *vty, struct lyd_node *dnode,
 | 
			
		||||
				bool show_defaults);
 | 
			
		||||
void cli_show_isis_is_type(struct vty *vty, struct lyd_node *dnode,
 | 
			
		||||
			   bool show_defaults);
 | 
			
		||||
void cli_show_isis_dynamic_hostname(struct vty *vty, struct lyd_node *dnode,
 | 
			
		||||
				    bool show_defaults);
 | 
			
		||||
 | 
			
		||||
#endif /* ISISD_ISIS_CLI_H_ */
 | 
			
		||||
 | 
			
		||||
@ -239,7 +239,14 @@ static int isis_instance_dynamic_hostname_modify(enum nb_event event,
 | 
			
		||||
						 const struct lyd_node *dnode,
 | 
			
		||||
						 union nb_resource *resource)
 | 
			
		||||
{
 | 
			
		||||
	/* TODO: implement me. */
 | 
			
		||||
	struct isis_area *area;
 | 
			
		||||
 | 
			
		||||
	if (event != NB_EV_APPLY)
 | 
			
		||||
		return NB_OK;
 | 
			
		||||
 | 
			
		||||
	area = yang_dnode_get_entry(dnode, true);
 | 
			
		||||
	isis_area_dynhostname_set(area, yang_dnode_get_bool(dnode, NULL));
 | 
			
		||||
 | 
			
		||||
	return NB_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1719,6 +1726,7 @@ const struct frr_yang_module_info frr_isisd_info = {
 | 
			
		||||
		{
 | 
			
		||||
			.xpath = "/frr-isisd:isis/instance/dynamic-hostname",
 | 
			
		||||
			.cbs.modify = isis_instance_dynamic_hostname_modify,
 | 
			
		||||
			.cbs.cli_show = cli_show_isis_dynamic_hostname,
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			.xpath = "/frr-isisd:isis/instance/attached",
 | 
			
		||||
 | 
			
		||||
@ -580,31 +580,6 @@ DEFUN (no_set_attached_bit,
 | 
			
		||||
	return CMD_SUCCESS;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
DEFUN (dynamic_hostname,
 | 
			
		||||
       dynamic_hostname_cmd,
 | 
			
		||||
       "hostname dynamic",
 | 
			
		||||
       "Dynamic hostname for IS-IS\n"
 | 
			
		||||
       "Dynamic hostname\n")
 | 
			
		||||
{
 | 
			
		||||
	VTY_DECLVAR_CONTEXT(isis_area, area);
 | 
			
		||||
 | 
			
		||||
	isis_area_dynhostname_set(area, true);
 | 
			
		||||
	return CMD_SUCCESS;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
DEFUN (no_dynamic_hostname,
 | 
			
		||||
       no_dynamic_hostname_cmd,
 | 
			
		||||
       "no hostname dynamic",
 | 
			
		||||
       NO_STR
 | 
			
		||||
       "Dynamic hostname for IS-IS\n"
 | 
			
		||||
       "Dynamic hostname\n")
 | 
			
		||||
{
 | 
			
		||||
	VTY_DECLVAR_CONTEXT(isis_area, area);
 | 
			
		||||
 | 
			
		||||
	isis_area_dynhostname_set(area, false);
 | 
			
		||||
	return CMD_SUCCESS;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
DEFUN (lsp_gen_interval_level,
 | 
			
		||||
       lsp_gen_interval_level_cmd,
 | 
			
		||||
       "lsp-gen-interval <level-1|level-2> (1-120)",
 | 
			
		||||
@ -785,9 +760,6 @@ void isis_vty_daemon_init(void)
 | 
			
		||||
	install_element(ROUTER_NODE, &set_attached_bit_cmd);
 | 
			
		||||
	install_element(ROUTER_NODE, &no_set_attached_bit_cmd);
 | 
			
		||||
 | 
			
		||||
	install_element(ROUTER_NODE, &dynamic_hostname_cmd);
 | 
			
		||||
	install_element(ROUTER_NODE, &no_dynamic_hostname_cmd);
 | 
			
		||||
 | 
			
		||||
	install_element(ROUTER_NODE, &lsp_gen_interval_level_cmd);
 | 
			
		||||
	install_element(ROUTER_NODE, &no_lsp_gen_interval_level_cmd);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user