1b29d6e837c6e88ad89d8eddde0212a4e5a961b0
[transportpce.git] / tox.ini
1 [tox]
2 minversion = 1.6
3 envlist = py3
4     docs
5     docs-linkcheck
6     checkbashisms
7 skipsdist = true
8 setupdir = tests/
9
10 [testenv]
11 passenv = USE_LIGHTY http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
12 usedevelop = True
13 basepython = python3
14 deps =
15   -r{toxinidir}/tests/requirements.txt
16   -r{toxinidir}/tests/test-requirements.txt
17 whitelist_externals = sh
18                       sudo
19 changedir={toxinidir}/tests
20 commands =
21 #install maven and JDK11 on the Gate since they are not there by default
22   {py3,portmapping,topoPortMapping,rspn,topology,pce,olm,end2end,portmapping221,rspn221,otnrenderer,otnshrenderer,topology221,otntopology,flexgrid,olm221,tapi221,otnend2end,end2end221,pce400g,gnpy}: - sh -c "which mvn >/dev/null || ./installMavenCentOS.sh"
23 #install honeynode 1.2.1 simulators
24   {py3,portmapping,topoPortMapping,rspn,topology,pce,olm,end2end}: - sh -c "./install_honeynode.sh 1.2.1"
25 #patch OLM constant to speed up tests, unnecessary for PCE
26   {py3,portmapping,topoPortMapping,rspn,topology,olm,end2end,portmapping221,rspn221,otnrenderer,otnshrenderer,topology221,otn-topology,olm221,otnend2end,end2end221,tapi221,nbinotifications}: - sh -c "sed -i'_' 's@=.*//#FUNCTESTVAL=@=@g' ../olm/src/main/java/org/opendaylight/transportpce/olm/util/OlmUtils.java"
27 #build controller, source JDK_JAVA_OPTIONS to remove illegal reflective acces warnings introduced by Java11
28   {py3,portmapping,topoPortMapping,rspn,topology,pce,olm,end2end,portmapping221,rspn221,otnrenderer,otnshrenderer,topology221,otntopology,flexgrid,olm221,tapi221,otnend2end,end2end221,pce400g,gnpy,nbinotifications}: - sh -c ". $PWD/reflectwarn.sh && cd .. && mvn clean install -s tests/odl_settings.xml -DskipTests -Dmaven.javadoc.skip=true -Dodlparent.spotbugs.skip -Dodlparent.checkstyle.skip"
29   {py3,portmapping,topoPortMapping,rspn,topology,olm,end2end,portmapping221,rspn221,otnrenderer,otnshrenderer,topology221,otn-topology,olm221,otnend2end,end2end221,tapi221,nbinotifications}: - sh -c "mv  ../olm/src/main/java/org/opendaylight/transportpce/olm/util/OlmUtils.java_  ../olm/src/main/java/org/opendaylight/transportpce/olm/util/OlmUtils.java"
30 #patch Karaf exec for the same reason at runtime
31   {py3,portmapping,topoPortMapping,rspn,topology,pce,olm,end2end,portmapping221,rspn221,otnrenderer,otnshrenderer,topology221,otntopology,flexgrid,olm221,tapi221,otnend2end,end2end221,pce400g,gnpy,nbinotifications}: - sh -c "sed -i'_' 's@!/bin/sh@!/bin/sh\'$'\n. $(dirname $0)/../../../../tests/reflectwarn.sh@' ../karaf/target/assembly/bin/karaf"
32   # the following command would be the straight and right way to support both BSD and GNU sed versions
33   # sh -c "sed -i'_' '1 a\'$'\n. \$(dirname \$0)/\.\./\.\./\.\./\.\./tests/reflectwarn.sh\n' ../karaf/target/assembly/bin/karaf"
34   # but tox reinterprets the quotes as
35   #¬†sh -c 'sed -i'"'"'_'"'"' '"'"'1 a\'"'"'$'"'"'\n. \$(dirname \$0)/\.\./\.\./\.\./\.\./tests/reflectwarn.sh\n'"'"' ../karaf/target/assembly/bin/karaf'
36   # ,what results in an unexpected different formating (with a $ on the second line and the dot on the third)
37 #build Lighty if needed
38   {py3,portmapping,topoPortMapping,rspn,topology,pce,olm,end2end,portmapping221,rspn221,otnrenderer,otnshrenderer,topology221,otntopology,olm221,tapi221,otnend2end,end2end221,pce400g,gnpy,nbinotifications}: - sh -c 'if [ "$USE_LIGHTY" = "True" ]; then (cd ../lighty && ./build.sh); fi'
39 #run 1.2.1 functional tests
40   {py3,portmapping}: nosetests --with-xunit transportpce_tests/1.2.1/test_portmapping.py
41   {py3,topoPortMapping}: nosetests --with-xunit transportpce_tests/1.2.1/test_topo_portmapping.py
42   {py3,topology}: nosetests --with-xunit transportpce_tests/1.2.1/test_topology.py
43   {py3,rspn}: nosetests --with-xunit transportpce_tests/1.2.1/test_renderer_service_path_nominal.py
44   {py3,pce}: nosetests --with-xunit transportpce_tests/1.2.1/test_pce.py
45   {py3,olm}: nosetests --with-xunit transportpce_tests/1.2.1/test_olm.py
46   #E2E 1.2.1 moved at the end before 2.2.1 E2E
47 #run 2.2.1 functional tests
48 #install honeynode 2.2.1 simulators
49   {py3,portmapping221,rspn221,otnrenderer,otnshrenderer,topology221,otntopology,flexgrid,olm221,tapi221,otnend2end,end2end221,nbinotifications}: - sh -c "./install_honeynode.sh 2.2.1"
50   {py3,portmapping221}: nosetests --with-xunit transportpce_tests/2.2.1/test_portmapping.py
51   {py3,topology221}: nosetests --with-xunit transportpce_tests/2.2.1/test_topology.py
52   {py3,otntopology}: nosetests --with-xunit transportpce_tests/2.2.1/test_otn_topology.py
53   {py3,flexgrid}: nosetests --with-xunit transportpce_tests/2.2.1/test_flex_grid.py
54   {py3,rspn221}: nosetests --with-xunit transportpce_tests/2.2.1/test_renderer_service_path_nominal.py
55   {py3,otnrenderer}: nosetests --with-xunit transportpce_tests/2.2.1/test_otn_renderer.py
56   {py3,otnshrenderer}: nosetests --with-xunit transportpce_tests/2.2.1/test_otn_sh_renderer.py
57   {py3,olm221}: nosetests --with-xunit transportpce_tests/2.2.1/test_olm.py
58   {py3,tapi221}: nosetests --with-xunit transportpce_tests/2.2.1/test_tapi.py
59   {py3,otnend2end}: nosetests --with-xunit transportpce_tests/2.2.1/test_otn_end2end.py
60 #run 7.1 functional tests
61   {py3,pce400g}: nosetests --with-xunit transportpce_tests/7.1/test_pce_400G.py
62   {py3,end2end}: nosetests --with-xunit transportpce_tests/1.2.1/test_end2end.py
63   {py3,end2end221}: nosetests --with-xunit transportpce_tests/2.2.1/test_end2end.py
64   #{gnpy}: - sudo docker pull atriki/gnpyrest:v1.2
65   {gnpy}: - sudo docker run -d -p 8008:5000 --name gnpy_tpce_rest1 atriki/gnpyrest:v1.2
66   {gnpy}: nosetests --with-xunit transportpce_tests/1.2.1/test_gnpy.py
67   {gnpy}: - sudo docker container rm -f gnpy_tpce_rest1
68   {nbinotifications}: - sudo docker-compose -f ./nbinotifications/docker-compose.yml up -d
69   {nbinotifications}: nosetests --with-xunit transportpce_tests/2.2.1/test_nbinotifications.py
70   {nbinotifications}: - sudo docker-compose -f ./nbinotifications/docker-compose.yml down --rmi all
71
72 [testenv:docs]
73 passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
74 basepython = python3
75 deps = -rdocs/requirements.txt
76 commands =
77     sphinx-build -W -b html -n -d {envtmpdir}/doctrees ../docs/ {toxinidir}/docs/_build/html
78
79 [testenv:docs-linkcheck]
80 passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
81 basepython = python3
82 deps = -rdocs/requirements.txt
83 commands = sphinx-build -b linkcheck -d {envtmpdir}/doctrees ../docs/ {toxinidir}/docs/_build/linkcheck
84
85 [testenv:checkbashisms]
86 deps =
87 whitelist_externals = sh
88                       checkbashisms
89                       sudo
90                       find
91 commands =
92     sh -c 'command checkbashisms>/dev/null || sudo yum install devscripts-minimal || (echo "checkbashisms command not found - please install it (e.g. sudo apt-get install devscripts | yum install devscripts-minimal )" >&2 && exit 1)'
93     find . -not -path '*/\.*' -name *.sh -exec checkbashisms -f  \{\} +
94
95 [testenv:spelling]
96 basepython = python3
97 deps =
98     -rdocs/requirements.txt
99     sphinxcontrib-spelling
100     PyEnchant
101 commands = sphinx-build -b spelling  -d {envtmpdir}/doctrees ../docs/ {toxinidir}/docs/_build/spelling
102
103 [testenv:autopep8]
104 basepython = python3
105 deps = autopep8
106 commands =
107     autopep8 --max-line-length 120 --in-place --recursive transportpce_tests/
108
109 [testenv:pylint]
110 basepython = python3
111 deps = pylint
112 whitelist_externals = find
113 commands =
114     find transportpce_tests/ -name *.py -exec pylint --max-line-length=120 --disable=missing-docstring --method-rgx="(([a-z_][a-zA-Z0-9_]{2,})|(_[a-z0-9_]*)|(__[a-zA-Z][a-zA-Z0-9_]+__))$" --variable-rgx="[a-zA-Z_][a-zA-Z0-9_]{1,30}$" --reports=y --score=y  --output-format=colorized  \{\} +
115
116 [testenv:pyang]
117 basepython = python3
118 deps = pyang
119 whitelist_externals = find
120 commands =
121     pyang --version
122     find ../api/ -name target -prune -o -name *.yang -exec pyang --lint --canonical --max-line-length=120 -p../api/src/main/yang/:../ordmodels/common/src/main/yang/:../ordmodels/service/src/main/yang/:../tapimodels/src/main/yang/ \{\} +
123 #find ../api/ ../ordmodels/ ../tapimodels/ -name target -prune -o -name *.yang -exec pyang --lint --canonical --max-line-length=120 -p../api/src/main/yang/:../ordmodels/common/src/main/yang/:../ordmodels/service/src/main/yang/:../tapimodels/src/main/yang/ \{\} +
124
125 [testenv:pyangformat]
126 basepython = python3
127 deps = pyang
128 whitelist_externals = sh
129 commands =
130     pyang --version
131     sh -c 'find ../api/ -name target -prune -o -name *.yang -print | while read -r fname; do pyang -f yang --yang-canonical --yang-remove-unused-imports --max-line-length=120 --keep-comments -p../api/src/main/yang/:../ordmodels/common/src/main/yang/:../ordmodels/service/src/main/yang/:../tapimodels/src/main/yang/ "$fname"  -o /tmp/tmpfile.$$ && mv /tmp/tmpfile.$$ "$fname";done'