SlideShare a Scribd company logo
1 of 6
Download to read offline
Network Automation Concept
1 - YAML
<< SHOW OF HANDS WHO HAS EXPERIENCE WITH YAML >>
Why YAML - it's simple, well known, and does the job
Great tool for representing data, no more (just want the data)
Similar-ish to XML or JSON but more useful to human beings than those two
First exercise is a list:
---
- Juniper
- Cisco
- Brocade
- VMware
Just an arbitrary list. No particular order, doesn't have to be unique.
I'll keep the Python light - for illustrative purposes only. Focus on YAML. We need to write a small
function to import the YAML data
import yaml
from pprint import pprint
def ly(filename):
with open(filename) as _:
return yaml.load(_)
Now we have a function we can use to quickly load the YAML files we write
Let's load the YAML file we wrote.
w body = ly('1-list.yml') print(type(body)) print(len(body)) print(body)
This is the representation of the data in Python
Items in list don't even have to be same type!! YAML mimics the flexibility of Python Notice that
strings (usually) don't have to be enclosed in quotes.
---
- Plants
- 12345
- False
- ['Hello', 'Workld', '!']
Let's run our function again
body = ly('2-mixedtypeslist.yml')
print(type(body))
print(len(body))
print(body)
Small loop to show individual types
for item in body:
print(type(item))
We can write dict of vendor to website mappings
---
Juniper: http://www.juniper.net/us/en/
Cisco: http://www.cisco.com/
Brocade: http://www.brocade.com/index.page
VMware: http://www.vmware.com/
Same as before, we can print type and length
body = ly('3-dictionary.yml')
print(type(body))
print(len(body))
We can call up a specific member of this dictionary by key
print(body['Juniper'])
Dictionaries can be mixed types
Also notice # for comment. Not part of data.
---
Juniper: Also a plant
Cisco: 6500 # They're still around, trust me.
Brocade: True
VMware: ['esxi', 'vcenter', 'nsx']
body = ly('4-mixedtypesdict.yml')
pprint(body)
If we specify values, iterates like a list
for v in body.values():
print(type(v))
Nesting is possible with lists and dictionaries
Here is a list OF dictionaries
---
- name: Juniper
products: ['vMX', 'vSRX', 'Contrail']
- name: Cisco
products: ['Nexus 7K', 'Catalyst 3750', 'ACI']
- name: Brocade
products: ['BVC', 'Vyatta 5400 vRouter', 'VDX 6740']
- name: VMware
products: ['vCenter', 'NSX', 'Virtual SAN']
Pretty print definitely comes in handy here.
body = ly('5-nesting.yml')
pprint(body)
As you can see, the root object is still a list
print(type(body))
However, we can loop through this list and see that there are dictionaries nested inside. This is
a list of dictionaries.
for vendor in body:
print(type(vendor))
Let's augment this loop a little bit to print the vendor name, and the first product in the list
for vendor in body:
print('First %s product is %s' % (vendor['name'], vendor['products'][0]))
You may have noticed YAML can store lists one of two ways I tend to use the one that looks
better (explicit is better than implicit).
---
- name: Juniper
products:
- vMX
- vSRX
- Contrail
- name: Cisco
products:
- Nexus 7K
- Catalyst 3750
- ACI
- name: Brocade
products:
- BVC
- Vyatta 5400 vRouter
- VDX 6740
- name: VMware
products: ['vCenter', 'NSX', 'Virtual SAN']
I'll run the same thing I ran in the last example on this new file. Same results.
body = ly('6-nesting2.yml')
for vendor in body:
print('First %s product is %s' % (vendor['name'], vendor['products'][0]))
We'll use Ansible in a bit - it does module arguments a little differently.
Either all on one line, or chunked up like this:
login_to_router:
user=root
passwd=Juniper
port=22
host=10.12.0.1
Python renders this as a single dictionary, all args just one big string
body = ly('7-sampleargs.yml')
print(body)
This implies that your Python is responsible for parsing this out. Fortunately, Ansible does
this for us.
Thank You.!
Cheers,
Ajeet Singh
Contact No:- +91 992039357 6
Linkedin:-https://in.linkedin.com/pub/ajeet-singh/3a/b42/895
Twitter:-@ajeet0537
Blog:-https://ajeets1.blogspot.in
Facebook:-https://www.facebook.com/NetworkingDCN?ref=hl
Network automation concept

