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
Fix class name typo in test_db_rpc_base

Change-Id: I23fd11fe4fdd2988463f2cf592d884cba72cdb41
Closes-Bug: #1281921
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
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
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
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
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
Remove pyudev dependency

pyudev was only used by the linuxbridge-agent to get the list
of virtual network devices. This can be got from /sys instead.
This patch fixes the problem where testr could not import the
lb-agent module because pyudev was not in requirements.txt.

Change-Id: I0a78c91e97de4413f2ecf6fb56d2ff61b36baa78
Closes-Bug: 1269040
BigSwitch: Stop using external locks

Changes BigSwitch server manager REST lock
to an in-memory lock since the plugin isn't
expected to run in independent processes.

Closes-Bug: #1284881
Change-Id: I2fdd5ba79a0c4b94b2b410db54a63f7c0ca47525
Add user-supplied arguments in log_handler

Sync from Oslo, change-id: I91289cc4a60f5dab89bca852e6f52b4b83831e47

When using PublishErrorsHandler, it will missing user-supplied
arguments. For example, do LOG.info("blabla %s", "foo"), the
payload only contains "blabla %s", but we expect it like "blabla foo".

Change-Id: I9e5515da31a04b82d49e406bc6b246f940fb73fc
Fix NSX migration path

The migration path for the NSX plugin was not working correctly,
as two migrations (extra route and network gateways) were
skipped.
Therefore installations were partially relying on automatic
schema generation.

This patch fixes the migration path, as well as an attribute
whose name in the migration and the DB model differed.

Closes-Bug: 1285095

Change-Id: I9e4db294e618d1419d86e07cfb5505dcc01b54ca
Fix get_vif_port_by_id to only return relevant ports

This is returning any port, even if it's not on the switch that we're
looking at. As a side-effect, this means that we can actually manipulate
these ports while we really shouldn't.

Co-Authored-By: Rossella Sblendido <rsblendido@suse.com>
Change-Id: Ia4f4e93237c1c2ea6cb4b6c2f5adf78d6b34c7bf
Closes-Bug: #1283765
NSX: Pass NSX uuid when plugging l2 gw attachment

The code passed the neutron network identifier.
This is no longer valid as identifiers on the backend are not
anymore the same as neutron identifiers.

Also, this would have hardly worked with networks on extended
logical switches.

Closes-Bug: 1285399
Change-Id: I6fe4d22d5b8d8b7dc3eb1cb3f47ad52ac1a2b565
Typo/grammar fixes for the example neutron config file

Change-Id: I12d21ef2a5bff5a8cdd08fea42b413b062479926