validate if the router has external gateway interface set

If the router wants to work with vpn service, we must
make sure external gateway interface is set.

This patch cannot prevent user from clearing the gateway interface
of the router after the vpnservice is created.

Change-Id: If0f00def949b31c1e3da7a2cd055454567201e4c
Closes-Bug: #1258379
LBaaS: fix handling pending create/update members and health monitors

When agent requests loadbalancer logical config from server,
server returns only active pool members and health_monitors.
Need to make server return also members and monitors which are in pending states.

Also a small refactoring moving ACTIVE_PENDING set to common place

Change-Id: I8e10004f199f982b055da18ea7a0e5e4d11fa7fb
Closes-Bug: #1259965
Dnsmasq uses all agent IPs as nameservers

Add dhcp option which provides all agent IPs
which will be used as nameserver entries when
neutron uses multiple dhcp agent per network and
when there is no dns nameserver provided by the
neutron server.

Change-Id: I639a844bba212a731616851ff479a5e735612cf8
Closes-bug: #1259482
[ML2] l2-pop MD handle multi create/delete ports

If more than one port is added or removed simultaneously, port db entry
have status BUILD or DOWN and pass to ACTIVE when agent have finish to
configured it.
l2-pop mechanism driver use events port pass to ACTIVE or DOWN to send
fdb entries. In case of port is the first or the last network port on
an agent, the flooding entry need to be add or removed.

This patch fix the method to determine how many ports are active on a
agent by adding filter on status port to be ACTIVE.

Closes-bug: #1263881
Change-Id: I9c1f8bd69dee37bc01a5d42327aa5f737998c5aa
LBaaS: handle NotFound exceptions in update_status callback

LBaaS agent may send update_status requests to server on objects
which were already deleted from db: this is due to creating and
deleting objects with a high rate (like tempest API tests do).
As a result errors and stacktraces appear in server and agent logs.
The proposed solution is to catch NotFound exceptions and print a warning.

Change-Id: I4446b678893d0bda578ad7ccdf3f109cb1c91b4d
Closes-Bug: #1260682
Use information from the dnsmasq hosts file to call dhcp_release

Certain situations can cause the DHCP agent's local cache to get out
of sync with the leases held internally by dnsmasq.  This method of
detecting when to call dhcp_release is idempotent and not dependent on
the cache.  It is more robust.

Change-Id: I4eafd9cfb94a77a2f0229f89de5483dad23725cf
Closes-Bug: #1250644
Fix race condition in delete_port method. Fix update_port method

Port can be gone between
  l3plugin.prevent_l3_port_deletion(context, id)
and port query. Need to handle it properly.
ALso need to handle non-existing port in update_port properly.

Closes-Bug: #1266537

Change-Id: Ic203f21db277f83c604a8757a8c421b3fb9ae709
NVP: Add LOG.exception to see why router was not created

Add missing LOG.exception so that it exposes what error occurred.

Change-Id: I9194795678a6be59eb1d2555dfa99ca7a035c418
Closes-bug: #1269152
Fix the migration adding a UC to agents table

The migration script mistakenly assumes that all core
plugins use agents extension, which is not true (e.g.
plumgrid and bigswitch don't).

Apply this migration script only for plugins that are
stated in the original migration script adding agents
table (511471cc46b_agent_ext_model_supp.py).

Related-Bug: #1254246

Change-Id: I7915ef8d183782eb5d46ac47f45014aa9e9640fb
Remove release_lease from the DHCP driver interface

Neither the midonet nor the linux dhcp driver needs a call to
release_lease.  Removing this from the driver API simplifies more code
in the DHCP agent.

Change-Id: Ib144b2bf3720b1b999205ace1a7d1ffe5ef3b167
Closes-Bug: #1269505
Expunge session contents between plugin requests

In the NVP plugin, metadata processing performs several plugin operations
with the same context (and db session). The first operation might leave
persisted objects in the session instance which then conflict with objects
created in the second operation.

Closes-Bug: #1266482

Change-Id: Ic9e2b952013610647aa222f1a8b6e33504b54b37
Fix interprocess locks for run_tests.sh

This was fixed for nova using this method and we are porting it here as we are
running into a similar bug as #1264058

Closes-Bug: #1269938
Change-Id: I06a2684629fd7b4d30e2d7716dc00a2ed0479f2f
Report proper error message in PLUMgrid Plugin

Change-Id: Ifc1bb55f6b025bba77cf9858ed392dbf170075a7
Closes-Bug: #1268460
Signed-off-by: Fawad Khaliq <fawad@plumgrid.com>
Use an independent iptables lock per namespace

Since iptables is independent from namespace to namespace, it makes
sense to use an independent lock per namespace.  This improvement is
aimed at improving the parallel performance in the L3 agent.

Partially implements blueprint: neutron-tempest-parallel

Change-Id: I15e9c9da9a7c15981757a09bc744501722d62db2
Minimize the cost of checking for api worker exit

A recent change to oslo allows the configuration of the interval
that ProcessLauncher waits between checks of child exit.  The
default interval of 0.01s resulted in the neutron service consuming
unnecessary cpu cycles checking whether api workers had exited (5%
cpu on idle in a VM).  This patch extends the interval to 1s to
minimize the cost of the checks.

Change-Id: I0407ccb2db65cd3839586faff15e70dbc35f005e
Closes-bug: #1095346
Rename nvp_cluster for VMware NSX plugin

Rename the module into nsx_cluster and the class into NSXCluster,
and update references accordingly.

Also, rename utility method create_nvp_cluster to create_nsx_cluster
and move it into nsx_utils.

Partial-implements blueprint: nicira-plugin-renaming

Change-Id: I1a943cc64730ea67f464c3804370dad46411f8a2
Enable hacking H233 rule

H233: Check that all occurrences look like print functions, not print
operator.

Change-Id: I4600eb32e1a8ecba13fc252d7ef08681672a40a7
Remove garbage in vim header

Introduced by commit 9d01010e8826eafc48044fc4018944a34bc96ba4

Change-Id: I97c7789fa13e61d16466cddac49fc41d1f917e80
L3 Agent restart causes network outage

When a L3 agent controlling multiple qrouter namespaces
restarts, it destroys all qrouter namespaces even if
some of them are still in use.  As a result, network
traffic could be stopped on the VMs that use the
networks associated with these namespaces.

So what is needed is for the L3 agent to preserve those
qrouter namespaces a L3 agent instance recognizes and to
destroy those it does not know about.

Closes-Bug: #1175695

Change-Id: Idae77886bd195d773878c3d212ccfd56269216fb
Remove extra network scheduling from vmware nsx plugin

Closes-bug: 1212555

Change-Id: I24dd51df4e3a966b66054fa55e70f6aa1e61da11