Fix to not send fdb updates when no port changes

(cherry picked from commit 28054a62314daaf30f636e4989cded529b6f12d5)
Fixes bug: 1241874

Change-Id: I36d453c01301ce0b04f64e719ff8f2fe55c72fa2
Fix L2pop to not send updates for unrelated networks

With this patch L2 population mechanism driver
sends updates only with ports related to the
network id of the port which is being updated.

(cherry picked from commit de24799696a8199b13223c2ca3820a9ef015bbe0)
Fixes bug: 1240744

Change-Id: If7d51ce26bf0d0837a00da07fe85f48d55e681c6
Fix lb doesn't remove vxlan int. if no int. map

LinuxBridge agent doesn't remove vxlan interfaces
if interface_mappings is not set.

(cherry picked from commit f39c8965d9679971afa3db101c09ca2740b39a91)
Fixes bug: 1240742

Change-Id: I163f1ac8cbd46b8d8836152e2be8cb7608a8ca22
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: I0cfb58d487b1925e0a0db2a701c5ea3c56a0b2b5
Fixes: Bug #1209011
Handle VLAN interfaces with Linux IP wrapper

Check if the interface name contains '@' character and use the part
before that character as interface name.

(cherry picked from commit 202fe60b646429aabeb2ef8b1430a1ba9b356061)
Closes-Bug: #1240125

Change-Id: I981c11ed0d62088a0774c09fbeef795f9987cc2f
Merge "Fix L2pop to not send updates for unrelated networks" into stable/havana
Merge "Fix to not send fdb updates when no port changes" into stable/havana
Merge "Fix lb doesn't remove vxlan int. if no int. map" into stable/havana
Merge "Handle VLAN interfaces with Linux IP wrapper" into stable/havana
Avoid suppressing underlying error when deploy.loadapp fails

Raise log level at the first load attempt. If there is a
fundamental problem with the environment, a Lookup error
is not helpful in troubleshooting the problem further.

Fix bug 1210236

(cherry picked from commit: 696e9f3fc8ef7e8bd2a8f21071f3ef91fac14ad5)

Change-Id: I55aa11a0e5a37dbef3f0c1b55aa4c9c11bbf55d9
Merge "Avoid suppressing underlying error when deploy.loadapp fails" into stable/havana
Removes unused nvp plugin config param

nvp_cluster_uuid is no longer used; it was missed
during the configuration file tweaks that was done
during Havana.

Closes-bug: #1251086
(cherry-picked from commit  Id6dd684833c99453cd97d88584be04d99fd21550)

Change-Id: Id6dd684833c99453cd97d88584be04d99fd21550
Fix update_device_up method of linuxbridge plugin

Also add unit tests covering update_device_up and update_device_down
methods

(cherry picked from commit: 01e45596fae2818b41c76b41bef46e86c5d33231)

Change-Id: I97f2f9249b684aa5350b3f0621754543e80bec70
Closes-Bug: #1241602
Tune up report and downtime intervals for l2 agent

If the neutron server erroneously thinks that the l2 agent is down
it will fail to bind a port, which can lead to VM's spawn errors.
However, the issue is only transient because the agent effectively
is only 'late' in reporting back.

Best solution would be an alpha-count algorithm (so that we can detect
persistent failures more reliably), but for now let's be more tolerant
assuming that the agent is down by waiting at least twice the report
interval plus a tiny teeny bit.

(cherry picked from commit 291048aba2fcaec8afee3011fb4c12c6ca0ebbba)

Close-bug: #1244255

Change-Id: I544135ce1f6b7eaefb34ac44af8f5844d92ddd95
Fix DB integrity issues when using postgres

The IntegrityError faced on network deletion that
spooks Tempest tests is most likely caused by the
fact that the ml2 plugin does a dirty read. By
adding a 'select for update' we should be able to
address the issue once and for all.

Also, there's a chance that the dhcp port gets
reallocated while we are deleting the network. To
this aim, catch the integrity error and attempt
to recover from it.

This patch also removes the handling of errors
on concurrent reads that can no longer occur when
deleting the network.

(Hopefully) Closes-bug: #1239637

PS: This fix may be relevant for bugs #1243726 and #1246737

Change-Id: Iefae7fc8a903cc35d8bf80fc4cee533b7f64032c
(cherry picked from commit 54d79acaab50993f08b50f21019f82f17d38caa3)
Lower severity of log trace for DB integrity error

LOG.exception is not appropriate, since a concurrent
port creation can occur and it has been dealt with
in the except block.

This avoids spooking users who are on the hunt for
real bugs.

Supports fix for 1239637

Change-Id: I9489702ee63db0b004fe41195fa4727af261d514
(cherry picked from commit 4c6906498a5ef0f11ada3ff2224e995f6b3062d8)
Linux device name can have '@' or ':' characters

It's possible to set '@' or ':' character in Linux device name. But
Neutron IP lib doesn't handle correctly these names.

To distinguish VLAN devices from others devices with '@' in their name,
the details option in iproute2 is used.

Change-Id: I7ed24ec00f481207d97bdef052f86388f24d9b21
Closes-Bug: #1245799
(cherry picked from commit 34f30a1d16d81be86a117690ccc5bdfc5bdd0659)
Fix OVS agent reclaims local VLAN

If a port disappears on an OVS agent, the port is removed of the lvm
vif_ports list. And if it's the last port of the network on this agent,
the network local VLAN is reclaim.

Change-Id: I07e03107eb86a84eeb8e4d06f27a1d2fbd7cea57
Closes-Bug: #1252284
(cherry picked from commit a5d996e381bd342f0204fcd99e8548cf28b20e92)
Merge "Tune up report and downtime intervals for l2 agent" into stable/havana
Fix TypeError: <MagicMock name='LinuxBridgeManager().local_ip'

This patch fixes an error that does not result in a test failure but
causes the following error to be logged in the test logs:

TypeError: <MagicMock name='LinuxBridgeManager().local_ip' id='666599248'>
is not JSON serializable

Related-Bug: #1234857

Change-Id: I65cdd997745d8b760031f8f32e3c10682ad2288e
(cherry picked from commit: d26dfed7d47926425bb55893da45f650d6549b9a)