Stop ignoring 400 errors returned by ODL

This commit stops ignoring 400 (Bad Request) HTTP codes returned by ODL
in create and update operations. It also modifies sendjson() because it
doesn't ignore any HTTP error code now.

Change-Id: Id0db2c0c1d8fddfbd16b3ce9476a2358e2ef1e49
Closes-Bug: #1369239
Remove some duplicate unit tests

There are several locations where some unit test mixins are
incorrectly used multiple times with an otherwise same configuration,
which results in pointless re-runs of the same unit test. Similarily,
there are a few tests defined in classes inherited by multiple tests
that don't change behavior in the child tests so they are run multiple
times as well.

This patch eliminates the duplicates and moves some test cases from
their parent class into a subclass when they don't need to be run multiple
times. The result is 221 fewer test runs (~1.5% of the tests run).

Closes-Bug: #1374836
Change-Id: I292091488cd944510fa1250920d41be2a50dabaf
Guard against concurrent port removal in DVR

The delete_csnat_router_interface_ports method constructs
a generator expression to retrieve the ports attached
to a router. If a concurrent process manages to delete
one of the ports referenced in the generator from the DB
after it is constructed (but before iteration), some of the
ports will be None objects on iteration.

This patch verifies that the port db object is there
before trying to extract the ID from it.

More details:

This is because the query expression[1] is evaluated immediately
at the time the generator is defined. If there are ports in the
DB at the time of this evaluation, RouterPort objects will be
prepared to be iterated over. However, before the iteration over the
generator happens, something else may delete the port from the DB.
If that happens, when the iteration starts and the 'port' attribute
is accessed on the router port, a SELECT statement will be issued to
the DB to get that port[2] and it will return None.

1. router.attached_ports.filter_by(port_type=DEVICE_OWNER_DVR_SNAT)
2. The RouterPorts table's relationship to the Ports table is using
   the default 'select' lazy loading.

Closes-Bug: #1381263
Change-Id: Ia371545d641aaa1cbaa0fd10cd233250ec5769e5
Remove single occurrence of lost-exception warning

Returning within a finally block can be surprising since the finally
block will "hijack" the regular return flow.  In this case, pylint is
trying to warn us that the return-within-finally would discard the
earlier caught exception.  For this particular function we don't care
that the exception is lost, so the existing code is correct but possibly
confusing.

Our options are:
1. Disable the lost-exception warning for this function
2. Rewrite the function to avoid return-within-finally

This change takes approach (2), since the required change is trivial.

This change also enables the corresponding pylint check now that the
only offending case has been removed.

Change-Id: If1706851b4bd67ebdbbdb3485984773598efdf7a
neutron-db-manage finds automatically config file

This patch lets oslo.config find config file containing connection
string to database by itself. Config file can be overriden by
--config-file cli parameter as it was before, so it is backward
compatible.

Change-Id: Iacbcd65edfe9ef268a0caf80641e0937a99b06a7
Closes-Bug: 1381100
Validate network config (vlan)

Validate to make sure empty physical networks
are not permitted. Added unit test as well.

Change-Id: Ie55fab3c53276ed48d5e9d603e8c1dc59fa9cc32
Closes-Bug: 1325664
Allow to add router interface to IPv6 SLAAC network

This patch will allow an IPv6 subnet configured with SLAAC
(or dhcpv6-stateless) to be attached to a router interface.

Closes-Bug: #1382076
Change-Id: If0c48a7287a828eef4a0f0b0859d4f898d2937bd
Use stop() method on MessageHandlingServer

MessageHandlingServer has no kill() method. In case neutron server using
rpc workers and is stopped, wrong method is called.

Change-Id: Id4a11f3dca070e684fb9e079139ac09792bc7aad
Closes-Bug: 1387053
Make L2 DVR Agent start successfully without an active neutron server

If the L2 Agent is started before the neutron controller
is available, it will fail to obtain its unique DVR MAC
address, and fall-back to operate in non-DVR mode
permanently.

This fix does two things:
1. Makes the L2 Agent attempt to retry obtaining a DVR MAC
address up to five times on initialization, which should be
enough time for RPC to be successful.  On failure, it will
fall back to non-DVR mode, ensuring that basic switching
continues to be functional.

2. Correctly obtains the current operating mode of the
L2 Agent in _report_state(), instead of only reporting
the configured state.  This operating mode is carried
in 'in_distributed_mode' attribute of agent state, and
is separate from the existing enable_distributed_routing
static config that is already sent.

Change-Id: I5fd9bf4163eafa321c5fca7ffb7901ae289f323b
Closes-bug: #1364215
Fix sneaky copypaste typo in ovs agent scheduler test

Change-Id: I3433e0bcd9834cbf387da42b8e69df9a5127b1bf
Imported Translations from Transifex

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

Change-Id: Icd40b3f0556c735637c940072306c52124df2f54
Merge "Use stop() method on MessageHandlingServer"
Merge "Stop ignoring 400 errors returned by ODL"
Merge "Remove some duplicate unit tests"
Replace "nova" entries in iptables_manager with "neutron"

In iptables_manager docstrings there are still some references to
nova left from nova/network/linux_net.py.
Remove these references and update the docstrings.

Change-Id: I50813e3050f7f117512bde7c2563ce3410939e54
Closes-Bug: #1389601
Merge "Allow to add router interface to IPv6 SLAAC network"
Merge "Make L2 DVR Agent start successfully without an active neutron server"
Merge "Validate network config (vlan)"
Merge "neutron-db-manage finds automatically config file"
Merge "Remove single occurrence of lost-exception warning"