run_tests.sh OS X script fixes

On OS X, '*' is not a valid grep modified for '[^[:space:]:]', nor is it
necessary when the lines being checked against must be prefixed with
neutron.tests.
Also, dirname was being called with an empty var, without quoting, resulting
in usage errors.

Closes-Bug: 1391858

Change-Id: I34ab0625a00809f68b7a44cb3a175a57ba0bd6d5
Strip square brackets from IPv6 addresses

When releasing old DHCP leases, square brackets around IPv6 addresses
should be stripped while reading dnsmasq hosts file.

Change-Id: Ia1e6d3a3cba30c94a1faa157d1d83da7beb523c4
Closes-bug: #1398380
radvd: pass -m syslog to avoid thread lock for radvd 2.0+

Since radvd 2.0, the daemon does not use daemon_fork() function from
libdaemon, but instead calls Linux daemon() function directly. It also
passes (1, 1) arguments when logging method (-m) is either stderr (the
default) or stderr_syslog. The second argument's value = 1 means that
stderr is not closed and left there for (some) log messages.

For neutron, it means that corresponding execute() call that spawns
radvd and expects the invoked process to close stderr does not ever get
completed. The current thread that spawned radvd is locked waiting for
radvd to exit, which does not ever occur unless the process crashes or
receives a signal.

Since L3 agent gives exclusive access to updates queue for each router
to one of processing threads only, it means that the thread that got to
serve a radvd-powered subnet will not proceed and not update any new
ports or other changes to the router anymore.

Passing -m syslog makes radvd 2.0+ close stderr and return to execute()
caller, proceeding with router update processing. The same arguments
should work for old (pre 2.0) versions of radvd too, so passing them
unconditionally.

We could instead use -m logfile and pass appropriate -l <logfile>
argument to radvd to make it log to a log file located in router's
namespace storage path. Though that would be not in line with what
dnsmasq processes currently do for dhcp agent, where we log all messages
to syslog, so sticking to syslog for radvd for consistency.

Change-Id: I131db0639bc46d332ed48faa2bbe68a214264062
Closes-Bug: #1398779
Reduce code duplication in test_linux_dhcp

This patch reduces duplication in test_output_opts_file_*()

Change-Id: Ie68b26a48c1d0ed9cb8e584a7284c06688937cf9
Closes-Bug: #1352870
Enforce log hints

This change enforces log hints use and removes debug level log
translation, modifications are validated through a hacking rule
and the change respects logging guidelines.

Change-Id: Ia4e6659b8b59732d88cd603b0e6c630fad37aae5
Closes-bug: #1320867
Fix IPv6 RA security group rule for DVR

Current IPv6 RA security group rule doesn't work for
DVR because the code only allows RA from device_owner
is network:router_interface. When DVR is enabled, the
router interface is network:router_interface_distributed.

This fix fixes the RA rule to allow RA from DVR router
interface, so router advertisement from DVR RADVD can
pass to VM.

Co-Authored-By: Baodong (Robert) Li <baoli@cisco.com>

Change-Id: Idd1324c653dcb15f5dacf2d897a7048bca22fc38
Partial-Bug: 1376325
Switch to using subunit-trace from tempest-lib

This commit removes the local copy of subunit-trace and instead uses
the version packaged with tempest-lib.

Change-Id: Ia7b57c6fc092514d9fbe4e71f580a4b189dc68b0
Refactor process_router method in L3 agent

Refactors the process_router method of the L3NATAgent class to several methods
that coherently group functionallity. The aim is to make the code more readable
and maintainable. There is no functional change in this patch.

Partially-Implements: bp restructure-l3-agent

Change-Id: Id35a5f10cd7d2dda565bffb14fc6a2fbd7eef3ea
Fix race condition in ProcessMonitor

If any new external process was enabled/disabled during
the process monitoring loop time, a RuntimeError: dictionary
changed size during iteration was thrown. This is fixed
by pre-building the service list from the dictionary
for the iteration.

Closes-Bug: #1401042

Change-Id: Id0a3af22fb85992bde35d8c691bee3ddf435639d
Remove broad exception catch from periodic_sync_routers_task

Although this change removes a broad exception from
periodic_sync_routers_task (neutron.agent.l3_agent), the
implementation still ensures if an exception --caught or uncaught --
prevents a call to the method to disable the fullsync, then the next
call to the method will perform a fullsync again.

Author:         Cedric Brandily <zzelle@gmail.com>
Co-Authored-By: Carl Baldwin <carl.baldwin@hp.com>

Change-Id: I6281886f3334100a18952578250c8154a0ed15a9
Not nova but neutron

The docstring for topic is not correct.

Change-Id: I6174453eb1c41c398ecffbab59c45b0678637672
Migrate to oslo.context

That's just a matter of adding requirements.txt entry, fixing imports,
and dropping the corresponding oslo-incubator module from the tree.

While at it, made all imports to import the module into 'oslo_context' and
not just 'context', so that we don't override the module locally in
multiple methods that receive their context arguments with the same
name, making the library inaccessible from inside those methods.

Change-Id: Ie62af970b3b7f225de453e56c01abc4b12af8f5e
Closes-Bug: #1401054
Catch duplicate errors scheduling SNAT service

Catch DBDuplicateEntry errors when scheduling SNAT to
a service node to prevent harmless tracebacks in the log.
These can occur if scheduling occurs concurrently,
so they are safe to ignore.

Closes-Bug: #1381958
Change-Id: If242b04b372609f640f3ce88f4245c17a45bf69d
Mock up time.sleep to avoid unnecessary wait in test_ovs_tunnel

Unnecessary wait in ovs tunnel UT introduces extra 6 seconds time cost,
and makes 3 test_daemon_loop cases the slowest tests. Mock up time.sleep
to reduce UT time, from around 6.272s to 0.135s.

Closes-bug: #1401457

Change-Id: Ic0a968a400268af1f66c91e4c39e7d3acf492ef3
Imported Translations from Transifex

For more information about this automatic import see:
https://wiki.openstack.org/wiki/Translations/Infrastructure

Change-Id: I18f00383ecae68436a9208f094a898849bfed8a2
Separate wait_until to standalone function

It makes wait_until more usable outside of unittest.TestCase classes.
Part of this patch is renaming pinger module to helpers thus we can have
helpers module with useful utilities for testing.

Change-Id: Ie8e4854c23aa3739b0df618db1b3944466d64bd2
Related-Bug: 1243216
Don't restore stopped mock that is initialized in setUp()

Since this mock will be reinitialized for consequent test cases when
calling setUp(), it's not needed to restart it in the case.

Change-Id: Ib120bf09d24dccc0b09fae906dae05c69efe734a
Merge "Catch duplicate errors scheduling SNAT service"
Generate testr_results.html for neutron functional job

Tweak job post_test_hook script to generate testr results
the same way other jobs do, with a pretty html view that
is easy to digest and navigate.

Closes-bug: #1401340

Change-Id: Ib355f34917580b88bda3d550e33fc630a8e7120b
Merge "Fix IPv6 RA security group rule for DVR"