Beispiel #1
0
/**
 * Register `configure system` commands.
 *
 * Those are the commands to configure protocol-independant stuff.
 */
void
register_commands_configure_system(struct cmd_node *configure,
    struct cmd_node *unconfigure)
{
	struct cmd_node *configure_system = commands_new(
		configure,
		"system", "System configuration",
		cmd_check_no_env, NULL, "ports");
	struct cmd_node *unconfigure_system = commands_new(
		unconfigure,
		"system", "System configuration",
		cmd_check_no_env, NULL, "ports");
	struct cmd_node *configure_interface = commands_new(
		configure_system,
		"interface", "Interface related items",
		NULL, NULL, NULL);
	struct cmd_node *unconfigure_interface = commands_new(
		unconfigure_system,
		"interface", "Interface related items",
		NULL, NULL, NULL);

	commands_new(
		commands_new(
			commands_new(configure_system,
			    "description", "Override chassis description",
			    NULL, NULL, NULL),
			NULL, "Chassis description",
			NULL, cmd_store_env_value, "description"),
		NEWLINE, "Override chassis description",
		NULL, cmd_system_description, "system");
	commands_new(
		commands_new(unconfigure_system,
		    "description", "Don't override chassis description",
		    NULL, NULL, NULL),
		NEWLINE, "Don't override chassis description",
		NULL, cmd_system_description, "system");

	commands_new(
		commands_new(
			commands_new(configure_system,
			    "chassisid", "Override chassis ID",
			    NULL, NULL, NULL),
			NULL, "Chassis ID",
			NULL, cmd_store_env_value, "description"),
		NEWLINE, "Override chassis ID",
		NULL, cmd_system_chassisid, "system");
	commands_new(
		commands_new(unconfigure_system,
		    "chassisid", "Don't override chassis ID",
		    NULL, NULL, NULL),
		NEWLINE, "Don't override chassis ID",
		NULL, cmd_system_chassisid, "system");

	commands_new(
		commands_new(
			commands_new(configure_system,
			    "platform", "Override platform description",
			    NULL, NULL, NULL),
			NULL, "Platform description (CDP)",
			NULL, cmd_store_env_value, "platform"),
		NEWLINE, "Override platform description",
		NULL, cmd_system_description, "platform");
	commands_new(
		commands_new(unconfigure_system,
		    "platform", "Don't override platform description",
		    NULL, NULL, NULL),
		NEWLINE, "Don't override platform description",
		NULL, cmd_system_description, "platform");

	commands_new(
		commands_new(
			commands_new(configure_system,
			    "hostname", "Override system name",
			    NULL, NULL, NULL),
			NULL, "System name",
			NULL, cmd_store_env_value, "hostname"),
		NEWLINE, "Override system name",
		NULL, cmd_hostname, NULL);
	commands_new(
		commands_new(unconfigure_system,
		    "hostname", "Don't override system name",
		    NULL, NULL, NULL),
		NEWLINE, "Don't override system name",
		NULL, cmd_hostname, NULL);

        commands_new(
		commands_new(
			commands_new(configure_system,
			    "max-neighbors", "Set maximum number of neighbors per port",
			    cmd_check_no_env, NULL, "ports"),
			NULL, "Maximum number of neighbors",
			NULL, cmd_store_env_value, "max-neighbors"),
		NEWLINE, "Set maximum number of neighbors per port",
		NULL, cmd_maxneighs, NULL);

	commands_new(
		commands_new(
			commands_new(
				commands_new(
					commands_new(configure_system,
					    "ip", "IP related options",
					    NULL, NULL, NULL),
					"management", "IP management related options",
					NULL, NULL, NULL),
				"pattern", "Set IP management pattern",
				NULL, NULL, NULL),
			NULL, "IP management pattern (comma-separated list of wildcards)",
			NULL, cmd_store_env_value, "management-pattern"),
		NEWLINE, "Set IP management pattern",
		NULL, cmd_management, NULL);
	commands_new(
		commands_new(
			commands_new(
				commands_new(unconfigure_system,
				    "ip", "IP related options",
				    NULL, NULL, NULL),
				"management", "IP management related options",
				NULL, NULL, NULL),
			"pattern", "Delete any IP management pattern",
			NULL, NULL, NULL),
		NEWLINE, "Delete any IP management pattern",
		NULL, cmd_management, NULL);

