EXOS configuration scripting tool

  • 0
  • 2
  • Question
  • Updated 3 weeks ago
  • Answered
Hi,

Going to throw this out there in the hope the community has some ideas.

I often find myself building configs with a lot of repative configuration statements, so was looking for a means of automating this.

Have played a little with python, but I'm very new to it so can't quit adopt it for use.

Found this article https://codingnetworker.com/2015/09/configuration-generator-with-python-and-jinja2/ where I changed the config to match EXOS and used a CSV file to fill in the parameters:

create vlan "{{ vlan-name }}"
configure vlan {{ vlan-name }} tag {{ vlan-number }}
configure vlan {{ vlan-name }} add ports 1:29,1:34 tagged
configure vlan {{ vlan-name }} ipaddress {{ vlan-ip }} 255.255.255.0
enable ipforwarding vlan {{ vlan-name }}
configure elrp-client periodic {{ vlan-name }} ports 61,1 interval 1 log-and-trap disable-port ingress permanent
enable bootprelay ipv4 vlan {{ vlan-name }}
create vrrp vlan {{ vlan-name }} vrid 1
configure vrrp vlan {{ vlan-name }} vrid 1 add {{ vlan-vip }}
configure vrrp vlan {{ vlan-name }} vrid 1 priority 150
enable vrrp vlan {{ vlan-name }} vrid 1
configure ospf vlan {{ vlan-name }} priority 0
configure ospf add vlan {{ vlan-name }} area 0.0.0.0 passive

This worked fine, except the elements above I need to repeat for every parameter listed. For example I might have 100 'vlan-name', 'vlan-number', 'vlan-ip' etc

So I need it to cyclic through each of the parameters and stop when finished. Although the article details the use of JSON which might do the trick, the preparation of that file would take too long. Whereas the creation of a CSV file with all the details in would be much easier and quicker to create.

Perhaps there is an easier way to do it, or something that already exits?

Look forward to any answers.

Thanks in advance
Photo of Martin Flammia

Martin Flammia

  • 6,326 Points 5k badge 2x thumb

Posted 1 year ago

  • 0
  • 2
Photo of Chad Smith

Chad Smith, Alum

  • 5,660 Points 5k badge 2x thumb
Martin,

A few questions.  Are you trying to automate configurations for multiple switches or a single switch?  

If a single switch, then are you trying to create a script that will run directly on the switch and configure it live or something that will build a .xsf file that can later be executed on a switch?
Photo of Martin Flammia

Martin Flammia

  • 6,326 Points 5k badge 2x thumb
Hi Chad,

Thanks for getting back.

Generally I just create a config in a text editor, then just squirt it in (easier to see any errors then). In this instance it would be for just one switch and hopefully an easier option than configuring directly on the switch or creating an .xsf.

It would be handy to have some kind of templating tool, that I could (take for example the config above) and get it to repeat over for all the entries I might have in a spreadsheet - that would be perfect!

95% bulk of the config would then be created, and I can just add the common elements I use in all my configs to fill the rest out - which wouldn't take long.

Its hours of work I could save by automating the repetitive commands with just the unique elements like VLAN name, Number, IP etc, that could be many hundreds of lines of code.

Thanks.
Photo of Larry Kunz

Larry Kunz, Employee

  • 1,570 Points 1k badge 2x thumb
Hi, Martin. Chapter 8 of the EXOS User Guide  describes how to do CLI scripting. Here's a link to the first page of the chapter. Perhaps you'll find it helpful.

Larry Kunz
Information Development
Extreme Networks
Photo of Martin Flammia

Martin Flammia

  • 6,326 Points 5k badge 2x thumb
Hi Larry,

Thanks for the information.

Had seen this previously, and I can see its value but not in what I want to achieve - although admittedly some of it goes over my head.

To take an example from the section you gave, this piece of code is given:

enable cli scripting
Set var count 1
while ($count < 101) do
Create vlan v$count
configure vlan v$count ipaddress 10.$(count).1.1/16
set var count ($count + 1)
endwhile
show vlan

