cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

Is there a way to omit all the unused config from a 'show conf'

Is there a way to omit all the unused config from a 'show conf'

Bruce_Garlock
New Contributor II
Coming from a mostly Procurve background, the one thing we are finding more difficult is the CLI output from EXOS. Is there any way to omit the features we aren't using, so there are not show many pages of output when doing a 'show conf' ?
9 REPLIES 9

Bruce_Garlock
New Contributor II
This is even better, Drew - thank you! Another reason why I tell everyone that 'vi' is better than emacs! I had no idea I could use Python. I'm still a newbie to Extreme, and this is a very nice selling point. Thanks again.

Drew_C
Valued Contributor III
You're welcome!
If you want to explore the capabilities of Python in EXOS, there's a lot of good information in the "Scripting" category here on The Hub.
If you want more, you can check out the Python Scripting Guide and documentation on The EXOS Python API, which you may find helpful.

Since you're new to Extreme - you'll likely want to see what you can find in our KB, GTAC Knowledge. New articles are loaded there every day.

Come back and see us... we're a helpful bunch of Extremists!

Drew_C
Valued Contributor III
Bruce, here's a Python script (for EXOS 15.7+) that will do exactly what you're looking for. It was adapted from another script. It's possible that there's a better way, but this works!
You can copy it to your switch as a .py file with TFTP, or just paste the script in through
code:
vi
on the CLI.
class Clean_Config(object):
def process_config(self):
self.cfg_modules = []
print "\nProcessing Configuration...\n\n"
config = exsh.clicmd('show config', capture=True)
config = config.splitlines(True)
print "\n->show configuration\n"
moduleName = ''
moduleStr = ''
configExist = False
for line in config:
if '#' not in line and line != '\n':
moduleStr += line
configExist = True
elif configExist is True and '#' in line:
self.cfg_modules.append(moduleName)
moduleStr = line
moduleName = ''
configExist = False
elif '#' in line:
moduleStr += line
configExist = False
if '# Module ' in line:
moduleName = line.replace('# Module ','')
moduleName = moduleName.replace(' configuration.\n','')
moduleName = moduleName.lower()
elif configExist is True and line == '\n':
moduleStr += line
else:
moduleStr = ''

def main():
cfg = Clean_Config()
cfg.process_config()
for module in cfg.cfg_modules:
cmd = 'show config %s' % module
print exsh.clicmd(cmd, capture=True)

main()

And here's how it looks when executed:
X460_TestSwitch.12 # run script clean_config.py
Processing Configuration...
->show configuration

#
# Module devmgr configuration.
#
configure snmp sysName "X460_TestSwitch"
configure snmp sysContact "support@extremenetworks.com, +1 888 257 3000"
configure sys-recovery-level switch reset

#
# Module vlan configuration.
#
configure vlan default delete ports all
configure vr VR-Default delete ports 1-34
configure vr VR-Default add ports 1-34
configure vlan default delete ports 1-34
create vlan "lp"
configure vlan lp tag 1001
enable loopback-mode vlan lp
create vlan "v1"
configure vlan v1 tag 10
create vlan "v3"
configure vlan v3 tag 30
create vlan "x460g2"
configure vlan x460g2 tag 1500
configure vlan v1 add ports 3 tagged
configure vlan v3 add ports 2 tagged
configure vlan x460g2 add ports 4 tagged
configure vlan v1 ipaddress 10.0.0.1 255.255.255.0
enable ipforwarding vlan v1
configure vlan lp ipaddress 192.168.1.1 255.255.255.0
enable ipforwarding vlan lp
configure vlan v3 ipaddress 30.0.0.2 255.255.255.0
enable ipforwarding vlan v3
configure vlan x460g2 ipaddress 172.16.11.1 255.255.255.0
enable ipforwarding vlan x460g2

#
# Module netTools configuration.
#
configure dns-client add name-server 10.1.1.1 vr VR-Default
configure dns-client add name-server 10.1.1.2 vr VR-Default
configure dns-client add domain-suffix extremenetworks.com
enable dhcp vlan Mgmt

#
# Module ospf configuration.
#
configure ospf routerid 192.168.1.1
enable ospf
create ospf area 0.0.0.2
configure ospf add vlan lp area 0.0.0.0
configure ospf add vlan v1 area 0.0.0.2 link-type point-to-point
configure ospf add vlan v3 area 0.0.0.2 link-type point-to-point
configure ospf add vlan x460g2 area 0.0.0.2 link-type point-to-point

#
# Module thttpd configuration.
#
configure ssl certificate hash-algorithm sha512
Let me know what you think!

-Drew

Drew_C
Valued Contributor III
Hi Bruce,
EXOS 15.7+ natively supports Python Scripting, if you're into that. It wouldn't be very difficult to write up a script that excludes modules that don't give output - we may already have one written that I can share. It might also be a good addition to EXOS' native CLI, but that won't happen overnight šŸ™‚
GTM-P2G8KFN