Commit Graph

21 Commits

Author SHA1 Message Date
Nurmatov Mamatisa 2d97f3edb2 use payloads for SEGMENT events
This patch switches over to payload style of callbacks for the remaining
SEGMENT based callback events. Unit tests are also updated as needed
to handle the switch.

NeutronLibImpact

Change-Id: I3624228238babc64fe02bf0cc56eb0c1f6d35e73
2021-05-05 15:17:50 +03:00
Rodolfo Alonso Hernandez 6f26f4026b Change provider network segmentation ID
In the ML2 plugin, allow to update the segmentation ID of a single
provider network.

A new method in the "SimpleAgentMechanismDriverBase" is added:
"provider_network_attribute_updates_supported". This method returns,
if implemented in the specific agent, which network attributes can
be updated on a live network with ports bound to this network back-end.
By default, an empty list is returned.

Partial-Bug: #1806052

Change-Id: I2595335d6fbc51562b070f14eaeaadf49cf7c418
2019-04-01 12:55:50 +00:00
Kailun Qin 563a536d02 Support Network Segment Range CRUD as extensions
This patch adds the support for network segment range CRUD. Subsequent
patches will be added to use this network segment range on segment
allocation if this extension is loaded.

Changes include:
- an API extension which exposes the segment range to be administered;
- standard attributes with tagging support for the new resource;
- a new service plugin "network_segment_range" for the feature
  enabling/disabling;
- a new network segment range DB table model along with operation
  logic;
- Oslo Versioned Objects for network segment range data model;
- policy-in-code support for network segment range.

Co-authored-by: Allain Legacy <Allain.legacy@windriver.com>

Partially-implements: blueprint network-segment-range-management
Change-Id: I75814e50b2c9402fe6776229d469745d7a72290b
2019-03-07 08:20:30 +00:00
Boden R e4aa5902f7 use context manager from neutron-lib
The neutron.db.api.context_manager already references neutron-lib's
context manager; so consumers of it are already using neutron-lib. This
patch switches neutron's references to the context_manager over to
use neutron-lib's directly rather than that in neutron.db.api.

NeutronLibImpact

Change-Id: I97120faeec73690592ed21a5ec3c6202f61e1429
2018-10-24 07:18:46 -06:00
Hongbin Lu 07b0dbf550 Convert Segment db model to OVO
Depends-On: Ia05df925eccf3c9d397748f282e995203a058de9
Change-Id: I1c2066e41d3b542ab44aaf9af4e4765f88738b2d
Partially-Implements: blueprint adopt-oslo-versioned-objects-for-db
2018-04-27 15:36:05 +00:00
Inessa Vasilevskaya 7322bd6efb Make code follow log translation guideline
Since Pike log messages should not be translated.
This patch removes calls to i18n _LC, _LI, _LE, _LW from
logging logic throughout the code. Translators definition
from neutron._i18n is removed as well.
This patch also removes log translation verification from
ignore directive in tox.ini.

Change-Id: If9aa76fcf121c0e61a7c08088006c5873faee56e
2017-08-14 02:01:48 +00:00
Boden R 0e2b667bf1 use neutron-lib callbacks
The callback modules have been available in neutron-lib since commit [1]
and are ready for consumption.

As the callback registry is implemented with a singleton manager
instance, sync complications can arise ensuring all consumers switch to
lib's implementation at the same time. Therefore this consumption has
been broken down:
1) Shim neutron's callbacks using lib's callback system and remove
existing neutron internals related to callbacks (devref, UTs, etc.).
2) Switch all neutron's callback imports over to neutron-lib's.
3) Have all sub-projects using callbacks move their imports over to use
neutron-lib's callbacks implementation.
4) Remove the callback shims in neutron-lib once sub-projects are moved
over to lib's callbacks.
5) Follow-on patches moving our existing uses of callbacks to the new
event payload model provided by neutron-lib.callback.events

This patch implements #2 from above, moving all neutron's callback
imports to use neutron-lib's callbacks.

There are also a few places in the UT code that still patch callbacks,
we can address those in step #4 which may need [2].

NeutronLibImpact

[1] fea8bb64ba7ff52632c2bd3e3298eaedf623ee4f
[2] I9966c90e3f90552b41ed84a68b19f3e540426432

Change-Id: I8dae56f0f5c009bdf3e8ebfa1b360756216ab886
2017-04-26 12:12:53 -06:00
Dongcan Ye 2d6290daf7 Add network_id in segment check log
For the purpose of debug, it will useful to know network_id in
check_segment_for_agent.

Change-Id: I16c4a9da6ae0e32f82d1e454500e2d7236169238
2017-04-21 16:37:57 +08:00
Victor Morales d26b96b7a2 Integrate NetworkSegment OVO
This patch integrates the NetworkSegment Oslo-Versioned Object.

Change-Id: Ie1569578fca45f3a705fbac44204a3d1e7bea7fe
Partially-Implements: blueprint adopt-oslo-versioned-objects-for-db
2017-04-16 02:56:18 -07:00
Ann Kamyshnikova cf34df8572 New enginefacade for networks, subnets.
Usage reader and writer for db operations.

In Neutron code we have common situation like:

with context.session.begin():
   context.session.add(obj)

self._make_obj_dict(obj)

With new enginefacade we change context.session.begin() for
db.context_manager.writer(reader).using(context).

When object leaves this with-block, its reference to session is
cleared because session is discarded. To use this object later to
load some data from its dependencies, we have to provide different
session to work in. To solve this obj either can be moved under
with-block or we have to do context.session.add(obj) one more time
to be able to load relations.

This change also switches to usage of new enginefacade for some db
operations with ports, in order to pass unit and functional tests.

Partially-Implements blueprint: enginefacade-switch

