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.

Conflicts:

	neutron/tests/base.py
	neutron/tests/unit/ml2/test_mechanism_odl.py
	neutron/tests/unit/test_db_plugin.py

Partial-Bug: #1234857
Change-Id: Ia1f868c2d206eb72ef77d290d054f3c48ab58c94
(cherry picked from commit 6db48dd688d45ba41863926fa1a91d2d3ea484ec)
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
(cherry picked from commit ee5c3b0bb60918a7e59e89ceffbafa2f683b74fd)
Control update, delete for cisco-network-profile

Add new behavior to control update and delete operations for the
cisco-network-profile resource extension.
The new behavior is to allow update and delete operations only if
there are no neutron networks associated with a particular
cisco-network-profile instance

Change-Id: I000a03c1ffd5c02e7b827ec757287633e5a5dd64
Closes-Bug: #1323867
(cherry picked from commit accd56fea86a0cd5f1706cbdd5b1bbc31c4cf479)
no quota for allowed address pair

There is no quota for allowed address pair. User can create unlimited
allowed address pairs. I add quota for allowed address pairs.

Change-Id: I7fec291a4838fba96b6d400ad56dbcdba9584d0f
Closes-Bug: #1336207
(cherry picked from commit I2efb0c0f527f1fb22c4d4b07f6d280863f565648)
Added support for NOS version 4.1.0, 5.0.0 and greater

NETCONF temaplates for NOS version greater than 4.1.0 are slightly
different (argh). An init time check of the NOS version is done
to enable selection of the correct NETCONF templates.

Change-Id: I01e82ad402fbbb25d92a99a3325ca2608dd514cb
Closes-bug: #1332719
(cherry picked from commit f807023246501b77e792371d98b612b208f5e8e3)
NSX: Remove unneed call to _ensure_default_security_group

This patch removes an unneeded call to _ensure_default_security_group
which does not need to be called in create_security_group_rule_bulk()
as one would need to call get_security_groups() to look up the uuid
of the default security group which be would created it for us, BOOM!

Change-Id: I628a94c7ea9553dcefa68fa956f25244f0abbb18
Closes-bug: 1340536
(cherry picked from commit e2dac9daf39d9b519df14441bbeb99c3c4a7bfaa)
NSX: fix router ports port_security_enabled=False

Previously there was a bug that resulted in a security group being
added to router ports which was not supported in NSX. Removing the
security group didn't actually completely solve the problem as we
never cleared the allowed_address_pairs on the router port. This
patch fixes this issue by disabling port_security_enabled on the
router port.

Change-Id: Ib61756e3bd5866318cbc3bb9856344571399d656
Closes-bug: 1344266
Related-bug: 1329043
(cherry picked from commit 25f1439ff356f78ab0d28a74dfc75d50e2f030b6)
Merge "Ensure core plugin deallocation after every test" into stable/icehouse
Merge "Make plugin deallocation check optional" into stable/icehouse
Merge "Added support for NOS version 4.1.0, 5.0.0 and greater" into stable/icehouse
Merge "NSX: Remove unneed call to _ensure_default_security_group" into stable/icehouse
Merge "Control update, delete for cisco-network-profile" into stable/icehouse
Merge "NSX: fix router ports port_security_enabled=False" into stable/icehouse
Merge branch 'stable/icehouse' of https://github.com/openstack/quantum into stable/icehouse