Use call to report state when ovs_agent starts up

Make sure to report ovs_agent state when starting up, otherwise
ovs_agent start_time would not be updated and thus l2pop does
not send fdb entries.

Change-Id: Idd770a85a9eabff112d9613e75d8bb524020234a
Closes-Bug: #1347452
Check for ports in subnet before deleting it from Nuage VSD

There could exist a port in subnet in neutron in which case subnet delete
is not allowed. In the nuage's plugin code, this validation needs to
be handle prior to sending delete subnet request to backend.

Change-Id: Idd20d2f878a6274a012504108d01bd2237dc665a
Closes-bug: #1351522
Access correct key for template name

When an exception occurs while loading the config agent driver, the
handler tries to log a message, but accesses the wrong key to get the
template name. This causes another exception, which masks the original
exception.

This change accesses the correct key and performs logging inside a
with block to (defensively) preserve the exception context.

Change-Id: I3991bc4c509bbd8d68f7a1c8c8314404f2e0eafa
Closes-Bug: #1368900
Separate Configuration from Freescale SDN ML2 mechanism Driver

- In the current implementation, CRD configuration is existing
  within the code of ML2 mechanism driver.

- When any other plugin/driver (like, Freescale FWaaS Plugin) need
  to use this configuration, it needs to duplicate the complete configuration.

- So the CRD configuration is moved to a separate file for use
  in other plugin/drivers.

- Unit testing of this MD is also updated.

Closes-Bug: #1368033

Change-Id: I488fee47803a494aae9df42f9c59fffa9843e727
Deletes FIP agent gw port when last VM is deleted

This patch deletes the FIP agent gateway port in
the plugin, when the last VM with FIP using this
FIP agent gw port on a Compute node gets deleted.

Closes-bug: #1367588

Change-Id: I71a9fa48544fa4bbd08ac6d83c99e6542c818009
Delete a broken subnet delete unit test

A test to delete a subnet in use was incorrectly
calling 'subnet' instead of 'subnets' in the API request
and asserting a 404 instead of a 409. Even the correct
version of this test is already covered by the
'test_port_prevents_subnet_deletion' method so this
commit just removes the broken test.

Change-Id: I3eac35abbb1d6f8429b4331948aecfc952284219
HA routers master state now distributed amongst agents

We're currently running with no pre-emption, meaning that
the first router in a cluster to go up will be the master,
regardless of priority. Since the order in which we sent
notifications was constant, the same agent hosted the
master instances of all HA routers, defeating the idea
of load sharing.

Closes-Bug: #1365429
Change-Id: Ia6fe2bd0317c241bf7eb55915df7650dfdc68210
Only setup dhcp interface if dhcp is not active on network

When enabling (DhcpLocalProcess.enable()) dhcp for a network the agent
first sets dhcp interface, then checks if dhcp is curently active and
if it's true then the agent restarts dhcp.
Restart (DhcpBase.restart()) first disables dhcp and then enables it again
by calling DhcpLocalProcess.enable() recursively which in turn sets
dhcp interface again (it doesn't see the port created earlier as network
is not re-fetched from db). This leads to duplicate dhcp interface
for the network.

The fix is to only setup dhcp interface if dhcp is not active.

Closes-Bug: #1339968

Change-Id: I3a6d2fd5b18a97138ac5b699ecd4d4b30dbdbacb
Merge "Check for ports in subnet before deleting it from Nuage VSD"
Do not assume order of device_ids set elements

This fixes the test_ancillary_bridges_multiple unit test that breaks with a randomized
PYTHONHASHSEED (see the bug report).
The test assumed that the device_ids set had
elements in a particular order. Found with PYTHONHASHSEED=2455351445.

The fix refactors the pullup_side_effect function so that it checks if the
device_id exists before returning the bridge.

Partial-bug: #1348818

Note: There are several other unrelated unit tests that also break with a
randomized PYTHONHASHSEED, but they are not addressed here. They will be
addressed in separate patches.

Change-Id: Ie6b44d1d820ebb186036ffcd04ea2104dd384e94
Indicate the begin and end of the sync process to EOS

Send a trigger to EOS when a sync operation is initiated, and,
another trigger when the sync operation is complete.
Additionally, sync_interval value (from ml2_conf_arista.ini)
is passed down to EOS. This is used by EOS to timeout the
transaction.

Change-Id: I5110b24380ad848d03719e94283d69a7bc0ce972
Closes-Bug: 1371324
Merge "Access correct key for template name"
Merge "Use call to report state when ovs_agent starts up"
Some clean up of code I'm preparing to modify

This patch has a few benign changes that should be easily reviewed.
The purpose of this patch is to allow me to make cleaner edits in
follow on patches so that they're more easily reviewed in their
specific contexts.

Change-Id: Ia3dd49c7b39f9ca07d5bb117972d934813c0cd67
Fix foreign key constraint error on ml2_dvr_port_bindings

Get the port before creating the DVR binding. This should guarantee that, if
the port is found, no foreign key violation is triggered.

Closes-bug: #1371696

Change-Id: I90c3d6460c14ef27823be95bc26aae38eba4879a
Merge "Indicate the begin and end of the sync process to EOS"
Merge "Separate Configuration from Freescale SDN ML2 mechanism Driver"
Merge "Deletes FIP agent gw port when last VM is deleted"
Merge "HA routers master state now distributed amongst agents"
Merge "Delete a broken subnet delete unit test"