diff options
| -rw-r--r-- | zebra/interface.c | 373 | ||||
| -rw-r--r-- | zebra/interface.h | 2 | ||||
| -rw-r--r-- | zebra/irdp_interface.c | 1 | ||||
| -rw-r--r-- | zebra/rtadv.c | 356 | ||||
| -rw-r--r-- | zebra/zebra_evpn_mh.c | 96 | ||||
| -rw-r--r-- | zebra/zebra_evpn_mh.h | 2 | ||||
| -rw-r--r-- | zebra/zebra_nb.c | 47 | ||||
| -rw-r--r-- | zebra/zebra_nb.h | 143 | ||||
| -rw-r--r-- | zebra/zebra_ptm.c | 43 | ||||
| -rw-r--r-- | zebra/zebra_ptm.h | 1 | ||||
| -rw-r--r-- | zebra/zebra_vty.c | 3 | 
11 files changed, 733 insertions, 334 deletions
diff --git a/zebra/interface.c b/zebra/interface.c index 8bbabff92b..62ff676f48 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -37,6 +37,7 @@  #include "zebra/zebra_vxlan.h"  #include "zebra/zebra_errors.h"  #include "zebra/zebra_evpn_mh.h" +#include "zebra/zebra_nb.h"  DEFINE_MTYPE_STATIC(ZEBRA, ZINFO, "Zebra Interface Information"); @@ -44,8 +45,6 @@ DEFINE_MTYPE_STATIC(ZEBRA, ZINFO, "Zebra Interface Information");  DEFINE_HOOK(zebra_if_extra_info, (struct vty * vty, struct interface *ifp),  	    (vty, ifp)); -DEFINE_HOOK(zebra_if_config_wr, (struct vty * vty, struct interface *ifp), -	    (vty, ifp));  DEFINE_MTYPE(ZEBRA, ZIF_DESC, "Intf desc"); @@ -3704,6 +3703,18 @@ DEFPY_YANG (multicast_new,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_multicast_cli_write(struct vty *vty, +					     const struct lyd_node *dnode, +					     bool show_defaults) +{ +	bool multicast = yang_dnode_get_bool(dnode, NULL); + +	if (multicast) +		vty_out(vty, " multicast enable\n"); +	else +		vty_out(vty, " multicast disable\n"); +} +  int if_multicast_set(struct interface *ifp)  {  	struct zebra_if *if_data; @@ -3751,6 +3762,18 @@ DEFPY_YANG (mpls,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_mpls_cli_write(struct vty *vty, +					const struct lyd_node *dnode, +					bool show_defaults) +{ +	bool mpls = yang_dnode_get_bool(dnode, NULL); + +	if (mpls) +		vty_out(vty, " mpls enable\n"); +	else +		vty_out(vty, " mpls disable\n"); +} +  int if_multicast_unset(struct interface *ifp)  {  	struct zebra_if *if_data; @@ -3816,6 +3839,18 @@ DEFPY_YANG (linkdetect,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_link_detect_cli_write(struct vty *vty, +					       const struct lyd_node *dnode, +					       bool show_defaults) +{ +	bool link_detect = yang_dnode_get_bool(dnode, NULL); + +	if (!link_detect) +		vty_out(vty, " no link-detect\n"); +	else if (show_defaults) +		vty_out(vty, " link-detect\n"); +} +  int if_shutdown(struct interface *ifp)  {  	struct zebra_if *if_data; @@ -3847,6 +3882,18 @@ DEFPY_YANG (shutdown_if,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_enabled_cli_write(struct vty *vty, +					   const struct lyd_node *dnode, +					   bool show_defaults) +{ +	bool enabled = yang_dnode_get_bool(dnode, NULL); + +	if (!enabled) +		vty_out(vty, " shutdown\n"); +	else if (show_defaults) +		vty_out(vty, " no shutdown\n"); +} +  int if_no_shutdown(struct interface *ifp)  {  	struct zebra_if *if_data; @@ -3888,6 +3935,15 @@ DEFPY_YANG (bandwidth_if,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_bandwidth_cli_write(struct vty *vty, +					     const struct lyd_node *dnode, +					     bool show_defaults) +{ +	uint32_t bandwidth = yang_dnode_get_uint32(dnode, NULL); + +	vty_out(vty, " bandwidth %u\n", bandwidth); +} +  struct cmd_node link_params_node = {  	.name = "link-params",  	.node = LINK_PARAMS_NODE, @@ -3967,6 +4023,19 @@ DEFUN_NOSH (exit_link_params,  	return CMD_SUCCESS;  } +void lib_interface_zebra_link_params_cli_write(struct vty *vty, +					       const struct lyd_node *dnode, +					       bool show_defaults) +{ +	vty_out(vty, " link-params\n"); +} + +void lib_interface_zebra_link_params_cli_write_end(struct vty *vty, +						   const struct lyd_node *dnode) +{ +	vty_out(vty, " exit-link-params\n"); +} +  DEFUN_YANG (no_link_params,         no_link_params_cmd,         "no link-params", @@ -4024,6 +4093,14 @@ DEFPY_YANG (link_params_metric,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_link_params_metric_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	uint32_t metric = yang_dnode_get_uint32(dnode, NULL); + +	vty_out(vty, "  metric %u\n", metric); +} +  DEFPY_YANG (link_params_maxbw,         link_params_maxbw_cmd,         "max-bw BANDWIDTH", @@ -4045,6 +4122,14 @@ DEFPY_YANG (link_params_maxbw,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_link_params_max_bandwidth_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	float max_bandwidth = yang_dnode_get_bandwidth_ieee_float32(dnode, NULL); + +	vty_out(vty, "  max-bw %g\n", max_bandwidth); +} +  DEFPY_YANG (link_params_max_rsv_bw,         link_params_max_rsv_bw_cmd,         "max-rsv-bw BANDWIDTH", @@ -4067,6 +4152,15 @@ DEFPY_YANG (link_params_max_rsv_bw,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_link_params_max_reservable_bandwidth_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	float max_reservable_bandwidth = +		yang_dnode_get_bandwidth_ieee_float32(dnode, NULL); + +	vty_out(vty, "  max-rsv-bw %g\n", max_reservable_bandwidth); +} +  DEFPY_YANG (link_params_unrsv_bw,         link_params_unrsv_bw_cmd,         "unrsv-bw (0-7)$priority BANDWIDTH", @@ -4093,6 +4187,17 @@ DEFPY_YANG (link_params_unrsv_bw,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_link_params_unreserved_bandwidths_unreserved_bandwidth_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	uint8_t priority = yang_dnode_get_uint8(dnode, "priority"); +	float unreserved_bandwidth = +		yang_dnode_get_bandwidth_ieee_float32(dnode, +						      "unreserved-bandwidth"); + +	vty_out(vty, "  unrsv-bw %u %g\n", priority, unreserved_bandwidth); +} +  DEFPY_YANG(link_params_admin_grp, link_params_admin_grp_cmd,  	   "admin-grp BITPATTERN",  	   "Administrative group membership\n" @@ -4156,6 +4261,16 @@ DEFPY_YANG (link_params_inter_as,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_link_params_neighbor_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	uint32_t remote_as = yang_dnode_get_uint32(dnode, "remote-as"); +	const char *ipv4_remote_id = yang_dnode_get_string(dnode, +							   "ipv4-remote-id"); + +	vty_out(vty, "  neighbor %s as %u\n", ipv4_remote_id, remote_as); +} +  /* RFC7471: OSPF Traffic Engineering (TE) Metric extensions &   * draft-ietf-isis-metric-extensions-07.txt */  DEFPY_YANG (link_params_delay, @@ -4191,6 +4306,27 @@ DEFPY_YANG (link_params_delay,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_link_params_delay_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	uint32_t delay = yang_dnode_get_uint32(dnode, NULL); + +	vty_out(vty, "  delay %u", delay); + +	if (yang_dnode_exists(dnode, "../min-max-delay")) { +		uint32_t delay_min = +			yang_dnode_get_uint32(dnode, +					      "../min-max-delay/delay-min"); +		uint32_t delay_max = +			yang_dnode_get_uint32(dnode, +					      "../min-max-delay/delay-max"); + +		vty_out(vty, " min %u max %u", delay_min, delay_max); +	} + +	vty_out(vty, "\n"); +} +  DEFPY_YANG (link_params_delay_var,         link_params_delay_var_cmd,         "[no] delay-variation ![(0-16777215)$delay_var]", @@ -4208,6 +4344,14 @@ DEFPY_YANG (link_params_delay_var,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_link_params_delay_variation_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	uint32_t delay_variation = yang_dnode_get_uint32(dnode, NULL); + +	vty_out(vty, "  delay-variation %u\n", delay_variation); +} +  DEFPY_YANG(  	link_params_pkt_loss, link_params_pkt_loss_cmd,  	"[no] packet-loss ![PERCENTAGE]", @@ -4224,6 +4368,14 @@ DEFPY_YANG(  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_link_params_packet_loss_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	double packet_loss = yang_dnode_get_dec64(dnode, NULL); + +	vty_out(vty, "  packet-loss %lf\n", packet_loss); +} +  DEFPY_YANG (link_params_res_bw,         link_params_res_bw_cmd,         "[no] res-bw ![BANDWIDTH]", @@ -4252,6 +4404,15 @@ DEFPY_YANG (link_params_res_bw,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_link_params_residual_bandwidth_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	float residual_bandwidth = yang_dnode_get_bandwidth_ieee_float32(dnode, +									 NULL); + +	vty_out(vty, "  res-bw %g\n", residual_bandwidth); +} +  DEFPY_YANG (link_params_ava_bw,         link_params_ava_bw_cmd,         "[no] ava-bw ![BANDWIDTH]", @@ -4280,6 +4441,15 @@ DEFPY_YANG (link_params_ava_bw,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_link_params_available_bandwidth_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	float available_bandwidth = yang_dnode_get_bandwidth_ieee_float32(dnode, +									  NULL); + +	vty_out(vty, "  ava-bw %g\n", available_bandwidth); +} +  DEFPY_YANG (link_params_use_bw,         link_params_use_bw_cmd,         "[no] use-bw ![BANDWIDTH]", @@ -4308,6 +4478,15 @@ DEFPY_YANG (link_params_use_bw,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_link_params_utilized_bandwidth_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	float utilized_bandwidth = yang_dnode_get_bandwidth_ieee_float32(dnode, +									 NULL); + +	vty_out(vty, "  use-bw %g\n", utilized_bandwidth); +} +  static int ag_change(struct vty *vty, int argc, struct cmd_token **argv,  		     const char *xpath_base, bool no, int start_idx)  { @@ -4537,6 +4716,23 @@ DEFPY_YANG (ip_address,  				    ip, mask);  } +void lib_interface_zebra_ipv4_addrs_cli_write(struct vty *vty, +					      const struct lyd_node *dnode, +					      bool show_defaults) +{ +	const char *ip = yang_dnode_get_string(dnode, "ip"); +	uint8_t prefix_length = yang_dnode_get_uint8(dnode, "prefix-length"); + +	vty_out(vty, " ip address %s/%u", ip, prefix_length); + +	if (yang_dnode_exists(dnode, "label")) { +		const char *label = yang_dnode_get_string(dnode, "label"); +		vty_out(vty, " label %s", label); +	} + +	vty_out(vty, "\n"); +} +  #ifdef HAVE_NETLINK  DEFPY_YANG (ip_address_peer,        ip_address_peer_cmd, @@ -4590,6 +4786,26 @@ DEFPY_YANG (ip_address_peer,  		address_str, peer_ip, peer_mask);  } +void lib_interface_zebra_ipv4_p2p_addrs_cli_write(struct vty *vty, +						  const struct lyd_node *dnode, +						  bool show_defaults) +{ +	const char *ip = yang_dnode_get_string(dnode, "ip"); +	const char *peer_ip = yang_dnode_get_string(dnode, "peer-ip"); +	uint8_t peer_prefix_length = yang_dnode_get_uint8(dnode, +							  "peer-prefix-length"); + +	vty_out(vty, " ip address %s peer %s/%u", ip, peer_ip, +		peer_prefix_length); + +	if (yang_dnode_exists(dnode, "label")) { +		const char *label = yang_dnode_get_string(dnode, "label"); +		vty_out(vty, " label %s", label); +	} + +	vty_out(vty, "\n"); +} +  void if_ipv6_address_install(struct interface *ifp, struct prefix *prefix)  {  	struct zebra_if *if_data; @@ -4683,153 +4899,14 @@ DEFPY_YANG (ipv6_address,  				    ip, mask);  } -static int link_params_config_write(struct vty *vty, struct interface *ifp) -{ -	const struct lyd_node *dnode; -	char xpath[XPATH_MAXLEN]; -	int i; - -	if ((ifp == NULL) || !HAS_LINK_PARAMS(ifp)) -		return -1; - -	struct if_link_params *iflp = ifp->link_params; - -	vty_out(vty, " link-params\n"); -	if (IS_PARAM_SET(iflp, LP_TE_METRIC) && iflp->te_metric != ifp->metric) -		vty_out(vty, "  metric %u\n", iflp->te_metric); -	if (IS_PARAM_SET(iflp, LP_MAX_BW) && iflp->max_bw != iflp->default_bw) -		vty_out(vty, "  max-bw %g\n", iflp->max_bw); -	if (IS_PARAM_SET(iflp, LP_MAX_RSV_BW) -	    && iflp->max_rsv_bw != iflp->default_bw) -		vty_out(vty, "  max-rsv-bw %g\n", iflp->max_rsv_bw); -	if (IS_PARAM_SET(iflp, LP_UNRSV_BW)) { -		for (i = 0; i < 8; i++) -			if (iflp->unrsv_bw[i] != iflp->default_bw) -				vty_out(vty, "  unrsv-bw %d %g\n", i, -					iflp->unrsv_bw[i]); -	} - -	snprintf( -		xpath, sizeof(xpath), -		"/frr-interface:lib/interface[name='%s']/frr-zebra:zebra/link-params", -		ifp->name); -	dnode = yang_dnode_get(running_config->dnode, xpath); -	if (dnode) -		nb_cli_show_dnode_cmds(vty, dnode, false); - -	if (IS_PARAM_SET(iflp, LP_DELAY)) { -		vty_out(vty, "  delay %u", iflp->av_delay); -		if (IS_PARAM_SET(iflp, LP_MM_DELAY)) { -			vty_out(vty, " min %u", iflp->min_delay); -			vty_out(vty, " max %u", iflp->max_delay); -		} -		vty_out(vty, "\n"); -	} -	if (IS_PARAM_SET(iflp, LP_DELAY_VAR)) -		vty_out(vty, "  delay-variation %u\n", iflp->delay_var); -	if (IS_PARAM_SET(iflp, LP_PKT_LOSS)) -		vty_out(vty, "  packet-loss %f\n", -			(double)iflp->pkt_loss * LOSS_PRECISION); -	if (IS_PARAM_SET(iflp, LP_AVA_BW)) -		vty_out(vty, "  ava-bw %g\n", iflp->ava_bw); -	if (IS_PARAM_SET(iflp, LP_RES_BW)) -		vty_out(vty, "  res-bw %g\n", iflp->res_bw); -	if (IS_PARAM_SET(iflp, LP_USE_BW)) -		vty_out(vty, "  use-bw %g\n", iflp->use_bw); -	if (IS_PARAM_SET(iflp, LP_RMT_AS)) -		vty_out(vty, "  neighbor %pI4 as %u\n", &iflp->rmt_ip, -			iflp->rmt_as); - -	vty_out(vty, " exit-link-params\n"); -	return 0; -} - -static int if_config_write(struct vty *vty) +void lib_interface_zebra_ipv6_addrs_cli_write(struct vty *vty, +					      const struct lyd_node *dnode, +					      bool show_defaults)  { -	struct vrf *vrf; -	struct interface *ifp; - -	zebra_ptm_write(vty); - -	RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) -		FOR_ALL_INTERFACES (vrf, ifp) { -			struct zebra_if *if_data; -			struct connected *ifc; -			struct prefix *p; - -			if_data = ifp->info; - -			if_vty_config_start(vty, ifp); - -			if (if_data) { -				if (if_data->shutdown == IF_ZEBRA_DATA_ON) -					vty_out(vty, " shutdown\n"); - -				zebra_ptm_if_write(vty, if_data); -			} - -			if (ifp->desc) -				vty_out(vty, " description %s\n", ifp->desc); - -			/* Assign bandwidth here to avoid unnecessary interface -			   flap -			   while processing config script */ -			if (ifp->bandwidth != 0) -				vty_out(vty, " bandwidth %u\n", ifp->bandwidth); - -			if (!CHECK_FLAG(ifp->status, -					ZEBRA_INTERFACE_LINKDETECTION)) -				vty_out(vty, " no link-detect\n"); - -			frr_each (if_connected, ifp->connected, ifc) { -				if (CHECK_FLAG(ifc->conf, -					       ZEBRA_IFC_CONFIGURED)) { -					char buf[INET6_ADDRSTRLEN]; -					p = ifc->address; -					vty_out(vty, " ip%s address %s", -						p->family == AF_INET ? "" -								     : "v6", -						inet_ntop(p->family, -							  &p->u.prefix, buf, -							  sizeof(buf))); -					if (CONNECTED_PEER(ifc)) { -						p = ifc->destination; -						vty_out(vty, " peer %s", -							inet_ntop(p->family, -								  &p->u.prefix, -								  buf, -								  sizeof(buf))); -					} -					vty_out(vty, "/%d", p->prefixlen); - -					if (ifc->label) -						vty_out(vty, " label %s", -							ifc->label); +	const char *ip = yang_dnode_get_string(dnode, "ip"); +	uint8_t prefix_length = yang_dnode_get_uint8(dnode, "prefix-length"); -					vty_out(vty, "\n"); -				} -			} - -			if (if_data) { -				if (if_data->multicast == IF_ZEBRA_DATA_ON) -					vty_out(vty, " multicast enable\n"); -				else if (if_data->multicast == IF_ZEBRA_DATA_OFF) -					vty_out(vty, " multicast disable\n"); - -				if (if_data->mpls_config == IF_ZEBRA_DATA_ON) -					vty_out(vty, " mpls enable\n"); -				else if (if_data->mpls_config == -					 IF_ZEBRA_DATA_OFF) -					vty_out(vty, " mpls disable\n"); -			} - -			hook_call(zebra_if_config_wr, vty, ifp); -			zebra_evpn_mh_if_write(vty, ifp); -			link_params_config_write(vty, ifp); - -			if_vty_config_end(vty); -		} -	return 0; +	vty_out(vty, " ipv6 address %s/%u\n", ip, prefix_length);  }  /* Allocate and initialize interface vector. */ @@ -4840,7 +4917,7 @@ void zebra_if_init(void)  	hook_register_prio(if_del, 0, if_zebra_delete_hook);  	/* Install configuration write function. */ -	if_cmd_init(if_config_write); +	if_cmd_init_default();  	install_node(&link_params_node);  	install_element(VIEW_NODE, &show_interface_cmd); diff --git a/zebra/interface.h b/zebra/interface.h index c1ff525189..fc6850e80e 100644 --- a/zebra/interface.h +++ b/zebra/interface.h @@ -218,8 +218,6 @@ struct zebra_if {  DECLARE_HOOK(zebra_if_extra_info, (struct vty * vty, struct interface *ifp),  	     (vty, ifp)); -DECLARE_HOOK(zebra_if_config_wr, (struct vty * vty, struct interface *ifp), -	     (vty, ifp));  #define IS_ZEBRA_IF_VRF(ifp)                                                   \  	(((struct zebra_if *)(ifp->info))->zif_type == ZEBRA_IF_VRF) diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c index 591236d680..70f3f57ae0 100644 --- a/zebra/irdp_interface.c +++ b/zebra/irdp_interface.c @@ -694,7 +694,6 @@ DEFUN (ip_irdp_debug_disable,  void irdp_if_init(void)  { -	hook_register(zebra_if_config_wr, irdp_config_write);  	hook_register(if_del, irdp_if_delete);  	install_element(INTERFACE_NODE, &ip_irdp_broadcast_cmd); diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 5d3c474ee2..2e418afde3 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -31,6 +31,7 @@  #include "zebra/zebra_vrf.h"  #include "zebra/zebra_errors.h"  #include "zebra/zebra_router.h" +#include "zebra/zebra_nb.h"  extern struct zebra_privs_t zserv_privs; @@ -1568,6 +1569,17 @@ DEFPY_YANG (ipv6_nd_ra_fast_retrans,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_ipv6_router_advertisements_fast_retransmit_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	bool fast_retransmit = yang_dnode_get_bool(dnode, NULL); + +	if (!fast_retransmit) +		vty_out(vty, " no ipv6 nd ra-fast-retrans\n"); +	else if (show_defaults) +		vty_out(vty, " ipv6 nd ra-fast-retrans\n"); +} +  DEFPY_YANG (ipv6_nd_ra_hop_limit,         ipv6_nd_ra_hop_limit_cmd,         "[no] ipv6 nd ra-hop-limit ![(0-255)$hopcount]", @@ -1588,6 +1600,14 @@ DEFPY_YANG (ipv6_nd_ra_hop_limit,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_ipv6_router_advertisements_cur_hop_limit_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	uint8_t hop_limit = yang_dnode_get_uint8(dnode, NULL); + +	vty_out(vty, " ipv6 nd ra-hop-limit %u\n", hop_limit); +} +  DEFPY_YANG (ipv6_nd_ra_retrans_interval,         ipv6_nd_ra_retrans_interval_cmd,         "[no] ipv6 nd ra-retrans-interval ![(0-4294967295)$interval]", @@ -1608,6 +1628,14 @@ DEFPY_YANG (ipv6_nd_ra_retrans_interval,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_ipv6_router_advertisements_retrans_timer_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	uint32_t retrans_timer = yang_dnode_get_uint32(dnode, NULL); + +	vty_out(vty, " ipv6 nd ra-retrans-interval %u\n", retrans_timer); +} +  DEFPY_YANG (ipv6_nd_suppress_ra,         ipv6_nd_suppress_ra_cmd,         "[no] ipv6 nd suppress-ra", @@ -1627,6 +1655,17 @@ DEFPY_YANG (ipv6_nd_suppress_ra,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_ipv6_router_advertisements_send_advertisements_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	bool send_advertisements = yang_dnode_get_bool(dnode, NULL); + +	if (send_advertisements) +		vty_out(vty, " no ipv6 nd suppress-ra\n"); +	else if (show_defaults) +		vty_out(vty, " ipv6 nd suppress-ra\n"); +} +  DEFPY_YANG (ipv6_nd_ra_interval,         ipv6_nd_ra_interval_cmd,         "[no] ipv6 nd ra-interval ![<(1-1800)$sec|msec (70-1800000)$msec>]", @@ -1657,6 +1696,19 @@ DEFPY_YANG (ipv6_nd_ra_interval,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_ipv6_router_advertisements_max_rtr_adv_interval_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	uint32_t max_rtr_adv_interval = yang_dnode_get_uint32(dnode, NULL); + +	if (max_rtr_adv_interval % 1000) +		vty_out(vty, " ipv6 nd ra-interval msec %u\n", +			max_rtr_adv_interval); +	else +		vty_out(vty, " ipv6 nd ra-interval %u\n", +			max_rtr_adv_interval / 1000); +} +  DEFPY_YANG (ipv6_nd_ra_lifetime,         ipv6_nd_ra_lifetime_cmd,         "[no] ipv6 nd ra-lifetime ![(0-9000)$lifetime]", @@ -1677,6 +1729,14 @@ DEFPY_YANG (ipv6_nd_ra_lifetime,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_ipv6_router_advertisements_default_lifetime_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	uint16_t default_lifetime = yang_dnode_get_uint16(dnode, NULL); + +	vty_out(vty, " ipv6 nd ra-lifetime %u\n", default_lifetime); +} +  DEFPY_YANG (ipv6_nd_reachable_time,         ipv6_nd_reachable_time_cmd,         "[no] ipv6 nd reachable-time ![(1-3600000)$msec]", @@ -1697,6 +1757,14 @@ DEFPY_YANG (ipv6_nd_reachable_time,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_ipv6_router_advertisements_reachable_time_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	uint32_t reachable_time = yang_dnode_get_uint32(dnode, NULL); + +	vty_out(vty, " ipv6 nd reachable-time %u\n", reachable_time); +} +  DEFPY_YANG (ipv6_nd_homeagent_preference,         ipv6_nd_homeagent_preference_cmd,         "[no] ipv6 nd home-agent-preference ![(0-65535)$pref]", @@ -1717,6 +1785,15 @@ DEFPY_YANG (ipv6_nd_homeagent_preference,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_ipv6_router_advertisements_home_agent_preference_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	uint16_t home_agent_preference = yang_dnode_get_uint16(dnode, NULL); + +	vty_out(vty, " ipv6 nd home-agent-preference %u\n", +		home_agent_preference); +} +  DEFPY_YANG (ipv6_nd_homeagent_lifetime,         ipv6_nd_homeagent_lifetime_cmd,         "[no] ipv6 nd home-agent-lifetime ![(1-65520)$lifetime]", @@ -1737,6 +1814,14 @@ DEFPY_YANG (ipv6_nd_homeagent_lifetime,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_ipv6_router_advertisements_home_agent_lifetime_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	uint16_t home_agent_lifetime = yang_dnode_get_uint16(dnode, NULL); + +	vty_out(vty, " ipv6 nd home-agent-lifetime %u\n", home_agent_lifetime); +} +  DEFPY_YANG (ipv6_nd_managed_config_flag,         ipv6_nd_managed_config_flag_cmd,         "[no] ipv6 nd managed-config-flag", @@ -1756,6 +1841,17 @@ DEFPY_YANG (ipv6_nd_managed_config_flag,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_ipv6_router_advertisements_managed_flag_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	bool managed_flag = yang_dnode_get_bool(dnode, NULL); + +	if (managed_flag) +		vty_out(vty, " ipv6 nd managed-config-flag\n"); +	else if (show_defaults) +		vty_out(vty, " no ipv6 nd managed-config-flag\n"); +} +  DEFPY_YANG (ipv6_nd_homeagent_config_flag,         ipv6_nd_homeagent_config_flag_cmd,         "[no] ipv6 nd home-agent-config-flag", @@ -1775,6 +1871,17 @@ DEFPY_YANG (ipv6_nd_homeagent_config_flag,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_ipv6_router_advertisements_home_agent_flag_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	bool home_agent_flag = yang_dnode_get_bool(dnode, NULL); + +	if (home_agent_flag) +		vty_out(vty, " ipv6 nd home-agent-config-flag\n"); +	else if (show_defaults) +		vty_out(vty, " no ipv6 nd home-agent-config-flag\n"); +} +  DEFPY_YANG (ipv6_nd_adv_interval_config_option,         ipv6_nd_adv_interval_config_option_cmd,         "[no] ipv6 nd adv-interval-option", @@ -1794,6 +1901,17 @@ DEFPY_YANG (ipv6_nd_adv_interval_config_option,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_ipv6_router_advertisements_advertisement_interval_option_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	bool advertisement_interval_option = yang_dnode_get_bool(dnode, NULL); + +	if (advertisement_interval_option) +		vty_out(vty, " ipv6 nd adv-interval-option\n"); +	else if (show_defaults) +		vty_out(vty, " no ipv6 nd adv-interval-option\n"); +} +  DEFPY_YANG (ipv6_nd_other_config_flag,         ipv6_nd_other_config_flag_cmd,         "[no] ipv6 nd other-config-flag", @@ -1813,6 +1931,17 @@ DEFPY_YANG (ipv6_nd_other_config_flag,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_ipv6_router_advertisements_other_config_flag_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	bool other_config_flag = yang_dnode_get_bool(dnode, NULL); + +	if (other_config_flag) +		vty_out(vty, " ipv6 nd other-config-flag\n"); +	else if (show_defaults) +		vty_out(vty, " no ipv6 nd other-config-flag\n"); +} +  DEFPY_YANG (ipv6_nd_prefix,         ipv6_nd_prefix_cmd,         "[no] ipv6 nd prefix X:X::X:X/M$prefix [<(0-4294967295)|infinite>$valid <(0-4294967295)|infinite>$preferred] [{router-address$routeraddr|off-link$offlink|no-autoconfig$noautoconf}]", @@ -1876,6 +2005,47 @@ DEFPY_YANG (ipv6_nd_prefix,  		prefix_str);  } +void lib_interface_zebra_ipv6_router_advertisements_prefix_list_prefix_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	const char *prefix = yang_dnode_get_string(dnode, "prefix-spec"); +	struct lyd_node *valid = yang_dnode_get(dnode, "valid-lifetime"); +	struct lyd_node *preferred = yang_dnode_get(dnode, "preferred-lifetime"); +	bool router_address_flag = yang_dnode_get_bool(dnode, +						       "router-address-flag"); +	bool on_link_flag = yang_dnode_get_bool(dnode, "on-link-flag"); +	bool autonomous_flag = yang_dnode_get_bool(dnode, "autonomous-flag"); + +	vty_out(vty, " ipv6 nd prefix %s", prefix); + +	if (!yang_dnode_is_default(valid, NULL) || +	    !yang_dnode_is_default(preferred, NULL) || show_defaults) { +		uint32_t valid_lifetime = yang_dnode_get_uint32(valid, NULL); +		uint32_t preferred_lifetime = yang_dnode_get_uint32(preferred, +								    NULL); + +		if (valid_lifetime == UINT32_MAX) +			vty_out(vty, " infinite"); +		else +			vty_out(vty, " %u", valid_lifetime); +		if (preferred_lifetime == UINT32_MAX) +			vty_out(vty, " infinite"); +		else +			vty_out(vty, " %u", preferred_lifetime); +	} + +	if (!on_link_flag) +		vty_out(vty, " off-link"); + +	if (!autonomous_flag) +		vty_out(vty, " no-autoconfig"); + +	if (router_address_flag) +		vty_out(vty, " router-address"); + +	vty_out(vty, "\n"); +} +  DEFPY_YANG (ipv6_nd_router_preference,         ipv6_nd_router_preference_cmd,         "[no] ipv6 nd router-preference ![<high|medium|low>$pref]", @@ -1898,6 +2068,16 @@ DEFPY_YANG (ipv6_nd_router_preference,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_ipv6_router_advertisements_default_router_preference_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	const char *default_router_preference = yang_dnode_get_string(dnode, +								      NULL); + +	vty_out(vty, " ipv6 nd router-preference %s\n", +		default_router_preference); +} +  DEFPY_YANG (ipv6_nd_mtu,         ipv6_nd_mtu_cmd,         "[no] ipv6 nd mtu ![(1-65535)]", @@ -1918,6 +2098,14 @@ DEFPY_YANG (ipv6_nd_mtu,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_ipv6_router_advertisements_link_mtu_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	uint16_t link_mtu = yang_dnode_get_uint32(dnode, NULL); + +	vty_out(vty, " ipv6 nd mtu %u\n", link_mtu); +} +  static struct rtadv_rdnss *rtadv_rdnss_new(void)  {  	return XCALLOC(MTYPE_RTADV_RDNSS, sizeof(struct rtadv_rdnss)); @@ -2044,6 +2232,25 @@ DEFPY_YANG (ipv6_nd_rdnss,  		addr_str);  } +void lib_interface_zebra_ipv6_router_advertisements_rdnss_rdnss_address_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	const char *address = yang_dnode_get_string(dnode, "address"); + +	vty_out(vty, " ipv6 nd rdnss %s", address); + +	if (yang_dnode_exists(dnode, "lifetime")) { +		uint32_t lifetime = yang_dnode_get_uint32(dnode, "lifetime"); + +		if (lifetime == UINT32_MAX) +			vty_out(vty, " infinite"); +		else +			vty_out(vty, " %u", lifetime); +	} + +	vty_out(vty, "\n"); +} +  DEFPY_YANG (ipv6_nd_dnssl,        ipv6_nd_dnssl_cmd,        "[no] ipv6 nd dnssl SUFFIX [<(0-4294967295)|infinite>]$lifetime", @@ -2092,6 +2299,24 @@ DEFPY_YANG (ipv6_nd_dnssl,  		dnssl.name);  } +void lib_interface_zebra_ipv6_router_advertisements_dnssl_dnssl_domain_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	const char *domain = yang_dnode_get_string(dnode, "domain"); + +	vty_out(vty, " ipv6 nd dnssl %s", domain); + +	if (yang_dnode_exists(dnode, "lifetime")) { +		uint32_t lifetime = yang_dnode_get_uint32(dnode, "lifetime"); + +		if (lifetime == UINT32_MAX) +			vty_out(vty, " infinite"); +		else +			vty_out(vty, " %u", lifetime); +	} + +	vty_out(vty, "\n"); +}  /* Dump interface ND information to vty. */  static int nd_dump_vty(struct vty *vty, struct interface *ifp) @@ -2163,136 +2388,6 @@ static int nd_dump_vty(struct vty *vty, struct interface *ifp)  	return 0;  } - -/* Write configuration about router advertisement. */ -static int rtadv_config_write(struct vty *vty, struct interface *ifp) -{ -	struct zebra_if *zif; -	struct listnode *node; -	struct rtadv_prefix *rprefix; -	struct rtadv_rdnss *rdnss; -	struct rtadv_dnssl *dnssl; -	int interval; - -	zif = ifp->info; - -	if (!if_is_loopback(ifp)) { -		if (zif->rtadv.AdvSendAdvertisements -		    && CHECK_FLAG(zif->rtadv.ra_configured, VTY_RA_CONFIGURED)) -			vty_out(vty, " no ipv6 nd suppress-ra\n"); -	} - -	interval = zif->rtadv.MaxRtrAdvInterval; -	if (CHECK_FLAG(zif->rtadv.ra_configured, VTY_RA_INTERVAL_CONFIGURED)) { -		if (interval % 1000) -			vty_out(vty, " ipv6 nd ra-interval msec %d\n", -				interval); -		else if (interval != RTADV_MAX_RTR_ADV_INTERVAL) -			vty_out(vty, " ipv6 nd ra-interval %d\n", -				interval / 1000); -	} - -	if (zif->rtadv.AdvIntervalOption) -		vty_out(vty, " ipv6 nd adv-interval-option\n"); - -	if (!zif->rtadv.UseFastRexmit) -		vty_out(vty, " no ipv6 nd ra-fast-retrans\n"); - -	if (zif->rtadv.AdvRetransTimer != 0) -		vty_out(vty, " ipv6 nd ra-retrans-interval %u\n", -			zif->rtadv.AdvRetransTimer); - -	if (zif->rtadv.AdvCurHopLimit != RTADV_DEFAULT_HOPLIMIT) -		vty_out(vty, " ipv6 nd ra-hop-limit %d\n", -			zif->rtadv.AdvCurHopLimit); - -	if (zif->rtadv.AdvDefaultLifetime != -1) -		vty_out(vty, " ipv6 nd ra-lifetime %d\n", -			zif->rtadv.AdvDefaultLifetime); - -	if (zif->rtadv.HomeAgentPreference) -		vty_out(vty, " ipv6 nd home-agent-preference %u\n", -			zif->rtadv.HomeAgentPreference); - -	if (zif->rtadv.HomeAgentLifetime != -1) -		vty_out(vty, " ipv6 nd home-agent-lifetime %u\n", -			zif->rtadv.HomeAgentLifetime); - -	if (zif->rtadv.AdvHomeAgentFlag) -		vty_out(vty, " ipv6 nd home-agent-config-flag\n"); - -	if (zif->rtadv.AdvReachableTime) -		vty_out(vty, " ipv6 nd reachable-time %d\n", -			zif->rtadv.AdvReachableTime); - -	if (zif->rtadv.AdvManagedFlag) -		vty_out(vty, " ipv6 nd managed-config-flag\n"); - -	if (zif->rtadv.AdvOtherConfigFlag) -		vty_out(vty, " ipv6 nd other-config-flag\n"); - -	if (zif->rtadv.DefaultPreference != RTADV_PREF_MEDIUM) -		vty_out(vty, " ipv6 nd router-preference %s\n", -			rtadv_pref_strs[zif->rtadv.DefaultPreference]); - -	if (zif->rtadv.AdvLinkMTU) -		vty_out(vty, " ipv6 nd mtu %d\n", zif->rtadv.AdvLinkMTU); - -	frr_each (rtadv_prefixes, zif->rtadv.prefixes, rprefix) { -		if ((rprefix->AdvPrefixCreate == PREFIX_SRC_MANUAL) -		    || (rprefix->AdvPrefixCreate == PREFIX_SRC_BOTH)) { -			vty_out(vty, " ipv6 nd prefix %pFX", &rprefix->prefix); -			if ((rprefix->AdvValidLifetime != RTADV_VALID_LIFETIME) -			    || (rprefix->AdvPreferredLifetime -				!= RTADV_PREFERRED_LIFETIME)) { -				if (rprefix->AdvValidLifetime == UINT32_MAX) -					vty_out(vty, " infinite"); -				else -					vty_out(vty, " %u", -						rprefix->AdvValidLifetime); -				if (rprefix->AdvPreferredLifetime == UINT32_MAX) -					vty_out(vty, " infinite"); -				else -					vty_out(vty, " %u", -						rprefix->AdvPreferredLifetime); -			} -			if (!rprefix->AdvOnLinkFlag) -				vty_out(vty, " off-link"); -			if (!rprefix->AdvAutonomousFlag) -				vty_out(vty, " no-autoconfig"); -			if (rprefix->AdvRouterAddressFlag) -				vty_out(vty, " router-address"); -			vty_out(vty, "\n"); -		} -	} - -	for (ALL_LIST_ELEMENTS_RO(zif->rtadv.AdvRDNSSList, node, rdnss)) { -		char buf[INET6_ADDRSTRLEN]; - -		vty_out(vty, " ipv6 nd rdnss %s", -			inet_ntop(AF_INET6, &rdnss->addr, buf, sizeof(buf))); -		if (rdnss->lifetime_set) { -			if (rdnss->lifetime == UINT32_MAX) -				vty_out(vty, " infinite"); -			else -				vty_out(vty, " %u", rdnss->lifetime); -		} -		vty_out(vty, "\n"); -	} -	for (ALL_LIST_ELEMENTS_RO(zif->rtadv.AdvDNSSLList, node, dnssl)) { -		vty_out(vty, " ipv6 nd dnssl %s", dnssl->name); -		if (dnssl->lifetime_set) { -			if (dnssl->lifetime == UINT32_MAX) -				vty_out(vty, " infinite"); -			else -				vty_out(vty, " %u", dnssl->lifetime); -		} -		vty_out(vty, "\n"); -	} -	return 0; -} - -  static void rtadv_event(struct zebra_vrf *zvrf, enum rtadv_event event, int val)  {  	struct rtadv *rtadv; @@ -2438,7 +2533,6 @@ void rtadv_cmd_init(void)  	interfaces_configured_for_ra_from_bgp = 0;  	hook_register(zebra_if_extra_info, nd_dump_vty); -	hook_register(zebra_if_config_wr, rtadv_config_write);  	install_element(VIEW_NODE, &show_ipv6_nd_ra_if_cmd); diff --git a/zebra/zebra_evpn_mh.c b/zebra/zebra_evpn_mh.c index 4a9c048833..eb0cb6e0b3 100644 --- a/zebra/zebra_evpn_mh.c +++ b/zebra/zebra_evpn_mh.c @@ -3300,42 +3300,6 @@ void zebra_evpn_es_show_esi(struct vty *vty, bool uj, esi_t *esi)  		vty_json(vty, json);  } -int zebra_evpn_mh_if_write(struct vty *vty, struct interface *ifp) -{ -	struct zebra_if *zif = ifp->info; -	char buf[ETHER_ADDR_STRLEN]; -	bool type_3_esi = false; -	char esi_buf[ESI_STR_LEN]; - -	if (zif->es_info.lid) { -		vty_out(vty, " evpn mh es-id %u\n", zif->es_info.lid); -		type_3_esi = true; -	} - -	if (!is_zero_mac(&zif->es_info.sysmac)) { -		vty_out(vty, " evpn mh es-sys-mac %s\n", -				prefix_mac2str(&zif->es_info.sysmac, -					buf, sizeof(buf))); -		type_3_esi = true; -	} - -	if (!type_3_esi -	    && memcmp(&zif->es_info.esi, zero_esi, sizeof(*zero_esi))) -		vty_out(vty, " evpn mh es-id %s\n", -				esi_to_str(&zif->es_info.esi, esi_buf, sizeof(esi_buf))); - -	if (zif->es_info.df_pref != EVPN_MH_DF_PREF_DEFAULT) -		vty_out(vty, " evpn mh es-df-pref %u\n", zif->es_info.df_pref); - -	if (zif->flags & ZIF_FLAG_EVPN_MH_UPLINK) -		vty_out(vty, " evpn mh uplink\n"); - -	if (zif->es_info.flags & ZIF_CFG_ES_FLAG_BYPASS) -		vty_out(vty, " evpn mh bypass\n"); - -	return 0; -} -  void zebra_evpn_mh_if_init(struct zebra_if *zif)  {  	zif->es_info.df_pref = EVPN_MH_DF_PREF_DEFAULT; @@ -3356,6 +3320,18 @@ DEFPY_HIDDEN(zebra_evpn_es_bypass, zebra_evpn_es_bypass_cmd,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_evpn_mh_bypass_cli_write(struct vty *vty, +						  const struct lyd_node *dnode, +						  bool show_defaults) +{ +	bool bypass = yang_dnode_get_bool(dnode, NULL); + +	if (bypass) +		vty_out(vty, " evpn mh bypass\n"); +	else if (show_defaults) +		vty_out(vty, " no evpn mh bypass\n"); +} +  /* CLI for configuring DF preference part for an ES */  DEFPY_YANG (zebra_evpn_es_pref,        zebra_evpn_es_pref_cmd, @@ -3377,6 +3353,14 @@ DEFPY_YANG (zebra_evpn_es_pref,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_evpn_mh_df_preference_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	uint16_t df_pref = yang_dnode_get_uint16(dnode, NULL); + +	vty_out(vty, " evpn mh es-df-pref %u\n", df_pref); +} +  /* CLI for setting up sysmac part of ESI on an access port */  DEFPY_YANG (zebra_evpn_es_sys_mac,        zebra_evpn_es_sys_mac_cmd, @@ -3399,6 +3383,18 @@ DEFPY_YANG (zebra_evpn_es_sys_mac,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_evpn_mh_type_3_system_mac_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	char buf[ETHER_ADDR_STRLEN]; +	struct ethaddr mac; + +	yang_dnode_get_mac(&mac, dnode, NULL); + +	vty_out(vty, " evpn mh es-sys-mac %s\n", +		prefix_mac2str(&mac, buf, sizeof(buf))); +} +  /* CLI for setting up local-ID part of ESI on an access port */  DEFPY_YANG (zebra_evpn_es_id,        zebra_evpn_es_id_cmd, @@ -3432,6 +3428,22 @@ DEFPY_YANG (zebra_evpn_es_id,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_evpn_mh_type_0_esi_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	const char *esi_str = yang_dnode_get_string(dnode, NULL); + +	vty_out(vty, " evpn mh es-id %s\n", esi_str); +} + +void lib_interface_zebra_evpn_mh_type_3_local_discriminator_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ +	uint32_t es_lid = yang_dnode_get_uint32(dnode, NULL); + +	vty_out(vty, " evpn mh es-id %u\n", es_lid); +} +  /* CLI for tagging an interface as an uplink */  DEFPY_YANG (zebra_evpn_mh_uplink,        zebra_evpn_mh_uplink_cmd, @@ -3450,6 +3462,18 @@ DEFPY_YANG (zebra_evpn_mh_uplink,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_evpn_mh_uplink_cli_write(struct vty *vty, +						  const struct lyd_node *dnode, +						  bool show_defaults) +{ +	bool uplink = yang_dnode_get_bool(dnode, NULL); + +	if (uplink) +		vty_out(vty, " evpn mh uplink\n"); +	else if (show_defaults) +		vty_out(vty, " no evpn mh uplink\n"); +} +  void zebra_evpn_mh_json(json_object *json)  {  	json_object *json_array; diff --git a/zebra/zebra_evpn_mh.h b/zebra/zebra_evpn_mh.h index fe450d4c2b..bc8ffd7877 100644 --- a/zebra/zebra_evpn_mh.h +++ b/zebra/zebra_evpn_mh.h @@ -17,6 +17,7 @@  #include "zebra_vxlan.h"  #include "zebra_vxlan_private.h"  #include "zebra_nhg.h" +#include "zebra_nb.h"  #define EVPN_MH_VTY_STR "Multihoming\n" @@ -337,7 +338,6 @@ extern bool zebra_evpn_es_mac_ref_entry(struct zebra_mac *mac,  extern bool zebra_evpn_es_mac_ref(struct zebra_mac *mac, const esi_t *esi);  extern struct zebra_evpn_es *zebra_evpn_es_find(const esi_t *esi);  extern void zebra_evpn_interface_init(void); -extern int zebra_evpn_mh_if_write(struct vty *vty, struct interface *ifp);  extern void zebra_evpn_acc_vl_show(struct vty *vty, bool uj);  extern void zebra_evpn_acc_vl_show_detail(struct vty *vty, bool uj);  extern void zebra_evpn_if_es_print(struct vty *vty, json_object *json, diff --git a/zebra/zebra_nb.c b/zebra/zebra_nb.c index bb63a151e2..b261325f19 100644 --- a/zebra/zebra_nb.c +++ b/zebra/zebra_nb.c @@ -99,6 +99,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-zebra:zebra/ptm-enable",  			.cbs = {  				.modify = zebra_ptm_enable_modify, +				.cli_show = zebra_ptm_enable_cli_write,  			}  		},  #endif @@ -316,6 +317,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv4-addrs",  			.cbs = {  				.create = lib_interface_zebra_ipv4_addrs_create, +				.cli_show = lib_interface_zebra_ipv4_addrs_cli_write,  				.destroy = lib_interface_zebra_ipv4_addrs_destroy,  			}  		}, @@ -330,6 +332,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv4-p2p-addrs",  			.cbs = {  				.create = lib_interface_zebra_ipv4_p2p_addrs_create, +				.cli_show = lib_interface_zebra_ipv4_p2p_addrs_cli_write,  				.destroy = lib_interface_zebra_ipv4_p2p_addrs_destroy,  			}  		}, @@ -344,6 +347,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-addrs",  			.cbs = {  				.create = lib_interface_zebra_ipv6_addrs_create, +				.cli_show = lib_interface_zebra_ipv6_addrs_cli_write,  				.destroy = lib_interface_zebra_ipv6_addrs_destroy,  			}  		}, @@ -351,6 +355,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/multicast",  			.cbs = {  				.modify = lib_interface_zebra_multicast_modify, +				.cli_show = lib_interface_zebra_multicast_cli_write,  				.destroy = lib_interface_zebra_multicast_destroy,  			}  		}, @@ -358,12 +363,14 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/link-detect",  			.cbs = {  				.modify = lib_interface_zebra_link_detect_modify, +				.cli_show = lib_interface_zebra_link_detect_cli_write,  			}  		},  		{  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/enabled",  			.cbs = {  				.modify = lib_interface_zebra_enabled_modify, +				.cli_show = lib_interface_zebra_enabled_cli_write,  				.destroy = lib_interface_zebra_enabled_destroy,  			}  		}, @@ -371,6 +378,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/bandwidth",  			.cbs = {  				.modify = lib_interface_zebra_bandwidth_modify, +				.cli_show = lib_interface_zebra_bandwidth_cli_write,  				.destroy = lib_interface_zebra_bandwidth_destroy,  			}  		}, @@ -378,6 +386,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/mpls",  			.cbs = {  				.modify = lib_interface_zebra_mpls_modify, +				.cli_show = lib_interface_zebra_mpls_cli_write,  				.destroy = lib_interface_zebra_mpls_destroy,  			}  		}, @@ -386,12 +395,15 @@ const struct frr_yang_module_info frr_zebra_info = {  			.cbs = {  				.create = lib_interface_zebra_link_params_create,  				.destroy = lib_interface_zebra_link_params_destroy, +				.cli_show = lib_interface_zebra_link_params_cli_write, +				.cli_show_end = lib_interface_zebra_link_params_cli_write_end,  			}  		},  		{  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/link-params/metric",  			.cbs = {  				.modify = lib_interface_zebra_link_params_metric_modify, +				.cli_show = lib_interface_zebra_link_params_metric_cli_write,  				.destroy = lib_interface_zebra_link_params_metric_destroy,  			}  		}, @@ -399,6 +411,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/link-params/max-bandwidth",  			.cbs = {  				.modify = lib_interface_zebra_link_params_max_bandwidth_modify, +				.cli_show = lib_interface_zebra_link_params_max_bandwidth_cli_write,  				.destroy = lib_interface_zebra_link_params_max_bandwidth_destroy,  			}  		}, @@ -406,6 +419,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/link-params/max-reservable-bandwidth",  			.cbs = {  				.modify = lib_interface_zebra_link_params_max_reservable_bandwidth_modify, +				.cli_show = lib_interface_zebra_link_params_max_reservable_bandwidth_cli_write,  				.destroy = lib_interface_zebra_link_params_max_reservable_bandwidth_destroy,  			}  		}, @@ -413,6 +427,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/link-params/unreserved-bandwidths/unreserved-bandwidth",  			.cbs = {  				.create = lib_interface_zebra_link_params_unreserved_bandwidths_unreserved_bandwidth_create, +				.cli_show = lib_interface_zebra_link_params_unreserved_bandwidths_unreserved_bandwidth_cli_write,  				.destroy = lib_interface_zebra_link_params_unreserved_bandwidths_unreserved_bandwidth_destroy,  			}  		}, @@ -426,6 +441,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/link-params/residual-bandwidth",  			.cbs = {  				.modify = lib_interface_zebra_link_params_residual_bandwidth_modify, +				.cli_show = lib_interface_zebra_link_params_residual_bandwidth_cli_write,  				.destroy = lib_interface_zebra_link_params_residual_bandwidth_destroy,  			}  		}, @@ -433,6 +449,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/link-params/available-bandwidth",  			.cbs = {  				.modify = lib_interface_zebra_link_params_available_bandwidth_modify, +				.cli_show = lib_interface_zebra_link_params_available_bandwidth_cli_write,  				.destroy = lib_interface_zebra_link_params_available_bandwidth_destroy,  			}  		}, @@ -440,6 +457,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/link-params/utilized-bandwidth",  			.cbs = {  				.modify = lib_interface_zebra_link_params_utilized_bandwidth_modify, +				.cli_show = lib_interface_zebra_link_params_utilized_bandwidth_cli_write,  				.destroy = lib_interface_zebra_link_params_utilized_bandwidth_destroy,  			}  		}, @@ -475,6 +493,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/link-params/neighbor",  			.cbs = {  				.create = lib_interface_zebra_link_params_neighbor_create, +				.cli_show = lib_interface_zebra_link_params_neighbor_cli_write,  				.destroy = lib_interface_zebra_link_params_neighbor_destroy,  			}  		}, @@ -494,6 +513,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/link-params/delay",  			.cbs = {  				.modify = lib_interface_zebra_link_params_delay_modify, +				.cli_show = lib_interface_zebra_link_params_delay_cli_write,  				.destroy = lib_interface_zebra_link_params_delay_destroy,  			}  		}, @@ -520,6 +540,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/link-params/delay-variation",  			.cbs = {  				.modify = lib_interface_zebra_link_params_delay_variation_modify, +				.cli_show = lib_interface_zebra_link_params_delay_variation_cli_write,  				.destroy = lib_interface_zebra_link_params_delay_variation_destroy,  			}  		}, @@ -527,6 +548,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/link-params/packet-loss",  			.cbs = {  				.modify = lib_interface_zebra_link_params_packet_loss_modify, +				.cli_show = lib_interface_zebra_link_params_packet_loss_cli_write,  				.destroy = lib_interface_zebra_link_params_packet_loss_destroy,  			}  		}, @@ -534,6 +556,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/evpn-mh/type-0/esi",  			.cbs = {  				.modify = lib_interface_zebra_evpn_mh_type_0_esi_modify, +				.cli_show = lib_interface_zebra_evpn_mh_type_0_esi_cli_write,  				.destroy = lib_interface_zebra_evpn_mh_type_0_esi_destroy,  			}  		}, @@ -541,6 +564,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/evpn-mh/type-3/system-mac",  			.cbs = {  				.modify = lib_interface_zebra_evpn_mh_type_3_system_mac_modify, +				.cli_show = lib_interface_zebra_evpn_mh_type_3_system_mac_cli_write,  				.destroy = lib_interface_zebra_evpn_mh_type_3_system_mac_destroy,  			}  		}, @@ -548,6 +572,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/evpn-mh/type-3/local-discriminator",  			.cbs = {  				.modify = lib_interface_zebra_evpn_mh_type_3_local_discriminator_modify, +				.cli_show = lib_interface_zebra_evpn_mh_type_3_local_discriminator_cli_write,  				.destroy = lib_interface_zebra_evpn_mh_type_3_local_discriminator_destroy,  			}  		}, @@ -555,18 +580,21 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/evpn-mh/df-preference",  			.cbs = {  				.modify = lib_interface_zebra_evpn_mh_df_preference_modify, +				.cli_show = lib_interface_zebra_evpn_mh_df_preference_cli_write,  			}  		},  		{  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/evpn-mh/bypass",  			.cbs = {  				.modify = lib_interface_zebra_evpn_mh_bypass_modify, +				.cli_show = lib_interface_zebra_evpn_mh_bypass_cli_write,  			}  		},  		{  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/evpn-mh/uplink",  			.cbs = {  				.modify = lib_interface_zebra_evpn_mh_uplink_modify, +				.cli_show = lib_interface_zebra_evpn_mh_uplink_cli_write,  			}  		},  #if defined(HAVE_RTADV) @@ -574,54 +602,63 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/send-advertisements",  			.cbs = {  				.modify = lib_interface_zebra_ipv6_router_advertisements_send_advertisements_modify, +				.cli_show = lib_interface_zebra_ipv6_router_advertisements_send_advertisements_cli_write,  			}  		},  		{  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/max-rtr-adv-interval",  			.cbs = {  				.modify = lib_interface_zebra_ipv6_router_advertisements_max_rtr_adv_interval_modify, +				.cli_show = lib_interface_zebra_ipv6_router_advertisements_max_rtr_adv_interval_cli_write,  			}  		},  		{  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/managed-flag",  			.cbs = {  				.modify = lib_interface_zebra_ipv6_router_advertisements_managed_flag_modify, +				.cli_show = lib_interface_zebra_ipv6_router_advertisements_managed_flag_cli_write,  			}  		},  		{  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/other-config-flag",  			.cbs = {  				.modify = lib_interface_zebra_ipv6_router_advertisements_other_config_flag_modify, +				.cli_show = lib_interface_zebra_ipv6_router_advertisements_other_config_flag_cli_write,  			}  		},  		{  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/home-agent-flag",  			.cbs = {  				.modify = lib_interface_zebra_ipv6_router_advertisements_home_agent_flag_modify, +				.cli_show = lib_interface_zebra_ipv6_router_advertisements_home_agent_flag_cli_write,  			}  		},  		{  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/link-mtu",  			.cbs = {  				.modify = lib_interface_zebra_ipv6_router_advertisements_link_mtu_modify, +				.cli_show = lib_interface_zebra_ipv6_router_advertisements_link_mtu_cli_write,  			}  		},  		{  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/reachable-time",  			.cbs = {  				.modify = lib_interface_zebra_ipv6_router_advertisements_reachable_time_modify, +				.cli_show = lib_interface_zebra_ipv6_router_advertisements_reachable_time_cli_write,  			}  		},  		{  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/retrans-timer",  			.cbs = {  				.modify = lib_interface_zebra_ipv6_router_advertisements_retrans_timer_modify, +				.cli_show = lib_interface_zebra_ipv6_router_advertisements_retrans_timer_cli_write,  			}  		},  		{  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/cur-hop-limit",  			.cbs = {  				.modify = lib_interface_zebra_ipv6_router_advertisements_cur_hop_limit_modify, +				.cli_show = lib_interface_zebra_ipv6_router_advertisements_cur_hop_limit_cli_write,  				.destroy = lib_interface_zebra_ipv6_router_advertisements_cur_hop_limit_destroy,  			}  		}, @@ -629,6 +666,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/default-lifetime",  			.cbs = {  				.modify = lib_interface_zebra_ipv6_router_advertisements_default_lifetime_modify, +				.cli_show = lib_interface_zebra_ipv6_router_advertisements_default_lifetime_cli_write,  				.destroy = lib_interface_zebra_ipv6_router_advertisements_default_lifetime_destroy,  			}  		}, @@ -636,18 +674,21 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/fast-retransmit",  			.cbs = {  				.modify = lib_interface_zebra_ipv6_router_advertisements_fast_retransmit_modify, +				.cli_show = lib_interface_zebra_ipv6_router_advertisements_fast_retransmit_cli_write,  			}  		},  		{  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/advertisement-interval-option",  			.cbs = {  				.modify = lib_interface_zebra_ipv6_router_advertisements_advertisement_interval_option_modify, +				.cli_show = lib_interface_zebra_ipv6_router_advertisements_advertisement_interval_option_cli_write,  			}  		},  		{  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/home-agent-preference",  			.cbs = {  				.modify = lib_interface_zebra_ipv6_router_advertisements_home_agent_preference_modify, +				.cli_show = lib_interface_zebra_ipv6_router_advertisements_home_agent_preference_cli_write,  				.destroy = lib_interface_zebra_ipv6_router_advertisements_home_agent_preference_destroy,  			}  		}, @@ -655,6 +696,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/home-agent-lifetime",  			.cbs = {  				.modify = lib_interface_zebra_ipv6_router_advertisements_home_agent_lifetime_modify, +				.cli_show = lib_interface_zebra_ipv6_router_advertisements_home_agent_lifetime_cli_write,  				.destroy = lib_interface_zebra_ipv6_router_advertisements_home_agent_lifetime_destroy,  			}  		}, @@ -662,12 +704,14 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/default-router-preference",  			.cbs = {  				.modify = lib_interface_zebra_ipv6_router_advertisements_default_router_preference_modify, +				.cli_show = lib_interface_zebra_ipv6_router_advertisements_default_router_preference_cli_write,  			}  		},  		{  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/prefix-list/prefix",  			.cbs = {  				.create = lib_interface_zebra_ipv6_router_advertisements_prefix_list_prefix_create, +				.cli_show = lib_interface_zebra_ipv6_router_advertisements_prefix_list_prefix_cli_write,  				.destroy = lib_interface_zebra_ipv6_router_advertisements_prefix_list_prefix_destroy,  			}  		}, @@ -675,6 +719,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/dnssl/dnssl-domain",  			.cbs = {  				.create = lib_interface_zebra_ipv6_router_advertisements_dnssl_dnssl_domain_create, +				.cli_show = lib_interface_zebra_ipv6_router_advertisements_dnssl_dnssl_domain_cli_write,  				.destroy = lib_interface_zebra_ipv6_router_advertisements_dnssl_dnssl_domain_destroy,  			}  		}, @@ -719,6 +764,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/rdnss/rdnss-address",  			.cbs = {  				.create = lib_interface_zebra_ipv6_router_advertisements_rdnss_rdnss_address_create, +				.cli_show = lib_interface_zebra_ipv6_router_advertisements_rdnss_rdnss_address_cli_write,  				.destroy = lib_interface_zebra_ipv6_router_advertisements_rdnss_rdnss_address_destroy,  			}  		}, @@ -735,6 +781,7 @@ const struct frr_yang_module_info frr_zebra_info = {  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ptm-enable",  			.cbs = {  				.modify = lib_interface_zebra_ptm_enable_modify, +				.cli_show = lib_interface_zebra_ptm_enable_cli_write,  			}  		},  #endif diff --git a/zebra/zebra_nb.h b/zebra/zebra_nb.h index 886be0cf81..5343cb0e9b 100644 --- a/zebra/zebra_nb.h +++ b/zebra/zebra_nb.h @@ -46,6 +46,8 @@ int zebra_allow_external_route_update_destroy(struct nb_cb_destroy_args *args);  int zebra_dplane_queue_limit_modify(struct nb_cb_modify_args *args);  #if HAVE_BFDD == 0  int zebra_ptm_enable_modify(struct nb_cb_modify_args *args); +void zebra_ptm_enable_cli_write(struct vty *vty, const struct lyd_node *dnode, +				bool show_defaults);  #endif  int zebra_debugs_debug_events_modify(struct nb_cb_modify_args *args);  int zebra_debugs_debug_events_destroy(struct nb_cb_destroy_args *args); @@ -84,178 +86,319 @@ int zebra_debugs_debug_dplane_detail_destroy(struct nb_cb_destroy_args *args);  int zebra_debugs_debug_mlag_modify(struct nb_cb_modify_args *args);  int zebra_debugs_debug_mlag_destroy(struct nb_cb_destroy_args *args);  int lib_interface_zebra_ipv4_addrs_create(struct nb_cb_create_args *args); +void lib_interface_zebra_ipv4_addrs_cli_write(struct vty *vty, +					      const struct lyd_node *dnode, +					      bool show_defaults);  int lib_interface_zebra_ipv4_addrs_destroy(struct nb_cb_destroy_args *args);  int lib_interface_zebra_ipv4_addrs_label_modify(struct nb_cb_modify_args *args); +void lib_interface_zebra_ipv4_addrs_label_cli_write(struct vty *vty, +						    const struct lyd_node *dnode, +						    bool show_defaults);  int lib_interface_zebra_ipv4_addrs_label_destroy(struct nb_cb_destroy_args *args);  int lib_interface_zebra_ipv4_p2p_addrs_create(struct nb_cb_create_args *args); +void lib_interface_zebra_ipv4_p2p_addrs_cli_write(struct vty *vty, +						  const struct lyd_node *dnode, +						  bool show_defaults);  int lib_interface_zebra_ipv4_p2p_addrs_destroy(struct nb_cb_destroy_args *args);  int lib_interface_zebra_ipv4_p2p_addrs_label_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_ipv4_p2p_addrs_label_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv4_p2p_addrs_label_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_ipv6_addrs_create(struct nb_cb_create_args *args); +void lib_interface_zebra_ipv6_addrs_cli_write(struct vty *vty, +					      const struct lyd_node *dnode, +					      bool show_defaults);  int lib_interface_zebra_ipv6_addrs_destroy(struct nb_cb_destroy_args *args);  int lib_interface_zebra_multicast_modify(struct nb_cb_modify_args *args); +void lib_interface_zebra_multicast_cli_write(struct vty *vty, +					     const struct lyd_node *dnode, +					     bool show_defaults);  int lib_interface_zebra_multicast_destroy(struct nb_cb_destroy_args *args);  int lib_interface_zebra_link_detect_modify(struct nb_cb_modify_args *args); +void lib_interface_zebra_link_detect_cli_write(struct vty *vty, +					       const struct lyd_node *dnode, +					       bool show_defaults);  int lib_interface_zebra_enabled_modify(struct nb_cb_modify_args *args); +void lib_interface_zebra_enabled_cli_write(struct vty *vty, +					   const struct lyd_node *dnode, +					   bool show_defaults);  int lib_interface_zebra_enabled_destroy(struct nb_cb_destroy_args *args);  int lib_interface_zebra_bandwidth_modify(struct nb_cb_modify_args *args);  int lib_interface_zebra_bandwidth_destroy(struct nb_cb_destroy_args *args); +void lib_interface_zebra_bandwidth_cli_write(struct vty *vty, +					     const struct lyd_node *dnode, +					     bool show_defaults);  int lib_interface_zebra_mpls_modify(struct nb_cb_modify_args *args); +void lib_interface_zebra_mpls_cli_write(struct vty *vty, +					const struct lyd_node *dnode, +					bool show_defaults);  int lib_interface_zebra_mpls_destroy(struct nb_cb_destroy_args *args);  int lib_interface_zebra_link_params_create(struct nb_cb_create_args *args); +void lib_interface_zebra_link_params_cli_write(struct vty *vty, +					       const struct lyd_node *dnode, +					       bool show_defaults); +void lib_interface_zebra_link_params_cli_write_end(struct vty *vty, +						   const struct lyd_node *dnode);  int lib_interface_zebra_link_params_destroy(struct nb_cb_destroy_args *args);  int lib_interface_zebra_link_params_metric_modify(struct nb_cb_modify_args *args); +void lib_interface_zebra_link_params_metric_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_link_params_metric_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_link_params_max_bandwidth_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_link_params_max_bandwidth_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_link_params_max_bandwidth_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_link_params_max_reservable_bandwidth_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_link_params_max_reservable_bandwidth_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_link_params_max_reservable_bandwidth_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_link_params_unreserved_bandwidths_unreserved_bandwidth_create(  	struct nb_cb_create_args *args); +void lib_interface_zebra_link_params_unreserved_bandwidths_unreserved_bandwidth_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_link_params_unreserved_bandwidths_unreserved_bandwidth_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_link_params_unreserved_bandwidths_unreserved_bandwidth_unreserved_bandwidth_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_link_params_unreserved_bandwidths_unreserved_bandwidth_unreserved_bandwidth_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_link_params_residual_bandwidth_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_link_params_residual_bandwidth_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_link_params_residual_bandwidth_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_link_params_available_bandwidth_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_link_params_available_bandwidth_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_link_params_available_bandwidth_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_link_params_utilized_bandwidth_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_link_params_utilized_bandwidth_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_link_params_utilized_bandwidth_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_legacy_admin_group_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_link_params_legacy_admin_group_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_legacy_admin_group_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_affinity_create(struct nb_cb_create_args *args); +void lib_interface_zebra_link_params_affinities_affinity_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_affinity_destroy(struct nb_cb_destroy_args *args);  int lib_interface_zebra_affinity_mode_modify(struct nb_cb_modify_args *args); +void lib_interface_zebra_link_params_affinity_mode_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_link_params_neighbor_create(  	struct nb_cb_create_args *args); +void lib_interface_zebra_link_params_neighbor_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_link_params_neighbor_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_link_params_neighbor_remote_as_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_link_params_neighbor_remote_as_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_link_params_neighbor_ipv4_remote_id_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_link_params_neighbor_ipv4_remote_id_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_link_params_delay_modify(struct nb_cb_modify_args *args); +void lib_interface_zebra_link_params_delay_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_link_params_delay_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_link_params_min_max_delay_create(  	struct nb_cb_create_args *args); +void lib_interface_zebra_link_params_min_max_delay_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_link_params_min_max_delay_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_link_params_min_max_delay_delay_min_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_link_params_min_max_delay_delay_min_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_link_params_min_max_delay_delay_max_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_link_params_min_max_delay_delay_max_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_link_params_delay_variation_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_link_params_delay_variation_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_link_params_delay_variation_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_link_params_packet_loss_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_link_params_packet_loss_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_link_params_packet_loss_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_evpn_mh_type_0_esi_modify(struct nb_cb_modify_args *args); +void lib_interface_zebra_evpn_mh_type_0_esi_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_evpn_mh_type_0_esi_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_evpn_mh_type_3_system_mac_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_evpn_mh_type_3_system_mac_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_evpn_mh_type_3_system_mac_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_evpn_mh_type_3_local_discriminator_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_evpn_mh_type_3_local_discriminator_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_evpn_mh_type_3_local_discriminator_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_evpn_mh_df_preference_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_evpn_mh_df_preference_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_evpn_mh_bypass_modify(struct nb_cb_modify_args *args); +void lib_interface_zebra_evpn_mh_bypass_cli_write(struct vty *vty, +						  const struct lyd_node *dnode, +						  bool show_defaults);  int lib_interface_zebra_evpn_mh_uplink_modify(struct nb_cb_modify_args *args); +void lib_interface_zebra_evpn_mh_uplink_cli_write(struct vty *vty, +						  const struct lyd_node *dnode, +						  bool show_defaults);  #if defined(HAVE_RTADV)  int lib_interface_zebra_ipv6_router_advertisements_send_advertisements_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_ipv6_router_advertisements_send_advertisements_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_max_rtr_adv_interval_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_ipv6_router_advertisements_max_rtr_adv_interval_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_managed_flag_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_ipv6_router_advertisements_managed_flag_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_other_config_flag_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_ipv6_router_advertisements_other_config_flag_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_home_agent_flag_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_ipv6_router_advertisements_home_agent_flag_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_link_mtu_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_ipv6_router_advertisements_link_mtu_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_reachable_time_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_ipv6_router_advertisements_reachable_time_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_retrans_timer_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_ipv6_router_advertisements_retrans_timer_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_cur_hop_limit_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_ipv6_router_advertisements_cur_hop_limit_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_cur_hop_limit_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_ipv6_router_advertisements_default_lifetime_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_ipv6_router_advertisements_default_lifetime_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_default_lifetime_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_ipv6_router_advertisements_fast_retransmit_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_ipv6_router_advertisements_fast_retransmit_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_advertisement_interval_option_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_ipv6_router_advertisements_advertisement_interval_option_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_home_agent_preference_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_ipv6_router_advertisements_home_agent_preference_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_home_agent_preference_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_ipv6_router_advertisements_home_agent_lifetime_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_ipv6_router_advertisements_home_agent_lifetime_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_home_agent_lifetime_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_ipv6_router_advertisements_default_router_preference_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_ipv6_router_advertisements_default_router_preference_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_prefix_list_prefix_create(  	struct nb_cb_create_args *args); +void lib_interface_zebra_ipv6_router_advertisements_prefix_list_prefix_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_prefix_list_prefix_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_ipv6_router_advertisements_prefix_list_prefix_valid_lifetime_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_ipv6_router_advertisements_prefix_list_prefix_valid_lifetime_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_prefix_list_prefix_on_link_flag_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_ipv6_router_advertisements_prefix_list_prefix_on_link_flag_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_prefix_list_prefix_preferred_lifetime_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_ipv6_router_advertisements_prefix_list_prefix_preferred_lifetime_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_prefix_list_prefix_autonomous_flag_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_ipv6_router_advertisements_prefix_list_prefix_autonomous_flag_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_prefix_list_prefix_router_address_flag_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_ipv6_router_advertisements_prefix_list_prefix_router_address_flag_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_rdnss_rdnss_address_create(  	struct nb_cb_create_args *args); +void lib_interface_zebra_ipv6_router_advertisements_rdnss_rdnss_address_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_rdnss_rdnss_address_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_ipv6_router_advertisements_rdnss_rdnss_address_lifetime_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_ipv6_router_advertisements_rdnss_rdnss_address_lifetime_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_rdnss_rdnss_address_lifetime_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_ipv6_router_advertisements_dnssl_dnssl_domain_create(  	struct nb_cb_create_args *args); +void lib_interface_zebra_ipv6_router_advertisements_dnssl_dnssl_domain_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_dnssl_dnssl_domain_destroy(  	struct nb_cb_destroy_args *args);  int lib_interface_zebra_ipv6_router_advertisements_dnssl_dnssl_domain_lifetime_modify(  	struct nb_cb_modify_args *args); +void lib_interface_zebra_ipv6_router_advertisements_dnssl_dnssl_domain_lifetime_cli_write( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults);  int lib_interface_zebra_ipv6_router_advertisements_dnssl_dnssl_domain_lifetime_destroy(  	struct nb_cb_destroy_args *args);  #endif /* defined(HAVE_RTADV) */  #if HAVE_BFDD == 0  int lib_interface_zebra_ptm_enable_modify(struct nb_cb_modify_args *args); +void lib_interface_zebra_ptm_enable_cli_write(struct vty *vty, +					      const struct lyd_node *dnode, +					      bool show_defaults);  #endif  struct yang_data *  lib_interface_zebra_state_up_count_get_elem(struct nb_cb_get_elem_args *args); diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c index 0272315418..78284acc78 100644 --- a/zebra/zebra_ptm.c +++ b/zebra/zebra_ptm.c @@ -29,6 +29,7 @@  #include "zebra/zebra_ptm_redistribute.h"  #include "zebra/zebra_router.h"  #include "zebra_vrf.h" +#include "zebra_nb.h"  /*   * Choose the BFD implementation that we'll use. @@ -293,6 +294,17 @@ DEFUN_YANG (no_zebra_ptm_enable,  	return nb_cli_apply_changes(vty, NULL);  } +void zebra_ptm_enable_cli_write(struct vty *vty, const struct lyd_node *dnode, +				bool show_defaults) +{ +	bool enable = yang_dnode_get_bool(dnode, NULL); + +	if (enable) +		vty_out(vty, "ptm-enable\n"); +	else if (show_defaults) +		vty_out(vty, "no ptm-enable\n"); +} +  void zebra_if_ptm_enable(struct interface *ifp)  {  	struct zebra_if *if_data; @@ -365,12 +377,26 @@ DEFUN_YANG (no_zebra_ptm_enable_if,  	return nb_cli_apply_changes(vty, NULL);  } +void lib_interface_zebra_ptm_enable_cli_write(struct vty *vty, +					      const struct lyd_node *dnode, +					      bool show_defaults) +{ +	bool enable = yang_dnode_get_bool(dnode, NULL); + +	if (!enable) +		vty_out(vty, " no ptm-enable\n"); +	else if (show_defaults) +		vty_out(vty, " ptm-enable\n"); +} +  void zebra_ptm_write(struct vty *vty)  { -	if (ptm_cb.ptm_enable) -		vty_out(vty, "ptm-enable\n"); +	struct lyd_node *dnode; -	return; +	dnode = yang_dnode_get(running_config->dnode, +			       "/frr-zebra:zebra/ptm-enable"); +	if (dnode) +		nb_cli_show_dnode_cmds(vty, dnode, false);  }  static int zebra_ptm_socket_init(void) @@ -1184,12 +1210,6 @@ void zebra_ptm_if_set_ptm_state(struct interface *ifp,  		ifp->ptm_enable = zebra_ifp->ptm_enable;  } -void zebra_ptm_if_write(struct vty *vty, struct zebra_if *zebra_ifp) -{ -	if (zebra_ifp->ptm_enable == ZEBRA_IF_PTM_ENABLE_OFF) -		vty_out(vty, " no ptm-enable\n"); -} -  #else /* HAVE_BFDD */  /* @@ -1557,11 +1577,6 @@ void zebra_ptm_write(struct vty *vty __attribute__((__unused__)))  	/* NOTHING */  } -void zebra_ptm_if_write(struct vty *vty __attribute__((__unused__)), -			struct zebra_if *zifp __attribute__((__unused__))) -{ -	/* NOTHING */ -}  void zebra_ptm_if_set_ptm_state(struct interface *i __attribute__((__unused__)),  				struct zebra_if *zi __attribute__((__unused__)))  { diff --git a/zebra/zebra_ptm.h b/zebra/zebra_ptm.h index 571018349c..2e4afa5cf9 100644 --- a/zebra/zebra_ptm.h +++ b/zebra/zebra_ptm.h @@ -81,7 +81,6 @@ void zebra_ptm_show_status(struct vty *vty, json_object *json,  void zebra_ptm_if_init(struct zebra_if *zebra_ifp);  void zebra_ptm_if_set_ptm_state(struct interface *ifp,  				struct zebra_if *zebra_ifp); -void zebra_ptm_if_write(struct vty *vty, struct zebra_if *zebra_ifp);  #ifdef __cplusplus  } diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index b778b39508..db59b138e9 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -51,6 +51,7 @@  #include "zebra/zebra_script.h"  #include "zebra/rtadv.h"  #include "zebra/zebra_neigh.h" +#include "zebra/zebra_ptm.h"  /* context to manage dumps in multiple tables or vrfs */  struct route_show_ctx { @@ -3971,6 +3972,8 @@ DEFPY (zebra_nexthop_group_keep,  static int config_write_protocol(struct vty *vty)  { +	zebra_ptm_write(vty); +  	if (zrouter.allow_delete)  		vty_out(vty, "allow-external-route-update\n");  | 
