Big Switch: Don't use MagicMocks unnecessarily

Replace the mocks purely being used to block external
calls with functions that just return and don't record
calls.

Closes-Bug: #1315574
Change-Id: I79533135b5cb456d941ddffa62f5365970146a7e
Use list copy for events in nova notifier

There is no need to call range() and len() and .pop() for such a
simple task as list copy.

Change-Id: I4d25e0887ba0a7a5c7f49d195e90a7d2818caac2
Improve usage of MagicMocks in ML2 and L3 tests

Removes usage of a MagicMock in a case where it's not needed.
Replaces a manual function replacement with a mock.patch call
so it's correctly cleaned up by mock.patch.stopall.

Partial-Bug: #1316401
Change-Id: I8f2f7e9eca2aeaa3b65be1b451e96ed2146950f4
Removes unnecessary Embrane module-level mocks

The embrane unit tests install a magicmock into
the system modules at the module level which
persists across all unit tests and isn't required.
This patch removes the unnecessary and limits the
life of the module mocks where they are necessary.

Partial-Bug: #1316401
Change-Id: Iaa38ee0c6821d46a6d78eefef39006df2c1c47e5
Add local type driver unittests

Partial-Bug: #1269127

Change-Id: I5b34dc09128bcb879ea46be64cc5104eeefd4ab4
Changed DictModel to dict with attribute access

DictModel is a dict where keys are accessible via attribute access.
The old version was an object with attributes created from dict keys and many
attributes where accessible only via getattr because they did not have a valid
python attribute naming (i.e.: 'provider:network_type' is not a valid
python variable/attribute name)::

    >>> d.provider:network_type
      File "<stdin>", line 1
        d.provider:network_type
              ^
    SyntaxError: invalid syntax

This time we just subclass dict with attribute access to keys.

So dict keys are accessible via attribute access but remain accessible via key
access::

    >>> d = DictModel({'foo': 'bar', 'provider:network_type': 'something'})
    >>> d.foo == d['foo']
    ... True
    >>> getattr(d, 'provider:network_type') == d.get('provider:network_type')
    ... True
    >>> getattr(d, 'provider:network_type') == d['provider:network_type']
    ... True

One of the big advantages when debugging is that now in pdb, pp(d) (where d is
a DictModel instance) shows a nice dictionary structure, while with the old
version whe had to perform a "dir(d)" and introspect each attribute...

Change-Id: I05fad7cd9763f97f61680d45e1b6592a80049541
Closes-Bug: 1251653
Cisco APIC Layer 3 Service plugin

This plugin provides Layer 3 features for the Cisco APIC.
The service plugin is currently limited to internal gateways
due to limitations in the Hardware.

Change-Id: I81cde4d721f9d72ec67baaf64ab91148b3799d78
Implements: blueprint cisco-apic-l3
Default to setting secure mode on the integration bridge

Set the fail-mode on the integration bridge to be secure. This means if the agent
is stopped or crashes, and OVS is also restarted, OVS will not program a default
NORMAL action. As soon as the agent is restarted, it will correctly program the
integration bridge.

Change-Id: Icf7e3e14ee747c8ce92c14c95a0a1bbf35986252
Closes-Bug: #1324703
Sync service module from oslo-incubator

This is needed for the stop method now implemented in service.py used here:
https://review.openstack.org/#/c/72564

Current oslo-incubator commit on HEAD
ad3c887fbfc81ac3502a3e49c1ed6c2824029c25

Change-Id: I66901c0c42472be1aadab803958932bcb9be8ee1
Return no active network if the agent has not been learnt yet

Sometimes the agent message to get the active networks is
processed before the agent is learnt by Neutron. Neutron throws an
error, but it should simply return no network

Change-Id: I6da0ca578cfe1fe0885138a5e2da76278f791491
Closes-bug: #1302838
Added note to neutron.conf

Added note to neutron.conf which clarifies where database
connection attribute should be set.

Change-Id: Ic0631cff789046528cae8622d935b65ae9b012cb
Closes-Bug: #1261298
OVS Agent: limit veth names to 15 chars

The maximum length of a veth interface name is 15 characters.
This patch limits the length of the veth names created for
integration bridges by switching to a fixed-length hashing
mechanism if the normal name would exceed the allowed length.

Closes-Bug: #1328288
Change-Id: I432cee62a6dc91f268becbc91f8024c23dd0bfac
Big Switch: Call correct method in watchdog

Updates the consistency watchdog fuction to call
the correct rest method.

Closes-Bug: #1328321
Change-Id: I86ce0af36f6764a3f1e789602cef52758caedc8b
Replace XML with JSON for N1kv REST calls

Currently the cisco n1kv plugin handles XML responses from VSM.
This change will replace the httplib2 with requests library and handle
JSON responses from the VSM.

Implements: blueprint cisco-n1kv-json-support

Change-Id: Icd32a6a2ab815ccd24ad86371e927c132e204413
Big Switch: Add missing data to topology sync

Adds data to the topology sync function that was
missing in the case where it is called from the
ML2 driver.

Closes-Bug: #1328222
Change-Id: I1cc3b0430f63f62c881f28139d1e5ebf22766357
Increase default metadata_workers, backlog to 4096

While deployment tools might want to change the number of workers
to match the number of cores (Or some fraction of it), any default
other than 1 should be outright better.

Inspired from 19:34:
https://www.youtube.com/watch?v=AF9r_VQrcJ0

DocImpact
Closes-Bug: #1323005
Change-Id: Ie90000183ae67ff391a23ca3213fd23aef5f4dc5
Check NVP router's status before deploying a service

With NVP advanced service plugin, router creation is asynchronous while
all service call is synchronous, so it is possible that advanced service
request is called before edge deployment completed.
The solution is to check the router status before deploying an advanced service.
If the router is not in ACTIVE status, the service deployment request would return
"Router not in 'ACTIVE' status" error.

Change-Id: Idde71c37f5d5c113ac04376ed607e0c156b07477
Closes-Bug: #1298865
Imported Translations from Transifex

Change-Id: I3c8e6595c12a2dabd15eb811f7d3fd5611427c6c
Use import from six.moves to import the queue module

The name of the synchronized queue class is queue instead of
Queue in Python3.

Change-Id: I5c5aba89b30b311bbfba2b64c61ea566d339b7c9
Closes-Bug: #1327975
Big Switch: Catch exceptions in watchdog thread

Catch and log exceptions in the watchdog greenthread to prevent
them from stopping the periodic consistency checks.

Closes-Bug: #1330135
Change-Id: I6834c0fee0429bb72b8c61307be7bdca77f6de9b