fixes test_kill_pids_in_file conflicts

Fixes Bug: #1231246
Change-Id: Ibedd59d6570cd8d5020e99125c6808d5d2170851
Fix random unit-test failure for NVP advanced plugin

Two problems were observed:
1. Tasks are not scheduled as desired in greenthread. The fix is to
   increase the max status probing time from 1 second to 10 seconds.
2. An error message is show in unit-test log output. Turns out in
   addition to a bug that may cause task manager stop prematurely,
   another unit-test case test_vcns_driver can cause same error
   message being displayed in the log.

Change-Id: I697dd8fc509308108ff1f40400f36ac6271bf4bb
Close-Bug: 1245698
Fix downgrade in migration

In 63afba73813_ovs_tunnelendpoints_id_unique migration mistake in
usage drop_constraint parameter type_ and positional agruments name
and table_name.

Closes-Bug: #1243073

Change-Id: I60cd6e7f18b193b71f8f20759251b9f59a79965a
Add support for NSX/NVP DHCP services

This is a feature patch (1 of 3) that adds support for DHCP
services provided by the NSX (aka NVP) platform. Green-field
deployments can use the AGENTLESS mode, which will make the
core plugin interact solely with the NSX platform to provide
DHCP services. Support for metadata proxy services, migration
for brown field deployments will be added in future patches.

Partial-implements blueprint nsx-integrated-services

Change-Id: Idfc4b2d871e70cd557d8e0e6b23e5563f9ed3420
Apply six for metaclass

__metaclass__ cannot be used in python3.
six be used in general for python 3 compatibility.

Change-Id: Ib0d71b9676dc01390679396443575c05975d3b58
Closes-Bug: #1236648
Added check on plugin.supported_extension_aliases

Added check to neutron.api.extensions.PluginAwareExtensionManager
which raises an exception when an alias in the plugin's
`supported_extension_aliases` list is not found in the set of loaded
extension aliases. If an alias is missing, it means the extension for
that alias has not been loaded, has not been found, and the file is
missing from paths listed in `oslo.config.CONF.api_extensions_path`.

This guards against a common class of bugs in plugins,
such as typographical errors in the `supported_extension_aliases`
property.

Plugin changes:

* bigswitch.plugin: Moves api_extensions_path override to plugin's
__init__ method, similar to other plugins.

* cisco.n1kv.n1kv_neutron_plugin: Removes "policy_profile_binding" and
"network_profile_binding" as they don't exist in Neutron currently.
Removed override of api_extensions_path as it is loaded through
cisco.network_plugin.

* cisco.network_plugin: Renames "Cisco Credential" to "credential".
Adds api_extension_path override to plugin's __init__ method.

* metaplugin.meta_neutron_plugin: Avoids alias of empty string when
cfg.CONF.META.supported_extension_aliases is an empty string.

* midonet.plugin: Fixes regression of 98e16a06 from 715b16ac.

* nec.nec_plugin: Extended override of api_extensions_path to append
nec extensions path to existing configured path.

* nicira.NeutronPlugin: Extended override of api_extensions_path to
append NXP_EXT_PATH to existing configured path.

Fixes: bug 1225080

Change-Id: Idcaade221d83c611fcbd87b503b2c8377d106962
Call _destroy_metadata_proxy from _destroy_router_namespaces

Refactor _spawn/destroy_metadata_proxy so that it can be called
with only the namespace and the router_id.

Change-Id: Id1c33b22c7c3bd35c54a7c9ad419831bfed8746b
Closes-Bug: #1252856
Optionally delete namespaces when they are no longer needed

Adds a configuration option to tell the network agents to delete
namespaces when they are no longer in use.  The option defaults to
False so that the agent will not attempt to delete namespaces in
environments where this is not safe.

This has been working well in deployments where iproute2 has been
patched with commit 58a3e8270fe72f8ed92687d3a3132c2a708582dd or it is
new enough to include it without being patched.

Change-Id: Ice5242c6f0446d16aaaa7ee353d674310297ef72
Closes-Bug: #1250596
Related-Bug: #1052535
Handle IPAddressGenerationFailure during get_dhcp_port

