Network Programming and Automation Essentials

Book description

Unleash the power of automation by mastering network programming fundamentals using Python and Go best practices Purchase of the print or Kindle book includes a free PDF eBook

Key Features

  • Understand the fundamentals of network programming and automation
  • Learn tips and tricks to transition from traditional networking to automated networks
  • Solve everyday problems with automation frameworks in Python and Go

Book Description

Network programming and automation, unlike traditional networking, is a modern-day skill that helps in configuring, managing, and operating networks and network devices. This book will guide you with important information, helping you set up and start working with network programming and automation.

With Network Programming and Automation Essentials, you’ll learn the basics of networking in brief. You’ll explore the network programming and automation ecosystem, learn about the leading programmable interfaces, and go through the protocols, tools, techniques, and technologies associated with network programming. You’ll also master network automation using Python and Go with hands-on labs and real network emulation in this comprehensive guide.

By the end of this book, you’ll be well equipped to program and automate networks efficiently.

What you will learn

  • Understand the foundation of network programming
  • Explore software-defined networks and related families
  • Recognize the differences between Go and Python through comparison
  • Leverage the best practices of Go and Python
  • Create your own network automation testing framework using network emulation
  • Acquire skills in using automation frameworks and strategies for automation

Who this book is for

This book is for network architects, network engineers, and software professionals looking to integrate programming into networks. Network engineers following traditional techniques can use this book to transition into modern-day network automation and programming. Familiarity with networking concepts is a prerequisite.

