Hash device_id only if it is longer than the allowed MAX size for NVP

This ensure that a VM uuid stays untouched, avoiding potential
confusion when inspecting NVP port tags. This patch also abstracts
the hashing method out by introducing a device_id_to_vm_id method.
Filtering logic is preserved, and a test has been added to ensure
that. However such a logic is not currently used in the NeutronPlugin
(because of the introduction of async status updates), but it has
been added as utility method to nvplib.

Fixes bug #1215204

Change-Id: Ib96ecae438e30f195c8b45176abc1cf55b4b363f
Don't add neutron metadata_nat_rules if disable metadata proxy

This patchset fixes this issue by adding a condition when adding nat
rules of neutron metadata proxy.

fixes bug #1212168

Change-Id: I99775aad73c49a8df3043690440d214614279a2b
Don't need to init testr in run_tests.sh

In run_tests.sh, function init_testr will initialize testr if the
directory .testrepository is not existed. Actually, testr will do
the check before run the test:

In Python package testrepository, setuptools_command.py:Testr.run

68 def run(self):
69     """Set up testr repo, then run testr"""
70     if not os.path.isdir(".testrepository"):
71         self._run_testr("init")

So, init_testr can be removed safely.

Fixes Bug #1224285

Change-Id: Ia74d9fff92b8efba9b72e5c7387f761144daa193
Enhance exception translation to better handle NeutronExceptions

NeutronExceptions have a 'message' class attribute that holds the
generic error message template, e.g. "Network %(network)s not found",
unfortunately, because the names are the same, it was overshadowing the
actual exception instance 'message', e.g. "Network 1 not found", after
translation when the exception was serialized to JSON.

This patch puts the exception's actual message in a new field called
'msg' and overwrites NeutronException unicode() so that 'msg' is used
during serialization and we'll get the correct message on the REST API
response.

Fixes bug: #1212882

Change-Id: I3965bffb1c2c2eee0af440d1ecd30ccb3bb958d5
Imported Translations from Transifex

Change-Id: I4c978bcffa92b00deaf86a3da826ebe2a4ca0eb4
Add new L3 RPC topic support to Ryu plugin

fixes bug #1224796

This patch adds RPC consumer for the new topic for L3 callbacks to
Ryu plugin.

Change-Id: Id9b3af474e65ab4c5b58121e1dcb160f80a71633
Add NvpPluginV2 to migration 4a666eb208c2

Bug 1224882

This migration alters a table used by NvpPluginV2 as well, so
it must be included in the plugin list.

Change-Id: Ifc5104d813c76fa8de000ec977ca3242e90e433d
Stop popen patch correctly in test_agent_linux_utils

Fixes bug #1225009

Change-Id: Ic9f3491be2fb7481bbf3fd843a421d66d9248a20
Fix failure in multi-chunk state sync for nicira plugin

Bug 1224719

This patch ensures the 'result_count' attribute from NVP API responses
is properly handled, and adds support for '_page_cursor' request query
parameter in the fake nvp api client in order to ensure issues like this
are captured by unit tests.

Change-Id: I1d6179bd58a14d19729fc882f004b6d1afccbe3d
Fix incorrect comment re:distributed router in nicira plugin

Change-Id: I22445cc477a86cb99e97740fd8a9ddb796c1ebac
Fixes Hyper-V agent unsopported network_type issue

Fixes an issue when an exception is raised in case of not
supported network types.

Fixes bug: #1224583

Change-Id: I847aa825fbf5b7086c9960c051014cc1d7515f62
Add router ownership check on vpnservice creation

Router ownership must be checked on vpnservice creation.
In this commit, we added the check.

Fixes bug 1224196

Change-Id: I14b18225f82ebe691f253fbd7645ecfc7f12faad
Prevent stale DHCP directories for dhcp agent nodes

This change fixes an issue that is most acute in test/dev
environments but that may affect production environments
as well: the presence of DHCP directories that no longer
represent networks that exist in the Neutron DB. This
issue can manifest itself over time if you delete networks
from the Server while the Agent node is down.

Without this fix, at the agent start-up the method
existing_dhcp_networks will return an empty list, and
as a consequence the directories that belong to networks
that have been removed from the server will stay because
the sync logic will not process them as it only looks at
the mismatch between active networks on the agent and
active networks on the server. With the fix instead, we
return *all* existing dhcp networks; if they are meant to
be active, the agent will bring them up, if they no longer
exist on the server, then the agent will dispose of the
resources. The dnsmasq driver will do the right thing when
enabling or disabling the process.

Fixes bug #1195770

Change-Id: I194064a449801713051d01193adc706bcb687c82
Use same hostname function as nova

Certain plugin implementations of port binding depend on the port's
binding:host_id set by nova matching the compute node's hostname
reported by neutron agents in agents_db. Nova uses
socket.gethostname() to obtain the hostname, so this changes neutron
to also use socket.gethostname(), instead of socket.getfqdn() to
obtain the default hostname. If deployments require a specific
hostname format or value, the hostname can be specified in nova and
neutron configuration files.

Closes-Bug: 1223000
Change-Id: I5de9c6b0df16eca482037a5bdc3a77dc52f4adba
Imported Translations from Transifex

Change-Id: I29024cf2b1f8bf04e7fd57066142665add77eef4
Fix haproxy agent unit test to be runnable alone by tox

haproxy agent uses periodic_interval option that can interfere
with the same option declared in neutron/service.py when running
'tox services.loadbalancer'

Change-Id: Ibcc91d603f5f31c7a376e0c735e8bf566198231d
Closes-Bug: #1221726
FWaaS - fix policy association of firewall rule

If an existing firewall rule already associated with a
firewall policy is associated with a different firewall
policy, the new association should fail. The check for
the existing association was not being made, hence the
firewall rule was being removed from the older policy
and being associated with the newer policy (incorrect
behavior). This is being fixed here.

If the association with the newer policy has to be made
the rule should first be removed from the existing policy
association.

Change-Id: I30c41d77e7fde673f0dccbc98e1cd7bd0d7b384f
Closes-Bug: #1223465
Imported Translations from Transifex

Change-Id: I182234e0d9a95feda9d8cfb17c6be9f2da3d03f6
Using constant error codes instead of hard-coded

Change all hard-coded error codes to be constants
from webob.exc.py in test_db_plugin.py

Fixes bug: #1225614

Change-Id: I9e58bb84afc66293afa56968a745b798bb88bf16
Imported Translations from Transifex

Change-Id: I3eebef458f0501227d971d455c00b98bb295dfed