mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 02:53:55 +00:00
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>
This commit is contained in:
parent
8291e3a313
commit
7832bbcc30
@ -1982,6 +1982,12 @@ module frr-zebra {
|
|||||||
"Interface admin status.";
|
"Interface admin status.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
leaf mpls {
|
||||||
|
type boolean;
|
||||||
|
description
|
||||||
|
"Interface MPLS status.";
|
||||||
|
}
|
||||||
|
|
||||||
leaf bandwidth {
|
leaf bandwidth {
|
||||||
type uint32 {
|
type uint32 {
|
||||||
range "1..100000";
|
range "1..100000";
|
||||||
|
@ -3783,21 +3783,14 @@ DEFPY (mpls,
|
|||||||
"Set mpls to be on for the interface\n"
|
"Set mpls to be on for the interface\n"
|
||||||
"Set mpls to be off for the interface\n")
|
"Set mpls to be off for the interface\n")
|
||||||
{
|
{
|
||||||
VTY_DECLVAR_CONTEXT(interface, ifp);
|
if (!no)
|
||||||
struct zebra_if *if_data = ifp->info;
|
nb_cli_enqueue_change(vty, "./frr-zebra:zebra/mpls",
|
||||||
|
NB_OP_CREATE, on ? "true" : "false");
|
||||||
|
else
|
||||||
|
nb_cli_enqueue_change(vty, "./frr-zebra:zebra/mpls",
|
||||||
|
NB_OP_DESTROY, NULL);
|
||||||
|
|
||||||
if (no) {
|
return nb_cli_apply_changes(vty, NULL);
|
||||||
/* keep the state as it is */
|
|
||||||
if_data->mpls_config = IF_ZEBRA_DATA_UNSPEC;
|
|
||||||
} else {
|
|
||||||
dplane_intf_mpls_modify_state(ifp, !!on);
|
|
||||||
if (on)
|
|
||||||
if_data->mpls_config = IF_ZEBRA_DATA_ON;
|
|
||||||
else
|
|
||||||
if_data->mpls_config = IF_ZEBRA_DATA_OFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int if_multicast_unset(struct interface *ifp)
|
int if_multicast_unset(struct interface *ifp)
|
||||||
|
@ -338,6 +338,13 @@ const struct frr_yang_module_info frr_zebra_info = {
|
|||||||
.destroy = lib_interface_zebra_bandwidth_destroy,
|
.destroy = lib_interface_zebra_bandwidth_destroy,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/mpls",
|
||||||
|
.cbs = {
|
||||||
|
.modify = lib_interface_zebra_mpls_modify,
|
||||||
|
.destroy = lib_interface_zebra_mpls_destroy,
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/bandwidth",
|
.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/bandwidth",
|
||||||
.cbs = {
|
.cbs = {
|
||||||
|
@ -96,6 +96,8 @@ int lib_interface_zebra_shutdown_modify(struct nb_cb_modify_args *args);
|
|||||||
int lib_interface_zebra_shutdown_destroy(struct nb_cb_destroy_args *args);
|
int lib_interface_zebra_shutdown_destroy(struct nb_cb_destroy_args *args);
|
||||||
int lib_interface_zebra_bandwidth_modify(struct nb_cb_modify_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);
|
int lib_interface_zebra_bandwidth_destroy(struct nb_cb_destroy_args *args);
|
||||||
|
int lib_interface_zebra_mpls_modify(struct nb_cb_modify_args *args);
|
||||||
|
int lib_interface_zebra_mpls_destroy(struct nb_cb_destroy_args *args);
|
||||||
int lib_interface_zebra_legacy_admin_group_modify(
|
int lib_interface_zebra_legacy_admin_group_modify(
|
||||||
struct nb_cb_modify_args *args);
|
struct nb_cb_modify_args *args);
|
||||||
int lib_interface_zebra_legacy_admin_group_destroy(
|
int lib_interface_zebra_legacy_admin_group_destroy(
|
||||||
|
@ -1087,6 +1087,50 @@ int lib_interface_zebra_shutdown_destroy(struct nb_cb_destroy_args *args)
|
|||||||
return NB_OK;
|
return NB_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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
|
* XPath: /frr-interface:lib/interface/frr-zebra:zebra/bandwidth
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user