Thursday, October 28, 2021

Access into Network Programmability

 It has been almost two months since I decided to start my studies to get my first certificate into the DEVNET path.

things were really confusing at first because honestly I knew nothing about the programming in general, I studied languages like Pascal in University, but that was longtime ago and lots has changed since then (2005-2009).

Knowing that studying programming in University does not necessarily means you are going to be able to make codes or become a programmer per se.

anyway let us talk about the networking world these days and how Cisco is contributing into making the new network engineering career and keeping it's  certified engineers at the top!


As we all know that working on big size networks can be really time consuming sometimes when it comes to routine tasks, things that you might get tasked to do by your manager that require lots of logins and typing lots of commands into switches/routers/firewalls.

and as we all know, many of our networks today are comprised of different products from different vendors.

this impose many risks in addition to the main one which is the time and effort required to do a tasks that might be very simple to achieve on one or two devices but the risk of making mistakes while working on huge network size is high.

this is why, many network engineers who had the programming skills were already trying to solve such problems using programming tools.

we all worked our way using things to make our jobs little bit easier by using Notepad to make scripts for commands and paste them into Network nodes.

this came up handy even in monster exams like CCIE.

in our work environments we might even used SecureCRT and sent commands to all tabs via Command window. 

but what if we have hundreds of a mixed products from different companies?

well, Cisco created a whole certification path to help us as engineers to understand and ease our tasks and save our time by learning new but not really new skills that will add up to our knowledge and support us to be more innovative, this is why Cisco DEVNET courses launched to teach us from zero to hero how to be in the new era of Network Engineering.

When Cisco published the free courses on Cisco Learning Network Site, the course had materials that teach you Linux, Windows, MacOS, VSCODE, Python, Git, GitHub and how to make your PC a Development Environment.

https://learningnetwork.cisco.com/s/learning-plan-detail-standard?ltui__urlRecordId=a1c3i0000005hsLAAQ&ltui__urlRedirect=learning-plan-detail-standard

You can learn about API and How to practically use Python to make codes that can actually help you in your daily tasks.

All of these mentioned above are standard and can work on any computer free and require nothing to operate.

Of Course the certificate will be joined with a training about Cisco products like Cisco DNA, and Cisco SD-WAN. 

Here is a look at the path of the DEVNET certification:

Image soure: Cisco.com

Cisco Has announced the Expert level recently as you can see the "New" above.

This all brings us to the moment where we ask ourselves, do you want to stay as legacy network engineer? or you need to move on and keep yourself updated? of course in IT field, you should always keep your knowledge fresh and up to date, otherwise, you should really think doing something else because IT world is never gonna stop evolving.

you should evolve as well or you are going to extinct.


Ok, so how adding programmability into networking skills going to help me in my work? in simple words, you can make one script that will help you configure or pull data from large number of nodes in few seconds, of course you will keep these codes and use them from time to time whenever needed! what about if they were from different vendors?

that is also ok because you can use libraries in python that can work on different vendors at the same time without the need to create a unique codes for each vendor.

examples: Using NAPALM to configure or get configuration from Nodes, check the list below for the supported vendors.

Image Source:napalm.readthedocs.io

More information about supported list of devices can be found in the link below:

https://napalm.readthedocs.io/en/latest/support/index.html


That being said, How I started my journey into this path? First of course I started with the denial phase, which is "I'm a network engineer and not a programmer!"

which is basically wrong, because network engineers do programming on daily basis while they do their work on any network device!.

anyway, once I had the courage to start, I started with Practical python learning, which is get the code, even if it's copied entirely from a site, I would do it just for the sake of trying a code and see how it works.

My training started with a very cheap course that I got from Udemy for 11$, this course came out handy! I actually used a code to get all serials for a small inventory job which was done in a matter of seconds! (of course making the code work took some work and time to execute :p, but still I can use it in coming tasks and will spend no time to make it work).

Ok, so this was my first course, and the important thing is how you find the Video/Books or blog or anything that will give you the spark to start understand and love the thing that you have been procrastinating to get your hands dirty with!.


every person learns differently, some people like to read books first and some prefer to study by video first. Well, I am the type of video first learners, I like to know what I'm going through before I start, which means I have to watch the videos first and then books.

It does not matter, just do what makes you comfortable and makes study easy.


Another good resource to study for the DEVASC would be the Official certification guide book by Cisco press, if you get the premium edition, it will be joined with a test engine that you can use to test yourself with its question which comes in a multi-choice form.

the book goes through the blueprint and explains the topics in each chapter, you see python and Cisco DNA, API and REST and SD-WAN, JSON and XML YAML and YANG RESTCONF and NETCONF.

The crucial part of preparing your development environment is choosing the system you will work on, is it gonna be Linux or windows or MacOS? I have seen many people recommending Linux Ubuntu, and Cisco video courses does go through the setup of Ubuntu as a workstation for such a thing, but I chose Windows and MacOS.

basically MacOS is the most programming friendly environment IMO.

so why go to Ubuntu? of course it does not hurt to learn linux but in my case I want to most stable system.

