Race for l2pop when ports go up/down on same host

With l2pop enabled, race exists in delete_port_postcommit
when both create/update_port and delete_port deal with
different ports on the same host, where such ports are
either the first (or) last on same network for that host.
This race happens outside the DB locking zones in
the respective methods of ML2 plugin.

To fix this, we have moved determination of
fdb_entries back to delete_port_postcommit and removed
delete_port_precommit altogether from l2pop mechanism
driver.  In order to accomodate dvr interfaces, we
are storing and re-using the mechanism-driver context
which hold dvr-port-binding information while
invoking delete_port_postcommit.  We loop through
dvr interface bindings invoking delete_port_postcommit
similar to delete_port_precommit.

Closes-Bug: #1372438
Change-Id: If0502f57382441fdb4510c81a89794f57a38e696
(cherry picked from commit 3cd2163d5105faad389bee5175ef446f0bb90289)
Big Switch: Don't clear hash before sync

This patch removes the step of clearing the consistency
hash from the DB before a topology sync. This will ensure
that inconsistency will be detected if the topology sync
fails.

This logic was originally there to make sure the hash header
was not present on the topology sync call to the backend.
However, the hash header is ignored by the backend in a sync
call so it wasn't necessary.

Closes-Bug: #1379510
Change-Id: I2d58fa2aea3b692834d64192d06ace727c7df8a0
(cherry picked from commit 24e4110eb284078775496501ff81630eb1619c11)
Cisco N1kv: Remove vmnetwork delete REST call on last port delete

Remove the vm network delete call to the VSM on final port call and
ensure that vm network is deleted from the database when the port count
becomes 0.

Change-Id: I6c08a099adfce2fdba8eefec6aadeb68a780ac37
Closes-Bug: 1373547
(cherry picked from commit 4e1c4cbcd71833095534bea9ff7617c582c300d2)
Merge "Big Switch: Don't clear hash before sync" into stable/juno
Big Switch: Switch to TLSv1 in server manager

Switch to TLSv1 for the connections to the backend
controllers. The default SSLv3 is no longer considered
secure.

TLSv1 was chosen over .1 or .2 because the .1 and .2 weren't
added until python 2.7.9 so TLSv1 is the only compatible option
for py26.

Closes-Bug: #1384487
Change-Id: I68bd72fc4d90a102003d9ce48c47a4a6a3dd6e03
(cherry picked from commit 62588957fbeccfb4f80eaa72bef2b86b6f08dcf8)
NSX: allow multiple networks with same vlan on different phy_net

Previously, the NSX plugin prevented one from creating multiple networks on
the same vlan even if they were being created on different physical_networks.
This patch corrects this issue and allows this to now occur.

Closes-bug: 1367034

Change-Id: I343449648304328dffdd5ba070491e05686ee22d
(cherry picked from commit 6d1f864531d169a54bc239561840176012629316)
Merge "NSX: allow multiple networks with same vlan on different phy_net" into stable/juno
Create DHCP port for IPv6 subnet

There is a bug in dhcp agent code that when first port is created
in an IPv6 subnet, DHCP port is not automatically created.

This fix resolves this problem by removing the IP version check
in configure_dhcp_for_network method.

Change-Id: If3f405d367a7099d9f33d72d11ffcb7a393abe23
Closes-Bug: #1367500
(cherry picked from commit 1b66e11b5d8c0b3de0610ca02c3e10b6f64ae375)
Merge "Race for l2pop when ports go up/down on same host" into stable/juno
Merge "Cisco N1kv: Remove vmnetwork delete REST call on last port delete" into stable/juno
Big Switch: Fix SSL version on get_server_cert

The ssl.get_server_certificate method uses SSLv3 by default.
Support for SSLv3 was dropped on the backend controller in
response to the POODLE vulnerability. This patch fixes it
to use TLSv1 like the wrap_socket method.

Closes-Bug: #1384487
Change-Id: I9cb5f219d327d62168bef2d7dbee22534b2e454e
(cherry picked from commit 77e283c94f51e21dcf126a316098c54a7cdfca0f)
Fix sleep function call

Remove time.sleep method reference in class and use time.sleep directly.

Change-Id: Ib4c02061b29c0d584d603746a78ab50922f781c3
Closes-Bug: 1375698
(cherry picked from commit 8e36ba8d24c198cb5e6c0e4ddc29a08904e3e10c)
Merge "Create DHCP port for IPv6 subnet" into stable/juno
Merge "Big Switch: Fix SSL version on get_server_cert" into stable/juno