Commit Graph

48 Commits (17d6123f789fd6522bcdb3ef215f8688f073f505)

Author SHA1 Message Date
Gary Kotton efb5bd8582 Use flake8-import-order plugin
This enables us to automate the import order validations.

Change-Id: Icb9bc9e10f7d4652cbe02ea902a0581f2feda7da
6 years ago
Jenkins 6143fd1812 Merge "Enable pylint 1.4.5" 6 years ago
Dong Jun 91294cad88 Enable pylint 1.4.5
This patch enables pylint 1.4.5 checking in netwoking-ovn.
Script tools/ is copied from neutron and adapted for
.pylintrc is also copied from neutron, message options that do not
need to be suppressed have been removed and some of remaining options
will be removed by code adjustment in separate patches.

Change-Id: I9e1612583debb555199b416675eea6685801f04c
6 years ago
Boden R e7ffa9ca87 use service type constants from neutron_lib plugins
The well known service type constants are in
neutron_lib.plugins.constants, but for legacy reasons a few still exist
and are referenced from neutron_lib.constants [1] that we'd like to

This patch switches references over to neutron_lib's plugin constants.


Change-Id: I8b5141f952b3500c7a4ce9c36e07a04630a5e44f
6 years ago
Lucas Alvares Gomes fdd576101e Add network and subnet resources to OVNClient
This patch is adding the network and subnet resources from the ml2
driver into OVNClient so later in this series of patches they can make
use of journaling.