This is useful in creating a 100 VLANs should the IP address used be uniform to (count), but this is rarely the case, and the method couldn't be used to supplement a Name that could be anything, and a tag number that also wouldn't be uniform to a count.

The information I need to enter though I already have in a spreadsheet that I used to create a schema, so I can extrapolate any of that information in any form, but I need to be able to add it on mass to make the config generator of any use, as it could be hundreds of different lines.

Do yo know anyway to do that with anything that exists within Extreme or any tool that might be good at the job?

Many thanks
Photo of EtherMAN

EtherMAN, Embassador

  • 7,370 Points 5k badge 2x thumb
What you are asking about is built into Netsight.  There are many canned scripts that can be run on single or groups of switches ... Port groups ect.  The power of scripting is being able to create a command and make configuration changes in the switches with less chance of human error.. We for example have a unique script for each of our EAPS rings that anytime we need to create and add a new vlan to a ring all the engineers need to do is go to the correct port group map for that ring and run the script.  It prompts them for the the vlan tag and name... the rest is built into the script.  

Same thing would apply if you need to say change something in all your devices ... single script run on hundreds of switches 10 or 20 at a time till it's done... If you dont have Netsight then get a demo key up and running and you can see how the scripts are triigger and used and over time you build your own library of scripts unique to you
Photo of Martin Flammia

Martin Flammia

  • 6,326 Points 5k badge 2x thumb
Thanks all for you help, but managed to manipulate the python script to give what I want. I'll try and figure out a way to share how it works, but I'll explain a little here.

Have created three files:

  • EXOS_json_based_config_generator.py
  • EXOS_parameters.json
  • EXOS_with_vlan.j2
The file EXOS_with_vlan.j2 holds the config I want to replicate \ repeat, and looks like the following:

{% for vlan in vlans %}
create vlan "{{ vlan.name }}"
configure vlan {{ vlan.name }} tag {{ vlan.number }}
configure vlan {{ vlan.name }} add ports 1:29,1:34 tagged
configure vlan {{ vlan.name }} ipaddress {{ vlan.ip }} 255.255.255.0
enable ipforwarding vlan {{ vlan.name }}
configure elrp-client periodic {{ vlan.name }} ports 61,1 interval 1 log-and-trap disable-port ingress permanent
enable bootprelay ipv4 vlan {{ vlan.name }}
create vrrp vlan {{ vlan.name }} vrid 1
configure vrrp vlan {{ vlan.name }} vrid 1 add {{ vlan.vip }}
configure vrrp vlan {{ vlan.name }} vrid 1 priority 150
enable vrrp vlan {{ vlan.name }} vrid 1
configure ospf vlan {{ vlan.name }} priority 0
configure ospf add vlan {{ vlan.name }} area 0.0.0.0 passive
{% endfor %}

The EXOS_parameters.json file contains the dictionary elements I want to repeat in the config above. Now to create that file I simply take a CSV format of my details, which look like the following:

name	number	ip	vip
Hyper-V 100 10.0.0.253 10.0.0.254
DC-Controllers 10 10.0.1.253 10.0.1.254
SQL-Database 20 10.0.2.253 10.0.2.254
App-Servers 30 10.0.3.253 10.0.3.254
Web-Servers 40 10.0.4.253 10.0.4.254
Print-Servers 50 10.0.5.253 10.0.5.254
Email-Services 60 10.0.6.253 10.0.6.254
Citrix-Server 70 10.0.7.253 10.0.7.254
File-Server 80 10.0.8.253 10.0.8.254
Security-Apps 90 10.0.9.253 10.0.9.254
Firewall 106 10.0.10.253 10.0.10.254
Remote-VPN 110 10.0.11.253 10.0.11.254
Wireless 150 10.0.15.253 10.0.15.254
VoIP -servers 120 10.0.20.253 10.0.20.254
Building Services 160 10.0.60.253 10.0.60.254
SwipeCard 170 10.0.70.253 10.0.70.254
CCTV 180 10.0.80.253 10.0.80.254
BEMS 190 10.0.90.253 10.0.90.254
iSCSI 1240 10.0.240.253 10.0.240.254
Point-to-Point 1254 10.0.254.253 10.0.254.254
Core-MGMT 1255 10.0.255.253 10.0.255.254

