diff options
| author | Igor Ryzhov <iryzhov@nfware.com> | 2021-04-26 21:13:08 +0300 | 
|---|---|---|
| committer | Igor Ryzhov <iryzhov@nfware.com> | 2021-04-29 17:05:21 +0300 | 
| commit | 1457b1d5dfe8e762487641667ee448b287e9c813 (patch) | |
| tree | b5aafd28b605c6223bd5bd28e9d1e99724fe68ee | |
| parent | aaf8e80994d431b66b4930d221f2743f0b57da6f (diff) | |
isisd, yang: remove vrf leaf from isis interface node
This is very confusing and incorrect. We can and should use vrf leaf of
the interface itself instead.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
| -rw-r--r-- | doc/user/isisd.rst | 2 | ||||
| -rw-r--r-- | isisd/isis_cli.c | 64 | ||||
| -rw-r--r-- | isisd/isis_nb.c | 7 | ||||
| -rw-r--r-- | isisd/isis_nb.h | 1 | ||||
| -rw-r--r-- | isisd/isis_nb_config.c | 48 | ||||
| -rw-r--r-- | yang/frr-isisd.yang | 7 | 
6 files changed, 38 insertions, 91 deletions
diff --git a/doc/user/isisd.rst b/doc/user/isisd.rst index ef2bf16166..c1bdd9a694 100644 --- a/doc/user/isisd.rst +++ b/doc/user/isisd.rst @@ -172,7 +172,7 @@ ISIS interface  .. _ip-router-isis-word: -.. clicmd:: <ip|ipv6> router isis WORD [vrf NAME] +.. clicmd:: <ip|ipv6> router isis WORD     Activate ISIS adjacency on this interface. Note that the name of ISIS     instance must be the same as the one used to configure the ISIS process (see diff --git a/isisd/isis_cli.c b/isisd/isis_cli.c index 5afce94b33..9f42a82a1a 100644 --- a/isisd/isis_cli.c +++ b/isisd/isis_cli.c @@ -153,15 +153,16 @@ void cli_show_router_isis(struct vty *vty, struct lyd_node *dnode,   * XPath: /frr-isisd:isis/instance   */  DEFPY_YANG(ip_router_isis, ip_router_isis_cmd, -	   "ip router isis WORD$tag [vrf NAME$vrf_name]", +	   "ip router isis WORD$tag",  	   "Interface Internet Protocol config commands\n"  	   "IP router interface commands\n"  	   "IS-IS routing protocol\n" -	   "Routing process tag\n" VRF_CMD_HELP_STR) +	   "Routing process tag\n")  {  	char inst_xpath[XPATH_MAXLEN];  	struct lyd_node *if_dnode, *inst_dnode;  	const char *circ_type = NULL; +	const char *vrf_name;  	struct interface *ifp;  	if_dnode = yang_dnode_get(vty->candidate_config->dnode, VTY_CURR_XPATH); @@ -186,8 +187,6 @@ DEFPY_YANG(ip_router_isis, ip_router_isis_cmd,  	nb_cli_enqueue_change(vty, "./frr-isisd:isis", NB_OP_CREATE, NULL);  	nb_cli_enqueue_change(vty, "./frr-isisd:isis/area-tag", NB_OP_MODIFY,  			      tag); -	nb_cli_enqueue_change(vty, "./frr-isisd:isis/vrf", NB_OP_MODIFY, -			      vrf_name);  	nb_cli_enqueue_change(vty, "./frr-isisd:isis/ipv4-routing",  			      NB_OP_MODIFY, "true");  	if (circ_type) @@ -203,16 +202,24 @@ DEFPY_YANG(ip_router_isis, ip_router_isis_cmd,  	return nb_cli_apply_changes(vty, NULL);  } +ALIAS_HIDDEN(ip_router_isis, ip_router_isis_vrf_cmd, +	     "ip router isis WORD$tag vrf NAME$vrf_name", +	     "Interface Internet Protocol config commands\n" +	     "IP router interface commands\n" +	     "IS-IS routing protocol\n" +	     "Routing process tag\n" VRF_CMD_HELP_STR) +  DEFPY_YANG(ip6_router_isis, ip6_router_isis_cmd, -	   "ipv6 router isis WORD$tag [vrf NAME$vrf_name]", +	   "ipv6 router isis WORD$tag",  	   "Interface Internet Protocol config commands\n"  	   "IP router interface commands\n"  	   "IS-IS routing protocol\n" -	   "Routing process tag\n" VRF_CMD_HELP_STR) +	   "Routing process tag\n")  {  	char inst_xpath[XPATH_MAXLEN];  	struct lyd_node *if_dnode, *inst_dnode;  	const char *circ_type = NULL; +	const char *vrf_name;  	struct interface *ifp;  	if_dnode = yang_dnode_get(vty->candidate_config->dnode, VTY_CURR_XPATH); @@ -237,8 +244,6 @@ DEFPY_YANG(ip6_router_isis, ip6_router_isis_cmd,  	nb_cli_enqueue_change(vty, "./frr-isisd:isis", NB_OP_CREATE, NULL);  	nb_cli_enqueue_change(vty, "./frr-isisd:isis/area-tag", NB_OP_MODIFY,  			      tag); -	nb_cli_enqueue_change(vty, "./frr-isisd:isis/vrf", NB_OP_MODIFY, -			      vrf_name);  	nb_cli_enqueue_change(vty, "./frr-isisd:isis/ipv6-routing",  			      NB_OP_MODIFY, "true");  	if (circ_type) @@ -254,15 +259,21 @@ DEFPY_YANG(ip6_router_isis, ip6_router_isis_cmd,  	return nb_cli_apply_changes(vty, NULL);  } +ALIAS_HIDDEN(ip6_router_isis, ip6_router_isis_vrf_cmd, +	     "ipv6 router isis WORD$tag vrf NAME$vrf_name", +	     "Interface Internet Protocol config commands\n" +	     "IP router interface commands\n" +	     "IS-IS routing protocol\n" +	     "Routing process tag\n" VRF_CMD_HELP_STR) +  DEFPY_YANG(no_ip_router_isis, no_ip_router_isis_cmd, -	   "no <ip|ipv6>$ip router isis [WORD]$tag [vrf NAME$vrf_name]", +	   "no <ip|ipv6>$ip router isis [WORD]$tag",  	   NO_STR  	   "Interface Internet Protocol config commands\n"  	   "IP router interface commands\n"  	   "IP router interface commands\n"  	   "IS-IS routing protocol\n" -	   "Routing process tag\n" -	   VRF_CMD_HELP_STR) +	   "Routing process tag\n")  {  	const struct lyd_node *dnode; @@ -295,36 +306,32 @@ DEFPY_YANG(no_ip_router_isis, no_ip_router_isis_cmd,  	return nb_cli_apply_changes(vty, NULL);  } +ALIAS_HIDDEN(no_ip_router_isis, no_ip_router_isis_vrf_cmd, +	     "no <ip|ipv6>$ip router isis WORD$tag vrf NAME$vrf_name", +	     NO_STR +	     "Interface Internet Protocol config commands\n" +	     "IP router interface commands\n" +	     "IP router interface commands\n" +	     "IS-IS routing protocol\n" +	     "Routing process tag\n" +	     VRF_CMD_HELP_STR) +  void cli_show_ip_isis_ipv4(struct vty *vty, struct lyd_node *dnode,  			   bool show_defaults)  { -	const char *vrf; - -	vrf = yang_dnode_get_string(dnode, "../vrf"); -  	if (!yang_dnode_get_bool(dnode, NULL))  		vty_out(vty, " no"); -	vty_out(vty, " ip router isis %s", +	vty_out(vty, " ip router isis %s\n",  		yang_dnode_get_string(dnode, "../area-tag")); -	if (!strmatch(vrf, VRF_DEFAULT_NAME)) -		vty_out(vty, " vrf %s", vrf); -	vty_out(vty, "\n");  }  void cli_show_ip_isis_ipv6(struct vty *vty, struct lyd_node *dnode,  			   bool show_defaults)  { -	const char *vrf; - -	vrf = yang_dnode_get_string(dnode, "../vrf"); -  	if (!yang_dnode_get_bool(dnode, NULL))  		vty_out(vty, " no"); -	vty_out(vty, " ipv6 router isis %s", +	vty_out(vty, " ipv6 router isis %s\n",  		yang_dnode_get_string(dnode, "../area-tag")); -	if (!strmatch(vrf, VRF_DEFAULT_NAME)) -		vty_out(vty, " vrf %s", vrf); -	vty_out(vty, "\n");  }  /* @@ -3174,8 +3181,11 @@ void isis_cli_init(void)  	install_element(CONFIG_NODE, &no_router_isis_cmd);  	install_element(INTERFACE_NODE, &ip_router_isis_cmd); +	install_element(INTERFACE_NODE, &ip_router_isis_vrf_cmd);  	install_element(INTERFACE_NODE, &ip6_router_isis_cmd); +	install_element(INTERFACE_NODE, &ip6_router_isis_vrf_cmd);  	install_element(INTERFACE_NODE, &no_ip_router_isis_cmd); +	install_element(INTERFACE_NODE, &no_ip_router_isis_vrf_cmd);  	install_element(INTERFACE_NODE, &isis_bfd_cmd);  	install_element(INTERFACE_NODE, &isis_bfd_profile_cmd); diff --git a/isisd/isis_nb.c b/isisd/isis_nb.c index 227724934b..4eac8de2cb 100644 --- a/isisd/isis_nb.c +++ b/isisd/isis_nb.c @@ -686,13 +686,6 @@ const struct frr_yang_module_info frr_isisd_info = {  			},  		},  		{ -			.xpath = "/frr-interface:lib/interface/frr-isisd:isis/vrf", -			.cbs = { -				.modify = lib_interface_isis_vrf_modify, -			}, -		}, - -		{  			.xpath = "/frr-interface:lib/interface/frr-isisd:isis/circuit-type",  			.cbs = {  				.cli_show = cli_show_ip_isis_circ_type, diff --git a/isisd/isis_nb.h b/isisd/isis_nb.h index a6841b9fd4..94aa00c975 100644 --- a/isisd/isis_nb.h +++ b/isisd/isis_nb.h @@ -214,7 +214,6 @@ int isis_instance_mpls_te_router_address_destroy(  int lib_interface_isis_create(struct nb_cb_create_args *args);  int lib_interface_isis_destroy(struct nb_cb_destroy_args *args);  int lib_interface_isis_area_tag_modify(struct nb_cb_modify_args *args); -int lib_interface_isis_vrf_modify(struct nb_cb_modify_args *args);  int lib_interface_isis_ipv4_routing_modify(struct nb_cb_modify_args *args);  int lib_interface_isis_ipv6_routing_modify(struct nb_cb_modify_args *args);  int lib_interface_isis_circuit_type_modify(struct nb_cb_modify_args *args); diff --git a/isisd/isis_nb_config.c b/isisd/isis_nb_config.c index 5cad9fcfcb..58a3304629 100644 --- a/isisd/isis_nb_config.c +++ b/isisd/isis_nb_config.c @@ -2437,9 +2437,7 @@ int lib_interface_isis_create(struct nb_cb_create_args *args)  	struct isis_area *area = NULL;  	struct interface *ifp;  	struct isis_circuit *circuit = NULL; -	struct vrf *vrf;  	const char *area_tag = yang_dnode_get_string(args->dnode, "./area-tag"); -	const char *vrf_name = yang_dnode_get_string(args->dnode, "./vrf");  	uint32_t min_mtu, actual_mtu;  	switch (args->event) { @@ -2454,14 +2452,6 @@ int lib_interface_isis_create(struct nb_cb_create_args *args)  		/* zebra might not know yet about the MTU - nothing we can do */  		if (!ifp || ifp->mtu == 0)  			break; -		vrf = vrf_lookup_by_id(ifp->vrf_id); -		if (ifp->vrf_id != VRF_DEFAULT && vrf -		    && strcmp(vrf->name, vrf_name) != 0) { -			snprintf(args->errmsg, args->errmsg_len, -				 "interface %s not in vrf %s\n", ifp->name, -				 vrf_name); -			return NB_ERR_VALIDATION; -		}  		actual_mtu =  			if_is_broadcast(ifp) ? ifp->mtu - LLC_LEN : ifp->mtu; @@ -2545,44 +2535,6 @@ int lib_interface_isis_area_tag_modify(struct nb_cb_modify_args *args)  }  /* - * XPath: /frr-interface:lib/interface/frr-isisd:isis/vrf - */ -int lib_interface_isis_vrf_modify(struct nb_cb_modify_args *args) -{ -	struct interface *ifp; -	struct vrf *vrf; -	const char *ifname, *vrfname, *vrf_name; -	struct isis_circuit *circuit; - -	if (args->event == NB_EV_VALIDATE) { -		/* libyang doesn't like relative paths across module boundaries -		 */ -		ifname = yang_dnode_get_string(args->dnode->parent->parent, -					       "./name"); -		vrfname = yang_dnode_get_string(args->dnode->parent->parent, -						"./vrf"); -		vrf = vrf_lookup_by_name(vrfname); -		assert(vrf); -		ifp = if_lookup_by_name(ifname, vrf->vrf_id); - -		if (!ifp) -			return NB_OK; - -		vrf_name = yang_dnode_get_string(args->dnode, NULL); -		circuit = circuit_scan_by_ifp(ifp); -		if (circuit && circuit->area && circuit->isis -		    && strcmp(circuit->isis->name, vrf_name)) { -			snprintf(args->errmsg, args->errmsg_len, -				 "ISIS circuit is already defined on vrf  %s", -				 circuit->isis->name); -			return NB_ERR_VALIDATION; -		} -	} - -	return NB_OK; -} - -/*   * XPath: /frr-interface:lib/interface/frr-isisd:isis/circuit-type   */  int lib_interface_isis_circuit_type_modify(struct nb_cb_modify_args *args) diff --git a/yang/frr-isisd.yang b/yang/frr-isisd.yang index be7426957e..46ad8d3971 100644 --- a/yang/frr-isisd.yang +++ b/yang/frr-isisd.yang @@ -506,13 +506,6 @@ module frr-isisd {          "Area-tag associated to this circuit.";      } -    leaf vrf { -      type frr-vrf:vrf-ref; -      default "default"; -      description -        "VRF NAME."; -    } -      leaf ipv4-routing {        type boolean;        default "false";  | 
