Commit Graph

33 Commits (295b967fc62fbd3eb733d9af83d1e2a99ef558a2)

Author SHA1 Message Date
Jenkins 38d9350e8a Merge "Add missing unit test for segment db" 6 years ago
Boden R fde6710515 use MechanismDriver from neutron-lib + shim
The ml2 MechanismDriver is now in neutron-lib along with its associated
constants. This patch switches over to the lib versions of those, but
leaves a shim of the MechanismDriver that just ref's the driver from
lib. This shim allows our broad consumer base of the driver to switch
over at their leisure.


Change-Id: I99e3de6d933a1bb341394f85415fb07306a82a01
6 years ago
Dongcan Ye 8595a01702 Add missing unit test for segment db
This patch add test for get_dynamic_segment.

Change-Id: Icf676059a0dd24ad18b8632563c4de81190f0d04
Closes-Bug: #1684519
6 years ago
Dongcan Ye 2d6290daf7 Add network_id in segment check log
For the purpose of debug, it will useful to know network_id in

Change-Id: I16c4a9da6ae0e32f82d1e454500e2d7236169238
6 years ago
Jenkins 77f885f06a Merge "use neutron_lib's portbindings api-def" 6 years ago
Boden R 7bd521e7ce use neutron_lib's portbindings api-def
Neutron-lib 1.1.0 is now out and contains the portbindings
API definition (as per commit [1]). This patch moves neutron
references over to the neutron-lib version.

- Consumers using the public constants within neutron's
portbindings API extension must now use the values
from neutron-lib.

[1] 87e42f993c07ae320159d5123662ee9f3bd4d903

Change-Id: I669af9b4c712877772d91a03857ab108714001d4
6 years ago
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():


With new enginefacade we change context.session.begin() for

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
6 years ago
Jenkins b8f3abeea3 Merge "Network OVO in neutron/tests/unit/plugins/ml2" 6 years ago
Nakul Dahiwade 2ea27c7da3 Network OVO in neutron/tests/unit/plugins/ml2
This patch integrates Oslo-Versioned Object for Network model class
in neutron/tests/unit/plugins/ml2

Change-Id: Ic73398bc81202460c37af59824ec076d65816715
Partially-Implements: blueprint adopt-oslo-versioned-objects-for-db
6 years ago
Armando Migliaccio ca751a1486 Spin off context module

Partially-implements: blueprint neutron-lib

Change-Id: I48cf45dc1b07035d952152eac2548a3bd9fc2832
6 years ago
Kevin Benton 7dfa64bf41 Remove ORM relationship between ports and networks
This relationship doesn't serve a purpose and it results
in SQLAlchemy trying to set the network_id column on ports
to NULL when attempting to delete a network with ports in it.

This results in the following exception:

IntegrityError: (1048, u"Column 'network_id' cannot be null")

This exception is not treated as a DBReferenceError by olso.db
which makes detecting races between ports being created on a
network being deleted very noisy in the logs since oslo.db treats
this as a generic DBError.

By removing the relationship, deleting a network will now just
result in a boring standard foreign key constraint failure which
will propagate from oslo.db as a DBReferenceError that is easy
to catch.

The patch that depends on this one adjusts the delete network logic
to capture these ReferenceErrors.

Change-Id: I4166a9bbaded57a77576400929a150123b8f1b2e
6 years ago
Jenkins 3ed3d52c09 Merge "Use Port OVO in ml2/db and plugins/ml2/test_db" 7 years ago
Manjeet Singh Bhatia c28bade4eb Use Port OVO in ml2/db and plugins/ml2/test_db
Port object is merged, this patch uses port object
in plugins/ml2/ and unit/plugins/ml2/

Change-Id: Ic1b617a789ea9c7e0ad369f34478d33e17837ba9
Partially-Implements: blueprint adopt-oslo-versioned-objects-for-db
7 years ago
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.


Partially-Implements blueprint: enginefacade-switch

Change-Id: Ie1c54138ceaf9ac6f0674ad2786d4aaea9c80f73
7 years ago
Ann Kamyshnikova 4eb4500472 Refactor ml2_db to pass context
We have a number of functions that expect to get session as one of
the arguments. Passing session is not correct and this prevents
the usage of new enginefacade which expect context to be passed
and session will be injected in current context.


Change-Id: If600033de801e1a3759919b272ac52f0850bf49c
7 years ago
Manjeet Singh Bhatia 2b66c6a2ed Relocate L3 DB Models
As we have started oslo versioned objects implementations. There
would be issue of cyclic import while implementation for objects
which have db models definitions and mixins in same file. This patch
will move routers models as discussed in [1].

For example DNS models and some queries are in same file [2]. for object
implementation I have separate models definitions and mixins where
queries were being done [3].


Change-Id: I9b9a44da5d28252be58cea1a920a64e18d8bbf32
Partial-Bug: #1597913
7 years ago
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
7 years ago
Jenkins 8cb7848e65 Merge "Create segment_host mapping after new network" 7 years ago
venkata anil 89cd4d07d1 Rename dvr portbinding functions
As part of making DVR portbinding implementation generic, we rename
dvr portbinding functions as distributed portbinding functions.
In next patch we make dvr logic for port binding generic,
to be useful for all distributed router ports(for example, HA).