And then just run it through an online CSV to JSON converter like the following:

http://www.csvjson.com/csv2json

The output I save to the EXOS_parameters.json file.

When done I just run the following script "EXOS_json_based_config_generator.py", and wallah!!!

You get the config output below in a text file, and all I had to do was input the parameters - will save me a whole bunch of time :)

create vlan "Hyper-V"
configure vlan Hyper-V tag 100
configure vlan Hyper-V add ports 1:29,1:34 tagged
configure vlan Hyper-V ipaddress 10.0.0.253 255.255.255.0
enable ipforwarding vlan Hyper-V
configure elrp-client periodic Hyper-V ports 61,1 interval 1 log-and-trap disable-port ingress permanent
enable bootprelay ipv4 vlan Hyper-V
create vrrp vlan Hyper-V vrid 1
configure vrrp vlan Hyper-V vrid 1 add 10.0.0.254
configure vrrp vlan Hyper-V vrid 1 priority 150
enable vrrp vlan Hyper-V vrid 1
configure ospf vlan Hyper-V priority 0
configure ospf add vlan Hyper-V area 0.0.0.0 passive
create vlan "DC-Controllers"
configure vlan DC-Controllers tag 10
configure vlan DC-Controllers add ports 1:29,1:34 tagged
configure vlan DC-Controllers ipaddress 10.0.1.253 255.255.255.0
enable ipforwarding vlan DC-Controllers
configure elrp-client periodic DC-Controllers ports 61,1 interval 1 log-and-trap disable-port ingress permanent
enable bootprelay ipv4 vlan DC-Controllers
create vrrp vlan DC-Controllers vrid 1
configure vrrp vlan DC-Controllers vrid 1 add 10.0.1.254
configure vrrp vlan DC-Controllers vrid 1 priority 150
enable vrrp vlan DC-Controllers vrid 1
configure ospf vlan DC-Controllers priority 0
configure ospf add vlan DC-Controllers area 0.0.0.0 passive
create vlan "SQL-Database"
configure vlan SQL-Database tag 20
configure vlan SQL-Database add ports 1:29,1:34 tagged
configure vlan SQL-Database ipaddress 10.0.2.253 255.255.255.0
enable ipforwarding vlan SQL-Database
configure elrp-client periodic SQL-Database ports 61,1 interval 1 log-and-trap disable-port ingress permanent
enable bootprelay ipv4 vlan SQL-Database
create vrrp vlan SQL-Database vrid 1
configure vrrp vlan SQL-Database vrid 1 add 10.0.2.254
configure vrrp vlan SQL-Database vrid 1 priority 150
enable vrrp vlan SQL-Database vrid 1
configure ospf vlan SQL-Database priority 0
configure ospf add vlan SQL-Database area 0.0.0.0 passive
create vlan "App-Servers"
configure vlan App-Servers tag 30
configure vlan App-Servers add ports 1:29,1:34 tagged
configure vlan App-Servers ipaddress 10.0.3.253 255.255.255.0
enable ipforwarding vlan App-Servers
configure elrp-client periodic App-Servers ports 61,1 interval 1 log-and-trap disable-port ingress permanent
enable bootprelay ipv4 vlan App-Servers
create vrrp vlan App-Servers vrid 1
configure vrrp vlan App-Servers vrid 1 add 10.0.3.254
configure vrrp vlan App-Servers vrid 1 priority 150
enable vrrp vlan App-Servers vrid 1
configure ospf vlan App-Servers priority 0
configure ospf add vlan App-Servers area 0.0.0.0 passive
create vlan "Web-Servers"
configure vlan Web-Servers tag 40
configure vlan Web-Servers add ports 1:29,1:34 tagged
configure vlan Web-Servers ipaddress 10.0.4.253 255.255.255.0
enable ipforwarding vlan Web-Servers
configure elrp-client periodic Web-Servers ports 61,1 interval 1 log-and-trap disable-port ingress permanent
enable bootprelay ipv4 vlan Web-Servers
create vrrp vlan Web-Servers vrid 1
configure vrrp vlan Web-Servers vrid 1 add 10.0.4.254
configure vrrp vlan Web-Servers vrid 1 priority 150
enable vrrp vlan Web-Servers vrid 1
configure ospf vlan Web-Servers priority 0
configure ospf add vlan Web-Servers area 0.0.0.0 passive
create vlan "Print-Servers"
configure vlan Print-Servers tag 50
configure vlan Print-Servers add ports 1:29,1:34 tagged
configure vlan Print-Servers ipaddress 10.0.5.253 255.255.255.0
enable ipforwarding vlan Print-Servers
configure elrp-client periodic Print-Servers ports 61,1 interval 1 log-and-trap disable-port ingress permanent
enable bootprelay ipv4 vlan Print-Servers
create vrrp vlan Print-Servers vrid 1
configure vrrp vlan Print-Servers vrid 1 add 10.0.5.254
configure vrrp vlan Print-Servers vrid 1 priority 150
enable vrrp vlan Print-Servers vrid 1
configure ospf vlan Print-Servers priority 0
configure ospf add vlan Print-Servers area 0.0.0.0 passive
create vlan "Email-Services"
configure vlan Email-Services tag 60
configure vlan Email-Services add ports 1:29,1:34 tagged
configure vlan Email-Services ipaddress 10.0.6.253 255.255.255.0
enable ipforwarding vlan Email-Services
configure elrp-client periodic Email-Services ports 61,1 interval 1 log-and-trap disable-port ingress permanent
enable bootprelay ipv4 vlan Email-Services
create vrrp vlan Email-Services vrid 1
configure vrrp vlan Email-Services vrid 1 add 10.0.6.254
configure vrrp vlan Email-Services vrid 1 priority 150
enable vrrp vlan Email-Services vrid 1
configure ospf vlan Email-Services priority 0
configure ospf add vlan Email-Services area 0.0.0.0 passive
create vlan "Citrix-Server"
configure vlan Citrix-Server tag 70
configure vlan Citrix-Server add ports 1:29,1:34 tagged
configure vlan Citrix-Server ipaddress 10.0.7.253 255.255.255.0
enable ipforwarding vlan Citrix-Server
configure elrp-client periodic Citrix-Server ports 61,1 interval 1 log-and-trap disable-port ingress permanent
enable bootprelay ipv4 vlan Citrix-Server
create vrrp vlan Citrix-Server vrid 1
configure vrrp vlan Citrix-Server vrid 1 add 10.0.7.254
configure vrrp vlan Citrix-Server vrid 1 priority 150
enable vrrp vlan Citrix-Server vrid 1
configure ospf vlan Citrix-Server priority 0
configure ospf add vlan Citrix-Server area 0.0.0.0 passive
create vlan "File-Server"
configure vlan File-Server tag 80
configure vlan File-Server add ports 1:29,1:34 tagged
configure vlan File-Server ipaddress 10.0.8.253 255.255.255.0
enable ipforwarding vlan File-Server
configure elrp-client periodic File-Server ports 61,1 interval 1 log-and-trap disable-port ingress permanent
enable bootprelay ipv4 vlan File-Server
create vrrp vlan File-Server vrid 1
configure vrrp vlan File-Server vrid 1 add 10.0.8.254
configure vrrp vlan File-Server vrid 1 priority 150
enable vrrp vlan File-Server vrid 1
configure ospf vlan File-Server priority 0
configure ospf add vlan File-Server area 0.0.0.0 passive
create vlan "Security-Apps"
configure vlan Security-Apps tag 90
configure vlan Security-Apps add ports 1:29,1:34 tagged
configure vlan Security-Apps ipaddress 10.0.9.253 255.255.255.0
enable ipforwarding vlan Security-Apps
configure elrp-client periodic Security-Apps ports 61,1 interval 1 log-and-trap disable-port ingress permanent
enable bootprelay ipv4 vlan Security-Apps
create vrrp vlan Security-Apps vrid 1
configure vrrp vlan Security-Apps vrid 1 add 10.0.9.254
configure vrrp vlan Security-Apps vrid 1 priority 150
enable vrrp vlan Security-Apps vrid 1
configure ospf vlan Security-Apps priority 0
configure ospf add vlan Security-Apps area 0.0.0.0 passive
create vlan "Firewall"
configure vlan Firewall tag 106
configure vlan Firewall add ports 1:29,1:34 tagged
configure vlan Firewall ipaddress 10.0.10.253 255.255.255.0
enable ipforwarding vlan Firewall
configure elrp-client periodic Firewall ports 61,1 interval 1 log-and-trap disable-port ingress permanent
enable bootprelay ipv4 vlan Firewall
create vrrp vlan Firewall vrid 1
configure vrrp vlan Firewall vrid 1 add 10.0.10.254
configure vrrp vlan Firewall vrid 1 priority 150
enable vrrp vlan Firewall vrid 1
configure ospf vlan Firewall priority 0
configure ospf add vlan Firewall area 0.0.0.0 passive
create vlan "Remote-VPN"
configure vlan Remote-VPN tag 110
configure vlan Remote-VPN add ports 1:29,1:34 tagged
configure vlan Remote-VPN ipaddress 10.0.11.253 255.255.255.0
enable ipforwarding vlan Remote-VPN
configure elrp-client periodic Remote-VPN ports 61,1 interval 1 log-and-trap disable-port ingress permanent
enable bootprelay ipv4 vlan Remote-VPN
create vrrp vlan Remote-VPN vrid 1
configure vrrp vlan Remote-VPN vrid 1 add 10.0.11.254
configure vrrp vlan Remote-VPN vrid 1 priority 150
enable vrrp vlan Remote-VPN vrid 1
configure ospf vlan Remote-VPN priority 0
configure ospf add vlan Remote-VPN area 0.0.0.0 passive
create vlan "Wireless"
configure vlan Wireless tag 150
configure vlan Wireless add ports 1:29,1:34 tagged
configure vlan Wireless ipaddress 10.0.15.253 255.255.255.0
enable ipforwarding vlan Wireless
configure elrp-client periodic Wireless ports 61,1 interval 1 log-and-trap disable-port ingress permanent
enable bootprelay ipv4 vlan Wireless
create vrrp vlan Wireless vrid 1
configure vrrp vlan Wireless vrid 1 add 10.0.15.254
configure vrrp vlan Wireless vrid 1 priority 150
enable vrrp vlan Wireless vrid 1
configure ospf vlan Wireless priority 0
configure ospf add vlan Wireless area 0.0.0.0 passive
create vlan "VoIP -servers"
configure vlan VoIP -servers tag 120
configure vlan VoIP -servers add ports 1:29,1:34 tagged
configure vlan VoIP -servers ipaddress 10.0.20.253 255.255.255.0
enable ipforwarding vlan VoIP -servers
configure elrp-client periodic VoIP -servers ports 61,1 interval 1 log-and-trap disable-port ingress permanent
enable bootprelay ipv4 vlan VoIP -servers
create vrrp vlan VoIP -servers vrid 1
configure vrrp vlan VoIP -servers vrid 1 add 10.0.20.254
configure vrrp vlan VoIP -servers vrid 1 priority 150
enable vrrp vlan VoIP -servers vrid 1
configure ospf vlan VoIP -servers priority 0
configure ospf add vlan VoIP -servers area 0.0.0.0 passive
create vlan "Building Services"
configure vlan Building Services tag 160
configure vlan Building Services add ports 1:29,1:34 tagged
configure vlan Building Services ipaddress 10.0.60.253 255.255.255.0
enable ipforwarding vlan Building Services
configure elrp-client periodic Building Services ports 61,1 interval 1 log-and-trap disable-port ingress permanent
enable bootprelay ipv4 vlan Building Services
create vrrp vlan Building Services vrid 1
configure vrrp vlan Building Services vrid 1 add 10.0.60.254
configure vrrp vlan Building Services vrid 1 priority 150
enable vrrp vlan Building Services vrid 1
configure ospf vlan Building Services priority 0
configure ospf add vlan Building Services area 0.0.0.0 passive
create vlan "SwipeCard"
configure vlan SwipeCard tag 170
configure vlan SwipeCard add ports 1:29,1:34 tagged
configure vlan SwipeCard ipaddress 10.0.70.253 255.255.255.0
enable ipforwarding vlan SwipeCard
configure elrp-client periodic SwipeCard ports 61,1 interval 1 log-and-trap disable-port ingress permanent
enable bootprelay ipv4 vlan SwipeCard
create vrrp vlan SwipeCard vrid 1
configure vrrp vlan SwipeCard vrid 1 add 10.0.70.254
configure vrrp vlan SwipeCard vrid 1 priority 150
enable vrrp vlan SwipeCard vrid 1
configure ospf vlan SwipeCard priority 0
configure ospf add vlan SwipeCard area 0.0.0.0 passive
create vlan "CCTV"
configure vlan CCTV tag 180
configure vlan CCTV add ports 1:29,1:34 tagged
configure vlan CCTV ipaddress 10.0.80.253 255.255.255.0
enable ipforwarding vlan CCTV
configure elrp-client periodic CCTV ports 61,1 interval 1 log-and-trap disable-port ingress permanent
enable bootprelay ipv4 vlan CCTV
create vrrp vlan CCTV vrid 1
configure vrrp vlan CCTV vrid 1 add 10.0.80.254
configure vrrp vlan CCTV vrid 1 priority 150
enable vrrp vlan CCTV vrid 1
configure ospf vlan CCTV priority 0
configure ospf add vlan CCTV area 0.0.0.0 passive
create vlan "BEMS"
configure vlan BEMS tag 190
configure vlan BEMS add ports 1:29,1:34 tagged
configure vlan BEMS ipaddress 10.0.90.253 255.255.255.0
enable ipforwarding vlan BEMS
configure elrp-client periodic BEMS ports 61,1 interval 1 log-and-trap disable-port ingress permanent
enable bootprelay ipv4 vlan BEMS
create vrrp vlan BEMS vrid 1
configure vrrp vlan BEMS vrid 1 add 10.0.90.254
configure vrrp vlan BEMS vrid 1 priority 150
enable vrrp vlan BEMS vrid 1
configure ospf vlan BEMS priority 0
configure ospf add vlan BEMS area 0.0.0.0 passive
create vlan "iSCSI"
configure vlan iSCSI tag 1240
configure vlan iSCSI add ports 1:29,1:34 tagged
configure vlan iSCSI ipaddress 10.0.240.253 255.255.255.0
enable ipforwarding vlan iSCSI
configure elrp-client periodic iSCSI ports 61,1 interval 1 log-and-trap disable-port ingress permanent
enable bootprelay ipv4 vlan iSCSI
create vrrp vlan iSCSI vrid 1
configure vrrp vlan iSCSI vrid 1 add 10.0.240.254
configure vrrp vlan iSCSI vrid 1 priority 150
enable vrrp vlan iSCSI vrid 1
configure ospf vlan iSCSI priority 0
configure ospf add vlan iSCSI area 0.0.0.0 passive
create vlan "Point-to-Point"
configure vlan Point-to-Point tag 1254
configure vlan Point-to-Point add ports 1:29,1:34 tagged
configure vlan Point-to-Point ipaddress 10.0.254.253 255.255.255.0
enable ipforwarding vlan Point-to-Point
configure elrp-client periodic Point-to-Point ports 61,1 interval 1 log-and-trap disable-port ingress permanent
enable bootprelay ipv4 vlan Point-to-Point
create vrrp vlan Point-to-Point vrid 1
configure vrrp vlan Point-to-Point vrid 1 add 10.0.254.254
configure vrrp vlan Point-to-Point vrid 1 priority 150
enable vrrp vlan Point-to-Point vrid 1
configure ospf vlan Point-to-Point priority 0
configure ospf add vlan Point-to-Point area 0.0.0.0 passive
create vlan "Core-MGMT"
configure vlan Core-MGMT tag 1255
configure vlan Core-MGMT add ports 1:29,1:34 tagged
configure vlan Core-MGMT ipaddress 10.0.255.253 255.255.255.0
enable ipforwarding vlan Core-MGMT
configure elrp-client periodic Core-MGMT ports 61,1 interval 1 log-and-trap disable-port ingress permanent
enable bootprelay ipv4 vlan Core-MGMT
create vrrp vlan Core-MGMT vrid 1
configure vrrp vlan Core-MGMT vrid 1 add 10.0.255.254
configure vrrp vlan Core-MGMT vrid 1 priority 150
enable vrrp vlan Core-MGMT vrid 1
configure ospf vlan Core-MGMT priority 0
configure ospf add vlan Core-MGMT area 0.0.0.0 passive
Photo of Johannes Denninger

