Hi Lajos. Thank you. I have a progress. I think my fake extension works. I added ``` extensions.register_custom_supported_check( "vpc_extension", lambda: True, plugin_agnostic=False ) ``` to ``` class Vpc(api_extensions.ExtensionDescriptor): extensions.register_custom_supported_check( "vpc_extension", lambda: True, plugin_agnostic=False ) ... ``` and I use ml2 extension driver without any new plugin. https://github.com/openstack/neutron/blob/master/neutron/tests/unit/plugins/... I tested it with python neutronclientapi. So I can change my new attribute (neutron.update_network(id, {'network': {'new_attribute': some string }})) and I see my changes (neutron.list_networks(name='demo-net')) I'm close to the end. Now I'm using modifed `TestExtensionDriver(TestExtensionDriverBase):`. It works but It stores the data locally. And I want to use class TestDBExtensionDriver(TestExtensionDriverBase): (https://github.com/openstack/neutron/blob/master/neutron/tests/unit/plugins/...) I tried to use it but I got such errors in neutron-server.log: "Table 'neutron.myextension.networkextensions' doesn't exist" How can I create a new table? I saw https://docs.openstack.org/neutron/latest/contributor/alembic_migrations.htm... and https://github.com/openstack/neutron-vpnaas/tree/master/neutron_vpnaas/db but I still don't understand. I mean I think some of the neutron_vpnaas/db files are generated. Are neutron_vpnaas/db/migration/alembic_migrations/versions generated? Which files I should create(their names, I think I can copy from neutron_vpnaas/db/) and what commands to type to create one new table: https://github.com/openstack/neutron/blob/master/neutron/tests/unit/plugins/... ?
Hi Igor,The line which is interesting for you: "Extension vpc_extension not supported by any of loaded plugins" In core Neutron for ml2 there is a list of supported extension aliases: https://opendev.org/openstack/neutron/src/branch/master/neutron/plugins/ml2/...
And there is a similar for l3 also: https://opendev.org/openstack/neutron/src/branch/master/neutron/services/l3_...
Or similarly for QoS: https://opendev.org/openstack/neutron/src/branch/master/neutron/services/qos...
So you need a plugin that uses the extension.
Good luck :-) Lajos Katona (lajoskatona)
Igor Zhukov <fsb4000@yandex.ru> ezt írta (időpont: 2022. aug. 23., K, 16:04):
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/p...
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/...
Best wishes
Lajos Katona
Igor Zhukov <fsb4000@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/...
How to configure neutron server, where should I put the file, should I create another files? How can I test that it works?