Python library to manage Extreme Networks devices running EXOS
- netmiko >= 1.4.2
- EXOS version == 16.2
pip install pyEXOS
pip install --upgrade pyEXOS
>>> from pyEXOS import EXOS
>>> device = EXOS(hostname='192.168.1.222', username='admin', password='admin', port=22, timeout=10)
>>> device.open()
>>> from pyEXOS import EXOS
>>> device = EXOS(hostname='192.168.1.222', username='admin', password='admin', protocol='telnet', port=23, timeout=10)
>>> device.open()
>>> device.load_candidate_config(config='configure snmp sysName test-string')
>>> print device.candidate_config
>>> ['configure snmp sysName test-string']
>>> device.discard_config()
>>> print device.candidate_config
>>> None
>>> device.get_running_config()
>>> print device.running_config
>>> [u'...']
>>> device.load_candidate_config(filename='config_merge.txt')
>>> diff = device.compare_merge_config()
>>> print diff
>>> --- running_config.conf
+++ candidate_config.conf
@@ -22,0 +23 @@
+configure snmp sysName test-merge-file
>>> device.commit_config()
>>> device.load_candidate_config(filename='config_replace.txt')
>>> diff = device.compare_replace_config()
>>> print diff
...
>>> device.commit_replace_config()
>>> device.rollback()
>>> device.close()
Logging is facilitated though the python logging module. Once you initilize a logger in your main program, pyexos will emit its messages accordingly.
>>> import logging
>>> import sys
>>> logging.basicConfig(stream=sys.stdout, level=logging.INFO)
Care needs to be taken with the compare_replace_config
method.
Extreme devices natively don't offer a config replace operation.
Based on the diff with the to-be-applied config, pyEXOS will generate a set of commands to remove already existing config lines one by one.
To generate the commands needed for removal, it uses a list of known commands embedded in the module.
If your config holds a command not known to the module, it will ignore the removal, issue a warning, but the command will remain on the device after the replace operation.
The module will have to be updated and the necessary line added to the _generate_commands
function, to be able to remove this command during the replace operation.
Copyright 2018 LINX
Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0