Johannes Denninger

  • 492 Points 250 badge 2x thumb
I've built something similiar, very basic with YAML files instead of JSON for easier readability:

https://github.com/joxz/yml2xos

It's configured to my needs but easy to make it fit to other needs.

Ignore the deploy.py it doesn't work :)
Photo of Dave Hammers

Dave Hammers, Dir SW Engineering

  • 3,802 Points 3k badge 2x thumb
I'm not sure if this will do what you want.
In EXOS 22.3 is the USBZTP feature.
As part of that capability, you can clone an entire switch to a USB memory module, including any configuration and then use that to initialize another switch.

The way this might help your needs is if you had a base configuration and EXOS release version you wanted to start with on each switch,
  • Start with your reference switch
  • configure the base configuration you want on all switches
  • save
  • clone to USB
  • insert that USB in a new switch
  • clone from USB
the new switch is now a copy of your reference switch.
  • both EXOS partitions
  • The entire /usr/local/cfg directory
  • licenses are not copied
Some things to keep in mind:
  • the entire configuration directory is cloned, including any scripts, policy files etc.
  • if the reference configuration has IP addresses, they will also be cloned and may need to be changed on the new switch.
Photo of Tim Black

Tim Black

  • 480 Points 250 badge 2x thumb
Martin, I wonder if you've since considered using the relatively new support for EXOS switches in Ansible. Currently, Ansible 2.6 includes only the exos_command module, but it looks like an exos_config module will soon follow, which is exactly what you were asking for, since Ansible uses jinja2 templates. For now, I am choosing to use the more mature and versatile JSONRPC interface to do the same thing.
Photo of Martin Flammia

