summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2024-01-22 22:21:38 +0200
committerIgor Ryzhov <iryzhov@nfware.com>2024-01-28 23:28:39 +0200
commit10757acae605cb8215608fec03e1b1ebcdcfe74d (patch)
tree654c4360de2d8a3baae048e47b6f7b0c13ff3db2
parent4a18818b02c55c6a5313b5d49c4447daef3a3816 (diff)
zebra: convert interface evpn mh uplink command to NB
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
-rw-r--r--yang/frr-zebra.yang6
-rw-r--r--zebra/zebra_evpn_mh.c26
-rw-r--r--zebra/zebra_evpn_mh.h1
-rw-r--r--zebra/zebra_nb.c6
-rw-r--r--zebra/zebra_nb.h1
-rw-r--r--zebra/zebra_nb_config.c18
6 files changed, 47 insertions, 11 deletions
diff --git a/yang/frr-zebra.yang b/yang/frr-zebra.yang
index ed2be1a2bc..95e4fc6db1 100644
--- a/yang/frr-zebra.yang
+++ b/yang/frr-zebra.yang
@@ -2257,6 +2257,12 @@ module frr-zebra {
description
"Bypass mode.";
}
+ leaf uplink {
+ type boolean;
+ default "false";
+ description
+ "Uplink to the VxLAN core.";
+ }
}
container state {
config false;
diff --git a/zebra/zebra_evpn_mh.c b/zebra/zebra_evpn_mh.c
index 840ea98e4d..4a9c048833 100644
--- a/zebra/zebra_evpn_mh.c
+++ b/zebra/zebra_evpn_mh.c
@@ -56,7 +56,6 @@ static void zebra_evpn_local_es_del(struct zebra_evpn_es **esp);
static void zebra_evpn_local_es_update(struct zebra_if *zif);
static bool zebra_evpn_es_br_port_dplane_update(struct zebra_evpn_es *es,
const char *caller);
-static void zebra_evpn_mh_uplink_cfg_update(struct zebra_if *zif, bool set);
static void zebra_evpn_mh_update_protodown_es(struct zebra_evpn_es *es,
bool resync_dplane);
static void zebra_evpn_mh_clear_protodown_es(struct zebra_evpn_es *es);
@@ -3434,16 +3433,21 @@ DEFPY_YANG (zebra_evpn_es_id,
}
/* CLI for tagging an interface as an uplink */
-DEFPY(zebra_evpn_mh_uplink, zebra_evpn_mh_uplink_cmd, "[no] evpn mh uplink",
- NO_STR "EVPN\n" EVPN_MH_VTY_STR "uplink to the VxLAN core\n")
+DEFPY_YANG (zebra_evpn_mh_uplink,
+ zebra_evpn_mh_uplink_cmd,
+ "[no] evpn mh uplink",
+ NO_STR
+ "EVPN\n"
+ EVPN_MH_VTY_STR
+ "Uplink to the VxLAN core\n")
{
- VTY_DECLVAR_CONTEXT(interface, ifp);
- struct zebra_if *zif;
-
- zif = ifp->info;
- zebra_evpn_mh_uplink_cfg_update(zif, no ? false : true);
-
- return CMD_SUCCESS;
+ if (!no)
+ nb_cli_enqueue_change(vty, "./frr-zebra:zebra/evpn-mh/uplink",
+ NB_OP_MODIFY, "true");
+ else
+ nb_cli_enqueue_change(vty, "./frr-zebra:zebra/evpn-mh/uplink",
+ NB_OP_DESTROY, NULL);
+ return nb_cli_apply_changes(vty, NULL);
}
void zebra_evpn_mh_json(json_object *json)
@@ -3780,7 +3784,7 @@ static void zebra_evpn_mh_uplink_oper_flags_update(struct zebra_if *zif,
}
}
-static void zebra_evpn_mh_uplink_cfg_update(struct zebra_if *zif, bool set)
+void zebra_evpn_mh_uplink_cfg_update(struct zebra_if *zif, bool set)
{
bool old_protodown = zebra_evpn_mh_is_all_uplinks_down();
bool new_protodown;
diff --git a/zebra/zebra_evpn_mh.h b/zebra/zebra_evpn_mh.h
index a3e44e1753..fe450d4c2b 100644
--- a/zebra/zebra_evpn_mh.h
+++ b/zebra/zebra_evpn_mh.h
@@ -390,6 +390,7 @@ 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_es_bypass_cfg_update(struct zebra_if *zif, bool bypass);
+void zebra_evpn_mh_uplink_cfg_update(struct zebra_if *zif, bool set);
void zebra_evpn_mh_if_init(struct zebra_if *zif);
diff --git a/zebra/zebra_nb.c b/zebra/zebra_nb.c
index 91e3bc3c3b..15cb9c0858 100644
--- a/zebra/zebra_nb.c
+++ b/zebra/zebra_nb.c
@@ -541,6 +541,12 @@ const struct frr_yang_module_info frr_zebra_info = {
}
},
{
+ .xpath = "/frr-interface:lib/interface/frr-zebra:zebra/evpn-mh/uplink",
+ .cbs = {
+ .modify = lib_interface_zebra_evpn_mh_uplink_modify,
+ }
+ },
+ {
.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/state/up-count",
.cbs = {
.get_elem = lib_interface_zebra_state_up_count_get_elem,
diff --git a/zebra/zebra_nb.h b/zebra/zebra_nb.h
index e9822617cf..1ddc985ffd 100644
--- a/zebra/zebra_nb.h
+++ b/zebra/zebra_nb.h
@@ -180,6 +180,7 @@ int lib_interface_zebra_evpn_mh_type_3_local_discriminator_destroy(
int lib_interface_zebra_evpn_mh_df_preference_modify(
struct nb_cb_modify_args *args);
int lib_interface_zebra_evpn_mh_bypass_modify(struct nb_cb_modify_args *args);
+int lib_interface_zebra_evpn_mh_uplink_modify(struct nb_cb_modify_args *args);
struct yang_data *
lib_interface_zebra_state_up_count_get_elem(struct nb_cb_get_elem_args *args);
struct yang_data *
diff --git a/zebra/zebra_nb_config.c b/zebra/zebra_nb_config.c
index 68f646098d..eb3d5eec2c 100644
--- a/zebra/zebra_nb_config.c
+++ b/zebra/zebra_nb_config.c
@@ -2438,6 +2438,24 @@ int lib_interface_zebra_evpn_mh_bypass_modify(struct nb_cb_modify_args *args)
}
/*
+ * XPath: /frr-interface:lib/interface/frr-zebra:zebra/evpn-mh/uplink
+ */
+int lib_interface_zebra_evpn_mh_uplink_modify(struct nb_cb_modify_args *args)
+{
+ struct interface *ifp;
+ bool uplink;
+
+ if (args->event != NB_EV_APPLY)
+ return NB_OK;
+
+ ifp = nb_running_get_entry(args->dnode, NULL, true);
+ uplink = yang_dnode_get_bool(args->dnode, NULL);
+ zebra_evpn_mh_uplink_cfg_update(ifp->info, uplink);
+
+ return NB_OK;
+}
+
+/*
* XPath: /frr-vrf:lib/vrf/frr-zebra:zebra/l3vni-id
*/
int lib_vrf_zebra_l3vni_id_modify(struct nb_cb_modify_args *args)