10/19/2024
Introduction to Network Programming
and Automation
Page 0 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Foreword
• Networks are evolving to be more open, more flexible, and simpler. Huawei's vision is to help
customers build intent-driven networks (IDNs).
• Network openness and programmability are prerequisites of intent-driven networks.
Page 1 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
1
10/19/2024
Objectives
Upon completion of this course, you will be able to describe:
▫ Background of network programming and automation.
▫ Network openness levels.
▫ Open capabilities of Huawei iMaster NCE.
▫ Positioning and capabilities of network automation engineers.
Page 2 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Contents
1. Network Programming and Automation
2. Network Automation Engineers
3. Course Overview
Page 3 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
2
10/19/2024
Background: Complex Networks
• From the first day when the computer network is generated, the network is complex and difficult to manage, which is reflected
in the following aspects:
▫ There are various network devices such as routers, switches, firewalls, and intrusion detection system (IDS).
▫ Devices from different or even the same vendors are managed in different ways.
▫ Complex devices result in complex network management.
3 Complex network management Multiple network management systems
2 Different device management modes CLI SNMP Web IPFIX
1 Diverse network devices
Router Switch Firewall Device from another vendor
Page 4 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Background: Network Architecture Transformation
• Software defined networking (SDN) brings about network architecture transformation. It introduces a network controller to
implement centralized control from a global perspective, achieving objectives such as fast service deployment, traffic
optimization, and network service openness.
Orchestration application layer Service
APP collaboration
NBI
Service
Controller layer
orchestration
SBI
Device layer Data forwarding
Page 5 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
3
10/19/2024
Basic Network Automation
• Network automation means that tools are used to implement automatic network deployment, operation, and
maintenance, gradually reducing the dependency on human resources.
• There are many open-source tools that implement network automation in the industry, such as Ansible,
SaltStack, Puppet, and Chef. These tools connect to devices through SSH to implement batch operation and
management, achieving basic network automation.
Network automation
Chef keywords SaltStack
NMS tool
Ansible Python Automatio
n scripts
Shell
Page 6 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Development of Network Automation
• In basic network automation, networks are managed on the CLI. The pain point is that network devices return unstructured data (text display),
which is inconvenient for computers to process. The basic requirement of network automation development is that devices provide structured
data, which can greatly promote the development of network automation. Devices provide NETCONF/RESTCONF interfaces to provide data in
XML or JSON format.
Structured data: easy to understand for machines
{ "Interfaces":
Unstructured data: easy to understand for humans { "GigabitEthernet0/0/0":
{ "InUti": "10", "OutUti": "20", "inErrors": "0", "outErrors": "0" },
Interface InUti OutUti inErrors outErrors
"GigabitEthernet0/0/1":
GigabitEthernet0/0/0 10% 20% 0 0
{"InUti": "20", "OutUti": "30", "inErrors": "0", "outErrors":"0"}
GigabitEthernet0/0/1 20% 30% 0 0 }
... }
CLI/SSH, SNMP NETCONF, RESTCONF
Discussion: What are the benefits
Network devices of open APIs?
Page 7 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
4
10/19/2024
Network Openness and Programmability
• Network openness and programmability is to use programming methods to implement automated networks on the premise of
open networks.
• In the early stage of SDN commercial use and in the future, traditional networks and SDN networks will coexist on a large scale.
Network openness is implemented at two levels: device openness and SDN platform openness.
RESTful API
CLI/SSH, SNMP, NETCONF, RESTCONF,
Telemetry, OPS, ...
Device-based openness and programmability SDN-based openness and programmability
Page 8 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Huawei iMaster NCE, Open and Programmable
• iMaster NCE (NCE for short) is an innovative network cloud engine of Huawei. The overall open programming capabilities of NCE include
automation, analytics, and intent engines. The goal is to build a full-lifecycle open programmable architecture to meet customer requirements for
openness and programmability. NCE service openness and programmability are designed to help customers implement service automation.
Intent
Design Conversion
Verification
Intent engine
Automation Analytics
Management unit Control unit Analysis Decision
Sensing
making
Automation engine
Analytics engine
Open and programmable NCE services
Page 9 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
5
10/19/2024
Contents
1. Network Programming and Automation
2. Network Automation Engineers
3. Course Overview
Page 10 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Overview and Objectives
• Generally, network engineers focus on network protocol principles, configuration, and management
of network devices. System engineers focus on operating system principles, configuration, and
management of system services. Development engineers focus on programming languages,
algorithms, and other related development capabilities.
• Network automation engineers for network programming and automation must be all-rounders who
master skills of these positions to some extent. This part introduces capability requirements on
network automation engineers and how to implement network programming and automation.
Page 11 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
6
10/19/2024
Network Automation Engineers
• Network engineers:
▫ Network engineers are professionals who master network technologies, have professional skills, competence, and project
management experience in the network engineering field. They are able to fully communicate with customers or other
project stakeholders onsite. In addition, they can develop implementation solutions and project plans (recognized by
project stakeholders) based on customer requirements and environment factors, fully mobilize resources of all parties to
ensure timely and high-quality project implementation, and provide training for stakeholders and deliver engineering
documents after the project is implemented.
• Network automation engineers:
▫ They are professionals who have network skills, competence, and project management experience in the network
automation field. They aim to meet the requirements of automatic deployment, development, and O&M of enterprise
networks.
Page 12 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Comprehensive Competence Model
• Compared with the comprehensive competence model of network engineers, network automation
engineers have the same basic competence and professional skills, but have different skill
requirements in terms of expertise.
Comprehensive competence model for network engineers
Team Process
Business etiquette
collaboration specification
Service Industrial
Values
management knowledge
Service Presentation Engineering
consciousness capability knowledge In addition to basic network technologies,
Information
Problem solving
Product network automation engineers need to master
search knowledge
Learning ability
Communication Technical development-related technology, product, and
competence knowledge
engineering knowledge.
Basic qualification Professional skills Expertise
Page 13 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
7
10/19/2024
Expertise
• The expertise of network automation engineers must be all-rounders who master skills of network
engineers, system engineers, and development engineers to some extent, including but not limited to
the following capabilities:
Source code management Source code control to help developers manage and store code
Programming language A good command of at least one programming language
Operating system (OS) Understanding the basic principles and mechanism of the OS
Network technology A good command of basic network protocol principles and network engineering technologies
Open network architecture A good command of the data structure and resource structure of open networks
Other professional knowledge Other related professional knowledge, such as database knowledge
Page 14 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Learning Objectives
• This course focuses on the following capabilities of network automation engineers:
Source code management Git
Programming language Python and integrated development environment (IDE)
OS N/A
Principles and code implementation of network technologies such as NETCONF, YANG,
Network technology
Telemetry, SNMP, and SSH
XML/JSON, Huawei NCE northbound RESTful API, and Huawei NCE service openness and
Open network architecture programmability
Others HTTP/TLS, northbound invocation tools
Page 15 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
8
10/19/2024
Contents
1. Network Programming and Automation
2. Network Automation Engineers
3. Course Overview
Page 16 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Introduction to Course Modules
• This course consists of four modules: programming basics, device openness and programmability, NCE northbound openness,
and NCE service openness and programmability.
Device openness and NCE service openness and
Programming basics NCE northbound openness
programmability programmability
Basic programming knowledge, Network programming and Network automation course module Course module based on the NCE
including: automation course module based on based on the northbound openness service open programming function,
device openness capabilities and capability of Huawei NCE, including: including:
• Python basics
Python practices:
• REST and RESTful • Jinjia2
• Python advanced
• SSH
knowledge • HTTP/HTTPS • Compilation of an NE driver
• SNMP package
• Source code management • RESTful invocation tools
• NETCONF/RESTCONF • Compilation of a service driver
• Scenario-based invocation
package
• Telemetry practice (campus network and
DCN) • Scenario-based service
• Huawei device OPS
provisioning practices and NBI
invoking
Page 17 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
9
10/19/2024
Python Overview
• Python is a fully open-source high-level programming language. It was created by Guido van Rossum.
• All coding practices in this course are based on Python.
Advantages of Python: Disadvantages of Python:
• Python has elegant syntax, dynamic typing, and interpretative nature. • Low running speed. Python is an
Python allows learners to focus on program logic instead of learning interpreted language that can run
syntax details. without compilation. The code is
• Python supports both process-oriented and object-oriented translated line by line into machine code
programming. that the CPU can understand, which is
• Python has rich third-party libraries. time-consuming.
• Python can invoke code written in other languages, therefore it is
known as "glue language".
In addition to language advantages, Python has abundant third-party libraries. Therefore, Python can be used in many
fields, such as AI, data science, apps, and automatic O&M scripts.
Page 18 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Python Learning Map
• Python can be used in many fields. To facilitate Python learning and use in the network
engineering field, this course divides Python into basics and advanced learning. Python basics
enable you to basically implement network programming and automation.
Python basics Python advanced knowledge
Python environment setup Syntax basics Regular expression
Data types and operators Python standard library Decorators
Control flow I/O operation Iterator and generator
Functions Exception processing Multitasking
Object-oriented programming Others
Page 19 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
10
10/19/2024
Device Openness and Programmability
• Device openness and programmability aim to provide engineers with guidance on how to implement network automation
through programming based on device openness capabilities.
• The following figure shows the open capabilities of Huawei network devices. This course module focuses on how to use Python
modules.
Python code
#!/usr/bin/env python
...
paramiko pysnmp ncclient requests grpc Uploading .py files
CLI/SSH SNMP NETCONF RESTCONF Telemetry FTP
Network devices MIB YANG Open Programmability System
Page 20 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
NCE Northbound Openness
• The openness and programmability of the controller provide engineers with guidance on how to implement network
automation through programming based on the open capabilities of the SDN controller.
• Huawei iMaster NCE includes controllers and provides northbound RESTful APIs. This course module focuses on how to use
tools to invoke NCE NBIs.
RESTful API
CloudFabric SD-WAN CloudCampus NCE-IP
Network devices
Page 21 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
11
10/19/2024
Huawei NCE Service Openness and Programmability
• NCE service openness and programmability is a subsystem
RESTful API Web UI
of NCE. It provides E2E programing capabilities including
Open programmability the openness of NE-layer functions and the openness of
framework of Huawei NCE
network service functions.
SSP
YANG • Engineers compile an NE driver package (specific NE driver,
YANG
SND) and a service driver package (specific service plugin,
SSP
SSP) to implement the following functions:
Service callback logic Python
▫ Multi-vendor device management
▫ User-defined network services
NE profile 1 NE profile 2 Jinjia2
▫ Web-based service management
▫ Automatic exposure of northbound RESTful APIs
SND
SND
NE YANG 1 NE YANG 2 YANG
NCE automatically generates NETCONF packets and sends the packets to a
device, or configure a device in CLI/SSH mode.
Page 22 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Summary
• Network programing and automation is to use programming methods to implement
automated networks on the premise of open networks. Network openness is implemented at
two levels: device openness and SDN platform openness.
• Network automation engineers must be all-rounders who master skills of network
engineers, system engineers, and development engineers to some extent to support
enterprise network automation.
• This course consists of four modules: programming basics, device openness and
programmability, NCE northbound openness, and NCE service openness and
programmability. Next, let's learn network programmability.
Page 23 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
12
10/19/2024
Thank
谢 谢You
www.huawei.com
Page 24 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
13