Files
neutron/doc/source/contributor/internals/segments.rst
Brian Haley e63cdd216b Alphabetize some of the admin and contrib docs
Over time docs were added or updated such that they were
no longer in alphabetical order based on the index order
or their title strings. Tried to fix it up a bit along
with some capitalization.

Trivialfix

Change-Id: I948b2a1c86faaffed07adcf0198a3fba72401abe
2023-09-18 13:12:31 -04:00

2.5 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.

Details about the DB models, API extension, and use cases can be found here: routed networks spec

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_CREATE
  • AFTER_CREATE
  • BEFORE_DELETE
  • PRECOMMIT_DELETE
  • AFTER_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.py defines the extension
  • neutron/db/models/segment.py defines the DB models for segments and for the segment host mapping, that is used in the implementation of routed networks.
  • neutron/db/segments_db.py has functions to add, retrieve and delete segments from the DB.
  • neutron/services/segments/db.py defines a mixin class with the methods that perform API CRUD operations for the segments plug-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.py defines the segments service plug-in.