Improve ODL ML2 Exception Handling

Raise a MechanismDriverError when authentication with ODL fails.
Re-raise HTTPError in "sync_resources" for exceptions whose status code is not 404.

Closes-Bug: #1311758
Change-Id: I99d2c4f270007c369024525ba4e6188d232a0b13
Add support to dynamically upload drivers in PLUMgrid plugin

PLUMgrid plugin will be able to dynamycally upload any of its available drivers.
It will simplify any CI testing by changing the configuration file for the plugin
instead of changing the code directly.

Change-Id: I56da881688cfdf8f9a1b655c1080c39ffc0133a5
Closes-bug: #1315137
Performance improvement of router routes operations

This patch fixes inefficiency of updating extra routes.
* remove the code repeated by every routes in validation check.
* remove searching a record to delete per record.

Note: Unit tests are covered by existing ones. So no unit test added.

Change-Id: Ia335ac21c65148063d330e4533a15a73962c43d8
Closes-bug: #1312482
NSX: pass the right argument during metadata setup

The NSX cluster was erroneously passed instead of context.
This patch addressed that and tweaks UT to verify the right
parameter is passed instead.

Change-Id: Ife660b3a23705342043d121c7dcecad43e22abc1
Closes-bug: #1315538
Allow DHCPv6 solicit from VM

DHCPv6 solicit UDP package is currently dropped because
there is no security group rule to allow it like IPv4.

This fix allows UDP DHCPv6 solicit from client port 546 to
server port 547. This fix also drops DHCP reply from VM.

Change-Id: I4941d401576e2c8bad37859d2cba227afde9e764
Closes-Bug: 1316515
Perform policy checks only once on list responses

The policy engine is currently being called for every attribute
of every resource to be returned by a list response. This is
harming the API performance; moreover such a high number of checks
is also unnecessary.

This patch therefore slightly changes the API logic so that list
response first determine the list of attributes which should be
returned querying the policy engine and then use this list for
all resource items to be returned.

To this aim a few methods in base.py needed to be refactored.
This patch also removes the routine check_if_exists from policy.py
and the related PolicyNotFound exception.

Finally, this patch also removes unnecessary admin_or_owner rules
when applied to attributes. This kind of rule indeed has no effect
anyway because of Neutron's ownership checks. The rules were removed
because this change won't allow anymore for having attribute-level
policies whose evaluation result depends on the resource value.

Implements blueprint faster-list-responses

Change-Id: I21b8273add5d5984f512ad94af5a99cf0b0a5d93
Upgrade failure for DB2 at ml2_binding_vif_details

50d5ba354c23_ml2_binding_vif_details fails during upgrade
when DB2 is used as the DB backend of neutron because
Boolean type is not supported by DB2.

This fix uses "1" instead of "true" in sql when db2 is engine.
This fix also changes context creation to op.execute.

Change-Id: I82d2141007894342c634f2c5e62344e20d876d8f
Closes-Bug: 1311589
eswitch_neutron_agent: Whitespace fixes in comments

Change-Id: I81ac1e6240c28f1544ff9be61761a5c58135557c
ML2 VxlanTypeDriver: Synchronize of VxlanAllocation table

At neutron startup VxlanTypeDriver syncs tunnel range from conf
to DB. In case multiple servers deployment restarting several
servers at the same time could lead to DB exceptions being thrown.
Need to synchronize between neutron servers by locking VxlanAllocation
table.

Change-Id: Idf9908f039070b9194612484603f592f1a8d74b8
Closes-Bug: #1307295
Updated from global requirements

Change-Id: I724ef5f13fd7444ea053bd29fbefda2f73897353
Ensure core plugin deallocation after every test

The unit tests were previously consuming an excessive amount of memory
(4GB+) due to plugin instances persisting in memory.  Deallocation was
not possible where a combination of circular references and mocking
was involved.  This patch ensures that only NeutronManager holds a
plugin reference and that all other references are instances of
weakref.proxy.  Residual memory footprint for tox executed on a
12-core machine has been reduced to ~1.3GB.  Plugin deallocation is
validated at the end of each test to prevent regressions.

This change also includes fixes to unit tests that depended on plugin
instances persisting across tests.

Partial-Bug: #1234857
Change-Id: Ia1f868c2d206eb72ef77d290d054f3c48ab58c94
Merge "Ensure core plugin deallocation after every test"
Merge "Add support to dynamically upload drivers in PLUMgrid plugin"
Make plugin deallocation check optional

The fix for memory leakage in the related bug added a check for plugin
deallocation that performed a call to gc.collect() after every test.
This had the side-effect of increasing test execution time by ~50%, so
this patch makes the check optional via an environment variable
(OS_CHECK_PLUGIN_DEALLOCATION).

It may make sense to create a periodic job that runs with the check
enabled, but otherwise the check can be used by developers for
debugging purposes.

Change-Id: I9ebe663abbc4e4ff3a62d807d5a3230c2ecccd07
Related-Bug: #1234857
Merge "Updated from global requirements"
Merge "eswitch_neutron_agent: Whitespace fixes in comments"
Merge "Make plugin deallocation check optional"
Merge "ML2 VxlanTypeDriver: Synchronize of VxlanAllocation table"
OVS lib defer apply doesn't handle concurrency

The OVS lib deferred apply methods use a dict to save flows to add,
modify or delete when deffered apply is switched off.
If another thread adds, modifies or deletes flows on that dict during
another process called deffered_apply_off, its flows could be ignored.

This fix stash reference flows list and point the flows list to a new
cleared flows list. Then, it applies flows from the stashed flows list.

Closes-bug: #1263866
Change-Id: Ia3c6ce181e1599d1474da7eb944feff7d84f1d73
LBaaS VIP doesn't work after delete and re-add

When delete and re-add the same vip, we need to send gratuitous ARP
to flush the ARP cache in the Router.

Change-Id: Id97088abb95f4433a100abdae8c8726b3be42ed2
Closes-Bug: 1301165