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.
1
2
3
4
5 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.
Christmas present
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.
You remember, we have discussed how to create basic and more advanced Ansible scripts.
Here is my present gift to you: 100_happy_new_year_ansible
Some preparations
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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 $ cat /etc/ansible/hosts
[linux]
localhost
[nokia]
SR1
SR2
[cisco]
XR3
XR4
$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.101 SR1
192.168.1.102 SR2
192.168.1.111 XR3
192.168.1.112 XR4
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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14 RP/0/0/CPU0:ios#show run
Wed Nov 29 02:21:23.701 UTC
Building configuration...
!! IOS XR Configuration 6.1.2
!! Last configuration change at Wed Nov 29 02:21:14 2017 by cisco
!
interface GigabitEthernet0/0/0/0.999
ipv4 address 192.168.1.111 255.255.255.0
encapsulation dot1q 999
logging events link-status
!
ssh server v2
ssh server vrf default
end
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:
- default_lab_linux
- default_lab_nokia
- default_lab_cisco
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):
Lessons learned
Automation is a key, especially when we step into NFV/SDN era.
Conclusion
Happy labbing and happy New Year!
P.S.
If you have further questions or you need help with your networks, I’m happy to assist you, just send me message.
Support us
BR,
Anton Karneliuk