Portable pyATS

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone my name is john capo bianco i'm a senior i.t planner and integrator for the canadian house of commons and i just want to make a disclaimer that this video and this technology is not endorsed by the house of commons or parliament of canada nor is it endorsed by or backed up by cisco in any way this is truly an open source thing that i've uh want to share with the community that i believe is maybe a valuable tool and maybe will help people start to use the pi ats framework and library without the necessary i'm going to call it overhead of being familiar with a linux environment with python 3 with a python 3 virtual environment with pip install with all the stuff that comes with you know setting up the pi ets environment for you to use it now the pi ets environment let me go to the screens in a second but i just want to top stop and explain how i managed to get here cisco has a development shop in ottawa ontario and my office is very close to their office proximity wise and just through happenstance the team that develops pi ats is in ottawa as well so i was aware of it and became aware of it through my network automation work and my work with ansible there was some work that let you plug in the what was called at the time the genie parsers into ansible and that's where i got started with the tool now the team actually set up a little demonstration a one hour q a live demo exploratory session with my team that i arranged to bring to the cisco offices and the pi ets team now they sh they really opened up our eyes with tests and the framework and working pythonically as well as at the time was brand new was just being released was expresso and so they opened up this world of containers to us and running pi ats as a container and using espresso as a cicd delivery system to schedule them to put them behind our back to make them like has made the analogy in my other videos little cd-roms of tests or functions right don't limit yourself to just tests this is anything that we can call in the in the pi ats framework so tests yes but we can also do things like dot learn or dot parse a command or even dot configure and push changes dot diff and do differentials so let me quickly jump over to my screen here and i'm just going to take you to honestly i just want to show you if you just google pi ats and go to this accelerating your devops page if this is new to you but this is what we're going to be looking at is the pi ets docs genie is deprecated it's now known really as the pi ets toolkit versus the pi ets framework so we're going to use that terminology that's in this devnet associate exam book by the way that genie is deprecated and that we should be speaking about pi ats frameworks and libraries so right it's it's incredible where we have a toolbox and an sdk and the libraries now i i've done some integrations with merlin and with ansible and with espresso and with my own ci cd pipelines but what i would like to do is take everything below the business logic and package all of this up into something that we can run like like a cli live cli version of pi ets on demand without the headache or overhead of setting up environments or anything like that so that's where we're going to come to docker and if we again if we google this pi ats and docker they have a whole docker build file that we'll look at i don't know if there's right configure your cloud environment if you use docker there's lots of documentation about this but they have here some examples if we look at say the alpine docker file this is how they build their docker container and they leave you in the python environment right so inspired by some of this work i and some of my latest work and my fun with docker now how is this build coming along i'm trying to build this in the cloud right now all right it's in progress that's almost done but i have it locally so what i've done and let me show you here is i've built something called portable pi ats and with a tag of latest and we're going to run this in a second but let's look at how this was done i literally have two files i'm going to fill in the readme file but we have two files here and the testbed is it's there to guide you and this works with the devnet sandbox so if you want to play with pi ats all you have to do now is spin up your vpn connection to the nx the nexus 9k devnet sandbox and one line command or from docker desktop you can run my container and have a cli into the pi ets world which is what i've done this also i'll show you in docker file but this you can edit this out to be your host name your alias right you can change all of this because i've made the container interactive with a shell and with vim meaning we can vi that testbed file and save it and run it for your environment this is also available on github where you could clone my repo make your own testbed file for your appropriate topology and then repackage it as your own container with your own testbed file either way will work now this is still building in progress this is great though and so let's go ahead and get into the container so let's run it and we're not mapping anything yet but we could map these drives but let's just run it for now we'll come back to that and i haven't tested that yet but i think it's going to work so now it's it's just running as a container app right and i should give it a name here figure out how to name these when i run them oh yeah i can do that let's let's start again i just jump right ahead run it and we're going to give it a name and we're just going to say portable pi ats and we could i think map the root to one of our folders and then the files will show up but let's do that as an advanced step so now we're going to run it now it says portable pi ets as a container app so think of your your everyday workspace you're a network engineer you have this massive network you want to run tests you want to do things you want to learn stuff on the fly with pi ats as opposed to the old cli days well you just run this as a container locally just continuously runs just let it run and then we hop into it by typing this cli button so now that we're in here right i have the ability to do say pi ats learn and let's learn bgp from the test bed file testbed.yaml and let me maximize this right i'm inside of the cli of the container right away look at learning bgp on the device because my testbed's pre-canned for that router and there i have bgp so now i do ls and i'm going to cat out the operations document well there it is there's my bgp as json right pretty cool and i can do anything you want let's do pi ets parse and i think i just do i do it like this show ip interface brief test bed file testbed.yaml i hope this works i'm kind of doing this off the cuff here now that i'm into the cli and there there it is there's the parsed and i can so that's pretty incredible we have show ip interface brief as well as our bgp all at the cli now what i'm going to try to do is let me just do this at the cli before i before i try it right so let's do make dire output all right so now that we have output made what we can do is do pi ats we'll do the same thing parse show ip interface brief and the testbed file testbed.yaml and now we just flag tag output and we're just going to say output now i'm not going to do anything else i think it makes files for us i don't need to specify json or anything like that i believe that's correct maybe not testbed file following arguments are required i have testbed file oh i spelt it wrong oh john let's try it again oh and i can't do that either yeah test bed file testbed.yaml and then i'm just gonna and it's output output anyhow sorry typo aside i'm not gonna start again because of the little typo so let's learn that and now we have two files if i cd into output and ls now i actually have my so i can cat right this brief console here and have my ip interface brief that's the console now i also have the parsed if i cat that whoops cat the parsed will give me the json very slick right now so you say so who cares well here let's destroy this whole thing let's let's destroy this whole container and what we're going to do is we're going to make a new app a new container but this time we're going to map it with a volume so i'm going to say this is a portable pi ats and we're going to mount i'm going to show you the long way c automate your network from docker portable pi ats let's just do that and then here we're going to say slash output and we're going to run this container so the first thing we do when we shell into this container is make dir output oh it already exists okay oh i see because it was there from previous let me just clean it out cd output ls why is it i thought it was destroyed i guess i have to rebuild the whole container let me just start from scratch then and delete that whole image and then we'll rebuild the image from scratch here uh docker build and we want to call it my name portable pi ets latest so this will rebuild the local and i'll have a fresh copy of the image without an output folder inside of it and we'll just start from scratch and make a new container so this is this is why i think this is pretty neat and again this is a windows computer i'm on so let's do this again i'm going to say portable pi ats map it to my volume container path is slash output right run it come into this container say ls there is there is the output folder i guess because i'm not deleting the image well now that it's mapped yeah c folder is empty let's where's my shell pi ats learn bgp testbed file testbed.emil output output let's just try it don't worry about this output folder hanging around it's must be using a cached copy something like this is happening anyway let's just do this new command and here's my folder right look at they're coming in in more or less real time there's the files so in my windows box i have all my bgp as json i have the raw bgp if i prefer to read it as cli output it's all there through a portable pi ats container anything you can think of with the pi ets framework learn diffs whatever we just put the output here i now i let me switch back to the main video here um what what i hope to be able let me show you this what i hope let me go back i've included vim so what the whole intention is is yes there's a testbed file and yes it works with the vpn but inside of the container let me make sure i'm sharing my screen here i've provided the ability for you to say vi testbed.yaml update this file with your topology your testbed and then you have the portable pi ets for your environment right so i haven't tried this yet that's my next step is to truly see how portable this is and what i want to do is in my lab in my sandbox see if i can run this container on the nexus device that would be my next video it's a little more advanced so this is portable pi ats an introduction you can clone the repo you can run the container it is available now on docker hub let me again show you real quick before we go i'm going to go to the public view this is what you will see is john capo bianco portable pi ets you can pull it with this command it has the latest tag which you can pull and run locally with or with this sandbox or with vi in the file with your own device thank you stay safe
Info
Channel: John Capobianco
Views: 131
Rating: 5 out of 5
Keywords: python, docker, infrastructure as code, network automation, pyATS, cisco, docker compose, containers, image, ci/cd, devnet, devops, gitops, git, github, dockerhub
Id: knwUPoZsrhw
Channel Id: undefined
Length: 15min 9sec (909 seconds)
Published: Sun Jun 27 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.