[Neutron] How to add Fake ML2 extension to Neutron?

Igor Zhukov fsb4000 at yandex.ru
Tue Aug 23 14:04:23 UTC 2022


Hi again!

Do you know how to debug  ML2 extension drivers?

I created folder with two python files: vpc/extensions/vpc.py  and vpc/plugins/ml2/drivers/vpc.py (also empty __init__.py files)

I added to neuron.conf
api_extensions_path = /path/to/vpc/extensions

and I added to ml2_ini.conf
extension_drivers = port_security, vpc.plugins.ml2.drivers.vpc:VpcExtensionDriver

and my neutron.server.log has:

INFO neutron.plugins.ml2.managers [-] Configured extension driver names: ['port_security', 'vpc_neutron.plugins.ml2.drivers.vpc:VpcExtensionDriver']
WARNING stevedore.named [-] Could not load vpc_neutron.plugins.ml2.drivers.vpc:VpcExtensionDriver
....
INFO neutron.api.extensions [req-fd226631-b0cd-4ff8-956b-9470e7f26ebe - - - - -] Extension vpc_extension not supported by any of loaded plugins

How can I find why the extension driver could not be loaded?

> Hi,The fake_extension is used only in unit tests to test the extension framework, i.e. :
> https://opendev.org/openstack/neutron/src/branch/master/neutron/tests/unit/plugins/ml2/drivers/ext_test.py#L37
> 
> If you would like to write an API extension check neutron-lib/api/definitions/ (and you can find the extensions "counterpart" under neutron/extensions in neutron repository)
> 
> You can also check other Networking projects like networking-bgvpn, neutron-dynamic-routing to have examples of API extensions.
> If you have an extension under neutron/extensions and there's somebody who uses it (see [1]) you will see it is loaded in neutron servers logs (something like this: "Loaded extension: address-group") and you can find it in the output of openstack extension list --network
> 
> [1]: https://opendev.org/openstack/neutron/src/branch/master/neutron/plugins/ml2/plugin.py#L200
> 
> Best wishes
> Lajos Katona
> 
> Igor Zhukov <fsb4000 at yandex.ru> ezt írta (időpont: 2022. aug. 22., H, 19:41):
> 
>> Hi all!
>>
>> Sorry for a complete noob question but I can't figure it out 😿
>>
>> So if I want to add Fake ML2 extension what should I do?
>>
>> I have neutron server installed and I have the file: https://github.com/openstack/neutron/blob/master/neutron/tests/unit/plugins/ml2/extensions/fake_extension.py
>>
>> How to configure neutron server, where should I put the file, should I create another files? How can I test that it works?



More information about the openstack-discuss mailing list