diff --git a/bindep.txt b/bindep.txt index c7e45e95..11673d17 100644 --- a/bindep.txt +++ b/bindep.txt @@ -3,3 +3,4 @@ openvswitch [platform:rpm test] openvswitch-switch [platform:dpkg test] +curl [test] diff --git a/ovsdbapp/native/helpers.py b/ovsdbapp/native/helpers.py index 08631ba3..c1fe3f45 100644 --- a/ovsdbapp/native/helpers.py +++ b/ovsdbapp/native/helpers.py @@ -27,6 +27,8 @@ def _connection_to_manager_uri(conn_uri): return 'p%s:%s' % (proto, addr) +# TODO(jlibosva): Get rid of this runtime configuration and raise a message to +# set Manager outside of ovsdbapp. def enable_connection_uri(conn_uri, execute=None, **kwargs): timeout = kwargs.get('timeout', 5) probe = timeout if kwargs.get('set_timeout') else None diff --git a/releasenotes/notes/configure-ovsdb-manager-a29a148b241a125e.yaml b/releasenotes/notes/configure-ovsdb-manager-a29a148b241a125e.yaml new file mode 100644 index 00000000..5e9bb23f --- /dev/null +++ b/releasenotes/notes/configure-ovsdb-manager-a29a148b241a125e.yaml @@ -0,0 +1,7 @@ +--- +other: + - | + ovsdbapp must get granted access to ovsdb by adding a new Manager via ovs-vsctl + command. The command must be executed with root privileges. An example of how to + create a new manager for localhost on port 6640 is as follows: + `sudo ovs-vsctl --id=@manager -- create Manager target=\"ptcp:6640:127.0.0.1\" -- add Open_vSwitch . manager_options @manager' diff --git a/tools/test-setup.sh b/tools/test-setup.sh new file mode 100755 index 00000000..fbb539df --- /dev/null +++ b/tools/test-setup.sh @@ -0,0 +1,7 @@ +#!/bin/bash -xe + +# This script is triggered by extra-test-setup macro from project-config +# repository. + +# Set manager for native interface +sudo ovs-vsctl --timeout=10 --id=@manager -- create Manager target=\"ptcp:6640:127.0.0.1\" -- add Open_vSwitch . manager_options @manager diff --git a/tools/tox_install.sh b/tools/tox_install.sh new file mode 100755 index 00000000..5baa4366 --- /dev/null +++ b/tools/tox_install.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +# Client constraint file contains this client version pin that is in conflict +# with installing the client from source. We should remove the version pin in +# the constraints file before applying it for from-source installation. + +CONSTRAINTS_FILE=$1 +shift 1 + +set -e + +# NOTE(tonyb): Place this in the tox enviroment's log dir so it will get +# published to logs.openstack.org for easy debugging. +localfile="$VIRTUAL_ENV/log/upper-constraints.txt" + +if [[ $CONSTRAINTS_FILE != http* ]]; then + CONSTRAINTS_FILE=file://$CONSTRAINTS_FILE +fi + +curl $CONSTRAINTS_FILE --insecure --progress-bar --output $localfile + +pip install -c$localfile openstack-requirements + +# This is the main purpose of the script: Allow local installation of +# the current repo. It is listed in constraints file and thus any +# install will be constrained and we need to unconstrain it. +edit-constraints $localfile -- $CLIENT_NAME + +pip install -c$localfile -U $* +exit $? diff --git a/tox.ini b/tox.ini index a32150d4..dfed0a59 100644 --- a/tox.ini +++ b/tox.ini @@ -5,11 +5,12 @@ skipsdist = True [testenv] usedevelop = True -install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages} setenv = VIRTUAL_ENV={envdir} PYTHONWARNINGS=default::DeprecationWarning OS_TEST_PATH=./ovsdbapp/tests/unit + CLIENT_NAME=ovsdbapp +install_command = {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages} deps = -r{toxinidir}/test-requirements.txt commands = python setup.py testr --slowest --testr-args='{posargs}' @@ -33,7 +34,8 @@ commands = commands = oslo_debug_helper {posargs} [testenv:functional] -setenv = OS_TEST_PATH=./ovsdbapp/tests/functional +setenv = {[testenv]setenv} + OS_TEST_PATH=./ovsdbapp/tests/functional [flake8] # E123, E125 skipped as they are invalid PEP-8.