mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 21:47:15 +02:00
Merge 1fb9f129de
into 3dd4d417be
This commit is contained in:
commit
d3a1108902
|
@ -48,13 +48,13 @@ def test_zebra_operationalr(tgen):
|
||||||
|
|
||||||
r1 = tgen.gears["r1"]
|
r1 = tgen.gears["r1"]
|
||||||
|
|
||||||
output = json.loads(r1.vtysh_cmd("show mgmt get-data /frr-zebra:zebra"))
|
output = json.loads(r1.vtysh_cmd("show mgmt get-data /frr-zebra:zebra/state"))
|
||||||
|
|
||||||
logger.info("Output")
|
logger.info("Output")
|
||||||
logger.info(output)
|
logger.info(output)
|
||||||
|
|
||||||
logger.info("Ensuring that the max-multipath value is returned")
|
logger.info("Ensuring that the max-multipath value is returned")
|
||||||
assert "max-multipath" in output["frr-zebra:zebra"].keys()
|
assert "max-multipath" in output["frr-zebra:zebra"]["state"].keys()
|
||||||
|
|
||||||
logger.info("Checking IP forwarding states")
|
logger.info("Checking IP forwarding states")
|
||||||
state = output["frr-zebra:zebra"]["state"]
|
state = output["frr-zebra:zebra"]["state"]
|
||||||
|
|
|
@ -3080,17 +3080,6 @@ module frr-zebra {
|
||||||
container zebra {
|
container zebra {
|
||||||
description
|
description
|
||||||
"Data model for the Zebra daemon.";
|
"Data model for the Zebra daemon.";
|
||||||
leaf max-multipath {
|
|
||||||
type uint16 {
|
|
||||||
range "1..65535";
|
|
||||||
}
|
|
||||||
config false;
|
|
||||||
description
|
|
||||||
"The maximum number of nexthops for a route. At this point it
|
|
||||||
is unlikely that a multipath number will ever get larger then
|
|
||||||
1024 but to allow for future expansions, the yang returns a
|
|
||||||
16 bit number";
|
|
||||||
}
|
|
||||||
leaf ip-forwarding {
|
leaf ip-forwarding {
|
||||||
type boolean;
|
type boolean;
|
||||||
description
|
description
|
||||||
|
@ -3193,6 +3182,16 @@ module frr-zebra {
|
||||||
config false;
|
config false;
|
||||||
description
|
description
|
||||||
"Operational data.";
|
"Operational data.";
|
||||||
|
leaf max-multipath {
|
||||||
|
type uint16 {
|
||||||
|
range "1..65535";
|
||||||
|
}
|
||||||
|
description
|
||||||
|
"The maximum number of nexthops for a route. At this point it
|
||||||
|
is unlikely that a multipath number will ever get larger then
|
||||||
|
1024 but to allow for future expansions, the yang returns a
|
||||||
|
16 bit number";
|
||||||
|
}
|
||||||
leaf ip-forwarding {
|
leaf ip-forwarding {
|
||||||
type boolean;
|
type boolean;
|
||||||
description
|
description
|
||||||
|
|
|
@ -26,7 +26,7 @@ const struct frr_yang_module_info frr_zebra_info = {
|
||||||
.features = features,
|
.features = features,
|
||||||
.nodes = {
|
.nodes = {
|
||||||
{
|
{
|
||||||
.xpath = "/frr-zebra:zebra/max-multipath",
|
.xpath = "/frr-zebra:zebra/state/max-multipath",
|
||||||
.cbs = {
|
.cbs = {
|
||||||
.get_elem = zebra_max_multipath_get_elem,
|
.get_elem = zebra_max_multipath_get_elem,
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,19 +30,28 @@
|
||||||
#include "zebra/zebra_routemap.h"
|
#include "zebra/zebra_routemap.h"
|
||||||
#include "zebra/zebra_rnh.h"
|
#include "zebra/zebra_rnh.h"
|
||||||
#include "zebra/table_manager.h"
|
#include "zebra/table_manager.h"
|
||||||
|
#include "zebra/ipforward.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPath: /frr-zebra:zebra/ip-forwarding
|
* XPath: /frr-zebra:zebra/ip-forwarding
|
||||||
*/
|
*/
|
||||||
int zebra_ip_forwarding_modify(struct nb_cb_modify_args *args)
|
int zebra_ip_forwarding_modify(struct nb_cb_modify_args *args)
|
||||||
{
|
{
|
||||||
switch (args->event) {
|
bool forwarding;
|
||||||
case NB_EV_VALIDATE:
|
int ret;
|
||||||
case NB_EV_PREPARE:
|
|
||||||
case NB_EV_ABORT:
|
if (args->event != NB_EV_APPLY)
|
||||||
case NB_EV_APPLY:
|
return NB_OK;
|
||||||
/* TODO: implement me. */
|
|
||||||
break;
|
forwarding = yang_dnode_get_bool(args->dnode, NULL);
|
||||||
|
|
||||||
|
ret = ipforward();
|
||||||
|
if (ret == 0) {
|
||||||
|
if (forwarding)
|
||||||
|
ipforward_on();
|
||||||
|
} else {
|
||||||
|
if (!forwarding)
|
||||||
|
ipforward_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
return NB_OK;
|
return NB_OK;
|
||||||
|
@ -67,13 +76,21 @@ int zebra_ip_forwarding_destroy(struct nb_cb_destroy_args *args)
|
||||||
*/
|
*/
|
||||||
int zebra_ipv6_forwarding_modify(struct nb_cb_modify_args *args)
|
int zebra_ipv6_forwarding_modify(struct nb_cb_modify_args *args)
|
||||||
{
|
{
|
||||||
switch (args->event) {
|
bool forwarding;
|
||||||
case NB_EV_VALIDATE:
|
int ret;
|
||||||
case NB_EV_PREPARE:
|
|
||||||
case NB_EV_ABORT:
|
if (args->event != NB_EV_APPLY)
|
||||||
case NB_EV_APPLY:
|
return NB_OK;
|
||||||
/* TODO: implement me. */
|
|
||||||
break;
|
forwarding = yang_dnode_get_bool(args->dnode, NULL);
|
||||||
|
ret = ipforward_ipv6();
|
||||||
|
|
||||||
|
if (ret == 0) {
|
||||||
|
if (forwarding)
|
||||||
|
ipforward_ipv6_on();
|
||||||
|
} else {
|
||||||
|
if (!forwarding)
|
||||||
|
ipforward_ipv6_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
return NB_OK;
|
return NB_OK;
|
||||||
|
|
|
@ -1165,7 +1165,7 @@ lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_nexthop_weight_get_elem(
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPath:
|
* XPath:
|
||||||
* /frr-zebra:zebra/max-multipath
|
* /frr-zebra:zebra/state/max-multipath
|
||||||
*/
|
*/
|
||||||
struct yang_data *zebra_max_multipath_get_elem(struct nb_cb_get_elem_args *args)
|
struct yang_data *zebra_max_multipath_get_elem(struct nb_cb_get_elem_args *args)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3833,45 +3833,17 @@ DEFUN (show_zebra,
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (ip_forwarding,
|
DEFPY_YANG (ip_forwarding,
|
||||||
ip_forwarding_cmd,
|
ip_forwarding_cmd,
|
||||||
"ip forwarding",
|
"[no] ip forwarding",
|
||||||
IP_STR
|
NO_STR
|
||||||
"Turn on IP forwarding\n")
|
IP_STR
|
||||||
|
"Turn on IP forwarding\n")
|
||||||
{
|
{
|
||||||
int ret;
|
nb_cli_enqueue_change(vty, "/frr-zebra:zebra/ip-forwarding", NB_OP_MODIFY,
|
||||||
|
no ? "false" : "true");
|
||||||
|
|
||||||
ret = ipforward();
|
return nb_cli_apply_changes(vty, NULL);
|
||||||
if (ret == 0)
|
|
||||||
ret = ipforward_on();
|
|
||||||
|
|
||||||
if (ret == 0) {
|
|
||||||
vty_out(vty, "Can't turn on IP forwarding\n");
|
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN (no_ip_forwarding,
|
|
||||||
no_ip_forwarding_cmd,
|
|
||||||
"no ip forwarding",
|
|
||||||
NO_STR
|
|
||||||
IP_STR
|
|
||||||
"Turn off IP forwarding\n")
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = ipforward();
|
|
||||||
if (ret != 0)
|
|
||||||
ret = ipforward_off();
|
|
||||||
|
|
||||||
if (ret != 0) {
|
|
||||||
vty_out(vty, "Can't turn off IP forwarding\n");
|
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Only display ip forwarding is enabled or not. */
|
/* Only display ip forwarding is enabled or not. */
|
||||||
|
@ -3922,45 +3894,17 @@ DEFUN (show_ipv6_forwarding,
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (ipv6_forwarding,
|
DEFPY_YANG (ipv6_forwarding,
|
||||||
ipv6_forwarding_cmd,
|
ipv6_forwarding_cmd,
|
||||||
"ipv6 forwarding",
|
"[no] ipv6 forwarding",
|
||||||
IPV6_STR
|
NO_STR
|
||||||
"Turn on IPv6 forwarding\n")
|
IPV6_STR
|
||||||
|
"Turn on IPv6 forwarding\n")
|
||||||
{
|
{
|
||||||
int ret;
|
nb_cli_enqueue_change(vty, "/frr-zebra:zebra/ipv6-forwarding", NB_OP_MODIFY,
|
||||||
|
no ? "false" : "true");
|
||||||
|
|
||||||
ret = ipforward_ipv6();
|
return nb_cli_apply_changes(vty, NULL);
|
||||||
if (ret == 0)
|
|
||||||
ret = ipforward_ipv6_on();
|
|
||||||
|
|
||||||
if (ret == 0) {
|
|
||||||
vty_out(vty, "Can't turn on IPv6 forwarding\n");
|
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN (no_ipv6_forwarding,
|
|
||||||
no_ipv6_forwarding_cmd,
|
|
||||||
"no ipv6 forwarding",
|
|
||||||
NO_STR
|
|
||||||
IPV6_STR
|
|
||||||
"Turn off IPv6 forwarding\n")
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = ipforward_ipv6();
|
|
||||||
if (ret != 0)
|
|
||||||
ret = ipforward_ipv6_off();
|
|
||||||
|
|
||||||
if (ret != 0) {
|
|
||||||
vty_out(vty, "Can't turn off IPv6 forwarding\n");
|
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display dataplane info */
|
/* Display dataplane info */
|
||||||
|
@ -4253,12 +4197,10 @@ void zebra_vty_init(void)
|
||||||
|
|
||||||
install_element(VIEW_NODE, &show_ip_forwarding_cmd);
|
install_element(VIEW_NODE, &show_ip_forwarding_cmd);
|
||||||
install_element(CONFIG_NODE, &ip_forwarding_cmd);
|
install_element(CONFIG_NODE, &ip_forwarding_cmd);
|
||||||
install_element(CONFIG_NODE, &no_ip_forwarding_cmd);
|
|
||||||
install_element(ENABLE_NODE, &show_zebra_cmd);
|
install_element(ENABLE_NODE, &show_zebra_cmd);
|
||||||
|
|
||||||
install_element(VIEW_NODE, &show_ipv6_forwarding_cmd);
|
install_element(VIEW_NODE, &show_ipv6_forwarding_cmd);
|
||||||
install_element(CONFIG_NODE, &ipv6_forwarding_cmd);
|
install_element(CONFIG_NODE, &ipv6_forwarding_cmd);
|
||||||
install_element(CONFIG_NODE, &no_ipv6_forwarding_cmd);
|
|
||||||
|
|
||||||
/* Route-map */
|
/* Route-map */
|
||||||
zebra_route_map_init();
|
zebra_route_map_init();
|
||||||
|
|
Loading…
Reference in a new issue