next, you will need to decide how you will practice and run your codes? because you can use VSCODE to make codes and send to a real/lab nodes directly, but also GNS3 is great option to do your labs, especially the option to download network automation appliance that comes with all needed tools ready to use. (you can search it and find it on GNS3 site).

personally I prefer both, GNS3 and real equipment because once you make sure your script is fine, you can make some use of it.

there is a list of requirements that you need to make sure to download and install on your environment whether it was linux or windows or MacOS.

the list is but not limited to: Python (latest version)

Ansible, Paramiko (netmiko), telnet library, NAPALM, PyATS, YANG, JSON....etc. 

Note that with all the pros of network programmability there is of course cons, because we cannot exclude the human error factor from this, imagine running a code for a number of devices with some mistake in the code, this is going to be catastrophic to some environments.  

This is my journey toward Cisco DEVASC, it started and not going to end until I achieve my goal and pass the exam.


Will be updated soon!


Samer R. Saleem




















Monday, October 25, 2021

Product review (Cisco CBS250 Switch)

 In this post, I will be reviewing my notes and experience during my work on new switches from Cisco.

the switches that I used to replace old HP switches with.

first of all, the Cisco CBS250 switches has nice white color and beautiful Cisco logo, they come with different sizes supporting from 8 to 48 ports and of course the SFP's.

have a look on a real photo for the product:

 


 

link to these products:

https://www.cisco.com/c/en/us/products/switches/business-250-series-smart-switches/index.html?ccid=cc001531


Price starting from: $235.00 USD

Ok, now let's start talking a little bit on the configuration part of the switch:

1. It supports GUI (which is very nice and well structured)

2. SSH and Telnet (Remote)

3. Console

 The switch also comes with a default username and password of (cisco), which you will be requested to change both after your first login.

one of the nice things I noticed is that the switch also has the automatic Baud rate detection, which will allow you connecting to switch without even altering your serial configs.



 

 

 

 

Don't mind the rubbish at the first line, this shows up during switch bootup because the auto detection is not active yet.

 So now let's talk about Network features, starting with the commands that you will need to configure the switch in order to make it ready for work.

1. Add a hostname using the command #hostname xxxxxx

2. Enable SSH if you are willing to connect to it via the SSH #ip ssh serve

then you need to go to:

#line ssh   (no more VTY)

(config-line)#login authentication default  (this will make the switch work with the default authentication method configured)

3. set the management IP address #interface vlan x     #ip address x.x.x.x x.x.x.x

4.set the gateway #ip default-gateway x.x.x.x

Note: at this moment, you would be also able to login to the switch using HTTP/HTTPS (GUI) but of course you need to set the IP address for the management.

Creating the vlans can be done at the beginning because you need to have them ready before you configure the SVI.

 

So now we talk about the Voice VLAN, which you must identify in the switch.

#VLAN 34

#voice vlan ID 34

So might need to add the OUI of the phones if it was not listed in the OUI table:


 

 



Ok, what about the switchports access type? well, below the types you can configure a port according to your needs:

1. Access  (vlan unaware port)

2. Trunk (vlan aware port)

3. General (generic port mode)

4. Customer (customer equipment port)


Note: by default the Switch comes with a Macro enabled and will put interfaces into vlan's automatically and even add a description, but in my case I had to disable it and configure ports according to my requirements.

here is how you disable the Macro globally:

#no macro auto

or you can disable per interface:

#no macro auto smartport

you can also create your own macro:

(config)#macro name SAMER

Ok, which mode to put your interface you need to configure, because for end users usually you need ports to be access ports, but since you need a phone then we used to have switchport voice vlan command before but now, this command is no longer available.

you have the following options:

1. automatic configs using the Macro

2. configure port as trunk (I don't think this is a good idea)

3. configure the port as general mode and use the (tagged option for the voice vlan)

and untagged for the PC and then PVID of the PC vlan.


in case you you won't be needing the Phone with your port then make it as Access mode only.

and of course the Uplinks must be Trunk.


here is an example:

interface GigabitEthernet1
 description DESKTOP
 port security max 2
 switchport mode general
 switchport general allowed vlan add 110 tagged  (Voice)
 switchport general allowed vlan add 16 untagged (User PC)
 switchport general pvid 16
 no macro auto smartport

 Lot's of configuration syntax has changed. for example, port security is not like before:



 

 

the modes changed permanent and lock  (not sure if this was changed longtime ago or I just didn't use Cisco switches for a longtime!)

 I found that removing the tab option which shows the options of the syntax for the available commands or completes the command is a bit annoying because it is not working like before.

 Overall, Cisco Switches always great, hardware and software and also the communities that can respond to your questions are really great.

you can't find this on other vendors forums.

 

Lastly
I want to talk about the GUI which I found pretty nice:

 you can choose HTTPS from the window itself as below



 

 

 

 

 

 

 

 

 

 The design is well structured as you can see below and the interface is really interactive:

 


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Well, this is all I have for now, I hope this was useful!

 

Samer R. Saleem

 

 

Python-Jinja template configuration generator for Cisco devices and printout configs to external text files

 In this post, I worked on collecting a code that works with Jinja template. the nice thing in working with Jinja is that you can have basel...