Fix concurrency issue in updating DBEntry flags

Fixes bug: #1375226

Cause:
DBEntry flag is updated from two mutually non-exclusive task. This results in corrupting the flags and unexpected free/delete on entry.
The problem is caused while setting "OnRemoveQ" flag on DBEntry as it can be done from any task context.

Fix:
Move OnRemoveQ out of DBEntry flags and make it as atomic bool variable.
Add assert to catch the case where route gets deleted with active paths
Add assert to catch the case where path is inserted to a deleted route
Added new test for repeated route update(from a agent with different nexthop) which discovered this bug.

Change-Id: I5df04f89f00959799a921e9db37388c0eb56334e
HA flag incorrectly set for instance-ip in LBAAS

Instance-ip should be set with active-standby flag. But because of a
change in neutron plugin to set the max-instances to 2 ha-flag was
overwritten to active-active. Removed the code dependency for ha-flag
on max-instances if ha-mode is specified.

Change-Id: I7a0970a6559a062cd13651416658c982bf7554b7
Closes-Bug: #1380763
subnet_uuid may not be present in the subnet dict. Use get() to access it.

Change-Id: Ided70dc28a225566d85b7ca4642bb4fc20f0940c
Closes-Bug: 1372307
(cherry picked from commit c93beb957cafc886c3d6ef6a746242185e32e93b)
Merge "Fix concurrency issue in updating DBEntry flags" into R1.10
Merge "subnet_uuid may not be present in the subnet dict. Use get() to access it." into R1.10
Bug:#1380771 Adding the load balancer session persistence parameters fro Service Instance's Virtual ip. The session persistense type and name are written to haproxy configuration file in the backend section

Change-Id: I44a2b5c750f2ab62221d5bd43925df3de2dc85cd
ISSUE : Services like DNS, ICMP not working in vmware

FIX :
  1. The vlan-id was over-written by ether-type in ProtoHandler::EthHdr
  2. vlan-id was stored in host-order inside the packet
  3. Modify the following packet forming functions to add VLAN header when
     outgoing interface has vlan-enabled
     ArpHandler::ArpHdr
     DhcpHandler::FillDhcpResponse
     DhcpHandler::CreateRelayPacket
     DhcpHandler::CreateRelayResponsePacket
     IcmpHandler::SendResponse
  4. Fix compilation error in test_route.cc
  5. Fix memory leak in instance_service_test
  6. When adding DHCP Option-82 the length of options was returned as 0.
     This resulted in truncated DHCP packet. Fix DhcpHandler::WriteOption82
     to update dhcp-options correctly

UNIT TESTS :
   (PktTest, tx_no_vlan_1) : Verify EthHdr doesnt insert VLAN header when
   outgoing interface is not VLAN enabled

   (PktTest, tx_vlan_1) : Verify EthHdr inserts VLAN header when outgoing
    interface is VLAN enabled.

   The protocol packet format are already verified by existing tests

Change-Id: Ib6505c7a135adc21cd44c96b4c58a0b20dc5a90b
Merge "ISSUE : Services like DNS, ICMP not working in vmware" into R1.10
schema changes for supporting subnet_uuid on the instance-ip

Change-Id: Icfcc120faa68ce884804c0bf71dfcd531c66679f
(cherry picked from commit 39f00bebe8e9ae55f2c4951a8c0a850b7b1a3150)
Catch PermissionDenied exception on security_group_update so that we can return proper error when sg rule quota is exceeded.

Change-Id: I1ebfe45a50521653ec92f115e12b692cc554dec4
Closes-Bug: 1365463
Merge "Catch PermissionDenied exception on security_group_update so that we can return proper error when sg rule quota is exceeded." into R1.10
Fix circular route re-origination bug with transit VN

Problem:

When a service is applied between a VN and a transit VN, routes from the
VN that are re-originated into the transit VN as ServiceChain routes get
re-originated again as ServiceChain routes into the regular VN.

Cause:

Implementation prior to transit VN used to ignore routes that did belong
to the destination VN of the service chain.  Code changes for transit VN
functionality relaxed this check, but did not cover the case where route
belongs to the source VN.

Fix:

Add check to ignore routes from source VN.

Change-Id: Ic6f5520217eca64b79f5144d71f80aa6d661e48a