Delete DHCP port without DHCP server on a net node

A DHCP-network was deleted from one host using neutron
dhcp-agent-network-remove and then added to another host
using neutron dhcp-agent-network-add command. While the
dhcp-agent-network-remove command was in progress, the
host crashed.  As a result, the removal of the DHCP-network
was partially done. The network was disassociated from
the agent in mysql. However, the agent never made the
release_dhcp_port RPC call to delete the port -- even
after the agent restarted. The end result is that there
are two DHCP ports for the same network. One of these
is found on the host that is no longer hosting the
dhcp-server.

This fix make the DHCP agent invoke the release_dhcp_port
RPC call on a stale network whose dnsmasq process is not
running (not active). Before this change, the RPC call is
made on a stale network only when the dnsmasq process is
running.

Closes-Bug: #1244860
Change-Id: Ie0bafdac698810b5455550c306c6a75ddf91d9bb
Drop service* tables only if they exist

Tables servicedefinitions and servicetypes are not used by neutron but
created using db migration tool. If quantum-server in grizzly was
started without using migration tool then tables mentioned above are not
created. During migration from grizzly to havana alembic attempts to
drop these unused tables. This patch uses "IF EXISTS" clause when
dropping mentioned tables.

Closes-bug: #1273355
Change-Id: I33fcb3e1dc96ce37ec9c00987cb5a3a953ca691d
Restore ability to run functional tests with run_tests.sh

Change f20b1d42 which split the running of functional tests from
the running of unit tests caused running:
  ./run_tests.sh neutron.tests.functional
to fail as the OS_TEST_PATH variable will be defaulted to
neutron.tests.unit which means that the functional tests will not
be discovered in the above case.

This patch trys to detect an argument passed in the form of a
neutron.tests string and correctly sets the OS_TEST_PATH variable
based on it.

Change-Id: I8ccdc7f10d3c8478281aeaf8d02175d0eeb8d6e9
Vmware: Set correct nullable for lsn_id, nsx_port_id

Corrected the following models according to database
content:
- NOT NULL for LsnPort lsn_id;
- NOT NULL for NeutronNsxPortMapping nsx_port_id;

Partial-Bug: #1296282

Change-Id: Ia67fcc68eeceb27d9274adb652ab45b32152f01c
LBaaS: Set correct nullable parameter for agent_id

Corrected the following model according to database
content:
 - NOT NULL for PoolLoadbalancerAgentBinding agent_id;

Partial-bug: #1296282

Change-Id: I1f11ec2e8f4c16f58dd8d4e6429e46eaedaec945
Segregate the VSM calls from database calls in N1kv plugin

Rearrange the code in such a way that the calls to the VSM are
outside the database session. This avoids DB locks on n1kv tables.

Change-Id: Ic0f0d816cca06a3b03fdd9b58ee7599ddf65473e
Closes-Bug: 1290646
Improve ODL ML2 Exception Handling

Raise a MechanismDriverError when authentication with ODL fails.
Re-raise HTTPError in "sync_resources" for exceptions whose status code is not 404.

Closes-Bug: #1311758
Change-Id: I99d2c4f270007c369024525ba4e6188d232a0b13
Database exception causes UnboundLocalError in linuxbridge-agent

When database exception raises from update_device_down,
the linuxbridge-agent doesn't deal with them in a proper way
that causes accessing not-existed local variables.

A straightforward workaround is to set it as None by default
and verify its value then.

Change-Id: I32a9467876a619a7d0ad53ff3d5d95ff977e54f4
Closes-Bug: #1311971
Add physical_network to binding:vif_details dictionary

During port binding binding:vif_details dictionary is
updated with physical_network to be used by mlnx nova vif driver.
binding:profile update will be removed once nova side fix is merged
to keep consistent solution.

Change-Id: If9525929a1546e8d05f7923570d30dfc2eed8898
Closes-Bug: 1304872
Cisco VPN device driver - support IPSec connection updates

