#include "privs.h"
#include "vrf.h"
#include "lib_errors.h"
+#include "northbound_cli.h"
#include "ripngd/ripngd.h"
#include "ripngd/ripng_debug.h"
}
}
-void ripng_interface_reset(void)
-{
- struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
- struct interface *ifp;
- struct ripng_interface *ri;
-
- FOR_ALL_INTERFACES (vrf, ifp) {
- ri = ifp->info;
-
- ri->enable_network = 0;
- ri->enable_interface = 0;
- ri->running = 0;
-
- ri->split_horizon = RIPNG_NO_SPLIT_HORIZON;
- ri->split_horizon_default = RIPNG_NO_SPLIT_HORIZON;
-
- ri->list[RIPNG_FILTER_IN] = NULL;
- ri->list[RIPNG_FILTER_OUT] = NULL;
-
- ri->prefix[RIPNG_FILTER_IN] = NULL;
- ri->prefix[RIPNG_FILTER_OUT] = NULL;
-
- if (ri->t_wakeup) {
- thread_cancel(ri->t_wakeup);
- ri->t_wakeup = NULL;
- }
-
- ri->passive = 0;
- }
-}
-
static void ripng_apply_address_add(struct connected *ifc)
{
struct prefix_ipv6 address;
return 0;
}
-DEFUN (ipv6_ripng_split_horizon,
- ipv6_ripng_split_horizon_cmd,
- "ipv6 ripng split-horizon",
- IPV6_STR
- "Routing Information Protocol\n"
- "Perform split horizon\n")
-{
- VTY_DECLVAR_CONTEXT(interface, ifp);
- struct ripng_interface *ri;
-
- ri = ifp->info;
-
- ri->split_horizon = RIPNG_SPLIT_HORIZON;
- return CMD_SUCCESS;
-}
-
-DEFUN (ipv6_ripng_split_horizon_poisoned_reverse,
- ipv6_ripng_split_horizon_poisoned_reverse_cmd,
- "ipv6 ripng split-horizon poisoned-reverse",
- IPV6_STR
- "Routing Information Protocol\n"
- "Perform split horizon\n"
- "With poisoned-reverse\n")
-{
- VTY_DECLVAR_CONTEXT(interface, ifp);
- struct ripng_interface *ri;
-
- ri = ifp->info;
-
- ri->split_horizon = RIPNG_SPLIT_HORIZON_POISONED_REVERSE;
- return CMD_SUCCESS;
-}
-
-DEFUN (no_ipv6_ripng_split_horizon,
- no_ipv6_ripng_split_horizon_cmd,
- "no ipv6 ripng split-horizon [poisoned-reverse]",
- NO_STR
- IPV6_STR
- "Routing Information Protocol\n"
- "Perform split horizon\n"
- "With poisoned-reverse\n")
-{
- VTY_DECLVAR_CONTEXT(interface, ifp);
- struct ripng_interface *ri;
-
- ri = ifp->info;
-
- ri->split_horizon = RIPNG_NO_SPLIT_HORIZON;
- return CMD_SUCCESS;
-}
-
static struct ripng_interface *ri_new(void)
{
struct ripng_interface *ri;
Relay or SMDS is enabled, the default value for split-horizon is
off. But currently Zebra does detect Frame Relay or SMDS
interface. So all interface is set to split horizon. */
- ri->split_horizon_default = RIPNG_SPLIT_HORIZON;
- ri->split_horizon = ri->split_horizon_default;
+ ri->split_horizon =
+ yang_get_default_enum("%s/split-horizon", RIPNG_IFACE);
return ri;
}
{
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
struct interface *ifp;
- struct ripng_interface *ri;
int write = 0;
FOR_ALL_INTERFACES (vrf, ifp) {
- ri = ifp->info;
+ struct lyd_node *dnode;
- /* Do not display the interface if there is no
- * configuration about it.
- **/
- if ((!ifp->desc)
- && (ri->split_horizon == ri->split_horizon_default))
+ dnode = yang_dnode_get(
+ running_config->dnode,
+ "/frr-interface:lib/interface[name='%s'][vrf='%s']",
+ ifp->name, vrf->name);
+ if (dnode == NULL)
continue;
- vty_frame(vty, "interface %s\n", ifp->name);
- if (ifp->desc)
- vty_out(vty, " description %s\n", ifp->desc);
-
- /* Split horizon. */
- if (ri->split_horizon != ri->split_horizon_default) {
- switch (ri->split_horizon) {
- case RIPNG_SPLIT_HORIZON:
- vty_out(vty, " ipv6 ripng split-horizon\n");
- break;
- case RIPNG_SPLIT_HORIZON_POISONED_REVERSE:
- vty_out(vty,
- " ipv6 ripng split-horizon poisoned-reverse\n");
- break;
- case RIPNG_NO_SPLIT_HORIZON:
- default:
- vty_out(vty, " no ipv6 ripng split-horizon\n");
- break;
- }
- }
-
- vty_endframe(vty, "!\n");
-
- write++;
+ write = 1;
+ nb_cli_show_dnode_cmds(vty, dnode, false);
}
+
return write;
}
/* Install interface node. */
install_node(&interface_node, interface_config_write);
if_cmd_init();
-
- install_element(INTERFACE_NODE, &ipv6_ripng_split_horizon_cmd);
- install_element(INTERFACE_NODE,
- &ipv6_ripng_split_horizon_poisoned_reverse_cmd);
- install_element(INTERFACE_NODE, &no_ipv6_ripng_split_horizon_cmd);
}