Change-Id: Ia15c63f94d2c67791da3b65546e59f6929c8c685
2017-03-30 01:26:45 -07:00
Ihar Hrachyshka 88e99f6f28 Clean up deprecated sqla model import paths
Those were moved under neutron.db.models start of Ocata. We should be
able to clean them up now.

NeutronLibImpact

Change-Id: Iadbf44d52ee8e30712807384152a29ce1a8b8f72
2017-02-25 03:42:34 +00:00
Ann Kamyshnikova 12b0e16692 Change passing session to context in segments db functions
We have a number of functions that expect to get session as one
of the arguments. Passing session is not correct and this prevents
using new enginefacade which expects context to be passed and
session will be injected in current context.

NeutronLibImpact

Partially-Implements blueprint: enginefacade-switch

Change-Id: Ie1c54138ceaf9ac6f0674ad2786d4aaea9c80f73
2016-12-23 16:47:41 +04:00
Gábor Antal 1628fb72f8 Improved readibility and fixed indentation
In some places, indentation was wrong.
In this patchset, they are fixed.
Also, I did some readibility improvements which I've found
during indentation fixing.

Change-Id: I298b9b0c557c07848c69ed23b0faa3a3147d055d
2016-10-10 11:03:53 +02:00
sindhu devale 72ddd2338b Relocate Segment DB Models
As there would be issue of cyclic imports while implementation of
objects for segments which has db models definition and mixins in same
file, this patch will relocate segment models.

Change-Id: I6f5aea69a0f7f1647bb06c86f1fac9367717033c
Partial-Bug: #1597913
Co-Authored-By: Victor Morales <victor.morales@intel.com>
2016-10-05 13:06:39 -05:00
Artur Korzeniewski 94ee8bc306 Introduce ovo objects for networks
Those objects are intentionally not integrated into the database code so
far. This is to quicken access to their definitions to implement
push-notifications for networks.

Segments are part of the network object. Since we need to reduce the
number of SQL queries executed per resource, and we want to include
segmentation information for networks, Network model was extended with
segments relationship that makes the information available on every
network resource fetch from the database. This change required some
change in test_dhcp_agent_scheduler to expire a session used in the
tests to avoid obsolete segment state to be reused to validate
scheduling.

This implementation of the object is not complete for the job of
updating the resource in database. For example, tags are not yet exposed
on the object; also attributes like availability_zones, or external
network attributes, are not covered. Those attributes are hopefully
needed on server side only, so until we adopt the object for server
side, it should be ok to live without them.

Another database related thing still missing in this patch is lack of
RBAC support for the object. To complete this support,
a real get_bound_tenant_ids should be put onto the object, instead of
the current no-op stub.

This patch also includes some rearrangements that simplified the work.
Specifically, all network related objects are consolidated in the
neutron.objects.network module, instead of being scattered through the
code base. Also, some setup code from test_policy relevant to RBAC was
moved into the base test class so that it can be utilized by other RBAC
enabled objects, like network.

Partially-Implements: blueprint adopt-oslo-versioned-objects-for-db
Partially-Implements: blueprint push-notifications

Co-Authored-By: Victor Morales <victor.morales@intel.com>
Change-Id: I5160d0ab9e8042c356229420739db0ce42842368
2016-09-29 15:36:47 +00:00
Kevin Benton 465d22180e Add common way to extend standard attribute models
This adds a way for standard attribute models to declare
the API resources they show up in. It then adds a utility
function to the standard_attr module to grab a map of all
API resources and their corresponding models.

This can be used by any processing code that wants to add
fields to standard attribute resources.

This also adjusts the existing extensions to leverage this
new functionality.

Partially-Implements: blueprint add-neutron-extension-resource-timestamp
Change-Id: Idc8923d0e983fcb0690f8cb5b55a5aff8690154f
2016-09-15 01:42:24 +00:00
Reedip 5ef869b3bc Add name and desc to networksegments table
This patch adds the name and description column to the
networksegments table.

Change-Id: I7edc224e25e604dfd7613b945a4ca16d9e385760
Partially-Implements: blueprint routed-networks
2016-09-01 09:41:09 -06:00
Henry Gessau 61cc14fd67 Switch to neutron-lib for model_base
Change-Id: If5b2b4cc0346515ddef3da1255ab49327c8e5732
2016-08-31 11:12:18 -04:00
Carl Baldwin 040d740d20 Create segment_host mapping after new network
This adds logic to add segment to host mappings for agents after a
network with one or more segments is created. The previous logic was
doing this only after an agent initially reported after the server
started.  This meant that any segmented networks created after the
agent was running would not get mappings to the agent's host.

Change-Id: Ie265500639b1119f0448ed272d235fb709db36f6
Partially-Implements: blueprint routed-networks
2016-06-30 18:08:16 -06:00
Hong Hui Xiao 1080620e5a Dont use query if network_ids is empty
A warning could be found in SQLAlchemy, if handling empty WHERE IN
clauses. This is found at neutron.db.segments_db.get_networks_segments

To avoid it, just return empty dict in such case.

Change-Id: I3cf727dede1d5909aeefbf852332818164ad3777
Closes-bug: #1586816
2016-05-30 03:13:21 +00:00
gong yong sheng c8fca1c96f Make network segment table available for standalone plugin
Some standalone plugins, such as networking-ovn, are expecting
to store provider network information in neutron database, but
we have no table, like other extensions do, for provider
network extension defined.

This patch moves NetworkSegment table out of the ML2 code tree.
The API methods to operate segments are also moved, but stub
methods are still kept in the ml2 db API.

Co-Author: Miguel Lavalle <malavall@us.ibm.com>
Change-Id: I2c4f78fce591486ded63252af13fc0c60d02a3e8
Partially-Implements: blueprint routed-networks
2016-03-25 15:04:22 +00:00