Posts

Config Push using Netmiko

 import netmiko device_ip = input ("Enter Router IP address : ") ssh_user = input("Enter user name : ") ssh_password = input("Enter ssh password : ") enable_pass = input("Enter enable password : ") session = netmiko.ConnectHandler(ip = device_ip, username = ssh_user,  password = ssh_password, secret = enable_pass, device_type = "cisco_xe") session.enable() print ("Before config change") print (session.send_command("sh run int GigabitEthernet1")) config_change = ["int GigabitEthernet1", "description OSPF enabled interface" ] session.send_config_set(config_change) print ("After config change") print (session.send_command("sh run int GigabitEthernet1")) session.save_config() session.disconnect()

How to Configure SIG Tunnel using vManage for SDWAN

Image
                  How to Configure SIG Tunnel using vManage for SDWAN Before we configure from vManage , follow the steps : Step 1 : Login to Cisco Umbrella Portal (https://login.umbrella.com/) Step 2 : Click on Admin --> API Keys -- > Click on Umbrella Management Note : If Keys are not generated then generate it & copy the key & secret (we need to use this info in vManage SIG feature template) Org ID is written at the URL , Example : https://dashboard.umbrella.com/o/ ORG_ID #/admin/apikeys Step 3 : Login to vManage & create SIG credential feature template & enter Umbrella Key, Secret & ORG ID copied from Umbrella Portal Step 4 : Once SIG credential feature template created, then create SIG feature template add the details like Ipsec tunnel number , Source Interface (VPN 0 transport interface) & IKE parameters to build IPSEC tunnel (SIG) with Cisco Umbrella And if you have added 2  Tunnels then in high availability section of SIG feature template one you a

Netmiko Module

 Using Netmiko Module to SSH to device & run the command , Netmiko is SSH module focused on Network devices  import netmiko # Take all inputs from User  ip_address = input("Enter IP address:") user = input("Enter Username :") pas = input("Enter Password :") # Device type is important while using connecthandler function of netmiko as it supports multivendor session = netmiko.ConnectHandler(ip = ip_address, username = user, password = pas, device_type = "cisco_xe") #Enter command to run & print it  command = input("Enter Command to run:") print(session.send_command(command + "\n")) #Disconnect Session session.disconnect()

Operators in Python

Image
                           Arithmetic Operators in Python  Concatenation of Strings can be achieved by using + operator & repetition of strings can be achieved by using * operator .. Rest of arithmetic operators are self explanatory ... Relational Operators in Python  Above Relational operators are self explanatory , output of relational operations are either True or False ..                                         Assignment Operators                                          Logical Operators  AND (should be written in small case ): If both the operands are True, then condition becomes True ...  OR (should be written in small case ): If any of the operands is True, then condition becomes True ...  NOT (should be written in small case ) : Used to reverse the logical state of its operand ...  Example :

Mutable & Immutable Data Types

Image
                    Mutable & Immutable Data Types  Mutable Data Types : Data Types (Variables) whose values can be changed or updated after they are created and assigned are called mutable.. Immutable Data Types : Data Types (Variables) whose values  can not  be changed or updated after they are created and assigned are called mutable.. Lists [ ] In above Example you can see x is  list data type which consists of values 1,2,3,4 .. In position 0 of x  (position 0 is index value),  1 was present but then we assigned 100 in position 0 of x .. Hence value of position 0 is updated from 1 to 100 ... Hence , List data type is mutable in nature.. I will cover more details on index position of list data type in further blog... Dictionary {Key:Value} : In above Example you can see ips is dictionary data type which consists of key :values pair .. Inside Dictionary vBond , vSmart & vManages are Keys... And 1.1.1.1 , 2.2.2.2 & 3.3.3.3 are its values respectively ... Then we replaced/u

Data Types

Image
                                               Data Types in Python  There are various types of data types which can be classified as below : Every Value  is specific to any data type in python.. Numbers Intergers Data Type : 1 , 2, -3, 0  Floats Data Type : 1.2 , 4.5 , -3.5 Complex Number Data Type : 5 + 6i, 4 + 4i Output : In Above Example cmath module is used to print real & imaginary part of complex number .. Later in blog I will explain how we can write a code using module & usage of functions.. Boolean Data Type : True and False == is Rational operator which compares , In above example first x = is assigned with 1 & then x is compared whether is 1 or not .. Hence Boolean Data type shows it is true or false ... Then we used type syntax to find the type of data type of True & False data type... Sequences  Strings Data Type : "ASR 1001-HX" , "vEdge" , "vManage" .. It is written inside single or double quotes. List Data Types : It is writ

Keywords, Identifiers, Variables , comments & Identity

Image
                              Python Keywords There are several reserved Keywords in python which cannot be used as variable or identifier in python These keywords has same definite purpose and are case sensitive .. We will discuss about these keywords later in due course ...                                        Identifiers  Identifiers are name used identify the variables  It cannot be keywords because keywords are reserved for special purpose Identifiers can start with lower case , UPPER CASE, __ underscore but cannot be special character.. Example : router = "ASR 1k" Here router is Identifier , now ASR 1k is inside double quotes hence router is consider as a string variable. 1 2 3 4 >>> router = "ASR 1K" >>> type(router) < class ' str '> >>> Explanation : Here, router is Identifier  ASR 1K is string written inside 2 double quotes String is assigned to identifier , hence router considered as string variabl

Fundamental of Python Programming

Image
           Fundamental of Python Programming We write code in python programming language , this code is generally referred as source code... Source codes are generally are high level language and cannot directly Interact with machine directly , it need compiler or interpreter to interact with machine. Source code Written in Python ---> Compiler/Interpreter ---> Machines language interact with machines                                                     Python Features  High level Language :  It is high level language as I have explained it above which complied by complier to convert into Machine language to interact with machines  Case Sensitive : Python is Case sensitive , example networkapi is different than NetworkApi Indentation for blocks and nested Blocks : Unlike C/C++ which uses semicolon to end of line in code... Python uses  space, tab, enter, colon etc to indicate indentation of code .. So be mindful on that ...                                              Python Inte
Welcome to my Micro blogging of Network Automations & API where we will not only learn how to configure networking devices using Python Programming but we will also learn about new technologies like Netconf, Yang Modeling , various  Data formatting like xml , json or yaml... We will try to simplify troubleshooting using python programming and learn about ansible configuration management sever to configure routers.. Also we will also learn few DevOps concepts like git commit, git pull, CI-CD etc.. In this new Era of DevNet we also need to keep your skills up with  Linux & virtualization  concepts, because  SDN , SDWAN or SD-LAN / SDA devices are controlled by linux server hosted in virtual environment ...