return CMD_SUCCESS;
}
-#ifndef VTYSH_EXTRACT_PL
-#include "bgp_debug_clippy.c"
-#endif
-
/* debug bgp bestpath */
-DEFPY (debug_bgp_bestpath_prefix,
+DEFUN (debug_bgp_bestpath_prefix,
debug_bgp_bestpath_prefix_cmd,
- "debug bgp bestpath <A.B.C.D/M|X:X::X:X/M>$bestpath",
+ "debug bgp bestpath <A.B.C.D/M|X:X::X:X/M>",
DEBUG_STR
BGP_STR
"BGP bestpath\n"
"IPv4 prefix\n"
"IPv6 prefix\n")
{
+ struct prefix *argv_p;
+ int idx_ipv4_ipv6_prefixlen = 3;
+
+ argv_p = prefix_new();
+ (void)str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
+ apply_mask(argv_p);
+
if (!bgp_debug_bestpath_prefixes)
bgp_debug_bestpath_prefixes = list_new();
if (bgp_debug_list_has_entry(bgp_debug_bestpath_prefixes, NULL,
- bestpath)) {
+ argv_p)) {
vty_out(vty,
"BGP bestpath debugging is already enabled for %s\n",
- bestpath_str);
+ argv[idx_ipv4_ipv6_prefixlen]->arg);
return CMD_SUCCESS;
}
- bgp_debug_list_add_entry(bgp_debug_bestpath_prefixes, NULL, bestpath);
+ bgp_debug_list_add_entry(bgp_debug_bestpath_prefixes, NULL, argv_p);
if (vty->node == CONFIG_NODE) {
DEBUG_ON(bestpath, BESTPATH);
} else {
TERM_DEBUG_ON(bestpath, BESTPATH);
vty_out(vty, "BGP bestpath debugging is on for %s\n",
- bestpath_str);
+ argv[idx_ipv4_ipv6_prefixlen]->arg);
}
return CMD_SUCCESS;
int idx_ipv4_ipv6_prefixlen = 4;
struct prefix *argv_p;
int found_prefix = 0;
- int ret;
argv_p = prefix_new();
- ret = str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
- if (!ret) {
- prefix_free(argv_p);
- vty_out(vty, "%% Malformed Prefix\n");
- return CMD_WARNING_CONFIG_FAILED;
- }
+ (void)str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
+ apply_mask(argv_p);
if (bgp_debug_bestpath_prefixes
&& !list_isempty(bgp_debug_bestpath_prefixes)) {
{
int idx_ipv4_ipv6_prefixlen = 4;
struct prefix *argv_p;
- int ret;
argv_p = prefix_new();
- ret = str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
- if (!ret) {
- prefix_free(argv_p);
- vty_out(vty, "%% Malformed Prefix\n");
- return CMD_WARNING_CONFIG_FAILED;
- }
-
+ (void)str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
+ apply_mask(argv_p);
if (!bgp_debug_update_prefixes)
bgp_debug_update_prefixes = list_new();
int idx_ipv4_ipv6_prefixlen = 5;
struct prefix *argv_p;
int found_prefix = 0;
- int ret;
argv_p = prefix_new();
- ret = str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
- if (!ret) {
- prefix_free(argv_p);
- vty_out(vty, "%% Malformed Prefix\n");
- return CMD_WARNING_CONFIG_FAILED;
- }
+ (void)str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
+ apply_mask(argv_p);
if (bgp_debug_update_prefixes
&& !list_isempty(bgp_debug_update_prefixes)) {
{
int idx_ipv4_ipv6_prefixlen = 4;
struct prefix *argv_p;
- int ret;
argv_p = prefix_new();
- ret = str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
- if (!ret) {
- prefix_free(argv_p);
- vty_out(vty, "%% Malformed Prefix\n");
- return CMD_WARNING_CONFIG_FAILED;
- }
+ (void)str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
+ apply_mask(argv_p);
if (!bgp_debug_zebra_prefixes)
bgp_debug_zebra_prefixes = list_new();
int idx_ipv4_ipv6_prefixlen = 5;
struct prefix *argv_p;
int found_prefix = 0;
- int ret;
argv_p = prefix_new();
- ret = str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
- if (!ret) {
- prefix_free(argv_p);
- vty_out(vty, "%% Malformed Prefix\n");
- return CMD_WARNING_CONFIG_FAILED;
- }
+ (void)str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
+ apply_mask(argv_p);
if (bgp_debug_zebra_prefixes
&& !list_isempty(bgp_debug_zebra_prefixes)) {
for ctx_key in ctx_keys:
cmd.append(ctx_key)
- return '\n' + '\n'.join(cmd)
+ cmd = '\n' + '\n'.join(cmd)
+
+ # There are some commands that are on by default so their "no" form will be
+ # displayed in the config. "no bgp default ipv4-unicast" is one of these.
+ # If we need to remove this line we do so by adding "bgp default ipv4-unicast",
+ # not by doing a "no no bgp default ipv4-unicast"
+ cmd = cmd.replace('no no ', '')
+
+ return cmd
def get_normalized_ipv6_line(line):
return (lines_to_add, lines_to_del)
+
if __name__ == '__main__':
# Command line options
parser = argparse.ArgumentParser(description='Dynamically apply diff in frr configs')
while True:
try:
- _ = subprocess.check_output(cmd)
+ _ = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError:
fh.write(line + '\n')
try:
- subprocess.check_output(['/usr/bin/vtysh', '-f', filename])
+ subprocess.check_output(['/usr/bin/vtysh', '-f', filename], stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
log.warning("frr-reload.py failed due to\n%s" % e.output)
reload_ok = False
pid_t integrated_write_pid;
static int integrated_result_fd;
-DEFUN_NOSH(show_watchfrr_debugging,
- show_watchfrr_debugging_cmd,
- "show debugging [watchfrr]",
- SHOW_STR
- DEBUG_STR
- "WatchFRR\n")
-{
- return CMD_SUCCESS;
-}
-
DEFUN(config_write_integrated,
config_write_integrated_cmd,
"write integrated",
exit(1);
}
+DEFUN_NOSH (show_debugging_watchfrr,
+ show_debugging_watchfrr_cmd,
+ "show debugging [watchfrr]",
+ SHOW_STR
+ DEBUG_STR
+ WATCHFRR_STR)
+{
+ return CMD_SUCCESS;
+}
+
void integrated_write_sigchld(int status)
{
uint8_t reply[4] = {0, 0, 0, CMD_WARNING};
{
integrated_write_pid = -1;
install_element(ENABLE_NODE, &config_write_integrated_cmd);
- install_element(ENABLE_NODE, &show_watchfrr_debugging_cmd);
+ install_element(ENABLE_NODE, &show_debugging_watchfrr_cmd);
+ install_element(CONFIG_NODE, &show_debugging_watchfrr_cmd);
}
"Debug option set for zebra events\n")
{
zebra_debug_event = ZEBRA_DEBUG_EVENT;
- return CMD_WARNING_CONFIG_FAILED;
+ return CMD_SUCCESS;
}
DEFUN (debug_zebra_nht,
"Debug option set for zebra next hop tracking\n")
{
zebra_debug_nht = ZEBRA_DEBUG_NHT;
- return CMD_WARNING_CONFIG_FAILED;
+ return CMD_SUCCESS;
}
DEFUN (debug_zebra_mpls,
"Debug option set for zebra MPLS LSPs\n")
{
zebra_debug_mpls = ZEBRA_DEBUG_MPLS;
- return CMD_WARNING_CONFIG_FAILED;
+ return CMD_SUCCESS;
}
DEFUN (debug_zebra_vxlan,
"Debug option set for zebra VxLAN (EVPN)\n")
{
zebra_debug_vxlan = ZEBRA_DEBUG_VXLAN;
- return CMD_WARNING;
+ return CMD_SUCCESS;
}
DEFUN (debug_zebra_pw,
UNSET_FLAG(zebra_debug_pw, ZEBRA_DEBUG_PW);
else
SET_FLAG(zebra_debug_pw, ZEBRA_DEBUG_PW);
- return CMD_WARNING;
+ return CMD_SUCCESS;
}
DEFUN (debug_zebra_packet,