Partial-Bug: #1595043
Partial-Bug: #1522980
Change-Id: I402df76c64299156d4ed48ac92ede1e8e9f28f23
7 years ago
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
7 years ago
Jenkins 44fcb7bd18 Merge "Rename ml2_dvr_port_bindings to make it generic" 7 years ago
venkata anil 77bfd82c3c Rename ml2_dvr_port_bindings to make it generic
Distributed port binding need to be implemented for HA router ports
to fix bug 1522980. HA ports can use existing DVR implementation for
multiple port binding. So we have to make current DVR port binding
implementation generic, so that all distributed ports(like DVR, HA)
can use it.

As part of making it generic, we rename 'ml2_dvr_port_bindings' table
to 'ml2_distributed_port_bindings', so that all distributed ports
(DVR, HA ..) can use this table.

Partial-Bug: #1595043
Partial-Bug: #1522980
Change-Id: I24650b7dee6305f801b457c4f21c8b16fb0eb6e0
7 years ago
Hong Hui Xiao 66c357400b Deprecate the functions map after segment moving out of ml2
This is a clean up for patch [1], the functions map should be removed
to make code easy to read. Start a deprecation cycle for these functions
in case external projects will use them.


Change-Id: I77c83bd7ee0c8ef92d8aaaa8e968479b848532fe
Partially-Implements: blueprint routed-networks
7 years ago
Henry Gessau 4148a347b3 Use constants from neutron-lib
With this we enable the deprecation warnings by default.

Related-Blueprint: neutron-lib

Change-Id: I5b9e53751dd164010e5bbeb15f534ac0fe2a5105
7 years ago
Jenkins c4ec972987 Merge "Fix port relationship for DVRPortBinding" 7 years ago
lzklibj 951dd5e015 Fix port relationship for DVRPortBinding
uselist=False is used for one to one relationship, but for
DVRPortBinding, a router_interface_distributed port can have
multiple bindings. That causes SAWarning:
Multiple rows returned with uselist=False for lazily-loaded attribute

"uselist=False" is misused in DVRPortBinding port relationship,
this patch will fix this.

Change-Id: I2b00d96aaa445e0977bc3d4957d35a28d44dd953
Closes-Bug: #1540259
7 years ago
Yatin Kumbhare 6b4be76e14 Fix params order in assertEqual
Fix params order to correspond to real signature:
assertEqual(expected, actual)

Change-Id: I722b998f6eae47076f3d10213073296a0a9a2081
Closes-Bug: #1277104
7 years ago
lzklibj b68d4eee1f Remove dead method delete_dvr_port_binding
This method is dead, not been used in upstream code, nor
in stable/liberty, nor in stable/kilo, remove it now.

Change-Id: I072cd548bf56c3f08764571e8c20888427ad801f
7 years ago
Kevin Benton 806e67538f Batch db segment retrieval
A net-list operation was calling extend_network_dict_provider for
each network individually which would result in a database call for
each network.

This adds a new call in the manager to extend multiple networks at
once and then it adds a bulk version of get_network_segments that
it calls.

Now 1 net list of any number of networks will only result in 1
segment DB call.

Change-Id: I2543b3bdbb178ee4bb8d1288e9a27af1c5c8c8b4
Closes-Bug: #1525423
Partial-Bug: #1513782
8 years ago
ChangBo Guo(gcb) c3d65a0ed9 Switch to oslo_utils.uuidutils
Get rid of oslo-incubator uuidutils

Closes-Bug: #1467020
Depends-On: I2df519965883b05d5d58cdc4785c850b0685dc2c
Depends-On: I9f8e98ad9517864a9ffdacf01c0a9a5aab554edb
Depends-On: Ied0faac809a5b72b1cd466c8babc9ca5418692c3
Change-Id: Iebe491b981b4b7c02785412fadd27678bb5e47de
8 years ago
Dane LeBlanc 47dd65cf98 Reuse caller's session in ML2 DB methods
This patch changes the get_port_from_device_mac() and
get_sg_ids_grouped_by_port() methods in ML2 module so that
they do not create a new database session (via get_session()), but
instead reuse the session associated with the caller's context.

In order to make the session that is associated with the caller's
context available to these ML2 DB methods, the
get_ports_from_devices plugin API in
needs to be modified so that the context can be passed down to the
ML2 plugin. (A similar change is made to the get_port_from_device
plugin API for consistency.)

Change-Id: I3f990895887e156de929bd7ac3732df114dd4a4b
Closes-Bug: 1441205
8 years ago
Dane LeBlanc aeb5efe3fb Re-use context session in ML2 DB get_port_binding_host
This patch modifies ML2 DB get_port_binding_host method so that it
reuses the existing context session to do the database query
rather than creating a new database session.

Note that there are other methods in ML2 DB that do not re-use
the caller's session (get_port_from_device_mac() and
get_sg_ids_grouped_by_port()). These will be modified using
a separate bug (
Change-Id: I8aafb0a70f40f9306ccc366e5db6860c92c48cce
Closes-Bug: #1440183
8 years ago
Maru Newby 21bef562c2 Reorganize plugin test modules
This change moves plugin test modules to conform to the new rules on
unit test tree structure (see TESTING.rst).

Vendor plugin paths continue to be ignored, and unit test modules that
test features instead of modules are also ignored pending their
removal to the functional test tree.

Change-Id: I482c377ca72ffd58692ad84bd9692356513e4c98
Closes-Bug: #1440834
8 years ago