The previous recipe showed you how Neutron invokes methods in a mechanism driver for Network-related operations. In this recipe, we will see how to process API requests for Subnets.
In this recipe, we will enhance our driver and implement the methods that will process API requests for a Subnet. Ensure that your DevStack setup is up and running, with cookbook
as one of the mechanism drivers, as shown in the earlier recipe.
With the appropriate credentials, SSH into your DevStack setup.
Open
/opt/stack/neutron/neutron/plugins/ml2/drivers/ ch10_ml2_mech_driver.py
using an editor.Add a new import statement, as highlighted in the following image:
Update the class declaration statement to include the Subnet driver class, as follows:
CookbookMechanismDriver
now extends theCookbookSubnetMechanismDriver
andCookbookNetworkMechanismDriver
classes. Hence, it inherits the following additional methods: