Added constraints tox targets

These are eventually going to be used in gate instead of unconstrained
jobs. There is some code duplication in commands definitions, but tox
does not allow to inherit definitions with {posargs} substitution.

Made tox_install.sh use constraints file to install both the project and
neutron dependency, if the first argument is 'constrained'.

Note: To test the docs targets, needed to fix a formatting issue in
multiple-local-subnets.rst document.

Change-Id: I699022b285594edf3c5db10fbdac2f904dc42928
Partial-Bug: #1522503
Depends-On: Icfc50a0a9330dbc2a59f9bb27f09944bdf0e00d1
This commit is contained in:
Ihar Hrachyshka 2015-11-26 15:23:02 +01:00 committed by Paul Michali
parent fc6865a668
commit ef4476a992
3 changed files with 110 additions and 72 deletions

View File

@ -44,40 +44,42 @@ Client CLI API
--------------
The originally implemented client CLI APIs (which are still available
for backward compatibility) for an IPsec connection are:
| neutron vpn-service-create ROUTER SUBNET
| neutron ipsec-site-connection-create
| --vpnservice-id VPNSERVICE
| --ikepolicy-id IKEPOLICY
| --ipsecpolicy-id IPSECPOLICY
| --peer-address PEER_ADDRESS
| --peer-id PEER_ID
| --peer-cidr PEER_CIDRS
| --dpd action=ACTION,interval=INTERVAL,timeout=TIMEOUT
| --initiator {bi-directional | response-only}
| --mtu MTU
| --psk PSK
for backward compatibility) for an IPsec connection are::
neutron vpn-service-create ROUTER SUBNET
neutron ipsec-site-connection-create
--vpnservice-id VPNSERVICE
--ikepolicy-id IKEPOLICY
--ipsecpolicy-id IPSECPOLICY
--peer-address PEER_ADDRESS
--peer-id PEER_ID
--peer-cidr PEER_CIDRS
--dpd action=ACTION,interval=INTERVAL,timeout=TIMEOUT
--initiator {bi-directional | response-only}
--mtu MTU
--psk PSK
Changes to the API, to support multiple local subnets, are shown in
**bold** text:
| neutron vpn-service-create ROUTER
| **neutron vpn-endpoint-groups-create**
| **--name OPTIONAL-NAME**
| **--description OPTIONAL-DESCRIPTION**
| **--ep-type={subnet,cidr,network,vlan,router}**
| **--ep-value=[list-of-endpoints-of-type]**
| neutron ipsec-site-connection-create
| --vpnservice-id VPNSERVICE
| --ikepolicy-id IKEPOLICY
| --ipsecpolicy-id IPSECPOLICY
| --peer-address PEER_ADDRESS
| --peer-id PEER_ID
| --dpd action=ACTION,interval=INTERVAL,timeout=TIMEOUT
| --initiator {bi-directional | response-only}
| --mtu MTU
| --psk PSK
| **--local-endpoints ENDPOINT-GROUPS-UUID**
| **--peer-endpoints ENDPOINT-GROUPS-UUID**
**bold** text::
neutron vpn-service-create ROUTER
**neutron vpn-endpoint-groups-create**
**--name OPTIONAL-NAME**
**--description OPTIONAL-DESCRIPTION**
**--ep-type={subnet,cidr,network,vlan,router}**
**--ep-value=[list-of-endpoints-of-type]**
neutron ipsec-site-connection-create
--vpnservice-id VPNSERVICE
--ikepolicy-id IKEPOLICY
--ipsecpolicy-id IPSECPOLICY
--peer-address PEER_ADDRESS
--peer-id PEER_ID
--dpd action=ACTION,interval=INTERVAL,timeout=TIMEOUT
--initiator {bi-directional | response-only}
--mtu MTU
--psk PSK
**--local-endpoints ENDPOINT-GROUPS-UUID**
**--peer-endpoints ENDPOINT-GROUPS-UUID**
The SUBNET in the original service API is optional, and will be used as an
indicator of whether or not the multiple local subnets feature is active.
@ -110,46 +112,48 @@ Examples
--------
The original APIs to create one side of an IPSec connection with
only one local and peer subnet:
| neutron vpn-ikepolicy-create ikepolicy
| neutron vpn-ipsecpolicy-create ipsecpolicy
| neutron vpn-service-create --name myvpn router1 privateA
| neutron ipsec-site-connection-create
| --name vpnconnection1
| --vpnservice-id myvpn
| --ikepolicy-id ikepolicy
| --ipsecpolicy-id ipsecpolicy
| --peer-address 172.24.4.13
| --peer-id 172.24.4.13
| --peer-cidr 10.3.0.0/24
| --psk secret
only one local and peer subnet::
neutron vpn-ikepolicy-create ikepolicy
neutron vpn-ipsecpolicy-create ipsecpolicy
neutron vpn-service-create --name myvpn router1 privateA
neutron ipsec-site-connection-create
--name vpnconnection1
--vpnservice-id myvpn
--ikepolicy-id ikepolicy
--ipsecpolicy-id ipsecpolicy
--peer-address 172.24.4.13
--peer-id 172.24.4.13
--peer-cidr 10.3.0.0/24
--psk secret
The local CIDR is obtained from the subnet, privateA. In this example,
that would be 10.1.0.0/24 (because that's how privateA was created).
Using the multiple local subnet feature, the APIs (with changes shown
in **bold** below:
| neutron vpn-ikepolicy-create ikepolicy
| neutron vpn-ipsecpolicy-create ipsecpolicy
| neutron vpn-service-create --name myvpn router1
| **neutron vpn-endpoint-group-create**
| **--name local-eps**
| **--ep-type=subnet**
| **--ep-value=privateA**
| **--ep-value=privateB**
| **neutron vpn-endpoint-group-create**
| **--name peer-eps**
| **--ep-type=cidr**
| **--ep-vallue=10.3.0.0/24**
| neutron ipsec-site-connection-create
| --name vpnconnection1
| --vpnservice-id myvpn
| --ikepolicy-id ikepolicy
| --ipsecpolicy-id ipsecpolicy
| --peer-address 172.24.4.13
| --psk secret
| **--local-endpoints local-eps**
| **--peer-endpoints peer-eps**
in **bold** below::
neutron vpn-ikepolicy-create ikepolicy
neutron vpn-ipsecpolicy-create ipsecpolicy
neutron vpn-service-create --name myvpn router1
**neutron vpn-endpoint-group-create**
**--name local-eps**
**--ep-type=subnet**
**--ep-value=privateA**
**--ep-value=privateB**
**neutron vpn-endpoint-group-create**
**--name peer-eps**
**--ep-type=cidr**
**--ep-vallue=10.3.0.0/24**
neutron ipsec-site-connection-create
--name vpnconnection1
--vpnservice-id myvpn
--ikepolicy-id ikepolicy
--ipsecpolicy-id ipsecpolicy
--peer-address 172.24.4.13
--psk secret
**--local-endpoints local-eps**
**--peer-endpoints peer-eps**
The subnets privateA and privateB are used for local endpoints and the
10.3.0.0/24 CIDR is used for the peer endpoint.

View File

@ -23,9 +23,16 @@ NEUTRON_DIR=$HOME/neutron
set -e
install_cmd="pip install"
if [ "$1" = "constrained" ]; then
install_cmd="$install_cmd $2"
shift
fi
shift
if [ -d "$NEUTRON_DIR" ]; then
echo "FOUND Neutron code at $NEUTRON_DIR - using"
pip install -U -e $NEUTRON_DIR
$install_cmd -U -e $NEUTRON_DIR
elif [ $neutron_installed -eq 0 ]; then
location=$(python -c "import neutron; print(neutron.__file__)")
echo "ALREADY INSTALLED at $location"
@ -39,12 +46,12 @@ elif [ -x "$ZUUL_CLONER" ]; then
git://git.openstack.org \
openstack/neutron
cd openstack/neutron
pip install -e .
$install_cmd -e .
cd "$cwd"
else
echo "LOCAL - Obtaining Neutron code from git.openstack.org"
pip install -U -egit+https://git.openstack.org/openstack/neutron#egg=neutron
$install_cmd -U -egit+https://git.openstack.org/openstack/neutron#egg=neutron
fi
pip install -U $*
$install_cmd -U $*
exit $?

29
tox.ini
View File

@ -6,7 +6,9 @@ skipsdist = True
[testenv]
setenv = VIRTUAL_ENV={envdir}
usedevelop = True
install_command = {toxinidir}/tools/tox_install.sh {opts} {packages}
install_command =
constraints: {[testenv:common-constraints]install_command}
{toxinidir}/tools/tox_install.sh unconstrained {opts} {packages}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
whitelist_externals = sh
@ -15,6 +17,9 @@ commands =
# there is also secret magic in pretty_tox.sh which lets you run in a fail only
# mode. To do this define the TRACE_FAILONLY environmental variable.
[testenv:common-constraints]
install_command = {toxinidir}/tools/tox_install.sh constrained -c{env:UPPER_CONTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
[testenv:functional]
deps =
{[testenv]deps}
@ -66,6 +71,15 @@ commands =
neutron-db-manage --subproject neutron-vpnaas --database-connection sqlite:// check_migration
whitelist_externals = sh
[testenv:pep8-constraints]
install_command = {[testenv:common-constraints]install_command}
commands =
flake8
pylint --rcfile=.pylintrc --output-format=colorized {posargs:neutron_vpnaas}
{toxinidir}/tools/check_unit_test_structure.sh
neutron-db-manage --subproject neutron-vpnaas --database-connection sqlite:// check_migration
whitelist_externals = {[testenv:pep8]whitelist_externals}
[testenv:i18n]
commands = python ./tools/check_i18n.py ./neutron-vpnaas ./tools/i18n_cfg.py
@ -73,6 +87,11 @@ commands = python ./tools/check_i18n.py ./neutron-vpnaas ./tools/i18n_cfg.py
commands =
python setup.py test --coverage --coverage-package-name=neutron_vpnaas --testr-args='{posargs}'
[testenv:cover-constraints]
install_command = {[testenv:common-constraints]install_command}
commands =
python setup.py test --coverage --coverage-package-name=neutron_vpnaas --testr-args='{posargs}'
[testenv:dsvm-functional-cover]
setenv = {[testenv:dsvm-functional]setenv}
commands =
@ -86,9 +105,17 @@ commands =
[testenv:venv]
commands = {posargs}
[testenv:venv-constraints]
install_command = {[testenv:common-constraints]install_command}
commands = {posargs}
[testenv:docs]
commands = sphinx-build -W -b html doc/source doc/build
[testenv:docs-constraints]
install_command = {[testenv:common-constraints]install_command}
commands = {[testenv:docs]commands}
[flake8]
# E125 continuation line does not distinguish itself from next logical line
# E126 continuation line over-indented for hanging indent