Skip to content
This repository has been archived by the owner on Oct 11, 2020. It is now read-only.

Junos configuration

Khelil Sator edited this page Feb 10, 2019 · 2 revisions

we will the python script configure_junos.py to configure the lab.

This script uses:

It generates the junos configuration for each device in the inventory.yml file and load the junos configuration on devices.

Install the requirements:

$ sudo apt install python-pip
$ pip install junos-eznc
$ pip install jinja2

Run this command to update the devices inventory file:

$ vi inventory.yml

Run this command to configure the lab:

$ python configure_junos.py
configured device vMX1
configured device vMX2
configured device vMX3
configured device vMX4
configured device vMX5
configured device vMX6
configured device vMX7

The generated junos configuration files are saved in the directory configure_junos.
This includes BGP, interfaces configuration, SNMP, gPRC, ...

$ ls configure_junos

ssh to a junos device and check bgp sessions state. The sessions should be established.
To audit BGP sessions using Python, run this command:

$ python audit_junos.py
vMX1
bgp session with peer 192.168.1.1+179 is Established
bgp session with peer 192.168.1.3+179 is Established
bgp session with peer 192.168.1.5+179 is Established
bgp session with peer 192.168.1.7+61628 is Established
vMX2
bgp session with peer 192.168.2.1+179 is Established
bgp session with peer 192.168.2.3+179 is Established
bgp session with peer 192.168.2.5+179 is Established
bgp session with peer 192.168.2.7+179 is Established
vMX3
bgp session with peer 192.168.3.1+179 is Established
bgp session with peer 192.168.3.3+64639 is Established
bgp session with peer 192.168.3.5+179 is Established
bgp session with peer 192.168.3.7+61672 is Established
vMX4
bgp session with peer 192.168.1.0+55338 is Established
bgp session with peer 192.168.2.0+63710 is Established
bgp session with peer 192.168.3.0+55353 is Established
vMX5
bgp session with peer 192.168.1.2+57685 is Established
bgp session with peer 192.168.2.2+61875 is Established
bgp session with peer 192.168.3.2+179 is Established
vMX6
bgp session with peer 192.168.1.4+55251 is Established
bgp session with peer 192.168.2.4+58983 is Established
bgp session with peer 192.168.3.4+53866 is Established
vMX7
bgp session with peer 192.168.1.6+179 is Established
bgp session with peer 192.168.2.6+59682 is Established
bgp session with peer 192.168.3.6+179 is Established