Deleting a VLAN using RESTCONF and requests
With the creation (see the Creating a VLAN using RESTCONF and requests recipe) and change of a device configuration (see the Updating a VLAN using RESTCONF and requests recipe) taken care of, we need to have a look at the final operation we have thus far neglected: deleting resources that are present in our device configuration.
Let's now go ahead and delete our previously created and then changed VLAN programmatically.
Getting ready
Open your code editor and start by creating a file called delete_vlan.py
. Next, navigate in your terminal to the same directory in which you just created the delete_vlan.py
file.
How to do it…
Follow these steps to delete a VLAN using RESTCONF and requests
:
- Import the required modules and set up a
requests
session that can interact with the device. We will also import the prettyprint standard library to get a nicely formatted output later. For a detailed step-by-step guide...