Use openstack.common.lockutils module for locks in tox functional tests.

Tox test has been switched to use openstack.common.lockutils module
for interprocess locks. However neutron tox functional tests was
left behind probably because locking is not required by the existing
functional test cases. This change makes neutron tox functional tests
adopt openstack.common.lockutils for locking.

Closes-Bug: 1332380
Change-Id: I4d6076e5f7586a11ea5381f18774d4bab57b0081
Expand arp_responder help text

Add additional text to arp_responder help to ensure that
proper documentation is included in the configuration guide.

Make ML2 and L2population references consistent.

Closes-Bug: #1321320

Change-Id: I0fc0691fc3729aa39888c90ca871ad7f711343f8
Define some abstract methods in VpnDriver class

Define the <op>_ipsec_site_connection() methods to ensure any new
service drivers will implement them.

Closes-Bug: 1326793

Change-Id: Idfe67632893592859990db486393a7108362447e
Log exceptions inside spawned functions

eventlet pool will discards all exception raised inside spawn(_n), it is
hard to discover problems inside spawned green-threads, it is better to
add a function wrapper to log the exceptions raised inside spawned
function.

Change-Id: I753df36c4614759f49134667a55f2a91f0c08317
Closes-bug: #1340708
Replace nullable from primary keys in tz_network_bindings with default

Columns vlan_id and phy_uuid were both nullable and primary keys.
Primary keys cannot be nulls. This situation caused problems in
autogenerating scripts creating always migration that set these columns
to nullable.

Instead of having primary keys nullable this patch creates a default
values.

Change-Id: I04642f6d6ad232997a593bff8ca44f9a7a803ffd
Closes-bug: #1346900
Ensure assertion matches dict iter order in test

Fixes a test_linux_ip_lib test that made an assertion
on a command that was called that could fail depending
on the order of the dictionary when it was iterated over.

This patch makes the assertion match the order that the
command is constructed by iterating through the dictionary
as well.

Partial-Bug: #1348818
Change-Id: I7baa518169c193f7e98d38632e1db16eb57ffee7
Do not assume order of parameters in OVSBridge.add_flow call

This fixes neutron.tests.unit.agent.linux.test_ovs_lib.OVS_Lib_Test.test_add_flow
unit test that breaks with a randomized PYTHONHASHSEED.

The test assumed that the parameters passed to add_flow had
elements in a particular order. Found with PYTHONHASHSEED=2455351445.
The fix refactors the test case to match parameters as set.

Partial-bug: #1348818

Note: There are several other unrelated unit tests that also break with a
randomized PYTHONHASHSEED, but they are not addressed here. They will be
addressed in separate patches.

Change-Id: Ibe2f4d929b8b42c8c909c2306d2554faf7109b49
Do not assume order of new_peers list elements

This fixes the vpn unit test that breaks with a randomized PYTHONHASHSEED
(see the bug report).

The test assumed that the new_peers list from self.new_update_request had
elements in a particular order. Found with PYTHONHASHSEED=2455351445.

The fix refactors the test case to handle an unsorted new_peers list by
sorting it before running the test.

Partial-bug: #1348818

Note: There are several other unrelated unit tests that also break with a
randomized PYTHONHASHSEED, but they are not addressed here. They will be
addressed in separate patches.

Change-Id: I86e7f84cedbdc8e1d7404363a560fd759d264c49
Opencontrail plug-in implementation for core resources

Adds Opencontrail plug-in implementation with unit tests
This patch has no dependency on any other blueprints
The link below describes how to install VIF driver for opencontrail
https://github.com/Juniper/contrail-controller/wiki/
OpenContrail-bring-up-and-provisioning

- The contrail_plugin_core.py is the main interface for neutron common
  infrastructure. It relays API requests to the opencontrail controller

DocImpact
Change-Id: I501bf669b2a999a171f9a3ee3e9893d4ead50e3b
Implements: blueprint juniper-plugin-with-extensions
SecurityGroupRuleExists should point out rule id inseand of group id

When we get a SecurityGroupRuleExists, we want to get the rule id
instaed of group id, and this is what the fucntion
_check_for_duplicate_rules() does.

