summaryrefslogtreecommitdiffstats
path: root/isisd
diff options
context:
space:
mode:
authorEmanuele Di Pascale <emanuele@voltanet.io>2018-12-10 11:44:30 +0100
committerEmanuele Di Pascale <emanuele@voltanet.io>2018-12-18 15:24:46 +0100
commit5f1e5e3fc6475fddecc8c8c8b77a10a080f0a20f (patch)
tree2443da5ae708761f454894f30a3796fd9a6ff553 /isisd
parentisisd: embed the isisd yang model (diff)
downloadfrr-5f1e5e3fc6475fddecc8c8c8b77a10a080f0a20f.tar.xz
frr-5f1e5e3fc6475fddecc8c8c8b77a10a080f0a20f.zip
isisd, yang: change type empty leafs to booleans
As requested by the reviewers. Additionally, added a check when setting a circuit on an interface to see if it is a loopback, and in that case, set it to passive. Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
Diffstat (limited to 'isisd')
-rw-r--r--isisd/isis_cli.c94
-rw-r--r--isisd/isis_northbound.c355
2 files changed, 141 insertions, 308 deletions
diff --git a/isisd/isis_cli.c b/isisd/isis_cli.c
index 3227f41b4..e4006fb3b 100644
--- a/isisd/isis_cli.c
+++ b/isisd/isis_cli.c
@@ -133,6 +133,9 @@ DEFPY(ip_router_isis, ip_router_isis_cmd, "ip router isis WORD$tag",
char temp_xpath[XPATH_MAXLEN];
const char *circ_type;
struct isis_area *area;
+ struct interface *ifp;
+ const struct lyd_node *dnode =
+ yang_dnode_get(running_config->dnode, VTY_CURR_XPATH);
/* area will be created if it is not present. make sure the yang model
* is synced with FRR and call the appropriate NB cb.
@@ -153,7 +156,7 @@ DEFPY(ip_router_isis, ip_router_isis_cmd, "ip router isis WORD$tag",
nb_cli_enqueue_change(vty, "./frr-isisd:isis/area-tag",
NB_OP_MODIFY, tag);
nb_cli_enqueue_change(vty, "./frr-isisd:isis/ipv4-routing",
- NB_OP_CREATE, NULL);
+ NB_OP_MODIFY, "true");
nb_cli_enqueue_change(
vty, "./frr-isisd:isis/circuit-type", NB_OP_MODIFY,
listcount(isis->area_list) == 0 ? "level-1-2"
@@ -176,11 +179,17 @@ DEFPY(ip_router_isis, ip_router_isis_cmd, "ip router isis WORD$tag",
nb_cli_enqueue_change(vty, "./frr-isisd:isis/area-tag",
NB_OP_MODIFY, tag);
nb_cli_enqueue_change(vty, "./frr-isisd:isis/ipv4-routing",
- NB_OP_CREATE, NULL);
+ NB_OP_MODIFY, "true");
nb_cli_enqueue_change(vty, "./frr-isisd:isis/circuit-type",
NB_OP_MODIFY, circ_type);
}
+ /* check if the interface is a loopback and if so set it as passive */
+ ifp = yang_dnode_get_entry(dnode, false);
+ if (ifp && if_is_loopback(ifp))
+ nb_cli_enqueue_change(vty, "./frr-isisd:isis/passive",
+ NB_OP_MODIFY, "true");
+
return nb_cli_apply_changes(vty, NULL);
}
@@ -193,6 +202,9 @@ DEFPY(ip6_router_isis, ip6_router_isis_cmd, "ipv6 router isis WORD$tag",
char temp_xpath[XPATH_MAXLEN];
const char *circ_type;
struct isis_area *area;
+ struct interface *ifp;
+ const struct lyd_node *dnode =
+ yang_dnode_get(running_config->dnode, VTY_CURR_XPATH);
/* area will be created if it is not present. make sure the yang model
* is synced with FRR and call the appropriate NB cb.
@@ -213,7 +225,7 @@ DEFPY(ip6_router_isis, ip6_router_isis_cmd, "ipv6 router isis WORD$tag",
nb_cli_enqueue_change(vty, "./frr-isisd:isis/area-tag",
NB_OP_MODIFY, tag);
nb_cli_enqueue_change(vty, "./frr-isisd:isis/ipv6-routing",
- NB_OP_CREATE, NULL);
+ NB_OP_MODIFY, "true");
nb_cli_enqueue_change(
vty, "./frr-isisd:isis/circuit-type", NB_OP_MODIFY,
listcount(isis->area_list) == 0 ? "level-1-2"
@@ -236,11 +248,17 @@ DEFPY(ip6_router_isis, ip6_router_isis_cmd, "ipv6 router isis WORD$tag",
nb_cli_enqueue_change(vty, "./frr-isisd:isis/area-tag",
NB_OP_MODIFY, tag);
nb_cli_enqueue_change(vty, "./frr-isisd:isis/ipv6-routing",
- NB_OP_CREATE, NULL);
+ NB_OP_MODIFY, "true");
nb_cli_enqueue_change(vty, "./frr-isisd:isis/circuit-type",
NB_OP_MODIFY, circ_type);
}
+ /* check if the interface is a loopback and if so set it as passive */
+ ifp = yang_dnode_get_entry(dnode, false);
+ if (ifp && if_is_loopback(ifp))
+ nb_cli_enqueue_change(vty, "./frr-isisd:isis/passive",
+ NB_OP_MODIFY, "true");
+
return nb_cli_apply_changes(vty, NULL);
}
@@ -274,7 +292,7 @@ DEFPY(no_ip_router_isis, no_ip_router_isis_cmd,
else
nb_cli_enqueue_change(vty,
"./frr-isisd:isis/ipv6-routing",
- NB_OP_DELETE, NULL);
+ NB_OP_MODIFY, "false");
} else { /* no ipv4 */
if (circuit && !circuit->ipv6_router)
nb_cli_enqueue_change(vty, "./frr-isisd:isis",
@@ -282,7 +300,7 @@ DEFPY(no_ip_router_isis, no_ip_router_isis_cmd,
else
nb_cli_enqueue_change(vty,
"./frr-isisd:isis/ipv4-routing",
- NB_OP_DELETE, NULL);
+ NB_OP_MODIFY, "false");
}
return nb_cli_apply_changes(vty, NULL);
@@ -291,6 +309,8 @@ DEFPY(no_ip_router_isis, no_ip_router_isis_cmd,
void cli_show_ip_isis_ipv4(struct vty *vty, struct lyd_node *dnode,
bool show_defaults)
{
+ if (!yang_dnode_get_bool(dnode, NULL))
+ vty_out(vty, " no");
vty_out(vty, " ip router isis %s\n",
yang_dnode_get_string(dnode, "../area-tag"));
}
@@ -298,6 +318,8 @@ void cli_show_ip_isis_ipv4(struct vty *vty, struct lyd_node *dnode,
void cli_show_ip_isis_ipv6(struct vty *vty, struct lyd_node *dnode,
bool show_defaults)
{
+ if (!yang_dnode_get_bool(dnode, NULL))
+ vty_out(vty, " no");
vty_out(vty, " ipv6 router isis %s\n",
yang_dnode_get_string(dnode, "../area-tag"));
}
@@ -413,8 +435,8 @@ DEFPY(set_overload_bit, set_overload_bit_cmd, "[no] set-overload-bit",
"Reset overload bit to accept transit traffic\n"
"Set overload bit to avoid any transit traffic\n")
{
- nb_cli_enqueue_change(vty, "./overload",
- no ? NB_OP_DELETE : NB_OP_CREATE, NULL);
+ nb_cli_enqueue_change(vty, "./overload", NB_OP_MODIFY,
+ no ? "false" : "true");
return nb_cli_apply_changes(vty, NULL);
}
@@ -422,6 +444,8 @@ DEFPY(set_overload_bit, set_overload_bit_cmd, "[no] set-overload-bit",
void cli_show_isis_overload(struct vty *vty, struct lyd_node *dnode,
bool show_defaults)
{
+ if (!yang_dnode_get_bool(dnode, NULL))
+ vty_out(vty, " no");
vty_out(vty, " set-overload-bit\n");
}
@@ -432,8 +456,8 @@ DEFPY(set_attached_bit, set_attached_bit_cmd, "[no] set-attached-bit",
"Reset attached bit\n"
"Set attached bit to identify as L1/L2 router for inter-area traffic\n")
{
- nb_cli_enqueue_change(vty, "./attached",
- no ? NB_OP_DELETE : NB_OP_CREATE, NULL);
+ nb_cli_enqueue_change(vty, "./attached", NB_OP_MODIFY,
+ no ? "false" : "true");
return nb_cli_apply_changes(vty, NULL);
}
@@ -441,6 +465,8 @@ DEFPY(set_attached_bit, set_attached_bit_cmd, "[no] set-attached-bit",
void cli_show_isis_attached(struct vty *vty, struct lyd_node *dnode,
bool show_defaults)
{
+ if (!yang_dnode_get_bool(dnode, NULL))
+ vty_out(vty, " no");
vty_out(vty, " set-attached-bit\n");
}
@@ -887,8 +913,8 @@ void cli_show_isis_spf_ietf_backoff(struct vty *vty, struct lyd_node *dnode,
DEFPY(area_purge_originator, area_purge_originator_cmd, "[no] purge-originator",
NO_STR "Use the RFC 6232 purge-originator\n")
{
- nb_cli_enqueue_change(vty, "./purge-originator",
- no ? NB_OP_DELETE : NB_OP_CREATE, NULL);
+ nb_cli_enqueue_change(vty, "./purge-originator", NB_OP_MODIFY,
+ no ? "false" : "true");
return nb_cli_apply_changes(vty, NULL);
}
@@ -896,6 +922,8 @@ DEFPY(area_purge_originator, area_purge_originator_cmd, "[no] purge-originator",
void cli_show_isis_purge_origin(struct vty *vty, struct lyd_node *dnode,
bool show_defaults)
{
+ if (!yang_dnode_get_bool(dnode, NULL))
+ vty_out(vty, " no");
vty_out(vty, " purge-originator\n");
}
@@ -986,9 +1014,8 @@ DEFPY(isis_default_originate, isis_default_originate_cmd,
nb_cli_enqueue_change(vty, ".", NB_OP_DELETE, NULL);
else {
nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL);
- nb_cli_enqueue_change(vty, "./always",
- always ? NB_OP_CREATE : NB_OP_DELETE,
- NULL);
+ nb_cli_enqueue_change(vty, "./always", NB_OP_MODIFY,
+ always ? "true" : "false");
nb_cli_enqueue_change(vty, "./route-map",
rmap ? NB_OP_MODIFY : NB_OP_DELETE,
rmap ? rmap : NULL);
@@ -1014,7 +1041,7 @@ static void vty_print_def_origin(struct vty *vty, struct lyd_node *dnode,
const char *metric;
vty_out(vty, " default-information originate %s %s", family, level);
- if (yang_dnode_exists(dnode, "./always"))
+ if (yang_dnode_get_bool(dnode, "./always"))
vty_out(vty, " always");
if (yang_dnode_exists(dnode, "./route-map"))
@@ -1154,9 +1181,8 @@ DEFPY(isis_topology, isis_topology_cmd,
nb_cli_enqueue_change(vty, ".", NB_OP_DELETE, NULL);
else {
nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL);
- nb_cli_enqueue_change(vty, "./overload",
- overload ? NB_OP_CREATE : NB_OP_DELETE,
- NULL);
+ nb_cli_enqueue_change(vty, "./overload", NB_OP_MODIFY,
+ overload ? "true" : "false");
}
return nb_cli_apply_changes(vty, base_xpath);
@@ -1166,7 +1192,7 @@ void cli_show_isis_mt_ipv4_multicast(struct vty *vty, struct lyd_node *dnode,
bool show_defaults)
{
vty_out(vty, " topology ipv4-multicast");
- if (yang_dnode_exists(dnode, "./overload"))
+ if (yang_dnode_get_bool(dnode, "./overload"))
vty_out(vty, " overload");
vty_out(vty, "\n");
}
@@ -1175,7 +1201,7 @@ void cli_show_isis_mt_ipv4_mgmt(struct vty *vty, struct lyd_node *dnode,
bool show_defaults)
{
vty_out(vty, " topology ipv4-mgmt");
- if (yang_dnode_exists(dnode, "./overload"))
+ if (yang_dnode_get_bool(dnode, "./overload"))
vty_out(vty, " overload");
vty_out(vty, "\n");
}
@@ -1184,7 +1210,7 @@ void cli_show_isis_mt_ipv6_unicast(struct vty *vty, struct lyd_node *dnode,
bool show_defaults)
{
vty_out(vty, " topology ipv6-unicast");
- if (yang_dnode_exists(dnode, "./overload"))
+ if (yang_dnode_get_bool(dnode, "./overload"))
vty_out(vty, " overload");
vty_out(vty, "\n");
}
@@ -1193,7 +1219,7 @@ void cli_show_isis_mt_ipv6_multicast(struct vty *vty, struct lyd_node *dnode,
bool show_defaults)
{
vty_out(vty, " topology ipv6-multicast");
- if (yang_dnode_exists(dnode, "./overload"))
+ if (yang_dnode_get_bool(dnode, "./overload"))
vty_out(vty, " overload");
vty_out(vty, "\n");
}
@@ -1202,7 +1228,7 @@ void cli_show_isis_mt_ipv6_mgmt(struct vty *vty, struct lyd_node *dnode,
bool show_defaults)
{
vty_out(vty, " topology ipv6-mgmt");
- if (yang_dnode_exists(dnode, "./overload"))
+ if (yang_dnode_get_bool(dnode, "./overload"))
vty_out(vty, " overload");
vty_out(vty, "\n");
}
@@ -1211,7 +1237,7 @@ void cli_show_isis_mt_ipv6_dstsrc(struct vty *vty, struct lyd_node *dnode,
bool show_defaults)
{
vty_out(vty, " topology ipv6-dstsrc");
- if (yang_dnode_exists(dnode, "./overload"))
+ if (yang_dnode_get_bool(dnode, "./overload"))
vty_out(vty, " overload");
vty_out(vty, "\n");
}
@@ -1224,8 +1250,8 @@ DEFPY(isis_passive, isis_passive_cmd, "[no] isis passive",
"IS-IS routing protocol\n"
"Configure the passive mode for interface\n")
{
- nb_cli_enqueue_change(vty, "./frr-isisd:isis/passive",
- no ? NB_OP_DELETE : NB_OP_CREATE, NULL);
+ nb_cli_enqueue_change(vty, "./frr-isisd:isis/passive", NB_OP_MODIFY,
+ no ? "false" : "true");
return nb_cli_apply_changes(vty, NULL);
}
@@ -1233,6 +1259,8 @@ DEFPY(isis_passive, isis_passive_cmd, "[no] isis passive",
void cli_show_ip_isis_passive(struct vty *vty, struct lyd_node *dnode,
bool show_defaults)
{
+ if (!yang_dnode_get_bool(dnode, NULL))
+ vty_out(vty, " no");
vty_out(vty, " isis passive\n");
}
@@ -1460,7 +1488,7 @@ DEFPY(isis_threeway_adj, isis_threeway_adj_cmd, "[no] isis three-way-handshake",
{
nb_cli_enqueue_change(vty,
"./frr-isisd:isis/disable-three-way-handshake",
- no ? NB_OP_CREATE : NB_OP_DELETE, NULL);
+ NB_OP_MODIFY, no ? "true" : "false");
return nb_cli_apply_changes(vty, NULL);
}
@@ -1468,7 +1496,9 @@ DEFPY(isis_threeway_adj, isis_threeway_adj_cmd, "[no] isis three-way-handshake",
void cli_show_ip_isis_threeway_shake(struct vty *vty, struct lyd_node *dnode,
bool show_defaults)
{
- vty_out(vty, " no isis three-way-handshake\n");
+ if (yang_dnode_get_bool(dnode, NULL))
+ vty_out(vty, " no");
+ vty_out(vty, " isis three-way-handshake\n");
}
/*
@@ -1884,8 +1914,8 @@ void cli_show_ip_isis_priority(struct vty *vty, struct lyd_node *dnode,
DEFPY(log_adj_changes, log_adj_changes_cmd, "[no] log-adjacency-changes",
NO_STR "Log changes in adjacency state\n")
{
- nb_cli_enqueue_change(vty, "./log-adjacency-changes",
- no ? NB_OP_DELETE : NB_OP_CREATE, NULL);
+ nb_cli_enqueue_change(vty, "./log-adjacency-changes", NB_OP_MODIFY,
+ no ? "false" : "true");
return nb_cli_apply_changes(vty, NULL);
}
@@ -1893,6 +1923,8 @@ DEFPY(log_adj_changes, log_adj_changes_cmd, "[no] log-adjacency-changes",
void cli_show_isis_log_adjacency(struct vty *vty, struct lyd_node *dnode,
bool show_defaults)
{
+ if (!yang_dnode_get_bool(dnode, NULL))
+ vty_out(vty, " no");
vty_out(vty, " log-adjacency-changes\n");
}
diff --git a/isisd/isis_northbound.c b/isisd/isis_northbound.c
index 9d7371c9c..6eb77f4f5 100644
--- a/isisd/isis_northbound.c
+++ b/isisd/isis_northbound.c
@@ -253,31 +253,19 @@ static int isis_instance_dynamic_hostname_modify(enum nb_event event,
/*
* XPath: /frr-isisd:isis/instance/attached
*/
-static int isis_instance_attached_create(enum nb_event event,
+static int isis_instance_attached_modify(enum nb_event event,
const struct lyd_node *dnode,
union nb_resource *resource)
{
struct isis_area *area;
+ bool attached;
if (event != NB_EV_APPLY)
return NB_OK;
area = yang_dnode_get_entry(dnode, true);
- isis_area_attached_bit_set(area, true);
-
- return NB_OK;
-}
-
-static int isis_instance_attached_delete(enum nb_event event,
- const struct lyd_node *dnode)
-{
- struct isis_area *area;
-
- if (event != NB_EV_APPLY)
- return NB_OK;
-
- area = yang_dnode_get_entry(dnode, true);
- isis_area_attached_bit_set(area, false);
+ attached = yang_dnode_get_bool(dnode, NULL);
+ isis_area_attached_bit_set(area, attached);
return NB_OK;
}
@@ -285,31 +273,19 @@ static int isis_instance_attached_delete(enum nb_event event,
/*
* XPath: /frr-isisd:isis/instance/overload
*/
-static int isis_instance_overload_create(enum nb_event event,
+static int isis_instance_overload_modify(enum nb_event event,
const struct lyd_node *dnode,
union nb_resource *resource)
{
struct isis_area *area;
+ bool overload;
if (event != NB_EV_APPLY)
return NB_OK;
area = yang_dnode_get_entry(dnode, true);
- isis_area_overload_bit_set(area, true);
-
- return NB_OK;
-}
-
-static int isis_instance_overload_delete(enum nb_event event,
- const struct lyd_node *dnode)
-{
- struct isis_area *area;
-
- if (event != NB_EV_APPLY)
- return NB_OK;
-
- area = yang_dnode_get_entry(dnode, true);
- isis_area_overload_bit_set(area, false);
+ overload = yang_dnode_get_bool(dnode, NULL);
+ isis_area_overload_bit_set(area, overload);
return NB_OK;
}
@@ -339,7 +315,7 @@ static int isis_instance_metric_style_modify(enum nb_event event,
/*
* XPath: /frr-isisd:isis/instance/purge-originator
*/
-static int isis_instance_purge_originator_create(enum nb_event event,
+static int isis_instance_purge_originator_modify(enum nb_event event,
const struct lyd_node *dnode,
union nb_resource *resource)
{
@@ -349,21 +325,7 @@ static int isis_instance_purge_originator_create(enum nb_event event,
return NB_OK;
area = yang_dnode_get_entry(dnode, true);
- area->purge_originator = true;
-
- return NB_OK;
-}
-
-static int isis_instance_purge_originator_delete(enum nb_event event,
- const struct lyd_node *dnode)
-{
- struct isis_area *area;
-
- if (event != NB_EV_APPLY)
- return NB_OK;
-
- area = yang_dnode_get_entry(dnode, true);
- area->purge_originator = false;
+ area->purge_originator = yang_dnode_get_bool(dnode, NULL);
return NB_OK;
}
@@ -854,7 +816,7 @@ static void default_info_origin_apply_finish(const struct lyd_node *dnode,
struct isis_area *area = yang_dnode_get_entry(dnode, true);
int level = yang_dnode_get_enum(dnode, "./level");
- if (yang_dnode_exists(dnode, "./always")) {
+ if (yang_dnode_get_bool(dnode, "./always")) {
originate_type = DEFAULT_ORIGINATE_ALWAYS;
} else if (family == AF_INET6) {
zlog_warn(
@@ -908,7 +870,7 @@ static int isis_instance_default_information_originate_ipv4_delete(
/*
* XPath: /frr-isisd:isis/instance/default-information-originate/ipv4/always
*/
-static int isis_instance_default_information_originate_ipv4_always_create(
+static int isis_instance_default_information_originate_ipv4_always_modify(
enum nb_event event, const struct lyd_node *dnode,
union nb_resource *resource)
{
@@ -916,13 +878,6 @@ static int isis_instance_default_information_originate_ipv4_always_create(
return NB_OK;
}
-static int isis_instance_default_information_originate_ipv4_always_delete(
- enum nb_event event, const struct lyd_node *dnode)
-{
- /* It's all done by default_info_origin_apply_finish */
- return NB_OK;
-}
-
/*
* XPath: /frr-isisd:isis/instance/default-information-originate/ipv4/route-map
*/
@@ -989,7 +944,7 @@ static int isis_instance_default_information_originate_ipv6_delete(
/*
* XPath: /frr-isisd:isis/instance/default-information-originate/ipv6/always
*/
-static int isis_instance_default_information_originate_ipv6_always_create(
+static int isis_instance_default_information_originate_ipv6_always_modify(
enum nb_event event, const struct lyd_node *dnode,
union nb_resource *resource)
{
@@ -997,13 +952,6 @@ static int isis_instance_default_information_originate_ipv6_always_create(
return NB_OK;
}
-static int isis_instance_default_information_originate_ipv6_always_delete(
- enum nb_event event, const struct lyd_node *dnode)
-{
- /* It's all done by default_info_origin_apply_finish */
- return NB_OK;
-}
-
/*
* XPath: /frr-isisd:isis/instance/default-information-originate/ipv6/route-map
*/
@@ -1241,8 +1189,7 @@ static int isis_multi_topology_common(enum nb_event event,
static int isis_multi_topology_overload_common(enum nb_event event,
const struct lyd_node *dnode,
- const char *topology,
- bool create)
+ const char *topology)
{
struct isis_area *area;
struct isis_area_mt_setting *setting;
@@ -1254,7 +1201,7 @@ static int isis_multi_topology_overload_common(enum nb_event event,
area = yang_dnode_get_entry(dnode, true);
setting = area_get_mt_setting(area, mtid);
- setting->overload = create;
+ setting->overload = yang_dnode_get_bool(dnode, NULL);
if (setting->enabled)
lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 0);
@@ -1280,19 +1227,12 @@ isis_instance_multi_topology_ipv4_multicast_delete(enum nb_event event,
/*
* XPath: /frr-isisd:isis/instance/multi-topology/ipv4-multicast/overload
*/
-static int isis_instance_multi_topology_ipv4_multicast_overload_create(
+static int isis_instance_multi_topology_ipv4_multicast_overload_modify(
enum nb_event event, const struct lyd_node *dnode,
union nb_resource *resource)
{
return isis_multi_topology_overload_common(event, dnode,
- "ipv4-multicast", true);
-}
-
-static int isis_instance_multi_topology_ipv4_multicast_overload_delete(
- enum nb_event event, const struct lyd_node *dnode)
-{
- return isis_multi_topology_overload_common(event, dnode,
- "ipv4-multicast", false);
+ "ipv4-multicast");
}
/*
@@ -1314,19 +1254,11 @@ static int isis_instance_multi_topology_ipv4_management_delete(
/*
* XPath: /frr-isisd:isis/instance/multi-topology/ipv4-management/overload
*/
-static int isis_instance_multi_topology_ipv4_management_overload_create(
+static int isis_instance_multi_topology_ipv4_management_overload_modify(
enum nb_event event, const struct lyd_node *dnode,
union nb_resource *resource)
{
- return isis_multi_topology_overload_common(event, dnode, "ipv4-mgmt",
- true);
-}
-
-static int isis_instance_multi_topology_ipv4_management_overload_delete(
- enum nb_event event, const struct lyd_node *dnode)
-{
- return isis_multi_topology_overload_common(event, dnode, "ipv4-mgmt",
- false);
+ return isis_multi_topology_overload_common(event, dnode, "ipv4-mgmt");
}
/*
@@ -1350,19 +1282,12 @@ isis_instance_multi_topology_ipv6_unicast_delete(enum nb_event event,
/*
* XPath: /frr-isisd:isis/instance/multi-topology/ipv6-unicast/overload
*/
-static int isis_instance_multi_topology_ipv6_unicast_overload_create(
+static int isis_instance_multi_topology_ipv6_unicast_overload_modify(
enum nb_event event, const struct lyd_node *dnode,
union nb_resource *resource)
{
- return isis_multi_topology_overload_common(event, dnode, "ipv6-unicast",
- true);
-}
-
-static int isis_instance_multi_topology_ipv6_unicast_overload_delete(
- enum nb_event event, const struct lyd_node *dnode)
-{
- return isis_multi_topology_overload_common(event, dnode, "ipv6-unicast",
- false);
+ return isis_multi_topology_overload_common(event, dnode,
+ "ipv6-unicast");
}
/*
@@ -1387,19 +1312,12 @@ isis_instance_multi_topology_ipv6_multicast_delete(enum nb_event event,
/*
* XPath: /frr-isisd:isis/instance/multi-topology/ipv6-multicast/overload
*/
-static int isis_instance_multi_topology_ipv6_multicast_overload_create(
+static int isis_instance_multi_topology_ipv6_multicast_overload_modify(
enum nb_event event, const struct lyd_node *dnode,
union nb_resource *resource)
{
return isis_multi_topology_overload_common(event, dnode,
- "ipv6-multicast", true);
-}
-
-static int isis_instance_multi_topology_ipv6_multicast_overload_delete(
- enum nb_event event, const struct lyd_node *dnode)
-{
- return isis_multi_topology_overload_common(event, dnode,
- "ipv6-multicast", false);
+ "ipv6-multicast");
}
/*
@@ -1421,19 +1339,11 @@ static int isis_instance_multi_topology_ipv6_management_delete(
/*
* XPath: /frr-isisd:isis/instance/multi-topology/ipv6-management/overload
*/
-static int isis_instance_multi_topology_ipv6_management_overload_create(
+static int isis_instance_multi_topology_ipv6_management_overload_modify(
enum nb_event event, const struct lyd_node *dnode,
union nb_resource *resource)
{
- return isis_multi_topology_overload_common(event, dnode, "ipv6-mgmt",
- true);
-}
-
-static int isis_instance_multi_topology_ipv6_management_overload_delete(
- enum nb_event event, const struct lyd_node *dnode)
-{
- return isis_multi_topology_overload_common(event, dnode, "ipv6-mgmt",
- false);
+ return isis_multi_topology_overload_common(event, dnode, "ipv6-mgmt");
}
/*
@@ -1457,51 +1367,29 @@ isis_instance_multi_topology_ipv6_dstsrc_delete(enum nb_event event,
/*
* XPath: /frr-isisd:isis/instance/multi-topology/ipv6-dstsrc/overload
*/
-static int isis_instance_multi_topology_ipv6_dstsrc_overload_create(
+static int isis_instance_multi_topology_ipv6_dstsrc_overload_modify(
enum nb_event event, const struct lyd_node *dnode,
union nb_resource *resource)
{
- return isis_multi_topology_overload_common(event, dnode, "ipv6-dstsrc",
- true);
-}
-
-static int isis_instance_multi_topology_ipv6_dstsrc_overload_delete(
- enum nb_event event, const struct lyd_node *dnode)
-{
- return isis_multi_topology_overload_common(event, dnode, "ipv6-dstsrc",
- false);
+ return isis_multi_topology_overload_common(event, dnode, "ipv6-dstsrc");
}
/*
* XPath: /frr-isisd:isis/instance/log-adjacency-changes
*/
static int
-isis_instance_log_adjacency_changes_create(enum nb_event event,
+isis_instance_log_adjacency_changes_modify(enum nb_event event,
const struct lyd_node *dnode,
union nb_resource *resource)
{
struct isis_area *area;
+ bool log = yang_dnode_get_bool(dnode, NULL);
if (event != NB_EV_APPLY)
return NB_OK;
area = yang_dnode_get_entry(dnode, true);
- area->log_adj_changes = 1;
-
- return NB_OK;
-}
-
-static int
-isis_instance_log_adjacency_changes_delete(enum nb_event event,
- const struct lyd_node *dnode)
-{
- struct isis_area *area;
-
- if (event != NB_EV_APPLY)
- return NB_OK;
-
- area = yang_dnode_get_entry(dnode, true);
- area->log_adj_changes = 0;
+ area->log_adj_changes = log ? 1 : 0;
return NB_OK;
}
@@ -1782,37 +1670,20 @@ static int lib_interface_isis_circuit_type_modify(enum nb_event event,
/*
* XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv4-routing
*/
-static int lib_interface_isis_ipv4_routing_create(enum nb_event event,
+static int lib_interface_isis_ipv4_routing_modify(enum nb_event event,
const struct lyd_node *dnode,
union nb_resource *resource)
{
- bool ipv6;
+ bool ipv4, ipv6;
struct isis_circuit *circuit;
if (event != NB_EV_APPLY)
return NB_OK;
circuit = yang_dnode_get_entry(dnode, true);
- ipv6 = yang_dnode_exists(dnode, "../ipv6-routing");
- isis_circuit_af_set(circuit, true, ipv6);
-
- return NB_OK;
-}
-
-static int lib_interface_isis_ipv4_routing_delete(enum nb_event event,
- const struct lyd_node *dnode)
-{
- bool ipv6;
- struct isis_circuit *circuit;
-
- if (event != NB_EV_APPLY)
- return NB_OK;
-
- circuit = yang_dnode_get_entry(dnode, true);
- if (circuit && circuit->area) {
- ipv6 = yang_dnode_exists(dnode, "../ipv6-routing");
- isis_circuit_af_set(circuit, false, ipv6);
- }
+ ipv4 = yang_dnode_get_bool(dnode, NULL);
+ ipv6 = yang_dnode_get_bool(dnode, "../ipv6-routing");
+ isis_circuit_af_set(circuit, ipv4, ipv6);
return NB_OK;
}
@@ -1820,37 +1691,20 @@ static int lib_interface_isis_ipv4_routing_delete(enum nb_event event,
/*
* XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv6-routing
*/
-static int lib_interface_isis_ipv6_routing_create(enum nb_event event,
+static int lib_interface_isis_ipv6_routing_modify(enum nb_event event,
const struct lyd_node *dnode,
union nb_resource *resource)
{
- bool ipv4;
- struct isis_circuit *circuit;
-
- if (event != NB_EV_APPLY)
- return NB_OK;
-
- circuit = yang_dnode_get_entry(dnode, true);
- ipv4 = yang_dnode_exists(dnode, "../ipv6-routing");
- isis_circuit_af_set(circuit, ipv4, true);
-
- return NB_OK;
-}
-
-static int lib_interface_isis_ipv6_routing_delete(enum nb_event event,
- const struct lyd_node *dnode)
-{
- bool ipv4;
+ bool ipv4, ipv6;
struct isis_circuit *circuit;
if (event != NB_EV_APPLY)
return NB_OK;
circuit = yang_dnode_get_entry(dnode, true);
- if (circuit->area) {
- ipv4 = yang_dnode_exists(dnode, "../ipv4-routing");
- isis_circuit_af_set(circuit, ipv4, false);
- }
+ ipv4 = yang_dnode_exists(dnode, "../ipv4-routing");
+ ipv6 = yang_dnode_get_bool(dnode, NULL);
+ isis_circuit_af_set(circuit, ipv4, ipv6);
return NB_OK;
}
@@ -2168,64 +2022,41 @@ static int lib_interface_isis_network_type_delete(enum nb_event event,
/*
* XPath: /frr-interface:lib/interface/frr-isisd:isis/passive
*/
-static int lib_interface_isis_passive_create(enum nb_event event,
+static int lib_interface_isis_passive_modify(enum nb_event event,
const struct lyd_node *dnode,
union nb_resource *resource)
{
struct isis_circuit *circuit;
struct isis_area *area;
-
- if (event != NB_EV_APPLY)
- return NB_OK;
-
- circuit = yang_dnode_get_entry(dnode, true);
- if (circuit->state != C_STATE_UP) {
- circuit->is_passive = true;
- } else {
- area = circuit->area;
- isis_csm_state_change(ISIS_DISABLE, circuit, area);
- circuit->is_passive = true;
- isis_csm_state_change(ISIS_ENABLE, circuit, area);
- }
-
- return NB_OK;
-}
-
-static int lib_interface_isis_passive_delete(enum nb_event event,
- const struct lyd_node *dnode)
-{
- struct isis_circuit *circuit;
- struct isis_area *area;
struct interface *ifp;
+ bool passive = yang_dnode_get_bool(dnode, NULL);
- switch (event) {
- case NB_EV_VALIDATE:
+ /* validation only applies if we are setting passive to false */
+ if (!passive && event == NB_EV_VALIDATE) {
circuit = yang_dnode_get_entry(dnode, false);
if (!circuit)
- break;
+ return NB_OK;
ifp = circuit->interface;
if (!ifp)
- break;
+ return NB_OK;
if (if_is_loopback(ifp)) {
flog_warn(EC_LIB_NB_CB_CONFIG_VALIDATE,
"Loopback is always passive");
return NB_ERR_VALIDATION;
}
- break;
- case NB_EV_PREPARE:
- case NB_EV_ABORT:
- break;
- case NB_EV_APPLY:
- circuit = yang_dnode_get_entry(dnode, true);
- if (circuit->state != C_STATE_UP) {
- circuit->is_passive = false;
- } else {
- area = circuit->area;
- isis_csm_state_change(ISIS_DISABLE, circuit, area);
- circuit->is_passive = false;
- isis_csm_state_change(ISIS_ENABLE, circuit, area);
- }
- break;
+ }
+
+ if (event != NB_EV_APPLY)
+ return NB_OK;
+
+ circuit = yang_dnode_get_entry(dnode, true);
+ if (circuit->state != C_STATE_UP) {
+ circuit->is_passive = passive;
+ } else {
+ area = circuit->area;
+ isis_csm_state_change(ISIS_DISABLE, circuit, area);
+ circuit->is_passive = passive;
+ isis_csm_state_change(ISIS_ENABLE, circuit, area);
}
return NB_OK;
@@ -2302,7 +2133,7 @@ lib_interface_isis_password_password_type_modify(enum nb_event event,
* XPath:
* /frr-interface:lib/interface/frr-isisd:isis/disable-three-way-handshake
*/
-static int lib_interface_isis_disable_three_way_handshake_create(
+static int lib_interface_isis_disable_three_way_handshake_modify(
enum nb_event event, const struct lyd_node *dnode,
union nb_resource *resource)
{
@@ -2312,21 +2143,7 @@ static int lib_interface_isis_disable_three_way_handshake_create(
return NB_OK;
circuit = yang_dnode_get_entry(dnode, true);
- circuit->disable_threeway_adj = true;
-
- return NB_OK;
-}
-
-static int lib_interface_isis_disable_three_way_handshake_delete(
- enum nb_event event, const struct lyd_node *dnode)
-{
- struct isis_circuit *circuit;
-
- if (event != NB_EV_APPLY)
- return NB_OK;
-
- circuit = yang_dnode_get_entry(dnode, true);
- circuit->disable_threeway_adj = false;
+ circuit->disable_threeway_adj = yang_dnode_get_bool(dnode, NULL);
return NB_OK;
}
@@ -2964,14 +2781,12 @@ const struct frr_yang_module_info frr_isisd_info = {
},
{
.xpath = "/frr-isisd:isis/instance/attached",
- .cbs.create = isis_instance_attached_create,
- .cbs.delete = isis_instance_attached_delete,
+ .cbs.modify = isis_instance_attached_modify,
.cbs.cli_show = cli_show_isis_attached,
},
{
.xpath = "/frr-isisd:isis/instance/overload",
- .cbs.create = isis_instance_overload_create,
- .cbs.delete = isis_instance_overload_delete,
+ .cbs.modify = isis_instance_overload_modify,
.cbs.cli_show = cli_show_isis_overload,
},
{
@@ -2981,8 +2796,7 @@ const struct frr_yang_module_info frr_isisd_info = {
},
{
.xpath = "/frr-isisd:isis/instance/purge-originator",
- .cbs.create = isis_instance_purge_originator_create,
- .cbs.delete = isis_instance_purge_originator_delete,
+ .cbs.modify = isis_instance_purge_originator_modify,
.cbs.cli_show = cli_show_isis_purge_origin,
},
{
@@ -3112,8 +2926,7 @@ const struct frr_yang_module_info frr_isisd_info = {
},
{
.xpath = "/frr-isisd:isis/instance/default-information-originate/ipv4/always",
- .cbs.create = isis_instance_default_information_originate_ipv4_always_create,
- .cbs.delete = isis_instance_default_information_originate_ipv4_always_delete,
+ .cbs.modify = isis_instance_default_information_originate_ipv4_always_modify,
},
{
.xpath = "/frr-isisd:isis/instance/default-information-originate/ipv4/route-map",
@@ -3134,8 +2947,7 @@ const struct frr_yang_module_info frr_isisd_info = {
},
{
.xpath = "/frr-isisd:isis/instance/default-information-originate/ipv6/always",
- .cbs.create = isis_instance_default_information_originate_ipv6_always_create,
- .cbs.delete = isis_instance_default_information_originate_ipv6_always_delete,
+ .cbs.modify = isis_instance_default_information_originate_ipv6_always_modify,
},
{
.xpath = "/frr-isisd:isis/instance/default-information-originate/ipv6/route-map",
@@ -3189,8 +3001,7 @@ const struct frr_yang_module_info frr_isisd_info = {
},
{
.xpath = "/frr-isisd:isis/instance/multi-topology/ipv4-multicast/overload",
- .cbs.create = isis_instance_multi_topology_ipv4_multicast_overload_create,
- .cbs.delete = isis_instance_multi_topology_ipv4_multicast_overload_delete,
+ .cbs.modify = isis_instance_multi_topology_ipv4_multicast_overload_modify,
},
{
.xpath = "/frr-isisd:isis/instance/multi-topology/ipv4-management",
@@ -3200,8 +3011,7 @@ const struct frr_yang_module_info frr_isisd_info = {
},
{
.xpath = "/frr-isisd:isis/instance/multi-topology/ipv4-management/overload",
- .cbs.create = isis_instance_multi_topology_ipv4_management_overload_create,
- .cbs.delete = isis_instance_multi_topology_ipv4_management_overload_delete,
+ .cbs.modify = isis_instance_multi_topology_ipv4_management_overload_modify,
},
{
.xpath = "/frr-isisd:isis/instance/multi-topology/ipv6-unicast",
@@ -3211,8 +3021,7 @@ const struct frr_yang_module_info frr_isisd_info = {
},
{
.xpath = "/frr-isisd:isis/instance/multi-topology/ipv6-unicast/overload",
- .cbs.create = isis_instance_multi_topology_ipv6_unicast_overload_create,
- .cbs.delete = isis_instance_multi_topology_ipv6_unicast_overload_delete,
+ .cbs.modify = isis_instance_multi_topology_ipv6_unicast_overload_modify,
},
{
.xpath = "/frr-isisd:isis/instance/multi-topology/ipv6-multicast",
@@ -3222,8 +3031,7 @@ const struct frr_yang_module_info frr_isisd_info = {
},
{
.xpath = "/frr-isisd:isis/instance/multi-topology/ipv6-multicast/overload",
- .cbs.create = isis_instance_multi_topology_ipv6_multicast_overload_create,
- .cbs.delete = isis_instance_multi_topology_ipv6_multicast_overload_delete,
+ .cbs.modify = isis_instance_multi_topology_ipv6_multicast_overload_modify,
},
{
.xpath = "/frr-isisd:isis/instance/multi-topology/ipv6-management",
@@ -3233,8 +3041,7 @@ const struct frr_yang_module_info frr_isisd_info = {
},
{
.xpath = "/frr-isisd:isis/instance/multi-topology/ipv6-management/overload",
- .cbs.create = isis_instance_multi_topology_ipv6_management_overload_create,
- .cbs.delete = isis_instance_multi_topology_ipv6_management_overload_delete,
+ .cbs.modify = isis_instance_multi_topology_ipv6_management_overload_modify,
},
{
.xpath = "/frr-isisd:isis/instance/multi-topology/ipv6-dstsrc",
@@ -3244,13 +3051,11 @@ const struct frr_yang_module_info frr_isisd_info = {
},
{
.xpath = "/frr-isisd:isis/instance/multi-topology/ipv6-dstsrc/overload",
- .cbs.create = isis_instance_multi_topology_ipv6_dstsrc_overload_create,
- .cbs.delete = isis_instance_multi_topology_ipv6_dstsrc_overload_delete,
+ .cbs.modify = isis_instance_multi_topology_ipv6_dstsrc_overload_modify,
},
{
.xpath = "/frr-isisd:isis/instance/log-adjacency-changes",
- .cbs.create = isis_instance_log_adjacency_changes_create,
- .cbs.delete = isis_instance_log_adjacency_changes_delete,
+ .cbs.modify = isis_instance_log_adjacency_changes_modify,
.cbs.cli_show = cli_show_isis_log_adjacency,
},
{
@@ -3281,14 +3086,12 @@ const struct frr_yang_module_info frr_isisd_info = {
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/ipv4-routing",
- .cbs.create = lib_interface_isis_ipv4_routing_create,
- .cbs.delete = lib_interface_isis_ipv4_routing_delete,
+ .cbs.modify = lib_interface_isis_ipv4_routing_modify,
.cbs.cli_show = cli_show_ip_isis_ipv4,
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/ipv6-routing",
- .cbs.create = lib_interface_isis_ipv6_routing_create,
- .cbs.delete = lib_interface_isis_ipv6_routing_delete,
+ .cbs.modify = lib_interface_isis_ipv6_routing_modify,
.cbs.cli_show = cli_show_ip_isis_ipv6,
},
{
@@ -3376,8 +3179,7 @@ const struct frr_yang_module_info frr_isisd_info = {
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/passive",
- .cbs.create = lib_interface_isis_passive_create,
- .cbs.delete = lib_interface_isis_passive_delete,
+ .cbs.modify = lib_interface_isis_passive_modify,
.cbs.cli_show = cli_show_ip_isis_passive,
},
{
@@ -3396,8 +3198,7 @@ const struct frr_yang_module_info frr_isisd_info = {
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/disable-three-way-handshake",
- .cbs.create = lib_interface_isis_disable_three_way_handshake_create,
- .cbs.delete = lib_interface_isis_disable_three_way_handshake_delete,
+ .cbs.modify = lib_interface_isis_disable_three_way_handshake_modify,
.cbs.cli_show = cli_show_ip_isis_threeway_shake,
},
{