A
A
Alexander Efremov2012-11-10 15:33:01
Cisco
Alexander Efremov, 2012-11-10 15:33:01

How to quickly make many similar text configuration files for network equipment (Cisco, Huawei etc)?

Colleagues, advice is needed
A typical situation for a network engineer:
A few dozen new equipment of the same type is installed on the network. It is necessary to prepare text-files with a configuration for each new piece of iron. These text files will basically be the same, only unique values ​​will differ in them, such as IP addresses, ports, etc. In some form, there is a plate with all these unique parameters. Let's say we fully configured and tested one piece of iron.
Question:
How can we quickly and conveniently make configurations for all other network elements from a plate with unique parameter values ​​for each network element and one completely ready-made configuration?
The situation is complicated by the fact that configurations contain repeating pieces, in which values ​​are substituted according to certain simple rules. A real example would be verbose and complex, but the gist is something like this:

...
modul 3 port 1 port_id 3001
modul 3 port 2 port_id 3002
modul 3 port 3 port_id 3003
...
modul 4 port 4 port_id 4003
modul 4 port 5 port_id 4004
modul 4 port 6 port_id 4005
...

The engineers of my company, with whom I have communicated, use Excel for this. But, it seems to me that this is far from the most convenient method of solving the problem. Here, it seems to me, it would be more convenient to use templating systems as in web programming in numerous CMS and frameworks.
I did not find anything suitable in the search engines. I’ve already set up to write my own bicycle: a simple templating system for such cases in Python + template syntax highlighting in Sublime Text 2. But first I would like to ask Habr who and how solves such problems in their practice?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
W
Wott, 2012-11-10
@Wott

I have a table of nodes in mysql in which there are a lot of parameters, some of which are taken from nagios (but I remake them on zabbix), sometimes from asterisks
Including the type of piece of iron, which corresponds to a simple template in another table
And a simple form on the web that creates edits/deletes the node and makes the config by substituting the parameters.
Actually, before me there was a similar system to an asterisk (without configs), and I slightly adapted it for network equipment
. Templates cover only a part - dlink and rwr (we have a lot of them). Tsiski in the kernel differ more strongly from each other in order to make templates for them.
Everything is just like a bicycle :)
What I want is to completely get away from manual work in the part where you can template. Like dhcp twitched, they determined the type by mac - you can go to the terminal, they determined exactly the piece of iron - they found its type, found its place on the network and slam into it with a config. And a new node on the map happily blinked green.

N
Nikolai Turnaviotov, 2012-11-10
@foxmuldercp

I can’t say for the very tricky parameters in the Cisco settings, but, let’s say, simple things like setting up ports, dns, vlans, interface management, radius / tax for those 26x, 35x, 37x and 18x pieces of iron that I have at work have no problems arose, the details were only in the settings of trunk ports on pieces of iron that had not only dot1x encapsulation, but on some especially smart ones, routing had to be turned off and routing was prescribed, otherwise the piece of iron was not available via the management interface.
I would do this:
1. merged the configs from all the pieces of iron into one place
2. typed different config options
3. created a configuration generator in my favorite language with the necessary settings - dns, snmp, management, etc. using the templates from point 2.
4. set up a tftp/ftp server with balancing and a heartbeat according to guides from vendors for issuing firmware and configurations
to hardware.
5. tested downloading and receiving firmware on devices over the network and their correct launch.
6. configured the creation/updating of nodes in the monitoring system based on the log from ftp/tftp — i.e. let's say the node received the firmware and configuration, respectively, received some address, and it's not a fact that it is in the monitoring and the profiles in the monitoring system that will be connected to the piece of iron.
7. launched it all in production.
Perhaps I missed some points, but I suspect that this will already depend on the network topology

A
Alexander Efremov, 2012-11-10
@siberianMan

“I created a configuration generator in my favorite language” - this is the moment I just wanted to avoid. Well, I guess I'll have to write anyway.

T
tgz, 2012-11-12
@tgz

Stupidly I create what is needed in vim. If there are too many, then sed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question