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
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
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
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
Fix config option names in ml2_conf_sriov.ini

Config option names in ml2_conf_sriov.ini file are
not in sync with definitions in source code.

Change-Id: Ic8f7b6b8e9acd022623daabd2b209b864caa0b06
Closes-Bug: #1357339
Change nexus_dict to accept port lists

When users configured a server to have two logical connections to a
single switch, the nexus driver would never know about the second
connection because the nexus_dict stored the interface as a single
value, which would just get overwritten.  This has been fixed by
allowing the port value to be a comma seperated list.  All
operations on ports have been update to loop over multiple ports
per switch. New test added for host with dual connections to one
switch.

Change-Id: Iefb30452083747b45496600c81f8d0a6f378bd08
Closes-Bug: 1288393
Use oslo.db create_engine instead of SQLAlchemy

oslo.db may set additional options to engines that we may be interested in.

blueprint enable-mysql-connector

Closes-Bug: #1350942
Change-Id: I6f67bb430c50ddacb2d53398de75fb5f494964a0
Add config for visibility of cisco-policy-profile

This change adds a configuration option to cisco_plugin.ini to control the
visibility of cisco-policy-profile among tenants. The default is false or
unrestricted, so all tenants can view all policy profiles. If the option
is set to true, tenants can only view policy profiles that are assigned
to that tenant. The admin user can always view all policy profiles. This
was implemented by adding a check of the configuration option in
get_policy_profiles().

Change-Id: I5d77544d75366d39714def971eb949cfdc40023e
Implements: blueprint cisco-policy-profile-visibility
Refactor type_tunnel/gre/vxlan to reduce duplicate code

gre and vxlan type drivers have similar implementation for multiple
methods. This change abstracts these methods and move them to
TunnelTypeDriver.

sync_allocations method is not shared between gre and vxlan type drivers
because they use different strategies and the targeted one is unclear.

Change-Id: I717b70eb718f7ae82f1bc0c81543b0c438e8bddd
VPNaaS: Enable UT cases with newer oslo.messaging

Now that 1.4.0.0a3 of oslo.messaging has been added to Neutron
requirements, the unit test cases in VPNaaS code can be
uncommented and included in the tests. These tests ensure that
the correct validator is called, when validation is performed.
This adds similar tests to the reference and Cisco VPNaaS
implementation.

Change-Id: I62e3f8f3ec5fcceccd13891b1aa142869e1d88a1
Closes-Bug: 1349829
One Convergence: Skip all tests with 'v6' in name

Adds a check to the test setup for the One Convergence tests
to look for v6 in the name of the test and skip it if present.
This prevents IPv6 developers from having to explicitly skip
each new IPv6 test in the One Convergence unit tests until the
plugin gains IPv6 support.

Closes-bug: #1361366
Change-Id: I5c17d7290302597d5c85ef2c1df95f4f71e1a69b
Add ipv6 forwarding for router namespaces

Change-Id: I35101e6b32ab84bebb228cf0c43162eda761b17b
Closes-Bug: 1355195
Removing sorted() function from assertEqual()

Removing unnecessary sorted() function from assertEqual() function
calls in functions used for sorting and pagination testing

Using sorted() breaks sorting tests objective which is to test sorting.
This is causing every unit test using this functions
(_test_list_with_sort, _test_list_with_pagination, _test_list_with_pagination_reverse)
for sorting tests to always succeed

Switched the parameters for assertEqual() function within the fixed code to meet
its signature - assertEqual(self, expected, observed, message='')

Test neutron.tests.unit.vmware.vshield.test_lbaas_plugin.TestLoadbalancerPlugin.test_list_vips
was succeeding because of this bug, although it should fail. It failed after the bug was fix.
Test was fixed.

Change-Id: Ia36b81d9a7fd32cae3b567ac1899b56481eb62ce
Closes-Bug: #1355251
Add template attr. for subnet, router create in Nuage plugin

subnet create and router create commands now gives the ability
to the user to create subnets and routers via neutron cli with
additional attributes nuage_subnet_template and nuage_router_template
respectively. The instantiated subnet and router inherits the properties
of the template that was mentioned in the additional parameters.

Change-Id: Ib73313e840cb35ede89df858baa536aab883efa2
Closes-Bug: #1353112
Set firewall state to CREATED when dealing with DVR

When DVR is enabled as a default option for creating routers, firewall
resources will need to have a new initial state, so that reconciliation
can be done once all L3 agents have processed the firewall rules.

The new state has been introduced to preserve API bw compatibility
with centralized routers.

Partial-bug: #1360351
Supports-blueprint: neutron-dvr-fwaas

Change-Id: I53122570dd3a2311eedb24ccd925bcdc9ad4f70c
Change autogenerate to be unconditional

Template for generating db migration scripts are now not run according
to used plugins. Target environment is set to use all available models
but also used plugins are kept for backward compatibility.

Part of this patch is script that will drop unused tables to avoid
generating the drop in future migration scripts.

Change-Id: I90a7d3416de24f2317ccdeb828bb8bd973ee5e61
Closes-bug: #1346638
Increase ovsdb_monitor.SimpleInterfaceMonitor start timeout

The current timeout fails during functional testing with
slightly higher load. Increasing it will lower the timeout
chances during high load conditions. Changed from 5 seconds
to respawn_interval/2. DEFAULT_OVSDBMON_RESPAWN = 30 , so
the default timeout will be 15 seconds.

Change-Id: I6a9e2977b275e96dcf01c4df90a33169c42287d6
Closes-Bug: #1358206
Fix IpNetnsCommand to execute without root_wrapper when no netns

IpNetnsCommand accept execution with a network namespace, and
that requires root privileges and a root_wrapper.
IpNetnsCommand does accept no namespace too, in that case, the
root_wrapper doesn't have to be present necessarily, unless the
command we're executing requires root privileges itself.

This patch fixes the check condition on IpNetnsCommand execute
method.

Change-Id: I5ab2f3f1daf4a5a080611dbcd3dbd43292f6766a
Closes-Bug: #1358196
Increase the default poll duration for Cisco n1kv

Increase the poll duration for Cisco N1Kv, from 10s to 60s and also
clean up the /etc/neutron/plugins/cisco/cisco_plugins.ini file. The
current poll duration of 10s causes that VSM to unnecessarily taking
frequent CPU cycles, resulting in the failure of other tasks in scale
configurations.

Closes-Bug: 1357030

Change-Id: I95747f35bae5b7157391c1698c0fe84d2126aa10