Search for What did you expect? - 5 results found

What did you Expect? Part 5, Basic Error Handling.

In the first four parts of What did you Expect, we covered the basics of getting started with automating interactions for network equipment.  In the first few posts it was important have a networking environment that  was 100% stable.  The last thing I needed when I was trying to learn to use python to automate network devices that were randomly unresponsive and would crash my code.  In order to accomplish that I built a test network you can read about here in GNS3, created a basic configuration to enable a IOS device to be remotely managed.  I also wrote a quick multi-device ping tool to verify that all the devices are responsive before we run remote code against them.  I made my life easy.  But as all operators know our lives are not that cut and dry.  So I started to break things…and my code did not like me. Read more

What did you Expect? Part 4, Working with Flat Files.

So far so good.  In Part 1 we connected to a Cisco switch and and performed basic Authentication with Expect.  Part 2 we expanded on that and added configuration to our code that added a VLAN and configured an interface.  But as I have already stated we are writing quite a bit of code just to configure a single switch.  So the next step is to add multiple devices and flat files.  I mean yeah we could setup a static list in our code and add our devices to that but why?  Our real goal here is to create functional code that we can use to do real things in real networks.  So that means pulling a list of devices from NMS, IPAM or even our nasty old excel files.  Plus this helps us address  the idea of adding authentication files and other flat file resource pools.  Eventually we will transition the use of flat files into databases so we can do even more cool stuff but we will hold off on that for now.

Read more

What did you Expect? Part 3, Fixing Stuff and Scaling Out.

When you setup to learn new things you are bound to get a bit sideways once and awhile.  With writing code I think that is even more the case.  You start out with an idea and if your lucky like I have been so far it starts to flow and things just work.  But in the spirit of learning in manageable chunks and sharing the experience with you I started targeting a single host.  When I tried to make the leap to multiple hosts things got interesting.  Along with that it became clear that these posts were going to get messy quick.  So lets clean all that up and move on to the cool stuff. Read more

What did you Expect? Part 2: Working with VLANS

So we started off in Part 1 breaking down what a basic SSH connection and authentication looks like using Python and Expect.  To add some context to this I am using the pexpect library for Python.  This library falls back on system level tools like the the SSH client inside OSX or Linux.  I can’t speak to how this works with Windows so just be aware of that as we move forward.  In the long term I will start adding more complexity such as the ParaMiko and NetMiko libraries that use integrated SSH clients but for now I want to keep this as simple as possible so both you and I can get the most value out of these posts. Read more

What did you Expect? Part 1: Connecting to Cisco IOS

Most of my career I have been an network operator.  In that time there have been many repetitive tasks that I wish I could have automated but I simply did not not have the skill or knowledge to do anything about it.  So when Big Matt Stone sat down and showed me what writing code in Expect inside of Python was all about I was BLOWN AWAY!  This is part one of who knows how many in my series of starting to use Expect to automate network tasks. Read more