More Related Content

What's hot

Spring data ii
Spring data iiSpring data ii
Spring data ii명철 강
 
JRubyKaigi2010 Hadoop Papyrus
JRubyKaigi2010 Hadoop PapyrusJRubyKaigi2010 Hadoop Papyrus
JRubyKaigi2010 Hadoop PapyrusKoichi Fujikawa
 
New in MongoDB 2.6
New in MongoDB 2.6New in MongoDB 2.6
New in MongoDB 2.6christkv
 
Azure sql insert perf
Azure sql insert perfAzure sql insert perf
Azure sql insert perfMornè Blake
 
Coding using jscript test complete
Coding using jscript test completeCoding using jscript test complete
Coding using jscript test completeViresh Doshi
 
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and OptimizationPgDay.Seoul
 
Full-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.jsFull-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.jsMichael Lehmann
 
"Metrics: Where and How", Vsevolod Polyakov
"Metrics: Where and How", Vsevolod Polyakov"Metrics: Where and How", Vsevolod Polyakov
"Metrics: Where and How", Vsevolod PolyakovYulia Shcherbachova
 
Queue in the cloud with mongo db
Queue in the cloud with mongo dbQueue in the cloud with mongo db
Queue in the cloud with mongo dbNuri Halperin
 
Mobile TechTalk - Interesting talks from NSConference 6
Mobile TechTalk - Interesting talks from NSConference 6Mobile TechTalk - Interesting talks from NSConference 6
Mobile TechTalk - Interesting talks from NSConference 6GlobalLogic Ukraine
 
Queue in swift
Queue in swiftQueue in swift
Queue in swiftjoonjhokil
 
ClickHouse and the Magic of Materialized Views, By Robert Hodges and Altinity...
ClickHouse and the Magic of Materialized Views, By Robert Hodges and Altinity...ClickHouse and the Magic of Materialized Views, By Robert Hodges and Altinity...
ClickHouse and the Magic of Materialized Views, By Robert Hodges and Altinity...Altinity Ltd
 
Sqlxml vs xquery
Sqlxml vs xquerySqlxml vs xquery
Sqlxml vs xqueryAmol Pujari
 
CFML Enhancements in ColdFusion 10
CFML Enhancements in ColdFusion 10 CFML Enhancements in ColdFusion 10
CFML Enhancements in ColdFusion 10 Mindfire Solutions
 

What's hot (20)

Spring data ii
Spring data iiSpring data ii
Spring data ii
 
QB Into the Box 2018
QB Into the Box 2018QB Into the Box 2018
QB Into the Box 2018
 
JRubyKaigi2010 Hadoop Papyrus
JRubyKaigi2010 Hadoop PapyrusJRubyKaigi2010 Hadoop Papyrus
JRubyKaigi2010 Hadoop Papyrus
 
Cassandra 2.2 & 3.0
Cassandra 2.2 & 3.0Cassandra 2.2 & 3.0
Cassandra 2.2 & 3.0
 
New in MongoDB 2.6
New in MongoDB 2.6New in MongoDB 2.6
New in MongoDB 2.6
 
Kotlin wonderland
Kotlin wonderlandKotlin wonderland
Kotlin wonderland
 
Azure sql insert perf
Azure sql insert perfAzure sql insert perf
Azure sql insert perf
 
Config BuildConfig
Config BuildConfigConfig BuildConfig
Config BuildConfig
 
Coding using jscript test complete
Coding using jscript test completeCoding using jscript test complete
Coding using jscript test complete
 
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
 
Full-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.jsFull-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.js
 
Python my SQL - create table
Python my SQL - create tablePython my SQL - create table
Python my SQL - create table
 
"Metrics: Where and How", Vsevolod Polyakov
"Metrics: Where and How", Vsevolod Polyakov"Metrics: Where and How", Vsevolod Polyakov
"Metrics: Where and How", Vsevolod Polyakov
 
Queue in the cloud with mongo db
Queue in the cloud with mongo dbQueue in the cloud with mongo db
Queue in the cloud with mongo db
 
