Reader small image

You're reading from  Mastering Python Networking - Fourth Edition

Product typeBook
Published inJan 2023
Reading LevelIntermediate
PublisherPackt
ISBN-139781803234618
Edition4th Edition
Languages
Concepts
Right arrow
Author (1)
Eric Chou
Eric Chou
author image
Eric Chou

Eric Chou is a seasoned technologist with over 20 years of experience. He has worked on some of the largest networks in the industry while working at Amazon, Azure, and other Fortune 500 companies. Eric is passionate about network automation, Python, DevOps, and helping companies build better security postures. In addition to being the author of Mastering Python Networking (Packt), he is the author or co-author of other top-selling books and highly-rated online classes. Eric is the primary inventor or co-inventor for three U.S. patents in IP telephony and networking. He shares his deep interest in technology through his books, classes, blog, and contributes to some of the popular Python open source projects.
Read more about Eric Chou

Right arrow

VyOS example

VyOS is a fully open-source network OS that runs on a wide range of hardware, virtual machines, and cloud providers (https://vyos.io/). Because of its open-source nature, it is gaining wide support in the open-source community. Many open-source projects are using VyOS as the default platform for testing. In the last section of the chapter, we will look at a quick VyOS example.

The VyOS image can be downloaded in various formats: https://wiki.vyos.net/wiki/Installation. Once it’s downloaded and initialized, we can install the Python library on our management host:

(venv) $ pip install vymgmt

The example script, vyos_1.py, is very simple:

#!/usr/bin/env python3
import vymgmt
vyos = vymgmt.Router('192.168.2.116', 'vyos', password='vyos')
vyos.login()
vyos.configure()
vyos.set("system domain-name networkautomationnerds.net")
vyos.commit()
vyos.save()
vyos.exit()
vyos.logout()

We can execute the script to...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Mastering Python Networking - Fourth Edition
Published in: Jan 2023Publisher: PacktISBN-13: 9781803234618

Author (1)

author image
Eric Chou

Eric Chou is a seasoned technologist with over 20 years of experience. He has worked on some of the largest networks in the industry while working at Amazon, Azure, and other Fortune 500 companies. Eric is passionate about network automation, Python, DevOps, and helping companies build better security postures. In addition to being the author of Mastering Python Networking (Packt), he is the author or co-author of other top-selling books and highly-rated online classes. Eric is the primary inventor or co-inventor for three U.S. patents in IP telephony and networking. He shares his deep interest in technology through his books, classes, blog, and contributes to some of the popular Python open source projects.
Read more about Eric Chou