--- /dev/null
+# 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.
+
+__pycache__
+*.pyc
+.tox/
+dist/
+.cache/
+.local/
+.eggs
+osm_lcm.egg-info/
+.coverage
+cover
+coverage.xml
+.tox
+nosetests.xml
+.cache
+.vscode/
+.project
+.settings
+.pydevproject
+pyvenv.cfg
+venv/
-# Copyright 2018 Telefonica S.A.
-#
# 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
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-
-# This Dockerfile is intented for devops and deb package generation
+########################################################################################
+# This Dockerfile is intented for devops testing and deb package generation
+#
+# To run stage 2 locally:
+#
+# docker build -t stage2 .
+# docker run -ti -v `pwd`:/work -w /work --entrypoint /bin/bash stage2
+# devops-stages/stage-test.sh
+# devops-stages/stage-build.sh
#
-# Use Dockerfile.local for running osm/LCM in a docker container from source
-
FROM ubuntu:18.04
-RUN apt-get update && \
- DEBIAN_FRONTEND=noninteractive apt-get --yes install git tox make debhelper wget \
- python-all python3 python3-pip python3-all apt-utils && \
- DEBIAN_FRONTEND=noninteractive pip3 install -U setuptools setuptools-version-command stdeb
-
-# TODO delete if not needed:
-# libcurl4-gnutls-dev libgnutls-dev python-dev python3-dev python-setuptools
-
-
-# Uncomment this block to generate automatically a debian package and show info
-# # Set the working directory to /app
-# WORKDIR /app
-# # Copy the current directory contents into the container at /app
-# ADD . /app
-# CMD /app/devops-stages/stage-build.sh && find -name "*.deb" -exec dpkg -I {} ";"
-
+RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
+ DEBIAN_FRONTEND=noninteractive apt-get -y install \
+ debhelper \
+ git \
+ python3 \
+ python3-all \
+ python3-dev \
+ python3-setuptools
+
+RUN python3 -m easy_install pip==21.0.1
+RUN pip3 install tox==3.22.0
# limitations under the License.
include README.rst
-recursive-include osm_lcm *.py *.xml *.sh lcm.cfg
+recursive-include osm_lcm *.py *.xml *.sh lcm.cfg *.txt
recursive-include devops-stages *
+++ /dev/null
-# Copyright 2018 Telefonica S.A.
-#
-# 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.
-
-all: clean package
-
-clean:
- rm -rf dist deb_dist osm_lcm-*.tar.gz osm_lcm.egg-info .eggs
-
-package:
- python3 setup.py --command-packages=stdeb.command sdist_dsc
- cp debian/python3-osm-lcm.postinst deb_dist/osm-lcm*/debian
- # cd deb_dist/osm-lcm*/debian && echo "osm-common python3-osm-common" > py3dist-overrides
- # cd deb_dist/osm-lcm*/debian && echo "pip3 python3-pip" >> py3dist-overrides
- cd deb_dist/osm-lcm*/ && dpkg-buildpackage -rfakeroot -uc -us
-
+++ /dev/null
-#!/bin/bash
-
-##
-# 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.
-#
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact with: OSM_TECH@list.etsi.org
-##
-
-echo "POST INSTALL OSM-LCM"
-echo "Installing python dependencies grpcio-tools grpclib via pip..."
-echo
-python3 -m pip install -U pip
-python3 -m pip install grpcio-tools grpclib
-
-# Creation of log folder
-# mkdir -p /var/log/osm
-
# under the License.
##
-# For the moment it is not needed any post-intall action, so tox instead of Makefile is used
-
-make clean package
+rm -rf dist deb_dist osm*.tar.gz *.egg-info .eggs
+tox -e dist
\ No newline at end of file
# License for the specific language governing permissions and limitations
# under the License.
##
-rm -f nosetests.xml
-tox # flake8 unittest
+
+OUTPUT=$(TOX_PARALLEL_NO_SPINNER=1 tox --parallel=auto)
+printf "$OUTPUT"
--- /dev/null
+# 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.
+
+-e git+https://osm.etsi.org/gerrit/osm/common.git@master#egg=osm-common
+-e git+https://osm.etsi.org/gerrit/osm/N2VC.git@master#egg=n2vc
--- /dev/null
+-e git+https://osm.etsi.org/gerrit/osm/N2VC.git@master#egg=n2vc
+ # via -r requirements-dev.in
+-e git+https://osm.etsi.org/gerrit/osm/common.git@master#egg=osm-common
+ # via -r requirements-dev.in
+aiokafka==0.7.0
+ # via osm-common
+bcrypt==3.2.0
+ # via paramiko
+cachetools==4.2.1
+ # via google-auth
+certifi==2020.12.5
+ # via
+ # kubernetes
+ # requests
+cffi==1.14.5
+ # via
+ # bcrypt
+ # cryptography
+ # pynacl
+chardet==4.0.0
+ # via requests
+cryptography==3.4.7
+ # via paramiko
+dataclasses==0.6
+ # via osm-common
+google-auth==1.28.0
+ # via kubernetes
+idna==2.10
+ # via requests
+juju==2.8.4
+ # via n2vc
+jujubundlelib==0.5.6
+ # via theblues
+kafka-python==2.0.2
+ # via aiokafka
+kubernetes==10.0.1
+ # via n2vc
+macaroonbakery==1.3.1
+ # via
+ # juju
+ # theblues
+mypy-extensions==0.4.3
+ # via typing-inspect
+oauthlib==3.1.0
+ # via requests-oauthlib
+paramiko==2.7.2
+ # via juju
+protobuf==3.15.6
+ # via macaroonbakery
+pyasn1-modules==0.2.8
+ # via google-auth
+pyasn1==0.4.8
+ # via
+ # juju
+ # n2vc
+ # pyasn1-modules
+ # rsa
+pycparser==2.20
+ # via cffi
+pycrypto==2.6.1
+ # via osm-common
+pymacaroons==0.13.0
+ # via macaroonbakery
+pymongo==3.11.3
+ # via osm-common
+pynacl==1.4.0
+ # via
+ # macaroonbakery
+ # paramiko
+ # pymacaroons
+pyrfc3339==1.1
+ # via
+ # juju
+ # macaroonbakery
+python-dateutil==2.8.1
+ # via kubernetes
+pytz==2021.1
+ # via pyrfc3339
+pyyaml==5.4.1
+ # via
+ # juju
+ # jujubundlelib
+ # kubernetes
+ # osm-common
+requests-oauthlib==1.3.0
+ # via kubernetes
+requests==2.25.1
+ # via
+ # kubernetes
+ # macaroonbakery
+ # requests-oauthlib
+ # theblues
+rsa==4.7.2
+ # via google-auth
+six==1.15.0
+ # via
+ # bcrypt
+ # google-auth
+ # kubernetes
+ # macaroonbakery
+ # protobuf
+ # pymacaroons
+ # pynacl
+ # python-dateutil
+ # websocket-client
+theblues==0.5.2
+ # via juju
+toposort==1.6
+ # via juju
+typing-extensions==3.7.4.3
+ # via typing-inspect
+typing-inspect==0.6.0
+ # via juju
+urllib3==1.26.4
+ # via
+ # kubernetes
+ # requests
+websocket-client==0.58.0
+ # via kubernetes
+websockets==7.0
+ # via juju
+
+# The following packages are considered to be unsafe in a requirements file:
+# setuptools
+#######################################################################################
+# 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.
+#######################################################################################
--- /dev/null
+# 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.
+
+stdeb
+setuptools-version-command
\ No newline at end of file
--- /dev/null
+setuptools-version-command==2.2
+ # via -r requirements-dist.in
+stdeb==0.10.0
+ # via -r requirements-dist.in
+
+# The following packages are considered to be unsafe in a requirements file:
+# setuptools
+#######################################################################################
+# 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.
+#######################################################################################
--- /dev/null
+# Copyright 2018 Telefonica S.A.
+#
+# 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.
+
+asynctest
+coverage
+mock
+nose2
\ No newline at end of file
--- /dev/null
+asynctest==0.13.0
+ # via -r requirements-test.in
+coverage==5.5
+ # via
+ # -r requirements-test.in
+ # nose2
+mock==4.0.3
+ # via -r requirements-test.in
+nose2==0.10.0
+ # via -r requirements-test.in
+six==1.15.0
+ # via nose2
+#######################################################################################
+# 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.
+#######################################################################################
--- /dev/null
+##
+# 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.
+##
+
+aiohttp
+grpcio-tools
+grpclib
+idna==2.10
+jinja2
+pyyaml
-##
-# 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
+aiohttp==3.7.4.post0
+ # via -r requirements.in
+async-timeout==3.0.1
+ # via aiohttp
+attrs==20.3.0
+ # via aiohttp
+chardet==4.0.0
+ # via aiohttp
+grpcio-tools==1.36.1
+ # via -r requirements.in
+grpcio==1.36.1
+ # via grpcio-tools
+grpclib==0.4.1
+ # via -r requirements.in
+h2==4.0.0
+ # via grpclib
+hpack==4.0.0
+ # via h2
+hyperframe==6.0.0
+ # via h2
+idna==2.10
+ # via
+ # -r requirements.in
+ # yarl
+jinja2==2.11.3
+ # via -r requirements.in
+markupsafe==1.1.1
+ # via jinja2
+multidict==5.1.0
+ # via
+ # aiohttp
+ # grpclib
+ # yarl
+protobuf==3.15.6
+ # via grpcio-tools
+pyyaml==5.4.1
+ # via -r requirements.in
+six==1.15.0
+ # via
+ # grpcio
+ # protobuf
+typing-extensions==3.7.4.3
+ # via aiohttp
+yarl==1.6.3
+ # via aiohttp
+
+# The following packages are considered to be unsafe in a requirements file:
+# setuptools
+#######################################################################################
+# 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
+# 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.
-##
-
-pyyaml
-aiohttp>=2.3.10
-jinja2
-grpcio-tools
-grpclib
-git+https://osm.etsi.org/gerrit/osm/common.git#egg=osm-common
-git+https://osm.etsi.org/gerrit/osm/N2VC.git#egg=n2vc
-
+# 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.
+#######################################################################################
# version=VERSION,
# python_requires='>3.5.0',
author='ETSI OSM',
- author_email='alfonso.tiernosepulveda@telefonica.com',
- maintainer='Alfonso Tierno',
- maintainer_email='alfonso.tiernosepulveda@telefonica.com',
+ author_email='osmsupport@etsi.org',
+ maintainer='ETSI OSM',
+ maintainer_email='osmsupport@etsi.org',
url='https://osm.etsi.org/gitweb/?p=osm/LCM.git;a=summary',
license='Apache 2.0',
packages=[_name],
include_package_data=True,
- # data_files=[('/etc/osm/', ['osm_lcm/lcm.cfg']),
- # ('/etc/systemd/system/', ['osm_lcm/osm-lcm.service']),
- # ],
- install_requires=[
- # 'pymongo',
- 'PyYAML',
- 'aiohttp>=2.3.10',
- 'osm-common @ git+https://osm.etsi.org/gerrit/osm/common.git#egg=osm-common',
- 'n2vc @ git+https://osm.etsi.org/gerrit/osm/N2VC.git#egg=n2vc',
- 'jinja2',
- 'grpcio-tools',
- 'grpclib',
- # TODO this is version installed by 'apt python3-aiohttp' on Ubuntu Sserver 14.04
- # version installed by pip 3.3.2 is not compatible. Code should be migrated to this version and use pip3
- ],
setup_requires=['setuptools-version-command'],
)
##
[DEFAULT]
X-Python3-Version : >= 3.6
-Depends3: python3-osm-common, python3-n2vc, python3-yaml, python3-aiohttp, python3-jinja2, python3-pip
+++ /dev/null
-# Copyright 2018 Telefonica S.A.
-#
-# 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.
-
-flake8<3.0
-asynctest
-
-# Copyright 2018 Telefonica S.A.
+#######################################################################################
+# 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.
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+#######################################################################################
[tox]
-envlist = cover, flake8
+envlist = black, cover, flake8, pylint, safety
+
+[tox:jenkins]
+toxworkdir = /tmp/.tox
[testenv]
usedevelop = True
basepython = python3
-install_command = python3 -m pip install -r requirements.txt -U {opts} {packages}
+setenv = VIRTUAL_ENV={envdir}
+ PYTHONDONTWRITEBYTECODE = 1
+deps = -r{toxinidir}/requirements.txt
+
+#######################################################################################
+[testenv:black]
+deps = black
+skip_install = true
+commands =
+ - black --check --diff osm_lcm/
+
+#######################################################################################
[testenv:cover]
-basepython = python3
-deps =
- nose2
- nose2-cov
- coverage
- -rrequirements.txt
- -rtest-requirements.txt
+deps = {[testenv]deps}
+ -r{toxinidir}/requirements-dev.txt
+ -r{toxinidir}/requirements-test.txt
commands =
- coverage erase
- nose2 -C --coverage osm_lcm --plugin nose2.plugins.junitxml -s osm_lcm/tests
- coverage report --omit='*tests*'
- coverage html -d ./cover --omit='*tests*'
- coverage xml -o coverage.xml --omit='*tests*'
+ sh -c 'rm -f nosetests.xml'
+ coverage erase
+ nose2 -C --coverage osm_lcm
+ coverage report --omit='*tests*'
+ coverage html -d ./cover --omit='*tests*'
+ coverage xml -o coverage.xml --omit=*tests*
+whitelist_externals = sh
+
+#######################################################################################
[testenv:flake8]
-basepython = python3
-deps =
- flake8
- -rrequirements.txt
-commands = flake8 osm_lcm --max-line-length 120 \
- --exclude .svn,CVS,.gz,.git,__pycache__,.tox,local,temp,frontend_grpc.py,frontend_pb2.py \
- --ignore W291,W293,E226,W504
-
-[testenv:build]
-basepython = python3
-deps = stdeb
- setuptools-version-command
-commands = python3 setup.py --command-packages=stdeb.command bdist_deb
+deps = flake8
+commands =
+ flake8 osm_lcm/ setup.py
+
+
+#######################################################################################
+[testenv:pylint]
+deps = {[testenv]deps}
+ -r{toxinidir}/requirements-dev.txt
+ -r{toxinidir}/requirements-test.txt
+ pylint
+commands =
+ - pylint -E osm_lcm
+
+
+#######################################################################################
+[testenv:safety]
+setenv =
+ LC_ALL=C.UTF-8
+ LANG=C.UTF-8
+deps = {[testenv]deps}
+ safety
+commands =
+ - safety check --full-report
+
+
+#######################################################################################
+[testenv:pip-compile]
+deps = pip-tools==5.5.0
+commands =
+ - sh -c 'for file in requirements*.in ; do pip-compile -rU --no-header $file ;\
+ out=`echo $file | sed "s/.in/.txt/"` ; \
+ head -16 tox.ini >> $out ;\
+ done'
+whitelist_externals = sh
+
+
+#######################################################################################
+[testenv:dist]
+deps = {[testenv]deps}
+ -r{toxinidir}/requirements-dist.txt
+
+# In the commands, we copy the requirements.txt to be presented as a source file (.py)
+# so it gets included in the .deb package for others to consume
+commands =
+ sh -c 'cp requirements.txt osm_lcm/requirements.txt'
+ python3 setup.py --command-packages=stdeb.command sdist_dsc
+ sh -c 'cd deb_dist/osm-lcm*/ && dpkg-buildpackage -rfakeroot -uc -us'
+ sh -c 'rm osm_lcm/requirements.txt'
+whitelist_externals = sh
+#######################################################################################
+[flake8]
+ignore =
+ W291,
+ W293,
+ W503,
+ E123,
+ E125,
+ E226,
+ E241,
+# Temporary until code can be reformatted
+ E121,
+ E122,
+ E203,
+ E303,
+ E501
+ W504
+exclude =
+ .git,
+ __pycache__,
+ .tox,
+max-line-length = 120
+show-source = True
+builtins = _