Martin Flammia

  • 6,326 Points 5k badge 2x thumb
Hi Tim,

Thanks for posting and no, I hadn't! That is a very intriguing idea!

Not seen or used Ansible before but going to start looking into now. 

The python scripting I use works extremely well, and probably shaves days of large projects. This issue with it, is that its not very user friendly i.e. I've gotten to understand it well, but when I pass it on other engineers they don't bother using it because setting it up and interfacing is a little complicated - and it would seem Ansible could have the answer to this.

If I do get to use it I'll post back my experience.

Thanks,

Martin
Photo of Tim Black

Tim Black

  • 480 Points 250 badge 2x thumb
Hi Martin, I've been working towards introducing Ansible at my company for machine configuration management, where machine typically has meant development workstations and servers, native/bare-metal, virtual, or containerized. But from Ansible's perspective, it can work on anythings with ssh and python. I've not used Ansible for switch provisioning, but am intrigued by it, moving forward.

Others at my company have used telnet CLI via python to control these, and I'm now more interested in JSONRPC bc of all the IO handling/parsing it does automatically. We are not a data center type application - we are doing product testing and I'm adding the ability to our test infrastructure to set up, use, and tear down various network topologies via python. You can call Ansible from python application (since Ansible itself is python code) but for our purpose I feel the integration with JSONRPC will be much simpler and can achieve the same things.

The main thing Ansible can do that JSONRPC approach does not (out of the box, anyway) is parallelism and idempotency for you so you can run the same playbook on 100 switches and it will be fast and will only do anything if it determines it needs to. Depending on what you're using these switches for, this may/may not be useful. Cheers!
Photo of Lindsay Hill

Lindsay Hill, Employee

  • 442 Points 250 badge 2x thumb
FYI, exos_command, exos_config and exos_facts are now all in the current shipping GA version of Ansible (2.7). It was published earlier this month.