Download presentation
1
Automating Legacy Network Devices
Jason Edelman @jedelman8
2
Who Am I? Jason Edelman Traditional Network Engineer
Worked for Cisco, VARs, etc. CCIE 15394, VCDX-NV 167 Shifted to software and systems ~4 years ago Provide training and consulting services on network automation technologies Blog: jedelman.com
3
Agenda Why Automation? Network Device Programmability
Python Libraries & Ansible Modules Ansible (Red Hat) Live Demo (Ansible)
4
Network Device Programmability
How do you connect to the device? Nexus NX-API NETCONF Arista eAPI REST APIs API du jour 15-20% of all devices?
5
Network Device Programmability
If there is an API, use it… If not, we have old faithful…SSH 85-90% of devices Legacy or Traditional?
6
It’s OKAY to use SSH
7
Python => Ansible Python Library Description Ansible Modules
Specialty/Focus napalm Multi-vendor library. Uses APIs when possible, but uses SSH (netmiko) for IOS napalm_install_config Note: there are also “get” modules Managing device configurations pyntc ntc_file_copy ntc_save_config ntc_show_command ntc_config_command ntc_reboot ntc_install_os ntc_get_facts ntc_rollback System level tasks netmiko Multi-vendor SSH client (12+ vendors) Used by napalm and ntc modules SSH client
8
Ansible Agentless Built-in Templating Engine
YAML & Jinja2 Reports, Docs, Configs, etc. Created and easily extended in Python (or language of your choice) Gaining adoption for Network Automation
9
Ansible Inventory File
[bldg1] b1-closet1-stack1 b1-closet2-stack2 [bldg2] b2-closet1-stack1 b2-closet2-stack2 Inventory File - inventory
10
Ansible Inventory File & Playbook
[bldg1] b1-closet1-stack1 b1-closet2-stack2 [bldg2] b2-closet1-stack1 b2-closet2-stack2 --- - name: deploy vlan on bldg2 switches hosts: bldg2 connection: local tasks: - name: ensure VLAN 10 exists nxos_vlan: vlan_id=10 name=web_vlan host={{ inventory_hostname }} Inventory File - inventory Playbook - vlan-pb.yml EXECUTE PLAYBOOK: $ ansible-playbook –i inventory vlan-pb.yml
11
ntc_show_command Multi-vendor Ansible module to streamline converting raw text into JSON key/value pairs Leverages TextFSM netmiko (SSH) is used for transport by default
12
ntc_show_command JSON data returned
13
Existing IOS Templates
Other vendors and OSs exist too
14
Sample TextFSM Template
No coding Regex in TextFsM templates is all that’s needed
15
ntc_config_command Send configs from list or from file
12+ device types supported (SSH)
16
ntc_get_facts Facts returned include: uptime (string) uptime (seconds)
model vendor os_version serial_number hostname fqdn vlans interfaces
17
ntc_save_config Save the running configuration as the startup configuration or to a file on the network device. Performs a commit on Juniper devices / copy run start on others Optionally, save the running configuration as a file to the Ansible control host.
18
ntc_file_copy Copy local files via SCP to network devices
19
ntc_rollback Create Checkpoint file and rollback to it if there is an error Insert other tasks between
20
LIVE DEMO Ansible Quickstart & Overview Save & Backup configs
Copying files Collecting Data: inventory & ‘show’ commands Creating Reports Pushing configs (time permitting)
21
DEMO FILES
22
Slack Team slack.networktocode.com Self sign up
Various channels for topics such as netmiko, napalm, ansible, trigger, and for specific vendors
23
Resources https://github.com/ktbyers/netmiko/
24
THANK YOU! Jason Edelman @jedelman8 jedelman.com
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.