Fix unshortened IPv6 address caused DHCP crash

When unshortened IPv6 address provided to allocation pool, DHCP
agent crashed because OpenStack is trying to add same IPv6 addresses
to dhcp tap device.

The root cause is that current code compares provided unshortened
IPv6 address with the returned result of "ip addr list", which is
shortened. So the same IPv6 address is treated as different ones.

The fix is trying to shorten the provided address before comparison.

Change-Id: If1e183e65c5ab785b73771d9a3d4b525d38284a9
Closes-Bug: 1266780
Remove unused variable

o neutron/services/firewall/drivers/linux/iptables_fwaas.py:FWAAS_CHAIN
  = 'fwaas'

  This variable was added in the following commit.

    commit 7e487160867d2c2059d556d0d3af50bc8e8838fa
    Author: Rajesh Mohan <rajesh.mlists@gmail.com>
    Date:   Fri Jun 21 17:55:08 2013 -0700

        Firewall as a Service (FWaaS) Iptables Driver

  But there is no evidence that was used.

Change-Id: I5633e74e2441b71e3dddaa0c2f6a5804778e21e1
Invalid ovs-agent test case - test_fdb_add_flows

setup_tunnel_port is an attribute of self.agent and not self.agent.tun_br.
This patch fixes the testcase accordingly.

Closes-Bug: #1284265
Change-Id: I70582e477bb53de6482e32d5913c0864c5d910cc
Delete disassociated floating ips on external network deletion

Also remove redundant check for network in use in bigswitch plugin

Closes-Bug: #1238439
Closes-Bug: #1259144

Change-Id: I7586f43c2e99be9df491c68bf1e8658994ffd263
Exclude .ropeproject from flake8 checks

Change-Id: Ic788c49e5e92b171e20fe132829648ff21539e33
Closes-Bug: #1297016
Fix Metering doesn't respect the l3 agent binding

This patch fix the issue by changing the call to
find the plugin which handles the l3 which is now
the l3_router service plugin instead of the old mixin.

Also change the unit tests to use the l3 service plugin
instead of the l3 mixin and refactor the rpc callbacks
part.

Co-Authored-By: Ala Rezmerita <ala.rezmerita@cloudwatt.com>
Closes-bug: #1257354
Change-Id: Ide26f825005fa63cd3fcc75fa91fffb947e0be7a
Fix uninitialized variable reference

This was probably a copy&paste error. While physical_network is used in
earlier loops, it isn't defined here. The identically named member variable was
probably intended.

Change-Id: I09e38321cf8670c62f4fdf9d99da1df737b2fc68
Closes-Bug: #1308421
Check if bridge exists and make sure it's UP in ensure_bridge

Introduce _bridge_exists_and_ensure_up that checks if the bridge
exists and if it's DOWN sets it UP

Change-Id: Ide9d2bb04016cadb347b00cadbee7007e61bd01e
Closes-bug: #1282741
Fix incorrect change of Enum type

In migration 1341ed32cc1e_nvp_netbinding_update Enum type had been
changed incorrectly from ('flat', 'vlan', 'stt', 'gre')
to ('flat', 'vlan', 'stt', 'gre', 'l3_ext') for PostgeSQL.

The same problem is taken place for vlan_type in migrations
38fc1f6789f8_cisco_n1kv_overlay from ('vlan', 'vxlan', 'trunk',
'multi-segment') to ('vlan', 'overlay', 'trunk', 'multi-segment')
and in 46a0efbd8f0_cisco_n1kv_multisegm from ('vlan', 'vxlan') to
('vlan', 'vxlan', 'trunk', 'multi-segment').

In this change request was added separate method for changing Enum
type for PostgreSQL.

Closes-bug: #1301396

Change-Id: I27197fb7405630a55178be8516a4b62bd135e05c
Fix migration that breaks Grenade jobs

Migration 33c3db036fe4_set_length_of_description_field_metering
needs to be changed as it is a reason of Grenade job's fail.

Closes-bug: #1307344

Change-Id: Ia57d9a60847e4a34977e40fb8b09181bdbd9c39b
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
Add 2-leg configuration to Radware LBaaS Driver

