Skip to content

Commit

Permalink
*: move CLI node names to cmd_node->name
Browse files Browse the repository at this point in the history
And again for the name.  Why on earth would we centralize this, just so
people can forget to update it?

Signed-off-by: David Lamparter <equinox@diac24.net>
  • Loading branch information
eqvinox committed Apr 2, 2020
1 parent 4958ca1 commit bfec662
Show file tree
Hide file tree
Showing 55 changed files with 177 additions and 94 deletions.
1 change: 1 addition & 0 deletions babeld/babel_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ static void babel_interface_free (babel_interface_nfo *bi);
static vector babel_enable_if; /* enable interfaces (by cmd). */
static int interface_config_write(struct vty *vty);
static struct cmd_node babel_interface_node = {
.name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",
Expand Down
1 change: 1 addition & 0 deletions babeld/babeld.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ static time_t source_expiry_time;
static int babel_config_write (struct vty *vty);
static struct cmd_node cmd_babel_node =
{
.name = "babel",
.node = BABEL_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
Expand Down
2 changes: 2 additions & 0 deletions bfdd/bfdd_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,13 +848,15 @@ DEFUN_NOSH(show_debugging_bfd,

static int bfdd_write_config(struct vty *vty);
struct cmd_node bfd_node = {
.name = "bfd",
.node = BFD_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-bfd)# ",
.config_write = bfdd_write_config,
};

struct cmd_node bfd_peer_node = {
.name = "bfd peer",
.node = BFD_PEER_NODE,
.parent_node = BFD_NODE,
.prompt = "%s(config-bfd-peer)# ",
Expand Down
1 change: 1 addition & 0 deletions bgpd/bgp_bmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1773,6 +1773,7 @@ static void bmp_active_setup(struct bmp_active *ba)
}

static struct cmd_node bmp_node = {
.name = "bmp",
.node = BMP_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-bgp-bmp)# "
Expand Down
1 change: 1 addition & 0 deletions bgpd/bgp_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -2284,6 +2284,7 @@ static int bgp_config_write_debug(struct vty *vty)

static int bgp_config_write_debug(struct vty *vty);
static struct cmd_node debug_node = {
.name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = bgp_config_write_debug,
Expand Down
1 change: 1 addition & 0 deletions bgpd/bgp_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,7 @@ DEFUN (no_dump_bgp_all,
static int config_write_bgp_dump(struct vty *vty);
/* BGP node structure. */
static struct cmd_node bgp_dump_node = {
.name = "dump",
.node = DUMP_NODE,
.prompt = "",
.config_write = config_write_bgp_dump,
Expand Down
1 change: 1 addition & 0 deletions bgpd/bgp_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@ static int config_write_as_list(struct vty *vty)

static int config_write_as_list(struct vty *vty);
static struct cmd_node as_list_node = {
.name = "as list",
.node = AS_LIST_NODE,
.prompt = "",
.config_write = config_write_as_list,
Expand Down
1 change: 1 addition & 0 deletions bgpd/bgp_rpki.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ static int rpki_sync_socket_rtr;
static int rpki_sync_socket_bgpd;

static struct cmd_node rpki_node = {
.name = "rpki",
.node = RPKI_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-rpki)# ",
Expand Down
14 changes: 14 additions & 0 deletions bgpd/bgp_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -15284,79 +15284,92 @@ int bgp_config_write(struct vty *vty)

/* BGP node structure. */
static struct cmd_node bgp_node = {
.name = "bgp",
.node = BGP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
.config_write = bgp_config_write,
};

static struct cmd_node bgp_ipv4_unicast_node = {
.name = "bgp ipv4 unicast",
.node = BGP_IPV4_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};

static struct cmd_node bgp_ipv4_multicast_node = {
.name = "bgp ipv4 multicast",
.node = BGP_IPV4M_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};

static struct cmd_node bgp_ipv4_labeled_unicast_node = {
.name = "bgp ipv4 labeled unicast",
.node = BGP_IPV4L_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};

static struct cmd_node bgp_ipv6_unicast_node = {
.name = "bgp ipv6",
.node = BGP_IPV6_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};

static struct cmd_node bgp_ipv6_multicast_node = {
.name = "bgp ipv6 multicast",
.node = BGP_IPV6M_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};

static struct cmd_node bgp_ipv6_labeled_unicast_node = {
.name = "bgp ipv6 labeled unicast",
.node = BGP_IPV6L_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};

static struct cmd_node bgp_vpnv4_node = {
.name = "bgp vpnv4",
.node = BGP_VPNV4_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};

static struct cmd_node bgp_vpnv6_node = {
.name = "bgp vpnv6",
.node = BGP_VPNV6_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af-vpnv6)# ",
};

static struct cmd_node bgp_evpn_node = {
.name = "bgp evpn",
.node = BGP_EVPN_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-evpn)# ",
};

static struct cmd_node bgp_evpn_vni_node = {
.name = "bgp evpn vni",
.node = BGP_EVPN_VNI_NODE,
.parent_node = BGP_EVPN_NODE,
.prompt = "%s(config-router-af-vni)# ",
};

static struct cmd_node bgp_flowspecv4_node = {
.name = "bgp ipv4 flowspec",
.node = BGP_FLOWSPECV4_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};

static struct cmd_node bgp_flowspecv6_node = {
.name = "bgp ipv6 flowspec",
.node = BGP_FLOWSPECV6_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af-vpnv6)# ",
Expand Down Expand Up @@ -17839,6 +17852,7 @@ static int community_list_config_write(struct vty *vty)

static int community_list_config_write(struct vty *vty);
static struct cmd_node community_list_node = {
.name = "community list",
.node = COMMUNITY_LIST_NODE,
.prompt = "",
.config_write = community_list_config_write,
Expand Down
4 changes: 4 additions & 0 deletions bgpd/rfapi/bgp_rfapi_cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2965,12 +2965,14 @@ DEFUN_NOSH (exit_vnc,
}

static struct cmd_node bgp_vnc_defaults_node = {
.name = "bgp vnc defaults",
.node = BGP_VNC_DEFAULTS_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-vnc-defaults)# ",
};

static struct cmd_node bgp_vnc_nve_group_node = {
.name = "bgp vnc nve",
.node = BGP_VNC_NVE_GROUP_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-vnc-nve-group)# ",
Expand Down Expand Up @@ -3394,6 +3396,7 @@ DEFUN_NOSH (exit_vrf_policy,
}

static struct cmd_node bgp_vrf_policy_node = {
.name = "bgp vrf policy",
.node = BGP_VRF_POLICY_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-vrf-policy)# ",
Expand Down Expand Up @@ -3633,6 +3636,7 @@ DEFUN (vnc_l2_group_rt,


static struct cmd_node bgp_vnc_l2_group_node = {
.name = "bgp vnc l2",
.node = BGP_VNC_L2_GROUP_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-vnc-l2-group)# ",
Expand Down
1 change: 1 addition & 0 deletions bgpd/rfapi/vnc_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ static int bgp_vnc_config_write_debug(struct vty *vty)

static int bgp_vnc_config_write_debug(struct vty *vty);
static struct cmd_node debug_node = {
.name = "vnc debug",
.node = DEBUG_VNC_NODE,
.prompt = "",
.config_write = bgp_vnc_config_write_debug,
Expand Down
2 changes: 2 additions & 0 deletions eigrpd/eigrp_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,7 @@ void eigrp_cli_show_keychain(struct vty *vty, struct lyd_node *dnode,
*/
static int eigrp_config_write(struct vty *vty);
static struct cmd_node eigrp_node = {
.name = "eigrp",
.node = EIGRP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
Expand All @@ -862,6 +863,7 @@ static int eigrp_config_write(struct vty *vty)

static int eigrp_write_interface(struct vty *vty);
static struct cmd_node eigrp_interface_node = {
.name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",
Expand Down
1 change: 1 addition & 0 deletions eigrpd/eigrp_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ DEFUN (no_debug_eigrp_packets,
/* Debug node. */
static int config_write_debug(struct vty *vty);
static struct cmd_node eigrp_debug_node = {
.name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = config_write_debug,
Expand Down
1 change: 1 addition & 0 deletions isisd/isis_circuit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,7 @@ ferr_r isis_circuit_passwd_hmac_md5_set(struct isis_circuit *circuit,
}

struct cmd_node interface_node = {
.name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",
Expand Down
13 changes: 11 additions & 2 deletions isisd/isisd.c
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@ DEFUN_NOSH (show_debugging,
static int config_write_debug(struct vty *vty);
/* Debug node. */
static struct cmd_node debug_node = {
.name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = config_write_debug,
Expand Down Expand Up @@ -2128,6 +2129,13 @@ static int isis_config_write(struct vty *vty)
return write;
}

struct cmd_node router_node = {
.name = "openfabric",
.node = OPENFABRIC_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
.config_write = isis_config_write,
};
#else
/* IS-IS configuration write function */
static int isis_config_write(struct vty *vty)
Expand All @@ -2143,14 +2151,15 @@ static int isis_config_write(struct vty *vty)

return write;
}
#endif /* ifdef FABRICD */

struct cmd_node router_node = {
.node = ROUTER_NODE,
.name = "isis",
.node = ISIS_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
.config_write = isis_config_write,
};
#endif /* ifdef FABRICD */

void isis_init(void)
{
Expand Down
1 change: 1 addition & 0 deletions ldpd/ldp_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ struct ldp_debug ldp_debug;

/* Debug node. */
struct cmd_node ldp_debug_node = {
.name = "debug",
.node = DEBUG_NODE,
.prompt = "",
};
Expand Down
7 changes: 7 additions & 0 deletions ldpd/ldp_vty_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,42 +38,49 @@ static int ldp_vty_get_af(struct vty *);
static int ldp_iface_is_configured(struct ldpd_conf *, const char *);

struct cmd_node ldp_node = {
.name = "ldp",
.node = LDP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-ldp)# ",
};

struct cmd_node ldp_ipv4_node = {
.name = "ldp ipv4",
.node = LDP_IPV4_NODE,
.parent_node = LDP_NODE,
.prompt = "%s(config-ldp-af)# ",
};

struct cmd_node ldp_ipv6_node = {
.name = "ldp ipv6",
.node = LDP_IPV6_NODE,
.parent_node = LDP_NODE,
.prompt = "%s(config-ldp-af)# ",
};

struct cmd_node ldp_ipv4_iface_node = {
.name = "ldp ipv4 interface",
.node = LDP_IPV4_IFACE_NODE,
.parent_node = LDP_IPV4_NODE,
.prompt = "%s(config-ldp-af-if)# ",
};

struct cmd_node ldp_ipv6_iface_node = {
.name = "ldp ipv6 interface",
.node = LDP_IPV6_IFACE_NODE,
.parent_node = LDP_IPV6_NODE,
.prompt = "%s(config-ldp-af-if)# ",
};

struct cmd_node ldp_l2vpn_node = {
.name = "ldp l2vpn",
.node = LDP_L2VPN_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-l2vpn)# ",
};

struct cmd_node ldp_pseudowire_node = {
.name = "ldp",
.node = LDP_PSEUDOWIRE_NODE,
.parent_node = LDP_L2VPN_NODE,
.prompt = "%s(config-l2vpn-pw)# ",
Expand Down
1 change: 1 addition & 0 deletions lib/agentx.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ static void agentx_events_update(void)
/* AgentX node. */
static int config_write_agentx(struct vty *vty);
static struct cmd_node agentx_node = {
.name = "smux",
.node = SMUX_NODE,
.prompt = "",
.config_write = config_write_agentx,
Expand Down
Loading

0 comments on commit bfec662

Please sign in to comment.