Simplify using external routers and metadata

The dhcp agent only pushes out the metadata
static route when the subnet is isolated, and it
determines that by checking if the gateway_ip is
not set. This makes it tricky to use external
routers and metadata from dhcp at the same time.

This patch changes how the dhcp agent determines
that the subnet is isolated. It now considers it
isolated if there is no Neutron router on it.
This makes it straightforward to use an external
router on a provider network and get the
metadata from the dhcp namespace.

Change-Id: I0e29a2f058564c267176dab26da00f6ef579808b
Closes-Bug: 1236783
Correct handling mock.patch.stop method

Correct calling the right stop method of mock.patch object.

Change-Id: I53cffd78f7597a9a0dc8ec7dbc176d958c85be83
Support uncompressed ipv6 address and abbreviated ipv4 address

Now neutron supports zero-compressed ipv6 address like
'2001:db8::10:10:10:0/120' and unabbreviated ipv4 address
like '10.0.0.0/24'.
This path will make neutron also support uncompressed ipv6
address and abbreviated ipv4 address. for example:
1, uncompressed ipv6 address like 'fe80:0:0:0:0:0:0:0/128'
2, ipv6 address with multiple consecutive zero like
   '2001:0db8:0:0:1::1/128' or '2001::0:1:0:0:1100/120'
3, abbreviated ipv4 address like '10/24'

Change-Id: I755e38ea11c139e15488ec60e7d5682a244ab114
Closes-Bug: #1240790
LBaaS: when returning VIP include session_persistence even if None

Closes-Bug: #1231915
Change-Id: I3dc5e17118995fb49dd381d08c9d92cb60b80abb
Remove deprecated fields in keystone auth middleware

This commit makes the following changes:

Use X_PROJECT_ID instead of X_TENANT_ID:
  In the latest keystone auth_token middleware it is recommended to
  use X_PROJECT_ID instead of X_TENANT_ID. X_PROJECT_ID is supported
  in auth_token middleware for both keystone v2 and v3 API.
  The corresponding change was done in keystoneclient before Grizzly
  release, so we don't need to take care of X_TENANT_ID now.

USE X_ROLES instead of X_ROLE:
  X_ROLES is now recommended.
  X_ROLE exists just for diablo backward compatibility.

Remove X_TENANT and X_USER:
  X_TENANT and X_USER are for diablo backward compatibility.
  We no longer need take care of them in Icehouse Neutron.

Change-Id: Ie714b1323ff8c44dbee66b54e683226cf675b104
Closes-Bug: #1242447
Avoid dhcp agent race condition on subnet and network delete

This patch ensures that, when the dhcp agent queries the server
to retrieve and delete its DHCP port, it does so by selecting
for update. This has been done by introducing a new method
that combines the get and delete in one shot.

Closes-Bug:1197627

Change-Id: I1e8a87d7dc1a1cb9309aeefd41619e20f49f95a6
LBaaS UT: use constants vs magic numbers for http error codes

Closes-Bug: #1245388
Change-Id: I4192b577182891f6d777a5a5eac237c9961e41bb
Use correct device_manager member in dhcp driver

* The DHCP driver used to use device_delegate, but that has
  changed to device_manager. referencing device_delegate
  caused the cleanup of the dhcp agent namespaces to fail.
  This fixes the issue by using the correct member name,
  device_manager

Change-Id: Iab8ea0549383335ff66f3f13df1953d206eeb28f
Closes-Bug: #1245408
sync log from oslo

5fef5a8105 allow keeping of existing loggers with fileConfig
fb8075a19d Add amqp=WARN,qpid=WARN to default_log_levels
4654a5d247 Don't override default value for eventlet.wsgi.server logging
41ddd7a975 _get_log_file_path explictly return, when logfile/logdire unset
e12e6b45f8 Make openstack.common.log Python 3 compatible
572cfecb4d Make Messages unicode before hitting logging
3243cdfbe9 python3: handle module moves in log

DocImpact

Change-Id: I63e21a4fbcc633e68a37a549508f971ac0704a6f
Merge "Avoid dhcp agent race condition on subnet and network delete"
Fix query error on dhcp release port for postgresql

This is achieved by disabling eager loading and
hence by avoiding incurring in left outer joins
that cannot be applied because of a nullable
side.

Closes-bug: #1246788

Change-Id: I16bcc738a43609f715c2561413c6387f443bd99c
Merge "sync log from oslo"
Merge "Fix query error on dhcp release port for postgresql"
Fix segment range in N1KV test to remove overlap

Adjusts a segment range in an N1KV unit test so
it doesn't overlap with a segment range in another
test that may be executed simultaneously.

Closes-Bug: #1248377
Change-Id: I84a15a2c772f01d7be7ba91aa86de09b934ef5e9
DHCP agent scheduler support for BigSwitch plugin

Adds support for the Neutron DHCP agent scheduler to the BigSwitch
plugin to support multiple neutron DHCP agents.

Implements: blueprint bsn-dhcp-agent-scheduler
Change-Id: I629ce73c0b97c2409b37afb85639282a116560b7
Merge "Fix segment range in N1KV test to remove overlap"
Fix import log_handler error with publish_errors set

Sync from Olso.
Commit Id is Ibf28ba17f81b5ddeda653f6a3501ecac18ffcd42

This handler sends all error logs as rpc notifications.
Note: when using publish_errors you also need to set the
notification_driver option too.

Closes-bug: #1240349
Change-Id: Ie66b23af8da2e439e0ac2f5677f6a064e3dd3133
Remove database section from plugin.ini

Change https://review.openstack.org/#/c/34515 moved the database
config items to neutron.conf but left some commented out
[database] items. Remove them as well.

Closes-Bug: #1247589
Change-Id: I05913d0c27a683cec30cae31a1978612aa1e1360
Refactor configuring of floating ips on a router

This approach to configuring floating ips is stateless and idempotent.
This allows it to handle corner cases, such as reusing a floating ip
address with a different floating ip id in a way that is easier to
understand.

The concept is to wipe the floating ips clean and rebuild them each
time with the following optimizations.  To avoid bad performance in
manipulating iptables, it is called in the context of a call to
defer_apply_on.  To avoid a disruption in network flow a set
difference is use to determine the set of addresses that no longer
belong on the inteface rather than removing them all blindly.

Change-Id: I98aacbbb52b35688036990961d02e0b273504a77
Fixes: Bug #1209011
ExtraRoute: fix _get_extra_routes_by_router_id()

router_id filter wasn't properly applied to the query
so the func returned all extra routes of all routers.

Closes-Bug: #1248219
Change-Id: I77733ee7994c8fccbbc966ccabd83b8fe4def8d5