EXOS configuration scripting tool
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎08-14-2017 09:21 PM
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
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
12 REPLIES 12
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎08-15-2017 04:00 PM
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
Larry Kunz
Information Development
Extreme Networks
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎08-15-2017 02:16 PM
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.
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.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎08-15-2017 01:29 PM
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?
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?