Radware's load balancer currently supports three network interfaces.
Prior to this code addition, the configuration of those three
interfaces was: one interface for management, one for high
availability backup, and one for load balancing servers where the
IP that the outside world sees (VIP) and the IP that the servers
respond to (PIP) are identical.

This change adds a new "2-legged" configuration: one interface for
management, one interface for a VIP network, and one interface for the
PIP and the high availability backup network.

During VIP creation, the LBaaS driver detects if the incoming
configuration is "2-legged" by comparing VIP and PIP networks.  If they
are different it allocates a new port on the PIP network in order to
obtain an IP address for the PIP and names that port after its
associated VIP ID.  vDirect is then directed to create a load balancer
with the PIP network also used as the HA network instead of using the
vDirect container's default HA network configuration.

During VIP deletion, the LBaas driver detects if a port for the PIP
had been previously allocated by searching for and deleting port names
that map to the VIP ID.

Change-Id: Ifb93159c654f16958842f646c119479c465230f9
Closes-Bug: 1268728
Replace loopingcall in notifier with a delayed send

The loopingcall thread here was started before processes fork and so
the thread stops working after the fork call.  This is a problem that
will probably need to be worked out in the long run.

To ensure that this notifier works correctly in all processes, this
change replaces the persistent loopingcall thread with a thread
created on demand to delay and batch up notifications.  The first
notification will trigger spawning the thread to wait to send it.  Any
notifications that come in the meantime will notice that there is
already a thread waiting to send and will return without spawning.

Change-Id: I519d4e89b8cee341c0e1cfffbce3e77151e8202a
Closes-Bug: #1301035
NSX: Fix fake_api_client to raise NotFound

If one quries NSX doing GET /ws.v1/lswitch/LS_UUID/lport and LS_UUID
is a UUID that does not exist in NSX. NSX raises a 404. If LS_UUID is *
NSX returns an empty result string. This patch fixes the fake_api_client
so that it's behavior is correct.

Change-Id: Id66299d6ae3cfa43a65d4cb28f34348d64d8ed65
Closes-bug: 1311291
Remove List events API from Cisco N1kv Neutron

Earlier Cisco N1kv plugin was using list events api to
poll policies from VSM.
It was inefficient and caused delay in processing.
So, now Cisco N1kv plugin  switched to list profiles to
poll policies from VSM.

Change-Id: Ia734735361dc3eaee8e276ada0c80045eaa9ef96
Closes-Bug: #1292173
Imported Translations from Transifex

Change-Id: I35cb53cb3a7a5c151c20be1d6ab7b7447e5c22d1
Sync db code from oslo-incubator

Synced from commit 5fb343faee1442921e2d610b1a5222e67418c4cd.
Due to changes in oslo.db API, this sync requires a bit more
work on Neutron side.

Sync includes the following commits:

5b7e61c Dispose db connections pool on disconnect
d1988b9 Set sql_mode callback on connect instead of checkout
a1a8280 Fix excessive logging from db.sqlalchemy.session
9933bdd Get mysql_sql_mode parameter from config
96a2217 Prevent incorrect usage of _wrap_db_error()
20a7510 Add from_config() method to EngineFacade
fea119e Drop special case for MySQL traditional mode, update unit tests
dda24eb Introduce mysql_sql_mode option, remove old warning
0b5af67 Introduce a method to set any MySQL session SQL mode
8dccc7b Handle ibm_db_sa DBDuplicateEntry integrity errors
5b9e9f4 Fix doc build errors in db.sqlalchemy
ac84a40 Update log translation domains
86707cd Remove None for dict.get()
0545121 Fix duplicating of SQL queries in logs
fcf517d Update oslo log messages with translation domains
630d395 Don't use cfg.CONF in oslo.db
ce69e7f Don't store engine instances in oslo.db

Change-Id: I0e1d86878d3eb924b01e04dced0f90b4e57757d8
Fix H302 violations in extensions package

H302 violation is reported by flake8 when importing separated objects from
modules instead of importing the whole module.
e.g.   from package.module import function
       function()
is changed to
       from package import module
       module.function()

Change-Id: I570eeee2a7633c1590b54ac98b411a71fc9d4f4e
Partial-Bug: #1291032
Merge "Delete disassociated floating ips on external network deletion"
Merge "Fix Metering doesn't respect the l3 agent binding"