Day One: Junos® Pyez Cookbook

Day One: Junos® Pyez Cookbook

DAY ONE: JUNOS® PyEZ COOKBOOK Books Networks Juniper Day One: Junos PyEZ Cookbook is a complete network automation cookbook with a set-up guide, a start-up sandbox, and a complete showcase of automation scripts that are readily available on GitHub. The cookbook is a joint effort by Juniper’s engineers and all the many Junos users and customers who want to show you how ‘EZ’ network automation can be. You ONE:DAY don’t have to be a coder when you can leverage Junos as your network OS. DAY ONE: JUNOS® PyEZ COOKBOOK “The decision to read a technical book involves a cost-benefit analysis. ‘Is the information I’m going to learn worth my time and energy?’ If your currently operating a network of Juniper devic- es using the Junos OS command line interface, then the unequivocal answer is ‘Yes!’ Written by an experienced team of Juniper’s customers, ambassadors, partners, and employees, Day One: Junos PyEZ Cookbook demonstrates its authors’ real-world experience in operating and auto- JUNOS Co-written by Juniper Customers, mating networks. More importantly, the book breaks what could be daunting tasks into small Ambassadors, Partners, and Employees and relevant recipes. You will be creating useful network automation tools with the Junos PyEZ library on day one. Happy Automating!” Stacy Smith, Sr. Software Developer for Junos Automation, Juniper Networks, ® Co-Author of Automating Junos Administration COOKBOOK PyEZ IT’S DAY ONE AND YOU HAVE A JOB TO DO, SO LEARN HOW TO: n Understand Basic Python Concepts; Get the Downloads and Resources to Set Up Your Lab n Automate NETCONF Service Activation n Learn Terminal Server Mapping n Check File System Directory Usage on Multiple Devices in Parallel n Configure Devices using Junos PyEZ and Jinja2 Templates n Take a Snapshot on ACXs Access Routers n Extract Operational Data from Devices Running on a Bridge Domain Environment n Reserve Bandwidth for MPLS Access Rings Automate your network tasks n Add a Graphical Interface to the PyEZ Script n Monitor IPSEC Tunnels with Junos PyEZ scripts that n Work with Junos Enhanced Auto-provision Process (JEAP) save time, energy, and efort. n Code PyEZ for On-box Scripts n Automate Network Testing with Junos PyEZ You don’t have to be a coder to n Create a Menu Script for Address Book Editing take advantage of Junos and PyEZ. n Provision L3VPN Services on PE Routers n Identify and Disable Unused Interfaces with Ansible n Track Down IP Conflicts with PyEZ Mellin, Mellin, et. al. n Code a Configuration Audit Using XML Schema (XSD) Klimai, By Peter Klimai, Matt Mellin, Michel Tepper, Jac Backus, Ivan Del Rio ISBN 978-1-941441-59-6 5 3 5 0 0 Juniper Networks Books are singularly focused on network productivity Fernandez, Paul McGinn, Scott Ware, Michelle Zhang, Diogo Montagner, and efficiency. Peruse the complete library at www.juniper.net/books. Stephen Steiner, Ben Dale, Sean Sawtell, and Jessica Garrison 9 781941 441596 DAY ONE: JUNOS® PyEZ COOKBOOK Books Networks Juniper Day One: Junos PyEZ Cookbook is a complete network automation cookbook with a set-up guide, a start-up sandbox, and a complete showcase of automation scripts that are readily available on GitHub. The cookbook is a joint effort by Juniper’s engineers and all the many Junos users and customers who want to show you how ‘EZ’ network automation can be. You ONE:DAY don’t have to be a coder when you can leverage Junos as your network OS. DAY ONE: JUNOS® PyEZ COOKBOOK “The decision to read a technical book involves a cost-benefit analysis. ‘Is the information I’m going to learn worth my time and energy?’ If you’re currently operating a network of Juniper devices using the Junos OS command line interface, then the unequivocal answer is ‘Yes!’ Written by an experienced team of Juniper customers, ambassadors, partners, and employees, Day One: Junos PyEZ Cookbook demonstrates its authors’ real-world experience in operating JUNOS Co-written by Juniper Customers, and automating networks. More importantly, the book breaks what could be daunting tasks Ambassadors, Partners, and Employees into small and relevant recipes. You will be creating useful network automation tools with the Junos PyEZ library on day one. Happy Automating!” Stacy Smith, Sr. Software Developer for Junos Automation, Juniper Networks, ® Co-Author of Automating Junos Administration COOKBOOK PyEZ IT’S DAY ONE AND YOU HAVE A JOB TO DO, SO LEARN HOW TO: n Understand Basic Python Concepts; Get the Downloads and Resources to Set Up Your Lab n Automate NETCONF Service Activation n Learn Terminal Server Mapping n Check File System Directory Usage on Multiple Devices in Parallel n Configure Devices using Junos PyEZ and Jinja2 Templates n Take a Snapshot on ACXs Access Routers n Extract Operational Data from Devices Running on a Bridge Domain Environment n Reserve Bandwidth for MPLS Access Rings Automate your network tasks n Add a Graphical Interface to the PyEZ Script n Monitor IPSEC Tunnels with Junos PyEZ scripts that n Work with Junos Enhanced Auto-provision Process (JEAP) save time, energy, and efort. n Code PyEZ for On-box Scripts n Automate Network Testing with Junos PyEZ You don’t have to be a coder to n Create a Menu Script for Address Book Editing take advantage of Junos and PyEZ. n Provision L3VPN Services on PE Routers n Identify and Disable Unused Interfaces with Ansible n Track Down IP Conflicts with PyEZ Mellin, Mellin, et. al. n Code a Configuration Audit Using XML Schema (XSD) Klimai, By Peter Klimai, Matt Mellin, Michel Tepper, Jac Backus, Ivan Del Rio ISBN 978-1-941441-59-6 5 3 5 0 0 Juniper Networks Books are singularly focused on network productivity Fernandez, Paul McGinn, Scott Ware, Michelle Zhang, Diogo Montagner, and efficiency. Peruse the complete library at www.juniper.net/books. Stephen Steiner, Ben Dale, Sean Sawtell, and Jessica Garrison 9 781941 441596 Day One: Junos® PyEZ Cookbook by Peter Klimai, Matt Mellin, Michel Tepper, Jac Backus, Ivan Del Rio Fernandez, Paul McGinn, Scott Ware, Michelle Zhang, Diogo Montagner, Stephen Steiner, Ben Dale, Sean Sawtell, and Jessica Garrison © 2017 by Juniper Networks, Inc. All rights reserved. Script Software License Juniper Networks, Junos, Steel-Belted Radius, NetScreen, © 2017 Juniper Networks, Inc. All rights reserved. and ScreenOS are registered trademarks of Juniper Licensed under the Juniper Networks Script Software Networks, Inc. in the United States and other countries. License (the “License”). You may not use this script file The Juniper Networks Logo, the Junos logo, and JunosE except in compliance with the License, which is located at are trademarks of Juniper Networks, Inc. All other http://www.juniper.net/support/legal/scriptlicense/. Unless trademarks, service marks, registered trademarks, or required by applicable law or otherwise agreed to in registered service marks are the property of their respective writing by the parties, software distributed under the owners. Juniper Networks assumes no responsibility for License is distributed on an “AS IS” BASIS, WITHOUT any inaccuracies in this document. Juniper Networks WARRANTIES OR CONDITIONS OF ANY KIND, reserves the right to change, modify, transfer, or otherwise either express or implied. revise this publication without notice. © 2017 by Juniper Networks Pvt Ltd. All rights reserved Published by Juniper Networks Books for scripts located at https://github.com/Juniper/junosauto- ISBN: 978-1-941441-59-6 (print) mation/tree/master/pyez/PyEZ_Cookbook_2017. Printed in the USA by Vervante Corporation. ISBN: 978-1-941441-60-2 (ebook) Version History: v1, October, 2017 2 3 4 5 6 7 8 9 10 iviv Table of Contents Table of Contents Part 1: Set Up Guide Recipe 1- Installing Python and PyEZ . 10 Recipe 2 - Enabling NETCONF . 17 Recipe 3 - Hello World! . 20 Recipe 4 - PyEZ Connection Options . 23 Part 2: Basic Scripts Recipe 5- Getting Started Sample . .. 27 Recipe 6 - Automating NETCONF Service Activation . 30 Recipe 7 - PyEZ with Console: Learning Terminal Server Mapping . 33 Recipe 8 - PyEZ with Console: Pushing an Initial Configuration . 35 Recipe 9 - Checking File System Directory Usage on Multiple Devices in Parallel . 37 Recipe 10 - Configuring Devices using Junos PyEZ and Jinja2 Templates . 41 Part 3: PyEZ Showcase Recipe 11 - Benefits of Taking a Snapshot on ACX Series Access Routers . 45 Recipe 12 - Extract Operational Data from Devices Running on a Bridge Domain Environment . 52 Recipe 13 - Bandwidth Reservation for MPLS Access Rings . .. 62 Recipe 14 - Adding a Graphical Interface to the PyEZ Script . 68 Recipe 15 - Monitoring IPSEC Tunnels . 74 Recipe 16 - Working with Junos Enhanced Auto-Provision Process (JEAP) . 78 Recipe 17 - PyEZ for On-Box Scripts . 89 Recipe 18 - Automated Network Testing with Junos PyEZ . 95 Recipe 19 - Menu Script for Address Book Editing . 101 Recipe 20 - Provisioning L3VPN Services on PE Routers . 112 Recipe 21 - Identifying and Disabling Unused Interfaces with Ansible . 129 Recipe 22 - Track Down IP Conflicts with PyEZ . 143 Recipe 23 - Configuration Audit Using XML Schema (XSD) . 180 v Contributors Contributors Peter Klimai currently works as an instructor and content developer at Poplar Systems, a Juniper Networks Authorized Education Partner. He is a Juniper Ambassador and certified JNCIE-SEC #98, JNCIE-ENT #393, JNCIE-SP #2253, JNCIP-DC, and JN- CIS-SDNA. Peter is enthusiastic about network automation using various tools, as well as software-defined networking and network function virtualization. Peter’s past in- cludes several years of experience supporting Juniper equipment for multiple custom- ers of varying sizes, as well as writing a PhD thesis in cosmology. Matt Mellin currently works at Juniper Networks as a data analyst and domain expert within the CTO office’s Data Analytics Group. His group applies machine learning to various network-related issues.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    200 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us