Mobile TechTalk - Interesting talks from NSConference 6
Mobile TechTalk - Interesting talks from NSConference 6Mobile TechTalk - Interesting talks from NSConference 6
Mobile TechTalk - Interesting talks from NSConference 6
 
Queue in swift
Queue in swiftQueue in swift
Queue in swift
 
ClickHouse and the Magic of Materialized Views, By Robert Hodges and Altinity...
ClickHouse and the Magic of Materialized Views, By Robert Hodges and Altinity...ClickHouse and the Magic of Materialized Views, By Robert Hodges and Altinity...
ClickHouse and the Magic of Materialized Views, By Robert Hodges and Altinity...
 
Sqlxml vs xquery
Sqlxml vs xquerySqlxml vs xquery
Sqlxml vs xquery
 
CFML Enhancements in ColdFusion 10
CFML Enhancements in ColdFusion 10 CFML Enhancements in ColdFusion 10
CFML Enhancements in ColdFusion 10
 
Storm introduction
Storm introductionStorm introduction
Storm introduction
 

Viewers also liked

Python (Jinja2) Templates for Network Automation
Python (Jinja2) Templates for Network AutomationPython (Jinja2) Templates for Network Automation
Python (Jinja2) Templates for Network AutomationRick Sherman
 
Automating the Network
Automating the NetworkAutomating the Network
Automating the NetworkPuppet
 
Model-driven Network Automation
Model-driven Network AutomationModel-driven Network Automation
Model-driven Network AutomationAnees Shaikh
 
Cohesive Networks Support Docs: VNS3 Setup for Juniper
Cohesive Networks Support Docs: VNS3 Setup for JuniperCohesive Networks Support Docs: VNS3 Setup for Juniper
Cohesive Networks Support Docs: VNS3 Setup for JuniperCohesive Networks
 
JDI Innovation Day
JDI Innovation DayJDI Innovation Day
JDI Innovation DayAMIT BORUDE
 
Juniper Innovation Contest
Juniper Innovation ContestJuniper Innovation Contest
Juniper Innovation ContestAMIT BORUDE
 
Junos space seminar
Junos space seminarJunos space seminar
Junos space seminarKappa Data
 
Juniper Content Delivery Network
Juniper Content Delivery NetworkJuniper Content Delivery Network
Juniper Content Delivery NetworkSergii Liventsev
 
Network automation ansible_nx-api
Network automation ansible_nx-apiNetwork automation ansible_nx-api
Network automation ansible_nx-apiJoel W. King
 
『WAN SDN Controller NorthStarご紹介 & デモ』
『WAN SDN Controller NorthStarご紹介 & デモ』『WAN SDN Controller NorthStarご紹介 & デモ』
『WAN SDN Controller NorthStarご紹介 & デモ』Juniper Networks (日本)
 
SFA: Stateful Forwarding Abstraction in SDN Data Plane
SFA: Stateful Forwarding Abstraction in SDN Data PlaneSFA: Stateful Forwarding Abstraction in SDN Data Plane
SFA: Stateful Forwarding Abstraction in SDN Data PlaneOpen Networking Summits
 
Quagga Overview as of 2015/10/17
Quagga Overview as of 2015/10/17Quagga Overview as of 2015/10/17
Quagga Overview as of 2015/10/17Kentaro Ebisawa
 
Software defined network and Virtualization
Software defined network and VirtualizationSoftware defined network and Virtualization
Software defined network and Virtualizationidrajeev
 
20150818 jun lee_openstack juno release 내용 분석
20150818 jun lee_openstack juno release 내용 분석20150818 jun lee_openstack juno release 내용 분석
20150818 jun lee_openstack juno release 내용 분석rootfs32
 
Performance Lessons learned in vRouter - Stephen Hemminger
Performance Lessons learned in vRouter - Stephen HemmingerPerformance Lessons learned in vRouter - Stephen Hemminger
Performance Lessons learned in vRouter - Stephen Hemmingerharryvanhaaren
 
A Network Engineer's Approach to Automation
A Network Engineer's Approach to AutomationA Network Engineer's Approach to Automation
A Network Engineer's Approach to AutomationJeremy Schulman
 

Viewers also liked (20)

Python (Jinja2) Templates for Network Automation
Python (Jinja2) Templates for Network AutomationPython (Jinja2) Templates for Network Automation
Python (Jinja2) Templates for Network Automation
 
