Stop exception log in Big Switch unit tests

Reduce unit test log sizes by removing stack trace
exception logging in Big Switch unit tests.

Closes-Bug: #1370898
Change-Id: Id808edb5db567db31b6c1366e20948683f20118a
Adds macvtap support

The current logic handles only VFs with direct vnic-type.
This fix will add support for VFs with macvtap vnic-type,
By checking the relevant upper_macvtap directory.

Change-Id: Id69b7e64858020682fd0f68b0e162e5e8022eea3
Closes-Bug: 1383098
Fix handling of CIDR in allowed address pairs

A CIDR in allowed address pairs would screw up
the calculation of remote security group member
IP addresses due to a call that assumed each entry
was an IP. This patch fixes that an adds a remote
security group reference to the address pairs SG
test case to exercise this code-path.

Closes-Bug: #1382562
Change-Id: I2676f4b56bce7449579d67fb221b3edb7b885103
NSX: Fix foreign key constraint delete provider network

The cascade delete on the tz_network_bindings table is not
taking effect with the NSX plugin. In order to fix this, this
will require a db migration. This patch allows us to provide a
fix for this by deleting the tz_network_bindings within a transaction
to avoid the foreign key constraint. This patch fixes it this way so
that it can be backported to icehouse. Later a patch will be pushed with a
migration which corrects the db schema.

Closes-bug: #1367032

Change-Id: I19d389acc710224baff79ad114fab756b2e21cfc
Fix incorrect int/tuple comparison during binary search

The code contains an incorrect int/tuple comparison during the binary
search, which completely breaks the "priority" feature.
(Apparently python2 thinks int < tuple is not an error and always True.)

Change-Id: Ic404b38eabc87b105c7c2443b6177071b26d97ce
Closes-Bug: #1386946
Support pudb as a different post mortem debugger

Post mortem debugger starts pdb at the assert failure place
when OS_POST_MORTEM_DEBUGGER is set and an exception or assert
failure happens.

This patch adds a neutron env variable OS_POST_MORTEM_DEBUGGER
to allow invocation of pudb instead of pdb. pudb module is not
a hard requisite as it will be only imported if you set
OS_POST_MORTEM_DEBUGGER=pudb.

The old OS_POST_MORTEM_DEBUG env variable is removed now.

Change-Id: I5d40913add439cf9c30305bafc98af9f8cd4d12f
Fix PYTHONHASHSEED bugs in test_security_groups_rpc

This fixes the test_security_groups_rpc unit test that breaks with a
randomized PYTHONHASHSEED (see the bug report).

The test assumed that several Dicts had elements in a particular order.
Found with PYTHONHASHSEED=2701526934.

The fix refactors the test case by using an OrderedDict instead of a Dict.
Or in the case of the regex strings, injecting different values depending
on the order of the devices2 and devices3 Dicts.

An upstream spelling mistake is also addressed in this patch.

Partial-bug: #1348818

Note: There are several other unrelated unit tests that also break with a
randomized PYTHONHASHSEED, but they are not addressed here. They will be
addressed in separate patches.

Change-Id: I744117edfc5869b0750349a89f2792f622e4285d
BSN: Add network to ext_gw_info sent to backend

Include the full network info in the external gateway info
sent to the backend controller. This alleviates a very expensive
query across all tenants on the backend controller.

Closes-Bug: #1393991
Change-Id: If3601ccbce21e683924a7056cdfe4e3c2d4d4a93
Catch NoResultFound in _get_policy_profile_by_name

Add try-except in _get_policy_profile_by_name to raise
proper PolicyProfileNameNotFound if profile not found in
database.

Also unittest is added.

Closes-bug: #1393399

Change-Id: I3ab50a6870ff77a95e0977c75255e9cbd7286fbb
Delete FIP namespace when last VM is deleted

On a compute node when the last VM with a floating IP association
is deleted, the L3 agent did not delete the fip namespace. However
the api server has already deleted the fip agent external gateway
port from the database.

This problem is happening on DVRs because the deletion of a VM port,
in addition to a floating IP disassociation, may also result in the
removal of the external gateway port binding AND the removal of the
fip agent external gateway port.

