Add lightynode support to testutils.py
[transportpce.git] / tox.ini
1 [tox]
2 minversion = 3.7.0
3 envlist = buildcontroller
4      testsPCE
5      sims121
6      build_karaf_tests121
7      tests121
8      sims221
9      build_karaf_tests221
10      tests_tapi
11      tests221
12      sims71
13      build_karaf_tests71
14      tests71
15      build_karaf_tests_hybrid
16      tests_hybrid
17      buildlighty
18      docs
19      docs-linkcheck
20      checkbashisms
21      pre-commit
22      pylint
23 skipsdist = true
24 setupdir = tests/
25
26 [testenv]
27 passenv = LAUNCHER
28      USE_LIGHTY
29      USE_SIMS
30      NO_ODL_STARTUP
31      http_proxy
32      HTTP_PROXY
33      https_proxy
34      HTTPS_PROXY
35      no_proxy
36      NO_PROXY
37      OLM_TIMER1
38      OLM_TIMER2
39 setenv =
40 #    USE_LIGHTY=True,
41     OLM_TIMER1=3000
42     OLM_TIMER2=2000
43
44 usedevelop = true
45 basepython = python3
46 deps =
47   -r{toxinidir}/tests/requirements.txt
48   -r{toxinidir}/tests/test-requirements.txt
49   setuptools>=7.0
50 changedir = {toxinidir}/tests
51 parallel_show_output = true
52
53 [testenv:buildcontroller]
54 allowlist_externals = build_controller.sh
55 commands =
56   ./build_controller.sh
57
58 [testenv:buildlighty]
59 allowlist_externals = build.sh
60 depends = buildcontroller,tests_hybrid
61 changedir = {toxinidir}/lighty
62 commands =
63   ./build.sh
64
65 [testenv:sims121]
66 allowlist_externals = install_honeynode.sh
67 depends = buildcontroller
68 # sims profiles does not strictly depends on buildcontroller
69 # but this dependency avoids race condition in the gate
70 commands =
71   ./install_honeynode.sh 1.2.1
72
73 [testenv:sims221]
74 allowlist_externals = install_honeynode.sh
75 depends = buildcontroller
76 commands =
77   ./install_honeynode.sh 2.2.1
78
79 [testenv:sims71]
80 allowlist_externals = install_honeynode.sh
81 depends = buildcontroller
82 commands =
83   ./install_honeynode.sh 7.1
84
85 [testenv:testsPCE]
86 depends = buildcontroller
87 #the following lines retrieve unofficial package of GNPy with REST support from Orange opensource Gitlab repo
88 setenv =
89     PIP_EXTRA_INDEX_URL = https://gitlab.com/api/v4/projects/33090323/packages/pypi/simple
90 #    USE_LIGHTY=True
91 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
92 deps =
93   -r{toxinidir}/tests/requirements.txt
94   -r{toxinidir}/tests/test-requirements.txt
95   setuptools>=7.0
96   gnpy4tpce==2.4.7
97 allowlist_externals = launch_tests.sh
98 passenv = LAUNCHER
99     USE_LIGHTY
100     NO_ODL_STARTUP
101     USE_ODL_RESTCONF_VERSION
102 basepython = python3
103 commands =
104   ./launch_tests.sh pce {posargs:}
105
106 [testenv:build_karaf_tests121]
107 depends = buildcontroller
108 # testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
109 allowlist_externals = launch_tests.sh
110 passenv = USE_LIGHTY
111 setenv =
112 #    USE_LIGHTY=True
113     USE_ODL_ALT_KARAF_ENV=./karaf121.env
114     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf121
115 commands =
116   ./build_karaf_for_tests.sh
117
118 [testenv:tests121]
119 depends = buildcontroller,build_karaf_tests121,sims121,testsPCE
120 # testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
121 allowlist_externals = launch_tests.sh
122 passenv = LAUNCHER
123     USE_LIGHTY
124     USE_SIMS
125     USE_ODL_RESTCONF_VERSION
126 setenv =
127 #    USE_LIGHTY=True
128 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
129     USE_ODL_ALT_KARAF_ENV=./karaf121.env
130     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf121
131 commands =
132   ./launch_tests.sh 1.2.1 {posargs:}
133 # By default, all tests in the folder transportpce_tests/1.2.1/ are run.
134 # Though, a restricted list of tests can be passed as argument to 'tox -e tests121'.
135 # For example, 'tox -e tests121 portmapping' will run only the portmapping test.
136 # and 'tox -e tests121 "portmapping pce"' will run the portmapping and pce tests.
137 # Additionnally, a different launcher command than 'nosetests --with-xunit' can be
138 # used by exporting the variable LAUNCHER. For example 'export LAUNCHER="python3"'
139 # which is more verbose than nose or 'export LAUNCHER="ls -l"' to only list script
140 # files attributes.
141
142 [testenv:build_karaf_tests221]
143 depends = buildcontroller
144 # testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
145 allowlist_externals = launch_tests.sh
146 passenv = USE_LIGHTY
147 setenv =
148 #    USE_LIGHTY=True
149     USE_ODL_ALT_KARAF_ENV=./karaf221.env
150     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf221
151 commands =
152   ./build_karaf_for_tests.sh
153
154 [testenv:launch]
155 depends = buildcontroller,build_karaf_tests221,sims,tests71
156 # tests71 dependency is only here to chain tests in the gate and avoid ressources starvation
157 allowlist_externals = launch.sh
158 passenv = LAUNCHER
159     USE_LIGHTY
160     NO_ODL_STARTUP
161     USE_ODL_RESTCONF_VERSION
162 setenv =
163 #    USE_LIGHTY=True
164 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
165     USE_ODL_ALT_KARAF_ENV=./karaf221.env
166     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf221
167 commands =
168   ./launch.sh
169
170
171 [testenv:tests221]
172 depends = buildcontroller,build_karaf_tests221,sims221,tests71
173 # tests71 dependency is only here to chain tests in the gate and avoid ressources starvation
174 allowlist_externals = launch_tests.sh
175 passenv = LAUNCHER
176     USE_LIGHTY
177     USE_SIMS
178     NO_ODL_STARTUP
179     USE_ODL_RESTCONF_VERSION
180 setenv =
181 #    USE_LIGHTY=True
182 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
183     USE_ODL_ALT_KARAF_ENV=./karaf221.env
184     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf221
185 commands =
186   ./launch_tests.sh 2.2.1 {posargs:}
187
188 [testenv:build_karaf_tests71]
189 depends = buildcontroller
190 # testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
191 allowlist_externals = launch_tests.sh
192 passenv = USE_LIGHTY
193 setenv =
194 #    USE_LIGHTY=True
195     USE_ODL_ALT_KARAF_ENV=./karaf71.env
196     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf71
197 commands =
198   ./build_karaf_for_tests.sh
199
200 [testenv:tests71]
201 depends = buildcontroller,build_karaf_tests71,sims71,tests_tapi
202 allowlist_externals = launch_tests.sh
203 passenv = LAUNCHER
204     USE_LIGHTY
205     USE_SIMS
206     NO_ODL_STARTUP
207     USE_ODL_RESTCONF_VERSION
208 setenv =
209 #    USE_LIGHTY=True
210 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
211     USE_ODL_ALT_KARAF_ENV=./karaf71.env
212     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf71
213 commands =
214   ./launch_tests.sh 7.1 {posargs:}
215
216 [testenv:build_karaf_tests_hybrid]
217 depends = buildcontroller
218 allowlist_externals = launch_tests.sh
219 passenv = USE_LIGHTY
220 setenv =
221 #    USE_LIGHTY=True
222     USE_ODL_ALT_KARAF_ENV=./karaf121.env
223     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf_hybrid
224 commands =
225   ./build_karaf_for_tests.sh
226
227 [testenv:tests_hybrid]
228 depends = buildcontroller,build_karaf_tests_hybrid,sims121,sims221,sims71,tests121,tests221,tests71
229 #the last dependency is to avoid temporarily concurrent ressources problem in parallel mode
230 allowlist_externals = launch_tests.sh
231 passenv = LAUNCHER
232     USE_LIGHTY
233     USE_SIMS
234     NO_ODL_STARTUP
235     USE_ODL_RESTCONF_VERSION
236 setenv =
237 #    USE_LIGHTY=True
238 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
239     USE_ODL_ALT_KARAF_ENV=./karaf121.env
240     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf_hybrid
241 commands =
242 #  nosetests --with-xunit transportpce_tests/hybrid/test01_device_change_notifications.py
243   ./launch_tests.sh hybrid {posargs:}
244
245 [testenv:tests_tapi]
246 depends = buildcontroller,build_karaf_tests221,sims221
247 allowlist_externals = launch_tests.sh add_tapi_feature_to_tests221.sh
248 passenv = LAUNCHER
249     USE_LIGHTY
250     USE_SIMS
251     NO_ODL_STARTUP
252     OLM_TIMER1
253     OLM_TIMER2
254     USE_ODL_RESTCONF_VERSION
255 setenv =
256 #    USE_LIGHTY=True
257 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
258     USE_ODL_ALT_KARAF_ENV=./karaf221.env
259     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf221
260     INSTALL_TAPI=True
261     OLM_TIMER1=3000
262     OLM_TIMER2=2000
263
264 commands =
265 #  ./add_tapi_feature_to_tests221.sh
266 -  ./launch_tests.sh tapi {posargs:}
267
268 [testenv:with_docker]
269 depends = buildcontroller,sims221
270 allowlist_externals = launch_tests.sh
271                       dockercmd.sh
272 passenv = LAUNCHER
273     USE_LIGHTY
274     USE_SIMS
275     NO_ODL_STARTUP
276     USE_ODL_RESTCONF_VERSION
277 #    OLM_TIMER1
278 #    OLM_TIMER2
279 setenv =
280     OLM_TIMER1=3000
281     OLM_TIMER2=2000
282     INSTALL_TAPI=True
283     INSTALL_NBINOTIFICATIONS=True
284 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
285
286 commands =
287   ./dockercmd.sh run -d -p 2181:2181 -p 9092:9092 --env ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092 --name tpce_kafka1 teivah/kafka:2.0.0
288   ./launch_tests.sh with_docker {posargs:}
289   ./dockercmd.sh container rm -f tpce_kafka1
290
291 [testenv:docs]
292 passenv = http_proxy
293     HTTP_PROXY
294     https_proxy
295     HTTPS_PROXY
296     no_proxy
297     NO_PROXY
298 basepython = python3
299 deps = -rdocs/requirements.txt
300 commands =
301     sphinx-build -q -W --keep-going -b html -n -d {envtmpdir}/doctrees ../docs/ {toxinidir}/docs/_build/html
302
303 [testenv:docs-linkcheck]
304 passenv = http_proxy
305     HTTP_PROXY
306     https_proxy
307     HTTPS_PROXY
308     no_proxy
309     NO_PROXY
310 basepython = python3
311 deps = -rdocs/requirements.txt
312 commands = sphinx-build -q -b linkcheck -d {envtmpdir}/doctrees ../docs/ {toxinidir}/docs/_build/linkcheck
313
314 [testenv:checkbashisms]
315 deps =
316 allowlist_externals = sh
317                       checkbashisms
318                       sudo
319                       find
320 commands =
321     sh -c 'command checkbashisms>/dev/null || sudo yum install -y devscripts-checkbashisms || sudo yum install -y devscripts-minimal || sudo yum install -y devscripts \
322         || sudo yum install -y https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/31/Everything/x86_64/os/Packages/d/devscripts-checkbashisms-2.19.6-2.fc31.x86_64.rpm \
323         || (echo "checkbashisms command not found - please install it \
324              (e.g. sudo apt-get install devscripts | yum install devscripts-minimal )" >&2 && exit 1)'
325     find . -not -path '*/\.*' -name *.sh -exec checkbashisms -f  \{\} +
326
327 [testenv:spelling]
328 basepython = python3
329 deps =
330     -rdocs/requirements.txt
331     sphinxcontrib-spelling
332     PyEnchant
333 commands = sphinx-build -b spelling -d {envtmpdir}/doctrees ../docs/ {toxinidir}/docs/_build/spelling
334
335 [testenv:autopep8]
336 basepython = python3
337 deps = autopep8
338 commands =
339     autopep8 --max-line-length 120 --in-place --recursive transportpce_tests/
340
341 [testenv:pylint_full]
342 basepython = python3
343 deps = pylint>=2.6.0
344 allowlist_externals = find
345 commands =
346     find transportpce_tests/ -name *.py -exec pylint --fail-under=9.22 --max-line-length=120 --disable=missing-docstring --module-rgx="([a-z0-9_]+$)|([0-9.]{1,30}$)" --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  \{\} +
347
348 [testenv:pylint]
349 basepython = python3
350 deps = pylint>=2.6.0
351 allowlist_externals = find
352 commands =
353     find transportpce_tests/ -name *.py -exec pylint --fail-under=10 --max-line-length=120 --disable=missing-docstring,import-error --disable=fixme --disable=duplicate-code --module-rgx="([a-z0-9_]+$)|([0-9.]{1,30}$)" --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}$" \{\} +
354
355 [testenv:pyang]
356 basepython = python3
357 deps = pyang
358 allowlist_externals = find
359 commands =
360     pyang --version
361     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/ \{\} +
362 #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/ \{\} +
363
364 [testenv:pyangformat]
365 basepython = python3
366 deps = pyang
367 allowlist_externals = sh
368 commands =
369     pyang --version
370     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'
371
372 [testenv:pre-commit-install]
373 basepython = python3
374 deps = pre-commit
375 commands =
376     pre-commit install
377     pre-commit install --hook-type commit-msg
378
379 [testenv:pre-commit-uninstall]
380 basepython = python3
381 deps = pre-commit
382 commands =
383     pre-commit uninstall
384     pre-commit uninstall --hook-type commit-msg
385
386 [testenv:pre-commit-autoupdate]
387 basepython = python3
388 deps = pre-commit
389 commands =
390     pre-commit autoupdate
391
392 [testenv:pre-commit]
393 basepython = python3
394 deps = pre-commit
395 passenv = HOME
396 commands =
397     pre-commit run --all-files --show-diff-on-failure
398     pre-commit run gitlint-ci --hook-stage manual
399
400 [testenv:gitlint]
401 basepython = python3
402 deps = gitlint
403 commands =
404     gitlint --config ../.gitlint
405
406 [testenv:allure-report-init]
407 basepython = python3
408 deps = allure-pytest>=2.10.0
409 # allure is under Apache License 2.0
410 allowlist_externals =
411     mkdir
412     sed
413 commands =
414     mkdir -p allure-report
415     sed -i_ '$a\allure-pytest # Apache License 2.0' ./test-requirements.txt
416
417 [testenv:allure-report-serve]
418 basepython = python3
419 allowlist_externals =
420     allure
421 commands =
422     allure serve "allure-report"