If a network/subnet is deleted while the dhcp agent is trying
to get/create a dhcp port for that network, the exception
will be raised because no IP Allocation Range is available.

However, this particular failure mode causes just noise, because
the dhcp agent can cope with it without problems.

A follow-up patch will deal with the other exception traces during
create_dhcp_port

Partial-bug: #1253344

Change-Id: I7fe35455ce905daa22ff96367e120864a7d3fb92
Do not add DHCP info to subnet if DHCP is disabled

Currently the midonet plugin will add default DHCP information to
each subnet even if the subnet is configured to have DHCP disabled.
This change addresses this by checking the DHCP settings while
creating a subnet, and only adding DHCP information if DHCP is
enabled.

Closes-bug #1230073

Change-Id: I2c422866c60f505df30bfa18bfe8d03599665b7a
Avoid dhcp agent race condition on subnet and network delete

Ensure that ports that are about to be deleted are 'selected
for update'. By doing so, we avoid a race condition between
subnet and network delete operations carried out by two
separate server instances.

A race caused by the dhcp agent deleting the DHCP port
(caused by a subnet-delete event notification) can
still occur and will be addressed in a subsequent patch.

delete_subnet's way to delete ports has been tweaked to
ensure that postgres db can handle the SELECT FOR UPDATE
correctly.

Partial-Bug:1197627

Change-Id: I5bd75a758395a2faeff9db35a03c42dfa8ae0eab
Mock the udevadm in the TunnelTestWithMTU test

When running the neutron.tests.unit.openvswitch.test_ovs_tunnel.
TunnelTestWithMTU unit test failure occurs because the udevadm is
timing out waiting on a mock-ed device.

Co-Authored-By: Salvatore Orlando <salv.orlando@gmail.com>

Change-Id: I0e16295be66513c2257831bf62fd6a0c19f3b8a4
Closes-Bug: #1253506
Fwaas can't run in operating system without namespace feature

Adding the check before generating the local_ns_list
to fix the issue.

Change-Id: If8edb5c0bb0fc0fd9aaf48a3441287f99bcdcf13
Closes-Bug: #1252201
Update Zhenguo Niu's mailmap

Using new email address.

Change-Id: I77190d0da0dbd4480ff03bcfe84540292cc81ea3
Fix showing nonexistent NetworkGateway throws 500 instead of 404

Change-Id: I5304bd52f7a5ae22fbc0d48206d7c1d282b34a91
Closes-Bug: #1252921
Send only one agent notification on port update

This patch removes the other redundant notification sent in the same
routine to notify whether a security group changed.

Closes-Bug: #1254924
Partial Blueprint neutron-tempest-parallel

Change-Id: I5bad015decdc197c3fa9b58c680564380d513bc4
Enforce unique constraint on neutron pool members

Neutron loadbalancer pool members should not be allowed to have
duplicate address/port tuples in the same pool.

Change-Id: Ie52c6033217ec05ee4f59bcf8a0e4167c7b13663
Closes-Bug: #1251867
Rebind allowed address pairs only if they changed

This patch ensures allowed address pairs bindings are refreshed
only when they actually change.
This will also avoid sending a notification to the agent if no
change actually occured.

Closes-Bug: #1255145
Partial blueprint neutron-tempest-parallel

Change-Id: Iac2502586a0d215a29194590c16c2e1a064f943b
Add test_handle_router_snat_rules_add_rules

Add a unit test to verify that snat rules are added and added in order.
So that it could be refactored without fear next time.

Closes-Bug: #1222660
Change-Id: I07e820cc28c9a6c139a8eed0917aef2cfe62638a
Fix format errors seen in rpc logging

The previous commit for this bug didn't include the 'project_name'
key in the context dict.  The missing key was causing the amqp
module to generate log formatting exceptions instead of normal
log output.

Separately, the context module itself was generating logging
exceptions in the quantum service when logging was attempted
before the context was fully initialized

Change-Id: I0f4c6f5a6804442932c9b2bd409a258cfc2419ff
Closes-Bug: #1254530
Related-Bug: #1239923