Hello my friend,
First of I wish you a lot of success and joy in the upcoming 2018 year. May all your dreams come true and all the best to you, your friends and your family. As it’s time to gift presents, I have prepared something for you.
No part of this blogpost could be reproduced, stored in a
retrieval system, or transmitted in any form or by any
means, electronic, mechanical or photocopying, recording,
or otherwise, for commercial purposes without the
prior permission of the author.
You remember, we always start articles with explanation of the topology, both physical and logical. We provide initial configuration files, so that you can copy them to your router and start working. By the way, here is the physical topology, for which I’ve created Ansbile playbooks:
But instead of VLAN 2 I use VLAN 999
To simplify this task, I’ve developed a set of Ansible playbooks, so that we let our PC do all the work himself. Well, almost himself.
Here is my present gift to you: 100_happy_new_year_ansible
Just make sure that in Linux system (or whatever host system, where you have Ansible installed) you have prover hosts files for Ansible and in general:
[root@localhost ansible]# cat /etc/ansible/hosts
This IP addresses must be already configured on your routers. For Nokia (Alcatel-Lucent) SR OS they are configured in BOF and are predefined in my case. For Cisco IOS XRv you need to create very basic config:
For XR4 you just change IPv4 address to 192.168.1.112 as it’s shown in hosts before.
Probably you will use Management Interface then you can configure it there.
How to use present gift?
To be honest, we have discussed all the topics related to creation of parametrized playbooks roughly a year ago. So I won’t explain details how to create it and its code. I’ll explain just what it does.
There are three 3 main Ansible playbooks:
There are also two folders:
- login (contains credentials to access Nokia VSRs, Cisco XRvs and Linux host)
- nodes (contains connectivity parameters to create lab topology)
First of all you start “default_lab_linux.yml”. It performs the following sequence of actions:
- Remove old SSH keys so that you don’t have problems to connect to Nokia SR OS and Cisco IOS XR routers
- Creates new empty file for SSH keys
- Launches KVM VMs with Nokia SR1 and SR2 routers
- Creates corresponding Linux bridges (brctl), sub-interfaces and maps them appropriately
Just after a couple of minutes needed for Nokia VSRs to boot you launch playbook “default_lab_nokia.yml”, which makes the following things happen:
- Set per router corresponding hostnames and chassis-modes
- Provision corresponding cards and MDAs
- Configure physical port and logical sub-interfaces
The last (but not least) playbook “default_lab_cisco.yml” is related to Cisco IOS XRv routers and it does the same actions as the previous one:
- Set per router corresponding hostnames
- Configure logging parameters
- Configure physical interfaces and sub-interfaces
Cisco IOS XRv are running in VMWare VMs, so they aren’t launched automatically. You have to start them manually (and configure code from preparation part). If you run them in KVM, you can also automate their launch based on Nokia VSR example
At the end of the plays, you get full meshed network with two Nokia (Alcatel-Lucent) VSRs, two Cisco IOS XRv and six linux bridges to provide this connectivity (and possibility to monitor these links with Wireshark):
Automation is a key, especially when we step into NFV/SDN era.
Happy labbing and happy New Year!
If you have further questions or you need help with your networks, I’m happy to assist you, just send me message.