summaryrefslogtreecommitdiffstats
path: root/eigrpd/eigrp_northbound.c
diff options
context:
space:
mode:
Diffstat (limited to 'eigrpd/eigrp_northbound.c')
-rw-r--r--eigrpd/eigrp_northbound.c90
1 files changed, 73 insertions, 17 deletions
diff --git a/eigrpd/eigrp_northbound.c b/eigrpd/eigrp_northbound.c
index f50abb7..4aeb635 100644
--- a/eigrpd/eigrp_northbound.c
+++ b/eigrpd/eigrp_northbound.c
@@ -14,6 +14,7 @@
#include "lib/table.h"
#include "lib/vrf.h"
#include "lib/zclient.h"
+#include "lib/distribute.h"
#include "eigrp_structs.h"
#include "eigrpd.h"
@@ -28,18 +29,18 @@ static void redistribute_get_metrics(const struct lyd_node *dnode,
{
memset(em, 0, sizeof(*em));
- if (yang_dnode_exists(dnode, "./bandwidth"))
- em->bandwidth = yang_dnode_get_uint32(dnode, "./bandwidth");
- if (yang_dnode_exists(dnode, "./delay"))
- em->delay = yang_dnode_get_uint32(dnode, "./delay");
+ if (yang_dnode_exists(dnode, "bandwidth"))
+ em->bandwidth = yang_dnode_get_uint32(dnode, "bandwidth");
+ if (yang_dnode_exists(dnode, "delay"))
+ em->delay = yang_dnode_get_uint32(dnode, "delay");
#if 0 /* TODO: How does MTU work? */
- if (yang_dnode_exists(dnode, "./mtu"))
- em->mtu[0] = yang_dnode_get_uint32(dnode, "./mtu");
+ if (yang_dnode_exists(dnode, "mtu"))
+ em->mtu[0] = yang_dnode_get_uint32(dnode, "mtu");
#endif
- if (yang_dnode_exists(dnode, "./load"))
- em->load = yang_dnode_get_uint32(dnode, "./load");
- if (yang_dnode_exists(dnode, "./reliability"))
- em->reliability = yang_dnode_get_uint32(dnode, "./reliability");
+ if (yang_dnode_exists(dnode, "load"))
+ em->load = yang_dnode_get_uint32(dnode, "load");
+ if (yang_dnode_exists(dnode, "reliability"))
+ em->reliability = yang_dnode_get_uint32(dnode, "reliability");
}
static struct eigrp_interface *eigrp_interface_lookup(const struct eigrp *eigrp,
@@ -73,7 +74,7 @@ static int eigrpd_instance_create(struct nb_cb_create_args *args)
/* NOTHING */
break;
case NB_EV_PREPARE:
- vrf = yang_dnode_get_string(args->dnode, "./vrf");
+ vrf = yang_dnode_get_string(args->dnode, "vrf");
pVrf = vrf_lookup_by_name(vrf);
if (pVrf)
@@ -81,7 +82,7 @@ static int eigrpd_instance_create(struct nb_cb_create_args *args)
else
vrfid = VRF_DEFAULT;
- eigrp = eigrp_get(yang_dnode_get_uint16(args->dnode, "./asn"),
+ eigrp = eigrp_get(yang_dnode_get_uint16(args->dnode, "asn"),
vrfid);
args->resource->ptr = eigrp;
break;
@@ -702,6 +703,22 @@ static int eigrpd_instance_neighbor_destroy(struct nb_cb_destroy_args *args)
}
/*
+ * XPath: /frr-eigrpd:eigrpd/instance/distribute-list
+ */
+static int eigrpd_instance_distribute_list_create(struct nb_cb_create_args *args)
+{
+ struct eigrp *eigrp;
+
+ if (args->event != NB_EV_APPLY)
+ return NB_OK;
+
+ eigrp = nb_running_get_entry(args->dnode, NULL, true);
+ group_distribute_list_create_helper(args, eigrp->distribute_ctx);
+
+ return NB_OK;
+}
+
+/*
* XPath: /frr-eigrpd:eigrpd/instance/redistribute
*/
static int eigrpd_instance_redistribute_create(struct nb_cb_create_args *args)
@@ -715,7 +732,7 @@ static int eigrpd_instance_redistribute_create(struct nb_cb_create_args *args)
switch (args->event) {
case NB_EV_VALIDATE:
- proto = yang_dnode_get_enum(args->dnode, "./protocol");
+ proto = yang_dnode_get_enum(args->dnode, "protocol");
vrfname = yang_dnode_get_string(args->dnode, "../vrf");
pVrf = vrf_lookup_by_name(vrfname);
@@ -733,7 +750,7 @@ static int eigrpd_instance_redistribute_create(struct nb_cb_create_args *args)
break;
case NB_EV_APPLY:
eigrp = nb_running_get_entry(args->dnode, NULL, true);
- proto = yang_dnode_get_enum(args->dnode, "./protocol");
+ proto = yang_dnode_get_enum(args->dnode, "protocol");
redistribute_get_metrics(args->dnode, &metrics);
eigrp_redistribute_set(eigrp, proto, metrics);
break;
@@ -755,7 +772,7 @@ static int eigrpd_instance_redistribute_destroy(struct nb_cb_destroy_args *args)
break;
case NB_EV_APPLY:
eigrp = nb_running_get_entry(args->dnode, NULL, true);
- proto = yang_dnode_get_enum(args->dnode, "./protocol");
+ proto = yang_dnode_get_enum(args->dnode, "protocol");
eigrp_redistribute_unset(eigrp, proto);
break;
}
@@ -1120,7 +1137,7 @@ static int lib_interface_eigrp_instance_create(struct nb_cb_create_args *args)
break;
}
- eigrp = eigrp_get(yang_dnode_get_uint16(args->dnode, "./asn"),
+ eigrp = eigrp_get(yang_dnode_get_uint16(args->dnode, "asn"),
ifp->vrf->vrf_id);
eif = eigrp_interface_lookup(eigrp, ifp->name);
if (eif == NULL)
@@ -1132,7 +1149,7 @@ static int lib_interface_eigrp_instance_create(struct nb_cb_create_args *args)
break;
case NB_EV_APPLY:
ifp = nb_running_get_entry(args->dnode, NULL, true);
- eigrp = eigrp_get(yang_dnode_get_uint16(args->dnode, "./asn"),
+ eigrp = eigrp_get(yang_dnode_get_uint16(args->dnode, "asn"),
ifp->vrf->vrf_id);
eif = eigrp_interface_lookup(eigrp, ifp->name);
if (eif == NULL)
@@ -1403,6 +1420,45 @@ const struct frr_yang_module_info frr_eigrpd_info = {
}
},
{
+ .xpath = "/frr-eigrpd:eigrpd/instance/distribute-list",
+ .cbs = {
+ .create = eigrpd_instance_distribute_list_create,
+ .destroy = group_distribute_list_destroy,
+ }
+ },
+ {
+ .xpath = "/frr-eigrpd:eigrpd/instance/distribute-list/in/access-list",
+ .cbs = {
+ .modify = group_distribute_list_ipv4_modify,
+ .destroy = group_distribute_list_ipv4_destroy,
+ .cli_show = group_distribute_list_ipv4_cli_show,
+ }
+ },
+ {
+ .xpath = "/frr-eigrpd:eigrpd/instance/distribute-list/out/access-list",
+ .cbs = {
+ .modify = group_distribute_list_ipv4_modify,
+ .destroy = group_distribute_list_ipv4_destroy,
+ .cli_show = group_distribute_list_ipv4_cli_show,
+ }
+ },
+ {
+ .xpath = "/frr-eigrpd:eigrpd/instance/distribute-list/in/prefix-list",
+ .cbs = {
+ .modify = group_distribute_list_ipv4_modify,
+ .destroy = group_distribute_list_ipv4_destroy,
+ .cli_show = group_distribute_list_ipv4_cli_show,
+ }
+ },
+ {
+ .xpath = "/frr-eigrpd:eigrpd/instance/distribute-list/out/prefix-list",
+ .cbs = {
+ .modify = group_distribute_list_ipv4_modify,
+ .destroy = group_distribute_list_ipv4_destroy,
+ .cli_show = group_distribute_list_ipv4_cli_show,
+ }
+ },
+ {
.xpath = "/frr-eigrpd:eigrpd/instance/redistribute",
.cbs = {
.create = eigrpd_instance_redistribute_create,