mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 23:58:44 +00:00
zebra: convert interface evpn mh es-df-pref command to NB
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
This commit is contained in:
parent
a6db1c14a4
commit
7c6e41ecff
@ -2245,6 +2245,12 @@ module frr-zebra {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
leaf df-preference {
|
||||||
|
type uint16;
|
||||||
|
default "32767";
|
||||||
|
description
|
||||||
|
"Preference value used for DF election.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
container state {
|
container state {
|
||||||
config false;
|
config false;
|
||||||
|
@ -148,6 +148,8 @@ static int if_zebra_new_hook(struct interface *ifp)
|
|||||||
|
|
||||||
rtadv_if_init(zebra_if);
|
rtadv_if_init(zebra_if);
|
||||||
|
|
||||||
|
zebra_evpn_mh_if_init(zebra_if);
|
||||||
|
|
||||||
memset(&zebra_if->neigh_mac[0], 0, 6);
|
memset(&zebra_if->neigh_mac[0], 0, 6);
|
||||||
|
|
||||||
/* Initialize installed address chains tree. */
|
/* Initialize installed address chains tree. */
|
||||||
|
@ -2251,8 +2251,7 @@ static void zebra_evpn_es_local_info_set(struct zebra_evpn_es *es,
|
|||||||
|
|
||||||
/* attach es to interface */
|
/* attach es to interface */
|
||||||
zif->es_info.es = es;
|
zif->es_info.es = es;
|
||||||
es->df_pref = zif->es_info.df_pref ? zif->es_info.df_pref
|
es->df_pref = zif->es_info.df_pref;
|
||||||
: EVPN_MH_DF_PREF_DEFAULT;
|
|
||||||
|
|
||||||
/* attach interface to es */
|
/* attach interface to es */
|
||||||
es->zif = zif;
|
es->zif = zif;
|
||||||
@ -2706,10 +2705,9 @@ void zebra_evpn_es_cleanup(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void zebra_evpn_es_df_pref_update(struct zebra_if *zif, uint16_t df_pref)
|
void zebra_evpn_es_df_pref_update(struct zebra_if *zif, uint16_t df_pref)
|
||||||
{
|
{
|
||||||
struct zebra_evpn_es *es;
|
struct zebra_evpn_es *es;
|
||||||
uint16_t tmp_pref;
|
|
||||||
|
|
||||||
if (zif->es_info.df_pref == df_pref)
|
if (zif->es_info.df_pref == df_pref)
|
||||||
return;
|
return;
|
||||||
@ -2720,13 +2718,10 @@ static void zebra_evpn_es_df_pref_update(struct zebra_if *zif, uint16_t df_pref)
|
|||||||
if (!es)
|
if (!es)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tmp_pref = zif->es_info.df_pref ? zif->es_info.df_pref
|
if (es->df_pref == zif->es_info.df_pref)
|
||||||
: EVPN_MH_DF_PREF_DEFAULT;
|
|
||||||
|
|
||||||
if (es->df_pref == tmp_pref)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
es->df_pref = tmp_pref;
|
es->df_pref = zif->es_info.df_pref;
|
||||||
/* run df election */
|
/* run df election */
|
||||||
zebra_evpn_es_run_df_election(es, __func__);
|
zebra_evpn_es_run_df_election(es, __func__);
|
||||||
/* notify bgp */
|
/* notify bgp */
|
||||||
@ -3330,7 +3325,7 @@ int zebra_evpn_mh_if_write(struct vty *vty, struct interface *ifp)
|
|||||||
vty_out(vty, " evpn mh es-id %s\n",
|
vty_out(vty, " evpn mh es-id %s\n",
|
||||||
esi_to_str(&zif->es_info.esi, esi_buf, sizeof(esi_buf)));
|
esi_to_str(&zif->es_info.esi, esi_buf, sizeof(esi_buf)));
|
||||||
|
|
||||||
if (zif->es_info.df_pref)
|
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);
|
vty_out(vty, " evpn mh es-df-pref %u\n", zif->es_info.df_pref);
|
||||||
|
|
||||||
if (zif->flags & ZIF_FLAG_EVPN_MH_UPLINK)
|
if (zif->flags & ZIF_FLAG_EVPN_MH_UPLINK)
|
||||||
@ -3339,6 +3334,11 @@ int zebra_evpn_mh_if_write(struct vty *vty, struct interface *ifp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void zebra_evpn_mh_if_init(struct zebra_if *zif)
|
||||||
|
{
|
||||||
|
zif->es_info.df_pref = EVPN_MH_DF_PREF_DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
#include "zebra/zebra_evpn_mh_clippy.c"
|
#include "zebra/zebra_evpn_mh_clippy.c"
|
||||||
/* CLI for setting an ES in bypass mode */
|
/* CLI for setting an ES in bypass mode */
|
||||||
DEFPY_HIDDEN(zebra_evpn_es_bypass, zebra_evpn_es_bypass_cmd,
|
DEFPY_HIDDEN(zebra_evpn_es_bypass, zebra_evpn_es_bypass_cmd,
|
||||||
@ -3364,28 +3364,24 @@ DEFPY_HIDDEN(zebra_evpn_es_bypass, zebra_evpn_es_bypass_cmd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* CLI for configuring DF preference part for an ES */
|
/* CLI for configuring DF preference part for an ES */
|
||||||
DEFPY(zebra_evpn_es_pref, zebra_evpn_es_pref_cmd,
|
DEFPY_YANG (zebra_evpn_es_pref,
|
||||||
"[no$no] evpn mh es-df-pref [(1-65535)$df_pref]",
|
zebra_evpn_es_pref_cmd,
|
||||||
NO_STR "EVPN\n" EVPN_MH_VTY_STR
|
"[no$no] evpn mh es-df-pref ![(1-65535)$df_pref]",
|
||||||
"preference value used for DF election\n"
|
NO_STR
|
||||||
"pref\n")
|
"EVPN\n"
|
||||||
|
EVPN_MH_VTY_STR
|
||||||
|
"Preference value used for DF election\n"
|
||||||
|
"Preference\n")
|
||||||
{
|
{
|
||||||
VTY_DECLVAR_CONTEXT(interface, ifp);
|
if (!no)
|
||||||
struct zebra_if *zif;
|
nb_cli_enqueue_change(vty,
|
||||||
|
"./frr-zebra:zebra/evpn-mh/df-preference",
|
||||||
zif = ifp->info;
|
NB_OP_MODIFY, df_pref_str);
|
||||||
|
else
|
||||||
if (no) {
|
nb_cli_enqueue_change(vty,
|
||||||
zebra_evpn_es_df_pref_update(zif, 0);
|
"./frr-zebra:zebra/evpn-mh/df-preference",
|
||||||
} else {
|
NB_OP_DESTROY, NULL);
|
||||||
if (!zebra_evpn_is_if_es_capable(zif)) {
|
return nb_cli_apply_changes(vty, NULL);
|
||||||
vty_out(vty,
|
|
||||||
"%% DF preference cannot be associated with this interface type\n");
|
|
||||||
return CMD_WARNING;
|
|
||||||
}
|
|
||||||
zebra_evpn_es_df_pref_update(zif, df_pref);
|
|
||||||
}
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CLI for setting up sysmac part of ESI on an access port */
|
/* CLI for setting up sysmac part of ESI on an access port */
|
||||||
|
@ -388,4 +388,8 @@ void zebra_evpn_es_sys_mac_update(struct zebra_if *zif, struct ethaddr *sysmac);
|
|||||||
void zebra_evpn_es_lid_update(struct zebra_if *zif, uint32_t lid);
|
void zebra_evpn_es_lid_update(struct zebra_if *zif, uint32_t lid);
|
||||||
void zebra_evpn_es_type0_esi_update(struct zebra_if *zif, esi_t *esi);
|
void zebra_evpn_es_type0_esi_update(struct zebra_if *zif, esi_t *esi);
|
||||||
|
|
||||||
|
void zebra_evpn_es_df_pref_update(struct zebra_if *zif, uint16_t df_pref);
|
||||||
|
|
||||||
|
void zebra_evpn_mh_if_init(struct zebra_if *zif);
|
||||||
|
|
||||||
#endif /* _ZEBRA_EVPN_MH_H */
|
#endif /* _ZEBRA_EVPN_MH_H */
|
||||||
|
@ -528,6 +528,12 @@ const struct frr_yang_module_info frr_zebra_info = {
|
|||||||
.destroy = lib_interface_zebra_evpn_mh_type_3_local_discriminator_destroy,
|
.destroy = lib_interface_zebra_evpn_mh_type_3_local_discriminator_destroy,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/evpn-mh/df-preference",
|
||||||
|
.cbs = {
|
||||||
|
.modify = lib_interface_zebra_evpn_mh_df_preference_modify,
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/state/up-count",
|
.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/state/up-count",
|
||||||
.cbs = {
|
.cbs = {
|
||||||
|
@ -177,6 +177,8 @@ int lib_interface_zebra_evpn_mh_type_3_local_discriminator_modify(
|
|||||||
struct nb_cb_modify_args *args);
|
struct nb_cb_modify_args *args);
|
||||||
int lib_interface_zebra_evpn_mh_type_3_local_discriminator_destroy(
|
int lib_interface_zebra_evpn_mh_type_3_local_discriminator_destroy(
|
||||||
struct nb_cb_destroy_args *args);
|
struct nb_cb_destroy_args *args);
|
||||||
|
int lib_interface_zebra_evpn_mh_df_preference_modify(
|
||||||
|
struct nb_cb_modify_args *args);
|
||||||
struct yang_data *
|
struct yang_data *
|
||||||
lib_interface_zebra_state_up_count_get_elem(struct nb_cb_get_elem_args *args);
|
lib_interface_zebra_state_up_count_get_elem(struct nb_cb_get_elem_args *args);
|
||||||
struct yang_data *
|
struct yang_data *
|
||||||
|
@ -2400,6 +2400,25 @@ int lib_interface_zebra_evpn_mh_type_3_local_discriminator_destroy(
|
|||||||
return NB_OK;
|
return NB_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XPath: /frr-interface:lib/interface/frr-zebra:zebra/evpn-mh/df-preference
|
||||||
|
*/
|
||||||
|
int lib_interface_zebra_evpn_mh_df_preference_modify(
|
||||||
|
struct nb_cb_modify_args *args)
|
||||||
|
{
|
||||||
|
struct interface *ifp;
|
||||||
|
uint16_t df_pref;
|
||||||
|
|
||||||
|
if (args->event != NB_EV_APPLY)
|
||||||
|
return NB_OK;
|
||||||
|
|
||||||
|
ifp = nb_running_get_entry(args->dnode, NULL, true);
|
||||||
|
df_pref = yang_dnode_get_uint16(args->dnode, NULL);
|
||||||
|
zebra_evpn_es_df_pref_update(ifp->info, df_pref);
|
||||||
|
|
||||||
|
return NB_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPath: /frr-vrf:lib/vrf/frr-zebra:zebra/l3vni-id
|
* XPath: /frr-vrf:lib/vrf/frr-zebra:zebra/l3vni-id
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user