Related-Bug: #1605089
Change-Id: I8477c246628711111c16f801c3dfad601eae9ba1
6 years ago
Lucas Alvares Gomes 9d8b07a7b5 Add OVNClient for Ports and L3 resources
Right now we have code doing CRUD operations on ONV resources spread
around different places (ml2/, l3/, this makes
things very complicated to implement something like journaling (see
bug: #1605089) where all resources, L2 and L3, are created from a
central place (the journal thread, which keeps things in order).

This patch is adding a new class called OVNClient which centralizes all
the CRUD operations for the OVN resources in one place.

For this first iteraction, the Port resource from the mechanism driver
and the L3 resources (floating ip, routers and routers ports) are being
moved to this new class, others will come in follow up patches.

Related-Bug: #1605089
Change-Id: Ia453a14cdc2ec393037fb813caff8fae23acd7c3
6 years ago
Dong Jun f8cd0ec591 Remove sleep() in _sync() to make it callable
Remove sleep in _sync() and do this delay when spawning greenthread,
then _sync() can be renamed to a callable method.
There are a few benefits, sync caller can simply call do_sync() instead of
sub-functions, and adding new sync sub-functions such as trunk, qos will
be simplified too,

Change-Id: I7b8acb9de0d2085443ac77c57fa4835f93241c55
Signed-off-by: Dong Jun <>
6 years ago
Ihar Hrachyshka ad6e1cebd7 Stop translating log messages
This is in line with late i18n team requests, and to adopt the new N537
hacking check from neutron-lib.

Change-Id: Ieacc6d3cfcea6846054655312916d29c1bb40d43
Depends-On: I1a7fff4140e50deb0e10024dedfba45d793b20fe
6 years ago
Dong Jun 24c5ca9ca0 Pass original mac to _get_ovn_dhcpv6_opts when syncing
Pass original mac to _get_ovn_dhcpv6_opts when syncing, otherwise a
warning occurred for stateless DHCP because _get_ovn_dhcpv6_opts uses
a new random mac and then options do not match.

Change-Id: Id24083953f2eab4ef7e5035a3eece76e007e002f
Closes-Bug: #1681621
Signed-off-by: Dong Jun <>
6 years ago
Russell Bryant ac226200ab Remove DHCP and L3 agent remnants.
Both the L3 and DHCP agents are no longer supported.  Remove many more
remnants from when they were supported.

Change-Id: If71489f9ac56c7c26746d0fbfb4640e570591f26
Signed-off-by: Russell Bryant <>
6 years ago
Dong Jun 6598de41a2 Sync provnet lsp missing in OVN DB for provider network
If ls exists in OVN DB and provnet lsp doesn't, provnet lsp syncing from
neutron network(vlan or flat) is not handled.

Change-Id: I3db3d98d95791f018eb3803916dc2bee9522affd
Closes-Bug: #1671394
Signed-off-by: Dong Jun <>
6 years ago
Armando Migliaccio 043fab5585 Use neutron-lib's context module
Change-Id: If5040d047f4b28247b66a888d223e66ecf1dacf7
6 years ago
Jenkins 38bee1c420 Merge "fix deepcopy dict_keys exception in python3.5" 6 years ago
Jenkins fa8b7d09d0 Merge "Ignore syncing floating IP ports when handling DB sync" 6 years ago
Guoshuai Li 45076c6b15 fix deepcopy dict_keys exception in python3.5
change dict_keys object to list

Closes-Bug: #1666113

Change-Id: I34a51bfd5712173196f8d5c59bbae7bd8abb3bd0
6 years ago
Dong Jun b8c319149b Ignore syncing floating IP ports when handling DB sync
Ignore syncing floating IP ports when handling OVN DB sync.

Change-Id: I4161f870e819e55963867a33d09580d4b81ad4ad
Closes-Bug: #1665574
Signed-off-by: Dong Jun <>
6 years ago
Dong Jun d532260556 Remove get_router when handling floating IP
It is useless to get router when handling floating IP, because
'gw_port_id' is no longer needed for setting NAT addresses.

Change-Id: Ief7f0a6ee4be62e08a2b3677ea2650a5549c6d01
Closes-Bug: #1664842
Signed-off-by: Dong Jun <>
6 years ago
Dong Jun 06890430ce Support distributed NAT in networking-ovn native L3 routing
This is a patch for supporting distributed NAT with centralized NAT rules
in networking-ovn native L3 routing.

Remove transit network
Support scheduling gateway port by setting redirect-chassis
Support gateway sNAT
Support gateway default route
Support floating IP
Support full sync including sNAT, gateway route and floating IP

Unit tests of syncing sNAT and FIP
Gratuitous ARP for sNAT and FIP

Closes-Bug: #1658622
Change-Id: I217d6c391140fa4392ae1cea0bc21c9ea0521796
Signed-off-by: Dong Jun <>
Co-authored-by: Guoshuai Li <>
6 years ago
Guoshuai Li 8b8a7dd9e7 Replace six.itervalues() with .values()
Replace six.iterkeys() with "for key in dict"

1.As mentioned in [1], we should avoid using six.itervalues and six.iterkeys().
We can use dict.values instead, as it will return iterators in PY3 as well.
And dict.items/keys will more readable. 2.In py2, the performance about
list should be negligible, see the link [2].

Change-Id: I099b2ac3b0db3c4b7d20b94523d91725cae9df45
6 years ago
Boden R b141ee2130 Use neutron-lib provider net api-def
This patch refactors networking-ovn to use provider net
from neutron-lib. For more details see [1].



Change-Id: I2056353a4046ae2d91abcfa93895edc5c7e71119
6 years ago
Dong Jun 274385296f Fix issue of adding router interface from dashboard with specified IP
When adding a router-interface from dashboard with subnet and a
specified IP, the port in neutron DB contains security_groups default.
The networking-ovn adds router-interface IP to "Address_Set" of
Actually, the router port need no security groups, this issue affects
lrouter's forwarding.
This patch fixes this bug. If security groups are present in a trusted
port we ignore them.

Change-Id: Ie872510416f50fcee7ec6d3760006b095621bff9
Closes-Bug: #1647949
Signed-off-by: Dong Jun <>
7 years ago
Jenkins 32d868ede2 Merge "Replace six.iteritems() with .items()" 7 years ago
Armando Migliaccio 89a04ac01f Switch to using plugins directory in lieu of neutron manager
Partially-implements: blueprint neutron-lib

Change-Id: Ia615535669e50dbb84904905abfff183df2394a9
Depends-on: I7331e914234c5f0b7abe836604fdd7e4067551cf
Depends-on: I3214a19e2374221b211ac7ab9b98842a1bdfc4a7
7 years ago
melissaml ac1764b618 Replace six.iteritems() with .items()
1.As mentioned in [1], we should avoid using six.iteritems to achieve iterators.
We can use dict.items instead, as it will return iterators in PY3 as well.
And dict.items/keys will more readable. 2.In py2, the performance about
list should be negligible, see the link [2].

Change-Id: I23a273d6e84f4046787a7dadf4691b6d5a9c3f75
7 years ago
Jenkins b8af082e32 Merge "Neutron lib integrations (L3)" 7 years ago
Jenkins 273954d3e4 Merge "Remove workarounds for python ovs mutate bug" 7 years ago
Gary Kotton 9471d7f6db Neutron lib integrations (L3)
Use L3 constants from Neutron-lib. This exists from version 1.0.0
of the library.


Change-Id: If7aa249d7f182da3d6c507af1928d3b2af6100d3
7 years ago
Richard Theis a72554637f Remove workarounds for python ovs mutate bug
Now that [1] is merged to ovs branch-2.6 and OpenStack requires
ovs >= 2.6.1, remove the networking-ovn workarounds.

Note: The wrapper functions which support the non-mutate code paths
will be removed in a separate patch set.


Depends-On: I38f9c6ec84667fecbe0353cd073b9b65d1c47d13
Change-Id: I961189f4439f932bfb8311f72e21e527b1b808f0
Closes-Bug: 1629099
7 years ago
Chandra S Vejendla b40f1dda47 NAT support (SNAT, FloatingIP)
This commit introduces the NAT support for networking-ovn. The proposal for
NAT support can be found @ [1]

1. Add functional test cases (To be followed up in a different patch)
2. Add sync code (Opened a bug to track this)
3. Add unit tests for the new ovsdb APIs (Opened a bug to track this)


Change-Id: I9b78ceb6b42e96c1ba58ed269e369b46113edd7e
Closes-Bug: 1514995
Closes-Bug: 1551717
7 years ago
Jenkins 16c7b50e72 Merge "enhance DHCP with improved transaction" 7 years ago
Gary Kotton e214575ba9 Use diff_list_of_dict from neutron-lib
This method was deprecated in Neutron.


Change-Id: I4df2bf215f022e69729c327143a6565763ebe649
7 years ago
lzklibj ff4a8d4a9f enhance DHCP with improved transaction
Based on improved neutron ovsdb transaction, we can put two ovsdb commands
into to one transaction, when they have dependency on data structure.
Like, before we set port dhcp options for a port, or create a port with port
dhcp options, we need to insert the port dhcp options first, and get the
inserted UUID. And currently, we do these by separated transactions.

Separated transactions make orphan row can happen, and to clean orphan rows
related to ports left behind, we do full table scan to locate them, lose in

Since the patch will fix the orphan DHCP_Options row issue,
DelLSwitchPortCommand will be also enhanced to remove port dhcp options
referred by port within the same transaction.

Depends-on: I1781794958af1483dabc0f5d17f2df6fea828564
Closes-bug: #1626812
Closes-bug: #1626828
Change-Id: Id078d57fe84e1af8db061ae6b812f162fed02dcd
7 years ago
Numan Siddique ed998d2dd7 Support native OVN DHCPv6
For v6 subnets, the 'DHCP_Options.options' in the OVN NB DB were set to empty.
This patch now sets this column for v6 subnets and also sets the
'Logical_Switch_Ports.dhcpv6_options' appropriately. If extra DHCPv6 options
are defined for a port, a new row in DHCP_Options table is created just like
the way it is done for DHCPv4.

Beside 'enable_dhcp' attribute check to a subnet, for v6 subnets, we will also
check its 'ipv6_address_mode', to make sure v6 subnets with 'slaac' as
'ipv6_address_mode' attribute value will have no DHCP_Options rows for them
be created.

Co-authored-by: Zongkai LI <>
Change-Id: I9cf5a7ef7676c4461c05d6cb2aabbcb95b20f4d7
7 years ago
Richard Theis 41c397ef62 Workaround OVS transaction mutate bug
Using OVS transaction mutate support causes the updated column to
be an empty list after the mutation. This results in subsequent
actions taken based on the column data to be incorrect. The column
data is accurate again once the current transaction completes. It
appears that the OVS python IDL is not properly handling getattr()
after column mutation.

This workaround is needed until OVS is fixed. The workaround drops
transaction mutate support for logical router static routes since
they require numerous column data comparisions within a single
transaction. In addition, OVN DB sync ACL processing had to be
modified to ensure mutations wouldn't impact any comparison. At
this time, no other problems where identified.

The functional tests were updated to test the logical router
static routes problem and other paths with multiple commands
within a mutate transaction.

Recent neutron relocations also required a couple minor unit
test updates.

Change-Id: I11782a74a7b08dbfd54aeb37cfbda68b0b3a2ef9
Related-Bug: 1622647
Partial-Bug: 1629099
7 years ago
Numan Siddique 759c5631d4 Add sync support for DHCP_Options
Co-authored-by: Zongkai LI <>
Change-Id: If4d2f862e73d044366e2fbd3690362b2a76eaf0c
Closes-bug: #1608899
7 years ago
Jenkins 7efc24527b Merge "Add DB sync support for lrouter port networks" 7 years ago
lzklibj 917b8d8a90 Add DB sync support for lrouter port networks
Per comments in,
add DB sync support for lrouter port networks.

Change-Id: I4c167b5bb343cb433e675771b37b1120906b22ec
7 years ago
Richard Theis 571f3b3f27 OVN NB sync ignores ACLs on lswitch without ports
The OVN NB sync ACLs processing ignores lswitches without ports.
As a result, the neutron-ovn-db-sync-util utility and neutron server
service startup sync won't delete ACLs on a lswitch unless the
lswitch has at least one port on it with a security group.

This patch set fixes the problem by using the neutron networks list
instead of the port security group binding list to determine the
OVN ACLs to process based on OVN lswitches.

Change-Id: Ie245186560c97b585f85c8497ab61d8ea22c0256
Closes-Bug: #1611963
7 years ago
Amitabha Biswas 86caa921b4 Sync support of SGs and ports to Address sets
This patch enables the OVN NB DB sync tool to sync SG, SG rules
in Neutron with Address Sets and ACLs in the OVN_Northbound DB.

Change-Id: I25071d8ce62709243ad5f08854aad344e4a62d07
Closes-Bug: #1600330
7 years ago
Hong Hui Xiao 81ed015135 Clear stale SegmentHostMapping when sync ovn sb db
When sync ovn sb db with neutron, compare the records in neutron and
information in ovn sb db. And then clear the stale data, udpate
existing data and add new data in neutron db.

Change-Id: Icb740af5613bb87577f19df98e8f578a3e5003f8
Partially-implements: blueprint routed-networks
7 years ago
Jenkins 4a2f1e5b83 Merge "Functional Test: Sync ACLs" 7 years ago
Richard Theis c7986525de Fix pep8 failures
Fix new pep8 failures impacting the gate.

Change-Id: Idbe5b2177a4426e346c7cb609de2b09879b14f3d
7 years ago
Richard Theis 63b4601db0 Functional Test: Sync ACLs
Enhance functional tests to ensure that ACLs are properly
synchronized during OVN NB DB synchronization.

While enhancing the tests, a bug was discovered that resulted
in synchronization removing all ACLs for a port when it only
needed to create the port in OVN (ACLs already exist). This
was caused by duplicate ACLs being created during the port sync.

Change-Id: Ief64f73511de70ff16aaf2a2a9d26ae5a718c3b3
Closes-Bug: #1594241
7 years ago
Amitabha Biswas 2030c299df Add OVN L3 Router Scheduler
This patch provides the infrastructure for the OVN L3 to schedule
the router gateway port. The OVN hypervisor administrator can
set aside certain hypervisors to be used for scheduling router
gateway ports. This is the corresponding WIP patch at the moment:

For now it is assumed that any hypervisor/chassis can host a router
gateway port.

There are 2 types of schedulers defined at the moment
(1) RandomChoice
(2) LeastLoaded

The Chassis (add/delete/update) event is used to schedule router
gateway ports which have not been bound to any chassis.

A future patch will add functional tests.

Change-Id: I83fb561cee642b90c4de41bb8e472f47fa807191
Related-Bug: 1514995
7 years ago
zhangyanxian c26ec7d5d3 Spelling mistake:addded should be added.
Change-Id: I410ce5a1d02bc93ac4d1851b7c1e25ff6a6d4b9e
7 years ago
Han Zhou 4bef39ef8a Use OVN address set to implement remote security groups
Add OVN address set support for implementing remote security
groups. This should significantly improve performance of port
create, update and delete operations when remote security
groups are used (see [1]).


Bug #1600330 has been added for the follow-on work to update
the OVN NB DB sync tool.

Co-Authored-By: Richard Theis <>
Change-Id: I56e9eb1ded1836b9a9f7262f22daa51103bc8518
Closes-bug: #1560817
7 years ago
Hong Hui Xiao 580e77d5eb Update segment host binding
This patch will update the SegmentHostMapping, with the information
from chassis table in SB DB. The update will happen when the service
starts and the chassis create/update/delete.

TODO(Will be in follow up patch):
Add functional test for OVN SB DB

Change-Id: I24baad1bee5f4b38f777721c5f174c10158813a5
Partially-implements: blueprint routed-networks
7 years ago
Hong Hui Xiao e2f2276fec Rename ovn_nb_sync to ovn_db_sync
Rename to add SB DB sync to the files.

Change-Id: I9c180482b96ccb65a87d7e451022d6944730fe99
7 years ago