Connecting cRPD using PyEZ
What is cRPD?
Containerized routing protocol process (cRPD) is Juniper’s routing protocol process (rpd) decoupled from Junos OS and packaged as a Docker container to run in Linux-based environments. rpd runs as a user-space application and learns route state through various routing protocols and maintains the complete set in routing information base (RIB), also known as the routing table. The rpd process is also responsible for downloading the routes into the forwarding information base (FIB) also known as the forwarding table based on local selection criteria. Whereas the Packet Forwarding Engine (PFE) in Juniper Networks router holds the FIB and does packet forwarding, for cRPD. The host Linux kernel stores the FIB and performs packet forwarding. cRPD can also be deployed to provide control plane-only services such as BGP route reflection.
What is PyEZ?
Junos PyEZ is a microframework for Python that enables you to manage and automate devices running the Junos operating system (Junos OS). Junos PyEZ is designed to provide the capabilities that a user would have on the Junos OS command-line interface (CLI) in an environment built for automation tasks. Junos PyEZ enables you to directly connect to a device using a serial console connection, telnet, or a NETCONF session over SSH. In addition, Junos PyEZ also supports connecting to the device through a telnet or SSH connection to a console server that is connected to the device’s CONSOLE port.
Where can I download cRPD container?
There are two ways to download the software:
- Juniper software download page
- Juniper Docker Registry
How can I download it from the docker registry?
- Log into the Juniper Internal Docker registry using the login name and password that you received as part of the sales fulfillment process when ordering cRPD.
root@ubuntu:~# docker login hub.juniper.net -u <username> -p <password>
2. Pull the docker image from the download site using the following command:
- Juniper software download page
- Juniper Docker Registry
How can I download it from the docker registry?
- Log into the Juniper Internal Docker registry using the login name and password that you received as part of the sales fulfillment process when ordering cRPD.
root@ubuntu:~# docker login hub.juniper.net -u <username> -p <password>
- Pull the docker image from the download site using the following command:
root@ubuntu:~# docker pull hub.juniper.net/routing/crpd:latest
- Verify images in docker image repository
regress@choc-esxi6-b-vm8:~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
crpd latest a35844302e59 34 hours ago 277MB
How to run and execute cRPD containers?
- Run the docker image using the command
root@ubuntu:~#docker run -d crpd
- Execute the docker using docker container id
root@ubuntu:~#docker exec -it 1810 /bin/bash
===>
Containerized Routing Protocols Daemon (CRPD)
Copyright © 2020, Juniper Networks, Inc. All rights reserved.
<===
root@1810e4ef04a9:/# cli
root@1810e4ef04a9> show version
Hostname: 1810e4ef04a9
Model: cRPD
cRPD package version : 19.1built by _cd-builder on 2020–03–13 10:26:28 UTC
root@1810e4ef04a9>
- Set the root password in the cRPD container
root@1810e4ef04a9:~# sudo passwd root
Enter new UNIX password:
- Run the “docker inspect <containerid>” to get IPaddress of the container
root@ubuntu:~$ docker inspect 181 | grep “IPAddress”
“SecondaryIPAddresses”: null,
“IPAddress”: “172.17.0.3”,
How to connect the cRPD using PyEZ framework?
Below PyEZ code will helps to collect the facts of cRPD container
root@ubuntu:~$ cat simple.py
from jnpr.junos import Device
from pprint import pprint
with Device(host=’172.17.0.3', user=’root’, password=’xxxx’, port = 22) as dev:
pprint (dev.facts)
root@ubuntu:~$ python simple.py
{‘2RE’: None,
‘HOME’: None,
‘RE0’: None,
‘RE1’: None,
‘RE_hw_mi’: None,
‘current_re’: None,
‘domain’: None,
‘fqdn’: ‘1810e4ef04a9’,
‘hostname’: ‘1810e4ef04a9’,
‘hostname_info’: {‘re0’: ‘1810e4ef04a9’},
‘ifd_style’: ‘CLASSIC’,
‘junos_info’: None,
‘master’: None,
‘model’: ‘CRPD’,
‘model_info’: {‘re0’: ‘CRPD’},
‘personality’: None,
‘re_info’: None,
‘re_master’: None,
‘serialnumber’: None,
‘srx_cluster’: None,
‘srx_cluster_id’: None,
‘srx_cluster_redundancy_group’: None,
‘switch_style’: ‘NONE’,
‘vc_capable’: False,
‘vc_fabric’: None,
‘vc_master’: None,
‘vc_mode’: None,
‘version’: ‘0.0I0.0’,
‘version_RE0’: None,
‘version_RE1’: None,
‘version_info’: junos.version_info(major=(0, 0), type=I, minor=0, build=0),
‘virtual’: None}