summaryrefslogtreecommitdiffstats
path: root/staticd
diff options
context:
space:
mode:
Diffstat (limited to 'staticd')
-rw-r--r--staticd/static_bfd.c8
-rw-r--r--staticd/static_nb.c15
-rw-r--r--staticd/static_nb_config.c40
-rw-r--r--staticd/static_vrf.c16
-rw-r--r--staticd/static_vty.c197
-rw-r--r--staticd/static_vty.h16
6 files changed, 153 insertions, 139 deletions
diff --git a/staticd/static_bfd.c b/staticd/static_bfd.c
index 507c64e6a..b0b256615 100644
--- a/staticd/static_bfd.c
+++ b/staticd/static_bfd.c
@@ -91,11 +91,11 @@ void static_next_hop_bfd_monitor_enable(struct static_nexthop *sn,
struct vrf *vrf = NULL;
use_interface = false;
- use_source = yang_dnode_exists(dnode, "./source");
- use_profile = yang_dnode_exists(dnode, "./profile");
+ use_source = yang_dnode_exists(dnode, "source");
+ use_profile = yang_dnode_exists(dnode, "profile");
onlink = yang_dnode_exists(dnode, "../onlink") &&
yang_dnode_get_bool(dnode, "../onlink");
- mhop = yang_dnode_get_bool(dnode, "./multi-hop");
+ mhop = yang_dnode_get_bool(dnode, "multi-hop");
vrf = vrf_lookup_by_name(yang_dnode_get_string(dnode, "../vrf"));
family = static_next_hop_type_to_family(sn);
@@ -112,7 +112,7 @@ void static_next_hop_bfd_monitor_enable(struct static_nexthop *sn,
/* Configure the session. */
if (use_source)
- yang_dnode_get_ip(&source, dnode, "./source");
+ yang_dnode_get_ip(&source, dnode, "source");
if (onlink || mhop == false)
bfd_sess_set_auto_source(sn->bsp, false);
diff --git a/staticd/static_nb.c b/staticd/static_nb.c
index 1c69a5803..e6aa71a77 100644
--- a/staticd/static_nb.c
+++ b/staticd/static_nb.c
@@ -16,18 +16,10 @@ const struct frr_yang_module_info frr_staticd_info = {
.name = "frr-staticd",
.nodes = {
{
- .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd",
- .cbs = {
- .cli_show = static_cli_show,
- .cli_show_end = static_cli_show_end,
- }
- },
- {
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list",
.cbs = {
.create = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_create,
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_destroy,
- .cli_cmp = static_route_list_cli_cmp,
}
},
{
@@ -35,7 +27,6 @@ const struct frr_yang_module_info frr_staticd_info = {
.cbs = {
.create = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_create,
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_destroy,
- .cli_cmp = static_path_list_cli_cmp,
}
},
{
@@ -51,8 +42,6 @@ const struct frr_yang_module_info frr_staticd_info = {
.create = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_create,
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_destroy,
.pre_validate = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_pre_validate,
- .cli_show = static_nexthop_cli_show,
- .cli_cmp = static_nexthop_cli_cmp,
}
},
{
@@ -150,7 +139,6 @@ const struct frr_yang_module_info frr_staticd_info = {
.cbs = {
.create = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_create,
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_destroy,
- .cli_cmp = static_src_list_cli_cmp,
}
},
{
@@ -158,7 +146,6 @@ const struct frr_yang_module_info frr_staticd_info = {
.cbs = {
.create = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_create,
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_destroy,
- .cli_cmp = static_path_list_cli_cmp,
}
},
{
@@ -174,8 +161,6 @@ const struct frr_yang_module_info frr_staticd_info = {
.create = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_create,
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_destroy,
.pre_validate = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_pre_validate,
- .cli_show = static_src_nexthop_cli_show,
- .cli_cmp = static_nexthop_cli_cmp,
}
},
{
diff --git a/staticd/static_nb_config.c b/staticd/static_nb_config.c
index 8a497304a..2fee908d5 100644
--- a/staticd/static_nb_config.c
+++ b/staticd/static_nb_config.c
@@ -34,8 +34,8 @@ static int static_path_list_create(struct nb_cb_create_args *args)
case NB_EV_VALIDATE:
vrf_dnode = yang_dnode_get_parent(args->dnode,
"control-plane-protocol");
- vrf = yang_dnode_get_string(vrf_dnode, "./vrf");
- table_id = yang_dnode_get_uint32(args->dnode, "./table-id");
+ vrf = yang_dnode_get_string(vrf_dnode, "vrf");
+ table_id = yang_dnode_get_uint32(args->dnode, "table-id");
/*
* TableId is not applicable for VRF. Consider the case of
@@ -56,8 +56,8 @@ static int static_path_list_create(struct nb_cb_create_args *args)
break;
case NB_EV_APPLY:
rn = nb_running_get_entry(args->dnode, NULL, true);
- distance = yang_dnode_get_uint8(args->dnode, "./distance");
- table_id = yang_dnode_get_uint32(args->dnode, "./table-id");
+ distance = yang_dnode_get_uint8(args->dnode, "distance");
+ table_id = yang_dnode_get_uint32(args->dnode, "table-id");
pn = static_add_path(rn, table_id, distance);
nb_running_set_entry(args->dnode, pn);
}
@@ -112,7 +112,7 @@ static int nexthop_iter_cb(const struct lyd_node *dnode, void *arg)
struct nexthop_iter *iter = arg;
enum static_nh_type nh_type;
- nh_type = yang_dnode_get_enum(dnode, "./nh-type");
+ nh_type = yang_dnode_get_enum(dnode, "nh-type");
if (nh_type == STATIC_BLACKHOLE)
iter->blackhole = true;
@@ -135,8 +135,8 @@ static bool static_nexthop_create(struct nb_cb_create_args *args)
switch (args->event) {
case NB_EV_VALIDATE:
- ifname = yang_dnode_get_string(args->dnode, "./interface");
- nh_type = yang_dnode_get_enum(args->dnode, "./nh-type");
+ ifname = yang_dnode_get_string(args->dnode, "interface");
+ nh_type = yang_dnode_get_enum(args->dnode, "nh-type");
if (ifname != NULL && nh_type != STATIC_BLACKHOLE) {
if (strcasecmp(ifname, "Null0") == 0
|| strcasecmp(ifname, "reject") == 0
@@ -171,10 +171,10 @@ static bool static_nexthop_create(struct nb_cb_create_args *args)
case NB_EV_ABORT:
break;
case NB_EV_APPLY:
- yang_dnode_get_ip(&ipaddr, args->dnode, "./gateway");
- nh_type = yang_dnode_get_enum(args->dnode, "./nh-type");
- ifname = yang_dnode_get_string(args->dnode, "./interface");
- nh_vrf = yang_dnode_get_string(args->dnode, "./vrf");
+ yang_dnode_get_ip(&ipaddr, args->dnode, "gateway");
+ nh_type = yang_dnode_get_enum(args->dnode, "nh-type");
+ ifname = yang_dnode_get_string(args->dnode, "interface");
+ nh_vrf = yang_dnode_get_string(args->dnode, "vrf");
pn = nb_running_get_entry(args->dnode, NULL, true);
if (!static_add_nexthop_validate(nh_vrf, nh_type, &ipaddr))
@@ -536,7 +536,7 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_pa
const struct lyd_node *mls_dnode;
uint32_t count;
- mls_dnode = yang_dnode_get(args->dnode, "./mpls-label-stack");
+ mls_dnode = yang_dnode_get(args->dnode, "mpls-label-stack");
count = yang_get_list_elements_count(lyd_child(mls_dnode));
if (count > MPLS_MAX_LABELS) {
@@ -553,7 +553,7 @@ int routing_control_plane_protocols_name_validate(
{
const char *name;
- name = yang_dnode_get_string(args->dnode, "./name");
+ name = yang_dnode_get_string(args->dnode, "name");
if (!strmatch(name, "staticd")) {
snprintf(args->errmsg, args->errmsg_len,
"static routing supports only one instance with name staticd");
@@ -580,15 +580,15 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_cr
switch (args->event) {
case NB_EV_VALIDATE:
- yang_dnode_get_prefix(&prefix, args->dnode, "./prefix");
- afi_safi = yang_dnode_get_string(args->dnode, "./afi-safi");
+ yang_dnode_get_prefix(&prefix, args->dnode, "prefix");
+ afi_safi = yang_dnode_get_string(args->dnode, "afi-safi");
yang_afi_safi_identity2value(afi_safi, &afi, &safi);
prefix_afi = family2afi(prefix.family);
if (afi != prefix_afi) {
flog_warn(
EC_LIB_NB_CB_CONFIG_VALIDATE,
"route node %s creation failed",
- yang_dnode_get_string(args->dnode, "./prefix"));
+ yang_dnode_get_string(args->dnode, "prefix"));
return NB_ERR_VALIDATION;
}
break;
@@ -601,8 +601,8 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_cr
vrf = nb_running_get_entry(vrf_dnode, NULL, true);
s_vrf = vrf->info;
- yang_dnode_get_prefix(&prefix, args->dnode, "./prefix");
- afi_safi = yang_dnode_get_string(args->dnode, "./afi-safi");
+ yang_dnode_get_prefix(&prefix, args->dnode, "prefix");
+ afi_safi = yang_dnode_get_string(args->dnode, "afi-safi");
yang_afi_safi_identity2value(afi_safi, &afi, &safi);
rn = static_add_route(afi, safi, &prefix, NULL, s_vrf);
@@ -610,7 +610,7 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_cr
snprintf(
args->errmsg, args->errmsg_len,
"Static Route to %s not installed currently because dependent config not fully available",
- yang_dnode_get_string(args->dnode, "./prefix"));
+ yang_dnode_get_string(args->dnode, "prefix"));
nb_running_set_entry(args->dnode, rn);
break;
}
@@ -1048,7 +1048,7 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_sr
rn = nb_running_get_entry(args->dnode, NULL, true);
info = route_table_get_info(rn->table);
s_vrf = info->svrf;
- yang_dnode_get_ipv6p(&src_prefix, args->dnode, "./src-prefix");
+ yang_dnode_get_ipv6p(&src_prefix, args->dnode, "src-prefix");
afi = family2afi(src_prefix.family);
src_rn =
static_add_route(afi, safi, &rn->p, &src_prefix, s_vrf);
diff --git a/staticd/static_vrf.c b/staticd/static_vrf.c
index a67dce200..7a0ff01d0 100644
--- a/staticd/static_vrf.c
+++ b/staticd/static_vrf.c
@@ -124,26 +124,12 @@ struct static_vrf *static_vrf_lookup_by_name(const char *name)
return NULL;
}
-static int static_vrf_config_write(struct vty *vty)
-{
- struct lyd_node *dnode;
- int written = 0;
-
- dnode = yang_dnode_get(running_config->dnode, "/frr-routing:routing");
- if (dnode) {
- nb_cli_show_dnode_cmds(vty, dnode, false);
- written = 1;
- }
-
- return written;
-}
-
void static_vrf_init(void)
{
vrf_init(static_vrf_new, static_vrf_enable, static_vrf_disable,
static_vrf_delete);
- vrf_cmd_init(static_vrf_config_write);
+ vrf_cmd_init(NULL);
}
void static_vrf_terminate(void)
diff --git a/staticd/static_vty.c b/staticd/static_vty.c
index c2c260cfb..70ea6c525 100644
--- a/staticd/static_vty.c
+++ b/staticd/static_vty.c
@@ -101,7 +101,7 @@ static int static_route_nb_run(struct vty *vty, struct static_route_args *args)
return CMD_WARNING_CONFIG_FAILED;
}
- args->vrf = yang_dnode_get_string(vrf_dnode, "./name");
+ args->vrf = yang_dnode_get_string(vrf_dnode, "name");
} else {
if (args->vrf == NULL)
args->vrf = VRF_DEFAULT_NAME;
@@ -1234,8 +1234,10 @@ DEFPY_YANG(ipv6_route_vrf, ipv6_route_vrf_cmd,
return static_route_nb_run(vty, &args);
}
-void static_cli_show(struct vty *vty, const struct lyd_node *dnode,
- bool show_defaults)
+#ifdef INCLUDE_MGMTD_CMDDEFS_ONLY
+
+static void static_cli_show(struct vty *vty, const struct lyd_node *dnode,
+ bool show_defaults)
{
const char *vrf;
@@ -1244,7 +1246,7 @@ void static_cli_show(struct vty *vty, const struct lyd_node *dnode,
vty_out(vty, "vrf %s\n", vrf);
}
-void static_cli_show_end(struct vty *vty, const struct lyd_node *dnode)
+static void static_cli_show_end(struct vty *vty, const struct lyd_node *dnode)
{
const char *vrf;
@@ -1262,13 +1264,13 @@ static int mpls_label_iter_cb(const struct lyd_node *dnode, void *arg)
{
struct mpls_label_iter *iter = arg;
- if (yang_dnode_exists(dnode, "./label")) {
+ if (yang_dnode_exists(dnode, "label")) {
if (iter->first)
vty_out(iter->vty, " label %s",
- yang_dnode_get_string(dnode, "./label"));
+ yang_dnode_get_string(dnode, "label"));
else
vty_out(iter->vty, "/%s",
- yang_dnode_get_string(dnode, "./label"));
+ yang_dnode_get_string(dnode, "label"));
iter->first = false;
}
@@ -1286,16 +1288,16 @@ static int srv6_seg_iter_cb(const struct lyd_node *dnode, void *arg)
char buffer[INET6_ADDRSTRLEN];
struct in6_addr cli_seg;
- if (yang_dnode_exists(dnode, "./seg")) {
+ if (yang_dnode_exists(dnode, "seg")) {
if (iter->first) {
- yang_dnode_get_ipv6(&cli_seg, dnode, "./seg");
+ yang_dnode_get_ipv6(&cli_seg, dnode, "seg");
if (inet_ntop(AF_INET6, &cli_seg, buffer,
INET6_ADDRSTRLEN) == NULL) {
return 1;
}
vty_out(iter->vty, " segments %s", buffer);
} else {
- yang_dnode_get_ipv6(&cli_seg, dnode, "./seg");
+ yang_dnode_get_ipv6(&cli_seg, dnode, "seg");
if (inet_ntop(AF_INET6, &cli_seg, buffer,
INET6_ADDRSTRLEN) == NULL) {
return 1;
@@ -1329,7 +1331,7 @@ static void nexthop_cli_show(struct vty *vty, const struct lyd_node *route,
vrf = yang_dnode_get_string(route, "../../vrf");
- afi_safi = yang_dnode_get_string(route, "./afi-safi");
+ afi_safi = yang_dnode_get_string(route, "afi-safi");
yang_afi_safi_identity2value(afi_safi, &afi, &safi);
if (afi == AFI_IP)
@@ -1344,32 +1346,32 @@ static void nexthop_cli_show(struct vty *vty, const struct lyd_node *route,
else
vty_out(vty, " mroute");
- vty_out(vty, " %s", yang_dnode_get_string(route, "./prefix"));
+ vty_out(vty, " %s", yang_dnode_get_string(route, "prefix"));
if (src)
vty_out(vty, " from %s",
- yang_dnode_get_string(src, "./src-prefix"));
+ yang_dnode_get_string(src, "src-prefix"));
- nh_type = yang_dnode_get_enum(nexthop, "./nh-type");
+ nh_type = yang_dnode_get_enum(nexthop, "nh-type");
switch (nh_type) {
case STATIC_IFNAME:
vty_out(vty, " %s",
- yang_dnode_get_string(nexthop, "./interface"));
+ yang_dnode_get_string(nexthop, "interface"));
break;
case STATIC_IPV4_GATEWAY:
case STATIC_IPV6_GATEWAY:
vty_out(vty, " %s",
- yang_dnode_get_string(nexthop, "./gateway"));
+ yang_dnode_get_string(nexthop, "gateway"));
break;
case STATIC_IPV4_GATEWAY_IFNAME:
case STATIC_IPV6_GATEWAY_IFNAME:
vty_out(vty, " %s",
- yang_dnode_get_string(nexthop, "./gateway"));
+ yang_dnode_get_string(nexthop, "gateway"));
vty_out(vty, " %s",
- yang_dnode_get_string(nexthop, "./interface"));
+ yang_dnode_get_string(nexthop, "interface"));
break;
case STATIC_BLACKHOLE:
- bh_type = yang_dnode_get_enum(nexthop, "./bh-type");
+ bh_type = yang_dnode_get_enum(nexthop, "bh-type");
switch (bh_type) {
case STATIC_BLACKHOLE_DROP:
vty_out(vty, " blackhole");
@@ -1384,13 +1386,13 @@ static void nexthop_cli_show(struct vty *vty, const struct lyd_node *route,
break;
}
- if (yang_dnode_exists(path, "./tag")) {
- tag = yang_dnode_get_uint32(path, "./tag");
+ if (yang_dnode_exists(path, "tag")) {
+ tag = yang_dnode_get_uint32(path, "tag");
if (tag != 0 || show_defaults)
vty_out(vty, " tag %" PRIu32, tag);
}
- distance = yang_dnode_get_uint8(path, "./distance");
+ distance = yang_dnode_get_uint8(path, "distance");
if (distance != ZEBRA_STATIC_DISTANCE_DEFAULT || show_defaults)
vty_out(vty, " %" PRIu8, distance);
@@ -1404,48 +1406,49 @@ static void nexthop_cli_show(struct vty *vty, const struct lyd_node *route,
yang_dnode_iterate(srv6_seg_iter_cb, &seg_iter, nexthop,
"./srv6-segs-stack/entry");
- nexthop_vrf = yang_dnode_get_string(nexthop, "./vrf");
+ nexthop_vrf = yang_dnode_get_string(nexthop, "vrf");
if (strcmp(vrf, nexthop_vrf))
vty_out(vty, " nexthop-vrf %s", nexthop_vrf);
- table_id = yang_dnode_get_uint32(path, "./table-id");
+ table_id = yang_dnode_get_uint32(path, "table-id");
if (table_id || show_defaults)
vty_out(vty, " table %" PRIu32, table_id);
- if (yang_dnode_exists(nexthop, "./onlink")) {
- onlink = yang_dnode_get_bool(nexthop, "./onlink");
+ if (yang_dnode_exists(nexthop, "onlink")) {
+ onlink = yang_dnode_get_bool(nexthop, "onlink");
if (onlink)
vty_out(vty, " onlink");
}
- if (yang_dnode_exists(nexthop, "./srte-color"))
+ if (yang_dnode_exists(nexthop, "srte-color"))
vty_out(vty, " color %s",
- yang_dnode_get_string(nexthop, "./srte-color"));
+ yang_dnode_get_string(nexthop, "srte-color"));
- if (yang_dnode_exists(nexthop, "./bfd-monitoring")) {
+ if (yang_dnode_exists(nexthop, "bfd-monitoring")) {
const struct lyd_node *bfd_dnode =
- yang_dnode_get(nexthop, "./bfd-monitoring");
+ yang_dnode_get(nexthop, "bfd-monitoring");
- if (yang_dnode_get_bool(bfd_dnode, "./multi-hop")) {
+ if (yang_dnode_get_bool(bfd_dnode, "multi-hop")) {
vty_out(vty, " bfd multi-hop");
- if (yang_dnode_exists(bfd_dnode, "./source"))
+ if (yang_dnode_exists(bfd_dnode, "source"))
vty_out(vty, " source %s",
yang_dnode_get_string(bfd_dnode,
"./source"));
} else
vty_out(vty, " bfd");
- if (yang_dnode_exists(bfd_dnode, "./profile"))
+ if (yang_dnode_exists(bfd_dnode, "profile"))
vty_out(vty, " profile %s",
- yang_dnode_get_string(bfd_dnode, "./profile"));
+ yang_dnode_get_string(bfd_dnode, "profile"));
}
vty_out(vty, "\n");
}
-void static_nexthop_cli_show(struct vty *vty, const struct lyd_node *dnode,
- bool show_defaults)
+static void static_nexthop_cli_show(struct vty *vty,
+ const struct lyd_node *dnode,
+ bool show_defaults)
{
const struct lyd_node *path = yang_dnode_get_parent(dnode, "path-list");
const struct lyd_node *route =
@@ -1454,8 +1457,9 @@ void static_nexthop_cli_show(struct vty *vty, const struct lyd_node *dnode,
nexthop_cli_show(vty, route, NULL, path, dnode, show_defaults);
}
-void static_src_nexthop_cli_show(struct vty *vty, const struct lyd_node *dnode,
- bool show_defaults)
+static void static_src_nexthop_cli_show(struct vty *vty,
+ const struct lyd_node *dnode,
+ bool show_defaults)
{
const struct lyd_node *path = yang_dnode_get_parent(dnode, "path-list");
const struct lyd_node *src = yang_dnode_get_parent(path, "src-list");
@@ -1464,16 +1468,16 @@ void static_src_nexthop_cli_show(struct vty *vty, const struct lyd_node *dnode,
nexthop_cli_show(vty, route, src, path, dnode, show_defaults);
}
-int static_nexthop_cli_cmp(const struct lyd_node *dnode1,
- const struct lyd_node *dnode2)
+static int static_nexthop_cli_cmp(const struct lyd_node *dnode1,
+ const struct lyd_node *dnode2)
{
enum static_nh_type nh_type1, nh_type2;
struct prefix prefix1, prefix2;
const char *vrf1, *vrf2;
int ret = 0;
- nh_type1 = yang_dnode_get_enum(dnode1, "./nh-type");
- nh_type2 = yang_dnode_get_enum(dnode2, "./nh-type");
+ nh_type1 = yang_dnode_get_enum(dnode1, "nh-type");
+ nh_type2 = yang_dnode_get_enum(dnode2, "nh-type");
if (nh_type1 != nh_type2)
return (int)nh_type1 - (int)nh_type2;
@@ -1481,24 +1485,24 @@ int static_nexthop_cli_cmp(const struct lyd_node *dnode1,
switch (nh_type1) {
case STATIC_IFNAME:
ret = if_cmp_name_func(
- yang_dnode_get_string(dnode1, "./interface"),
- yang_dnode_get_string(dnode2, "./interface"));
+ yang_dnode_get_string(dnode1, "interface"),
+ yang_dnode_get_string(dnode2, "interface"));
break;
case STATIC_IPV4_GATEWAY:
case STATIC_IPV6_GATEWAY:
- yang_dnode_get_prefix(&prefix1, dnode1, "./gateway");
- yang_dnode_get_prefix(&prefix2, dnode2, "./gateway");
+ yang_dnode_get_prefix(&prefix1, dnode1, "gateway");
+ yang_dnode_get_prefix(&prefix2, dnode2, "gateway");
ret = prefix_cmp(&prefix1, &prefix2);
break;
case STATIC_IPV4_GATEWAY_IFNAME:
case STATIC_IPV6_GATEWAY_IFNAME:
- yang_dnode_get_prefix(&prefix1, dnode1, "./gateway");
- yang_dnode_get_prefix(&prefix2, dnode2, "./gateway");
+ yang_dnode_get_prefix(&prefix1, dnode1, "gateway");
+ yang_dnode_get_prefix(&prefix2, dnode2, "gateway");
ret = prefix_cmp(&prefix1, &prefix2);
if (!ret)
ret = if_cmp_name_func(
- yang_dnode_get_string(dnode1, "./interface"),
- yang_dnode_get_string(dnode2, "./interface"));
+ yang_dnode_get_string(dnode1, "interface"),
+ yang_dnode_get_string(dnode2, "interface"));
break;
case STATIC_BLACKHOLE:
/* There's only one blackhole nexthop per route */
@@ -1509,28 +1513,28 @@ int static_nexthop_cli_cmp(const struct lyd_node *dnode1,
if (ret)
return ret;
- vrf1 = yang_dnode_get_string(dnode1, "./vrf");
+ vrf1 = yang_dnode_get_string(dnode1, "vrf");
if (strmatch(vrf1, "default"))
vrf1 = "";
- vrf2 = yang_dnode_get_string(dnode2, "./vrf");
+ vrf2 = yang_dnode_get_string(dnode2, "vrf");
if (strmatch(vrf2, "default"))
vrf2 = "";
return if_cmp_name_func(vrf1, vrf2);
}
-int static_route_list_cli_cmp(const struct lyd_node *dnode1,
- const struct lyd_node *dnode2)
+static int static_route_list_cli_cmp(const struct lyd_node *dnode1,
+ const struct lyd_node *dnode2)
{
const char *afi_safi1, *afi_safi2;
afi_t afi1, afi2;
safi_t safi1, safi2;
struct prefix prefix1, prefix2;
- afi_safi1 = yang_dnode_get_string(dnode1, "./afi-safi");
+ afi_safi1 = yang_dnode_get_string(dnode1, "afi-safi");
yang_afi_safi_identity2value(afi_safi1, &afi1, &safi1);
- afi_safi2 = yang_dnode_get_string(dnode2, "./afi-safi");
+ afi_safi2 = yang_dnode_get_string(dnode2, "afi-safi");
yang_afi_safi_identity2value(afi_safi2, &afi2, &safi2);
if (afi1 != afi2)
@@ -1539,42 +1543,97 @@ int static_route_list_cli_cmp(const struct lyd_node *dnode1,
if (safi1 != safi2)
return (int)safi1 - (int)safi2;
- yang_dnode_get_prefix(&prefix1, dnode1, "./prefix");
- yang_dnode_get_prefix(&prefix2, dnode2, "./prefix");
+ yang_dnode_get_prefix(&prefix1, dnode1, "prefix");
+ yang_dnode_get_prefix(&prefix2, dnode2, "prefix");
return prefix_cmp(&prefix1, &prefix2);
}
-int static_src_list_cli_cmp(const struct lyd_node *dnode1,
- const struct lyd_node *dnode2)
+static int static_src_list_cli_cmp(const struct lyd_node *dnode1,
+ const struct lyd_node *dnode2)
{
struct prefix prefix1, prefix2;
- yang_dnode_get_prefix(&prefix1, dnode1, "./src-prefix");
- yang_dnode_get_prefix(&prefix2, dnode2, "./src-prefix");
+ yang_dnode_get_prefix(&prefix1, dnode1, "src-prefix");
+ yang_dnode_get_prefix(&prefix2, dnode2, "src-prefix");
return prefix_cmp(&prefix1, &prefix2);
}
-int static_path_list_cli_cmp(const struct lyd_node *dnode1,
- const struct lyd_node *dnode2)
+static int static_path_list_cli_cmp(const struct lyd_node *dnode1,
+ const struct lyd_node *dnode2)
{
uint32_t table_id1, table_id2;
uint8_t distance1, distance2;
- table_id1 = yang_dnode_get_uint32(dnode1, "./table-id");
- table_id2 = yang_dnode_get_uint32(dnode2, "./table-id");
+ table_id1 = yang_dnode_get_uint32(dnode1, "table-id");
+ table_id2 = yang_dnode_get_uint32(dnode2, "table-id");
if (table_id1 != table_id2)
return (int)table_id1 - (int)table_id2;
- distance1 = yang_dnode_get_uint8(dnode1, "./distance");
- distance2 = yang_dnode_get_uint8(dnode2, "./distance");
+ distance1 = yang_dnode_get_uint8(dnode1, "distance");
+ distance2 = yang_dnode_get_uint8(dnode2, "distance");
return (int)distance1 - (int)distance2;
}
-#ifndef INCLUDE_MGMTD_CMDDEFS_ONLY
+const struct frr_yang_module_info frr_staticd_info = {
+ .name = "frr-staticd",
+ .ignore_cbs = true,
+ .nodes = {
+ {
+ .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd",
+ .cbs = {
+ .cli_show = static_cli_show,
+ .cli_show_end = static_cli_show_end,
+ }
+ },
+ {
+ .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list",
+ .cbs = {
+ .cli_cmp = static_route_list_cli_cmp,
+ }
+ },
+ {
+ .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/path-list",
+ .cbs = {
+ .cli_cmp = static_path_list_cli_cmp,
+ }
+ },
+ {
+ .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/path-list/frr-nexthops/nexthop",
+ .cbs = {
+ .cli_show = static_nexthop_cli_show,
+ .cli_cmp = static_nexthop_cli_cmp,
+ }
+ },
+ {
+ .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list",
+ .cbs = {
+ .cli_cmp = static_src_list_cli_cmp,
+ }
+ },
+ {
+ .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list",
+ .cbs = {
+ .cli_cmp = static_path_list_cli_cmp,
+ }
+ },
+ {
+ .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-nexthops/nexthop",
+ .cbs = {
+ .cli_show = static_src_nexthop_cli_show,
+ .cli_cmp = static_nexthop_cli_cmp,
+ }
+ },
+ {
+ .xpath = NULL,
+ },
+ }
+};
+
+#else /* ifdef INCLUDE_MGMTD_CMDDEFS_ONLY */
DEFPY_YANG(debug_staticd, debug_staticd_cmd,
"[no] debug static [{events$events|route$route|bfd$bfd}]",
diff --git a/staticd/static_vty.h b/staticd/static_vty.h
index 77e52b5bd..4b4cc1c3b 100644
--- a/staticd/static_vty.h
+++ b/staticd/static_vty.h
@@ -11,22 +11,6 @@
extern "C" {
#endif
-void static_cli_show(struct vty *vty, const struct lyd_node *dnode,
- bool show_defaults);
-void static_cli_show_end(struct vty *vty, const struct lyd_node *dnode);
-void static_nexthop_cli_show(struct vty *vty, const struct lyd_node *dnode,
- bool show_defaults);
-void static_src_nexthop_cli_show(struct vty *vty, const struct lyd_node *dnode,
- bool show_defaults);
-int static_nexthop_cli_cmp(const struct lyd_node *dnode1,
- const struct lyd_node *dnode2);
-int static_route_list_cli_cmp(const struct lyd_node *dnode1,
- const struct lyd_node *dnode2);
-int static_src_list_cli_cmp(const struct lyd_node *dnode1,
- const struct lyd_node *dnode2);
-int static_path_list_cli_cmp(const struct lyd_node *dnode1,
- const struct lyd_node *dnode2);
-
void static_vty_init(void);
#ifdef __cplusplus