Brkops 1237
Brkops 1237
Brkops 1237
#CiscoLive
Cisco Webex App
Questions?
Use Cisco Webex App to chat
with the speaker after the session
How
1 Find this session in the Cisco Live Mobile App
3 Install the Webex App or go directly to the Webex space Enter your personal notes here
#CiscoLive BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 3
#CiscoLive IBOOPS-1214 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public
• Spreadsheet driven
automation
• Aw CRUD, we gotta talk a
little about APIs
• Source of Truth, it doesn’t
have to be you anymore
Agenda • pyATS - How to no-code
and automate networks
• Ansible the Hammer of
Network Automation
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 5
Spreadsheet
driven
automation
Story Time
with Hank
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 7
“Network Engineering Runs on Spreadsheets”
#CiscoLive BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 8
Device Configuration Standard
crypto isakmp policy 10
encryption aes
hash sha256
authentication pre-share
group 14
interface <OUTSIDE_INT>
crypto map <MAP_NAME>
#CiscoLive BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 9
Creating the Access List Configuration
#CiscoLive BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 10
Creating the Access List Configuration
#CiscoLive BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 11
Using CONCAT Function in Excel to Create
Strings
#CiscoLive BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 12
CONCAT your CONCATs for Full Configs
Common Config Elements
=CONCAT('Common Info'!$C$2,
'Common Info'!$C$3,
B2, D2, C2, E2)
Tip! Don’t forget to add spaces and new lines where needed
#CiscoLive BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 13
Demo!
• MID – Pull characters out of a string
• REPLACE – Change characters in a
string
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 15
• Business runs on
spreadsheets… not just
networking
• Formulas are WAY faster
Why should I care? and consistent than manual
• Double check, then triple
check results!
• But be careful you don’t go
too far…
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 16
Aw CRUD, we
gotta talk a little
about APIs
In the beginning…
Humans were the
only users
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 18
Software displays results
in User Interface (UI)
In the beginning…
Humans were the
only users
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 19
“It’s a way for two
pieces of software to
talk to each other”
BRKOPS-1237 © 2022 Cisco and/or its affiliates. All rights reserved. Cisco Public 20
My Software
Software returns System
results via API
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 21
APIs aren’t
scary… you
already use
them
Command Line Interface (CLI)
Designed for Humans… so #!/usr/bin/expect -f
#CiscoLive BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 23
Simple Network
Management Protocol
(SNMP)
“designed as a
programmatic interface
between management
applications and devices”
https://tools.ietf.org/html/rfc3535
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 24
Representational State Transfer (REST)
• API framework for simple web
services
• Another use for the HTTP
protocol
• Popular due to performance,
scale, simplicity, and reliability
#CiscoLive BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 26
RESTCONF
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 27
The URI: What are you Requesting?
https://router-01.example.com/restconf/data/Cisco-IOS-XE-native:native/hostname
#CiscoLive BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 28
HTTP Methods: What to do?
HTTP Verb Typical Purpose (CRUD) Description
Used to create a new object, or resource.
POST Create Example: Add new book to library
Retrieve resource details from the system.
GET Read Example: Get list of books from the library
Typically used to replace or update a resource. Can be used to
PUT Update modify or create.
Example: Update the borrower details for a book
Remove a resource from the system.
DELETE Delete Example: Delete a book from the library.
#CiscoLive BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 29
Demo!
• IT System Integrations
• Understand and work with
automation peers
Why should I care? • Evaluate APIs from your
products and vendors
• APIs are cool, add it to
your resume!
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 31
• REST API Fundamentals
Learning Module on
Resources DevNet
• Introduction to RESTCONF
Learning Lab on DevNet
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 32
Source of Truth,
it doesn’t have
to be you
anymore
Lookup
Desired State
Do Something
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 34
Lookup
Desired State
How does
automation Compare to
network Current State
engineering work?
Do Something
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 35
What types of data make up “Desired State”
• IP Addresses • Cables / Circuits
• Interface settings • Management Access
• VLANs • Status
• Software Versions • Standards
• Credentials • Application / Service Details
• Serial / Asset Numbers • Host Details
• Neighbors
#CiscoLive BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 36
• In your head
• In someone else’s head
• On a spreadsheet
Where is the data • On a network diagram
found? • Text docs and notes apps
• Paper notes and scrap
paper
• Within the network
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 37
#CiscoLive © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public
#CiscoLive © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public
Device Installation Workflow with Source of Truth
DS renders
DS/Gear updates Gear applies DS sends
bootstrap config
SoT with status bootstrap config bootstrap config
from SoT
#CiscoLive BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 40
• CSV Files
• YAML / JSON Files
Common • Git Repositories
Automation Source • APIs into Other
Applications
of Truth Options • IPAM / DCIM
• Secret Management
• Service Desk / CDB
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 41
#CiscoLive © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public
• “Single” is a fantasy
• Goal should be ”single per
domain”
IPAM, DCIM, Secrets, etc
”Single” Source of
•
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 43
pyATS – How to
no-code and
automate
networks
“Could you get me this
info from all of the
devices in the network?”
© 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public
• Serial Numbers
• Interface status
• Routing table
“Could you get me this • ARP / MAC tables
info from all of the
devices in the network?” • Logs
• Etc
• Etc
• etc
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 46
We all have our cheats…
#CiscoLive BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 47
100%| █████████████████████████████████████████ | 1/1 [00:00<00:00, 1.89it/s]
+===========================================================================+
| Genie Parse Summary for rtr1 |
+===========================================================================+
Per device | Connected to rtr1 |
| - Log: output/ip_routes/connection_rtr1.txt |
results |---------------------------------------------------------------------------|
| Parsed command 'show ip route' |
| - Parsed structure: output/ip_routes/rtr1_show-ip-route_parsed.txt |
Command to Run | - Device Console: output/ip_routes/rtr1_show-ip-route_console.txt |
|---------------------------------------------------------------------------|
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 48
Demo
• Collect network baselines
pyATS can do • Quickly find differences
much more • Create robust network tests
(does require coding)
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 50
• pyATS home on DevNet
Resources • pyATS CLI Hands On Lab
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 51
Ansible – The
Hammer of
Network
Automation
• OpenSource Infrastructure as
Code tool
• Low barrier of entry into
automation
Why Ansible? • Coding skills not needed
• Very popular -> Lots of
examples
• Broad network automation use
cases
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 53
- name: Side 2 Config
loop: "{{ vpns.list }}"
loop_control:
label: "{{ item.vpn_name }} Side 2"
Ansible, it isn’t
vars:
vpn_name: "{{ item.vpn_name }}"
preshared_key: "{{ item.preshared_key }} "
ansible.builtin.template:
src: ios-vpn.j2
dest: configs/{{ item.vpn_name }}-side2-config.txt
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 54
Maybe I’m ready to try
something new…
CLI
#CiscoLive BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 56
Demo!
• Apply configurations
directly to devices
Ansible can do • Complex workflows
much more • Manage network, compute,
storage, cloud, etc at once
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 58
• Ansible on DevNet
• Ansible Core Docs
• Reading from CSV
Resources • Using Jinja Templates
• Jinja Template
Documentation
• Demo Example Code
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 59
In closing…
Programmability…
Nothing to be
afraid of!
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 60
• Spreadsheet driven automation
• Aw CRUD, we gotta talk a little about APIs
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 61
Hank Preston
• Stay in touch:
• Webex/Email: hapresto@cisco.com
• Twitter: @hfpreston
• Blogs: https://blogs.cisco.com/author/hankpreston
#CiscoLive BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 62
Fill out your session surveys!
These points help you get on the leaderboard and increase your chances of winning daily and grand prizes
#CiscoLive BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 63
• Visit the Cisco Showcase
for related demos
BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 64
Thank you
#CiscoLive
Gamify your Cisco Live experience!
Get points for attending this session!
How:
1 Open the Cisco Events App.
4 Click the + at the bottom of the screen and scan the QR code:
#CiscoLive BRKOPS-1237 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 66
#CiscoLive