+ All Categories
Home > Documents > On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie...

On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie...

Date post: 09-Jul-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
32
Cisco Tech Club Webináře On-line každých 14 dní
Transcript
Page 1: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

Cisco Tech Club Webináře

On-line každých 14 dní

Page 2: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

Peter Morvay

Nornir, PyATS- automatizace, jak ji potřebujete

Page 3: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

© 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public

”I am not sure why they are reinventing Ansible”

3

Page 4: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

© 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public © 2019 Cisco and/or its affiliates. All rights reserved.

Nornir

Flexible and scalable network automation framework where everything is done in Python

4

Page 5: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

© 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public

• Why use Framework?

• Systematic Inventory Management

• Modular integration to other ligraries (netmiko, …)

• Integrated Concurrency

• Systematizes automation approach

Page 6: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

© 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public

Page 7: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

© 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public

Page 8: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

© 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public

Page 9: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

© 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public

• + Own integrations to IPAMs

• https://nornir.readthedocs.io/en/stable/ref/api/inventory.html#

Page 10: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

© 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public

Page 11: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

© 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public

Internal inventory

Host > Group1 > Group2 > Default

Page 12: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

© 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public

Inventory

---

localhost:

hostname: localhost

Page 13: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

© 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public

nr = InitNornir(config_file="config.yaml")

Page 14: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

© 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public

nr.run(task=my_task)

nr.close_connections()

Page 15: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

© 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public

def my_task(task):

print(f"==== {task.host} ==== \n")

Page 16: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

© 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public

Built-in tasks

Page 17: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

© 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public

from nornir.plugins.functions.text import print_result

print_result(result)

Page 18: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

© 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public

Page 19: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

Demo

Page 20: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

© 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public

Network profilingPyATS, Genie

20

Page 21: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

State validation before and after changes (aka MTTI)

Page 22: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

Parsersconverting/formatting command output into Python data structures

Parsing Function

Page 23: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

Open-Source Libraries

• The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic

• All platform, device, and feature implementations are open-source:

• Connection plugins & extensions

• Libraries - feature models, parsers, data-driven testcases are loaded via an abstracted library layer (eg: https://github.com/CiscoTestAutomation/genieparser)

Example:

• IOSXE (eg asr1k, cat9k)• Junos

• NXOS (eg n9k, n7k)• NSO

• IOSXR (eg asr9k)• NGFW (eg, asa)

Page 24: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

Solution Layout

• Topology & Test definition

• Execution & ReportingpyATS Core Test InfrastructureToolbox

• Basis for agnostic automation libraries

• Boilerplate library foundation & engineGenie Library Framework

• Parsers, Feature/Protocol Models

• Reusable Testcases: Triggers, VerificationsGenie Libs

SDK & Library

• XPRESSO, Ansible, RobotFramework

• Jenkins, CI/CD pipelines, CLI, other tooling, etcIntegrationBusiness Logic

Page 25: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

pyATS | Genie Parsers

https://pubhub.devnetcloud.com/media/pyats-packages/docs/genie/genie_libs/#/parsers

Features:

• 1200+ individual parsers across Cisco network OS and counting

• Agnostic framework: multiple OS/Platform/Release/etc support

• Multi-mgmt. protocol: support for parsing CLI/NETCONF/XML/etc

• Self-testing: each parser features its own schema

Page 26: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

Environment

• Linux/macOS/WSL

• Python 3.4-3.7 (3.8 soon)

• Generates HTML+Text and Email Reports

• Plugin-based engine – integrates into anything

bash$ python3 –m venv ~/pyatsbash$ source ~/pyats/bin/activate(pyats) bash$ pip install pyats[full]

Page 27: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

© 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public

Page 28: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

Demo

Page 29: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

© 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public

Questions?

Page 30: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

© 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public

By Jarry Pilař

Next TechClub: 21.1.2020

Principy řešení Software DefinedAccess pro podnikové sítě

30

Page 31: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

© 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public

Sources

Nornir training https://pynet.twb-tech.com/class-nornir.html

Devnethttps://developer.cisco.com/netdevops/live/https://developer.cisco.com/netdevops/live/#s01t09https://developer.cisco.com/network-automation/detail/8755580187240324/

Code from presentationhttps://github.com/pmorvay/TechClub20_Nornir

Page 32: On-line 14 dní Cisco Tech Club Webináře · Open-Source Libraries • The core of pyATS & Genie is light weight, and platform, feature/protocol agnostic • All platform, device,

Recommended