]> git.puffer.fish Git - mirror/frr.git/commitdiff
Expand #defines in command strings
authorDaniel Walton <dwalton@cumulusnetworks.com>
Sun, 25 Sep 2016 14:22:48 +0000 (14:22 +0000)
committerDaniel Walton <dwalton@cumulusnetworks.com>
Sun, 25 Sep 2016 14:22:48 +0000 (14:22 +0000)
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Sam Tannous <stannous@cumulusnetworks.com>
Ticket:

bgpd/bgp_bfd.c
bgpd/bgp_vty.c
lib/command.c
tools/argv_translator.py
zebra/zebra_vty.c

index bb8f4ceeea8944325991bae9e4ec6a8f6b655add..72ea3c60aeab98df7dc6c40d34d31912c924258c 100644 (file)
@@ -640,7 +640,7 @@ DEFUN_HIDDEN (neighbor_bfd_type,
 
 /*
  * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * NO_NEIGHBOR_CMD2 "bfd " BFD_CMD_DETECT_MULT_RANGE BFD_CMD_MIN_RX_RANGE BFD_CMD_MIN_TX_RANGE,
+ * "no neighbor <A.B.C.D|X:X::X:X|WORD> bfd (2-255) (50-60000) (50-60000)",
  *     NO_STR
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
index f1411ea5eb5d354bbec4d5198b46c724627e486c..4dcba02c24a2ed44eba016e6193820c2d2b28a14 100644 (file)
@@ -2910,7 +2910,7 @@ DEFUN (neighbor_peer_group,
 
 /*
  * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * NO_NEIGHBOR_CMD "remote-as (" CMD_AS_RANGE "|internal|external)",
+ * "no neighbor <A.B.C.D|X:X::X:X> remote-as ((1-4294967295)|internal|external)",
  *     NO_STR
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR
@@ -3171,14 +3171,14 @@ DEFUN (neighbor_local_as_no_prepend_replace_as,
 
 /*
  * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
+ * "no neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295)",
  *     NO_STR
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
  *     "Specify a local-as number\n"
  *     "AS number used as local AS\n"
  *
- * NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
+ * "no neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295) no-prepend",
  *     NO_STR
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
@@ -3186,7 +3186,7 @@ DEFUN (neighbor_local_as_no_prepend_replace_as,
  *     "AS number used as local AS\n"
  *     "Do not prepend local-as to updates from ebgp peers\n"
  *
- * NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
+ * "no neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295) no-prepend replace-as",
  *     NO_STR
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
@@ -3281,7 +3281,7 @@ DEFUN (neighbor_password,
 
 /*
  * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * NO_NEIGHBOR_CMD2 "password LINE",
+ * "no neighbor <A.B.C.D|X:X::X:X|WORD> password LINE",
  *     NO_STR
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
@@ -4130,7 +4130,7 @@ DEFUN (no_neighbor_nexthop_local_unchanged,
 
 /*
  * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
+ * "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged med next-hop as-path",
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
  *     "BGP attribute is propagated unchanged to this neighbor\n"
@@ -4138,7 +4138,7 @@ DEFUN (no_neighbor_nexthop_local_unchanged,
  *     "Nexthop attribute\n"
  *     "As-path attribute\n"
  *
- * NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
+ * "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged med as-path next-hop",
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
  *     "BGP attribute is propagated unchanged to this neighbor\n"
@@ -4146,7 +4146,7 @@ DEFUN (no_neighbor_nexthop_local_unchanged,
  *     "As-path attribute\n"
  *     "Nexthop attribute\n"
  *
- * NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
+ * "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged as-path next-hop med",
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
  *     "BGP attribute is propagated unchanged to this neighbor\n"
@@ -4154,7 +4154,7 @@ DEFUN (no_neighbor_nexthop_local_unchanged,
  *     "Nexthop attribute\n"
  *     "Med attribute\n"
  *
- * NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
+ * "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged next-hop as-path med",
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
  *     "BGP attribute is propagated unchanged to this neighbor\n"
@@ -4162,7 +4162,7 @@ DEFUN (no_neighbor_nexthop_local_unchanged,
  *     "As-path attribute\n"
  *     "Med attribute\n"
  *
- * NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
+ * "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged as-path med next-hop",
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
  *     "BGP attribute is propagated unchanged to this neighbor\n"
@@ -4170,7 +4170,7 @@ DEFUN (no_neighbor_nexthop_local_unchanged,
  *     "Med attribute\n"
  *     "Nexthop attribute\n"
  *
- * NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
+ * "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged next-hop med as-path",
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
  *     "BGP attribute is propagated unchanged to this neighbor\n"
@@ -4297,7 +4297,7 @@ DEFUN (neighbor_attr_unchanged4,
 
 /*
  * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
+ * "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged next-hop med as-path",
  *     NO_STR
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
@@ -4306,7 +4306,7 @@ DEFUN (neighbor_attr_unchanged4,
  *     "Med attribute\n"
  *     "As-path attribute\n"
  *
- * NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
+ * "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged as-path med next-hop",
  *     NO_STR
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
@@ -4315,7 +4315,7 @@ DEFUN (neighbor_attr_unchanged4,
  *     "Med attribute\n"
  *     "Nexthop attribute\n"
  *
- * NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
+ * "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged med as-path next-hop",
  *     NO_STR
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
@@ -4324,7 +4324,7 @@ DEFUN (neighbor_attr_unchanged4,
  *     "As-path attribute\n"
  *     "Nexthop attribute\n"
  *
- * NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
+ * "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged next-hop as-path med",
  *     NO_STR
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
@@ -4333,7 +4333,7 @@ DEFUN (neighbor_attr_unchanged4,
  *     "As-path attribute\n"
  *     "Med attribute\n"
  *
- * NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
+ * "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged as-path next-hop med",
  *     NO_STR
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
@@ -4342,7 +4342,7 @@ DEFUN (neighbor_attr_unchanged4,
  *     "Nexthop attribute\n"
  *     "Med attribute\n"
  *
- * NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
+ * "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged med next-hop as-path",
  *     NO_STR
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
@@ -4534,7 +4534,7 @@ DEFUN (neighbor_ebgp_multihop_ttl,
 
 /*
  * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * NO_NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR(1, MAXTTL),
+ * "no neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop (1-255)",
  *     NO_STR
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
@@ -4558,7 +4558,7 @@ DEFUN (no_neighbor_ebgp_multihop,
 /* disable-connected-check */
 /*
  * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * NEIGHBOR_CMD2 "enforce-multihop",
+ * "neighbor <A.B.C.D|X:X::X:X|WORD> enforce-multihop",
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
  *     "Enforce EBGP neighbors perform multihop\n"
@@ -4577,7 +4577,7 @@ DEFUN (neighbor_disable_connected_check,
 
 /*
  * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * NO_NEIGHBOR_CMD2 "enforce-multihop",
+ * "no neighbor <A.B.C.D|X:X::X:X|WORD> enforce-multihop",
  *     NO_STR
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
@@ -4630,7 +4630,7 @@ DEFUN (neighbor_description,
 
 /*
  * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * NO_NEIGHBOR_CMD2 "description .LINE",
+ * "no neighbor <A.B.C.D|X:X::X:X|WORD> description .LINE",
  *     NO_STR
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
@@ -4773,7 +4773,7 @@ DEFUN (neighbor_default_originate_rmap,
 
 /*
  * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
+ * "no neighbor <A.B.C.D|X:X::X:X|WORD> default-originate route-map WORD",
  *     NO_STR
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
@@ -5779,14 +5779,14 @@ DEFUN (neighbor_maximum_prefix_threshold_restart,
 
 /*
  * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
+ * "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix <1-4294967295>",
  *     NO_STR
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
  *     "Maximum number of prefix accept from this peer\n"
  *     "maximum no. of prefix limit\n"
  *
- * NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
+ * "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
  *     NO_STR
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
@@ -5796,7 +5796,7 @@ DEFUN (neighbor_maximum_prefix_threshold_restart,
  *     "Restart bgp connection after limit is exceeded\n"
  *     "Restart interval in minutes"
  *
- * NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
+ * "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix <1-4294967295> warning-only",
  *     NO_STR
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
@@ -5804,7 +5804,7 @@ DEFUN (neighbor_maximum_prefix_threshold_restart,
  *     "maximum no. of prefix limit\n"
  *     "Only give warning message when limit is exceeded\n"
  *
- * NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
+ * "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix <1-4294967295> restart <1-65535>",
  *     NO_STR
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
@@ -5813,7 +5813,7 @@ DEFUN (neighbor_maximum_prefix_threshold_restart,
  *     "Restart bgp connection after limit is exceeded\n"
  *     "Restart interval in minutes"
  *
- * NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
+ * "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix <1-4294967295> <1-100> warning-only",
  *     NO_STR
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
@@ -5822,7 +5822,7 @@ DEFUN (neighbor_maximum_prefix_threshold_restart,
  *     "Threshold value (%) at which to generate a warning msg\n"
  *     "Only give warning message when limit is exceeded\n"
  *
- * NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
+ * "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix <1-4294967295> <1-100>",
  *     NO_STR
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
@@ -5853,7 +5853,7 @@ DEFUN (no_neighbor_maximum_prefix,
 /* "neighbor allowas-in" */
 /*
  * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * NEIGHBOR_CMD2 "allowas-in <1-10>",
+ * "neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in <1-10>",
  *     NEIGHBOR_STR
  *     NEIGHBOR_ADDR_STR2
  *     "Accept as-path with my AS present in it\n"
index 6fb265f97a7d6c773031732df4710a4abcaf23e2..10448ef6fb33bacf5158665f0cac3c8d058c2b9b 100644 (file)
@@ -1814,7 +1814,7 @@ set_log_file(struct vty *vty, const char *fname, int loglevel)
 
 DEFUN (config_log_file,
        config_log_file_cmd,
-       "log file FILENAME [" LOG_LEVELS "]",
+       "log file FILENAME [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]",
        "Logging control\n"
        "Logging to file\n"
        "Logging filename\n"
@@ -1855,7 +1855,7 @@ DEFUN (no_config_log_file,
 
 DEFUN (config_log_syslog,
        config_log_syslog_cmd,
-       "log syslog [" LOG_LEVELS "]",
+       "log syslog [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]",
        "Logging control\n"
        "Set syslog logging level\n"
        LOG_LEVEL_DESC)
@@ -1893,7 +1893,7 @@ DEFUN_DEPRECATED (config_log_syslog_facility,
 
 DEFUN (no_config_log_syslog,
        no_config_log_syslog_cmd,
-       "no log syslog [<kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7>] [" LOG_LEVELS "]",
+       "no log syslog [<kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7>] [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]",
        NO_STR
        "Logging control\n"
        "Cancel logging to syslog\n"
index 8a4a0b8cf26e9c76fd8c66759b43ea0e4a3812c9..4845c08d0a281ea34d66512c4e6ebd7e384c00e8 100755 (executable)
@@ -520,6 +520,7 @@ def expand_command_string(line):
     line = line.replace('" QUAGGA_REDIST_STR_OSPF6D "', '<kernel|connected|static|ripng|isis|bgp|table>')
     line = line.replace('" QUAGGA_REDIST_STR_ISISD "', '<kernel|connected|static|rip|ripng|ospf|ospf6|bgp|pim|table>')
     line = line.replace('" LOG_FACILITIES "', '<kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7>')
+    line = line.replace('" LOG_LEVELS "', ' (emergencies|alerts|critical|errors|warnings|notifications|informational|debugging)')
 
     # endswith
     line = line.replace('" CMD_AS_RANGE,', ' (1-4294967295)",')
@@ -551,6 +552,7 @@ def expand_command_string(line):
     line = line.replace('" QUAGGA_REDIST_STR_OSPF6D,', ' <kernel|connected|static|ripng|isis|bgp|table>",')
     line = line.replace('" QUAGGA_REDIST_STR_ISISD,', ' <kernel|connected|static|rip|ripng|ospf|ospf6|bgp|pim|table>",')
     line = line.replace('" LOG_FACILITIES,', ' <kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7>",')
+    line = line.replace('" LOG_LEVELS,', ' (emergencies|alerts|critical|errors|warnings|notifications|informational|debugging)",')
 
     # startswith
     line = line.replace('LISTEN_RANGE_CMD "', '"bgp listen range <A.B.C.D/M|X:X::X:X/M> ')
@@ -562,6 +564,7 @@ def expand_command_string(line):
     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 ')
+    line = line.replace('LOG_LEVELS "', '"(emergencies|alerts|critical|errors|warnings|notifications|informational|debugging) ')
 
     # solo
     line = line.replace('NO_NEIGHBOR_CMD2,', '"no neighbor <A.B.C.D|X:X::X:X|WORD>",')
@@ -720,7 +723,6 @@ DEFUN (no_bgp_maxmed_onstartup,
         new_command_string_expanded = expand_command_string(new_command_string)
         lines = []
 
-        # dwalton
         lines.append("DEFUN (%s,\n" % self.name)
         lines.append("       %s,\n" % self.name_cmd)
         # lines.append(new_command_string)
@@ -868,7 +870,7 @@ def update_argvs(filename):
                 if line.strip() == '*/':
                     state = None
                     fh.write(line)
-                elif line.strip().startswith('* "'):
+                elif line.strip().startswith('* ') and not line.strip().startswith('*    '):
                     # dwalton
                     new_line = expand_command_string(line[3:]) # chop the leading " * "
                     fh.write(" * %s" % new_line)
index 878af09ee09f312cb23d1705319be0d4a7329b4c..005c9370b595be40eba7f6d610db072e2bcceb65 100644 (file)
@@ -5597,7 +5597,7 @@ DEFUN (show_ipv6_route_prefix_longer,
 
 /*
  * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "show ipv6 route " VRF_CMD_STR " <kernel|connected|static|ripng|ospf6|isis|bgp|table>",
+ * "show ipv6 route vrf NAME <kernel|connected|static|ripng|ospf6|isis|bgp|table>",
  *     SHOW_STR
  *     IP_STR
  *     "IP routing table\n"