Automating the Network
Automating the NetworkAutomating the Network
Automating the Network
 
Model-driven Network Automation
Model-driven Network AutomationModel-driven Network Automation
Model-driven Network Automation
 
Cohesive Networks Support Docs: VNS3 Setup for Juniper
Cohesive Networks Support Docs: VNS3 Setup for JuniperCohesive Networks Support Docs: VNS3 Setup for Juniper
Cohesive Networks Support Docs: VNS3 Setup for Juniper
 
Portfolio
PortfolioPortfolio
Portfolio
 
JDI Innovation Day
JDI Innovation DayJDI Innovation Day
JDI Innovation Day
 
Juniper Innovation Contest
Juniper Innovation ContestJuniper Innovation Contest
Juniper Innovation Contest
 
Junos space seminar
Junos space seminarJunos space seminar
Junos space seminar
 
Network Innovation with Open Software
Network Innovation with Open SoftwareNetwork Innovation with Open Software
Network Innovation with Open Software
 
An In-Depth Look at Junos Space SDK
An In-Depth Look at Junos Space SDKAn In-Depth Look at Junos Space SDK
An In-Depth Look at Junos Space SDK
 
Juniper Content Delivery Network
Juniper Content Delivery NetworkJuniper Content Delivery Network
Juniper Content Delivery Network
 
Network automation ansible_nx-api
Network automation ansible_nx-apiNetwork automation ansible_nx-api
Network automation ansible_nx-api
 
『WAN SDN Controller NorthStarご紹介 & デモ』
『WAN SDN Controller NorthStarご紹介 & デモ』『WAN SDN Controller NorthStarご紹介 & デモ』
『WAN SDN Controller NorthStarご紹介 & デモ』
 
SFA: Stateful Forwarding Abstraction in SDN Data Plane
SFA: Stateful Forwarding Abstraction in SDN Data PlaneSFA: Stateful Forwarding Abstraction in SDN Data Plane
SFA: Stateful Forwarding Abstraction in SDN Data Plane
 
Quagga Overview as of 2015/10/17
Quagga Overview as of 2015/10/17Quagga Overview as of 2015/10/17
Quagga Overview as of 2015/10/17
 
Introduction to Software Defined Networking (SDN)
Introduction to Software Defined Networking (SDN)Introduction to Software Defined Networking (SDN)
Introduction to Software Defined Networking (SDN)
 
Software defined network and Virtualization
Software defined network and VirtualizationSoftware defined network and Virtualization
Software defined network and Virtualization
 
20150818 jun lee_openstack juno release 내용 분석
20150818 jun lee_openstack juno release 내용 분석20150818 jun lee_openstack juno release 내용 분석
20150818 jun lee_openstack juno release 내용 분석
 
Performance Lessons learned in vRouter - Stephen Hemminger
Performance Lessons learned in vRouter - Stephen HemmingerPerformance Lessons learned in vRouter - Stephen Hemminger
Performance Lessons learned in vRouter - Stephen Hemminger
 
A Network Engineer's Approach to Automation
A Network Engineer's Approach to AutomationA Network Engineer's Approach to Automation
A Network Engineer's Approach to Automation
 

Similar to Network automation concept

Introductontoxaml
IntroductontoxamlIntroductontoxaml
Introductontoxamlsunhope777
 
IBM Workload Scheduler for z/OS Security with RACF & IBM zSecure
IBM Workload Scheduler for z/OS Security with RACF & IBM zSecureIBM Workload Scheduler for z/OS Security with RACF & IBM zSecure
IBM Workload Scheduler for z/OS Security with RACF & IBM zSecureNico Chillemi
 
Enable Database Service over HTTP or IBM WebSphere MQ in 15_minutes with IAS
Enable Database Service over HTTP or IBM WebSphere MQ in 15_minutes with IASEnable Database Service over HTTP or IBM WebSphere MQ in 15_minutes with IAS
Enable Database Service over HTTP or IBM WebSphere MQ in 15_minutes with IASInvenire Aude
 
Mule data weave_10
Mule data weave_10Mule data weave_10
Mule data weave_10kunal vishe
 
