summaryrefslogtreecommitdiffstats
path: root/ripngd
diff options
context:
space:
mode:
Diffstat (limited to 'ripngd')
-rw-r--r--ripngd/ripng_cli.c36
-rw-r--r--ripngd/ripng_cli.h3
-rw-r--r--ripngd/ripng_northbound.c7
-rw-r--r--ripngd/ripngd.c35
-rw-r--r--ripngd/ripngd.h5
5 files changed, 46 insertions, 40 deletions
diff --git a/ripngd/ripng_cli.c b/ripngd/ripng_cli.c
index 04cde899d..5a1c9bdca 100644
--- a/ripngd/ripng_cli.c
+++ b/ripngd/ripng_cli.c
@@ -125,6 +125,40 @@ void cli_show_ripng_default_information_originate(struct vty *vty,
vty_out(vty, " default-information originate\n");
}
+/*
+ * XPath: /frr-ripngd:ripngd/instance/default-metric
+ */
+DEFPY (ripng_default_metric,
+ ripng_default_metric_cmd,
+ "default-metric (1-16)",
+ "Set a metric of redistribute routes\n"
+ "Default metric\n")
+{
+ nb_cli_enqueue_change(vty, "./default-metric", NB_OP_MODIFY,
+ default_metric_str);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+DEFPY (no_ripng_default_metric,
+ no_ripng_default_metric_cmd,
+ "no default-metric [(1-16)]",
+ NO_STR
+ "Set a metric of redistribute routes\n"
+ "Default metric\n")
+{
+ nb_cli_enqueue_change(vty, "./default-metric", NB_OP_MODIFY, NULL);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+void cli_show_ripng_default_metric(struct vty *vty, struct lyd_node *dnode,
+ bool show_defaults)
+{
+ vty_out(vty, " default-metric %s\n",
+ yang_dnode_get_string(dnode, NULL));
+}
+
void ripng_cli_init(void)
{
install_element(CONFIG_NODE, &router_ripng_cmd);
@@ -132,4 +166,6 @@ void ripng_cli_init(void)
install_element(RIPNG_NODE, &ripng_allow_ecmp_cmd);
install_element(RIPNG_NODE, &ripng_default_information_originate_cmd);
+ install_element(RIPNG_NODE, &ripng_default_metric_cmd);
+ install_element(RIPNG_NODE, &no_ripng_default_metric_cmd);
}
diff --git a/ripngd/ripng_cli.h b/ripngd/ripng_cli.h
index 6ba75c7f4..0cdbc2d6a 100644
--- a/ripngd/ripng_cli.h
+++ b/ripngd/ripng_cli.h
@@ -28,5 +28,8 @@ extern void cli_show_ripng_allow_ecmp(struct vty *vty, struct lyd_node *dnode,
extern void cli_show_ripng_default_information_originate(struct vty *vty,
struct lyd_node *dnode,
bool show_defaults);
+extern void cli_show_ripng_default_metric(struct vty *vty,
+ struct lyd_node *dnode,
+ bool show_defaults);
#endif /* _FRR_RIPNG_CLI_H_ */
diff --git a/ripngd/ripng_northbound.c b/ripngd/ripng_northbound.c
index 6d837af3c..7a7c14ceb 100644
--- a/ripngd/ripng_northbound.c
+++ b/ripngd/ripng_northbound.c
@@ -125,7 +125,11 @@ static int ripngd_instance_default_metric_modify(enum nb_event event,
const struct lyd_node *dnode,
union nb_resource *resource)
{
- /* TODO: implement me. */
+ if (event != NB_EV_APPLY)
+ return NB_OK;
+
+ ripng->default_metric = yang_dnode_get_uint8(dnode, NULL);
+
return NB_OK;
}
@@ -544,6 +548,7 @@ const struct frr_yang_module_info frr_ripngd_info = {
{
.xpath = "/frr-ripngd:ripngd/instance/default-metric",
.cbs.modify = ripngd_instance_default_metric_modify,
+ .cbs.cli_show = cli_show_ripng_default_metric,
},
{
.xpath = "/frr-ripngd:ripngd/instance/network",
diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c
index e8dc45d1f..4d67aa2f6 100644
--- a/ripngd/ripngd.c
+++ b/ripngd/ripngd.c
@@ -2290,33 +2290,6 @@ DEFUN (no_ripng_aggregate_address,
return CMD_SUCCESS;
}
-DEFUN (ripng_default_metric,
- ripng_default_metric_cmd,
- "default-metric (1-16)",
- "Set a metric of redistribute routes\n"
- "Default metric\n")
-{
- int idx_number = 1;
- if (ripng) {
- ripng->default_metric = atoi(argv[idx_number]->arg);
- }
- return CMD_SUCCESS;
-}
-
-DEFUN (no_ripng_default_metric,
- no_ripng_default_metric_cmd,
- "no default-metric [(1-16)]",
- NO_STR
- "Set a metric of redistribute routes\n"
- "Default metric\n")
-{
- if (ripng) {
- ripng->default_metric = RIPNG_DEFAULT_METRIC_DEFAULT;
- }
- return CMD_SUCCESS;
-}
-
-
#if 0
/* RIPng update timer setup. */
DEFUN (ripng_update_timer,
@@ -2551,11 +2524,6 @@ static int ripng_config_write(struct vty *vty)
ripng_network_write(vty, 1);
- /* RIPng default metric configuration */
- if (ripng->default_metric != RIPNG_DEFAULT_METRIC_DEFAULT)
- vty_out(vty, " default-metric %d\n",
- ripng->default_metric);
-
ripng_redistribute_write(vty, 1);
/* RIP offset-list configuration. */
@@ -2885,9 +2853,6 @@ void ripng_init()
install_element(RIPNG_NODE, &ripng_aggregate_address_cmd);
install_element(RIPNG_NODE, &no_ripng_aggregate_address_cmd);
- install_element(RIPNG_NODE, &ripng_default_metric_cmd);
- install_element(RIPNG_NODE, &no_ripng_default_metric_cmd);
-
install_element(RIPNG_NODE, &ripng_timers_cmd);
install_element(RIPNG_NODE, &no_ripng_timers_cmd);
#if 0
diff --git a/ripngd/ripngd.h b/ripngd/ripngd.h
index c9bcd8b0e..6ebc72dae 100644
--- a/ripngd/ripngd.h
+++ b/ripngd/ripngd.h
@@ -77,9 +77,6 @@
#define RIPNG_DEFAULT_ACCEPT_NONE 1
#define RIPNG_DEFAULT_ACCEPT 2
-/* Default value for "default-metric" command. */
-#define RIPNG_DEFAULT_METRIC_DEFAULT 1
-
/* For max RTE calculation. */
#ifndef IPV6_HDRLEN
#define IPV6_HDRLEN 40
@@ -105,7 +102,7 @@ struct ripng {
unsigned long timeout_time;
unsigned long garbage_time;
int max_mtu;
- int default_metric;
+ uint8_t default_metric;
/* Input/output buffer of RIPng. */
struct stream *ibuf;