When the L3 agent is handling a routers_updated notification, it is
not processing floating ip address updates when the router has both
a floating ip disassociated and a external gateway port deleted.
This patch corrects this problem.

Closes-bug: #1377156
Change-Id: I86bdef7c9d988cb9d87c88adde55548d459f29a5
ofagent: Remove obsolete bridge_mappings (plugin side)

For ofagent, it has been superseded by physical_interface_mappings
and was planned to be removed in Kilo.

Related: blueprint ofagent-physical-interface-mappings
Change-Id: I1f7cbcde429a03e7e918dc224d8cbd8c6aa47049
enable H401 hacking check

This change corrects H401 (docstring should not start with a space)
errors and enables the check
Change-Id: I2f798421d5895fcec349c757d27b7f085ee001e7
Partial-Bug: 1329017
Eliminate unnecessary indirection in L3 agent

These indirections serve no useful purpose.  Normally, I wouldn't
bother to change them but these make other refactoring efforts a bit
more of a pain.

Change-Id: Ia73c93eb2eaa81d5772b3e0178fdf18f0c275b4c
Tighten up try/except block around rpc call

The try is too broad.  This commit moves code outside of the try block
where exceptions are not expected to be raised.  This only leaves the
rpc call in the current code.  In legacy code, there used to be more
but now this code merely queues updates for workers to handle
in other threads.

Change-Id: I15407553fc6ad6eeb5b483499fe1a5adffe1edca
Fix context.elevated

The current version of elevated method sets for the original context
the admin role too. This change fix this.

Added unittest.

Closes-bug: #1386932

Change-Id: Ife881112efa151e53bfa4b7af35643dcf2d1114f
Drop RpcProxy usage from bigswitch plugin

This patch drops the usage of the RpcProxy compatibility class from
the bigswitch plugin.  The equivalent usage of oslo.messaging APIs is
now used instead.

Note that there is one very minor functional change included.  The
previous code set the base version to '1.1'.  It should be '1.0'.  The
proper pattern to use is to set the base version on the client side to
be the initial version of the API (X.0).  Then, any methods that
require a newer version need to specify it.  In this case, verison
'1.1' was the security group methods, and those specify '1.1' as you
would expect.

Part of blueprint drop-rpc-compat.

Change-Id: I695d2a26db9c01b0be65b11cd4e4063567b5f20d
Fix metadata proxy start problem for v6-v4 network

Commit 1b66e11b5d8c0b3de0610ca02c3e10b6f64ae375 introduces
a new problem that metadata proxy will not be started when
an isolated network contains ipv6 subnet with dhcp enabled
and a ipv4 subnet.

This fix separates the checks to enable dhcp and enable metadata
so metadata proxy can be started if there is ipv4 subnet exists
in the network with metadata enabled.

Change-Id: If26806083db225e9ab30d75fa6c728ce99a7cafe
Closes-Bug: 1392564
Update i18n translation for linuxbridge log msg's

This patch set covers the linuxbridge directory under neutron/plugins.

Partial-Bug: #1320867
Change-Id: I603f9ae8f95bf1b1815edaca49e728fa378cf6ba
Imported Translations from Transifex

For more information about this automatic import see:
https://wiki.openstack.org/wiki/Translations/Infrastructure

Change-Id: I754cecc4efba2c9cd385de99901dce8c2188fce0
Test HA router failover

HA failover testing requires the ability for two L3 agents to
co-exist on the same machine. The following changes were made
to support this:

* Add l3 agent ability to simulate nested namespaces by suffixing
  each router namespace with '@host'. For example, if a router
  with id '1' is created, its namespace will be:
  'qrouter-1@host'
* Added test.common submodule which will hold common code which is
  shared between the different kind of tests (unit and funtional).
* Added tests.common.agents submodule which holds test-only agents, and
  added a test L3NAT agent to be used in the HA functional testings.

Co-Authored-By: Assaf Muller <amuller@redhat.com>
Closes-bug: #1374946
Change-Id: I2185fe276d9d32b34c407396e7ed5d6e2801340c