I would like to have the entire configuration for a specific port > output in the same way you can view the entire configuration for a vlan with the pipe command.
as an example:
switch.name # show config | i V123
create vlan "V123-x_x" vr vr-xxx-xxx
configure vlan V123-x_x tag 123
configure vlan V123-x_x add ports 2:21, 4:7 tagged
configure vlan V123-x_x ipaddress 188.8.131.52 255.255.255.255
enable ipforwarding V123-x_x
enable bootprelay ipv4 V123-x_x
configure ospf add vlan V123-x_x area x.x.x.x passive
configure ospf vlan V123-x_x priority x
enable stpd S123-x_x auto-bind vlan V123-x_x
create vrrp vlan V123-x_x vrid x
configure vrrp vlan V123-x_x vrid x priority xxx
configure vrrp vlan V123-x_x vrid x preempt delay xx
configure vrrp vlan V123-x_x vrid 1 track-mode any
configure vrrp vlan V123-x_x vrid 1 accept-mode on
configure vrrp vlan V123-x_x vrid 1 add 184.108.40.206
enable vrrp vlan V123-x_x vrid x
!outputs the entire configuration for vlan 123
I would like to do the same thing for a specific port.
Some of the options to output the configuration for a port are:
sh port 1 information detail
show config | i 1 > where 1 is a port #. but 1 doesn't work because there are a lot of other instances where the # 1 is used in a configuration string.
you could do:
show config | i 45 > and the output is fine. but it won't work with the lower port #'s.
What i want output is all of the config and create commands that are applied to the port in question.
Ideally it would like it look something like this:
switch.name # show config | i Port 1 > but you can't do this because you cannot have a space between the word Port and 1. I have tried "Port 1" 'Port 1' Port-1 Port*1 and a few others. But none seem to work.
So... is there a way to have just the configuration commands output for a specific port doing something like this:
switch.name # show config | i Port 1
switch.name # show port config | i config
For some context, it would be the same thing in Cisco IOS when doing this:
switch#sh run int gi1/1
!outputs the configuration for int gi1/1
I think this would require a new argument to "show configuration" CLI command on the switch, where you give it a list of port numbers.
The pipe include will never work here, because it does raw grep on the output and if the port is embedded in a range there can be nothing to match..
You could probably write a Python script to run on the XOS which would obtain the config file and then process it against a list of ports provided...
Or if it can help, this is what I get on my terminal:
But the "advanced" grep capability is done here by the terminal (not the switch).
You are welcome to try it out; it's a home made terminal which I originally wrote for the Avaya switches (now acquired by Extreme) and I have recently extended to work on XOS.
For the wildcard regex, may I suggest:
sh config | include " ports* 15$"that would mean "space followed by port, followed by 0(!) or more occurrences of 's', followed by space, then 15, then end-of-line"
But it does nothing to find config lines with "ports 13-19". If I find the time, I might fiddle with a script. I need to learn scripting on EXOS anyway.
Unfortunately there isn't a simple/easy way to do this. With EXOS ports are usually added to other entities like VLAN, STP, EAPS, etc rather than adding the entities to the ports. As such, ports are referenced in many different forms throughout the different CLI commands. You could create a regex that would cover most situations, but it would likely contain some configuration commands that do not pertain to the port (because it matched on the number). Also, it will not catch commands that contain the port if the port is contained within a port list/range.
You could do this with a script, expanding the port ranges and accounting for the other outliers, but that may be more complicated than you were looking for.