Beispiel #1
0
func installCommands(root *command.CmdNode) {

	command.InstallCommonHelpers(root)

	cmdNone := command.CMD_NONE
	//cmdConH := command.CMD_CONF | command.CMD_HELP
	cmdConH := command.CMD_CONF

	command.CmdInstall(root, cmdConH, "hostname (HOSTNAME)", command.CONF, command.HelperHostname, command.ApplyBogus, "Hostname")
	command.CmdInstall(root, cmdNone, "show version", command.EXEC, cmdVersion, nil, "Show version")
	command.CmdInstall(root, cmdNone, "show rip routes", command.EXEC, cmdShowRipRoutes, nil, "Show RIP routes")
	command.CmdInstall(root, cmdConH, "router rip", command.CONF, cmdRip, applyRip, "Enable RIP protocol")
	command.CmdInstall(root, cmdConH, "router rip interface {IFNAME} cost (RIPMETRIC)", command.CONF, cmdRipIfaceCost, applyRipIfaceCost, "RIP interface cost")
	command.CmdInstall(root, cmdConH, "router rip network {NETWORK}", command.CONF, cmdRipNetwork, applyRipNet, "Insert network into RIP protocol")
	command.CmdInstall(root, cmdConH, "router rip network {NETWORK} cost (RIPMETRIC)", command.CONF, cmdRipNetCost, applyRipNetCost, "RIP network metric")
	command.CmdInstall(root, cmdConH, "router rip network {NETWORK} nexthop {IPADDR}", command.CONF, cmdRipNetNexthop, applyRipNetNexthop, "RIP network nexthop")
	command.CmdInstall(root, cmdConH, "router rip network {NETWORK} nexthop {IPADDR} cost (RIPMETRIC)", command.CONF, cmdRipNetNexthopCost, applyRipNetNexthopCost, "RIP network metric")
	command.CmdInstall(root, cmdConH, "router rip vrf {VRFNAME} network {NETWORK}", command.CONF, cmdRipNetwork, applyRipVrfNet, "Insert network into RIP protocol")
	command.CmdInstall(root, cmdConH, "router rip vrf {VRFNAME} network {NETWORK} cost (RIPMETRIC)", command.CONF, cmdRipNetCost, applyRipVrfNetCost, "RIP network metric")
	command.CmdInstall(root, cmdConH, "router rip vrf {VRFNAME} network {NETWORK} nexthop {IPADDR}", command.CONF, cmdRipNetNexthop, applyRipVrfNetNexthop, "RIP network nexthop")
	command.CmdInstall(root, cmdConH, "router rip vrf {VRFNAME} network {NETWORK} nexthop {IPADDR} cost (RIPMETRIC)", command.CONF, cmdRipNetNexthopCost, applyRipVrfNetNexthopCost, "RIP network metric")

	// Node description is used for pretty display in command help.
	// It is not strictly required, but its lack is reported by the command command.MissingDescription().
	command.DescInstall(root, "hostname", "Assign hostname")
	command.DescInstall(root, "router", "Configure routing")
	command.DescInstall(root, "router rip network", "Insert network into RIP protocol")
	command.DescInstall(root, "router rip network {NETWORK} cost", "RIP network cost")
	command.DescInstall(root, "router rip vrf", "Insert network into RIP protocol for specific VRF")
	command.DescInstall(root, "router rip vrf {VRFNAME}", "Insert network into RIP protocol for specific VRF")
	command.DescInstall(root, "router rip vrf {VRFNAME} network", "Insert network into RIP protocol for specific VRF")
	command.DescInstall(root, "router rip vrf {VRFNAME} network {NETWORK} cost", "RIP network cost")

	command.MissingDescription(root)
}
Beispiel #2
0
func installCommands(root *command.CmdNode) {

	command.InstallCommonHelpers(root)

	cmdNone := command.CMD_NONE
	cmdConf := command.CMD_CONF

	command.CmdInstall(root, cmdConf, "hostname (HOSTNAME)", command.CONF, command.HelperHostname, command.ApplyBogus, "Hostname")
	command.CmdInstall(root, cmdNone, "show version", command.EXEC, cmdVersion, nil, "Show version")
	//command.CmdInstall(root, cmdConf, "router bgp {ASN}", command.CONF, cmdBgp, applyBgp, "Enable BGP protocol")
	command.CmdInstall(root, cmdConf, "router bgp {ASN} neighbor {IPADDR} description {ANY}", command.CONF, cmdNeighDesc, command.ApplyBogus, "BGP neighbor description")
	command.CmdInstall(root, cmdConf, "router bgp {ASN} neighbor {IPADDR} remote-as (ASN)", command.CONF, cmdNeighAsn, applyNeighAsn, "BGP neighbor ASN")

	// Node description is used for pretty display in command help.
	// It is not strictly required, but its lack is reported by the command command.MissingDescription().
	command.DescInstall(root, "hostname", "Assign hostname")

	command.MissingDescription(root)
}
Beispiel #3
0
func installRibCommands(root *command.CmdNode) {

	command.InstallCommonHelpers(root)

	cmdNone := command.CMD_NONE
	cmdConf := command.CMD_CONF
	//cmdConH := command.CMD_CONF | command.CMD_HELP
	cmdConH := cmdConf

	command.CmdInstall(root, cmdConH, "interface {IFNAME} description {ANY}", command.CONF, cmdDescr, command.ApplyBogus, "Interface description")
	command.CmdInstall(root, cmdConH, "interface {IFNAME} ipv4 address {IFADDR}", command.CONF, cmdIfaceAddr, applyIfaceAddr, "Assign IPv4 address to interface")
	command.CmdInstall(root, cmdConH, "interface {IFNAME} ipv6 address {IFADDR6}", command.CONF, cmdIfaceAddrIPv6, command.ApplyBogus, "Assign IPv6 address to interface")
	command.CmdInstall(root, cmdConH, "interface {IFNAME} shutdown", command.CONF, cmdIfaceShutdown, command.ApplyBogus, "Disable interface")
	command.CmdInstall(root, cmdConH, "interface {IFNAME} vrf {VRFNAME}", command.CONF, cmdIfaceVrf, applyIfaceVrf, "Interface VRF")
	command.CmdInstall(root, cmdConH, "ip routing", command.CONF, cmdIPRouting, command.ApplyBogus, "Enable IP routing")
	command.CmdInstall(root, cmdConH, "hostname (HOSTNAME)", command.CONF, cmdHostname, command.ApplyBogus, "Assign hostname")
	command.CmdInstall(root, cmdNone, "show interface", command.EXEC, cmdShowInt, nil, "Show interfaces")
	command.CmdInstall(root, cmdNone, "show", command.EXEC, cmdShowInt, nil, "Ugh") // duplicated command
	command.CmdInstall(root, cmdNone, "show ip address", command.EXEC, cmdShowIPAddr, nil, "Show addresses")
	command.CmdInstall(root, cmdNone, "show ip interface", command.EXEC, cmdShowIPInt, nil, "Show interfaces")
	command.CmdInstall(root, cmdNone, "show ip interface detail", command.EXEC, cmdShowIPInt, nil, "Show interface detail")
	command.CmdInstall(root, cmdNone, "show ip route", command.EXEC, cmdShowIPRoute, nil, "Show routing table")
	command.CmdInstall(root, cmdNone, "show version", command.EXEC, cmdVersion, nil, "Show version")
	command.CmdInstall(root, cmdConf, "vrf {VRFNAME} ipv4 import route-target {RT}", command.CONF, cmdVrfImportRT, command.ApplyBogus, "Route-target for import")
	command.CmdInstall(root, cmdConf, "vrf {VRFNAME} ipv4 export route-target {RT}", command.CONF, cmdVrfExportRT, command.ApplyBogus, "Route-target for export")

	// Node description is used for pretty display in command help.
	// It is not strictly required, but its lack is reported by the command command.MissingDescription().
	command.DescInstall(root, "hostname", "Assign hostname")
	command.DescInstall(root, "interface", "Configure interface")
	command.DescInstall(root, "interface {IFNAME}", "Configure interface parameter")
	command.DescInstall(root, "interface {IFNAME} description", "Configure interface description")
	command.DescInstall(root, "interface {IFNAME} ipv4", "Configure interface IPv4 parameter")
	command.DescInstall(root, "interface {IFNAME} ipv6", "Configure interface IPv6 parameter")
	command.DescInstall(root, "interface {IFNAME} ipv4 address", "Configure interface IPv4 address")
	command.DescInstall(root, "interface {IFNAME} ipv6 address", "Configure interface IPv6 address")
	command.DescInstall(root, "interface {IFNAME} vrf", "Assign VRF to interface")
	command.DescInstall(root, "ip", "Configure IP parameter")
	command.DescInstall(root, "show ip", "Show IP information")
	command.DescInstall(root, "vrf", "Configure VRF")
	command.DescInstall(root, "vrf {VRFNAME}", "Configure VRF parameter")
	command.DescInstall(root, "vrf {VRFNAME} ipv4", "Configure VRF IPv4 parameter")
	command.DescInstall(root, "vrf {VRFNAME} ipv4 import", "Configure VRF import")
	command.DescInstall(root, "vrf {VRFNAME} ipv4 export", "Configure VRF export")
	command.DescInstall(root, "vrf {VRFNAME} ipv4 import route-target", "Import route target")
	command.DescInstall(root, "vrf {VRFNAME} ipv4 export route-target", "Export route target")

	command.MissingDescription(root)
}