Table of contents

  1. Network Programming and Automation Essentials
  2. Contributors
  3. About the author
  4. About the reviewers
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the example code files
    5. Download the color images
    6. Conventions used
    7. Get in touch
    8. Share your thoughts
    9. Download a free PDF copy of this book
  6. Part 1: Foundations for Network Automation
  7. Chapter 1: Network Basics for Development
    1. Reviewing protocol layers, network device types, and network topologies
      1. Protocol layers
      2. LAN, WAN, internet, and intranet
    2. Describing network architecture and its components
      1. Diagrams
      2. Network node names
      3. The last-mile network
      4. The physical architecture
      5. The routing architecture
      6. Types of failure
      7. Failure detection techniques
      8. Control plane and forwarding plane
      9. Graceful restart
    3. Illustrating network management components, network bastions, and more
      1. ACL
      2. Management system and managed elements
      3. In-band and out-of-band management
      4. Network telemetry
      5. Management information base
      6. Network bastions
      7. FCAPS
      8. Network planning
      9. Network security
    4. Summary
  8. Chapter 2: Programmable Networks
    1. Exploring the history of programmable networks and looking at those used in the present day
      1. Active networking
      2. NodeOS
      3. Data and control plane separation
    2. Virtual network technologies
      1. Virtual private networks
      2. The Virtual Router Redundancy Protocol
      3. The Virtual Extensible Local Area Network
      4. Open vSwitch
      5. Linux Containers
      6. Virtual machines
    3. SDNs and OpenFlow
      1. History of OpenFlow
      2. SDN architecture
      3. OpenFlow and its future
    4. Understanding cloud computing
      1. Commercial cloud computing
      2. The OpenStack Foundation
      3. Cloud Native Computing Foundation
    5. Using OpenStack for networking
      1. OpenStack Neutron
      2. The Neutron API
    6. Summary
  9. Chapter 3: Accessing the Network
    1. Working with the CLI
      1. The command prompt
      2. Serial access
      3. Remote insecure access
      4. Remote secure access
    2. Using SNMP
      1. SNMP agents and managers
      2. An SNMP MIB
      3. SNMP versions
      4. SNMP primitive methods
      5. SNMP security issues
    3. Employing NETCONF
      1. Motivation
      2. OpenConfig
      3. YANG
      4. NETCONF
      5. RESTCONF
    4. Adopting gRPC
      1. The letter g
      2. Motivation
      3. Overview
      4. Protobuf
      5. gRPC and network telemetry
      6. Code examples using gRPC
    5. Operating with gNMI
      1. Protocol layers
      2. The data model
      3. The communication model
      4. Service definition
      5. gNMI-gateway
    6. Summary
  10. Chapter 4: Working with Network Configurations and Definitions
    1. Technical requirements
    2. Describing the configuration problem
      1. Source of truth
      2. The startup configuration and the running configuration
      3. Configuration states and history
      4. Deployment pipeline
      5. Network diagrams and automation
    3. Using network definitions to aid automation
      1. The router configuration render
      2. Using configuration templates
      3. Using Python engine templates
      4. Using Go engine templates
    4. Creating network definitions
      1. Nested and hierarchical definitions
      2. IP allocation considerations
      3. Using files for definitions
      4. File format
      5. Names
    5. Exploring different file types
      1. XML files
      2. JSON files
      3. YAML files
    6. Summary
  11. Part 2: Network Programming for Automation
  12. Chapter 5: Dos and Don’ts for Network Programming
    1. Coding topics
      1. Peer review
      2. Life cycle
      3. Refactoring
      4. Copying code and licensing
      5. Code quality and perception
      6. Architecture and modeling
    2. Applying best practices in coding
      1. Follow the standards
      2. Mindful code writing
      3. Making it extremely readable
      4. Commenting your code
      5. Use IP libraries
      6. Follow naming conventions
      7. Don’t shorten variable names
      8. Avoid complex loops
      9. Don’t repeat code
    3. Coding formatters
      1. Python Black
      2. Python isort
      3. Python YAPF
      4. Go gofmt
      5. Go golines
      6. Go golangci-lint
    4. Versioning and concurrent development
      1. clone
      2. checkout
      3. commit
      4. Mainline
      5. Branching
      6. Merging
    5. Testing your code
      1. Unit testing
      2. Integration testing
      3. E2E testing
      4. Other testing
    6. Summary
  13. Chapter 6: Using Go and Python for Network Programming
    1. Technical requirements
    2. Looking into the language runtime
      1. What are compiled and interpreted languages?
      2. Python interpreter
      3. Go compiler
      4. Pros and cons of programming runtimes
    3. Using third-party libraries
      1. Adding Python libraries
      2. Adding Go libraries
    4. Accessing network devices using libraries
      1. Libraries to access the network via a CLI
      2. Libraries to access networks using SNMP
      3. Libraries to access networks using NETCONF or RESTCONF
      4. Libraries to access networks using gRPC and gNMI
    5. Summary
  14. Chapter 7: Error Handling and Logging
    1. Technical requirements
    2. Writing code for error handling
      1. Adding error handling in Go
      2. Adding error handling in Python
    3. Logging events
      1. Severity levels
    4. Adding logging to your code
      1. Adding event logging in Go
      2. Add event logging in Python
    5. Summary
  15. Chapter 8: Scaling Your Code
    1. Technical requirements
    2. Dealing with multitasking, threads, and coroutines
      1. Multiprocessing
      2. Multithreading
      3. Coroutines
    3. Adding schedulers and job dispatchers
      1. Using classical schedulers and dispatchers
      2. Working with big data
    4. Using microservices and containers
      1. Building a scalable solution by example
    5. Summary
  16. Part 3: Testing, Hands-On, and Going Forward
  17. Chapter 9: Network Code Testing Framework
    1. Technical requirements
    2. Using software for testing
      1. Differences between emulation and simulation
    3. Using device emulation
      1. Scaling up emulation with containers
    4. Connecting devices for testing
      1. Using physical wires to connect
      2. Using software to connect
      3. Building a hybrid lab
    5. Using advanced testing techniques
      1. Using time dilation
      2. Using monkey testing
      3. Using artificial intelligence
      4. Using network simulation
      5. Using traffic control
    6. Summary
  18. Chapter 10: Hands-On and Going Forward
    1. Technical requirements
    2. Using a network lab
    3. Building our network lab
      1. Launching the lab host
      2. Checking the lab host
    4. Connecting the devices
      1. The OOB management network
      2. Looking at the topology
      3. Creating the connections between devices
      4. Automating the connections
      5. Looking into the automation program
      6. Checking the connections manually
    5. Adding automation
      1. Link connection check automation
      2. IP configuration automation
      3. Additional network lab automation
    6. Going forward and further study
      1. Checking popular platforms and tools
      2. Joining the network automation community
    7. Summary
  19. Index
    1. Why subscribe?
  20. Other Books You May Enjoy
    1. Packt is searching for authors like you
    2. Share your thoughts
    3. Download a free PDF copy of this book

Product information

  • Title: Network Programming and Automation Essentials
  • Author(s): Claus Töpke
  • Release date: April 2023
  • Publisher(s): Packt Publishing
  • ISBN: 9781803233666