Expand arp_responder help text

Add additional text to arp_responder help to ensure that
proper documentation is included in the configuration guide.

Make ML2 and L2population references consistent.

Closes-Bug: #1321320

Change-Id: I0fc0691fc3729aa39888c90ca871ad7f711343f8
Define some abstract methods in VpnDriver class

Define the <op>_ipsec_site_connection() methods to ensure any new
service drivers will implement them.

Closes-Bug: 1326793

Change-Id: Idfe67632893592859990db486393a7108362447e
Replace nullable from primary keys in tz_network_bindings with default

Columns vlan_id and phy_uuid were both nullable and primary keys.
Primary keys cannot be nulls. This situation caused problems in
autogenerating scripts creating always migration that set these columns
to nullable.

Instead of having primary keys nullable this patch creates a default
values.

Change-Id: I04642f6d6ad232997a593bff8ca44f9a7a803ffd
Closes-bug: #1346900
Remove ignored do_request timeout argument

The timeout to the underlying request was always self._request_timeout,
regardless of the value of the do_request(timeout) arg provided.  Both
callers always pass timeout=self._request_timeout anyway, so just remove
this unused/misleading argument.

Change-Id: I911ee986caef8fcf9b97ef622a03856d4351bee0
Remove unneeded device_owner field from l2pop tuple

The DVR development added this device_owner to the middle of this
tuple during early development because it was thought to be needed.
Over the course of development, it was found to be unnecessary and
much of the code that read it from this value was removed or
obsoleted.  That job went unfinished and so this commit completes it.
This essentially restores the code to what it was before and fixes the
regression that was caused.

Change-Id: Ia901f925883b53e9880dd25688e16e0ffe402bf4
Partial-bug: #1352801
Fix session's InvalidRequestError because of nested rollback

This patch addresses the issue by removing the extra nesting
(which is effectively redundant).

The longer story about this patch is the following:

Race conditions may cause DBDuplicateEntry exceptions that
require a transaction to be rollbacked back, and yet make
the whole operation succeed. A classic example is what has
been solved in commit fbc6b99. If the rollback is done in a
nested transaction, the above mentioned exception is raised.

To address the problem, we could use savepoints by means of
sqlalchemy's begin_nested(); Even though this approach is
preferable, it causes quite a bit of changes in the unit
tests (because of sqlite); it may also require that certain
DBMS, or certain DB backend configurations, support savepoints.

In the end, the simpler approach was chosen.

Closes-bug: #1354072

Change-Id: Ic9393319e55f71d681124bd3052e939724ebab6b
Return port context from _bind_port_if_needed

Previously port was returned causing exception being thrown
in rpc handling code.

Change-Id: Iba498d0600d625f0469392b99ac0bc8c1f1ecff7
Closes-Bug: #1354912
Fixing neutron-db-manage with some options other than upgrade/downgrade

"mysql-engine" argument was added to upgrade and downgrade option of
neutron-db-manage.
Reference commit: http://tinyurl.com/mzepbmq

migration environment's run_migration_offline/online() gets called
even for other neutron-db-manage options as well such as current,
history, stamp, branches etc. For those options since the argument
can not be set, it throws oslo.config.cfg.NoSuchOptError.
This fix tries to catch it and set the value accordingly.

Closes-bug: #1353180

Change-Id: I044daf04216ec61245ddb51689f8e50be5666e34
Predictable field and filter ordering

This fixes the fields and filters units tests that break with a
randomized PYTHONHASHSEED (see the bug report).

The RESOURCE_ATTRIBUTE_MAP is stored as a dict leading to an
unpredictable output order. Values in kvp strings are being stored as
sets underpinned by dicts when converted, leading to unpredictable
ordering of values when read.

Discovered with PYTHONHASHSEED = 2455351445 on these tests:
test_api_v2.APIv2TestCase.test_fields
test_api_v2.APIv2TestCase.test_fields_multiple
test_api_v2.FiltersTestCase.test_attr_info_with_convert_list_to
test_api_v2.APIv2TestCase.test_filters_with_fields
test_api_v2.APIv2TestCase.test_fields_multiple_with_empty

There are 3 parts to this fix:
1. Update the APIv2TestCase _do_field_list function to construct
field list in the same order as the controller constructs its list.
2. Ensure the APIv2TestCase _get_collection_kwargs maintains order
throughout.
3. Use new assertOrderedEqual function to sort values before assertion
in test_attr_info_with_convert_list_to

Change-Id: I547cfa80cf83b0340b459279df9283443562326b
Partial-bug: #1348818
MLNX Agent: ensure removed ports get treated on resyncs

This patch ensures that removed ports will be cleaned up properly if exception
occurs in the daemon_loop.
It does the same for the mlnx-agent as was done for the lb-agent in
Ieada34ad315c0c29aa8462ebf041a448fde007b8.