How to deploy spark instance using ansible 2.0 in fiware lab v2
How to deploy spark instance using ansible 2.0 in fiware lab v2How to deploy spark instance using ansible 2.0 in fiware lab v2
How to deploy spark instance using ansible 2.0 in fiware lab v2Fernando Lopez Aguilar
 
How to Deploy Spark Instance Using Ansible 2.0 in FIWARE Lab
How to Deploy Spark Instance Using Ansible 2.0 in FIWARE LabHow to Deploy Spark Instance Using Ansible 2.0 in FIWARE Lab
How to Deploy Spark Instance Using Ansible 2.0 in FIWARE LabFIWARE
 
Develop an inventory management system for an electronics store. The .pdf
Develop an inventory management system for an electronics store. The .pdfDevelop an inventory management system for an electronics store. The .pdf
Develop an inventory management system for an electronics store. The .pdfflashfashioncasualwe
 
New and improved hacking oracle from web apps sumit sidharth
New and improved hacking oracle from web apps   sumit sidharthNew and improved hacking oracle from web apps   sumit sidharth
New and improved hacking oracle from web apps sumit sidharthowaspindia
 
The program reads data from two files, itemsList-0x.txt and .docx
The program reads data from two files, itemsList-0x.txt and .docxThe program reads data from two files, itemsList-0x.txt and .docx
The program reads data from two files, itemsList-0x.txt and .docxoscars29
 
Amazon EMR Masterclass
Amazon EMR MasterclassAmazon EMR Masterclass
Amazon EMR MasterclassIan Massingham
 
Writing Rust Command Line Applications
Writing Rust Command Line ApplicationsWriting Rust Command Line Applications
Writing Rust Command Line ApplicationsAll Things Open
 
Simple xml in .net
Simple xml in .netSimple xml in .net
Simple xml in .netVi Vo Hung
 
Learn you some Ansible for great good!
Learn you some Ansible for great good!Learn you some Ansible for great good!
Learn you some Ansible for great good!David Lapsley
 
ZLM-Cython Build you first module
ZLM-Cython Build you first moduleZLM-Cython Build you first module
ZLM-Cython Build you first moduleVladimir Ulogov
 
Introduction to underscore.js
Introduction to underscore.jsIntroduction to underscore.js
Introduction to underscore.jsJitendra Zaa
 

Similar to Network automation concept (20)

Introductontoxaml
IntroductontoxamlIntroductontoxaml
Introductontoxaml
 
IBM Workload Scheduler for z/OS Security with RACF & IBM zSecure
IBM Workload Scheduler for z/OS Security with RACF & IBM zSecureIBM Workload Scheduler for z/OS Security with RACF & IBM zSecure
IBM Workload Scheduler for z/OS Security with RACF & IBM zSecure
 
Enable Database Service over HTTP or IBM WebSphere MQ in 15_minutes with IAS
Enable Database Service over HTTP or IBM WebSphere MQ in 15_minutes with IASEnable Database Service over HTTP or IBM WebSphere MQ in 15_minutes with IAS
Enable Database Service over HTTP or IBM WebSphere MQ in 15_minutes with IAS
 
Mule data weave_10
Mule data weave_10Mule data weave_10
Mule data weave_10
 
Triggers and Stored Procedures
Triggers and Stored ProceduresTriggers and Stored Procedures
Triggers and Stored Procedures
 
How to deploy spark instance using ansible 2.0 in fiware lab v2
How to deploy spark instance using ansible 2.0 in fiware lab v2How to deploy spark instance using ansible 2.0 in fiware lab v2
How to deploy spark instance using ansible 2.0 in fiware lab v2
 
How to Deploy Spark Instance Using Ansible 2.0 in FIWARE Lab
How to Deploy Spark Instance Using Ansible 2.0 in FIWARE LabHow to Deploy Spark Instance Using Ansible 2.0 in FIWARE Lab
How to Deploy Spark Instance Using Ansible 2.0 in FIWARE Lab
 
Develop an inventory management system for an electronics store. The .pdf
Develop an inventory management system for an electronics store. The .pdfDevelop an inventory management system for an electronics store. The .pdf
Develop an inventory management system for an electronics store. The .pdf
 
New and improved hacking oracle from web apps sumit sidharth
New and improved hacking oracle from web apps   sumit sidharthNew and improved hacking oracle from web apps   sumit sidharth
New and improved hacking oracle from web apps sumit sidharth
 
