diff options
| author | Philippe Guibert <philippe.guibert@6wind.com> | 2023-07-09 21:44:03 +0200 | 
|---|---|---|
| committer | Philippe Guibert <philippe.guibert@6wind.com> | 2023-08-10 18:13:21 +0200 | 
| commit | 7832bbcc30cd770e2f85b0b96fb0a4f09e29095e (patch) | |
| tree | 1bb30be0c68d4804a1c951ce6078410e8ecd42b3 /zebra/zebra_nb_config.c | |
| parent | 8291e3a3138163b169441dbb321b863cb7b6a345 (diff) | |
zebra, yang: add an mpls leaf to interface
The yang NB API does not handle the mpls configuration
on its leaf.
Add an mpls leaf to stick to the mpls configuration.
- true or false to mean if config
- not defined, means no config.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'zebra/zebra_nb_config.c')
| -rw-r--r-- | zebra/zebra_nb_config.c | 44 | 
1 files changed, 44 insertions, 0 deletions
diff --git a/zebra/zebra_nb_config.c b/zebra/zebra_nb_config.c index 336669a49b..5ea03112bc 100644 --- a/zebra/zebra_nb_config.c +++ b/zebra/zebra_nb_config.c @@ -1088,6 +1088,50 @@ int lib_interface_zebra_shutdown_destroy(struct nb_cb_destroy_args *args)  }  /* + * XPath: /frr-interface:lib/interface/frr-zebra:zebra/mpls + */ +int lib_interface_zebra_mpls_modify(struct nb_cb_modify_args *args) +{ +	struct interface *ifp; +	bool mpls; +	struct zebra_if *zif; + +	if (args->event != NB_EV_APPLY) +		return NB_OK; + +	ifp = nb_running_get_entry(args->dnode, NULL, true); +	zif = ifp->info; +	mpls = yang_dnode_get_bool(args->dnode, NULL); + +	if (mpls) +		zif->mpls_config = IF_ZEBRA_DATA_ON; +	else +		zif->mpls_config = IF_ZEBRA_DATA_OFF; + +	dplane_intf_mpls_modify_state(ifp, mpls); + +	return NB_OK; +} + +int lib_interface_zebra_mpls_destroy(struct nb_cb_destroy_args *args) +{ +	struct interface *ifp; +	struct zebra_if *zif; + +	if (args->event != NB_EV_APPLY) +		return NB_OK; + +	ifp = nb_running_get_entry(args->dnode, NULL, true); +	zif = ifp->info; + +	zif->mpls_config = IF_ZEBRA_DATA_UNSPEC; + +	/* keep the state as it is */ + +	return NB_OK; +} + +/*   * XPath: /frr-interface:lib/interface/frr-zebra:zebra/bandwidth   */  int lib_interface_zebra_bandwidth_modify(struct nb_cb_modify_args *args)  | 
