blob: 7d0a3d2fd60904186016d923fb8d218579ab0ffe [file] [log] [blame]
sousaedu96abfc22021-02-18 14:57:01 +01001#######################################################################################
2# Copyright ETSI Contributors and Others.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13# implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#######################################################################################
17
18[tox]
sousaedu47b5bf02021-04-13 12:59:54 +020019envlist = black, flake8, pylint, safety
sousaedu96abfc22021-02-18 14:57:01 +010020
21[tox:jenkins]
22toxworkdir = /tmp/.tox
23
24[testenv]
25usedevelop = True
26basepython = python3
27setenv = VIRTUAL_ENV={envdir}
28 PYTHONDONTWRITEBYTECODE = 1
29deps = -r{toxinidir}/requirements.txt
30parallel_show_output = true
31
32
33#######################################################################################
sousaedu1077bbd2021-04-15 01:18:59 +020034[testenv:release_notes]
35deps = reno
36skip_install = true
37commands =
38 reno new {posargs:new_feature}
39
40
41#######################################################################################
sousaedu96abfc22021-02-18 14:57:01 +010042[testenv:black]
43deps = black
44skip_install = true
45commands =
46 - black --check --diff NG-RO
47 - black --check --diff RO-plugin
48 - black --check --diff RO-SDN-arista_cloudvision
49 - black --check --diff RO-SDN-dpb
50 - black --check --diff RO-SDN-dynpac
51 - black --check --diff RO-SDN-floodlight_openflow
52 - black --check --diff RO-SDN-ietfl2vpn
53 - black --check --diff RO-SDN-juniper_contrail
54 - black --check --diff RO-SDN-odl_openflow
55 - black --check --diff RO-SDN-onos_openflow
56 - black --check --diff RO-SDN-onos_vpls
57 - black --check --diff RO-VIM-aws
58 - black --check --diff RO-VIM-azure
59 - black --check --diff RO-VIM-fos
60 - black --check --diff RO-VIM-opennebula
61 - black --check --diff RO-VIM-openstack
62 - black --check --diff RO-VIM-openvim
63 - black --check --diff RO-VIM-vmware
64
65
66#######################################################################################
67[testenv:cover]
68deps = {[testenv]deps}
69 -r{toxinidir}/requirements-dev.txt
70 -r{toxinidir}/requirements-test.txt
71skip_install = true
72commands =
73 sh -c 'rm -f nosetests.xml'
74 coverage erase
75 # NG-RO
76 - nose2 -C --coverage NG-RO/osm_ng_ro
77 sh -c 'mv .coverage .coverage_ng_ro'
78 # RO-plugin
79 - nose2 -C --coverage RO-plugin/osm_ro_plugin
80 sh -c 'mv .coverage .coverage_ro_plugin'
81 # RO-SDN-arista_cloudvision
82 - nose2 -C --coverage RO-SDN-arista_cloudvision/osm_rosdn_arista_cloudvision
83 sh -c 'mv .coverage .coverage_rosdn_arista_cloudvision'
84 # RO-SDN-dpb
85 - nose2 -C --coverage RO-SDN-dpb/osm_rosdn_dpb
86 sh -c 'mv .coverage .coverage_rosdn_dpb'
87 # RO-SDN-dynpac
88 - nose2 -C --coverage RO-SDN-dynpac/osm_rosdn_dynpac
89 sh -c 'mv .coverage .coverage_rosdn_dynpac'
90 # RO-SDN-floodlight_openflow
91 - nose2 -C --coverage RO-SDN-floodlight_openflow/osm_rosdn_floodlightof
92 sh -c 'mv .coverage .coverage_rosdn_floodlightof'
93 # RO-SDN-ietfl2vpn
94 - nose2 -C --coverage RO-SDN-ietfl2vpn/osm_rosdn_ietfl2vpn
95 sh -c 'mv .coverage .coverage_rosdn_ietfl2vpn'
96 # RO-SDN-juniper_contrail
97 - nose2 -C --coverage RO-SDN-juniper_contrail/osm_rosdn_juniper_contrail
98 sh -c 'mv .coverage .coverage_rosdn_juniper_contrail'
99 # RO-SDN-odl_openflow
100 - nose2 -C --coverage RO-SDN-odl_openflow/osm_rosdn_odlof
101 sh -c 'mv .coverage .coverage_rosdn_odlof'
102 # RO-SDN-onos_openflow
103 - nose2 -C --coverage RO-SDN-onos_openflow/osm_rosdn_onosof
104 sh -c 'mv .coverage .coverage_rosdn_onosof'
105 # RO-SDN-onos_vpls
106 - nose2 -C --coverage RO-SDN-onos_vpls/osm_rosdn_onos_vpls
107 sh -c 'mv .coverage .coverage_rosdn_onos_vpls'
108 # RO-VIM-aws
109 - nose2 -C --coverage RO-VIM-aws/osm_rovim_aws
110 sh -c 'mv .coverage .coverage_rovim_aws'
111 # RO-VIM-azure
112 - nose2 -C --coverage RO-VIM-azure/osm_rovim_azure
113 sh -c 'mv .coverage .coverage_rovim_azure'
114 # RO-VIM-fos
115 - nose2 -C --coverage RO-VIM-fos/osm_rovim_fos
116 sh -c 'mv .coverage .coverage_rovim_fos'
117 # RO-VIM-opennebula
118 - nose2 -C --coverage RO-VIM-opennebula/osm_rovim_opennebula
119 sh -c 'mv .coverage .coverage_rovim_opennebula'
120 # RO-VIM-openstack
121 - nose2 -C --coverage RO-VIM-openstack/osm_rovim_openstack -s RO-VIM-openstack/osm_rovim_openstack
122 sh -c 'mv .coverage .coverage_rovim_openstack'
123 # RO-VIM-openvim
124 - nose2 -C --coverage RO-VIM-openvim/osm_rovim_openvim
125 sh -c 'mv .coverage .coverage_rovim_openvim'
126 # RO-VIM-vmware
127 - nose2 -C --coverage RO-VIM-vmware/osm_rovim_vmware -s RO-VIM-vmware/osm_rovim_vmware
128 sh -c 'mv .coverage .coverage_rovim_vmware'
129 # Combine results and generate reports
130 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_rovim_aws .coverage_rovim_azure .coverage_rovim_fos .coverage_rovim_opennebula .coverage_rovim_openstack .coverage_rovim_openvim .coverage_rovim_vmware
131 coverage report --omit='*tests*'
132 coverage html -d ./cover --omit='*tests*'
133 coverage xml -o coverage.xml --omit='*tests*'
134whitelist_externals = sh
135
136
137#######################################################################################
138[testenv:flake8]
139deps = flake8
140skip_install = true
141commands =
142 - flake8 NG-RO/osm_ng_ro/ NG-RO/setup.py
143 - flake8 RO-plugin/osm_ro_plugin/ RO-plugin/setup.py
144 - flake8 RO-SDN-arista_cloudvision/osm_rosdn_arista_cloudvision/ RO-SDN-arista_cloudvision/setup.py
145 - flake8 RO-SDN-dpb/osm_rosdn_dpb/ RO-SDN-dpb/setup.py
146 - flake8 RO-SDN-dynpac/osm_rosdn_dynpac/ RO-SDN-dynpac/setup.py
147 - flake8 RO-SDN-floodlight_openflow/osm_rosdn_floodlightof/ RO-SDN-floodlight_openflow/setup.py
148 - flake8 RO-SDN-ietfl2vpn/osm_rosdn_ietfl2vpn/ RO-SDN-ietfl2vpn/setup.py
149 - flake8 RO-SDN-juniper_contrail/osm_rosdn_juniper_contrail/ RO-SDN-juniper_contrail/setup.py
150 - flake8 RO-SDN-odl_openflow/osm_rosdn_odlof/ RO-SDN-odl_openflow/setup.py
151 - flake8 RO-SDN-onos_openflow/osm_rosdn_onosof/ RO-SDN-onos_openflow/setup.py
152 - flake8 RO-SDN-onos_vpls/osm_rosdn_onos_vpls/ RO-SDN-onos_vpls/setup.py
153 - flake8 RO-VIM-aws/osm_rovim_aws/ RO-VIM-aws/setup.py
154 - flake8 RO-VIM-azure/osm_rovim_azure/ RO-VIM-azure/setup.py
155 - flake8 RO-VIM-fos/osm_rovim_fos/ RO-VIM-fos/setup.py
156 - flake8 RO-VIM-opennebula/osm_rovim_opennebula/ RO-VIM-opennebula/setup.py
157 - flake8 RO-VIM-openstack/osm_rovim_openstack/ RO-VIM-openstack/setup.py
158 - flake8 RO-VIM-openvim/osm_rovim_openvim/ RO-VIM-openvim/setup.py
159 - 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
160
161
162#######################################################################################
163[testenv:pylint]
164deps = {[testenv]deps}
165 -r{toxinidir}/requirements-dev.txt
166 -r{toxinidir}/requirements-test.txt
167 pylint
168skip_install = true
169commands =
170 - pylint -E NG-RO/osm_ng_ro
171 - pylint -E RO-plugin/osm_ro_plugin
172 - pylint -E RO-SDN-arista_cloudvision/osm_rosdn_arista_cloudvision
173 - pylint -E RO-SDN-dpb/osm_rosdn_dpb
174 - pylint -E RO-SDN-dynpac/osm_rosdn_dynpac
175 - pylint -E RO-SDN-floodlight_openflow/osm_rosdn_floodlightof
176 - pylint -E RO-SDN-ietfl2vpn/osm_rosdn_ietfl2vpn
177 - pylint -E RO-SDN-juniper_contrail/osm_rosdn_juniper_contrail
178 - pylint -E RO-SDN-odl_openflow/osm_rosdn_odlof
179 - pylint -E RO-SDN-onos_openflow/osm_rosdn_onosof
180 - pylint -E RO-SDN-onos_vpls/osm_rosdn_onos_vpls
181 - pylint -E RO-VIM-aws/osm_rovim_aws
182 - pylint -E RO-VIM-azure/osm_rovim_azure
183 - pylint -E RO-VIM-fos/osm_rovim_fos
184 - pylint -E RO-VIM-opennebula/osm_rovim_opennebula
185 - pylint -E RO-VIM-openstack/osm_rovim_openstack
186 - pylint -E RO-VIM-openvim/osm_rovim_openvim
187 - pylint -E RO-VIM-vmware/osm_rovim_vmware
188
189
190#######################################################################################
191[testenv:safety]
192setenv =
193 LC_ALL=C.UTF-8
194 LANG=C.UTF-8
195deps = {[testenv]deps}
196 safety
197skip_install = true
198commands =
199 - safety check --full-report
200
201
202#######################################################################################
203[testenv:pip-compile]
204deps = pip-tools==5.5.0
sousaedubecd0832021-04-08 00:16:18 +0200205skip_install = true
sousaedu96abfc22021-02-18 14:57:01 +0100206commands =
sousaedubecd0832021-04-08 00:16:18 +0200207 - sh -c "for file in requirements*.in ; do pip-compile -rU --no-header $file ;\
208 out=`echo $file | sed 's/.in/.txt/'` ; \
209 sed -i -e '1 e head -16 tox.ini' $out ;\
210 done"
sousaedu96abfc22021-02-18 14:57:01 +0100211whitelist_externals = sh
212
213
214#######################################################################################
215[testenv:dist_ng_ro]
216deps = {[testenv]deps}
217 -r{toxinidir}/requirements-dist.txt
218skip_install = true
219changedir = {toxinidir}/NG-RO
220commands =
221 sh -c 'rm -rf osm_ng_ro/requirements.txt deb_dist dist osm_ng_ro.egg-info osm_ng_ro*.tar.gz'
222 sh -c 'cp ../requirements.txt osm_ng_ro/requirements.txt'
223 python3 setup.py --command-packages=stdeb.command sdist_dsc
224 sh -c 'cd deb_dist/osm-ng-ro*/ && dpkg-buildpackage -rfakeroot -uc -us'
225whitelist_externals = sh
226
227#######################################################################################
228[testenv:dist_ro_plugin]
229deps = {[testenv]deps}
230 -r{toxinidir}/requirements-dist.txt
231skip_install = true
232changedir = {toxinidir}/RO-plugin
233commands =
234 sh -c 'rm -rf deb_dist dist osm_ro_plugin.egg-info osm_ro_plugin*.tar.gz'
235 python3 setup.py --command-packages=stdeb.command sdist_dsc
236 sh -c 'cd deb_dist/osm-ro-plugin*/ && dpkg-buildpackage -rfakeroot -uc -us'
237whitelist_externals = sh
238
239#######################################################################################
240[testenv:dist_ro_sdn_arista_cloudvision]
241deps = {[testenv]deps}
242 -r{toxinidir}/requirements-dist.txt
243skip_install = true
244changedir = {toxinidir}/RO-SDN-arista_cloudvision
245commands =
246 sh -c 'rm -rf deb_dist dist osm_rosdn_arista_cloudvision.egg-info osm_rosdn_arista_cloudvision*.tar.gz'
247 python3 setup.py --command-packages=stdeb.command sdist_dsc
248 sh -c 'cd deb_dist/osm-rosdn-arista-cloudvision*/ && dpkg-buildpackage -rfakeroot -uc -us'
249whitelist_externals = sh
250
251#######################################################################################
252[testenv:dist_ro_sdn_dpb]
253deps = {[testenv]deps}
254 -r{toxinidir}/requirements-dist.txt
255skip_install = true
256changedir = {toxinidir}/RO-SDN-dpb
257commands =
258 sh -c 'rm -rf deb_dist dist osm_rosdn_dpb.egg-info osm_rosdn_dpb*.tar.gz'
259 python3 setup.py --command-packages=stdeb.command sdist_dsc
260 sh -c 'cd deb_dist/osm-rosdn-dpb*/ && dpkg-buildpackage -rfakeroot -uc -us'
261whitelist_externals = sh
262
263#######################################################################################
264[testenv:dist_ro_sdn_dynpac]
265deps = {[testenv]deps}
266 -r{toxinidir}/requirements-dist.txt
267skip_install = true
268changedir = {toxinidir}/RO-SDN-dynpac
269commands =
270 sh -c 'rm -rf deb_dist dist osm_rosdn_dynpac.egg-info osm_rosdn_dynpac*.tar.gz'
271 python3 setup.py --command-packages=stdeb.command sdist_dsc
272 sh -c 'cd deb_dist/osm-rosdn-dynpac*/ && dpkg-buildpackage -rfakeroot -uc -us'
273whitelist_externals = sh
274
275#######################################################################################
276[testenv:dist_ro_sdn_floodlight_of]
277deps = {[testenv]deps}
278 -r{toxinidir}/requirements-dist.txt
279skip_install = true
280changedir = {toxinidir}/RO-SDN-floodlight_openflow
281commands =
282 sh -c 'rm -rf deb_dist dist osm_rosdn_floodlightof.egg-info osm_rosdn_floodlightof*.tar.gz'
283 python3 setup.py --command-packages=stdeb.command sdist_dsc
284 sh -c 'cd deb_dist/osm-rosdn-floodlightof*/ && dpkg-buildpackage -rfakeroot -uc -us'
285whitelist_externals = sh
286
287#######################################################################################
288[testenv:dist_ro_sdn_ietfl2vpn]
289deps = {[testenv]deps}
290 -r{toxinidir}/requirements-dist.txt
291skip_install = true
292changedir = {toxinidir}/RO-SDN-ietfl2vpn
293commands =
294 sh -c 'rm -rf deb_dist dist osm_rosdn_ietfl2vpn.egg-info osm_rosdn_ietfl2vpn*.tar.gz'
295 python3 setup.py --command-packages=stdeb.command sdist_dsc
296 sh -c 'cd deb_dist/osm-rosdn-ietfl2vpn*/ && dpkg-buildpackage -rfakeroot -uc -us'
297whitelist_externals = sh
298
299#######################################################################################
300[testenv:dist_ro_sdn_juniper_contrail]
301deps = {[testenv]deps}
302 -r{toxinidir}/requirements-dist.txt
303skip_install = true
304changedir = {toxinidir}/RO-SDN-juniper_contrail
305commands =
306 sh -c 'rm -rf deb_dist dist osm_rosdn_juniper_contrail.egg-info osm_rosdn_juniper_contrail*.tar.gz'
307 python3 setup.py --command-packages=stdeb.command sdist_dsc
308 sh -c 'cd deb_dist/osm-rosdn-juniper-contrail*/ && dpkg-buildpackage -rfakeroot -uc -us'
309whitelist_externals = sh
310
311#######################################################################################
312[testenv:dist_ro_sdn_odl_of]
313deps = {[testenv]deps}
314 -r{toxinidir}/requirements-dist.txt
315skip_install = true
316changedir = {toxinidir}/RO-SDN-odl_openflow
317commands =
318 sh -c 'rm -rf deb_dist dist osm_rosdn_odlof.egg-info osm_rosdn_odlof*.tar.gz'
319 python3 setup.py --command-packages=stdeb.command sdist_dsc
320 sh -c 'cd deb_dist/osm-rosdn-odlof*/ && dpkg-buildpackage -rfakeroot -uc -us'
321whitelist_externals = sh
322
323#######################################################################################
324[testenv:dist_ro_sdn_onos_of]
325deps = {[testenv]deps}
326 -r{toxinidir}/requirements-dist.txt
327skip_install = true
328changedir = {toxinidir}/RO-SDN-onos_openflow
329commands =
330 sh -c 'rm -rf deb_dist dist osm_rosdn_onosof.egg-info osm_rosdn_onosof*.tar.gz'
331 python3 setup.py --command-packages=stdeb.command sdist_dsc
332 sh -c 'cd deb_dist/osm-rosdn-onosof*/ && dpkg-buildpackage -rfakeroot -uc -us'
333whitelist_externals = sh
334
335#######################################################################################
336[testenv:dist_ro_sdn_onos_vpls]
337deps = {[testenv]deps}
338 -r{toxinidir}/requirements-dist.txt
339skip_install = true
340changedir = {toxinidir}/RO-SDN-onos_vpls
341commands =
342 sh -c 'rm -rf deb_dist dist osm_rosdn_onos_vpls.egg-info osm_rosdn_onos_vpls*.tar.gz'
343 python3 setup.py --command-packages=stdeb.command sdist_dsc
344 sh -c 'cd deb_dist/osm-rosdn-onos-vpls*/ && dpkg-buildpackage -rfakeroot -uc -us'
345whitelist_externals = sh
346
347#######################################################################################
348[testenv:dist_ro_vim_aws]
349deps = {[testenv]deps}
350 -r{toxinidir}/requirements-dist.txt
351skip_install = true
352changedir = {toxinidir}/RO-VIM-aws
353commands =
354 sh -c 'rm -rf deb_dist dist osm_rovim_aws.egg-info osm_rovim_aws*.tar.gz'
355 python3 setup.py --command-packages=stdeb.command sdist_dsc
356 sh -c 'cd deb_dist/osm-rovim-aws*/ && dpkg-buildpackage -rfakeroot -uc -us'
357whitelist_externals = sh
358
359#######################################################################################
360[testenv:dist_ro_vim_azure]
361deps = {[testenv]deps}
362 -r{toxinidir}/requirements-dist.txt
363skip_install = true
364changedir = {toxinidir}/RO-VIM-azure
365commands =
366 sh -c 'rm -rf deb_dist dist osm_rovim_azure.egg-info osm_rovim_azure*.tar.gz'
367 python3 setup.py --command-packages=stdeb.command sdist_dsc
368 sh -c 'cd deb_dist/osm-rovim-azure*/ && dpkg-buildpackage -rfakeroot -uc -us'
369whitelist_externals = sh
370
371#######################################################################################
372[testenv:dist_ro_vim_fos]
373deps = {[testenv]deps}
374 -r{toxinidir}/requirements-dist.txt
375skip_install = true
376changedir = {toxinidir}/RO-VIM-fos
377commands =
378 sh -c 'rm -rf deb_dist dist osm_rovim_fos.egg-info osm_rovim_fos*.tar.gz'
379 python3 setup.py --command-packages=stdeb.command sdist_dsc
380 sh -c 'cd deb_dist/osm-rovim-fos*/ && dpkg-buildpackage -rfakeroot -uc -us'
381whitelist_externals = sh
382
383#######################################################################################
384[testenv:dist_ro_vim_opennebula]
385deps = {[testenv]deps}
386 -r{toxinidir}/requirements-dist.txt
387skip_install = true
388changedir = {toxinidir}/RO-VIM-opennebula
389commands =
390 sh -c 'rm -rf deb_dist dist osm_rovim_opennebula.egg-info osm_rovim_opennebula*.tar.gz'
391 python3 setup.py --command-packages=stdeb.command sdist_dsc
392 sh -c 'cd deb_dist/osm-rovim-opennebula*/ && dpkg-buildpackage -rfakeroot -uc -us'
393whitelist_externals = sh
394
395#######################################################################################
396[testenv:dist_ro_vim_openstack]
397deps = {[testenv]deps}
398 -r{toxinidir}/requirements-dist.txt
399skip_install = true
400changedir = {toxinidir}/RO-VIM-openstack
401commands =
402 sh -c 'rm -rf deb_dist dist osm_rovim_openstack.egg-info osm_rovim_openstack*.tar.gz'
403 python3 setup.py --command-packages=stdeb.command sdist_dsc
404 sh -c 'cd deb_dist/osm-rovim-openstack*/ && dpkg-buildpackage -rfakeroot -uc -us'
405whitelist_externals = sh
406
407#######################################################################################
408[testenv:dist_ro_vim_openvim]
409deps = {[testenv]deps}
410 -r{toxinidir}/requirements-dist.txt
411skip_install = true
412changedir = {toxinidir}/RO-VIM-openvim
413commands =
414 sh -c 'rm -rf deb_dist dist osm_rovim_openvim.egg-info osm_rovim_openvim*.tar.gz'
415 python3 setup.py --command-packages=stdeb.command sdist_dsc
416 sh -c 'cd deb_dist/osm-rovim-openvim*/ && dpkg-buildpackage -rfakeroot -uc -us'
417whitelist_externals = sh
418
419#######################################################################################
420[testenv:dist_ro_vim_vmware]
421deps = {[testenv]deps}
422 -r{toxinidir}/requirements-dist.txt
423skip_install = true
424changedir = {toxinidir}/RO-VIM-vmware
425commands =
426 sh -c 'rm -rf deb_dist dist osm_rovim_vmware.egg-info osm_rovim_vmware*.tar.gz'
427 python3 setup.py --command-packages=stdeb.command sdist_dsc
428 sh -c 'cd deb_dist/osm-rovim-vmware*/ && dpkg-buildpackage -rfakeroot -uc -us'
429whitelist_externals = sh
430
431#######################################################################################
432[flake8]
433ignore =
434 W291,
435 W293,
436 W503,
437 W605,
438 E123,
439 E125,
440 E203,
441 E226,
442 E241
443exclude =
444 .git,
445 __pycache__,
446 .tox,
447max-line-length = 120
448show-source = True
449builtins = _