
How to remove Python 2.7, and install python 3.6, PIP3 (version 21.1.1) to get Ubuntu Linux desktop (16.04) terminal ready to develop python 3 scripts
Practise Python if Statement and how it works
sudo apt-get update
sudo apt-get install build-essential libssl-dev libffi-dev -y
pip install paramiko
pip install netmiko
#!/usr/bin/env python
# This to display ip interface brief on linux terminal with Netmiko connection to Huawei router
from netmiko import ConnectHandler
NE40E = {
'device_type':'huawei',
'ip':'10.1.1.2',
'username':'huawei',
'password':'Hamdy@123',
}
net_connect = ConnectHandler(**NE40E)
output = net_connect.send_command('display ip int brief')
print(output)
#!/usr/bin/env python
# Connect to Huawei router with Napalm SSH connection, receive general info about the router
# selects the hostname to be printed separatelly
from napalm import get_network_driver
import pprint
driver = get_network_driver('huawei_vrp')
device = driver(hostname='10.1.1.2', username='huawei', password = 'Hamdy@123')
device.open()
get_facts = device.get_facts()
pprint.pprint(get_facts)
print(get_facts['hostname'])
#!/usr/bin/env python
# This script is to display ip interface brief
from napalm import get_network_driver
import pprint
driver = get_network_driver('huawei_vrp')
device = driver(hostname='10.1.1.2', username='huawei', password='Hamdy@123')
device.open()
get_interfaces_ip = device.get_interfaces_ip()
pprint.pprint(get_interfaces_ip)
#!/usr/bin/env python
# This script is to ping remote IP after logging to Huawei router
from napalm import get_network_driver
import pprint
driver = get_network_driver('huawei_vrp')
device = driver(hostname='10.1.1.2', username='huawei', password='Hamdy@123')
device.open()
ping_remote_ip = device.ping('10.1.1.9')
pprint.pprint(ping_remote_ip)
Configure VLANs, switch-ports, IP Interface
Welcome to Huawei Datacom Network Automation Developer Course, Network programming and automation became one of the most important network topics for building large automated networks that can scale and react easily to network changes. All daily network manual tasks should be converted into automated tasks to save time, increase productivity, and minimise human mistakes specially when it comes to large networks like Telecom Operator Networks. Python programming language is commonly and widely used for network engineers because of its simplicity and its rich network modules. Because Huawei is widely used in Telecom operators networks all over the world, it would be important to discuss automation tools Huawei devices.
Python Network Programming for Huawei devices course introduces how to install python 3 on Ubuntu linux with getting rid of python 2 when the terminal comes by default with python 2, and how to install network libraries (like Netmiko and Napalm) to connect with Huawei Routers like a robot (on behalf of a network engineer) that can automatically collect information and configure the routers with the usage of python scripts. The course is explained through practical exercises on EVE-NG and ubuntu Linux desktop.
Upon completing this course, you will be familiar with python 3 and network modules and build automated scripts to collect information about Huawei router with Netmiko library, and use napalm different libraries to collect information such as ‘display ip interface brief’ or ‘display version’, build automated script to check ip connectivity to a certain IP address with ping module and get the result, make automated configuration changes like configuring OSPF on Huawei Routers with the usage of both Netmiko and Napalm modules to know the difference between them.
You will also get familiar to NETCONF and how to practise it with Huawei NE40 to get information from it, and make configuration (configure interface and VLAN).
Ansible! you will learn about it, and how to perform automation for Huawei devices. It’s easy, simple to deploy with ready network modules, scalable, and doesn’t require python knowledge to deploy automated scripts.
The module gives you support on how to install all required modules on Ubuntu Linux.