From: Daniel Walton Date: Fri, 23 Sep 2016 00:14:41 +0000 (+0000) Subject: pimd: argv update X-Git-Tag: frr-3.0-branchpoint~129^2~189 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=91ac1d43adb63876fdfa123d82d7481a03706277;p=matthieu%2Ffrr.git pimd: argv update Signed-off-by: Daniel Walton --- diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 6cfed0f2c6..8753106515 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -1534,7 +1534,7 @@ DEFUN (pim_interface, "Interface's name\n") { struct interface *ifp; - const char *ifname = argv[0]; + const char *ifname = argv[1]->arg; size_t sl; sl = strlen(ifname); @@ -2374,7 +2374,7 @@ DEFUN (show_ip_rib, char nexthop_addr_str[100]; int result; - addr_str = argv[0]; + addr_str = argv[3]->arg; result = inet_pton(AF_INET, addr_str, &addr); if (result <= 0) { vty_out(vty, "Bad unicast address %s: errno=%d: %s%s", @@ -2468,14 +2468,14 @@ DEFUN (ip_pim_rp, { int result; - result = inet_pton(AF_INET, argv[0], &qpim_rp.rpf_addr.s_addr); + result = inet_pton(AF_INET, argv[3]->arg, &qpim_rp.rpf_addr.s_addr); if (result <= 0) { - vty_out(vty, "%% Bad RP address specified: %s", argv[0]); + vty_out(vty, "%% Bad RP address specified: %s", argv[3]->arg); return CMD_WARNING; } if (pim_nexthop_lookup(&qpim_rp.source_nexthop, qpim_rp.rpf_addr, NULL) != 0) { - vty_out(vty, "%% No Path to RP address specified: %s", argv[0]); + vty_out(vty, "%% No Path to RP address specified: %s", argv[3]->arg); return CMD_WARNING; } @@ -2533,7 +2533,7 @@ DEFUN (ip_ssmpingd, { int result; struct in_addr source_addr; - const char *source_str = (argc > 0) ? argv[0] : "0.0.0.0"; + const char *source_str = (argc > 0) ? argv[2]->arg : "0.0.0.0"; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { @@ -2562,7 +2562,7 @@ DEFUN (no_ip_ssmpingd, { int result; struct in_addr source_addr; - const char *source_str = (argc > 0) ? argv[0] : "0.0.0.0"; + const char *source_str = (argc > 0) ? argv[3]->arg : "0.0.0.0"; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { @@ -2658,7 +2658,7 @@ DEFUN (interface_ip_igmp_join, ifp = vty->index; /* Group address */ - group_str = argv[0]; + group_str = argv[3]->arg; result = inet_pton(AF_INET, group_str, &group_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -2667,7 +2667,7 @@ DEFUN (interface_ip_igmp_join, } /* Source address */ - source_str = argv[1]; + source_str = argv[4]->arg; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -2705,7 +2705,7 @@ DEFUN (interface_no_ip_igmp_join, ifp = vty->index; /* Group address */ - group_str = argv[0]; + group_str = argv[4]->arg; result = inet_pton(AF_INET, group_str, &group_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -2714,7 +2714,7 @@ DEFUN (interface_no_ip_igmp_join, } /* Source address */ - source_str = argv[1]; + source_str = argv[5]->arg; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -2887,7 +2887,7 @@ DEFUN (interface_ip_igmp_query_interval, return CMD_WARNING; } - query_interval = atoi(argv[0]); + query_interval = atoi(argv[4]->arg); query_interval_dsec = 10 * query_interval; /* @@ -2981,7 +2981,7 @@ DEFUN (interface_ip_igmp_query_max_response_time, return CMD_WARNING; } - query_max_response_time = atoi(argv[0]); + query_max_response_time = atoi(argv[4]->arg); /* It seems we don't need to check bounds since command.c does it @@ -3075,7 +3075,7 @@ DEFUN (interface_ip_igmp_query_max_response_time_dsec, return CMD_WARNING; } - query_max_response_time_dsec = atoi(argv[0]); + query_max_response_time_dsec = atoi(argv[4]->arg); /* It seems we don't need to check bounds since command.c does it @@ -3166,7 +3166,7 @@ DEFUN (interface_ip_pim_drprio, old_dr_prio = pim_ifp->pim_dr_priority; - pim_ifp->pim_dr_priority = strtol(argv[0], NULL, 10); + pim_ifp->pim_dr_priority = strtol(argv[3]->arg, NULL, 10); if (old_dr_prio != pim_ifp->pim_dr_priority) { if (pim_if_dr_election(ifp)) @@ -3355,7 +3355,7 @@ DEFUN (interface_ip_mroute, iif = vty->index; - oifname = argv[0]; + oifname = argv[2]->arg; oif = if_lookup_by_name(oifname); if (!oif) { vty_out(vty, "No such interface name %s%s", @@ -3363,7 +3363,7 @@ DEFUN (interface_ip_mroute, return CMD_WARNING; } - grp_str = argv[1]; + grp_str = argv[3]->arg; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -3401,7 +3401,7 @@ DEFUN (interface_ip_mroute_source, iif = vty->index; - oifname = argv[0]; + oifname = argv[2]->arg; oif = if_lookup_by_name(oifname); if (!oif) { vty_out(vty, "No such interface name %s%s", @@ -3409,7 +3409,7 @@ DEFUN (interface_ip_mroute_source, return CMD_WARNING; } - grp_str = argv[1]; + grp_str = argv[3]->arg; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -3417,7 +3417,7 @@ DEFUN (interface_ip_mroute_source, return CMD_WARNING; } - src_str = argv[2]; + src_str = argv[4]->arg; result = inet_pton(AF_INET, src_str, &src_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -3452,7 +3452,7 @@ DEFUN (interface_no_ip_mroute, iif = vty->index; - oifname = argv[0]; + oifname = argv[3]->arg; oif = if_lookup_by_name(oifname); if (!oif) { vty_out(vty, "No such interface name %s%s", @@ -3460,7 +3460,7 @@ DEFUN (interface_no_ip_mroute, return CMD_WARNING; } - grp_str = argv[1]; + grp_str = argv[4]->arg; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -3499,7 +3499,7 @@ DEFUN (interface_no_ip_mroute_source, iif = vty->index; - oifname = argv[0]; + oifname = argv[3]->arg; oif = if_lookup_by_name(oifname); if (!oif) { vty_out(vty, "No such interface name %s%s", @@ -3507,7 +3507,7 @@ DEFUN (interface_no_ip_mroute_source, return CMD_WARNING; } - grp_str = argv[1]; + grp_str = argv[4]->arg; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -3515,7 +3515,7 @@ DEFUN (interface_no_ip_mroute_source, return CMD_WARNING; } - src_str = argv[2]; + src_str = argv[5]->arg; result = inet_pton(AF_INET, src_str, &src_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -3550,10 +3550,10 @@ DEFUN (interface_ip_pim_hello, return CMD_WARNING; } - pim_ifp->pim_hello_period = strtol(argv[0], NULL, 10); + pim_ifp->pim_hello_period = strtol(argv[3]->arg, NULL, 10); if (argc == 2) - pim_ifp->pim_default_holdtime = strtol(argv[1], NULL, 10); + pim_ifp->pim_default_holdtime = strtol(argv[4]->arg, NULL, 10); return CMD_SUCCESS; } @@ -3856,12 +3856,12 @@ DEFUN (debug_pim_packets_filter, DEBUG_PIM_HELLO_PACKETS_STR DEBUG_PIM_J_P_PACKETS_STR) { - if (strncmp(argv[0],"h",1) == 0) + if (strncmp(argv[3]->arg,"h",1) == 0) { PIM_DO_DEBUG_PIM_HELLO; vty_out (vty, "PIM Hello debugging is on %s", VTY_NEWLINE); } - else if (strncmp(argv[0],"j",1) == 0) + else if (strncmp(argv[3]->arg,"j",1) == 0) { PIM_DO_DEBUG_PIM_J_P; vty_out (vty, "PIM Join/Prune debugging is on %s", VTY_NEWLINE); @@ -3894,12 +3894,12 @@ DEFUN (no_debug_pim_packets_filter, DEBUG_PIM_HELLO_PACKETS_STR DEBUG_PIM_J_P_PACKETS_STR) { - if (strncmp(argv[0],"h",1) == 0) + if (strncmp(argv[4]->arg,"h",1) == 0) { PIM_DONT_DEBUG_PIM_HELLO; vty_out (vty, "PIM Hello debugging is off %s", VTY_NEWLINE); } - else if (strncmp(argv[0],"j",1) == 0) + else if (strncmp(argv[4]->arg,"j",1) == 0) { PIM_DONT_DEBUG_PIM_J_P; vty_out (vty, "PIM Join/Prune debugging is off %s", VTY_NEWLINE); @@ -4138,7 +4138,7 @@ DEFUN (test_igmp_receive_report, struct in_addr *src_addr; int argi; - socket = argv[0]; + socket = argv[4]->arg; socket_fd = atoi(socket); igmp = find_igmp_sock_by_fd(socket_fd); if (!igmp) { @@ -4147,7 +4147,7 @@ DEFUN (test_igmp_receive_report, return CMD_WARNING; } - grp_str = argv[1]; + grp_str = argv[5]->arg; result = inet_pton(AF_INET, grp_str, &grp_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -4155,7 +4155,7 @@ DEFUN (test_igmp_receive_report, return CMD_WARNING; } - record_type_str = argv[2]; + record_type_str = argv[6]->arg; record_type = atoi(record_type_str); /* @@ -4183,7 +4183,7 @@ DEFUN (test_igmp_receive_report, sources = (struct in_addr *) (group_record + IGMP_V3_GROUP_RECORD_SOURCE_OFFSET); src_addr = sources; for (argi = 3; argi < argc; ++argi,++src_addr) { - src_str = argv[argi]; + src_str = argv[argi]->arg; result = inet_pton(AF_INET, src_str, src_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -4243,7 +4243,7 @@ DEFUN (test_pim_receive_dump, int result; /* Find interface */ - ifname = argv[0]; + ifname = argv[4]->arg; ifp = if_lookup_by_name(ifname); if (!ifp) { vty_out(vty, "No such interface name %s%s", @@ -4252,7 +4252,7 @@ DEFUN (test_pim_receive_dump, } /* Neighbor address */ - neigh_str = argv[1]; + neigh_str = argv[5]->arg; result = inet_pton(AF_INET, neigh_str, &neigh_addr); if (result <= 0) { vty_out(vty, "Bad neighbor address %s: errno=%d: %s%s", @@ -4278,7 +4278,7 @@ DEFUN (test_pim_receive_dump, /* Scan LINE dump into buffer */ for (argi = 2; argi < argc; ++argi) { - const char *str = argv[argi]; + const char *str = argv[argi]->arg; int str_len = strlen(str); int str_last = str_len - 1; int i; @@ -4368,7 +4368,7 @@ DEFUN (test_pim_receive_hello, int result; /* Find interface */ - ifname = argv[0]; + ifname = argv[4]->arg; ifp = if_lookup_by_name(ifname); if (!ifp) { vty_out(vty, "No such interface name %s%s", @@ -4377,7 +4377,7 @@ DEFUN (test_pim_receive_hello, } /* Neighbor address */ - neigh_str = argv[1]; + neigh_str = argv[5]->arg; result = inet_pton(AF_INET, neigh_str, &neigh_addr); if (result <= 0) { vty_out(vty, "Bad neighbor address %s: errno=%d: %s%s", @@ -4385,12 +4385,12 @@ DEFUN (test_pim_receive_hello, return CMD_WARNING; } - neigh_holdtime = atoi(argv[2]); - neigh_dr_priority = atoi(argv[3]); - neigh_generation_id = atoi(argv[4]); - neigh_propagation_delay = atoi(argv[5]); - neigh_override_interval = atoi(argv[6]); - neigh_can_disable_join_suppression = atoi(argv[7]); + neigh_holdtime = atoi(argv[6]->arg); + neigh_dr_priority = atoi(argv[7]->arg); + neigh_generation_id = atoi(argv[8]->arg); + neigh_propagation_delay = atoi(argv[9]->arg); + neigh_override_interval = atoi(argv[10]->arg); + neigh_can_disable_join_suppression = atoi(argv[11]->arg); /* Tweak IP header @@ -4409,7 +4409,7 @@ DEFUN (test_pim_receive_hello, /* Scan LINE addresses */ for (argi = 8; argi < argc; ++argi) { - const char *sec_str = argv[argi]; + const char *sec_str = argv[argi]->arg; struct in_addr sec_addr; result = inet_pton(AF_INET, sec_str, &sec_addr); if (result <= 0) { @@ -4494,7 +4494,7 @@ DEFUN (test_pim_receive_assert, int result; /* Find interface */ - ifname = argv[0]; + ifname = argv[4]->arg; ifp = if_lookup_by_name(ifname); if (!ifp) { vty_out(vty, "No such interface name %s%s", @@ -4503,7 +4503,7 @@ DEFUN (test_pim_receive_assert, } /* Neighbor address */ - neigh_str = argv[1]; + neigh_str = argv[5]->arg; result = inet_pton(AF_INET, neigh_str, &neigh_addr); if (result <= 0) { vty_out(vty, "Bad neighbor address %s: errno=%d: %s%s", @@ -4512,7 +4512,7 @@ DEFUN (test_pim_receive_assert, } /* Group address */ - group_str = argv[2]; + group_str = argv[6]->arg; result = inet_pton(AF_INET, group_str, &group_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -4521,7 +4521,7 @@ DEFUN (test_pim_receive_assert, } /* Source address */ - source_str = argv[3]; + source_str = argv[7]->arg; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -4529,9 +4529,9 @@ DEFUN (test_pim_receive_assert, return CMD_WARNING; } - assert_metric_preference = atoi(argv[4]); - assert_route_metric = atoi(argv[5]); - assert_rpt_bit_flag = atoi(argv[6]); + assert_metric_preference = atoi(argv[8]->arg); + assert_route_metric = atoi(argv[9]->arg); + assert_rpt_bit_flag = atoi(argv[10]->arg); remain = buf_pastend - buf; if (remain < (int) sizeof(struct ip)) { @@ -4580,7 +4580,7 @@ DEFUN (test_pim_receive_assert, } static int recv_joinprune(struct vty *vty, - const char *argv[], + struct cmd_token **argv, int src_is_join) { uint8_t buf[1000]; @@ -4608,7 +4608,7 @@ static int recv_joinprune(struct vty *vty, uint16_t num_pruned; /* Find interface */ - ifname = argv[0]; + ifname = argv[0]->arg; ifp = if_lookup_by_name(ifname); if (!ifp) { vty_out(vty, "No such interface name %s%s", @@ -4616,10 +4616,10 @@ static int recv_joinprune(struct vty *vty, return CMD_WARNING; } - neigh_holdtime = atoi(argv[1]); + neigh_holdtime = atoi(argv[1]->arg); /* Neighbor destination address */ - neigh_dst_str = argv[2]; + neigh_dst_str = argv[2]->arg; result = inet_pton(AF_INET, neigh_dst_str, &neigh_dst_addr); if (result <= 0) { vty_out(vty, "Bad neighbor destination address %s: errno=%d: %s%s", @@ -4628,7 +4628,7 @@ static int recv_joinprune(struct vty *vty, } /* Neighbor source address */ - neigh_src_str = argv[3]; + neigh_src_str = argv[3]->arg; result = inet_pton(AF_INET, neigh_src_str, &neigh_src_addr); if (result <= 0) { vty_out(vty, "Bad neighbor source address %s: errno=%d: %s%s", @@ -4637,7 +4637,7 @@ static int recv_joinprune(struct vty *vty, } /* Multicast group address */ - group_str = argv[4]; + group_str = argv[4]->arg; result = inet_pton(AF_INET, group_str, &group_addr); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -4646,7 +4646,7 @@ static int recv_joinprune(struct vty *vty, } /* Multicast source address */ - source_str = argv[5]; + source_str = argv[5]->arg; result = inet_pton(AF_INET, source_str, &source_addr); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", @@ -4819,7 +4819,7 @@ DEFUN (test_pim_receive_upcall, const char *source_str; int result; - upcall_type = argv[0]; + upcall_type = argv[4]->arg; if (upcall_type[0] == 'n') msg.im_msgtype = IGMPMSG_NOCACHE; @@ -4833,10 +4833,10 @@ DEFUN (test_pim_receive_upcall, return CMD_WARNING; } - msg.im_vif = atoi(argv[1]); + msg.im_vif = atoi(argv[5]->arg); /* Group address */ - group_str = argv[2]; + group_str = argv[6]->arg; result = inet_pton(AF_INET, group_str, &msg.im_dst); if (result <= 0) { vty_out(vty, "Bad group address %s: errno=%d: %s%s", @@ -4845,7 +4845,7 @@ DEFUN (test_pim_receive_upcall, } /* Source address */ - source_str = argv[3]; + source_str = argv[7]->arg; result = inet_pton(AF_INET, source_str, &msg.im_src); if (result <= 0) { vty_out(vty, "Bad source address %s: errno=%d: %s%s", diff --git a/quagga_parser_to_network_docopt.py b/quagga_parser_to_network_docopt.py deleted file mode 100755 index 89a6fd7985..0000000000 --- a/quagga_parser_to_network_docopt.py +++ /dev/null @@ -1,1327 +0,0 @@ -#!/usr/bin/env python - -""" -The primary use case of this tool is to print a network-docopt compatible -docstring that covers all bgp and ospf commands in quagga. -""" - -import argparse -import logging -import os -import re -import sys -from pprint import pprint, pformat - -# All of the clear commands in bgp_clear_ignore will be covered by these clear commands: -# quagga clear bgp (|||*) -# quagga clear bgp (|||*) soft [in|out] -# quagga clear bgp prefix -bgp_clear_ignore = """ quagga clear bgp (||) - quagga clear bgp (||) in - quagga clear bgp (||) in prefix-filter - quagga clear bgp (||) out - quagga clear bgp (||) soft - quagga clear bgp (||) soft in - quagga clear bgp (||) soft out - quagga clear bgp * - quagga clear bgp * in - quagga clear bgp * in prefix-filter - quagga clear bgp * out - quagga clear bgp * soft - quagga clear bgp * soft in - quagga clear bgp * soft out - quagga clear bgp <1-4294967295> - quagga clear bgp <1-4294967295> in - quagga clear bgp <1-4294967295> in prefix-filter - quagga clear bgp <1-4294967295> out - quagga clear bgp <1-4294967295> soft - quagga clear bgp <1-4294967295> soft in - quagga clear bgp <1-4294967295> soft out - quagga clear bgp BGP_INSTANCE_CMD * - quagga clear bgp BGP_INSTANCE_CMD * soft - quagga clear bgp BGP_INSTANCE_CMD * soft in - quagga clear bgp BGP_INSTANCE_CMD * soft out - quagga clear bgp external - quagga clear bgp external in - quagga clear bgp external in prefix-filter - quagga clear bgp external out - quagga clear bgp external soft - quagga clear bgp external soft in - quagga clear bgp external soft out - quagga clear bgp ipv6 (||) - quagga clear bgp ipv6 (||) in - quagga clear bgp ipv6 (||) in prefix-filter - quagga clear bgp ipv6 (||) out - quagga clear bgp ipv6 (||) soft - quagga clear bgp ipv6 (||) soft in - quagga clear bgp ipv6 (||) soft out - quagga clear bgp ipv6 (unicast|multicast) prefix - quagga clear bgp ipv6 * - quagga clear bgp ipv6 * in - quagga clear bgp ipv6 * in prefix-filter - quagga clear bgp ipv6 * out - quagga clear bgp ipv6 * soft - quagga clear bgp ipv6 * soft in - quagga clear bgp ipv6 * soft out - quagga clear bgp ipv6 <1-4294967295> - quagga clear bgp ipv6 <1-4294967295> in - quagga clear bgp ipv6 <1-4294967295> in prefix-filter - quagga clear bgp ipv6 <1-4294967295> out - quagga clear bgp ipv6 <1-4294967295> soft - quagga clear bgp ipv6 <1-4294967295> soft in - quagga clear bgp ipv6 <1-4294967295> soft out - quagga clear bgp ipv6 external - quagga clear bgp ipv6 external WORD in - quagga clear bgp ipv6 external WORD out - quagga clear bgp ipv6 external in prefix-filter - quagga clear bgp ipv6 external soft - quagga clear bgp ipv6 external soft in - quagga clear bgp ipv6 external soft out - quagga clear bgp ipv6 peer-group WORD - quagga clear bgp ipv6 peer-group WORD in - quagga clear bgp ipv6 peer-group WORD in prefix-filter - quagga clear bgp ipv6 peer-group WORD out - quagga clear bgp ipv6 peer-group WORD soft - quagga clear bgp ipv6 peer-group WORD soft in - quagga clear bgp ipv6 peer-group WORD soft out - quagga clear bgp peer-group WORD - quagga clear bgp peer-group WORD in - quagga clear bgp peer-group WORD in prefix-filter - quagga clear bgp peer-group WORD out - quagga clear bgp peer-group WORD soft - quagga clear bgp peer-group WORD soft in - quagga clear bgp peer-group WORD soft out - quagga clear ip bgp (|) in - quagga clear ip bgp (|) in prefix-filter - quagga clear ip bgp (|) ipv4 (unicast|multicast) in - quagga clear ip bgp (|) ipv4 (unicast|multicast) in prefix-filter - quagga clear ip bgp (|) ipv4 (unicast|multicast) out - quagga clear ip bgp (|) ipv4 (unicast|multicast) soft - quagga clear ip bgp (|) ipv4 (unicast|multicast) soft in - quagga clear ip bgp (|) ipv4 (unicast|multicast) soft out - quagga clear ip bgp (|) out - quagga clear ip bgp (|) soft - quagga clear ip bgp (|) soft in - quagga clear ip bgp (|) soft out - quagga clear ip bgp (|) vpnv4 unicast in - quagga clear ip bgp (|) vpnv4 unicast out - quagga clear ip bgp (|) vpnv4 unicast soft - quagga clear ip bgp (|) vpnv4 unicast soft in - quagga clear ip bgp (|) vpnv4 unicast soft out - quagga clear ip bgp (||) - quagga clear ip bgp * - quagga clear ip bgp * in - quagga clear ip bgp * in prefix-filter - quagga clear ip bgp * ipv4 (unicast|multicast) in - quagga clear ip bgp * ipv4 (unicast|multicast) in prefix-filter - quagga clear ip bgp * ipv4 (unicast|multicast) out - quagga clear ip bgp * ipv4 (unicast|multicast) soft - quagga clear ip bgp * ipv4 (unicast|multicast) soft in - quagga clear ip bgp * ipv4 (unicast|multicast) soft out - quagga clear ip bgp * out - quagga clear ip bgp * soft - quagga clear ip bgp * soft in - quagga clear ip bgp * soft out - quagga clear ip bgp * vpnv4 unicast in - quagga clear ip bgp * vpnv4 unicast out - quagga clear ip bgp * vpnv4 unicast soft - quagga clear ip bgp * vpnv4 unicast soft in - quagga clear ip bgp * vpnv4 unicast soft out - quagga clear ip bgp <1-4294967295> - quagga clear ip bgp <1-4294967295> in - quagga clear ip bgp <1-4294967295> in prefix-filter - quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) in - quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) in prefix-filter - quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) out - quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) soft - quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) soft in - quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) soft out - quagga clear ip bgp <1-4294967295> out - quagga clear ip bgp <1-4294967295> soft - quagga clear ip bgp <1-4294967295> soft in - quagga clear ip bgp <1-4294967295> soft out - quagga clear ip bgp <1-4294967295> vpnv4 unicast in - quagga clear ip bgp <1-4294967295> vpnv4 unicast out - quagga clear ip bgp <1-4294967295> vpnv4 unicast soft - quagga clear ip bgp <1-4294967295> vpnv4 unicast soft in - quagga clear ip bgp <1-4294967295> vpnv4 unicast soft out - quagga clear ip bgp BGP_INSTANCE_CMD * - quagga clear ip bgp BGP_INSTANCE_CMD * in prefix-filter - quagga clear ip bgp BGP_INSTANCE_CMD * ipv4 (unicast|multicast) in prefix-filter - quagga clear ip bgp BGP_INSTANCE_CMD * ipv4 (unicast|multicast) soft - quagga clear ip bgp BGP_INSTANCE_CMD * ipv4 (unicast|multicast) soft in - quagga clear ip bgp BGP_INSTANCE_CMD * ipv4 (unicast|multicast) soft out - quagga clear ip bgp BGP_INSTANCE_CMD * soft - quagga clear ip bgp BGP_INSTANCE_CMD * soft in - quagga clear ip bgp BGP_INSTANCE_CMD * soft out - quagga clear ip bgp dampening - quagga clear ip bgp dampening - quagga clear ip bgp dampening - quagga clear ip bgp dampening - quagga clear ip bgp external - quagga clear ip bgp external in - quagga clear ip bgp external in prefix-filter - quagga clear ip bgp external ipv4 (unicast|multicast) in - quagga clear ip bgp external ipv4 (unicast|multicast) in prefix-filter - quagga clear ip bgp external ipv4 (unicast|multicast) out - quagga clear ip bgp external ipv4 (unicast|multicast) soft - quagga clear ip bgp external ipv4 (unicast|multicast) soft in - quagga clear ip bgp external ipv4 (unicast|multicast) soft out - quagga clear ip bgp external out - quagga clear ip bgp external soft - quagga clear ip bgp external soft in - quagga clear ip bgp external soft out - quagga clear ip bgp peer-group WORD - quagga clear ip bgp peer-group WORD in - quagga clear ip bgp peer-group WORD in prefix-filter - quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) in - quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter - quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) out - quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft - quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in - quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out - quagga clear ip bgp peer-group WORD out - quagga clear ip bgp peer-group WORD soft - quagga clear ip bgp peer-group WORD soft in - quagga clear ip bgp peer-group WORD soft out - quagga clear ip bgp prefix """.splitlines() - -# All of the debug commands in bgp_debug_ignore will be covered by these debug commands: -# quagga (add|del) debug bgp bestpath -# quagga (add|del) debug bgp keepalives (||) -# quagga (add|del) debug bgp neighbor-events (||) -# quagga (add|del) debug bgp nht -# quagga (add|del) debug bgp update-groups -# quagga (add|del) debug bgp updates prefix -# quagga (add|del) debug bgp zebra prefix -bgp_debug_ignore = """ quagga debug bgp as4 - quagga debug bgp as4 segment - quagga debug bgp bestpath (|) - quagga debug bgp keepalives - quagga debug bgp keepalives (||) - quagga debug bgp neighbor-events - quagga debug bgp neighbor-events (||) - quagga debug bgp nht - quagga debug bgp update-groups - quagga debug bgp updates - quagga debug bgp updates (in|out) - quagga debug bgp updates (in|out) (||) - quagga debug bgp updates prefix (|) - quagga debug bgp zebra - quagga debug bgp zebra prefix (|)""".splitlines() - - -bgp_show_ignore = """ quagga show bgp (ipv4) (vpnv4) statistics - quagga show bgp (ipv4|ipv6) (unicast|multicast) statistics - quagga show bgp (ipv4|ipv6) (unicast|multicast) update-groups - quagga show bgp (ipv4|ipv6) (unicast|multicast) update-groups (advertise-queue|advertised-routes|packet-queue) - quagga show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID - quagga show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue) - quagga show bgp (bestpath|multipath) [json] - quagga show bgp [json] - quagga show bgp longer-prefixes - quagga show bgp (bestpath|multipath) [json] - quagga show bgp [json] - quagga show bgp BGP_INSTANCE_CMD (ipv4) (vpnv4) statistics - quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community - quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) - quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) neighbors (||) (advertised-routes|received-routes) [json] - quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) statistics - quagga show bgp BGP_INSTANCE_CMD (bestpath|multipath) [json] - quagga show bgp BGP_INSTANCE_CMD [json] - quagga show bgp BGP_INSTANCE_CMD longer-prefixes - quagga show bgp BGP_INSTANCE_CMD (bestpath|multipath) [json] - quagga show bgp BGP_INSTANCE_CMD [json] - quagga show bgp BGP_INSTANCE_CMD [json] - quagga show bgp BGP_INSTANCE_CMD community-list (<1-500>|WORD) - quagga show bgp BGP_INSTANCE_CMD filter-list WORD - quagga show bgp BGP_INSTANCE_CMD ipv6 (unicast|multicast) summary [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 (bestpath|multipath) [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 longer-prefixes - quagga show bgp BGP_INSTANCE_CMD ipv6 (bestpath|multipath) [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 community-list (<1-500>|WORD) - quagga show bgp BGP_INSTANCE_CMD ipv6 filter-list WORD - quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) advertised-routes [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) dampened-routes [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) flap-statistics [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) prefix-counts [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) received prefix-filter [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) received-routes [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) routes [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors [json] - quagga show bgp BGP_INSTANCE_CMD ipv6 prefix-list WORD - quagga show bgp BGP_INSTANCE_CMD ipv6 route-map WORD - quagga show bgp BGP_INSTANCE_CMD ipv6 summary [json] - quagga show bgp BGP_INSTANCE_CMD neighbors (||) [json] - quagga show bgp BGP_INSTANCE_CMD neighbors (||) advertised-routes [json] - quagga show bgp BGP_INSTANCE_CMD neighbors (||) dampened-routes [json] - quagga show bgp BGP_INSTANCE_CMD neighbors (||) flap-statistics [json] - quagga show bgp BGP_INSTANCE_CMD neighbors (||) received prefix-filter [json] - quagga show bgp BGP_INSTANCE_CMD neighbors (||) received-routes [json] - quagga show bgp BGP_INSTANCE_CMD neighbors (||) routes [json] - quagga show bgp BGP_INSTANCE_CMD neighbors [json] - quagga show bgp BGP_INSTANCE_CMD prefix-list WORD - quagga show bgp BGP_INSTANCE_CMD route-map WORD - quagga show bgp BGP_INSTANCE_CMD summary [json] - quagga show bgp BGP_INSTANCE_CMD update-groups - quagga show bgp BGP_INSTANCE_CMD update-groups (advertise-queue|advertised-routes|packet-queue) - quagga show bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID - quagga show bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue) - quagga show bgp [json] - quagga show bgp community - quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) - quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show bgp community-list (<1-500>|WORD) - quagga show bgp community-list (<1-500>|WORD) exact-match - quagga show bgp filter-list WORD - quagga show bgp ipv4 (unicast|multicast) (bestpath|multipath) [json] - quagga show bgp ipv4 (unicast|multicast) [json] - quagga show bgp ipv4 (unicast|multicast) (bestpath|multipath) [json] - quagga show bgp ipv4 (unicast|multicast) [json] - quagga show bgp ipv4 (unicast|multicast) [json] - quagga show bgp ipv4 (unicast|multicast) summary [json] - quagga show bgp ipv6 (unicast|multicast) (bestpath|multipath) [json] - quagga show bgp ipv6 (unicast|multicast) [json] - quagga show bgp ipv6 (unicast|multicast) (bestpath|multipath) [json] - quagga show bgp ipv6 (unicast|multicast) [json] - quagga show bgp ipv6 (unicast|multicast) [json] - quagga show bgp ipv6 (unicast|multicast) summary [json] - quagga show bgp ipv6 (bestpath|multipath) [json] - quagga show bgp ipv6 [json] - quagga show bgp ipv6 longer-prefixes - quagga show bgp ipv6 (bestpath|multipath) [json] - quagga show bgp ipv6 [json] - quagga show bgp ipv6 [json] - quagga show bgp ipv6 community - quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) - quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show bgp ipv6 community-list (<1-500>|WORD) - quagga show bgp ipv6 community-list (<1-500>|WORD) exact-match - quagga show bgp ipv6 filter-list WORD - quagga show bgp ipv6 neighbors (||) [json] - quagga show bgp ipv6 neighbors (||) advertised-routes [json] - quagga show bgp ipv6 neighbors (||) dampened-routes [json] - quagga show bgp ipv6 neighbors (||) flap-statistics [json] - quagga show bgp ipv6 neighbors (||) prefix-counts [json] - quagga show bgp ipv6 neighbors (||) received prefix-filter [json] - quagga show bgp ipv6 neighbors (||) received-routes [json] - quagga show bgp ipv6 neighbors (||) routes [json] - quagga show bgp ipv6 neighbors [json] - quagga show bgp ipv6 prefix-list WORD - quagga show bgp ipv6 regexp LINE - quagga show bgp ipv6 route-map WORD - quagga show bgp ipv6 summary [json] - quagga show bgp memory - quagga show bgp neighbors (||) [json] - quagga show bgp neighbors (||) advertised-routes [json] - quagga show bgp neighbors (||) dampened-routes [json] - quagga show bgp neighbors (||) flap-statistics [json] - quagga show bgp neighbors (||) received prefix-filter [json] - quagga show bgp neighbors (||) received-routes [json] - quagga show bgp neighbors (||) routes [json] - quagga show bgp neighbors [json] - quagga show bgp prefix-list WORD - quagga show bgp regexp LINE - quagga show bgp route-map WORD - quagga show bgp summary [json] - quagga show bgp update-groups - quagga show bgp update-groups (advertise-queue|advertised-routes|packet-queue) - quagga show bgp update-groups SUBGROUP-ID - quagga show bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue) - quagga show bgp view WORD ipv4 (unicast|multicast) summary [json] - quagga show bgp views - quagga show bgp vrfs [json] - quagga show debugging bgp - quagga show ip as-path-access-list - quagga show ip as-path-access-list WORD - quagga show ip bgp (bestpath|multipath) [json] - quagga show ip bgp [json] - quagga show ip bgp longer-prefixes - quagga show ip bgp (bestpath|multipath) [json] - quagga show ip bgp [json] - quagga show ip bgp BGP_INSTANCE_CMD (bestpath|multipath) [json] - quagga show ip bgp BGP_INSTANCE_CMD [json] - quagga show ip bgp BGP_INSTANCE_CMD longer-prefixes - quagga show ip bgp BGP_INSTANCE_CMD (bestpath|multipath) [json] - quagga show ip bgp BGP_INSTANCE_CMD [json] - quagga show ip bgp BGP_INSTANCE_CMD [json] - quagga show ip bgp BGP_INSTANCE_CMD community-list (<1-500>|WORD) - quagga show ip bgp BGP_INSTANCE_CMD filter-list WORD - quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) [json] - quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) advertised-routes [json] - quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) advertised-routes route-map WORD [json] - quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) prefix-counts [json] - quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) received-routes [json] - quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) received-routes route-map WORD [json] - quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) routes [json] - quagga show ip bgp BGP_INSTANCE_CMD neighbors [json] - quagga show ip bgp BGP_INSTANCE_CMD nexthop - quagga show ip bgp BGP_INSTANCE_CMD nexthop detail - quagga show ip bgp BGP_INSTANCE_CMD peer-group - quagga show ip bgp BGP_INSTANCE_CMD peer-group WORD - quagga show ip bgp BGP_INSTANCE_CMD prefix-list WORD - quagga show ip bgp BGP_INSTANCE_CMD route-map WORD - quagga show ip bgp BGP_INSTANCE_CMD summary [json] - quagga show ip bgp BGP_INSTANCE_CMD update-groups - quagga show ip bgp BGP_INSTANCE_CMD update-groups (advertise-queue|advertised-routes|packet-queue) - quagga show ip bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID - quagga show ip bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue) - quagga show ip bgp [json] - quagga show ip bgp attribute-info - quagga show ip bgp cidr-only - quagga show ip bgp community - quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) - quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ip bgp community-info - quagga show ip bgp community-list (<1-500>|WORD) - quagga show ip bgp community-list (<1-500>|WORD) exact-match - quagga show ip bgp dampened-paths - quagga show ip bgp filter-list WORD - quagga show ip bgp flap-statistics - quagga show ip bgp flap-statistics - quagga show ip bgp flap-statistics longer-prefixes - quagga show ip bgp flap-statistics - quagga show ip bgp flap-statistics cidr-only - quagga show ip bgp flap-statistics filter-list WORD - quagga show ip bgp flap-statistics prefix-list WORD - quagga show ip bgp flap-statistics regexp LINE - quagga show ip bgp flap-statistics route-map WORD - quagga show ip bgp ipv4 (unicast|multicast) (bestpath|multipath) [json] - quagga show ip bgp ipv4 (unicast|multicast) [json] - quagga show ip bgp ipv4 (unicast|multicast) longer-prefixes - quagga show ip bgp ipv4 (unicast|multicast) [json] - quagga show ip bgp ipv4 (unicast|multicast) [json] - quagga show ip bgp ipv4 (unicast|multicast) cidr-only - quagga show ip bgp ipv4 (unicast|multicast) community - quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) - quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD) - quagga show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD) exact-match - quagga show ip bgp ipv4 (unicast|multicast) filter-list WORD - quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) [json] - quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) advertised-routes [json] - quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) advertised-routes route-map WORD [json] - quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) prefix-counts [json] - quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) received prefix-filter [json] - quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) received-routes [json] - quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) received-routes route-map WORD [json] - quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) routes [json] - quagga show ip bgp ipv4 (unicast|multicast) neighbors [json] - quagga show ip bgp ipv4 (unicast|multicast) paths - quagga show ip bgp ipv4 (unicast|multicast) prefix-list WORD - quagga show ip bgp ipv4 (unicast|multicast) regexp LINE - quagga show ip bgp ipv4 (unicast|multicast) route-map WORD - quagga show ip bgp ipv4 (unicast|multicast) summary [json] - quagga show ip bgp neighbors (||) [json] - quagga show ip bgp neighbors (||) advertised-routes [json] - quagga show ip bgp neighbors (||) advertised-routes route-map WORD [json] - quagga show ip bgp neighbors (||) dampened-routes [json] - quagga show ip bgp neighbors (||) flap-statistics [json] - quagga show ip bgp neighbors (||) prefix-counts [json] - quagga show ip bgp neighbors (||) received prefix-filter [json] - quagga show ip bgp neighbors (||) received-routes [json] - quagga show ip bgp neighbors (||) received-routes route-map WORD [json] - quagga show ip bgp neighbors (||) routes [json] - quagga show ip bgp neighbors [json] - quagga show ip bgp nexthop - quagga show ip bgp nexthop detail - quagga show ip bgp paths - quagga show ip bgp peer-group - quagga show ip bgp peer-group WORD - quagga show ip bgp prefix-list WORD - quagga show ip bgp regexp LINE - quagga show ip bgp route-map WORD - quagga show ip bgp summary [json] - quagga show ip bgp update-groups - quagga show ip bgp update-groups (advertise-queue|advertised-routes|packet-queue) - quagga show ip bgp update-groups SUBGROUP-ID - quagga show ip bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue) - quagga show ip bgp view WORD ipv4 (unicast|multicast) summary [json] - quagga show ip bgp vpnv4 all - quagga show ip bgp vpnv4 all [json] - quagga show ip bgp vpnv4 all [json] - quagga show ip bgp vpnv4 all neighbors (||) prefix-counts [json] - quagga show ip bgp vpnv4 all neighbors [json] - quagga show ip bgp vpnv4 all neighbors advertised-routes [json] - quagga show ip bgp vpnv4 all neighbors routes [json] - quagga show ip bgp vpnv4 all neighbors [json] - quagga show ip bgp vpnv4 all summary [json] - quagga show ip bgp vpnv4 all tags - quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn - quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn [json] - quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn [json] - quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors [json] - quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors advertised-routes [json] - quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors routes [json] - quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors [json] - quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary [json] - quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn tags - quagga show ip community-list - quagga show ip community-list (<1-500>|WORD) - quagga show ip extcommunity-list - quagga show ip extcommunity-list (<1-500>|WORD) - quagga show ipv6 bgp [json] - quagga show ipv6 bgp longer-prefixes - quagga show ipv6 bgp [json] - quagga show ipv6 bgp [json] - quagga show ipv6 bgp community - quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) - quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ipv6 bgp community-list WORD - quagga show ipv6 bgp community-list WORD exact-match - quagga show ipv6 bgp filter-list WORD - quagga show ipv6 bgp neighbors (||) advertised-routes [json] - quagga show ipv6 bgp neighbors (||) received-routes [json] - quagga show ipv6 bgp neighbors (||) routes [json] - quagga show ipv6 bgp prefix-list WORD - quagga show ipv6 bgp regexp LINE - quagga show ipv6 bgp summary [json] - quagga show ipv6 mbgp [json] - quagga show ipv6 mbgp longer-prefixes - quagga show ipv6 mbgp [json] - quagga show ipv6 mbgp [json] - quagga show ipv6 mbgp community - quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) - quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) - quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) exact-match - quagga show ipv6 mbgp community-list WORD - quagga show ipv6 mbgp community-list WORD exact-match - quagga show ipv6 mbgp filter-list WORD - quagga show ipv6 mbgp neighbors (||) advertised-routes [json] - quagga show ipv6 mbgp neighbors (||) received-routes [json] - quagga show ipv6 mbgp neighbors (||) routes [json] - quagga show ipv6 mbgp prefix-list WORD - quagga show ipv6 mbgp regexp LINE - quagga show ipv6 mbgp summary [json]""".splitlines() - -bgp_config_ignore = """ quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) activate - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) addpath-tx-all-paths - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) addpath-tx-bestpath-per-AS - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) allowas-in - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) allowas-in <1-10> - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) as-override - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged (as-path|next-hop|med) - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged as-path (next-hop|med) - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged as-path med next-hop - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged as-path next-hop med - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged med (as-path|next-hop) - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged med as-path next-hop - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged med next-hop as-path - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged next-hop (as-path|med) - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged next-hop as-path med - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged next-hop med as-path - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) capability orf prefix-list (both|send|receive) - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) default-originate - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) default-originate route-map WORD - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) distribute-list (<1-199>|<1300-2699>|WORD) (in|out) - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) filter-list WORD (in|out) - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) maximum-prefix <1-4294967295> - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) maximum-prefix <1-4294967295> <1-100> - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) maximum-prefix <1-4294967295> <1-100> restart <1-65535> - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) maximum-prefix <1-4294967295> <1-100> warning-only - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) maximum-prefix <1-4294967295> restart <1-65535> - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) maximum-prefix <1-4294967295> warning-only - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) next-hop-self - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) next-hop-self force - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) peer-group WORD - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) prefix-list WORD (in|out) - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) remove-private-AS - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) remove-private-AS all - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) remove-private-AS all replace-AS - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) remove-private-AS replace-AS - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) route-map WORD (in|out) - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) route-reflector-client - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) route-server-client - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) send-community - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) send-community (both|extended|standard) - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) soft-reconfiguration inbound - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) unsuppress-map WORD - quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] table-map WORD - quagga (add|del) bgp [ipv4|ipv6] unicast maximum-paths <1-255> - quagga (add|del) bgp [ipv4|ipv6] unicast maximum-paths ibgp <1-255> - quagga (add|del) bgp [ipv4|ipv6] unicast maximum-paths ibgp <1-255> equal-cluster-length - quagga (add|del) bgp always-compare-med - quagga (add|del) bgp bestpath as-path confed - quagga (add|del) bgp bestpath as-path ignore - quagga (add|del) bgp bestpath as-path multipath-relax [as-set|no-as-set] - quagga (add|del) bgp bestpath compare-routerid - quagga (add|del) bgp bestpath med (confed|missing-as-worst) - quagga (add|del) bgp bestpath med confed missing-as-worst - quagga (add|del) bgp bestpath med missing-as-worst confed - quagga (add|del) bgp client-to-client reflection - quagga (add|del) bgp cluster-id <1-4294967295> - quagga (add|del) bgp cluster-id - quagga (add|del) bgp confederation identifier <1-4294967295> - quagga (add|del) bgp confederation peers . <1-4294967295> - quagga (add|del) bgp default ipv4-unicast - quagga (add|del) bgp default local-preference <0-4294967295> - quagga (add|del) bgp default show-hostname - quagga (add|del) bgp default subgroup-pkt-queue-max <20-100> - quagga (add|del) bgp deterministic-med - quagga (add|del) bgp disable-ebgp-connected-route-check - quagga (add|del) bgp enforce-first-as - quagga (add|del) bgp fast-external-failover - quagga (add|del) bgp graceful-restart - quagga (add|del) bgp graceful-restart stalepath-time <1-3600> - quagga (add|del) bgp listen limit <1-5000> - quagga (add|del) bgp listen range (|) peer-group WORD - quagga (add|del) bgp log-neighbor-changes - quagga (add|del) bgp max-med administrative - quagga (add|del) bgp max-med administrative <0-4294967294> - quagga (add|del) bgp max-med on-startup <5-86400> - quagga (add|del) bgp max-med on-startup <5-86400> <0-4294967294> - quagga (add|del) bgp network import-check - quagga (add|del) bgp route-map delay-timer <0-600> - quagga (add|del) bgp route-reflector allow-outbound-policy - quagga (add|del) bgp router-id - quagga (add|del) bgp coalesce-time <0-4294967295> - quagga (add|del) bgp distance <1-255> - quagga (add|del) bgp distance <1-255> WORD - quagga (add|del) bgp distance bgp <1-255> <1-255> <1-255> - quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address - quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address as-set - quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address as-set summary-only - quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address summary-only - quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address summary-only as-set - quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address - quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address as-set - quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address as-set summary-only - quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address summary-only - quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address summary-only as-set - quagga (add|del) bgp ipv4 [unicast|multicast] network - quagga (add|del) bgp ipv4 [unicast|multicast] network route-map WORD - quagga (add|del) bgp ipv4 [unicast|multicast] network - quagga (add|del) bgp ipv4 [unicast|multicast] network prefixlen - quagga (add|del) bgp ipv4 [unicast|multicast] network prefixlen route-map WORD - quagga (add|del) bgp ipv4 [unicast|multicast] network route-map WORD - quagga (add|del) bgp ipv4 unicast bgp dampening - quagga (add|del) bgp ipv4 unicast bgp dampening <1-45> - quagga (add|del) bgp ipv4 unicast bgp dampening <1-45> <1-20000> <1-20000> <1-255> - quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis) - quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis) metric <0-4294967295> - quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis) metric <0-4294967295> route-map WORD - quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis) route-map WORD - quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis) route-map WORD metric <0-4294967295> - quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535> - quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535> metric <0-4294967295> - quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD - quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535> route-map WORD - quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295> - quagga (add|del) bgp ipv6 [unicast|multicast] network - quagga (add|del) bgp ipv6 bgp aggregate-address - quagga (add|del) bgp ipv6 bgp aggregate-address summary-only - quagga (add|del) bgp ipv6 bgp network - quagga (add|del) bgp ipv6 unicast aggregate-address - quagga (add|del) bgp ipv6 unicast aggregate-address summary-only - quagga (add|del) bgp ipv6 unicast neighbor (||) nexthop-local unchanged - quagga (add|del) bgp ipv6 unicast network route-map WORD - quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis) - quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis) metric <0-4294967295> - quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis) metric <0-4294967295> route-map WORD - quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis) route-map WORD - quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis) route-map WORD metric <0-4294967295> - quagga (add|del) bgp neighbor (|) interface WORD - quagga (add|del) bgp neighbor (|) port <0-65535> - quagga (add|del) bgp neighbor (|) strict-capability-match - quagga (add|del) bgp neighbor (||) advertisement-interval <0-600> - quagga (add|del) bgp neighbor (||) bfd - quagga (add|del) bgp neighbor (||) bfd <2-255> BFD_CMD_MIN_RX_RANGE <50-60000> - quagga (add|del) bgp neighbor (||) capability dynamic - quagga (add|del) bgp neighbor (||) capability extended-nexthop - quagga (add|del) bgp neighbor (||) description LINE - quagga (add|del) bgp neighbor (||) disable-connected-check - quagga (add|del) bgp neighbor (||) dont-capability-negotiate - quagga (add|del) bgp neighbor (||) ebgp-multihop - quagga (add|del) bgp neighbor (||) ebgp-multihop <1-255> - quagga (add|del) bgp neighbor (||) enforce-multihop - quagga (add|del) bgp neighbor (||) local-as <1-4294967295> - quagga (add|del) bgp neighbor (||) local-as <1-4294967295> no-prepend - quagga (add|del) bgp neighbor (||) local-as <1-4294967295> no-prepend replace-as - quagga (add|del) bgp neighbor (||) override-capability - quagga (add|del) bgp neighbor (||) passive - quagga (add|del) bgp neighbor (||) password LINE - quagga (add|del) bgp neighbor (||) remote-as (<1-4294967295>|external|internal) - quagga (add|del) bgp neighbor (||) shutdown - quagga (add|del) bgp neighbor (||) solo - quagga (add|del) bgp neighbor (||) timers <0-65535> <0-65535> - quagga (add|del) bgp neighbor (||) timers connect <1-65535> - quagga (add|del) bgp neighbor (||) ttl-security hops <1-254> - quagga (add|del) bgp neighbor (||) update-source (||) - quagga (add|del) bgp neighbor (||) weight <0-65535> - quagga (add|del) bgp neighbor WORD interface - quagga (add|del) bgp neighbor WORD interface peer-group WORD - quagga (add|del) bgp neighbor WORD interface v6only - quagga (add|del) bgp neighbor WORD interface v6only peer-group WORD - quagga (add|del) bgp neighbor WORD peer-group - quagga (add|del) bgp network backdoor - quagga (add|del) bgp network backdoor - quagga (add|del) bgp network prefixlen backdoor - quagga (add|del) bgp timers bgp <0-65535> <0-65535> - quagga (add|del) bgp update-delay <0-3600> - quagga (add|del) bgp update-delay <0-3600> <1-3600> - quagga (add|del) bgp write-quanta <1-10000>""".splitlines() - -ospf_clear_ignore = [" quagga clear ip ospf interface [IFNAME]", ] - -ospf_debug_ignore = """ quagga debug ospf <1-65535> event - quagga debug ospf <1-65535> ism - quagga debug ospf <1-65535> ism (status|events|timers) - quagga debug ospf <1-65535> lsa - quagga debug ospf <1-65535> lsa (generate|flooding|install|refresh) - quagga debug ospf <1-65535> nsm - quagga debug ospf <1-65535> nsm (status|events|timers) - quagga debug ospf <1-65535> nssa - quagga debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) - quagga debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|) - quagga debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail) - quagga debug ospf <1-65535> zebra - quagga debug ospf <1-65535> zebra (interface|redistribute) - quagga debug ospf event - quagga debug ospf ism - quagga debug ospf ism (status|events|timers) - quagga debug ospf lsa - quagga debug ospf lsa (generate|flooding|install|refresh) - quagga debug ospf nsm - quagga debug ospf nsm (status|events|timers) - quagga debug ospf nssa - quagga debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) - quagga debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|) - quagga debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail) - quagga debug ospf zebra - quagga debug ospf zebra (interface|redistribute)""".splitlines() - -ospf_show_ignore = """ quagga show debugging ospf - quagga show debugging ospf <1-65535> - quagga show ip ospf <1-65535> [json] - quagga show ip ospf <1-65535> border-routers - quagga show ip ospf <1-65535> database - quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) (self-originate|) - quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) - quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) (self-originate|) - quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) adv-router - quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) adv-router - quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate) - quagga show ip ospf <1-65535> interface [INTERFACE] [json] - quagga show ip ospf <1-65535> neighbor [json] - quagga show ip ospf <1-65535> neighbor IFNAME [json] - quagga show ip ospf <1-65535> neighbor IFNAME detail [json] - quagga show ip ospf <1-65535> neighbor [json] - quagga show ip ospf <1-65535> neighbor all [json] - quagga show ip ospf <1-65535> neighbor detail [json] - quagga show ip ospf <1-65535> neighbor detail all [json] - quagga show ip ospf <1-65535> route - quagga show ip ospf [json] - quagga show ip ospf border-routers - quagga show ip ospf database - quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) (self-originate|) - quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) - quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) (self-originate|) - quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) adv-router - quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) adv-router - quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate) - quagga show ip ospf interface [INTERFACE] [json] - quagga show ip ospf neighbor [json] - quagga show ip ospf neighbor IFNAME [json] - quagga show ip ospf neighbor IFNAME detail [json] - quagga show ip ospf neighbor [json] - quagga show ip ospf neighbor all [json] - quagga show ip ospf neighbor detail [json] - quagga show ip ospf neighbor detail all [json] - quagga show ip ospf route - quagga show mpls-te interface [INTERFACE] - quagga show mpls-te router""".splitlines() - -ospf_config_ignore = """ quagga (add|del) ip ospf <1-65535> area (|<0-4294967295>) - quagga (add|del) ip ospf area (|<0-4294967295>) - quagga (add|del) ip ospf authentication - quagga (add|del) ip ospf authentication (null|message-digest) - quagga (add|del) ip ospf authentication (null|message-digest) - quagga (add|del) ip ospf authentication - quagga (add|del) ip ospf authentication-key AUTH_KEY - quagga (add|del) ip ospf authentication-key AUTH_KEY - quagga (add|del) ip ospf bfd - quagga (add|del) ip ospf bfd <2-255> BFD_CMD_MIN_RX_RANGE <50-60000> - quagga (add|del) ip ospf cost <1-65535> - quagga (add|del) ip ospf cost <1-65535> - quagga (add|del) ip ospf dead-interval <1-65535> - quagga (add|del) ip ospf dead-interval <1-65535> - quagga (add|del) ip ospf dead-interval minimal hello-multiplier <1-10> - quagga (add|del) ip ospf dead-interval minimal hello-multiplier <1-10> - quagga (add|del) ip ospf hello-interval <1-65535> - quagga (add|del) ip ospf hello-interval <1-65535> - quagga (add|del) ip ospf message-digest-key <1-255> md5 KEY - quagga (add|del) ip ospf message-digest-key <1-255> md5 KEY - quagga (add|del) ip ospf mtu-ignore - quagga (add|del) ip ospf mtu-ignore - quagga (add|del) ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point) - quagga (add|del) ip ospf priority <0-255> - quagga (add|del) ip ospf priority <0-255> - quagga (add|del) ip ospf retransmit-interval <3-65535> - quagga (add|del) ip ospf retransmit-interval <3-65535> - quagga (add|del) ip ospf transmit-delay <1-65535> - quagga (add|del) ip ospf transmit-delay <1-65535> - quagga (add|del) mpls-te link max-bw BANDWIDTH - quagga (add|del) mpls-te link max-rsv-bw BANDWIDTH - quagga (add|del) mpls-te link metric <0-4294967295> - quagga (add|del) mpls-te link rsc-clsclr BITPATTERN - quagga (add|del) mpls-te link unrsv-bw <0-7> BANDWIDTH - quagga (add|del) ospf abr-type (cisco|ibm|shortcut|standard) - quagga (add|del) ospf area (|<0-4294967295>) authentication - quagga (add|del) ospf area (|<0-4294967295>) authentication message-digest - quagga (add|del) ospf area (|<0-4294967295>) default-cost <0-16777215> - quagga (add|del) ospf area (|<0-4294967295>) export-list NAME - quagga (add|del) ospf area (|<0-4294967295>) filter-list prefix WORD (in|out) - quagga (add|del) ospf area (|<0-4294967295>) import-list NAME - quagga (add|del) ospf area (|<0-4294967295>) nssa - quagga (add|del) ospf area (|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always) - quagga (add|del) ospf area (|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always) no-summary - quagga (add|del) ospf area (|<0-4294967295>) nssa no-summary - quagga (add|del) ospf area (|<0-4294967295>) range - quagga (add|del) ospf area (|<0-4294967295>) range advertise - quagga (add|del) ospf area (|<0-4294967295>) range advertise cost <0-16777215> - quagga (add|del) ospf area (|<0-4294967295>) range cost <0-16777215> - quagga (add|del) ospf area (|<0-4294967295>) range not-advertise - quagga (add|del) ospf area (|<0-4294967295>) range substitute - quagga (add|del) ospf area (|<0-4294967295>) shortcut (default|enable|disable) - quagga (add|del) ospf area (|<0-4294967295>) stub - quagga (add|del) ospf area (|<0-4294967295>) stub no-summary - quagga (add|del) ospf area (|<0-4294967295>) virtual-link - quagga (add|del) ospf area (|<0-4294967295>) virtual-link - quagga (add|del) ospf auto-cost reference-bandwidth <1-4294967> - quagga (add|del) ospf capability opaque - quagga (add|del) ospf compatible rfc1583 - quagga (add|del) ospf default-information originate - quagga (add|del) ospf default-metric <0-16777214> - quagga (add|del) ospf distance <1-255> - quagga (add|del) ospf distance <1-255> - quagga (add|del) ospf distance <1-255> WORD - quagga (add|del) ospf distance ospf - quagga (add|del) ospf distribute-list WORD out QUAGGA_REDIST_STR_OSPFD - quagga (add|del) ospf log-adjacency-changes - quagga (add|del) ospf log-adjacency-changes detail - quagga (add|del) ospf max-metric router-lsa administrative - quagga (add|del) ospf max-metric router-lsa on-shutdown <5-100> - quagga (add|del) ospf max-metric router-lsa on-startup <5-86400> - quagga (add|del) ospf mpls-te - quagga (add|del) ospf mpls-te on - quagga (add|del) ospf mpls-te router-address - quagga (add|del) ospf neighbor - quagga (add|del) ospf neighbor poll-interval <1-65535> - quagga (add|del) ospf neighbor poll-interval <1-65535> priority <0-255> - quagga (add|del) ospf neighbor priority <0-255> - quagga (add|del) ospf neighbor priority <0-255> poll-interval <1-65535> - quagga (add|del) ospf network area (|<0-4294967295>) - quagga (add|del) ospf opaque-lsa - quagga (add|del) ospf passive-interface IFNAME - quagga (add|del) ospf passive-interface IFNAME - quagga (add|del) ospf passive-interface default - quagga (add|del) ospf redistribute (ospf|table) <1-65535> - quagga (add|del) ospf redistribute QUAGGA_REDIST_STR_OSPFD - quagga (add|del) ospf rfc1583compatibility - quagga (add|del) ospf router-id - quagga (add|del) ospf timers lsa arrival <0-1000> - quagga (add|del) ospf timers lsa min-arrival <0-600000> - quagga (add|del) ospf timers throttle lsa all <0-5000> - quagga (add|del) ospf timers throttle spf <0-600000> <0-600000> <0-600000> - quagga (add|del) ospf write-multiplier <1-100> - quagga (add|del) ospf write-multiplier <1-100>""".splitlines() - -def replace_constants(line): - line = line.replace('NO_NEIGHBOR_CMD2', 'no neighbor (A.B.C.D|X:X::X:X|WORD) ') - line = line.replace('NEIGHBOR_CMD2', 'neighbor (A.B.C.D|X:X::X:X|WORD) ') - line = line.replace('NO_NEIGHBOR_CMD', 'no neighbor (A.B.C.D|X:X::X:X) ') - line = line.replace('NEIGHBOR_CMD', 'neighbor (A.B.C.D|X:X::X:X) ') - line = line.replace('CMD_AS_RANGE', '<1-4294967295>') - line = line.replace('LISTEN_RANGE_CMD', 'bgp listen range (A.B.C.D/M|X:X::X:X/M) ') - line = line.replace('DYNAMIC_NEIGHBOR_LIMIT_RANGE', '<1-5000>') - line = line.replace('QUAGGA_IP_REDIST_STR_BGPD', '(kernel|connected|static|rip|ospf|isis)') - line = line.replace('QUAGGA_IP6_REDIST_STR_BGPD', '(kernel|connected|static|ripng|ospf6|isis)') - line = line.replace('QUAGGA_IP6_REDIST_STR_ZEBRA', '(kernel|connected|static|ripng|ospf6|isis|bgp)') - line = line.replace('QUAGGA_IP_REDIST_STR_ZEBRA', '(kernel|connected|static|rip|ospf|isis|bgp)') - line = line.replace('OSPF_LSA_TYPES_CMD_STR', 'asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as') - line = line.replace('CMD_RANGE_STR(1, MULTIPATH_NUM)', '<1-255>') - line = line.replace('CMD_RANGE_STR(1, MAXTTL)', '<1-255>') - line = line.replace('BFD_CMD_DETECT_MULT_RANGE', '<2-255>') - line = line.replace('BFD_CMD_MIN_TX_RANGE', '<50-60000>') - line = line.replace('BGP_UPDATE_SOURCE_REQ_STR', '(A.B.C.D|X:X::X:X|WORD)') - line = line.replace('BGP_UPDATE_SOURCE_OPT_STR', '{A.B.C.D|X:X::X:X|WORD}') - line = line.replace('.LINE', 'LINE') - line = line.replace('.AA:NN', 'AA:NN') - # line = line.replace('', '') - return line - - -ignore = {} -ignore['bgpd'] = [] -ignore['bgpd'].append('address-family ipv4') -ignore['bgpd'].append('address-family ipv4 (unicast|multicast)') -ignore['bgpd'].append('address-family ipv6') -ignore['bgpd'].append('address-family ipv6 (unicast|multicast)') -ignore['bgpd'].append('address-family vpnv4') -ignore['bgpd'].append('address-family vpnv4 unicast') -ignore['bgpd'].append('exit-address-family') - -ignore['ospfd'] = [] - - -class Command(object): - - def __init__(self, defun, text, line_number): - self.defun = defun - self.text = text - self.line_number = line_number - self.context = [] - self.docstring = None - - def __str__(self): - return "%s - %s" % (self.context, self.text) - - def set_docstring(self): - ds = self.text - - if self.text in ignore['bgpd']: - return None - - # For these two WORD means an interface name - ds = ds.replace('A.B.C.D|X:X::X:X|WORD', '||') - ds = ds.replace('A.B.C.D|WORD', '|') - - ds = ds.replace('A.B.C.D/M', '') - ds = ds.replace('A.B.C.D', '') - ds = ds.replace('X:X::X:X/M', '') - ds = ds.replace('X:X::X:X', '') - ds = ds.replace('{json}', '[json]') - ds = ds.replace('{', '[') - ds = ds.replace('}', ']') - ds = ds.replace(' PATH ', ' ') - - afis = [] - safis = [] - - if 'BGP_IPV4_NODE' in self.context: - afis.append('ipv4') - safis.append('unicast') - - if 'BGP_IPV4M_NODE' in self.context: - afis.append('ipv4') - safis.append('multicast') - - if 'BGP_IPV6_NODE' in self.context: - afis.append('ipv6') - safis.append('unicast') - - if 'BGP_IPV6M_NODE' in self.context: - afis.append('ipv6') - safis.append('multicast') - - afis = list(set(afis)) - safis = list(set(safis)) - - # clear, debug, show, etc - if 'ENABLE_NODE' in self.context: - pass - - # config command so need to add (add|del) and maybe afi/safi - else: - if afis: - if len(afis) > 1: - afi_string = "[%s]" % '|'.join(afis) - else: - afi_string = afis[0] - - if len(safis) > 1: - safi_string = "[%s]" % '|'.join(safis) - else: - safi_string = safis[0] - - ds = "(add|del) bgp %s %s " % (afi_string, safi_string) + ds - - elif 'BGP_NODE' in self.context: - if ds.startswith('bgp'): - ds = "(add|del) " + ds - else: - ds = "(add|del) bgp " + ds - - elif 'INTERFACE_NODE' in self.context: - ds = "(add|del) " + ds - - elif 'OSPF_NODE' in self.context: - if ds.startswith('ospf'): - ds = "(add|del) " + ds - else: - ds = "(add|del) ospf " + ds - - # Ignore the route-map commands, ip community-list, etc for now - else: - ds = None - - if ds: - ds = ds.rstrip() - self.docstring = ' quagga ' + ds - - -if __name__ == '__main__': - - parser = argparse.ArgumentParser(description='Parse the quagga parser') - parser.add_argument('directory', help='quagga directory') - parser.add_argument('daemon', help='bgpd, ospfd, etc') - parser.add_argument('--print-quagga', action='store_true', help='print the raw quagga commands') - parser.add_argument('--print-docstring', action='store_true', help='print a docstring for network-docopt') - parser.add_argument('--print-context', action='store_true', help='print quagga commands with their context') - args = parser.parse_args() - - logging.basicConfig(level=logging.INFO, - format='%(asctime)s %(levelname)7s: %(message)s') - log = logging.getLogger(__name__) - - # Color the errors and warnings in red - logging.addLevelName(logging.ERROR, "\033[91m %s\033[0m" % logging.getLevelName(logging.ERROR)) - logging.addLevelName(logging.WARNING, "\033[91m%s\033[0m" % logging.getLevelName(logging.WARNING)) - - bgpd = os.path.join(args.directory, 'bgpd') - isisd = os.path.join(args.directory, 'isisd') - ospfd = os.path.join(args.directory, 'ospfd') - ospf6d = os.path.join(args.directory, 'ospf6d') - ripd = os.path.join(args.directory, 'ripd') - ripngd = os.path.join(args.directory, 'ripngd') - zebra = os.path.join(args.directory, 'zebra') - parser_files = [] - - for (directory, foo, files) in sorted(os.walk(args.directory)): - - # We do not care about crunching files in these directories - if (directory.endswith('vtysh') or - directory.endswith('quagga-0.99.23.1/') or - directory.endswith('lib') or - directory.endswith('isisd') or - directory.endswith('ripd') or - directory.endswith('ripngd') or - directory.endswith('m4') or - directory.endswith('tests')): - continue - - if args.daemon not in directory: - continue - - for x in sorted(files): - if x.endswith('.c'): - filename = os.path.join(directory, x) - parser_files.append(filename) - - commands = {} - defun_to_context = {} - - for filename in parser_files: - - with open(filename, 'r') as fh: - state = 'LIMBO' - line_number = 1 - - for line in fh.readlines(): - - if state == 'LIMBO': - if (line.startswith('DEFUN ') or line.startswith('ALIAS ')): - state = 'DEFUN_LINE_1' - - elif 'install_element' in line: - # install_element (BGP_NODE, &neighbor_bfd_cmd); - re_line = re.search('install_element\s*\(\s*(\S+)\s*, \&(\S+)\)', line) - - if re_line: - context = re_line.group(1) - defun = re_line.group(2) - - if defun not in defun_to_context: - defun_to_context[defun] = [] - defun_to_context[defun].append(context) - else: - log.warning("regex failed on '%s'" % line.strip()) - - elif state == 'DEFUN_LINE_1': - state = 'DEFUN_LINE_2' - # remove spaces and trailing comma - defun = line.strip()[0:-1] - - elif state == 'DEFUN_LINE_2': - if 'ifdef HAVE_IPV6' in line: - pass - else: - state = 'LIMBO' - - # remove the leading and trailing spaces - # remove the leading and trailing " - # remove the trailing , - line = line.strip() - line = replace_constants(line) - - if line.endswith(','): - line = line.rstrip().lstrip()[:-1] - - if line.startswith('"'): - line = line.rstrip().lstrip()[1:] - - if line.endswith('"'): - line = line.rstrip().lstrip()[:-1] - - line = line.replace(' " ', ' ') - line = line.replace(' "', ' ') - line = line.replace('" ', ' ') - line = line.replace('( ', '(') - line = line.replace(' )', ')') - - line = line.replace('| ', '|') - line = line.replace(' |', '|') - - # compress multiple whitespaces - while ' ' in line: - line = line.replace(' ', ' ') - - commands[line] = Command(defun, line, line_number) - defun = None - line_number += 1 - - # Fill in the context for each Command based on its defun - for cmd in commands.itervalues(): - cmd.context = defun_to_context.get(cmd.defun) - if cmd.context is None: - log.error("%s: could not find defun for %s" % (cmd, cmd.defun)) - continue - cmd.set_docstring() - - normal = [] - expert = [] - - if args.print_docstring: - if args.daemon == 'bgpd': - normal.append(' quagga show bgp [ipv4|ipv6] [unicast|multicast] summary [json]') - normal.append(' quagga show bgp [ipv4|ipv6] [unicast|multicast] [|] [bestpath|multipath] [json]') - normal.append(' quagga show bgp neighbor [|]') - normal.append(' quagga clear bgp (||*)') - normal.append(' quagga clear bgp (||*) soft [in|out]') - normal.append(' quagga clear bgp prefix ') - normal.append(' quagga (add|del) debug bgp bestpath ') - normal.append(' quagga (add|del) debug bgp keepalives ()') - normal.append(' quagga (add|del) debug bgp neighbor-events (|)') - expert.append(' quagga (add|del) debug bgp nht') - expert.append(' quagga (add|del) debug bgp update-groups') - normal.append(' quagga (add|del) debug bgp updates prefix ') - normal.append(' quagga (add|del) debug bgp zebra prefix ') - - bgp_bgp = ['always-compare-med', - 'bestpath', - 'client-to-client reflection', - 'cluster-id', - 'confederation peers', - 'default ipv4-unicast', - 'default local-preference', - 'default show-hostname', - 'default subgroup-pkt-queue-max', - 'deterministic-med', - 'disable-ebgp-connected-route-check', - 'enforce-first-as', - 'fast-external-failover', - 'graceful-restart', - 'listen', - 'log-neighbor-changes', - 'max-med', - 'network import-check', - 'route-map delay-timer', - 'route-reflector allow-outbound-policy', - 'router-id'] - - # ====== - # global - # ====== - normal.append(' quagga (add|del) bgp always-compare-med') - expert.append(' quagga (add|del) bgp bestpath as-path (confed|ignore)') - normal.append(' quagga (add|del) bgp bestpath as-path multipath-relax [as-set|no-as-set]') - expert.append(' quagga (add|del) bgp bestpath med (confed|missing-as-worst)') - expert.append(' quagga (add|del) bgp client-to-client reflection') - expert.append(' quagga (add|del) bgp cluster-id (|<1-4294967295>)') - expert.append(' quagga (add|del) bgp confederation peers <1-4294967295>') - expert.append(' quagga (add|del) bgp default ipv4-unicast') - expert.append(' quagga (add|del) bgp default local-preference <0-4294967295>') - expert.append(' quagga (add|del) bgp default show-hostname') - expert.append(' quagga (add|del) bgp default subgroup-pkt-queue-max <20-100>') - expert.append(' quagga (add|del) bgp deterministic-med') - expert.append(' quagga (add|del) bgp disable-ebgp-connected-route-check') - expert.append(' quagga (add|del) bgp enforce-first-as') - expert.append(' quagga (add|del) bgp fast-external-failover') - expert.append(' quagga (add|del) bgp graceful-restart') - expert.append(' quagga (add|del) bgp listen limit <1-5000>') - expert.append(' quagga (add|del) bgp listen range (|) peer-group ') - expert.append(' quagga (add|del) bgp log-neighbor-changes') - expert.append(' quagga (add|del) bgp max-med administrative <0-4294967294>') - expert.append(' quagga (add|del) bgp max-med on-startup <5-86400> [<0-4294967294>]') - expert.append(' quagga (add|del) bgp network import-check') - expert.append(' quagga (add|del) bgp route-map delay-timer <0-600>') - expert.append(' quagga (add|del) bgp route-reflector allow-outbound-policy') - normal.append(' quagga (add|del) bgp router-id ') - expert.append(' quagga (add|del) bgp coalesce-time <0-4294967295>') - expert.append(' quagga (add|del) bgp distance <1-255> ') - expert.append(' quagga (add|del) bgp distance bgp <1-255> <1-255> <1-255>') - expert.append(' quagga (add|del) bgp timers bgp <0-65535> <0-65535>') - expert.append(' quagga (add|del) bgp update-delay <0-3600> [<1-3600>]') - expert.append(' quagga (add|del) bgp write-quanta <1-10000>') - - # ==================== - # peer global afi/safi - # ==================== - normal.append(' quagga (add|del) bgp neighbor interface') - normal.append(' quagga (add|del) bgp neighbor interface peer-group ') - expert.append(' quagga (add|del) bgp neighbor interface v6only') - expert.append(' quagga (add|del) bgp neighbor interface v6only peer-group ') - normal.append(' quagga (add|del) bgp neighbor peer-group') - expert.append(' quagga (add|del) bgp neighbor (|) advertisement-interval <0-600>') - expert.append(' quagga (add|del) bgp neighbor (|) bfd') - expert.append(' quagga (add|del) bgp neighbor (|) capability dynamic') - normal.append(' quagga (add|del) bgp neighbor (|) capability extended-nexthop') - normal.append(' quagga (add|del) bgp neighbor (|) description ') - expert.append(' quagga (add|del) bgp neighbor (|) disable-connected-check') - expert.append(' quagga (add|del) bgp neighbor (|) dont-capability-negotiate') - normal.append(' quagga (add|del) bgp neighbor (|) ebgp-multihop [<1-255>]') - expert.append(' quagga (add|del) bgp neighbor (|) enforce-multihop') - expert.append(' quagga (add|del) bgp neighbor (|) local-as <1-4294967295> [no-prepend] [replace-as]') - expert.append(' quagga (add|del) bgp neighbor (|) override-capability') - expert.append(' quagga (add|del) bgp neighbor (|) passive') - normal.append(' quagga (add|del) bgp neighbor (|) password ') - expert.append(' quagga (add|del) bgp neighbor (|) port <0-65535>') - normal.append(' quagga (add|del) bgp neighbor (|) remote-as (<1-4294967295>|external|internal)') - normal.append(' quagga (add|del) bgp neighbor (|) shutdown') - expert.append(' quagga (add|del) bgp neighbor (|) solo') - expert.append(' quagga (add|del) bgp neighbor (|) strict-capability-match') - normal.append(' quagga (add|del) bgp neighbor (|) timers <0-65535> <0-65535>') - normal.append(' quagga (add|del) bgp neighbor (|) timers connect <1-65535>') - expert.append(' quagga (add|del) bgp neighbor (|) ttl-security hops <1-254>') - normal.append(' quagga (add|del) bgp neighbor (|) update-source (||)') - expert.append(' quagga (add|del) bgp neighbor (|) weight <0-65535>') - - # ================= - # peer per afi/safi - # ================= - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) addpath-tx-all-paths') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) addpath-tx-bestpath-per-AS') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) allowas-in [<1-10>]') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) as-override') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) attribute-unchanged [as-path] [next-hop] [med]') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) capability orf prefix-list (both|send|receive)') - normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) default-originate [route-map ]') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) distribute-list (<1-199>|<1300-2699>|) (in|out)') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) filter-list (in|out)') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) maximum-prefix <1-4294967295>') - normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) next-hop-self [force]') - normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) peer-group ') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) prefix-list (in|out)') - normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) remove-private-AS [all] [replace-AS]') - normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) route-map (in|out)') - normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) route-reflector-client') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) route-server-client') - normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) send-community [both|extended|standard]') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) soft-reconfiguration inbound') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) unsuppress-map ') - expert.append(' quagga (add|del) bgp ipv6 unicast neighbor (|) nexthop-local unchanged') - - # ============ - # per afi/safi - # ============ - normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] maximum-paths [ibgp] <1-255> [equal-cluster-length]') - normal.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] aggregate-address [as-set] [summary-only]') - normal.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] network (|)') - expert.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] network (|) route-map ') - expert.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] bgp dampening <1-45> <1-20000> <1-20000> <1-255>') - normal.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] redistribute (kernel|connected|static|rip|ospf|isis) [metric <0-4294967295>] [route-map ]') - expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] table-map ') - - if args.daemon == 'ospfd': - normal.append(' quagga clear ip ospf interface []') - normal.append(' quagga (add|del) debug ospf [<1-65535>] ism [status|events|timers]') - normal.append(' quagga (add|del) debug ospf [<1-65535>] lsa [generate|flooding|install|refresh]') - normal.append(' quagga (add|del) debug ospf [<1-65535>] nsm [status|events|timers]') - expert.append(' quagga (add|del) debug ospf [<1-65535>] nssa') - normal.append(' quagga (add|del) debug ospf [<1-65535>] packet [hello|dd|ls-request|ls-update|ls-ack|all] [send|recv|detail]') - normal.append(' quagga (add|del) debug ospf [<1-65535>] zebra [interface|redistribute]') - normal.append(' quagga show ip ospf [<1-65535>]') - expert.append(' quagga show ip ospf [<1-65535>] border-routers') - expert.append(' quagga show ip ospf [<1-65535>] database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate) [self-originate]') - expert.append(' quagga show ip ospf [<1-65535>] database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate) adv-router ') - normal.append(' quagga show ip ospf [<1-65535>] interface [] [json]') - normal.append(' quagga show ip ospf [<1-65535>] neighbor (all||) [detail] [json]') - normal.append(' quagga show ip ospf [<1-65535>] route') - - normal.append(' quagga (add|del) ip ospf [<1-65535>] area (|<0-4294967295>)') - normal.append(' quagga (add|del) ip ospf dead-interval <1-65535>') - normal.append(' quagga (add|del) ip ospf hello-interval <1-65535>') - normal.append(' quagga (add|del) ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)') - normal.append(' quagga (add|del) ospf network area (|<0-4294967295>)') - normal.append(' quagga (add|del) ospf passive-interface IFNAME') - normal.append(' quagga (add|del) ospf router-id ') - normal.append(' quagga (add|del) ospf timers throttle spf <0-600000> <0-600000> <0-600000>') - - - - ignore_list = bgp_clear_ignore + bgp_debug_ignore + bgp_show_ignore + bgp_config_ignore - ignore_list += ospf_clear_ignore + ospf_debug_ignore + ospf_show_ignore + ospf_config_ignore - - for cmd in commands.itervalues(): - if not cmd.text.startswith('no ') and cmd.context: - if cmd.docstring: - if cmd.docstring not in ignore_list: - normal.append(cmd.docstring) - - elif args.print_quagga: - for cmd in commands.itervalues(): - if not cmd.text.startswith('no ') and cmd.context: - normal.append(cmd.text) - - elif args.print_context: - for cmd in commands.itervalues(): - if not cmd.text.startswith('no ') and cmd.context: - normal.append("%s - %s" % (cmd.context, cmd.text)) - else: - raise Exception("No print option specified") - - normal = sorted(normal) - print '\n'.join(map(str, normal)) diff --git a/tools/argv_translator.py b/tools/argv_translator.py index 0263b8ba9e..ba37664250 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -225,6 +225,10 @@ def update_argvs(filename): line = line.replace('" QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA,', ' (kernel|connected|static|ripng|ospf6|isis|bgp|table|any)",') line = line.replace('" QUAGGA_REDIST_STR_RIPNGD,', ' (kernel|connected|static|ospf6|isis|bgp|table)",') line = line.replace('" QUAGGA_REDIST_STR_RIPD,', ' (kernel|connected|static|ospf|isis|bgp|pim|table)",') + line = line.replace('" PIM_CMD_IP_MULTICAST_ROUTING,', ' ip multicast-routing",') + line = line.replace('" PIM_CMD_IP_IGMP_QUERY_INTERVAL,', ' ip igmp query-interval",') + line = line.replace('" PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC,', ' ip igmp query-max-response-time-dsec",') + line = line.replace('" PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME,', ' ip igmp query-max-response-time",') # startswith line = line.replace('LISTEN_RANGE_CMD "', '"bgp listen range (A.B.C.D/M|X:X::X:X/M) ') @@ -232,12 +236,17 @@ def update_argvs(filename): line = line.replace('NEIGHBOR_CMD2 "', '"neighbor (A.B.C.D|X:X::X:X|WORD) ') line = line.replace('NO_NEIGHBOR_CMD "', '"no neighbor (A.B.C.D|X:X::X:X) ') line = line.replace('NEIGHBOR_CMD "', '"neighbor (A.B.C.D|X:X::X:X) ') + line = line.replace('PIM_CMD_NO "', '"no ') + line = line.replace('PIM_CMD_IP_IGMP_QUERY_INTERVAL "', '"ip igmp query-interval ') + line = line.replace('PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME "', '"ip igmp query-max-response-time ') + line = line.replace('PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC "', '"ip igmp query-max-response-time-dsec ') # solo line = line.replace('NO_NEIGHBOR_CMD2,', '"no neighbor (A.B.C.D|X:X::X:X|WORD)",') line = line.replace('NEIGHBOR_CMD2,', '"neighbor (A.B.C.D|X:X::X:X|WORD)",') line = line.replace('NO_NEIGHBOR_CMD,', '"no neighbor (A.B.C.D|X:X::X:X)",') line = line.replace('NEIGHBOR_CMD,', '"neighbor (A.B.C.D|X:X::X:X)",') + line = line.replace('PIM_CMD_IP_MULTICAST_ROUTING,', '"ip multicast-routing",') if line.rstrip().endswith('" ,'): line = line.replace('" ,', '",') diff --git a/tools/quagga_parser_to_network_docopt.py b/tools/quagga_parser_to_network_docopt.py new file mode 100755 index 0000000000..89a6fd7985 --- /dev/null +++ b/tools/quagga_parser_to_network_docopt.py @@ -0,0 +1,1327 @@ +#!/usr/bin/env python + +""" +The primary use case of this tool is to print a network-docopt compatible +docstring that covers all bgp and ospf commands in quagga. +""" + +import argparse +import logging +import os +import re +import sys +from pprint import pprint, pformat + +# All of the clear commands in bgp_clear_ignore will be covered by these clear commands: +# quagga clear bgp (|||*) +# quagga clear bgp (|||*) soft [in|out] +# quagga clear bgp prefix +bgp_clear_ignore = """ quagga clear bgp (||) + quagga clear bgp (||) in + quagga clear bgp (||) in prefix-filter + quagga clear bgp (||) out + quagga clear bgp (||) soft + quagga clear bgp (||) soft in + quagga clear bgp (||) soft out + quagga clear bgp * + quagga clear bgp * in + quagga clear bgp * in prefix-filter + quagga clear bgp * out + quagga clear bgp * soft + quagga clear bgp * soft in + quagga clear bgp * soft out + quagga clear bgp <1-4294967295> + quagga clear bgp <1-4294967295> in + quagga clear bgp <1-4294967295> in prefix-filter + quagga clear bgp <1-4294967295> out + quagga clear bgp <1-4294967295> soft + quagga clear bgp <1-4294967295> soft in + quagga clear bgp <1-4294967295> soft out + quagga clear bgp BGP_INSTANCE_CMD * + quagga clear bgp BGP_INSTANCE_CMD * soft + quagga clear bgp BGP_INSTANCE_CMD * soft in + quagga clear bgp BGP_INSTANCE_CMD * soft out + quagga clear bgp external + quagga clear bgp external in + quagga clear bgp external in prefix-filter + quagga clear bgp external out + quagga clear bgp external soft + quagga clear bgp external soft in + quagga clear bgp external soft out + quagga clear bgp ipv6 (||) + quagga clear bgp ipv6 (||) in + quagga clear bgp ipv6 (||) in prefix-filter + quagga clear bgp ipv6 (||) out + quagga clear bgp ipv6 (||) soft + quagga clear bgp ipv6 (||) soft in + quagga clear bgp ipv6 (||) soft out + quagga clear bgp ipv6 (unicast|multicast) prefix + quagga clear bgp ipv6 * + quagga clear bgp ipv6 * in + quagga clear bgp ipv6 * in prefix-filter + quagga clear bgp ipv6 * out + quagga clear bgp ipv6 * soft + quagga clear bgp ipv6 * soft in + quagga clear bgp ipv6 * soft out + quagga clear bgp ipv6 <1-4294967295> + quagga clear bgp ipv6 <1-4294967295> in + quagga clear bgp ipv6 <1-4294967295> in prefix-filter + quagga clear bgp ipv6 <1-4294967295> out + quagga clear bgp ipv6 <1-4294967295> soft + quagga clear bgp ipv6 <1-4294967295> soft in + quagga clear bgp ipv6 <1-4294967295> soft out + quagga clear bgp ipv6 external + quagga clear bgp ipv6 external WORD in + quagga clear bgp ipv6 external WORD out + quagga clear bgp ipv6 external in prefix-filter + quagga clear bgp ipv6 external soft + quagga clear bgp ipv6 external soft in + quagga clear bgp ipv6 external soft out + quagga clear bgp ipv6 peer-group WORD + quagga clear bgp ipv6 peer-group WORD in + quagga clear bgp ipv6 peer-group WORD in prefix-filter + quagga clear bgp ipv6 peer-group WORD out + quagga clear bgp ipv6 peer-group WORD soft + quagga clear bgp ipv6 peer-group WORD soft in + quagga clear bgp ipv6 peer-group WORD soft out + quagga clear bgp peer-group WORD + quagga clear bgp peer-group WORD in + quagga clear bgp peer-group WORD in prefix-filter + quagga clear bgp peer-group WORD out + quagga clear bgp peer-group WORD soft + quagga clear bgp peer-group WORD soft in + quagga clear bgp peer-group WORD soft out + quagga clear ip bgp (|) in + quagga clear ip bgp (|) in prefix-filter + quagga clear ip bgp (|) ipv4 (unicast|multicast) in + quagga clear ip bgp (|) ipv4 (unicast|multicast) in prefix-filter + quagga clear ip bgp (|) ipv4 (unicast|multicast) out + quagga clear ip bgp (|) ipv4 (unicast|multicast) soft + quagga clear ip bgp (|) ipv4 (unicast|multicast) soft in + quagga clear ip bgp (|) ipv4 (unicast|multicast) soft out + quagga clear ip bgp (|) out + quagga clear ip bgp (|) soft + quagga clear ip bgp (|) soft in + quagga clear ip bgp (|) soft out + quagga clear ip bgp (|) vpnv4 unicast in + quagga clear ip bgp (|) vpnv4 unicast out + quagga clear ip bgp (|) vpnv4 unicast soft + quagga clear ip bgp (|) vpnv4 unicast soft in + quagga clear ip bgp (|) vpnv4 unicast soft out + quagga clear ip bgp (||) + quagga clear ip bgp * + quagga clear ip bgp * in + quagga clear ip bgp * in prefix-filter + quagga clear ip bgp * ipv4 (unicast|multicast) in + quagga clear ip bgp * ipv4 (unicast|multicast) in prefix-filter + quagga clear ip bgp * ipv4 (unicast|multicast) out + quagga clear ip bgp * ipv4 (unicast|multicast) soft + quagga clear ip bgp * ipv4 (unicast|multicast) soft in + quagga clear ip bgp * ipv4 (unicast|multicast) soft out + quagga clear ip bgp * out + quagga clear ip bgp * soft + quagga clear ip bgp * soft in + quagga clear ip bgp * soft out + quagga clear ip bgp * vpnv4 unicast in + quagga clear ip bgp * vpnv4 unicast out + quagga clear ip bgp * vpnv4 unicast soft + quagga clear ip bgp * vpnv4 unicast soft in + quagga clear ip bgp * vpnv4 unicast soft out + quagga clear ip bgp <1-4294967295> + quagga clear ip bgp <1-4294967295> in + quagga clear ip bgp <1-4294967295> in prefix-filter + quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) in + quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) in prefix-filter + quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) out + quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) soft + quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) soft in + quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) soft out + quagga clear ip bgp <1-4294967295> out + quagga clear ip bgp <1-4294967295> soft + quagga clear ip bgp <1-4294967295> soft in + quagga clear ip bgp <1-4294967295> soft out + quagga clear ip bgp <1-4294967295> vpnv4 unicast in + quagga clear ip bgp <1-4294967295> vpnv4 unicast out + quagga clear ip bgp <1-4294967295> vpnv4 unicast soft + quagga clear ip bgp <1-4294967295> vpnv4 unicast soft in + quagga clear ip bgp <1-4294967295> vpnv4 unicast soft out + quagga clear ip bgp BGP_INSTANCE_CMD * + quagga clear ip bgp BGP_INSTANCE_CMD * in prefix-filter + quagga clear ip bgp BGP_INSTANCE_CMD * ipv4 (unicast|multicast) in prefix-filter + quagga clear ip bgp BGP_INSTANCE_CMD * ipv4 (unicast|multicast) soft + quagga clear ip bgp BGP_INSTANCE_CMD * ipv4 (unicast|multicast) soft in + quagga clear ip bgp BGP_INSTANCE_CMD * ipv4 (unicast|multicast) soft out + quagga clear ip bgp BGP_INSTANCE_CMD * soft + quagga clear ip bgp BGP_INSTANCE_CMD * soft in + quagga clear ip bgp BGP_INSTANCE_CMD * soft out + quagga clear ip bgp dampening + quagga clear ip bgp dampening + quagga clear ip bgp dampening + quagga clear ip bgp dampening + quagga clear ip bgp external + quagga clear ip bgp external in + quagga clear ip bgp external in prefix-filter + quagga clear ip bgp external ipv4 (unicast|multicast) in + quagga clear ip bgp external ipv4 (unicast|multicast) in prefix-filter + quagga clear ip bgp external ipv4 (unicast|multicast) out + quagga clear ip bgp external ipv4 (unicast|multicast) soft + quagga clear ip bgp external ipv4 (unicast|multicast) soft in + quagga clear ip bgp external ipv4 (unicast|multicast) soft out + quagga clear ip bgp external out + quagga clear ip bgp external soft + quagga clear ip bgp external soft in + quagga clear ip bgp external soft out + quagga clear ip bgp peer-group WORD + quagga clear ip bgp peer-group WORD in + quagga clear ip bgp peer-group WORD in prefix-filter + quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) in + quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter + quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) out + quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft + quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in + quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out + quagga clear ip bgp peer-group WORD out + quagga clear ip bgp peer-group WORD soft + quagga clear ip bgp peer-group WORD soft in + quagga clear ip bgp peer-group WORD soft out + quagga clear ip bgp prefix """.splitlines() + +# All of the debug commands in bgp_debug_ignore will be covered by these debug commands: +# quagga (add|del) debug bgp bestpath +# quagga (add|del) debug bgp keepalives (||) +# quagga (add|del) debug bgp neighbor-events (||) +# quagga (add|del) debug bgp nht +# quagga (add|del) debug bgp update-groups +# quagga (add|del) debug bgp updates prefix +# quagga (add|del) debug bgp zebra prefix +bgp_debug_ignore = """ quagga debug bgp as4 + quagga debug bgp as4 segment + quagga debug bgp bestpath (|) + quagga debug bgp keepalives + quagga debug bgp keepalives (||) + quagga debug bgp neighbor-events + quagga debug bgp neighbor-events (||) + quagga debug bgp nht + quagga debug bgp update-groups + quagga debug bgp updates + quagga debug bgp updates (in|out) + quagga debug bgp updates (in|out) (||) + quagga debug bgp updates prefix (|) + quagga debug bgp zebra + quagga debug bgp zebra prefix (|)""".splitlines() + + +bgp_show_ignore = """ quagga show bgp (ipv4) (vpnv4) statistics + quagga show bgp (ipv4|ipv6) (unicast|multicast) statistics + quagga show bgp (ipv4|ipv6) (unicast|multicast) update-groups + quagga show bgp (ipv4|ipv6) (unicast|multicast) update-groups (advertise-queue|advertised-routes|packet-queue) + quagga show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID + quagga show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue) + quagga show bgp (bestpath|multipath) [json] + quagga show bgp [json] + quagga show bgp longer-prefixes + quagga show bgp (bestpath|multipath) [json] + quagga show bgp [json] + quagga show bgp BGP_INSTANCE_CMD (ipv4) (vpnv4) statistics + quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community + quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) + quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) neighbors (||) (advertised-routes|received-routes) [json] + quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) statistics + quagga show bgp BGP_INSTANCE_CMD (bestpath|multipath) [json] + quagga show bgp BGP_INSTANCE_CMD [json] + quagga show bgp BGP_INSTANCE_CMD longer-prefixes + quagga show bgp BGP_INSTANCE_CMD (bestpath|multipath) [json] + quagga show bgp BGP_INSTANCE_CMD [json] + quagga show bgp BGP_INSTANCE_CMD [json] + quagga show bgp BGP_INSTANCE_CMD community-list (<1-500>|WORD) + quagga show bgp BGP_INSTANCE_CMD filter-list WORD + quagga show bgp BGP_INSTANCE_CMD ipv6 (unicast|multicast) summary [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 (bestpath|multipath) [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 longer-prefixes + quagga show bgp BGP_INSTANCE_CMD ipv6 (bestpath|multipath) [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 community-list (<1-500>|WORD) + quagga show bgp BGP_INSTANCE_CMD ipv6 filter-list WORD + quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) advertised-routes [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) dampened-routes [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) flap-statistics [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) prefix-counts [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) received prefix-filter [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) received-routes [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (||) routes [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors [json] + quagga show bgp BGP_INSTANCE_CMD ipv6 prefix-list WORD + quagga show bgp BGP_INSTANCE_CMD ipv6 route-map WORD + quagga show bgp BGP_INSTANCE_CMD ipv6 summary [json] + quagga show bgp BGP_INSTANCE_CMD neighbors (||) [json] + quagga show bgp BGP_INSTANCE_CMD neighbors (||) advertised-routes [json] + quagga show bgp BGP_INSTANCE_CMD neighbors (||) dampened-routes [json] + quagga show bgp BGP_INSTANCE_CMD neighbors (||) flap-statistics [json] + quagga show bgp BGP_INSTANCE_CMD neighbors (||) received prefix-filter [json] + quagga show bgp BGP_INSTANCE_CMD neighbors (||) received-routes [json] + quagga show bgp BGP_INSTANCE_CMD neighbors (||) routes [json] + quagga show bgp BGP_INSTANCE_CMD neighbors [json] + quagga show bgp BGP_INSTANCE_CMD prefix-list WORD + quagga show bgp BGP_INSTANCE_CMD route-map WORD + quagga show bgp BGP_INSTANCE_CMD summary [json] + quagga show bgp BGP_INSTANCE_CMD update-groups + quagga show bgp BGP_INSTANCE_CMD update-groups (advertise-queue|advertised-routes|packet-queue) + quagga show bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID + quagga show bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue) + quagga show bgp [json] + quagga show bgp community + quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) + quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show bgp community-list (<1-500>|WORD) + quagga show bgp community-list (<1-500>|WORD) exact-match + quagga show bgp filter-list WORD + quagga show bgp ipv4 (unicast|multicast) (bestpath|multipath) [json] + quagga show bgp ipv4 (unicast|multicast) [json] + quagga show bgp ipv4 (unicast|multicast) (bestpath|multipath) [json] + quagga show bgp ipv4 (unicast|multicast) [json] + quagga show bgp ipv4 (unicast|multicast) [json] + quagga show bgp ipv4 (unicast|multicast) summary [json] + quagga show bgp ipv6 (unicast|multicast) (bestpath|multipath) [json] + quagga show bgp ipv6 (unicast|multicast) [json] + quagga show bgp ipv6 (unicast|multicast) (bestpath|multipath) [json] + quagga show bgp ipv6 (unicast|multicast) [json] + quagga show bgp ipv6 (unicast|multicast) [json] + quagga show bgp ipv6 (unicast|multicast) summary [json] + quagga show bgp ipv6 (bestpath|multipath) [json] + quagga show bgp ipv6 [json] + quagga show bgp ipv6 longer-prefixes + quagga show bgp ipv6 (bestpath|multipath) [json] + quagga show bgp ipv6 [json] + quagga show bgp ipv6 [json] + quagga show bgp ipv6 community + quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) + quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show bgp ipv6 community-list (<1-500>|WORD) + quagga show bgp ipv6 community-list (<1-500>|WORD) exact-match + quagga show bgp ipv6 filter-list WORD + quagga show bgp ipv6 neighbors (||) [json] + quagga show bgp ipv6 neighbors (||) advertised-routes [json] + quagga show bgp ipv6 neighbors (||) dampened-routes [json] + quagga show bgp ipv6 neighbors (||) flap-statistics [json] + quagga show bgp ipv6 neighbors (||) prefix-counts [json] + quagga show bgp ipv6 neighbors (||) received prefix-filter [json] + quagga show bgp ipv6 neighbors (||) received-routes [json] + quagga show bgp ipv6 neighbors (||) routes [json] + quagga show bgp ipv6 neighbors [json] + quagga show bgp ipv6 prefix-list WORD + quagga show bgp ipv6 regexp LINE + quagga show bgp ipv6 route-map WORD + quagga show bgp ipv6 summary [json] + quagga show bgp memory + quagga show bgp neighbors (||) [json] + quagga show bgp neighbors (||) advertised-routes [json] + quagga show bgp neighbors (||) dampened-routes [json] + quagga show bgp neighbors (||) flap-statistics [json] + quagga show bgp neighbors (||) received prefix-filter [json] + quagga show bgp neighbors (||) received-routes [json] + quagga show bgp neighbors (||) routes [json] + quagga show bgp neighbors [json] + quagga show bgp prefix-list WORD + quagga show bgp regexp LINE + quagga show bgp route-map WORD + quagga show bgp summary [json] + quagga show bgp update-groups + quagga show bgp update-groups (advertise-queue|advertised-routes|packet-queue) + quagga show bgp update-groups SUBGROUP-ID + quagga show bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue) + quagga show bgp view WORD ipv4 (unicast|multicast) summary [json] + quagga show bgp views + quagga show bgp vrfs [json] + quagga show debugging bgp + quagga show ip as-path-access-list + quagga show ip as-path-access-list WORD + quagga show ip bgp (bestpath|multipath) [json] + quagga show ip bgp [json] + quagga show ip bgp longer-prefixes + quagga show ip bgp (bestpath|multipath) [json] + quagga show ip bgp [json] + quagga show ip bgp BGP_INSTANCE_CMD (bestpath|multipath) [json] + quagga show ip bgp BGP_INSTANCE_CMD [json] + quagga show ip bgp BGP_INSTANCE_CMD longer-prefixes + quagga show ip bgp BGP_INSTANCE_CMD (bestpath|multipath) [json] + quagga show ip bgp BGP_INSTANCE_CMD [json] + quagga show ip bgp BGP_INSTANCE_CMD [json] + quagga show ip bgp BGP_INSTANCE_CMD community-list (<1-500>|WORD) + quagga show ip bgp BGP_INSTANCE_CMD filter-list WORD + quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) [json] + quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) advertised-routes [json] + quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) advertised-routes route-map WORD [json] + quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) prefix-counts [json] + quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) received-routes [json] + quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) received-routes route-map WORD [json] + quagga show ip bgp BGP_INSTANCE_CMD neighbors (||) routes [json] + quagga show ip bgp BGP_INSTANCE_CMD neighbors [json] + quagga show ip bgp BGP_INSTANCE_CMD nexthop + quagga show ip bgp BGP_INSTANCE_CMD nexthop detail + quagga show ip bgp BGP_INSTANCE_CMD peer-group + quagga show ip bgp BGP_INSTANCE_CMD peer-group WORD + quagga show ip bgp BGP_INSTANCE_CMD prefix-list WORD + quagga show ip bgp BGP_INSTANCE_CMD route-map WORD + quagga show ip bgp BGP_INSTANCE_CMD summary [json] + quagga show ip bgp BGP_INSTANCE_CMD update-groups + quagga show ip bgp BGP_INSTANCE_CMD update-groups (advertise-queue|advertised-routes|packet-queue) + quagga show ip bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID + quagga show ip bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue) + quagga show ip bgp [json] + quagga show ip bgp attribute-info + quagga show ip bgp cidr-only + quagga show ip bgp community + quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) + quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ip bgp community-info + quagga show ip bgp community-list (<1-500>|WORD) + quagga show ip bgp community-list (<1-500>|WORD) exact-match + quagga show ip bgp dampened-paths + quagga show ip bgp filter-list WORD + quagga show ip bgp flap-statistics + quagga show ip bgp flap-statistics + quagga show ip bgp flap-statistics longer-prefixes + quagga show ip bgp flap-statistics + quagga show ip bgp flap-statistics cidr-only + quagga show ip bgp flap-statistics filter-list WORD + quagga show ip bgp flap-statistics prefix-list WORD + quagga show ip bgp flap-statistics regexp LINE + quagga show ip bgp flap-statistics route-map WORD + quagga show ip bgp ipv4 (unicast|multicast) (bestpath|multipath) [json] + quagga show ip bgp ipv4 (unicast|multicast) [json] + quagga show ip bgp ipv4 (unicast|multicast) longer-prefixes + quagga show ip bgp ipv4 (unicast|multicast) [json] + quagga show ip bgp ipv4 (unicast|multicast) [json] + quagga show ip bgp ipv4 (unicast|multicast) cidr-only + quagga show ip bgp ipv4 (unicast|multicast) community + quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) + quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD) + quagga show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD) exact-match + quagga show ip bgp ipv4 (unicast|multicast) filter-list WORD + quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) [json] + quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) advertised-routes [json] + quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) advertised-routes route-map WORD [json] + quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) prefix-counts [json] + quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) received prefix-filter [json] + quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) received-routes [json] + quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) received-routes route-map WORD [json] + quagga show ip bgp ipv4 (unicast|multicast) neighbors (||) routes [json] + quagga show ip bgp ipv4 (unicast|multicast) neighbors [json] + quagga show ip bgp ipv4 (unicast|multicast) paths + quagga show ip bgp ipv4 (unicast|multicast) prefix-list WORD + quagga show ip bgp ipv4 (unicast|multicast) regexp LINE + quagga show ip bgp ipv4 (unicast|multicast) route-map WORD + quagga show ip bgp ipv4 (unicast|multicast) summary [json] + quagga show ip bgp neighbors (||) [json] + quagga show ip bgp neighbors (||) advertised-routes [json] + quagga show ip bgp neighbors (||) advertised-routes route-map WORD [json] + quagga show ip bgp neighbors (||) dampened-routes [json] + quagga show ip bgp neighbors (||) flap-statistics [json] + quagga show ip bgp neighbors (||) prefix-counts [json] + quagga show ip bgp neighbors (||) received prefix-filter [json] + quagga show ip bgp neighbors (||) received-routes [json] + quagga show ip bgp neighbors (||) received-routes route-map WORD [json] + quagga show ip bgp neighbors (||) routes [json] + quagga show ip bgp neighbors [json] + quagga show ip bgp nexthop + quagga show ip bgp nexthop detail + quagga show ip bgp paths + quagga show ip bgp peer-group + quagga show ip bgp peer-group WORD + quagga show ip bgp prefix-list WORD + quagga show ip bgp regexp LINE + quagga show ip bgp route-map WORD + quagga show ip bgp summary [json] + quagga show ip bgp update-groups + quagga show ip bgp update-groups (advertise-queue|advertised-routes|packet-queue) + quagga show ip bgp update-groups SUBGROUP-ID + quagga show ip bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue) + quagga show ip bgp view WORD ipv4 (unicast|multicast) summary [json] + quagga show ip bgp vpnv4 all + quagga show ip bgp vpnv4 all [json] + quagga show ip bgp vpnv4 all [json] + quagga show ip bgp vpnv4 all neighbors (||) prefix-counts [json] + quagga show ip bgp vpnv4 all neighbors [json] + quagga show ip bgp vpnv4 all neighbors advertised-routes [json] + quagga show ip bgp vpnv4 all neighbors routes [json] + quagga show ip bgp vpnv4 all neighbors [json] + quagga show ip bgp vpnv4 all summary [json] + quagga show ip bgp vpnv4 all tags + quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn + quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn [json] + quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn [json] + quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors [json] + quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors advertised-routes [json] + quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors routes [json] + quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors [json] + quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary [json] + quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn tags + quagga show ip community-list + quagga show ip community-list (<1-500>|WORD) + quagga show ip extcommunity-list + quagga show ip extcommunity-list (<1-500>|WORD) + quagga show ipv6 bgp [json] + quagga show ipv6 bgp longer-prefixes + quagga show ipv6 bgp [json] + quagga show ipv6 bgp [json] + quagga show ipv6 bgp community + quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) + quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ipv6 bgp community-list WORD + quagga show ipv6 bgp community-list WORD exact-match + quagga show ipv6 bgp filter-list WORD + quagga show ipv6 bgp neighbors (||) advertised-routes [json] + quagga show ipv6 bgp neighbors (||) received-routes [json] + quagga show ipv6 bgp neighbors (||) routes [json] + quagga show ipv6 bgp prefix-list WORD + quagga show ipv6 bgp regexp LINE + quagga show ipv6 bgp summary [json] + quagga show ipv6 mbgp [json] + quagga show ipv6 mbgp longer-prefixes + quagga show ipv6 mbgp [json] + quagga show ipv6 mbgp [json] + quagga show ipv6 mbgp community + quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) + quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) + quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) exact-match + quagga show ipv6 mbgp community-list WORD + quagga show ipv6 mbgp community-list WORD exact-match + quagga show ipv6 mbgp filter-list WORD + quagga show ipv6 mbgp neighbors (||) advertised-routes [json] + quagga show ipv6 mbgp neighbors (||) received-routes [json] + quagga show ipv6 mbgp neighbors (||) routes [json] + quagga show ipv6 mbgp prefix-list WORD + quagga show ipv6 mbgp regexp LINE + quagga show ipv6 mbgp summary [json]""".splitlines() + +bgp_config_ignore = """ quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) activate + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) addpath-tx-all-paths + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) addpath-tx-bestpath-per-AS + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) allowas-in + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) allowas-in <1-10> + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) as-override + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged (as-path|next-hop|med) + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged as-path (next-hop|med) + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged as-path med next-hop + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged as-path next-hop med + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged med (as-path|next-hop) + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged med as-path next-hop + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged med next-hop as-path + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged next-hop (as-path|med) + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged next-hop as-path med + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) attribute-unchanged next-hop med as-path + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) capability orf prefix-list (both|send|receive) + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) default-originate + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) default-originate route-map WORD + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) distribute-list (<1-199>|<1300-2699>|WORD) (in|out) + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) filter-list WORD (in|out) + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) maximum-prefix <1-4294967295> + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) maximum-prefix <1-4294967295> <1-100> + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) maximum-prefix <1-4294967295> <1-100> restart <1-65535> + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) maximum-prefix <1-4294967295> <1-100> warning-only + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) maximum-prefix <1-4294967295> restart <1-65535> + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) maximum-prefix <1-4294967295> warning-only + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) next-hop-self + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) next-hop-self force + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) peer-group WORD + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) prefix-list WORD (in|out) + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) remove-private-AS + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) remove-private-AS all + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) remove-private-AS all replace-AS + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) remove-private-AS replace-AS + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) route-map WORD (in|out) + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) route-reflector-client + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) route-server-client + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) send-community + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) send-community (both|extended|standard) + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) soft-reconfiguration inbound + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (||) unsuppress-map WORD + quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] table-map WORD + quagga (add|del) bgp [ipv4|ipv6] unicast maximum-paths <1-255> + quagga (add|del) bgp [ipv4|ipv6] unicast maximum-paths ibgp <1-255> + quagga (add|del) bgp [ipv4|ipv6] unicast maximum-paths ibgp <1-255> equal-cluster-length + quagga (add|del) bgp always-compare-med + quagga (add|del) bgp bestpath as-path confed + quagga (add|del) bgp bestpath as-path ignore + quagga (add|del) bgp bestpath as-path multipath-relax [as-set|no-as-set] + quagga (add|del) bgp bestpath compare-routerid + quagga (add|del) bgp bestpath med (confed|missing-as-worst) + quagga (add|del) bgp bestpath med confed missing-as-worst + quagga (add|del) bgp bestpath med missing-as-worst confed + quagga (add|del) bgp client-to-client reflection + quagga (add|del) bgp cluster-id <1-4294967295> + quagga (add|del) bgp cluster-id + quagga (add|del) bgp confederation identifier <1-4294967295> + quagga (add|del) bgp confederation peers . <1-4294967295> + quagga (add|del) bgp default ipv4-unicast + quagga (add|del) bgp default local-preference <0-4294967295> + quagga (add|del) bgp default show-hostname + quagga (add|del) bgp default subgroup-pkt-queue-max <20-100> + quagga (add|del) bgp deterministic-med + quagga (add|del) bgp disable-ebgp-connected-route-check + quagga (add|del) bgp enforce-first-as + quagga (add|del) bgp fast-external-failover + quagga (add|del) bgp graceful-restart + quagga (add|del) bgp graceful-restart stalepath-time <1-3600> + quagga (add|del) bgp listen limit <1-5000> + quagga (add|del) bgp listen range (|) peer-group WORD + quagga (add|del) bgp log-neighbor-changes + quagga (add|del) bgp max-med administrative + quagga (add|del) bgp max-med administrative <0-4294967294> + quagga (add|del) bgp max-med on-startup <5-86400> + quagga (add|del) bgp max-med on-startup <5-86400> <0-4294967294> + quagga (add|del) bgp network import-check + quagga (add|del) bgp route-map delay-timer <0-600> + quagga (add|del) bgp route-reflector allow-outbound-policy + quagga (add|del) bgp router-id + quagga (add|del) bgp coalesce-time <0-4294967295> + quagga (add|del) bgp distance <1-255> + quagga (add|del) bgp distance <1-255> WORD + quagga (add|del) bgp distance bgp <1-255> <1-255> <1-255> + quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address + quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address as-set + quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address as-set summary-only + quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address summary-only + quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address summary-only as-set + quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address + quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address as-set + quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address as-set summary-only + quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address summary-only + quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address summary-only as-set + quagga (add|del) bgp ipv4 [unicast|multicast] network + quagga (add|del) bgp ipv4 [unicast|multicast] network route-map WORD + quagga (add|del) bgp ipv4 [unicast|multicast] network + quagga (add|del) bgp ipv4 [unicast|multicast] network prefixlen + quagga (add|del) bgp ipv4 [unicast|multicast] network prefixlen route-map WORD + quagga (add|del) bgp ipv4 [unicast|multicast] network route-map WORD + quagga (add|del) bgp ipv4 unicast bgp dampening + quagga (add|del) bgp ipv4 unicast bgp dampening <1-45> + quagga (add|del) bgp ipv4 unicast bgp dampening <1-45> <1-20000> <1-20000> <1-255> + quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis) + quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis) metric <0-4294967295> + quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis) metric <0-4294967295> route-map WORD + quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis) route-map WORD + quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis) route-map WORD metric <0-4294967295> + quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535> + quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535> metric <0-4294967295> + quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD + quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535> route-map WORD + quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295> + quagga (add|del) bgp ipv6 [unicast|multicast] network + quagga (add|del) bgp ipv6 bgp aggregate-address + quagga (add|del) bgp ipv6 bgp aggregate-address summary-only + quagga (add|del) bgp ipv6 bgp network + quagga (add|del) bgp ipv6 unicast aggregate-address + quagga (add|del) bgp ipv6 unicast aggregate-address summary-only + quagga (add|del) bgp ipv6 unicast neighbor (||) nexthop-local unchanged + quagga (add|del) bgp ipv6 unicast network route-map WORD + quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis) + quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis) metric <0-4294967295> + quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis) metric <0-4294967295> route-map WORD + quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis) route-map WORD + quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis) route-map WORD metric <0-4294967295> + quagga (add|del) bgp neighbor (|) interface WORD + quagga (add|del) bgp neighbor (|) port <0-65535> + quagga (add|del) bgp neighbor (|) strict-capability-match + quagga (add|del) bgp neighbor (||) advertisement-interval <0-600> + quagga (add|del) bgp neighbor (||) bfd + quagga (add|del) bgp neighbor (||) bfd <2-255> BFD_CMD_MIN_RX_RANGE <50-60000> + quagga (add|del) bgp neighbor (||) capability dynamic + quagga (add|del) bgp neighbor (||) capability extended-nexthop + quagga (add|del) bgp neighbor (||) description LINE + quagga (add|del) bgp neighbor (||) disable-connected-check + quagga (add|del) bgp neighbor (||) dont-capability-negotiate + quagga (add|del) bgp neighbor (||) ebgp-multihop + quagga (add|del) bgp neighbor (||) ebgp-multihop <1-255> + quagga (add|del) bgp neighbor (||) enforce-multihop + quagga (add|del) bgp neighbor (||) local-as <1-4294967295> + quagga (add|del) bgp neighbor (||) local-as <1-4294967295> no-prepend + quagga (add|del) bgp neighbor (||) local-as <1-4294967295> no-prepend replace-as + quagga (add|del) bgp neighbor (||) override-capability + quagga (add|del) bgp neighbor (||) passive + quagga (add|del) bgp neighbor (||) password LINE + quagga (add|del) bgp neighbor (||) remote-as (<1-4294967295>|external|internal) + quagga (add|del) bgp neighbor (||) shutdown + quagga (add|del) bgp neighbor (||) solo + quagga (add|del) bgp neighbor (||) timers <0-65535> <0-65535> + quagga (add|del) bgp neighbor (||) timers connect <1-65535> + quagga (add|del) bgp neighbor (||) ttl-security hops <1-254> + quagga (add|del) bgp neighbor (||) update-source (||) + quagga (add|del) bgp neighbor (||) weight <0-65535> + quagga (add|del) bgp neighbor WORD interface + quagga (add|del) bgp neighbor WORD interface peer-group WORD + quagga (add|del) bgp neighbor WORD interface v6only + quagga (add|del) bgp neighbor WORD interface v6only peer-group WORD + quagga (add|del) bgp neighbor WORD peer-group + quagga (add|del) bgp network backdoor + quagga (add|del) bgp network backdoor + quagga (add|del) bgp network prefixlen backdoor + quagga (add|del) bgp timers bgp <0-65535> <0-65535> + quagga (add|del) bgp update-delay <0-3600> + quagga (add|del) bgp update-delay <0-3600> <1-3600> + quagga (add|del) bgp write-quanta <1-10000>""".splitlines() + +ospf_clear_ignore = [" quagga clear ip ospf interface [IFNAME]", ] + +ospf_debug_ignore = """ quagga debug ospf <1-65535> event + quagga debug ospf <1-65535> ism + quagga debug ospf <1-65535> ism (status|events|timers) + quagga debug ospf <1-65535> lsa + quagga debug ospf <1-65535> lsa (generate|flooding|install|refresh) + quagga debug ospf <1-65535> nsm + quagga debug ospf <1-65535> nsm (status|events|timers) + quagga debug ospf <1-65535> nssa + quagga debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) + quagga debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|) + quagga debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail) + quagga debug ospf <1-65535> zebra + quagga debug ospf <1-65535> zebra (interface|redistribute) + quagga debug ospf event + quagga debug ospf ism + quagga debug ospf ism (status|events|timers) + quagga debug ospf lsa + quagga debug ospf lsa (generate|flooding|install|refresh) + quagga debug ospf nsm + quagga debug ospf nsm (status|events|timers) + quagga debug ospf nssa + quagga debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) + quagga debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|) + quagga debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail) + quagga debug ospf zebra + quagga debug ospf zebra (interface|redistribute)""".splitlines() + +ospf_show_ignore = """ quagga show debugging ospf + quagga show debugging ospf <1-65535> + quagga show ip ospf <1-65535> [json] + quagga show ip ospf <1-65535> border-routers + quagga show ip ospf <1-65535> database + quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) (self-originate|) + quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) + quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) (self-originate|) + quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) adv-router + quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) adv-router + quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate) + quagga show ip ospf <1-65535> interface [INTERFACE] [json] + quagga show ip ospf <1-65535> neighbor [json] + quagga show ip ospf <1-65535> neighbor IFNAME [json] + quagga show ip ospf <1-65535> neighbor IFNAME detail [json] + quagga show ip ospf <1-65535> neighbor [json] + quagga show ip ospf <1-65535> neighbor all [json] + quagga show ip ospf <1-65535> neighbor detail [json] + quagga show ip ospf <1-65535> neighbor detail all [json] + quagga show ip ospf <1-65535> route + quagga show ip ospf [json] + quagga show ip ospf border-routers + quagga show ip ospf database + quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) (self-originate|) + quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) + quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) (self-originate|) + quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) adv-router + quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) adv-router + quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate) + quagga show ip ospf interface [INTERFACE] [json] + quagga show ip ospf neighbor [json] + quagga show ip ospf neighbor IFNAME [json] + quagga show ip ospf neighbor IFNAME detail [json] + quagga show ip ospf neighbor [json] + quagga show ip ospf neighbor all [json] + quagga show ip ospf neighbor detail [json] + quagga show ip ospf neighbor detail all [json] + quagga show ip ospf route + quagga show mpls-te interface [INTERFACE] + quagga show mpls-te router""".splitlines() + +ospf_config_ignore = """ quagga (add|del) ip ospf <1-65535> area (|<0-4294967295>) + quagga (add|del) ip ospf area (|<0-4294967295>) + quagga (add|del) ip ospf authentication + quagga (add|del) ip ospf authentication (null|message-digest) + quagga (add|del) ip ospf authentication (null|message-digest) + quagga (add|del) ip ospf authentication + quagga (add|del) ip ospf authentication-key AUTH_KEY + quagga (add|del) ip ospf authentication-key AUTH_KEY + quagga (add|del) ip ospf bfd + quagga (add|del) ip ospf bfd <2-255> BFD_CMD_MIN_RX_RANGE <50-60000> + quagga (add|del) ip ospf cost <1-65535> + quagga (add|del) ip ospf cost <1-65535> + quagga (add|del) ip ospf dead-interval <1-65535> + quagga (add|del) ip ospf dead-interval <1-65535> + quagga (add|del) ip ospf dead-interval minimal hello-multiplier <1-10> + quagga (add|del) ip ospf dead-interval minimal hello-multiplier <1-10> + quagga (add|del) ip ospf hello-interval <1-65535> + quagga (add|del) ip ospf hello-interval <1-65535> + quagga (add|del) ip ospf message-digest-key <1-255> md5 KEY + quagga (add|del) ip ospf message-digest-key <1-255> md5 KEY + quagga (add|del) ip ospf mtu-ignore + quagga (add|del) ip ospf mtu-ignore + quagga (add|del) ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point) + quagga (add|del) ip ospf priority <0-255> + quagga (add|del) ip ospf priority <0-255> + quagga (add|del) ip ospf retransmit-interval <3-65535> + quagga (add|del) ip ospf retransmit-interval <3-65535> + quagga (add|del) ip ospf transmit-delay <1-65535> + quagga (add|del) ip ospf transmit-delay <1-65535> + quagga (add|del) mpls-te link max-bw BANDWIDTH + quagga (add|del) mpls-te link max-rsv-bw BANDWIDTH + quagga (add|del) mpls-te link metric <0-4294967295> + quagga (add|del) mpls-te link rsc-clsclr BITPATTERN + quagga (add|del) mpls-te link unrsv-bw <0-7> BANDWIDTH + quagga (add|del) ospf abr-type (cisco|ibm|shortcut|standard) + quagga (add|del) ospf area (|<0-4294967295>) authentication + quagga (add|del) ospf area (|<0-4294967295>) authentication message-digest + quagga (add|del) ospf area (|<0-4294967295>) default-cost <0-16777215> + quagga (add|del) ospf area (|<0-4294967295>) export-list NAME + quagga (add|del) ospf area (|<0-4294967295>) filter-list prefix WORD (in|out) + quagga (add|del) ospf area (|<0-4294967295>) import-list NAME + quagga (add|del) ospf area (|<0-4294967295>) nssa + quagga (add|del) ospf area (|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always) + quagga (add|del) ospf area (|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always) no-summary + quagga (add|del) ospf area (|<0-4294967295>) nssa no-summary + quagga (add|del) ospf area (|<0-4294967295>) range + quagga (add|del) ospf area (|<0-4294967295>) range advertise + quagga (add|del) ospf area (|<0-4294967295>) range advertise cost <0-16777215> + quagga (add|del) ospf area (|<0-4294967295>) range cost <0-16777215> + quagga (add|del) ospf area (|<0-4294967295>) range not-advertise + quagga (add|del) ospf area (|<0-4294967295>) range substitute + quagga (add|del) ospf area (|<0-4294967295>) shortcut (default|enable|disable) + quagga (add|del) ospf area (|<0-4294967295>) stub + quagga (add|del) ospf area (|<0-4294967295>) stub no-summary + quagga (add|del) ospf area (|<0-4294967295>) virtual-link + quagga (add|del) ospf area (|<0-4294967295>) virtual-link + quagga (add|del) ospf auto-cost reference-bandwidth <1-4294967> + quagga (add|del) ospf capability opaque + quagga (add|del) ospf compatible rfc1583 + quagga (add|del) ospf default-information originate + quagga (add|del) ospf default-metric <0-16777214> + quagga (add|del) ospf distance <1-255> + quagga (add|del) ospf distance <1-255> + quagga (add|del) ospf distance <1-255> WORD + quagga (add|del) ospf distance ospf + quagga (add|del) ospf distribute-list WORD out QUAGGA_REDIST_STR_OSPFD + quagga (add|del) ospf log-adjacency-changes + quagga (add|del) ospf log-adjacency-changes detail + quagga (add|del) ospf max-metric router-lsa administrative + quagga (add|del) ospf max-metric router-lsa on-shutdown <5-100> + quagga (add|del) ospf max-metric router-lsa on-startup <5-86400> + quagga (add|del) ospf mpls-te + quagga (add|del) ospf mpls-te on + quagga (add|del) ospf mpls-te router-address + quagga (add|del) ospf neighbor + quagga (add|del) ospf neighbor poll-interval <1-65535> + quagga (add|del) ospf neighbor poll-interval <1-65535> priority <0-255> + quagga (add|del) ospf neighbor priority <0-255> + quagga (add|del) ospf neighbor priority <0-255> poll-interval <1-65535> + quagga (add|del) ospf network area (|<0-4294967295>) + quagga (add|del) ospf opaque-lsa + quagga (add|del) ospf passive-interface IFNAME + quagga (add|del) ospf passive-interface IFNAME + quagga (add|del) ospf passive-interface default + quagga (add|del) ospf redistribute (ospf|table) <1-65535> + quagga (add|del) ospf redistribute QUAGGA_REDIST_STR_OSPFD + quagga (add|del) ospf rfc1583compatibility + quagga (add|del) ospf router-id + quagga (add|del) ospf timers lsa arrival <0-1000> + quagga (add|del) ospf timers lsa min-arrival <0-600000> + quagga (add|del) ospf timers throttle lsa all <0-5000> + quagga (add|del) ospf timers throttle spf <0-600000> <0-600000> <0-600000> + quagga (add|del) ospf write-multiplier <1-100> + quagga (add|del) ospf write-multiplier <1-100>""".splitlines() + +def replace_constants(line): + line = line.replace('NO_NEIGHBOR_CMD2', 'no neighbor (A.B.C.D|X:X::X:X|WORD) ') + line = line.replace('NEIGHBOR_CMD2', 'neighbor (A.B.C.D|X:X::X:X|WORD) ') + line = line.replace('NO_NEIGHBOR_CMD', 'no neighbor (A.B.C.D|X:X::X:X) ') + line = line.replace('NEIGHBOR_CMD', 'neighbor (A.B.C.D|X:X::X:X) ') + line = line.replace('CMD_AS_RANGE', '<1-4294967295>') + line = line.replace('LISTEN_RANGE_CMD', 'bgp listen range (A.B.C.D/M|X:X::X:X/M) ') + line = line.replace('DYNAMIC_NEIGHBOR_LIMIT_RANGE', '<1-5000>') + line = line.replace('QUAGGA_IP_REDIST_STR_BGPD', '(kernel|connected|static|rip|ospf|isis)') + line = line.replace('QUAGGA_IP6_REDIST_STR_BGPD', '(kernel|connected|static|ripng|ospf6|isis)') + line = line.replace('QUAGGA_IP6_REDIST_STR_ZEBRA', '(kernel|connected|static|ripng|ospf6|isis|bgp)') + line = line.replace('QUAGGA_IP_REDIST_STR_ZEBRA', '(kernel|connected|static|rip|ospf|isis|bgp)') + line = line.replace('OSPF_LSA_TYPES_CMD_STR', 'asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as') + line = line.replace('CMD_RANGE_STR(1, MULTIPATH_NUM)', '<1-255>') + line = line.replace('CMD_RANGE_STR(1, MAXTTL)', '<1-255>') + line = line.replace('BFD_CMD_DETECT_MULT_RANGE', '<2-255>') + line = line.replace('BFD_CMD_MIN_TX_RANGE', '<50-60000>') + line = line.replace('BGP_UPDATE_SOURCE_REQ_STR', '(A.B.C.D|X:X::X:X|WORD)') + line = line.replace('BGP_UPDATE_SOURCE_OPT_STR', '{A.B.C.D|X:X::X:X|WORD}') + line = line.replace('.LINE', 'LINE') + line = line.replace('.AA:NN', 'AA:NN') + # line = line.replace('', '') + return line + + +ignore = {} +ignore['bgpd'] = [] +ignore['bgpd'].append('address-family ipv4') +ignore['bgpd'].append('address-family ipv4 (unicast|multicast)') +ignore['bgpd'].append('address-family ipv6') +ignore['bgpd'].append('address-family ipv6 (unicast|multicast)') +ignore['bgpd'].append('address-family vpnv4') +ignore['bgpd'].append('address-family vpnv4 unicast') +ignore['bgpd'].append('exit-address-family') + +ignore['ospfd'] = [] + + +class Command(object): + + def __init__(self, defun, text, line_number): + self.defun = defun + self.text = text + self.line_number = line_number + self.context = [] + self.docstring = None + + def __str__(self): + return "%s - %s" % (self.context, self.text) + + def set_docstring(self): + ds = self.text + + if self.text in ignore['bgpd']: + return None + + # For these two WORD means an interface name + ds = ds.replace('A.B.C.D|X:X::X:X|WORD', '||') + ds = ds.replace('A.B.C.D|WORD', '|') + + ds = ds.replace('A.B.C.D/M', '') + ds = ds.replace('A.B.C.D', '') + ds = ds.replace('X:X::X:X/M', '') + ds = ds.replace('X:X::X:X', '') + ds = ds.replace('{json}', '[json]') + ds = ds.replace('{', '[') + ds = ds.replace('}', ']') + ds = ds.replace(' PATH ', ' ') + + afis = [] + safis = [] + + if 'BGP_IPV4_NODE' in self.context: + afis.append('ipv4') + safis.append('unicast') + + if 'BGP_IPV4M_NODE' in self.context: + afis.append('ipv4') + safis.append('multicast') + + if 'BGP_IPV6_NODE' in self.context: + afis.append('ipv6') + safis.append('unicast') + + if 'BGP_IPV6M_NODE' in self.context: + afis.append('ipv6') + safis.append('multicast') + + afis = list(set(afis)) + safis = list(set(safis)) + + # clear, debug, show, etc + if 'ENABLE_NODE' in self.context: + pass + + # config command so need to add (add|del) and maybe afi/safi + else: + if afis: + if len(afis) > 1: + afi_string = "[%s]" % '|'.join(afis) + else: + afi_string = afis[0] + + if len(safis) > 1: + safi_string = "[%s]" % '|'.join(safis) + else: + safi_string = safis[0] + + ds = "(add|del) bgp %s %s " % (afi_string, safi_string) + ds + + elif 'BGP_NODE' in self.context: + if ds.startswith('bgp'): + ds = "(add|del) " + ds + else: + ds = "(add|del) bgp " + ds + + elif 'INTERFACE_NODE' in self.context: + ds = "(add|del) " + ds + + elif 'OSPF_NODE' in self.context: + if ds.startswith('ospf'): + ds = "(add|del) " + ds + else: + ds = "(add|del) ospf " + ds + + # Ignore the route-map commands, ip community-list, etc for now + else: + ds = None + + if ds: + ds = ds.rstrip() + self.docstring = ' quagga ' + ds + + +if __name__ == '__main__': + + parser = argparse.ArgumentParser(description='Parse the quagga parser') + parser.add_argument('directory', help='quagga directory') + parser.add_argument('daemon', help='bgpd, ospfd, etc') + parser.add_argument('--print-quagga', action='store_true', help='print the raw quagga commands') + parser.add_argument('--print-docstring', action='store_true', help='print a docstring for network-docopt') + parser.add_argument('--print-context', action='store_true', help='print quagga commands with their context') + args = parser.parse_args() + + logging.basicConfig(level=logging.INFO, + format='%(asctime)s %(levelname)7s: %(message)s') + log = logging.getLogger(__name__) + + # Color the errors and warnings in red + logging.addLevelName(logging.ERROR, "\033[91m %s\033[0m" % logging.getLevelName(logging.ERROR)) + logging.addLevelName(logging.WARNING, "\033[91m%s\033[0m" % logging.getLevelName(logging.WARNING)) + + bgpd = os.path.join(args.directory, 'bgpd') + isisd = os.path.join(args.directory, 'isisd') + ospfd = os.path.join(args.directory, 'ospfd') + ospf6d = os.path.join(args.directory, 'ospf6d') + ripd = os.path.join(args.directory, 'ripd') + ripngd = os.path.join(args.directory, 'ripngd') + zebra = os.path.join(args.directory, 'zebra') + parser_files = [] + + for (directory, foo, files) in sorted(os.walk(args.directory)): + + # We do not care about crunching files in these directories + if (directory.endswith('vtysh') or + directory.endswith('quagga-0.99.23.1/') or + directory.endswith('lib') or + directory.endswith('isisd') or + directory.endswith('ripd') or + directory.endswith('ripngd') or + directory.endswith('m4') or + directory.endswith('tests')): + continue + + if args.daemon not in directory: + continue + + for x in sorted(files): + if x.endswith('.c'): + filename = os.path.join(directory, x) + parser_files.append(filename) + + commands = {} + defun_to_context = {} + + for filename in parser_files: + + with open(filename, 'r') as fh: + state = 'LIMBO' + line_number = 1 + + for line in fh.readlines(): + + if state == 'LIMBO': + if (line.startswith('DEFUN ') or line.startswith('ALIAS ')): + state = 'DEFUN_LINE_1' + + elif 'install_element' in line: + # install_element (BGP_NODE, &neighbor_bfd_cmd); + re_line = re.search('install_element\s*\(\s*(\S+)\s*, \&(\S+)\)', line) + + if re_line: + context = re_line.group(1) + defun = re_line.group(2) + + if defun not in defun_to_context: + defun_to_context[defun] = [] + defun_to_context[defun].append(context) + else: + log.warning("regex failed on '%s'" % line.strip()) + + elif state == 'DEFUN_LINE_1': + state = 'DEFUN_LINE_2' + # remove spaces and trailing comma + defun = line.strip()[0:-1] + + elif state == 'DEFUN_LINE_2': + if 'ifdef HAVE_IPV6' in line: + pass + else: + state = 'LIMBO' + + # remove the leading and trailing spaces + # remove the leading and trailing " + # remove the trailing , + line = line.strip() + line = replace_constants(line) + + if line.endswith(','): + line = line.rstrip().lstrip()[:-1] + + if line.startswith('"'): + line = line.rstrip().lstrip()[1:] + + if line.endswith('"'): + line = line.rstrip().lstrip()[:-1] + + line = line.replace(' " ', ' ') + line = line.replace(' "', ' ') + line = line.replace('" ', ' ') + line = line.replace('( ', '(') + line = line.replace(' )', ')') + + line = line.replace('| ', '|') + line = line.replace(' |', '|') + + # compress multiple whitespaces + while ' ' in line: + line = line.replace(' ', ' ') + + commands[line] = Command(defun, line, line_number) + defun = None + line_number += 1 + + # Fill in the context for each Command based on its defun + for cmd in commands.itervalues(): + cmd.context = defun_to_context.get(cmd.defun) + if cmd.context is None: + log.error("%s: could not find defun for %s" % (cmd, cmd.defun)) + continue + cmd.set_docstring() + + normal = [] + expert = [] + + if args.print_docstring: + if args.daemon == 'bgpd': + normal.append(' quagga show bgp [ipv4|ipv6] [unicast|multicast] summary [json]') + normal.append(' quagga show bgp [ipv4|ipv6] [unicast|multicast] [|] [bestpath|multipath] [json]') + normal.append(' quagga show bgp neighbor [|]') + normal.append(' quagga clear bgp (||*)') + normal.append(' quagga clear bgp (||*) soft [in|out]') + normal.append(' quagga clear bgp prefix ') + normal.append(' quagga (add|del) debug bgp bestpath ') + normal.append(' quagga (add|del) debug bgp keepalives ()') + normal.append(' quagga (add|del) debug bgp neighbor-events (|)') + expert.append(' quagga (add|del) debug bgp nht') + expert.append(' quagga (add|del) debug bgp update-groups') + normal.append(' quagga (add|del) debug bgp updates prefix ') + normal.append(' quagga (add|del) debug bgp zebra prefix ') + + bgp_bgp = ['always-compare-med', + 'bestpath', + 'client-to-client reflection', + 'cluster-id', + 'confederation peers', + 'default ipv4-unicast', + 'default local-preference', + 'default show-hostname', + 'default subgroup-pkt-queue-max', + 'deterministic-med', + 'disable-ebgp-connected-route-check', + 'enforce-first-as', + 'fast-external-failover', + 'graceful-restart', + 'listen', + 'log-neighbor-changes', + 'max-med', + 'network import-check', + 'route-map delay-timer', + 'route-reflector allow-outbound-policy', + 'router-id'] + + # ====== + # global + # ====== + normal.append(' quagga (add|del) bgp always-compare-med') + expert.append(' quagga (add|del) bgp bestpath as-path (confed|ignore)') + normal.append(' quagga (add|del) bgp bestpath as-path multipath-relax [as-set|no-as-set]') + expert.append(' quagga (add|del) bgp bestpath med (confed|missing-as-worst)') + expert.append(' quagga (add|del) bgp client-to-client reflection') + expert.append(' quagga (add|del) bgp cluster-id (|<1-4294967295>)') + expert.append(' quagga (add|del) bgp confederation peers <1-4294967295>') + expert.append(' quagga (add|del) bgp default ipv4-unicast') + expert.append(' quagga (add|del) bgp default local-preference <0-4294967295>') + expert.append(' quagga (add|del) bgp default show-hostname') + expert.append(' quagga (add|del) bgp default subgroup-pkt-queue-max <20-100>') + expert.append(' quagga (add|del) bgp deterministic-med') + expert.append(' quagga (add|del) bgp disable-ebgp-connected-route-check') + expert.append(' quagga (add|del) bgp enforce-first-as') + expert.append(' quagga (add|del) bgp fast-external-failover') + expert.append(' quagga (add|del) bgp graceful-restart') + expert.append(' quagga (add|del) bgp listen limit <1-5000>') + expert.append(' quagga (add|del) bgp listen range (|) peer-group ') + expert.append(' quagga (add|del) bgp log-neighbor-changes') + expert.append(' quagga (add|del) bgp max-med administrative <0-4294967294>') + expert.append(' quagga (add|del) bgp max-med on-startup <5-86400> [<0-4294967294>]') + expert.append(' quagga (add|del) bgp network import-check') + expert.append(' quagga (add|del) bgp route-map delay-timer <0-600>') + expert.append(' quagga (add|del) bgp route-reflector allow-outbound-policy') + normal.append(' quagga (add|del) bgp router-id ') + expert.append(' quagga (add|del) bgp coalesce-time <0-4294967295>') + expert.append(' quagga (add|del) bgp distance <1-255> ') + expert.append(' quagga (add|del) bgp distance bgp <1-255> <1-255> <1-255>') + expert.append(' quagga (add|del) bgp timers bgp <0-65535> <0-65535>') + expert.append(' quagga (add|del) bgp update-delay <0-3600> [<1-3600>]') + expert.append(' quagga (add|del) bgp write-quanta <1-10000>') + + # ==================== + # peer global afi/safi + # ==================== + normal.append(' quagga (add|del) bgp neighbor interface') + normal.append(' quagga (add|del) bgp neighbor interface peer-group ') + expert.append(' quagga (add|del) bgp neighbor interface v6only') + expert.append(' quagga (add|del) bgp neighbor interface v6only peer-group ') + normal.append(' quagga (add|del) bgp neighbor peer-group') + expert.append(' quagga (add|del) bgp neighbor (|) advertisement-interval <0-600>') + expert.append(' quagga (add|del) bgp neighbor (|) bfd') + expert.append(' quagga (add|del) bgp neighbor (|) capability dynamic') + normal.append(' quagga (add|del) bgp neighbor (|) capability extended-nexthop') + normal.append(' quagga (add|del) bgp neighbor (|) description ') + expert.append(' quagga (add|del) bgp neighbor (|) disable-connected-check') + expert.append(' quagga (add|del) bgp neighbor (|) dont-capability-negotiate') + normal.append(' quagga (add|del) bgp neighbor (|) ebgp-multihop [<1-255>]') + expert.append(' quagga (add|del) bgp neighbor (|) enforce-multihop') + expert.append(' quagga (add|del) bgp neighbor (|) local-as <1-4294967295> [no-prepend] [replace-as]') + expert.append(' quagga (add|del) bgp neighbor (|) override-capability') + expert.append(' quagga (add|del) bgp neighbor (|) passive') + normal.append(' quagga (add|del) bgp neighbor (|) password ') + expert.append(' quagga (add|del) bgp neighbor (|) port <0-65535>') + normal.append(' quagga (add|del) bgp neighbor (|) remote-as (<1-4294967295>|external|internal)') + normal.append(' quagga (add|del) bgp neighbor (|) shutdown') + expert.append(' quagga (add|del) bgp neighbor (|) solo') + expert.append(' quagga (add|del) bgp neighbor (|) strict-capability-match') + normal.append(' quagga (add|del) bgp neighbor (|) timers <0-65535> <0-65535>') + normal.append(' quagga (add|del) bgp neighbor (|) timers connect <1-65535>') + expert.append(' quagga (add|del) bgp neighbor (|) ttl-security hops <1-254>') + normal.append(' quagga (add|del) bgp neighbor (|) update-source (||)') + expert.append(' quagga (add|del) bgp neighbor (|) weight <0-65535>') + + # ================= + # peer per afi/safi + # ================= + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) addpath-tx-all-paths') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) addpath-tx-bestpath-per-AS') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) allowas-in [<1-10>]') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) as-override') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) attribute-unchanged [as-path] [next-hop] [med]') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) capability orf prefix-list (both|send|receive)') + normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) default-originate [route-map ]') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) distribute-list (<1-199>|<1300-2699>|) (in|out)') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) filter-list (in|out)') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) maximum-prefix <1-4294967295>') + normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) next-hop-self [force]') + normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) peer-group ') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) prefix-list (in|out)') + normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) remove-private-AS [all] [replace-AS]') + normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) route-map (in|out)') + normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) route-reflector-client') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) route-server-client') + normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) send-community [both|extended|standard]') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) soft-reconfiguration inbound') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (|) unsuppress-map ') + expert.append(' quagga (add|del) bgp ipv6 unicast neighbor (|) nexthop-local unchanged') + + # ============ + # per afi/safi + # ============ + normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] maximum-paths [ibgp] <1-255> [equal-cluster-length]') + normal.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] aggregate-address [as-set] [summary-only]') + normal.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] network (|)') + expert.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] network (|) route-map ') + expert.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] bgp dampening <1-45> <1-20000> <1-20000> <1-255>') + normal.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] redistribute (kernel|connected|static|rip|ospf|isis) [metric <0-4294967295>] [route-map ]') + expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] table-map ') + + if args.daemon == 'ospfd': + normal.append(' quagga clear ip ospf interface []') + normal.append(' quagga (add|del) debug ospf [<1-65535>] ism [status|events|timers]') + normal.append(' quagga (add|del) debug ospf [<1-65535>] lsa [generate|flooding|install|refresh]') + normal.append(' quagga (add|del) debug ospf [<1-65535>] nsm [status|events|timers]') + expert.append(' quagga (add|del) debug ospf [<1-65535>] nssa') + normal.append(' quagga (add|del) debug ospf [<1-65535>] packet [hello|dd|ls-request|ls-update|ls-ack|all] [send|recv|detail]') + normal.append(' quagga (add|del) debug ospf [<1-65535>] zebra [interface|redistribute]') + normal.append(' quagga show ip ospf [<1-65535>]') + expert.append(' quagga show ip ospf [<1-65535>] border-routers') + expert.append(' quagga show ip ospf [<1-65535>] database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate) [self-originate]') + expert.append(' quagga show ip ospf [<1-65535>] database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate) adv-router ') + normal.append(' quagga show ip ospf [<1-65535>] interface [] [json]') + normal.append(' quagga show ip ospf [<1-65535>] neighbor (all||) [detail] [json]') + normal.append(' quagga show ip ospf [<1-65535>] route') + + normal.append(' quagga (add|del) ip ospf [<1-65535>] area (|<0-4294967295>)') + normal.append(' quagga (add|del) ip ospf dead-interval <1-65535>') + normal.append(' quagga (add|del) ip ospf hello-interval <1-65535>') + normal.append(' quagga (add|del) ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)') + normal.append(' quagga (add|del) ospf network area (|<0-4294967295>)') + normal.append(' quagga (add|del) ospf passive-interface IFNAME') + normal.append(' quagga (add|del) ospf router-id ') + normal.append(' quagga (add|del) ospf timers throttle spf <0-600000> <0-600000> <0-600000>') + + + + ignore_list = bgp_clear_ignore + bgp_debug_ignore + bgp_show_ignore + bgp_config_ignore + ignore_list += ospf_clear_ignore + ospf_debug_ignore + ospf_show_ignore + ospf_config_ignore + + for cmd in commands.itervalues(): + if not cmd.text.startswith('no ') and cmd.context: + if cmd.docstring: + if cmd.docstring not in ignore_list: + normal.append(cmd.docstring) + + elif args.print_quagga: + for cmd in commands.itervalues(): + if not cmd.text.startswith('no ') and cmd.context: + normal.append(cmd.text) + + elif args.print_context: + for cmd in commands.itervalues(): + if not cmd.text.startswith('no ') and cmd.context: + normal.append("%s - %s" % (cmd.context, cmd.text)) + else: + raise Exception("No print option specified") + + normal = sorted(normal) + print '\n'.join(map(str, normal))