Refactoring the daemon_loop and scan_ports in a way that -
If there's an exception, the ports that were flagged for cleaning will
be retreated in the following iteration,
unlike previous exception handling, where only existing ports
were treated in the following iteration.

Closes-Bug: 1287648
Change-Id: I3af505773aa3fdc0d17f2079ac1f1b3e93bb64a3
Signed-off-by: Roey Chen <roeyc@mellanox.com>
NSX: fix wording for configuration option

This patch clarifies that in order to use NSX distributed
routers, the replication_mode parameter should be set to
'service'. This is already its default value, so no further
change is needed beyond clarifying wording.

Change-Id: I446c428ecf8c0bf7f6947e69562d60a7fb4383ed
Closes-Bug: #1355502
NSX: unify the two distributed routing extensions

This is done by adopting the router_extra_attributes
models. However, the NSX 'distributed' extension is
slightly different in that it is visible to tenants
and prevents router conversion (allow_put=false).

PUT requests are made return the correct HTTP code;
The access control misalignments will need to be
adjusted via rules in policy.json. This will be
properly documented.

DocImpact

Supports-blueprint: neutron-ovs-dvr

Change-Id: I35a4b54318d8169eb2c73be77ca2f30bbee08b46
add auth token to context

As discussed at
http://lists.openstack.org/pipermail/openstack-dev/2014-July/040644.html
SerivceVM project (and other routervm plugins) need auth token in context.
The first user will be l3 routervm plugin.

Closes-Bug: #1343854
Closes-Bug: #1352698
Change-Id: Id5a4c98059894eef33faf19d5ab063780b362f4a
Make plugin and l3plugin available as mixin's properties

This makes the code simpler and slightly more efficient.
This is a minor refactoring related to a race condition
observed when the agent is processing a router while its
interfaces are being removed.

Related-bug: #1355409

Change-Id: Ic0ce25aa6a977e28b1ab76081c74da4c46c2ca6b
Do not assume order of new_peers list elements

This fixes the vpn unit test that breaks with a randomized PYTHONHASHSEED
(see the bug report).

The test assumed that the new_peers list from self.new_update_request had
elements in a particular order. Found with PYTHONHASHSEED=2455351445.

The fix refactors the test case to handle an unsorted new_peers list by
sorting it before running the test.

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: I86e7f84cedbdc8e1d7404363a560fd759d264c49
Opencontrail plug-in implementation for core resources

Adds Opencontrail plug-in implementation with unit tests
This patch has no dependency on any other blueprints
The link below describes how to install VIF driver for opencontrail
https://github.com/Juniper/contrail-controller/wiki/
OpenContrail-bring-up-and-provisioning

- The contrail_plugin_core.py is the main interface for neutron common
  infrastructure. It relays API requests to the opencontrail controller

DocImpact
Change-Id: I501bf669b2a999a171f9a3ee3e9893d4ead50e3b
Implements: blueprint juniper-plugin-with-extensions
SecurityGroupRuleExists should point out rule id inseand of group id

When we get a SecurityGroupRuleExists, we want to get the rule id
instaed of group id, and this is what the fucntion
_check_for_duplicate_rules() does.

Change-Id: I9b526d9829582cb26bfda98bcaf1704fe8681cbe
Closes-bug:  #1354343
Raise exception for network delete with subnets presents

N1kv plugin should raise an exception during network delete
if there is a subnet that is tied to that network.

Changed the order of the Assert arguments since now it's encoraged to have <expected_value, actual_value> now.

Change-Id: I92f177af0e2a2fbc460e0d668989ce590b7d1cb2
Closes-Bug: 1336107
Fix 404 error fetching metadata when using DVR

The metadata agent was unable to find networks
attached to the DVR router because it was only
filtering ports for 'centralized' routers.

To fix the issue, this patch expands the search
filters to include DVR router interfaces during
the network lookup operation.

The extra filter cause no evident performance
loss while serving the request; a different
approach would require to pass the router type
around to narrow down the search filter, but it
sounds like an overkill.

Closes-bug: #1353271

Change-Id: Iefbefa1ff300adad48ab9fc472d5eb1913fbe488
Preserve link local IP allocations for DVR fip ns across restart

The L3 agent allocates link local address pairs used in connecting the
routers to the floating ip namespace.  When those allocations are
forgetten by restarting the L3 agent they all get rewired on restart.
This change preserves the allocations using a file in the local file
system.  Storing them in the database would be overkill and would
affect system performance.

Change-Id: I39614c7ea2a7dcc35bf969c90045adc5926ea9df
Closes-Bug: #1348306
Partially-Implements: blueprint neutron-ovs-dvr
Co-Authored-By: Rajeev Grover <rajeev.grover@hp.com>