I modified the router config collection tool I posted earlier and published it on PyPI. [Tool for centrally acquiring Cisco / Juniper router config] (http://qiita.com/taijijiji/items/620908c1bec27e1ea933)
https://pypi.python.org/pypi/ConfigCollector https://github.com/taijiji/ConfigCollector
It was my first PyPI registration, so it took some time, but I managed to make my PyPI debut.
I wanted to manage the router config with Git, but before Git, it was troublesome to collect the config of the router group in operation, so I made a Config Collector that can collect the config of all routers with one command. I did.
I thought about automating it including the Git command, but "If you concluct, you should manually select it." "If you forcibly upload the router config, which is confidential information, trouble will occur if you make a mistake." The target of this tool is "SSH login to multiple routers" because it was troublesome to implement optional functions such as git remove at the time of error (I'm not sure if there is a need for the troublesome implementation). Get config ・ Limited to "collecting".
By publishing it on PyPI, you can install it with the pip command.
pip install configcolletctor
If you have never used pip, please install pip by referring to this article. [The first packages to include in Python setuptools and pip] (http://www.lifewithpython.com/2012/11/Python-package-setuptools-pip.html)
After installation, run the tool in this way.
configcollector -i [inventory_file] -o [output_dirctory]
[
{
"hostname" : "router1",
"username" : "user1",
"password" : "aaabbbccc",
"ipv4" : "192.168.0.1",
"os" : "JUNOS"
},
{
"hostname" : "router2",
"username" : "user2",
"password" : "aaabbbccc",
"ipv4" : "192.168.0.2",
"os" : "IOS-XR"
},
{
"hostname" : "router3",
"username" : "user3",
"password" : "aaabbbccc",
"ipv4" : "192.168.0.3",
"os" : "IOS"
}
]
Use ConfigCollector as follows.
First, create an output destination directory where the router config is saved.
% mkdir router_config
Run ConfigCollector
% configcollector -i sample_routers.json -o router_config/
Accessing router: router1...
Writing output file "router_config/router1"...
Success : "router_config/router1"!
Accessing router: router2...
Writing output file "router_config/router2"...
Success : "router_config/router2"!
Accessing router: router3...
Writing output file "router_config/router3"...
Success : "router_config/router3"!
Check the created file.
% ls router_config
router1.txt router2.txt router3.txt
% less router1.txt
show configuration | no-more
## Last commit: 2015-05-01 17:00:00 JST by user1
version x.x.x;
system {
host-name router1;
time-zone Asia/Tokyo;
(snip)
that's all.
You can manage the router config acquired by this tool with Git by the following procedure.
% configcollector -i sample_routers.json -o router_config/
% git add router_config/ .
% git commit
% git push
(First time only% git push origin master)
I registered for PyPI for the first time in my life. I'm glad that I was able to join the ranks of decent OSS committers for the first time. There are many places where I don't know how to use PyPI and OSS yet, so I would be grateful if you could give me feedback. https://pypi.python.org/pypi/ConfigCollector https://github.com/taijiji/ConfigCollector
Recommended Posts