Java Script ppt
Java Script pptJava Script ppt
Java Script ppt
 
The program reads data from two files, itemsList-0x.txt and .docx
The program reads data from two files, itemsList-0x.txt and .docxThe program reads data from two files, itemsList-0x.txt and .docx
The program reads data from two files, itemsList-0x.txt and .docx
 
Introduction to r
Introduction to rIntroduction to r
Introduction to r
 
Matlab isim link
Matlab isim linkMatlab isim link
Matlab isim link
 
Amazon EMR Masterclass
Amazon EMR MasterclassAmazon EMR Masterclass
Amazon EMR Masterclass
 
Amazon EMR Masterclass
Amazon EMR MasterclassAmazon EMR Masterclass
Amazon EMR Masterclass
 
Writing Rust Command Line Applications
Writing Rust Command Line ApplicationsWriting Rust Command Line Applications
Writing Rust Command Line Applications
 
Simple xml in .net
Simple xml in .netSimple xml in .net
Simple xml in .net
 
Learn you some Ansible for great good!
Learn you some Ansible for great good!Learn you some Ansible for great good!
Learn you some Ansible for great good!
 
ZLM-Cython Build you first module
ZLM-Cython Build you first moduleZLM-Cython Build you first module
ZLM-Cython Build you first module
 
Introduction to underscore.js
Introduction to underscore.jsIntroduction to underscore.js
Introduction to underscore.js
 

More from Ajeet Singh

Kubernetes Architecture with Components
 Kubernetes Architecture with Components Kubernetes Architecture with Components
Kubernetes Architecture with ComponentsAjeet Singh
 
Deploy the blockchain network using kubernetes ap is on google cloud
Deploy the blockchain network using kubernetes ap is on google cloudDeploy the blockchain network using kubernetes ap is on google cloud
Deploy the blockchain network using kubernetes ap is on google cloudAjeet Singh
 
Setup Kubernetes with flannel on ubuntu platform
Setup Kubernetes with flannel on ubuntu platformSetup Kubernetes with flannel on ubuntu platform
Setup Kubernetes with flannel on ubuntu platformAjeet Singh
 
vPC techonology for full ha from dc core to baremetel server.
vPC techonology for full ha from dc core to baremetel server.vPC techonology for full ha from dc core to baremetel server.
vPC techonology for full ha from dc core to baremetel server.Ajeet Singh
 
Palo Alto Virtual firewall deployment Architecture
Palo Alto Virtual firewall deployment Architecture Palo Alto Virtual firewall deployment Architecture
Palo Alto Virtual firewall deployment Architecture Ajeet Singh
 
Palo Alto Virtual firewall deployment guide on OpenStack Cloud
Palo Alto Virtual firewall deployment guide on OpenStack Cloud  Palo Alto Virtual firewall deployment guide on OpenStack Cloud
Palo Alto Virtual firewall deployment guide on OpenStack Cloud Ajeet Singh
 

More from Ajeet Singh (6)

Kubernetes Architecture with Components
 Kubernetes Architecture with Components Kubernetes Architecture with Components
Kubernetes Architecture with Components
 
Deploy the blockchain network using kubernetes ap is on google cloud
Deploy the blockchain network using kubernetes ap is on google cloudDeploy the blockchain network using kubernetes ap is on google cloud
Deploy the blockchain network using kubernetes ap is on google cloud
 
Setup Kubernetes with flannel on ubuntu platform
Setup Kubernetes with flannel on ubuntu platformSetup Kubernetes with flannel on ubuntu platform
Setup Kubernetes with flannel on ubuntu platform
 
vPC techonology for full ha from dc core to baremetel server.
vPC techonology for full ha from dc core to baremetel server.vPC techonology for full ha from dc core to baremetel server.
vPC techonology for full ha from dc core to baremetel server.
 
Palo Alto Virtual firewall deployment Architecture
Palo Alto Virtual firewall deployment Architecture Palo Alto Virtual firewall deployment Architecture
Palo Alto Virtual firewall deployment Architecture
 
Palo Alto Virtual firewall deployment guide on OpenStack Cloud
Palo Alto Virtual firewall deployment guide on OpenStack Cloud  Palo Alto Virtual firewall deployment guide on OpenStack Cloud
Palo Alto Virtual firewall deployment guide on OpenStack Cloud
 

