Expand #defines in command strings

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
This commit is contained in:
Daniel Walton 2016-09-25 16:49:39 +00:00
parent 3ce54f7812
commit 199d90a10e
14 changed files with 29 additions and 73 deletions

View File

@ -610,7 +610,7 @@ DEFUN (neighbor_bfd_param,
DEFUN_HIDDEN (neighbor_bfd_type,
neighbor_bfd_type_cmd,
NEIGHBOR_CMD2 "bfd " BFD_CMD_TYPE,
"neighbor <A.B.C.D|X:X::X:X|WORD> bfd (multihop|singlehop)",
NEIGHBOR_STR
NEIGHBOR_ADDR_STR2
"Enables BFD support\n"
@ -675,7 +675,7 @@ DEFUN (no_neighbor_bfd,
DEFUN_HIDDEN (no_neighbor_bfd_type,
no_neighbor_bfd_type_cmd,
NO_NEIGHBOR_CMD2 "bfd " BFD_CMD_TYPE,
"no neighbor <A.B.C.D|X:X::X:X|WORD> bfd (multihop|singlehop)",
NO_STR
NEIGHBOR_STR
NEIGHBOR_ADDR_STR2

View File

@ -4689,9 +4689,6 @@ peer_update_source_vty (struct vty *vty, const char *peer_str,
return CMD_SUCCESS;
}
#define BGP_UPDATE_SOURCE_STR "A.B.C.D|X:X::X:X|WORD"
#define BGP_UPDATE_SOURCE_REQ_STR "(" BGP_UPDATE_SOURCE_STR ")"
#define BGP_UPDATE_SOURCE_OPT_STR "{" BGP_UPDATE_SOURCE_STR "}"
#define BGP_UPDATE_SOURCE_HELP_STR \
"IPv4 address\n" \
"IPv6 address\n" \

View File

@ -23,11 +23,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
struct bgp;
#define CMD_AS_RANGE "<1-4294967295>"
#define DYNAMIC_NEIGHBOR_LIMIT_RANGE "<1-5000>"
#define BGP_INSTANCE_CMD "(view|vrf) WORD"
#define BGP_INSTANCE_HELP_STR "BGP view\nBGP VRF\nView/VRF name\n"
#define BGP_INSTANCE_ALL_CMD "(view|vrf) all"
#define BGP_INSTANCE_ALL_HELP_STR "BGP view\nBGP VRF\nAll Views/VRFs\n"
extern void bgp_vty_init (void);

View File

@ -26,11 +26,6 @@
#include "lib/json.h"
#define BFD_CMD_DETECT_MULT_RANGE "<2-255> "
#define BFD_CMD_MIN_RX_RANGE "<50-60000> "
#define BFD_CMD_MIN_TX_RANGE "<50-60000>"
#define BFD_CMD_TYPE "(multihop|singlehop)"
#define BFD_DEF_MIN_RX 300
#define BFD_MIN_MIN_RX 50
#define BFD_MAX_MIN_RX 60000

View File

@ -1621,7 +1621,7 @@ DEFUN_HIDDEN (do_echo,
DEFUN (config_logmsg,
config_logmsg_cmd,
"logmsg "LOG_LEVELS" MESSAGE...",
"logmsg <emergencies|alerts|critical|errors|warnings|notifications|informational|debugging> MESSAGE...",
"Send a message to enabled logging destinations\n"
LOG_LEVEL_DESC
"The message to send\n")
@ -1694,7 +1694,7 @@ DEFUN (show_logging,
DEFUN (config_log_stdout,
config_log_stdout_cmd,
"log stdout ["LOG_LEVELS"]",
"log stdout [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]",
"Logging control\n"
"Set stdout logging level\n"
LOG_LEVEL_DESC)
@ -1715,7 +1715,7 @@ DEFUN (config_log_stdout,
DEFUN (no_config_log_stdout,
no_config_log_stdout_cmd,
"no log stdout ["LOG_LEVELS"]",
"no log stdout [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]",
NO_STR
"Logging control\n"
"Cancel logging to stdout\n"
@ -1727,7 +1727,7 @@ DEFUN (no_config_log_stdout,
DEFUN (config_log_monitor,
config_log_monitor_cmd,
"log monitor ["LOG_LEVELS"]",
"log monitor [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]",
"Logging control\n"
"Set terminal line (monitor) logging level\n"
LOG_LEVEL_DESC)
@ -1748,7 +1748,7 @@ DEFUN (config_log_monitor,
DEFUN (no_config_log_monitor,
no_config_log_monitor_cmd,
"no log monitor ["LOG_LEVELS"]",
"no log monitor [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]",
NO_STR
"Logging control\n"
"Disable terminal line (monitor) logging\n"
@ -1878,7 +1878,7 @@ DEFUN (config_log_syslog,
DEFUN_DEPRECATED (config_log_syslog_facility,
config_log_syslog_facility_cmd,
"log syslog facility "LOG_FACILITIES,
"log syslog facility (kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7)",
"Logging control\n"
"Logging goes to syslog\n"
"(Deprecated) Facility parameter for syslog messages\n"
@ -1932,7 +1932,7 @@ DEFUN (no_config_log_facility,
DEFUN_DEPRECATED (config_log_trap,
config_log_trap_cmd,
"log trap " LOG_LEVELS,
"log trap <emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>",
"Logging control\n"
"(Deprecated) Set logging level and default for all destinations\n"
LOG_LEVEL_DESC)
@ -1952,7 +1952,7 @@ DEFUN_DEPRECATED (config_log_trap,
DEFUN_DEPRECATED (no_config_log_trap,
no_config_log_trap_cmd,
"no log trap [" LOG_LEVELS "]",
"no log trap [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]",
NO_STR
"Logging control\n"
"Permit all logging information\n"

View File

@ -319,7 +319,6 @@ struct cmd_element
*/
#define CMD_CREATE_STR(s) CMD_CREATE_STR_HELPER(s)
#define CMD_CREATE_STR_HELPER(s) #s
#define CMD_RANGE_STR(a,s) "<" CMD_CREATE_STR(a) "-" CMD_CREATE_STR(s) ">"
/* Common descriptions. */
#define SHOW_STR "Show running system information\n"
@ -372,28 +371,18 @@ struct cmd_element
/* IPv4 only machine should not accept IPv6 address for peer's IP
address. So we replace VTY command string like below. */
#ifdef HAVE_IPV6
#define NEIGHBOR_CMD "neighbor <A.B.C.D|X:X::X:X> "
#define NO_NEIGHBOR_CMD "no neighbor <A.B.C.D|X:X::X:X> "
#define NEIGHBOR_ADDR_STR "Neighbor address\nIPv6 address\n"
#define NEIGHBOR_CMD2 "neighbor <A.B.C.D|X:X::X:X|WORD> "
#define NO_NEIGHBOR_CMD2 "no neighbor <A.B.C.D|X:X::X:X|WORD> "
#define NEIGHBOR_ADDR_STR2 "Neighbor address\nNeighbor IPv6 address\nInterface name or neighbor tag\n"
#define NEIGHBOR_ADDR_STR3 "Neighbor address\nIPv6 address\nInterface name\n"
#else
#define NEIGHBOR_CMD "neighbor A.B.C.D "
#define NO_NEIGHBOR_CMD "no neighbor A.B.C.D "
#define NEIGHBOR_ADDR_STR "Neighbor address\n"
#define NEIGHBOR_CMD2 "neighbor <A.B.C.D|WORD> "
#define NO_NEIGHBOR_CMD2 "no neighbor <A.B.C.D|WORD> "
#define NEIGHBOR_ADDR_STR2 "Neighbor address\nNeighbor tag\n"
#endif /* HAVE_IPV6 */
/* Dynamic neighbor (listen range) configuration */
#ifdef HAVE_IPV6
#define LISTEN_RANGE_CMD "bgp listen range <A.B.C.D/M|X:X::X:X/M> "
#define LISTEN_RANGE_ADDR_STR "Neighbor address\nNeighbor IPv6 address\n"
#else
#define LISTEN_RANGE_CMD "bgp listen range A.B.C.D/M "
#define LISTEN_RANGE_ADDR_STR "Neighbor address\n"
#endif /* HAVE_IPV6 */

View File

@ -750,7 +750,7 @@ if_sunwzebra_get (const char *name, size_t nlen, vrf_id_t vrf_id)
DEFUN (interface,
interface_cmd,
"interface IFNAME ["VRF_CMD_STR"]",
"interface IFNAME [vrf NAME]",
"Select an interface to configure\n"
"Interface's name\n"
VRF_CMD_HELP_STR)
@ -795,7 +795,7 @@ DEFUN (interface,
DEFUN_NOSH (no_interface,
no_interface_cmd,
"no interface IFNAME [VRF_CMD_STR]",
"no interface IFNAME [vrf NAME]",
NO_STR
"Delete a pseudo interface's configuration\n"
"Interface's name\n"
@ -894,7 +894,7 @@ DEFUN_NOSH (no_vrf,
/* For debug purpose. */
DEFUN (show_address,
show_address_cmd,
"show address [VRF_CMD_STR]",
"show address [vrf NAME]",
SHOW_STR
"address\n"
VRF_CMD_HELP_STR)

View File

@ -192,8 +192,6 @@ struct timestamp_control {
/* Defines for use in command construction: */
#define LOG_LEVELS "(emergencies|alerts|critical|errors|warnings|notifications|informational|debugging)"
#define LOG_LEVEL_DESC \
"System is unusable\n" \
"Immediate action needed\n" \
@ -204,8 +202,6 @@ struct timestamp_control {
"Informational messages\n" \
"Debugging messages\n"
#define LOG_FACILITIES "(kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7)"
#define LOG_FACILITY_DESC \
"Kernel\n" \
"User process\n" \

View File

@ -50,11 +50,7 @@ enum {
/*
* The command strings
*/
#define VRF_CMD_STR "vrf NAME"
#define VRF_CMD_HELP_STR "Specify the VRF\nThe VRF name\n"
#define VRF_ALL_CMD_STR "vrf all"
#define VRF_ALL_CMD_HELP_STR "Specify the VRF\nAll VRFs\n"
/*

View File

@ -5757,11 +5757,6 @@ show_ip_ospf_database_maxage (struct vty *vty, struct ospf *ospf)
#define OSPF_LSA_TYPE_OPAQUE_AS_DESC "Link AS Opaque-LSA\n"
#define OSPF_LSA_TYPE_OPAQUE_CMD_STR "|opaque-link|opaque-area|opaque-as"
#define OSPF_LSA_TYPES_CMD_STR \
"asbr-summary|external|network|router|summary" \
OSPF_LSA_TYPE_NSSA_CMD_STR \
OSPF_LSA_TYPE_OPAQUE_CMD_STR
#define OSPF_LSA_TYPES_DESC \
"ASBR summary link states\n" \
"External link states\n" \

View File

@ -60,12 +60,6 @@
#define MROUTE_STR "IP multicast routing table\n"
#define RIB_STR "IP unicast routing table\n"
#define PIM_CMD_NO "no"
#define PIM_CMD_IP_MULTICAST_ROUTING "ip multicast-routing"
#define PIM_CMD_IP_IGMP_QUERY_INTERVAL "ip igmp query-interval"
#define PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME "ip igmp query-max-response-time"
#define PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC "ip igmp query-max-response-time-dsec"
void pim_cmd_init(void);
#endif /* PIM_CMD_H */

View File

@ -98,7 +98,7 @@ int pim_global_config_write(struct vty *vty)
char buffer[32];
if (PIM_MROUTE_IS_ENABLED) {
vty_out(vty, "%s%s", PIM_CMD_IP_MULTICAST_ROUTING, VTY_NEWLINE);
vty_out(vty, "ip multicast-routing%s", VTY_NEWLINE);
++writes;
}
if (qpim_rp.rpf_addr.s_addr != INADDR_NONE) {
@ -170,8 +170,7 @@ int pim_interface_config_write(struct vty *vty)
/* IF ip igmp query-interval */
if (pim_ifp->igmp_default_query_interval != IGMP_GENERAL_QUERY_INTERVAL)
{
vty_out(vty, " %s %d%s",
PIM_CMD_IP_IGMP_QUERY_INTERVAL,
vty_out(vty, " ip igmp query-interval %d%s",
pim_ifp->igmp_default_query_interval,
VTY_NEWLINE);
++writes;
@ -180,8 +179,7 @@ int pim_interface_config_write(struct vty *vty)
/* IF ip igmp query-max-response-time */
if (pim_ifp->igmp_query_max_response_time_dsec != IGMP_QUERY_MAX_RESPONSE_TIME_DSEC)
{
vty_out(vty, " %s %d%s",
PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC,
vty_out(vty, " ip igmp query-max-response-time-dsec %d%s",
pim_ifp->igmp_query_max_response_time_dsec,
VTY_NEWLINE);
++writes;

View File

@ -520,7 +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)')
line = line.replace('" LOG_LEVELS "', ' <emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>')
# endswith
line = line.replace('" CMD_AS_RANGE,', ' (1-4294967295)",')
@ -552,7 +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)",')
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> ')
@ -564,7 +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) ')
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>",')

View File

@ -1084,7 +1084,7 @@ DEFUNSH (VTYSH_ALL,
DEFUNSH (VTYSH_BGPD,
router_bgp,
router_bgp_cmd,
"router bgp " CMD_AS_RANGE,
"router bgp (1-4294967295)",
ROUTER_STR
BGP_STR
AS_STR)
@ -1103,7 +1103,7 @@ ALIAS_SH (VTYSH_BGPD,
ALIAS_SH (VTYSH_BGPD,
router_bgp,
router_bgp_view_cmd,
"router bgp " CMD_AS_RANGE " (view|vrf) WORD",
"router bgp (1-4294967295) (view|vrf) WORD",
ROUTER_STR
BGP_STR
AS_STR
@ -1616,7 +1616,7 @@ DEFUNSH (VTYSH_INTERFACE,
ALIAS_SH (VTYSH_ZEBRA,
vtysh_interface,
vtysh_interface_vrf_cmd,
"interface IFNAME " VRF_CMD_STR,
"interface IFNAME vrf NAME",
"Select an interface to configure\n"
"Interface's name\n"
VRF_CMD_HELP_STR)
@ -1631,7 +1631,7 @@ DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D,
DEFSH (VTYSH_ZEBRA,
vtysh_no_interface_vrf_cmd,
"no interface IFNAME " VRF_CMD_STR,
"no interface IFNAME vrf NAME",
NO_STR
"Delete a pseudo interface's configuration\n"
"Interface's name\n"
@ -1867,7 +1867,7 @@ DEFUNSH (VTYSH_ALL,
DEFUNSH (VTYSH_ALL,
vtysh_log_stdout_level,
vtysh_log_stdout_level_cmd,
"log stdout "LOG_LEVELS,
"log stdout <emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>",
"Logging control\n"
"Set stdout logging level\n"
LOG_LEVEL_DESC)
@ -1901,7 +1901,7 @@ DEFUNSH (VTYSH_ALL,
DEFUNSH (VTYSH_ALL,
vtysh_log_file_level,
vtysh_log_file_level_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"
@ -1945,7 +1945,7 @@ DEFUNSH (VTYSH_ALL,
DEFUNSH (VTYSH_ALL,
vtysh_log_monitor_level,
vtysh_log_monitor_level_cmd,
"log monitor "LOG_LEVELS,
"log monitor <emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>",
"Logging control\n"
"Set terminal line (monitor) logging level\n"
LOG_LEVEL_DESC)
@ -1978,7 +1978,7 @@ DEFUNSH (VTYSH_ALL,
DEFUNSH (VTYSH_ALL,
vtysh_log_syslog_level,
vtysh_log_syslog_level_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)
@ -2001,7 +2001,7 @@ DEFUNSH (VTYSH_ALL,
DEFUNSH (VTYSH_ALL,
vtysh_log_facility,
vtysh_log_facility_cmd,
"log facility "LOG_FACILITIES,
"log facility <kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7>",
"Logging control\n"
"Facility parameter for syslog messages\n"
LOG_FACILITY_DESC)
@ -2026,7 +2026,7 @@ DEFUNSH (VTYSH_ALL,
DEFUNSH_DEPRECATED (VTYSH_ALL,
vtysh_log_trap,
vtysh_log_trap_cmd,
"log trap "LOG_LEVELS,
"log trap <emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>",
"Logging control\n"
"(Deprecated) Set logging level and default for all destinations\n"
LOG_LEVEL_DESC)