Provides support for IPSec connection updates and state changes. To do
this, the configuration of the connection is maintained, when the
connection is created. This is checked against the current settings, at
sync time, to determine whether a configuration change (as opposed to a
state change) has occurred.

If there is a change to the configuration detected, then the simple
approach is taken of deleting and then re-creating the connection, with
the new settings.

In addition, if the admin state of the connection changes, the tunnel
will be taken admin down/up, as needed. Admin down will occur if the
IPSec connection or the associated VPN service is set to admin down.
Admin up will occur, if both the IPSec connection and the VPN service
are in admin up state.

Added REST client method to allow changing the IPSec connection tunnel
to admin up/down (effectively doing a no-shut/shut on the tunnel I/F),
based on the above mentioned state.

Modified UTs for the support of IPSec connection update requests (used to
throw an "unsupported" exception), and to check that the configuration
and state changing are processed correctly.

Updated so that tunnel_ip is set in device driver, rather than hard
coding, and then overriding in REST client. Since device driver has the
same info, this will fit into future plans to obtain the info from
router, vs reading an .ini file. Revised UTs as well.

Change-Id: I184942d7f2f282c867ba020f62cd48ec53315d3e
Closes-Bug: 1303830
Unit test cases for quota_db.py

This commit adds unit test cases with 100% coverage for the quotas
database implementation in neutron/db/quota_db.py

Closes-Bug: #1312310

Change-Id: Icc08132369e88a2f83fe57f524232e94ec4db702
Allow test_l3_agent unit test to run individually

When the test_l3_agent.TestL3AgentEventHandler test case is run
after test discovery it passes because discovery imports files
that registers all the config options. For the test case to run
individually we need to explicitly register the config options
used in the test.

Change-Id: Ic31503ad7be8601ff843dbdc8edf5856ce8b0e39
Closes-bug: #1313812
Reference new get_engine() method from wsgi.py

wsgi.py referenced get_engine in neutron.openstack.common.db.sqlalchemy.session.
This method was removed from that file in commit 53609f29f3c8fcadc545afb891189253c07b33c3
change-id I0e1d86878d3eb924b01e04dced0f90b4e57757d8. This patch references the
replacement method added to neutron.db.api.

Closes-Bug: #1314850
Change-Id: Ifd4db5f49e2aaebc67eccb8bdcef8eea54983112
Add support to dynamically upload drivers in PLUMgrid plugin

PLUMgrid plugin will be able to dynamycally upload any of its available drivers.
It will simplify any CI testing by changing the configuration file for the plugin
instead of changing the code directly.

Change-Id: I56da881688cfdf8f9a1b655c1080c39ffc0133a5
Closes-bug: #1315137
Performance improvement of router routes operations

This patch fixes inefficiency of updating extra routes.
* remove the code repeated by every routes in validation check.
* remove searching a record to delete per record.

Note: Unit tests are covered by existing ones. So no unit test added.

Change-Id: Ia335ac21c65148063d330e4533a15a73962c43d8
Closes-bug: #1312482
Fix network profile subtype validation in N1kv plugin

Network profile of type Trunk expects a subtype field for
creation. If a subtype is missing in the request body, plugin
should raise an exception. This patch fixes the validation logic
to detect missing subtype field.

Change-Id: I6b4fb533576a317f7d568b4a0fe4117b5464ffa6
Closes-Bug: 1315197
Improve help strings for radware LbaaS driver

Make strings consistent with what we use elsewhere:
* Capitalize first word
* End with "."
* Improve wording and spelling

Partial-Bug: #1315111
Change-Id: Ic378aa7e4f936c3f3da0a23598620c3b978cbf45
Merge "Vmware: Set correct nullable for lsn_id, nsx_port_id"
Merge "Fix network profile subtype validation in N1kv plugin"
Merge "Cisco VPN device driver - support IPSec connection updates"