Recently uploaded

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 

Recently uploaded (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 

Network automation concept

  • 1. Network Automation Concept 1 - YAML << SHOW OF HANDS WHO HAS EXPERIENCE WITH YAML >> Why YAML - it's simple, well known, and does the job Great tool for representing data, no more (just want the data) Similar-ish to XML or JSON but more useful to human beings than those two First exercise is a list: --- - Juniper - Cisco - Brocade - VMware Just an arbitrary list. No particular order, doesn't have to be unique. I'll keep the Python light - for illustrative purposes only. Focus on YAML. We need to write a small function to import the YAML data import yaml from pprint import pprint def ly(filename): with open(filename) as _: return yaml.load(_) Now we have a function we can use to quickly load the YAML files we write Let's load the YAML file we wrote. w body = ly('1-list.yml') print(type(body)) print(len(body)) print(body) This is the representation of the data in Python Items in list don't even have to be same type!! YAML mimics the flexibility of Python Notice that strings (usually) don't have to be enclosed in quotes. --- - Plants - 12345 - False - ['Hello', 'Workld', '!']
  • 2. Let's run our function again body = ly('2-mixedtypeslist.yml') print(type(body)) print(len(body)) print(body) Small loop to show individual types for item in body: print(type(item)) We can write dict of vendor to website mappings --- Juniper: http://www.juniper.net/us/en/ Cisco: http://www.cisco.com/ Brocade: http://www.brocade.com/index.page VMware: http://www.vmware.com/ Same as before, we can print type and length body = ly('3-dictionary.yml') print(type(body)) print(len(body)) We can call up a specific member of this dictionary by key print(body['Juniper']) Dictionaries can be mixed types Also notice # for comment. Not part of data. --- Juniper: Also a plant Cisco: 6500 # They're still around, trust me. Brocade: True VMware: ['esxi', 'vcenter', 'nsx'] body = ly('4-mixedtypesdict.yml') pprint(body)
  • 3. If we specify values, iterates like a list for v in body.values(): print(type(v)) Nesting is possible with lists and dictionaries Here is a list OF dictionaries --- - name: Juniper products: ['vMX', 'vSRX', 'Contrail'] - name: Cisco products: ['Nexus 7K', 'Catalyst 3750', 'ACI'] - name: Brocade products: ['BVC', 'Vyatta 5400 vRouter', 'VDX 6740'] - name: VMware products: ['vCenter', 'NSX', 'Virtual SAN'] Pretty print definitely comes in handy here. body = ly('5-nesting.yml') pprint(body) As you can see, the root object is still a list print(type(body)) However, we can loop through this list and see that there are dictionaries nested inside. This is a list of dictionaries. for vendor in body: print(type(vendor)) Let's augment this loop a little bit to print the vendor name, and the first product in the list for vendor in body: print('First %s product is %s' % (vendor['name'], vendor['products'][0])) You may have noticed YAML can store lists one of two ways I tend to use the one that looks better (explicit is better than implicit). --- - name: Juniper products:
  • 4. - vMX - vSRX - Contrail - name: Cisco products: - Nexus 7K - Catalyst 3750 - ACI - name: Brocade products: - BVC - Vyatta 5400 vRouter - VDX 6740 - name: VMware products: ['vCenter', 'NSX', 'Virtual SAN'] I'll run the same thing I ran in the last example on this new file. Same results. body = ly('6-nesting2.yml') for vendor in body: print('First %s product is %s' % (vendor['name'], vendor['products'][0])) We'll use Ansible in a bit - it does module arguments a little differently. Either all on one line, or chunked up like this: login_to_router: user=root passwd=Juniper port=22 host=10.12.0.1 Python renders this as a single dictionary, all args just one big string body = ly('7-sampleargs.yml') print(body) This implies that your Python is responsible for parsing this out. Fortunately, Ansible does this for us.
  • 5. Thank You.! Cheers, Ajeet Singh Contact No:- +91 992039357 6 Linkedin:-https://in.linkedin.com/pub/ajeet-singh/3a/b42/895 Twitter:-@ajeet0537 Blog:-https://ajeets1.blogspot.in Facebook:-https://www.facebook.com/NetworkingDCN?ref=hl