This commit adds a document to devref that explains the implementation of the segments plug-in Change-Id: I80928eac7a6cb051c3d6532d83c9d9ecd328cd18
2.3 KiB
Segments extension
Neutron has an extension that allows CRUD operations on the
/segments resource in the API, that corresponds to the
NetworkSegment entity in the DB layer. The extension is
implemented as a service plug-in.
Note
The segments service plug-in is not configured by
default. To configure it, add segments to the
service_plugins parameter in neutron.conf
Core plug-ins can coordinate with the segments service
plug-in by subscribing callbacks to events associated to the
SEGMENT resource. Currently, the segments plug-in notifies
subscribers of the following events:
PRECOMMIT_CREATEAFTER_CREATEBEFORE_DELETEPRECOMMIT_DELETEAFTER_DELETE
As of this writing, ML2 and OVN register
callbacks to receive events from the segments service
plug-in. The ML2 plug-in defines the callback
_handle_segment_change to process all the relevant segments
events.
Segments extension relevant modules
neutron/extensions/segment.pydefines the extensionneutron/db/models/segment.pydefines the DB models for segments and for the segment host mapping, that is used in the implementation of routed networks.neutron/db/segments_db.pyhas functions to add, retrieve and delete segments from the DB.neutron/services/segments/db.pydefines a mixin class with the methods that perform API CRUD operations for thesegmentsplug-in. It also has a set of functions to create and maintain the mapping of segments to hosts, which is necessary in the implementation of routed networks.neutron/services/segments/plugin.pydefines thesegmentsservice plug-in.