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