Change-Id: I9b526d9829582cb26bfda98bcaf1704fe8681cbe
Closes-bug:  #1354343
Fix duplicate function: test_getattr_unallowed_attr

This meant only one of the two test cases was ever being run.  Renamed
one.

Change-Id: I37cfe2bb531a3f5015e729bed93d6a59d7d9c15d
Raise NotImplementedError instead of NotImplemented

NotImplementedError is the name of the exception
(https://docs.python.org/2/library/exceptions.html).

NotImplemented is the name of a constant
(https://docs.python.org/2/library/constants.html).

It makes no sense to raise a constant. The exception should
be raised instead.

Change-Id: I4969e26eb7b46f008ea3c8bd0093490c425f7069
Closes-Bug: #1339855
Option to remove routers from dead l3 agents

Add a configuration-enabled periodic check to examine the
status of all L3 agents with routers scheduled to them and
admin_state_up set to True. If the agent is dead, the router
will be rescheduled to an alive agent.

Neutron considers and agent 'dead' when the server doesn't
receive any heartbeat messages from the agent over the
RPC channel within a given number of seconds (agent_down_time).
There are various false positive scenarios where the agent may
fail to report even though the node is still forwarding traffic.

This is configuration driven because a dead L3 agent with active
namespaces forwarding traffic and responding to ARP requests may
cause issues. If the network backend does not block the dead
agent's node from using the router's IP addresses, there will be
a conflict between the old and new namespace.

This conflict should not break east-west traffic because both
namespaces will be attached to the appropriate networks and
either can forward the traffic without state. However, traffic
being overloaded onto the router's external network interface
IP in north-south traffic will be impacted because the matching
translation for port address translation will only be present
on one router. Additionally, floating IPs associated to ports
after the rescheduling will not work traversing the old
namespace because the mapping will not be present.

DocImpact

Partial-Bug: #1174591
Change-Id: Id7d487f54ca54fdd46b7616c0969319afc0bb589
Fix PortNotFound error during update_device_up for DVR

An agent's request to update the ARP entry for a VM port
may come after a deletion request has been processed,
resulting in a PortNotFound exception being raised.

This patch takes care of this condition. A test has
been added, which required a minor refactoring of the
test case class, in order to accommodate the use of
side effects for the objects being mocked.

Closes-bug: #1356120

Change-Id: I40d635bcf47c683663cb4dedf20323902dff2c7f
Ignore http_proxy while connecting to test WSGI server

urllib2.urlopen uses $http_proxy/$HTTP_PROXY environment variables by
default.  If set (and pointing to a remote host), then the WSGI tests
that spin up a local server and connect to it using
http://127.0.0.1:$port/ instead connect to $port *on the proxy*,
and (hopefully) fail.

This change uses urllib2 in a way that ignores proxy settings.

Change-Id: I4d94fcc06925d0c947345a07ae20352e1898e46d
Closes-Bug: #1356665
Remove INACTIVE status from FWaaS

DOWN status is introduced to replace INACTIVE status. There is one
place in FWaaS code which still checks INACTIVE status.

This commit removes INACTIVE status from FWaaS.

Change-Id: I896c81a6229978a46f8a88a31936920a1036f142
Partial-Bug: #1286048
Updated from global requirements

Change-Id: I3b7f5b18ef5b2bd257eb11669ec35397653cbc8b
Merge "Define some abstract methods in VpnDriver class"
Merge "Fix PortNotFound error during update_device_up for DVR"
Skip FWaaS config mismatch check if RPC method is unsupported

In this commit FWaaS config check skip is skipped
if neutron server does not support this API.

Commit d6f014d introduced FWaaS config mismatch check between
server and agent. It added a new RPC method get_service_plugin_list
and bumped l3-agent RPC version to 1.3, but this version RPC is
only supported by L3 router service plugin and
it breaks existing plugins using L3 router mixin.

Bumping l3-agent RPC version requires detailed investigation on all
affected plugins and it can be done by plugin maintainer later.

Change-Id: I388a24b0c6a507203674ef108bb14cea0534f98c
Closes-Bug: #1353309