        commands_new(
		commands_new(
			commands_new(configure_interface,
			    "pattern", "Set active interface pattern",
			    NULL, NULL, NULL),
			NULL, "Interface pattern (comma-separated list of wildcards)",
			NULL, cmd_store_env_value, "iface-pattern"),
		NEWLINE, "Set active interface pattern",
		NULL, cmd_iface_pattern, NULL);
        commands_new(
		commands_new(unconfigure_interface,
		    "pattern", "Delete any interface pattern",
		    NULL, NULL, NULL),
		NEWLINE, "Clear interface pattern",
		NULL, cmd_iface_pattern, NULL);

        commands_new(
		commands_new(
			commands_new(configure_interface,
			    "permanent", "Set permanent interface pattern",
			    NULL, NULL, NULL),
			NULL, "Permanent interface pattern (comma-separated list of wildcards)",
			NULL, cmd_store_env_value, "iface-pattern"),
		NEWLINE, "Set permanent interface pattern",
		NULL, cmd_perm_iface_pattern, NULL);
        commands_new(
		commands_new(unconfigure_interface,
		    "permanent", "Clear permanent interface pattern",
		    NULL, NULL, NULL),
		NEWLINE, "Delete any interface pattern",
		NULL, cmd_perm_iface_pattern, NULL);

	commands_new(
		commands_new(configure_interface,
		    "description", "Update interface descriptions with neighbor name",
		    NULL, NULL, NULL),
		NEWLINE, "Update interface descriptions with neighbor name",
		NULL, cmd_update_descriptions, "enable");
	commands_new(
		commands_new(unconfigure_interface,
		    "description", "Don't update interface descriptions with neighbor name",
		    NULL, NULL, NULL),
		NEWLINE, "Don't update interface descriptions with neighbor name",
		NULL, cmd_update_descriptions, NULL);

	commands_new(
		commands_new(configure_interface,
		    "promiscuous", "Enable promiscuous mode on managed interfaces",
		    NULL, NULL, NULL),
		NEWLINE, "Enable promiscuous mode on managed interfaces",
		NULL, cmd_iface_promisc, "enable");
	commands_new(
		commands_new(unconfigure_interface,
		    "promiscuous", "Don't enable promiscuous mode on managed interfaces",
		    NULL, NULL, NULL),
		NEWLINE, "Don't enable promiscuous mode on managed interfaces",
		NULL, cmd_iface_promisc, NULL);

	register_commands_srcmac_type(configure_system);
}
Beispiel #2
0
/**
 * Register `configure system` commands.
 *
 * Those are the commands to configure protocol-independant stuff.
 */
void
register_commands_configure_system(struct cmd_node *configure,
    struct cmd_node *unconfigure)
{
	struct cmd_node *configure_system = commands_new(
		configure,
		"system", "System configuration",
		cmd_check_no_env, NULL, "ports");
	struct cmd_node *unconfigure_system = commands_new(
		unconfigure,
		"system", "System configuration",
		cmd_check_no_env, NULL, "ports");
	struct cmd_node *configure_interface = commands_new(
		configure_system,
		"interface", "Interface related items",
		NULL, NULL, NULL);
	struct cmd_node *unconfigure_interface = commands_new(
		unconfigure_system,
		"interface", "Interface related items",
		NULL, NULL, NULL);

	commands_new(
		commands_new(
			commands_new(configure_system,
			    "description", "Override chassis description",
			    NULL, NULL, NULL),
			NULL, "Chassis description",
			NULL, cmd_store_env_value, "description"),
		NEWLINE, "Override chassis description",
		NULL, cmd_system_description, NULL);

	commands_new(
		commands_new(
			commands_new(configure_system,
			    "platform", "Override platform description",
			    NULL, NULL, NULL),
			NULL, "Platform description (CDP)",
			NULL, cmd_store_env_value, "platform"),
		NEWLINE, "Override platform description",
		NULL, cmd_system_description, NULL);

        commands_new(
		commands_new(
			commands_new(configure_interface,
			    "pattern", "Set active interface pattern",
			    NULL, NULL, NULL),
			NULL, "Interface pattern (comma separated list of wildcards)",
			NULL, cmd_store_env_value, "iface-pattern"),
		NEWLINE, "Set active interface pattern",
		NULL, cmd_iface_pattern, NULL);

	commands_new(
		commands_new(configure_interface,
		    "description", "Update interface descriptions with neighbor name",
		    NULL, NULL, NULL),
		NEWLINE, "Update interface descriptions with neighbor name",
		NULL, cmd_update_descriptions, "enable");
	commands_new(
		commands_new(unconfigure_interface,
		    "description", "Don't update interface descriptions with neighbor name",
		    NULL, NULL, NULL),
		NEWLINE, "Don't update interface descriptions with neighbor name",
		NULL, cmd_update_descriptions, NULL);

	register_commands_srcmac_type(configure_system);
}