Move db migration of ml2 security groups to havana

ml2 plugin is a havana feature. Currently securitygroups table are
created in chain of migration after havana release. It causes db
migration failure when migrating from havana to current head because
securitygroups table is attempted to be created although it was already
created by create_all().

Closes-bug: #1271231
Change-Id: If450bd95de7a5fdfdb2219cfbf7eb0c1323044bb
L3 agent fetches the external network id once

Rather than fetching the id of the external network each time that
_process_routers is called, get it once and remember it.  If the agent
is ever requested to connect to a different ext-net then it will fetch
the current ext-net to double check for the unlikely event that the
ext-net has changed.  If it has then it will remember the new ext-net.

This is only applicable in the case where there is only one ext-net
that has not been configured explicitly in the config file.  That was
the only case that would cause an RPC message in the first place.

Change-Id: I40bbbf6233131ea5d40122ef9495fd3cb7dc823a
Closes-Bug: #1269567
Reset the policy after loading extensions

The loading of extensions might impact how rules are interpreted in the
policies; for instance, the external-net extension specifies how to
convert the router:external field of a network (to a boolean). So we
need to make sure that the policy is recreated afterwards.

We also need to fix a unit test that assumes that the policy is loaded.

Change-Id: Ifde13323b1435fc84c6cb24ab6a71de5d67f6b9f
Closes-Bug: #1280738
Fix class name typo in test_db_rpc_base

Change-Id: I23fd11fe4fdd2988463f2cf592d884cba72cdb41
Closes-Bug: #1281921
Implements provider network support in PLUMgrid plugin

Includes the provider network extension in PLUMgrid plugin
PLUMgrid drivers are updated with the new extension data
Unit tests are added

Change-Id: Ia7fc011c04d143bdb7fd8f67768a2076be8c5264
Implements: blueprint provider-network-plumgrid
Fix VPN agent does not handle multiple connections per vpn service

    Once the OpenSwan process is created, incoming updated vpnservice
data would not be updated into the process class which leads to config
files and openswan process always keep old configurations

Change-Id: Ia91ab08b1d03fbbe46bafd4967b57181fc4c6e71
Closes-Bug: 1263194
Handle racing condition in OFC port deletion

Multiple delete_port operations can run in parallel.
For such case later operation(s) will receive 404 (NotFound)
error from OFC or NotResultFound sqlalchemy exception.
These are valid exceptions and they should be ignored
in delete_port operations.

Closes-Bug: #1281574

OFCConsistencyBroken is renamed to OFCMappingNotFound
because when multiple delete_port operations run in parallel
OFCConsistencyBroken can occur and it is a valid case
so the excepion name looks inappropriate.

Change-Id: I1511d55994c88b8828f0ff62610c18ddc6dfac8f
BigSwitch: Fix tenant_id for shared net requests

The URI port requests are sent to on the backend
contains the tenant_id of the network. This corrects
a bug where, on port updates and deletes, the tenant_id
of the port rather than the network was being used,
which was incorrect when attached to a shared network.

Closes-Bug: #1278530
Change-Id: I09ffc767c669416555867e975d0b7057a5cfa0cb
Make sure dnsmasq can distinguish IPv6 address from MAC address

Currrently, due to in dnsmasq host file, the IPv6 address does
not be wrapped with '[]', dnsmasq cannot distinguish IPv6 address
from MAC address, it will cause the deployed instances cannot get
IPv6 address via dnsmasq dhcp service.

Change-Id: I023e44667a238664d11f2ac2cc484432cd301bcc
Closes-Bug: #1281916
Change tenant network type usage for IB Fabric

This patch changes tenant network type usage for InfiniBand Fabric
to vlan type. Add the indication of Fabric Type (Ethernet/InfiniBand)
to the provider_network via the plugin configuration file.
If physical network type is not specified for some provider network
listed in the network_vlan_ranges, use default physical network type.

Co-authored-by: Roey Chen <roeyc@mellanox.com>
Change-Id: Id45acfb8234359a43303c2eee2205a44998c039a
Closes-Bug: 1263638
Sync oslo cache with oslo-incubator

Due to removal of py3kcompat we need to sync with
oslo-incubator in order to use six package directly.

Related-Bug: #1276440
Change-Id: Ib3d1c9e09497f7ecd7495ef0f70c6105c14a9783
Fix webob.exc.HTTPForbidden parameter miss

HTTPForbidden should use the parameter 'explanation'
instead of 'detail'.
This patch fixes this bug.

Change-Id: I4c66697daf0ce9e00c8820311dc7141eacd7e733
Closes-Bug: #1283872
change Openstack to OpenStack in neutron

Change-Id: I769e00efb8d61679a544ed5ded1c93dd3bc252db
Support Port Binding Extension in Cisco N1kv plugin

Change-Id: I9bcacb2b1f1bb1500b9176a49736aac128938de8
Closes-Bug: #1272128
Ensure ovsdb-client is stopped when OVS agent dies

If the OVS agent is killed, the interpreter is killed before any cleanup
is done. This patch adds a signal handler for SIGTERM that exits
normally so that the existing cleanup is done and the ovsdb-client
process is terminated.

Change-Id: Ie4f8ff434098100f4699124403d58caa784084cf
tests/service: consolidate setUp/tearDown logic

Consolidate the duplicate code for extension api tests.
This will be also used by servicevm extensions later.

At the same time, a bug in test_extension_firewall.py is also fixed.
double call of super().setUp().

Closes-bug: #1275654
Change-Id: I72f185ef6e5af55729ced51fc0b72fae799d46ac
l2-population : send flooding entries when the last port goes down

Delete port used to call update_port_down to calculate
its fdb entries during delete_port_precommit. But during
the pre-commit, the port is still up, so update_port_down
acts as if there was still one port on the agent, and
doesn't add flooding entry in its fdb_entries.

Closes bug #1282141

Change-Id: Icedd02f33d999200505950beb9169ae3634e551b
l2-population/lb/vxlan : ip neigh add command failed

we were using ip neigh add command which must be replaced by
ip neigh replace, to avoid error when creating a VM with an ip
previously used by a deleted VM

Change-Id: I2405096d5925ae37efd5f8abcc02b99cf0c9f5d3
Closes-Bug: #1282662
LBaaS: check for associations before deleting health monitor

Need to prohibit health monitor deletion if it has associations with
pools. Given that pools may belong to different lbaas drivers the process
of monitor deletion becomes complex and unreliable since association
deletion may fail on any single driver.

DocImpact

Closes-Bug: #1243129
Change-Id: I27c20e7a5be8433f90569534ecf838e33027cb00
Include proper Content-Type in the HTTP response headers

Neutron namespace proxy handler and metadata agent were not setting the
Content-Type in its response. Both of them were returning only the response
data which is obtained from the nova-metadata-service. Since they were returning
only the response data, the Content-Type returned to the clients has the default
one which is - "text/html". Ideally this should be set to the data type which is
present in the HTTP Response. The fix now includes the Content-Type which is
returned by nova-metadata-service

Closes-Bug: #1243878
Change-Id: If68f0b508fbea4ecd1eb0e58d602b5ba6ccbe263