Show entire port configuration for a specific port

  • 17 April 2018
  • 9 replies
  • 7855 views

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 1.2.3.4 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 1.2.3.4
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
or
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

Any output (pun intended) would be Appreciated :)

Thanks,

~Mike

9 replies

Hi Mike,

you could try show config detail | include "port 3"
followed by show config detail | include "ports 3"

this should show you the port configuration

Regards

Michael
Userlevel 6
Hi Mike,

you could try show config detail | include "port 3"
followed by show config detail | include "ports 3"

this should show you the port configuration

Regards

Michael

Hello, Michael!

You right, this output show you only config lines where clearly written "port 3"
BUT
if in config present line with port-list, like
configure vlan Default add ports 1-6
this configuration isn't visible
🙂

Thank you!
Userlevel 4
Gave it a few trys myself (not very strong in regex). I was able to get at it using two variables:

i port.1$
i ports.1$

this looks for port or ports and caps the end of the query after the first "1".

It's two lines instead of one, but I'm still experimenting to see if EXOS allows any type of grouping (which regex seems to support, but I can't get working on EXOS).

Eric

UPDATE: Scratch that post - not reliable (and not sure why). Still working on it...
Userlevel 4
Okay - maybe...

sho config | i (port 1$|ports 1$)
Have tried this? switch.name # show port config port-numb | I 2 (or 1:2)

This is the output:

Slot-1 switch_name.3 # sho ports configuration port-number | i 1:2
1:2 VR-Default E A ON AUTO 1000 AUTO FULL NONE UTP
%% Refresh display exited by output filter. Use "no-refresh" if applicable.
Userlevel 6
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.

There is some code in this script that could be repurposed to expand port ranges

This script changes port config from one port to another, so the functionality you are looking for is inevitably embedded in it somewhere

This would be a worthwhile feature request
Userlevel 5
For the wildcard regex, may I suggest:
sh config | include " ports* 15$"[/code]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.
i played a bit and figured out that :

show configuration | include "(port |ports |ports all|ports .-.])"
will show you icluding ( all) rages.

not sure if this is parcticable .
Userlevel 3
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:

Slot-1 Stack.9 #% cfg||1:15
alias% show configuration -b ||1:15
configure vr VR-Default delete ports 1:1-34,2:1-34
configure vr VR-Default add ports 1:1-34,2:1-34
configure vlan Default add ports 1:1-12,1:14-34,2:1-12,2:14-23,2:25-34 untagged
configure vlan test add ports 1:15 tagged
Slot-1 Stack.9 #%

...and on a standalone switch...

X440G2-12p-10G4.8 #% cfg||3
alias% show configuration -b ||3
configure vr VR-Default delete ports 1-16
configure vr VR-Default add ports 1-16
configure vlan Default add ports 1-6,9-16 untagged
X440G2-12p-10G4.9 #%

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.

http://www.oranda.fr/ACLI-terminal/
(this is of course not supported in any way by Extreme!)

Reply