SlideShare a Scribd company logo
JUNOS
AUTOMATION
INTRO
DAVID MCKAY
@DAVIDMCKAYV
OFFICE OF THE
NETWORK ENGINEER
• I am not a "Programmer"
• I think about the network & complex networking planning
• I spend a lot of my time fire-fighting the network
• I need automation tools to help me do my job
• I know I need to "level-up" with automation but I need something that helps me get started
• I’d like to use Python since it is shaping up as the standard
THINKING LIKE A
PROGRAMMER
• You do *not* have to be a programmer to be successful in automation.
• In the most simple of terms, programming is the manipulation of data.
• You already know the core concepts of data types and how to manipulate
them, the missing link is the language.
THIS LOOKS FAMILIAR,
BUT WHAT THE HELL IS
GOING ON
IT'S SHOWTIME
BECAUSE I'M GOING TO SAY PLEASE a
TALK TO THE HAND "a is true"
BULLSHIT
TALK TO THE HAND "a is not true"
YOU HAVE NO RESPECT FOR LOGIC
YOU HAVE BEEN TERMINATED
ArnoldC
https://github.com/lha
rtikk/ArnoldC
PYEZ – A LAYERED
APPROACH
Python Shell Python script
IT
Frameworks
Custom
Applications
ncclient
junos-pyez
• Junos specific
• Abstraction Layer
• micro-framework
• NETCONF transport only
• Vendor Agnostic
• No abstractions
• Native Python data types (hash/list)
• Junos specific not required
• XML not required
open-source, Juniper
open-source, Community
interactive simple → complex
INTRO
JunOS has a number of automation options available
• Ansible, www.ansible.com
• Chef, www.chef.io/chef/
• Puppet, www.puppetlabs.com
• Salt, www.saltstack.com
Today we will focus on pyez, www.github.com/Juniper/py-
junos-eznc
• A python library to directly interact with a device’s API via
netconf over SSH
• The JunOS API is primarily XML driven, pyez simplifies
that
INSTALL PYTHON
FRAMEWORK
Install pip
• Type ‘easy_install pip’
• easy_install assumes your system has python on it
• If not, please install python first
• www.python.org
Install the JunOS python framework
• Type ‘pip install junos-eznc’
Optionally install ipython
• Type ‘pip install ipython’
• ipython provides a better python shell than standard python
• This shell is what will be used in this deck
SETUP YOUR DEVICE
JunOS’s API is accessed via SSH and netconf
• Login to your Juniper device
• Type ‘set system services netconf ssh’
• Type ‘commit’
• This will open TCP port 830
• This will need to be done on all devices that want to
participate in automation via netconf
SETUP DEVICE
CONNECTION
We need to open a connection to our device, all scripts or
interactions via the shell will need to use the Device object and
call open() before we do anything
• Type ‘python’ or ‘ipython’ to enter the interactive shell
• Type ‘from jnpr.junos import Device’
• We need to import a class Device, to access to code for
connecting
• Type ‘myDev = Device('192.168.212.129', user='dave',
password='juniper123’)’
• myDev is now our connection variable
• Type ‘myDev.open()’
• If you get a connection error, check your username and
password
• Also check that TCP port 830 is open on your device
MORE SECURE WAY
TO CONNECT
Typing out a plain text password isn’t ideal for a shell or a script,
so we can set it as a local environment variable and call it that
way
• Before starting the python shell (or script) type ‘export
MYSSHPW=“yourSSHPass”’
• This assumes you are using Bash for your shell
• Now we setup the connection like we previously did
• Type ‘python’ or ‘ipython’ to enter the interactive shell
• Type ‘from jnpr.junos import Device’
• Type ‘import os’
• Type ‘sshpass = os.environ['MYSSHPW']’
• This assigns the variable “sshpass” to your ssh password
• Type ‘myDev = Device('192.168.212.129', user='dave',
password=sshpass)’
• Type ‘myDev.open()’
SETUP CONNECTION
VIA SSH KEY
If you want to use an SSH key to login to the device, that is
also possible
• Before starting the python shell (or script) type ‘export
MYSSHPW=“yourSSHPass”’
• This assumes you are using Bash for your shell
• Now we setup the connection like we previously did
• Type ‘python’ or ‘ipython’ to enter the interactive shell
• Type ‘from jnpr.junos import Device’
• Type ‘sshpass = os.environ['MYSSHPW']’
• This assigns the variable “pass” to your ssh password
• Type ‘myDev = Device('192.168.212.129', user='dave',
password=sshpass),
ssh_private_key_file='/home/dave/.ssh/id_rsa'’
• Type ‘myDev.open()’
CHECK SOME FACTS
Now that we have a good connection open let’s see some
device attributes
• Type ‘from pprint import pprint’
• We want a “pretty print” option for printing out our
attributes
• Type ‘pprint( myDev.facts )’
• This should output a python dictionary of device attributes
• But maybe we want to get a specific fact, like a serial
• In this case we use key -> value to grab it
• Type ‘pprint ( myDev.facts['serialnumber'] )’
• This is using our myDev.facts dictionary and calling
the key “serialnumber” to get the serial number’s
value
REFRESH AND CHECK
Some attributes may change like system uptime
• We can refresh the device facts by asking for an update
• Type ‘myDev.facts_refresh()’
• Now we can see if anything has changed
• For instance, the uptime should have incremented
• Type ‘pprint ( myDev.facts['RE0']['up_time'] )’
• Note here that we are accessing a dictionary within a
dictionary
• We are asking for the RE0 key inside our
myDev.facts dict and the up_time key inside of
the RE0 dict
LOOK AT THE
INTERFACES
Perhaps we want to check into our ethernet interfaces
• Type the following block of code:
• This should give you a dictionary of all of your interfaces
and associated attributes
from jnpr.junos.op.ethport import EthPortTable
eths = EthPortTable(myDev)
eths.get()
x = 0
while x < len(eths):
print "Interface: " + eths.keys()[x] + " Information"
print eths[x].items()
x += 1
A BETTER INTERFACE
LIST
This will give a printout of all ethernet interfaces on a device,
whether or not they are up, the corresponding mac address
and duplex setting
from jnpr.junos.op.ethport import EthPortTable
eths = EthPortTable(myDev)
eths.get()
x = 0
while x < len(eths):
print "Interface {} is {}, MAC: {}, Link Mode: {}".format(eths.keys()[x], 
eths[x].oper, eths[x].macaddr, eths[x].link_mode )
x += 1
LOOKING AT THE
ROUTE TABLE
Check out the routing table, but do note, this could be very
memory intensive for tables with huge numbers of routes
from jnpr.junos.op.routes import RouteTable
routes = RouteTable(myDev)
routes.get()
r = 0
while r < len(routes):
print "Route: {}, via interface: {}, protocol: {}".format(routes.keys()[r], 
routes[r].via, routes[r].protocol)
r += 1
UPDATING A CONFIG
TUTORIAL
• https://pynet.twb-tech.com/blog/juniper/juniper-pyez.html
• https://pynet.twb-tech.com/blog/juniper/juniper-pyez-
commit.html
ADVANCED
TECHNIQUES
• Jinja2
• Smart templating system
• SLAX
• On board scripts
• http://www.juniper.net/techpubs/en_US/junos-
pyez1.0/topics/task/program/junos-pyez-program-
configuration-data-loading.html
• JunOS 14.2
• REST API
BONUS - ZTP
• ZTP or Zero-Touch Provisioning allows you to setup a
device without every logging in.
• ZTP utilizes DHCP and (T)FTP/HTTP. With these it can
upgrade code and/or add a configuration to a device.
• ZTP is enabled by default on JUNOS from the factory or
via ‘request system zeroize’.
• ZTP requires DHCP option 43 to be set and serves a
number of suboptions.
• http://www.juniper.net/techpubs/en_US/junos13.3/topics/ta
sk/configuration/software-image-and-configuration-
automatic-provisioning-confguring.html
SUBOPTIONS
• 00 - name of the software image file to install
• 01 - name of the configuration file to install
• 03 - transfer mode (ftp, tftp, http)
NEXT STEPS
• Learn Python
• http://www.codecademy.com/tracks/python
• Juniper Python framework
• https://github.com/Juniper/py-junos-eznc
• Multi-vendor network API abstraction framework
• https://github.com/spotify/napalm
• Zero-Touch Provisioning
• http://www.juniper.net/techpubs/en_US/junos13.2/topics/to
pic-map/ztp-overview-els.html

More Related Content

What's hot

10 minutes fun with Cloud API comparison
10 minutes fun with Cloud API comparison10 minutes fun with Cloud API comparison
10 minutes fun with Cloud API comparison
Laurent Cerveau
 
Play concurrency
Play concurrencyPlay concurrency
Play concurrencyJustin Long
 
Zabbix visión general del sistema - 04.12.2013
Zabbix   visión general del sistema - 04.12.2013Zabbix   visión general del sistema - 04.12.2013
Zabbix visión general del sistema - 04.12.2013Emmanuel Arias
 
Windows Configuration Management: Managing Packages, Services, & Power Shell-...
Windows Configuration Management: Managing Packages, Services, & Power Shell-...Windows Configuration Management: Managing Packages, Services, & Power Shell-...
Windows Configuration Management: Managing Packages, Services, & Power Shell-...
Puppet
 
Splunk Modular Inputs / JMS Messaging Module Input
Splunk Modular Inputs / JMS Messaging Module InputSplunk Modular Inputs / JMS Messaging Module Input
Splunk Modular Inputs / JMS Messaging Module Input
Damien Dallimore
 
London Hashicorp Meetup #22 - Congruent infrastructure @zopa by Ben Coughlan
London Hashicorp Meetup #22 - Congruent infrastructure @zopa by Ben CoughlanLondon Hashicorp Meetup #22 - Congruent infrastructure @zopa by Ben Coughlan
London Hashicorp Meetup #22 - Congruent infrastructure @zopa by Ben Coughlan
Ben Coughlan
 
Creating pools of Virtual Machines - ApacheCon NA 2013
Creating pools of Virtual Machines - ApacheCon NA 2013Creating pools of Virtual Machines - ApacheCon NA 2013
Creating pools of Virtual Machines - ApacheCon NA 2013
Andrei Savu
 
Puppet Release Workflows at Jive Software
Puppet Release Workflows at Jive SoftwarePuppet Release Workflows at Jive Software
Puppet Release Workflows at Jive Software
Puppet
 
Puppet Camp Denver 2015: Nagios Management With Puppet
Puppet Camp Denver 2015: Nagios Management With PuppetPuppet Camp Denver 2015: Nagios Management With Puppet
Puppet Camp Denver 2015: Nagios Management With Puppet
Puppet
 
Vladimir Ulogov - Large Scale Simulation | ZabConf2016 Lightning Talk
Vladimir Ulogov - Large Scale Simulation | ZabConf2016 Lightning TalkVladimir Ulogov - Large Scale Simulation | ZabConf2016 Lightning Talk
Vladimir Ulogov - Large Scale Simulation | ZabConf2016 Lightning Talk
Zabbix
 
Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture
AppDynamics
 
Nagios XI Best Practices
Nagios XI Best PracticesNagios XI Best Practices
Nagios XI Best Practices
Nagios
 
Basic Understanding and Implement of Node.js
Basic Understanding and Implement of Node.jsBasic Understanding and Implement of Node.js
Basic Understanding and Implement of Node.js
Gary Yeh
 
Monitoring Oracle SOA Suite - UKOUG Tech15 2015
Monitoring Oracle SOA Suite - UKOUG Tech15 2015Monitoring Oracle SOA Suite - UKOUG Tech15 2015
Monitoring Oracle SOA Suite - UKOUG Tech15 2015
C2B2 Consulting
 
Nagios, Getting Started.
Nagios, Getting Started.Nagios, Getting Started.
Nagios, Getting Started.
Hitesh Bhatia
 
Elements for an iOS Backend
Elements for an iOS BackendElements for an iOS Backend
Elements for an iOS Backend
Laurent Cerveau
 
Podila mesos con-northamerica_sep2017
Podila mesos con-northamerica_sep2017Podila mesos con-northamerica_sep2017
Podila mesos con-northamerica_sep2017
Sharma Podila
 
Nagios Conference 2011 - Nate Broderick - Nagios XI Large Implementation Tips...
Nagios Conference 2011 - Nate Broderick - Nagios XI Large Implementation Tips...Nagios Conference 2011 - Nate Broderick - Nagios XI Large Implementation Tips...
Nagios Conference 2011 - Nate Broderick - Nagios XI Large Implementation Tips...
Nagios
 
Puppet Camp Melbourne 2014:
Puppet Camp Melbourne 2014: Puppet Camp Melbourne 2014:
Puppet Camp Melbourne 2014: Puppet
 

What's hot (20)

10 minutes fun with Cloud API comparison
10 minutes fun with Cloud API comparison10 minutes fun with Cloud API comparison
10 minutes fun with Cloud API comparison
 
Play concurrency
Play concurrencyPlay concurrency
Play concurrency
 
Zabbix visión general del sistema - 04.12.2013
Zabbix   visión general del sistema - 04.12.2013Zabbix   visión general del sistema - 04.12.2013
Zabbix visión general del sistema - 04.12.2013
 
Windows Configuration Management: Managing Packages, Services, & Power Shell-...
Windows Configuration Management: Managing Packages, Services, & Power Shell-...Windows Configuration Management: Managing Packages, Services, & Power Shell-...
Windows Configuration Management: Managing Packages, Services, & Power Shell-...
 
Splunk Modular Inputs / JMS Messaging Module Input
Splunk Modular Inputs / JMS Messaging Module InputSplunk Modular Inputs / JMS Messaging Module Input
Splunk Modular Inputs / JMS Messaging Module Input
 
London Hashicorp Meetup #22 - Congruent infrastructure @zopa by Ben Coughlan
London Hashicorp Meetup #22 - Congruent infrastructure @zopa by Ben CoughlanLondon Hashicorp Meetup #22 - Congruent infrastructure @zopa by Ben Coughlan
London Hashicorp Meetup #22 - Congruent infrastructure @zopa by Ben Coughlan
 
Creating pools of Virtual Machines - ApacheCon NA 2013
Creating pools of Virtual Machines - ApacheCon NA 2013Creating pools of Virtual Machines - ApacheCon NA 2013
Creating pools of Virtual Machines - ApacheCon NA 2013
 
Puppet Release Workflows at Jive Software
Puppet Release Workflows at Jive SoftwarePuppet Release Workflows at Jive Software
Puppet Release Workflows at Jive Software
 
Puppet Camp Denver 2015: Nagios Management With Puppet
Puppet Camp Denver 2015: Nagios Management With PuppetPuppet Camp Denver 2015: Nagios Management With Puppet
Puppet Camp Denver 2015: Nagios Management With Puppet
 
Vladimir Ulogov - Large Scale Simulation | ZabConf2016 Lightning Talk
Vladimir Ulogov - Large Scale Simulation | ZabConf2016 Lightning TalkVladimir Ulogov - Large Scale Simulation | ZabConf2016 Lightning Talk
Vladimir Ulogov - Large Scale Simulation | ZabConf2016 Lightning Talk
 
Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture
 
Nagios XI Best Practices
Nagios XI Best PracticesNagios XI Best Practices
Nagios XI Best Practices
 
Basic Understanding and Implement of Node.js
Basic Understanding and Implement of Node.jsBasic Understanding and Implement of Node.js
Basic Understanding and Implement of Node.js
 
Monitoring Oracle SOA Suite - UKOUG Tech15 2015
Monitoring Oracle SOA Suite - UKOUG Tech15 2015Monitoring Oracle SOA Suite - UKOUG Tech15 2015
Monitoring Oracle SOA Suite - UKOUG Tech15 2015
 
Nagios, Getting Started.
Nagios, Getting Started.Nagios, Getting Started.
Nagios, Getting Started.
 
Elements for an iOS Backend
Elements for an iOS BackendElements for an iOS Backend
Elements for an iOS Backend
 
Podila mesos con-northamerica_sep2017
Podila mesos con-northamerica_sep2017Podila mesos con-northamerica_sep2017
Podila mesos con-northamerica_sep2017
 
Nagios Conference 2011 - Nate Broderick - Nagios XI Large Implementation Tips...
Nagios Conference 2011 - Nate Broderick - Nagios XI Large Implementation Tips...Nagios Conference 2011 - Nate Broderick - Nagios XI Large Implementation Tips...
Nagios Conference 2011 - Nate Broderick - Nagios XI Large Implementation Tips...
 
JustLetMeCode-Final
JustLetMeCode-FinalJustLetMeCode-Final
JustLetMeCode-Final
 
Puppet Camp Melbourne 2014:
Puppet Camp Melbourne 2014: Puppet Camp Melbourne 2014:
Puppet Camp Melbourne 2014:
 

Similar to Automation intro

Python for the Network Nerd
Python for the Network NerdPython for the Network Nerd
Python for the Network Nerd
Matt Bynum
 
Managing Large-scale Networks with Trigger
Managing Large-scale Networks with TriggerManaging Large-scale Networks with Trigger
Managing Large-scale Networks with Trigger
jathanism
 
How to deploy node to production
How to deploy node to productionHow to deploy node to production
How to deploy node to productionSean Hess
 
Who pulls the strings?
Who pulls the strings?Who pulls the strings?
Who pulls the strings?
Ronny
 
Internet of things the salesforce lego machine cloud
Internet of things   the salesforce lego machine cloudInternet of things   the salesforce lego machine cloud
Internet of things the salesforce lego machine cloud
andyinthecloud
 
DeviceHub - First steps using Intel Edison
DeviceHub - First steps using Intel EdisonDeviceHub - First steps using Intel Edison
DeviceHub - First steps using Intel Edison
Gabriel Arnautu
 
Puppet for Developers
Puppet for DevelopersPuppet for Developers
Puppet for Developers
sagarhere4u
 
Puppet Camp Boston 2014: Keynote
Puppet Camp Boston 2014: Keynote Puppet Camp Boston 2014: Keynote
Puppet Camp Boston 2014: Keynote
Puppet
 
OSX Pirrit : Why you should care about malicious mac adware
OSX Pirrit : Why you should care about malicious mac adwareOSX Pirrit : Why you should care about malicious mac adware
OSX Pirrit : Why you should care about malicious mac adware
Priyanka Aash
 
Python and Oracle : allies for best of data management
Python and Oracle : allies for best of data managementPython and Oracle : allies for best of data management
Python and Oracle : allies for best of data management
Laurent Leturgez
 
E yantra robot abstractions
E yantra robot abstractionsE yantra robot abstractions
E yantra robot abstractionsAkshar Desai
 
Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'
Jen Andre
 
HPC Examples
HPC ExamplesHPC Examples
HPC Examples
Wendi Sapp
 
Socket.io (part 1)
Socket.io (part 1)Socket.io (part 1)
Socket.io (part 1)
Andrea Tarquini
 
Simplifying openstack instances networking
Simplifying openstack instances networkingSimplifying openstack instances networking
Simplifying openstack instances networking
Mohamed ELMesseiry
 
Chapter 6
Chapter 6Chapter 6
Chapter 6
pavan penugonda
 
Automating the Cloud with Terraform, and Ansible
Automating the Cloud with Terraform, and AnsibleAutomating the Cloud with Terraform, and Ansible
Automating the Cloud with Terraform, and Ansible
Brian Hogan
 
Devnet 1005 Getting Started with OpenStack
Devnet 1005 Getting Started with OpenStackDevnet 1005 Getting Started with OpenStack
Devnet 1005 Getting Started with OpenStack
Cisco DevNet
 

Similar to Automation intro (20)

Python for the Network Nerd
Python for the Network NerdPython for the Network Nerd
Python for the Network Nerd
 
Managing Large-scale Networks with Trigger
Managing Large-scale Networks with TriggerManaging Large-scale Networks with Trigger
Managing Large-scale Networks with Trigger
 
How to deploy node to production
How to deploy node to productionHow to deploy node to production
How to deploy node to production
 
Who pulls the strings?
Who pulls the strings?Who pulls the strings?
Who pulls the strings?
 
Java sockets
Java socketsJava sockets
Java sockets
 
Internet of things the salesforce lego machine cloud
Internet of things   the salesforce lego machine cloudInternet of things   the salesforce lego machine cloud
Internet of things the salesforce lego machine cloud
 
DeviceHub - First steps using Intel Edison
DeviceHub - First steps using Intel EdisonDeviceHub - First steps using Intel Edison
DeviceHub - First steps using Intel Edison
 
Puppet for Developers
Puppet for DevelopersPuppet for Developers
Puppet for Developers
 
Puppet Camp Boston 2014: Keynote
Puppet Camp Boston 2014: Keynote Puppet Camp Boston 2014: Keynote
Puppet Camp Boston 2014: Keynote
 
OSX Pirrit : Why you should care about malicious mac adware
OSX Pirrit : Why you should care about malicious mac adwareOSX Pirrit : Why you should care about malicious mac adware
OSX Pirrit : Why you should care about malicious mac adware
 
Python and Oracle : allies for best of data management
Python and Oracle : allies for best of data managementPython and Oracle : allies for best of data management
Python and Oracle : allies for best of data management
 
E yantra robot abstractions
E yantra robot abstractionsE yantra robot abstractions
E yantra robot abstractions
 
Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'
 
OLSR setup
OLSR setup OLSR setup
OLSR setup
 
HPC Examples
HPC ExamplesHPC Examples
HPC Examples
 
Socket.io (part 1)
Socket.io (part 1)Socket.io (part 1)
Socket.io (part 1)
 
Simplifying openstack instances networking
Simplifying openstack instances networkingSimplifying openstack instances networking
Simplifying openstack instances networking
 
Chapter 6
Chapter 6Chapter 6
Chapter 6
 
Automating the Cloud with Terraform, and Ansible
Automating the Cloud with Terraform, and AnsibleAutomating the Cloud with Terraform, and Ansible
Automating the Cloud with Terraform, and Ansible
 
Devnet 1005 Getting Started with OpenStack
Devnet 1005 Getting Started with OpenStackDevnet 1005 Getting Started with OpenStack
Devnet 1005 Getting Started with OpenStack
 

Recently uploaded

How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 

Recently uploaded (20)

How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 

Automation intro

  • 2. OFFICE OF THE NETWORK ENGINEER • I am not a "Programmer" • I think about the network & complex networking planning • I spend a lot of my time fire-fighting the network • I need automation tools to help me do my job • I know I need to "level-up" with automation but I need something that helps me get started • I’d like to use Python since it is shaping up as the standard
  • 3. THINKING LIKE A PROGRAMMER • You do *not* have to be a programmer to be successful in automation. • In the most simple of terms, programming is the manipulation of data. • You already know the core concepts of data types and how to manipulate them, the missing link is the language.
  • 4. THIS LOOKS FAMILIAR, BUT WHAT THE HELL IS GOING ON IT'S SHOWTIME BECAUSE I'M GOING TO SAY PLEASE a TALK TO THE HAND "a is true" BULLSHIT TALK TO THE HAND "a is not true" YOU HAVE NO RESPECT FOR LOGIC YOU HAVE BEEN TERMINATED ArnoldC https://github.com/lha rtikk/ArnoldC
  • 5. PYEZ – A LAYERED APPROACH Python Shell Python script IT Frameworks Custom Applications ncclient junos-pyez • Junos specific • Abstraction Layer • micro-framework • NETCONF transport only • Vendor Agnostic • No abstractions • Native Python data types (hash/list) • Junos specific not required • XML not required open-source, Juniper open-source, Community interactive simple → complex
  • 6. INTRO JunOS has a number of automation options available • Ansible, www.ansible.com • Chef, www.chef.io/chef/ • Puppet, www.puppetlabs.com • Salt, www.saltstack.com Today we will focus on pyez, www.github.com/Juniper/py- junos-eznc • A python library to directly interact with a device’s API via netconf over SSH • The JunOS API is primarily XML driven, pyez simplifies that
  • 7. INSTALL PYTHON FRAMEWORK Install pip • Type ‘easy_install pip’ • easy_install assumes your system has python on it • If not, please install python first • www.python.org Install the JunOS python framework • Type ‘pip install junos-eznc’ Optionally install ipython • Type ‘pip install ipython’ • ipython provides a better python shell than standard python • This shell is what will be used in this deck
  • 8. SETUP YOUR DEVICE JunOS’s API is accessed via SSH and netconf • Login to your Juniper device • Type ‘set system services netconf ssh’ • Type ‘commit’ • This will open TCP port 830 • This will need to be done on all devices that want to participate in automation via netconf
  • 9. SETUP DEVICE CONNECTION We need to open a connection to our device, all scripts or interactions via the shell will need to use the Device object and call open() before we do anything • Type ‘python’ or ‘ipython’ to enter the interactive shell • Type ‘from jnpr.junos import Device’ • We need to import a class Device, to access to code for connecting • Type ‘myDev = Device('192.168.212.129', user='dave', password='juniper123’)’ • myDev is now our connection variable • Type ‘myDev.open()’ • If you get a connection error, check your username and password • Also check that TCP port 830 is open on your device
  • 10. MORE SECURE WAY TO CONNECT Typing out a plain text password isn’t ideal for a shell or a script, so we can set it as a local environment variable and call it that way • Before starting the python shell (or script) type ‘export MYSSHPW=“yourSSHPass”’ • This assumes you are using Bash for your shell • Now we setup the connection like we previously did • Type ‘python’ or ‘ipython’ to enter the interactive shell • Type ‘from jnpr.junos import Device’ • Type ‘import os’ • Type ‘sshpass = os.environ['MYSSHPW']’ • This assigns the variable “sshpass” to your ssh password • Type ‘myDev = Device('192.168.212.129', user='dave', password=sshpass)’ • Type ‘myDev.open()’
  • 11. SETUP CONNECTION VIA SSH KEY If you want to use an SSH key to login to the device, that is also possible • Before starting the python shell (or script) type ‘export MYSSHPW=“yourSSHPass”’ • This assumes you are using Bash for your shell • Now we setup the connection like we previously did • Type ‘python’ or ‘ipython’ to enter the interactive shell • Type ‘from jnpr.junos import Device’ • Type ‘sshpass = os.environ['MYSSHPW']’ • This assigns the variable “pass” to your ssh password • Type ‘myDev = Device('192.168.212.129', user='dave', password=sshpass), ssh_private_key_file='/home/dave/.ssh/id_rsa'’ • Type ‘myDev.open()’
  • 12. CHECK SOME FACTS Now that we have a good connection open let’s see some device attributes • Type ‘from pprint import pprint’ • We want a “pretty print” option for printing out our attributes • Type ‘pprint( myDev.facts )’ • This should output a python dictionary of device attributes • But maybe we want to get a specific fact, like a serial • In this case we use key -> value to grab it • Type ‘pprint ( myDev.facts['serialnumber'] )’ • This is using our myDev.facts dictionary and calling the key “serialnumber” to get the serial number’s value
  • 13. REFRESH AND CHECK Some attributes may change like system uptime • We can refresh the device facts by asking for an update • Type ‘myDev.facts_refresh()’ • Now we can see if anything has changed • For instance, the uptime should have incremented • Type ‘pprint ( myDev.facts['RE0']['up_time'] )’ • Note here that we are accessing a dictionary within a dictionary • We are asking for the RE0 key inside our myDev.facts dict and the up_time key inside of the RE0 dict
  • 14. LOOK AT THE INTERFACES Perhaps we want to check into our ethernet interfaces • Type the following block of code: • This should give you a dictionary of all of your interfaces and associated attributes from jnpr.junos.op.ethport import EthPortTable eths = EthPortTable(myDev) eths.get() x = 0 while x < len(eths): print "Interface: " + eths.keys()[x] + " Information" print eths[x].items() x += 1
  • 15. A BETTER INTERFACE LIST This will give a printout of all ethernet interfaces on a device, whether or not they are up, the corresponding mac address and duplex setting from jnpr.junos.op.ethport import EthPortTable eths = EthPortTable(myDev) eths.get() x = 0 while x < len(eths): print "Interface {} is {}, MAC: {}, Link Mode: {}".format(eths.keys()[x], eths[x].oper, eths[x].macaddr, eths[x].link_mode ) x += 1
  • 16. LOOKING AT THE ROUTE TABLE Check out the routing table, but do note, this could be very memory intensive for tables with huge numbers of routes from jnpr.junos.op.routes import RouteTable routes = RouteTable(myDev) routes.get() r = 0 while r < len(routes): print "Route: {}, via interface: {}, protocol: {}".format(routes.keys()[r], routes[r].via, routes[r].protocol) r += 1
  • 17. UPDATING A CONFIG TUTORIAL • https://pynet.twb-tech.com/blog/juniper/juniper-pyez.html • https://pynet.twb-tech.com/blog/juniper/juniper-pyez- commit.html
  • 18. ADVANCED TECHNIQUES • Jinja2 • Smart templating system • SLAX • On board scripts • http://www.juniper.net/techpubs/en_US/junos- pyez1.0/topics/task/program/junos-pyez-program- configuration-data-loading.html • JunOS 14.2 • REST API
  • 19. BONUS - ZTP • ZTP or Zero-Touch Provisioning allows you to setup a device without every logging in. • ZTP utilizes DHCP and (T)FTP/HTTP. With these it can upgrade code and/or add a configuration to a device. • ZTP is enabled by default on JUNOS from the factory or via ‘request system zeroize’. • ZTP requires DHCP option 43 to be set and serves a number of suboptions. • http://www.juniper.net/techpubs/en_US/junos13.3/topics/ta sk/configuration/software-image-and-configuration- automatic-provisioning-confguring.html
  • 20. SUBOPTIONS • 00 - name of the software image file to install • 01 - name of the configuration file to install • 03 - transfer mode (ftp, tftp, http)
  • 21. NEXT STEPS • Learn Python • http://www.codecademy.com/tracks/python • Juniper Python framework • https://github.com/Juniper/py-junos-eznc • Multi-vendor network API abstraction framework • https://github.com/spotify/napalm • Zero-Touch Provisioning • http://www.juniper.net/techpubs/en_US/junos13.2/topics/to pic-map/ztp-overview-els.html

Editor's Notes

  1. A bit too long of a process to go through in a power point, but easily doable from this tutorial which can walk you through the process.