Network Automation Cookbook
上QQ阅读APP看书,第一时间看更新

Automating Juniper Devices in the Service Providers Using Ansible

In this chapter, we will outline how to automate Juniper devices running the Junos OS software in a typical service provider (SP) environment. We will explore how to interact with Juniper devices using Ansible, and how to provision different services and protocols on Juniper devices using various Ansible modules. We will base our illustration on the following sample network diagram of a basic SP network:

The following table outlines the devices in our sample topology and their respective management Internet Protocols (IPs):

      

The main recipes covered in this chapter are as follows:

  • Building the network inventory
  • Connecting and authenticating to Juniper devices
  • Enabling the Network Configuration Protocol (NETCONF) on Junos OS devices
  • Configuring generic system options on Juniper devices
  • Configuring interfaces on Juniper devices
  • Configuring Open Shortest Path First (OSPF) on Juniper devices
  • Configuring Multiprotocol Label Switching (MPLS) on Juniper devices
  • Configuring the Border Gate Protocol (BGP) on Juniper devices
  • Deploying configuration on Juniper devices
  • Configuring the Layer 3 virtual private network (L3VPN) service on Juniper devices
  • Gathering Juniper device facts using Ansible
  • Validating network reachability on Juniper devices
  • Retrieving operational data from Juniper devices
  • Validating the network state using PyEZ operational tables

Device           Role           Vendor           Management (MGMT) Port           MGMT IP

           

mxp01           P Router           Juniper vMX 14.1           fxp0           172.20.1.2

           

mxp02           P Router           Juniper vMX 14.1           fxp0           172.20.1.3

           

mxpe01           PE Router           Juniper vMX 14.1           fxp0           172.20.1.4

           

mxpe02           PE Router           Juniper vMX 17.1           fxp0           172.20.1.5