Newer
Older
#######################################################################################
# Copyright ETSI Contributors and Others.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#######################################################################################
[tox]
envlist = black, cover, flake8, pylint, safety
[tox:jenkins]
toxworkdir = /tmp/.tox
setenv = VIRTUAL_ENV={envdir}
PYTHONDONTWRITEBYTECODE = 1
deps = -r{toxinidir}/requirements.txt
parallel_show_output = true
#######################################################################################
[testenv:release_notes]
deps = reno
skip_install = true
allowlist_externals = bash
bash -c "sed -i -e '1 e head -16 tox.ini' releasenotes/notes/{posargs:new_feature}*.yaml"
#######################################################################################
[testenv:black]
deps = black
skip_install = true
commands =
black --check --diff NG-RO
black --check --diff RO-plugin
black --check --diff RO-SDN-arista_cloudvision
black --check --diff RO-SDN-dpb
black --check --diff RO-SDN-dynpac
black --check --diff RO-SDN-floodlight_openflow
black --check --diff RO-SDN-ietfl2vpn
black --check --diff RO-SDN-juniper_contrail
black --check --diff RO-SDN-odl_openflow
black --check --diff RO-SDN-onos_openflow
black --check --diff RO-SDN-onos_vpls
black --check --diff RO-SDN-tapi
black --check --diff RO-VIM-aws
black --check --diff RO-VIM-azure
black --check --diff RO-VIM-openstack
black --check --diff RO-VIM-openvim
black --check --diff RO-VIM-vmware
black --check --diff RO-VIM-gcp
black --check --diff integration-tests
#######################################################################################
[testenv:cover]
deps = {[testenv]deps}
-r{toxinidir}/requirements-dev.txt
-r{toxinidir}/requirements-test.txt
skip_install = true
allowlist_externals = sh
commands =
sh -c 'rm -f nosetests.xml'
coverage erase
# NG-RO
nose2 -C --coverage NG-RO/osm_ng_ro -s NG-RO/osm_ng_ro
sh -c 'mv .coverage .coverage_ng_ro'
# RO-plugin
# nose2 -C --coverage RO-plugin/osm_ro_plugin -s RO-plugin/osm_ro_plugin
# sh -c 'mv .coverage .coverage_ro_plugin'
# nose2 -C --coverage RO-SDN-arista_cloudvision/osm_rosdn_arista_cloudvision -s RO-SDN-arista_cloudvision/osm_rosdn_arista_cloudvision
# sh -c 'mv .coverage .coverage_rosdn_arista_cloudvision'
# nose2 -C --coverage RO-SDN-dpb/osm_rosdn_dpb -s RO-SDN-dpb/osm_rosdn_dpb
# sh -c 'mv .coverage .coverage_rosdn_dpb'
# nose2 -C --coverage RO-SDN-dynpac/osm_rosdn_dynpac -s RO-SDN-dynpac/osm_rosdn_dynpac
# sh -c 'mv .coverage .coverage_rosdn_dynpac'
# nose2 -C --coverage RO-SDN-floodlight_openflow/osm_rosdn_floodlightof -s RO-SDN-floodlight_openflow/osm_rosdn_floodlightof
# sh -c 'mv .coverage .coverage_rosdn_floodlightof'
# nose2 -C --coverage RO-SDN-ietfl2vpn/osm_rosdn_ietfl2vpn -s RO-SDN-ietfl2vpn/osm_rosdn_ietfl2vpn
# sh -c 'mv .coverage .coverage_rosdn_ietfl2vpn'
nose2 -C --coverage RO-SDN-juniper_contrail/osm_rosdn_juniper_contrail -s RO-SDN-juniper_contrail/osm_rosdn_juniper_contrail
sh -c 'mv .coverage .coverage_rosdn_juniper_contrail'
# nose2 -C --coverage RO-SDN-odl_openflow/osm_rosdn_odlof -s RO-SDN-odl_openflow/osm_rosdn_odlof
# sh -c 'mv .coverage .coverage_rosdn_odlof'
# nose2 -C --coverage RO-SDN-onos_openflow/osm_rosdn_onosof -s RO-SDN-onos_openflow/osm_rosdn_onosof
# sh -c 'mv .coverage .coverage_rosdn_onosof'
# nose2 -C --coverage RO-SDN-onos_vpls/osm_rosdn_onos_vpls -s RO-SDN-onos_vpls/osm_rosdn_onos_vpls
# sh -c 'mv .coverage .coverage_rosdn_onos_vpls'
# RO-SDN-tapi
nose2 -C --coverage RO-SDN-tapi/osm_rosdn_tapi -s RO-SDN-tapi/osm_rosdn_tapi
sh -c 'mv .coverage .coverage_rosdn_tapi'
# nose2 -C --coverage RO-VIM-aws/osm_rovim_aws -s RO-VIM-aws/osm_rovim_aws
# sh -c 'mv .coverage .coverage_rovim_aws'
# nose2 -C --coverage RO-VIM-azure/osm_rovim_azure -s RO-VIM-azure/osm_rovim_azure
# sh -c 'mv .coverage .coverage_rovim_azure'
nose2 -C --coverage RO-VIM-openstack/osm_rovim_openstack -s RO-VIM-openstack/osm_rovim_openstack
sh -c 'mv .coverage .coverage_rovim_openstack'
# nose2 -C --coverage RO-VIM-openvim/osm_rovim_openvim -s RO-VIM-openvim/osm_rovim_openvim
# sh -c 'mv .coverage .coverage_rovim_openvim'
# nose2 -C --coverage RO-VIM-vmware/osm_rovim_vmware -s RO-VIM-vmware/osm_rovim_vmware
# sh -c 'mv .coverage .coverage_rovim_vmware'
# nose2 -C --coverage RO-VIM-gcp/osm_rovim_gcp -s RO-VIM-gcp/osm_rovim_gcp
# sh -c 'mv .coverage .coverage_rovim_gcp'
# Combine results and generate reports
# coverage combine .coverage_ng_ro .coverage_ro_plugin .coverage_rosdn_arista_cloudvision .coverage_rosdn_dpb .coverage_rosdn_dynpac .coverage_rosdn_floodlightof .coverage_rosdn_ietfl2vpn .coverage_rosdn_juniper_contrail .coverage_rosdn_odlof .coverage_rosdn_onos_vpls .coverage_rosdn_onosof .coverage_rosdn_tapi .coverage_rovim_aws .coverage_rovim_azure .coverage_rovim_openvim .coverage_rovim_gcp # .coverage_rovim_openstack .coverage_rovim_vmware
coverage combine .coverage_ng_ro .coverage_rovim_openstack .coverage_rosdn_juniper_contrail
coverage report --omit='*tests*'
coverage html -d ./cover --omit='*tests*'
coverage xml -o coverage.xml --omit='*tests*'
#######################################################################################
[testenv:flake8]
flake8 NG-RO/osm_ng_ro/ NG-RO/setup.py
flake8 RO-plugin/osm_ro_plugin/ RO-plugin/setup.py
flake8 RO-SDN-arista_cloudvision/osm_rosdn_arista_cloudvision/ RO-SDN-arista_cloudvision/setup.py
flake8 RO-SDN-dpb/osm_rosdn_dpb/ RO-SDN-dpb/setup.py
flake8 RO-SDN-dynpac/osm_rosdn_dynpac/ RO-SDN-dynpac/setup.py
flake8 RO-SDN-floodlight_openflow/osm_rosdn_floodlightof/ RO-SDN-floodlight_openflow/setup.py
flake8 RO-SDN-ietfl2vpn/osm_rosdn_ietfl2vpn/ RO-SDN-ietfl2vpn/setup.py
flake8 RO-SDN-juniper_contrail/osm_rosdn_juniper_contrail/ RO-SDN-juniper_contrail/setup.py
flake8 RO-SDN-odl_openflow/osm_rosdn_odlof/ RO-SDN-odl_openflow/setup.py
flake8 RO-SDN-onos_openflow/osm_rosdn_onosof/ RO-SDN-onos_openflow/setup.py
flake8 RO-SDN-onos_vpls/osm_rosdn_onos_vpls/ RO-SDN-onos_vpls/setup.py
flake8 RO-SDN-tapi/osm_rosdn_tapi/ RO-SDN-tapi/setup.py
flake8 RO-VIM-aws/osm_rovim_aws/ RO-VIM-aws/setup.py
flake8 RO-VIM-azure/osm_rovim_azure/ RO-VIM-azure/setup.py
flake8 RO-VIM-openstack/osm_rovim_openstack/ RO-VIM-openstack/setup.py
flake8 RO-VIM-openvim/osm_rovim_openvim/ RO-VIM-openvim/setup.py
flake8 RO-VIM-vmware/osm_rovim_vmware/vimconn_vmware.py RO-VIM-vmware/osm_rovim_vmware/tests/test_vimconn_vmware.py RO-VIM-vmware/setup.py
flake8 RO-VIM-gcp/osm_rovim_gcp/ RO-VIM-gcp/setup.py
flake8 integration-tests/
#######################################################################################
[testenv:pylint]
deps = {[testenv]deps}
-r{toxinidir}/requirements-dev.txt
-r{toxinidir}/requirements-test.txt
pylint
skip_install = true
commands =
pylint -E NG-RO/osm_ng_ro --disable=E1101
pylint -E RO-plugin/osm_ro_plugin --disable=E1101
pylint -E RO-SDN-arista_cloudvision/osm_rosdn_arista_cloudvision --disable=all
pylint -E RO-SDN-dpb/osm_rosdn_dpb
pylint -E RO-SDN-dynpac/osm_rosdn_dynpac --disable=E1101
pylint -E RO-SDN-floodlight_openflow/osm_rosdn_floodlightof
pylint -E RO-SDN-ietfl2vpn/osm_rosdn_ietfl2vpn --disable=E1101
pylint -E RO-SDN-juniper_contrail/osm_rosdn_juniper_contrail
pylint -E RO-SDN-odl_openflow/osm_rosdn_odlof
pylint -E RO-SDN-onos_openflow/osm_rosdn_onosof
pylint -E RO-SDN-onos_vpls/osm_rosdn_onos_vpls --disable=E1101
pylint -E RO-SDN-tapi/osm_rosdn_tapi
pylint -E RO-VIM-aws/osm_rovim_aws
pylint -E RO-VIM-azure/osm_rovim_azure --disable=all
pylint -E RO-VIM-openstack/osm_rovim_openstack --disable=E1101
pylint -E RO-VIM-openvim/osm_rovim_openvim --disable=all
pylint -E RO-VIM-vmware/osm_rovim_vmware --disable=all
pylint -E RO-VIM-gcp/osm_rovim_gcp --disable=E1101
#######################################################################################
[testenv:safety]
setenv =
LC_ALL=C.UTF-8
LANG=C.UTF-8
deps = {[testenv]deps}
safety
skip_install = true
commands =
- safety check --full-report
#######################################################################################
[testenv:pip-compile]
skip_install = true
allowlist_externals = bash
- bash -c "for file in requirements*.in ; do \
UNSAFE="" ; \
if [[ $file =~ 'dist' ]] ; then UNSAFE='--allow-unsafe' ; fi ; \
pip-compile -rU --no-header $UNSAFE $file ;\
out=`echo $file | sed 's/.in/.txt/'` ; \
sed -i -e '1 e head -16 tox.ini' $out ;\
done"
- bash -c "sed -i 's/.*RO-plugin/-e RO-plugin/g' requirements-test.txt"
#######################################################################################
[testenv:dist_ng_ro]
deps = {[testenv]deps}
-r{toxinidir}/requirements-dist.txt
skip_install = true
allowlist_externals = sh
changedir = {toxinidir}/NG-RO
commands =
sh -c 'rm -rf osm_ng_ro/requirements.txt deb_dist dist osm_ng_ro.egg-info osm_ng_ro*.tar.gz'
sh -c 'cp ../requirements.txt osm_ng_ro/requirements.txt'
python3 setup.py --command-packages=stdeb.command sdist_dsc
sh -c 'cd deb_dist/osm-ng-ro*/ && dpkg-buildpackage -rfakeroot -uc -us'
#######################################################################################
[testenv:dist_ro_plugin]
deps = {[testenv]deps}
-r{toxinidir}/requirements-dist.txt
skip_install = true
allowlist_externals = sh
changedir = {toxinidir}/RO-plugin
commands =
sh -c 'rm -rf deb_dist dist osm_ro_plugin.egg-info osm_ro_plugin*.tar.gz'
python3 setup.py --command-packages=stdeb.command sdist_dsc
sh -c 'cd deb_dist/osm-ro-plugin*/ && dpkg-buildpackage -rfakeroot -uc -us'
#######################################################################################
[testenv:dist_ro_sdn_arista_cloudvision]
deps = {[testenv]deps}
-r{toxinidir}/requirements-dist.txt
skip_install = true
allowlist_externals = sh
changedir = {toxinidir}/RO-SDN-arista_cloudvision
commands =
sh -c 'rm -rf deb_dist dist osm_rosdn_arista_cloudvision.egg-info osm_rosdn_arista_cloudvision*.tar.gz'
python3 setup.py --command-packages=stdeb.command sdist_dsc
sh -c 'cd deb_dist/osm-rosdn-arista-cloudvision*/ && dpkg-buildpackage -rfakeroot -uc -us'
#######################################################################################
[testenv:dist_ro_sdn_dpb]
deps = {[testenv]deps}
-r{toxinidir}/requirements-dist.txt
skip_install = true
allowlist_externals = sh
changedir = {toxinidir}/RO-SDN-dpb
commands =
sh -c 'rm -rf deb_dist dist osm_rosdn_dpb.egg-info osm_rosdn_dpb*.tar.gz'
python3 setup.py --command-packages=stdeb.command sdist_dsc
sh -c 'cd deb_dist/osm-rosdn-dpb*/ && dpkg-buildpackage -rfakeroot -uc -us'
#######################################################################################
[testenv:dist_ro_sdn_dynpac]
deps = {[testenv]deps}
-r{toxinidir}/requirements-dist.txt
skip_install = true
allowlist_externals = sh
changedir = {toxinidir}/RO-SDN-dynpac
commands =
sh -c 'rm -rf deb_dist dist osm_rosdn_dynpac.egg-info osm_rosdn_dynpac*.tar.gz'
python3 setup.py --command-packages=stdeb.command sdist_dsc
sh -c 'cd deb_dist/osm-rosdn-dynpac*/ && dpkg-buildpackage -rfakeroot -uc -us'
#######################################################################################
[testenv:dist_ro_sdn_floodlight_of]
deps = {[testenv]deps}
-r{toxinidir}/requirements-dist.txt
skip_install = true
allowlist_externals = sh
changedir = {toxinidir}/RO-SDN-floodlight_openflow
commands =
sh -c 'rm -rf deb_dist dist osm_rosdn_floodlightof.egg-info osm_rosdn_floodlightof*.tar.gz'
python3 setup.py --command-packages=stdeb.command sdist_dsc
sh -c 'cd deb_dist/osm-rosdn-floodlightof*/ && dpkg-buildpackage -rfakeroot -uc -us'
#######################################################################################
[testenv:dist_ro_sdn_ietfl2vpn]
deps = {[testenv]deps}
-r{toxinidir}/requirements-dist.txt
skip_install = true
allowlist_externals = sh
changedir = {toxinidir}/RO-SDN-ietfl2vpn
commands =
sh -c 'rm -rf deb_dist dist osm_rosdn_ietfl2vpn.egg-info osm_rosdn_ietfl2vpn*.tar.gz'
python3 setup.py --command-packages=stdeb.command sdist_dsc
sh -c 'cd deb_dist/osm-rosdn-ietfl2vpn*/ && dpkg-buildpackage -rfakeroot -uc -us'
#######################################################################################
[testenv:dist_ro_sdn_juniper_contrail]
deps = {[testenv]deps}
-r{toxinidir}/requirements-dist.txt
skip_install = true
allowlist_externals = sh
changedir = {toxinidir}/RO-SDN-juniper_contrail
commands =
sh -c 'rm -rf deb_dist dist osm_rosdn_juniper_contrail.egg-info osm_rosdn_juniper_contrail*.tar.gz'
python3 setup.py --command-packages=stdeb.command sdist_dsc
sh -c 'cd deb_dist/osm-rosdn-juniper-contrail*/ && dpkg-buildpackage -rfakeroot -uc -us'
#######################################################################################
[testenv:dist_ro_sdn_odl_of]
deps = {[testenv]deps}
-r{toxinidir}/requirements-dist.txt
skip_install = true
allowlist_externals = sh
changedir = {toxinidir}/RO-SDN-odl_openflow
commands =
sh -c 'rm -rf deb_dist dist osm_rosdn_odlof.egg-info osm_rosdn_odlof*.tar.gz'
python3 setup.py --command-packages=stdeb.command sdist_dsc
sh -c 'cd deb_dist/osm-rosdn-odlof*/ && dpkg-buildpackage -rfakeroot -uc -us'
#######################################################################################
[testenv:dist_ro_sdn_onos_of]
deps = {[testenv]deps}
-r{toxinidir}/requirements-dist.txt
skip_install = true
allowlist_externals = sh
changedir = {toxinidir}/RO-SDN-onos_openflow
commands =
sh -c 'rm -rf deb_dist dist osm_rosdn_onosof.egg-info osm_rosdn_onosof*.tar.gz'
python3 setup.py --command-packages=stdeb.command sdist_dsc
sh -c 'cd deb_dist/osm-rosdn-onosof*/ && dpkg-buildpackage -rfakeroot -uc -us'
#######################################################################################
[testenv:dist_ro_sdn_onos_vpls]
deps = {[testenv]deps}
-r{toxinidir}/requirements-dist.txt
skip_install = true
allowlist_externals = sh
changedir = {toxinidir}/RO-SDN-onos_vpls
commands =
sh -c 'rm -rf deb_dist dist osm_rosdn_onos_vpls.egg-info osm_rosdn_onos_vpls*.tar.gz'
python3 setup.py --command-packages=stdeb.command sdist_dsc
sh -c 'cd deb_dist/osm-rosdn-onos-vpls*/ && dpkg-buildpackage -rfakeroot -uc -us'
#######################################################################################
[testenv:dist_ro_sdn_tapi]
deps = {[testenv]deps}
-r{toxinidir}/requirements-dist.txt
skip_install = true
whitelist_externals = sh
changedir = {toxinidir}/RO-SDN-tapi
commands =
sh -c 'rm -rf deb_dist dist osm_rosdn_tapi.egg-info osm_rosdn_tapi*.tar.gz'
python3 setup.py --command-packages=stdeb.command sdist_dsc
sh -c 'cd deb_dist/osm-rosdn-tapi*/ && dpkg-buildpackage -rfakeroot -uc -us'
#######################################################################################
[testenv:dist_ro_vim_aws]
deps = {[testenv]deps}
-r{toxinidir}/requirements-dist.txt
skip_install = true
allowlist_externals = sh
changedir = {toxinidir}/RO-VIM-aws
commands =
sh -c 'rm -rf deb_dist dist osm_rovim_aws.egg-info osm_rovim_aws*.tar.gz'
python3 setup.py --command-packages=stdeb.command sdist_dsc
sh -c 'cd deb_dist/osm-rovim-aws*/ && dpkg-buildpackage -rfakeroot -uc -us'
#######################################################################################
[testenv:dist_ro_vim_azure]
deps = {[testenv]deps}
-r{toxinidir}/requirements-dist.txt
skip_install = true
allowlist_externals = sh
changedir = {toxinidir}/RO-VIM-azure
commands =
sh -c 'rm -rf deb_dist dist osm_rovim_azure.egg-info osm_rovim_azure*.tar.gz'
python3 setup.py --command-packages=stdeb.command sdist_dsc
sh -c 'cd deb_dist/osm-rovim-azure*/ && dpkg-buildpackage -rfakeroot -uc -us'
#######################################################################################
[testenv:dist_ro_vim_openstack]
deps = {[testenv]deps}
-r{toxinidir}/requirements-dist.txt
skip_install = true
allowlist_externals = sh
changedir = {toxinidir}/RO-VIM-openstack
commands =
sh -c 'rm -rf deb_dist dist osm_rovim_openstack.egg-info osm_rovim_openstack*.tar.gz'
python3 setup.py --command-packages=stdeb.command sdist_dsc
sh -c 'cd deb_dist/osm-rovim-openstack*/ && dpkg-buildpackage -rfakeroot -uc -us'
#######################################################################################
[testenv:dist_ro_vim_openvim]
deps = {[testenv]deps}
-r{toxinidir}/requirements-dist.txt
skip_install = true
allowlist_externals = sh
changedir = {toxinidir}/RO-VIM-openvim
commands =
sh -c 'rm -rf deb_dist dist osm_rovim_openvim.egg-info osm_rovim_openvim*.tar.gz'
python3 setup.py --command-packages=stdeb.command sdist_dsc
sh -c 'cd deb_dist/osm-rovim-openvim*/ && dpkg-buildpackage -rfakeroot -uc -us'
#######################################################################################
[testenv:dist_ro_vim_vmware]
deps = {[testenv]deps}
-r{toxinidir}/requirements-dist.txt
skip_install = true
allowlist_externals = sh
changedir = {toxinidir}/RO-VIM-vmware
commands =
sh -c 'rm -rf deb_dist dist osm_rovim_vmware.egg-info osm_rovim_vmware*.tar.gz'
python3 setup.py --command-packages=stdeb.command sdist_dsc
sh -c 'cd deb_dist/osm-rovim-vmware*/ && dpkg-buildpackage -rfakeroot -uc -us'
#######################################################################################
[testenv:dist_ro_vim_gcp]
deps = {[testenv]deps}
-r{toxinidir}/requirements-dist.txt
skip_install = true
allowlist_externals = sh
changedir = {toxinidir}/RO-VIM-gcp
commands =
sh -c 'rm -rf deb_dist dist osm_rovim_gcp.egg-info osm_rovim_gcp*.tar.gz'
python3 setup.py --command-packages=stdeb.command sdist_dsc
sh -c 'cd deb_dist/osm-rovim-gcp*/ && dpkg-buildpackage -rfakeroot -uc -us'
#######################################################################################
[flake8]
ignore =
W291,
W293,
W503,
W605,
E123,
E125,
E203,
E226,
exclude =
.git,
__pycache__,
.tox,
max-line-length = 120
show-source = True
builtins = _