# See the License for the specific language governing permissions and
# limitations under the License.
-FROM ubuntu:18.04
+FROM ubuntu:22.04
+
+RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
+ DEBIAN_FRONTEND=noninteractive apt-get --yes install \
+ python3=3.10.* \
+ python3-pip=22.0.* \
+ && rm -rf /var/lib/apt/lists/*
+
+# gcc=4:11.* \
+# python3-dev=3.10.* \
+# curl=7.81.* \
# Set the working directory to /app
WORKDIR /app/EE
# Libraries used by the base osm defined ee
RUN apt-get update && apt-get install -y git python3 python3-pip \
- && python3 -m pip install --upgrade pip \
- && python3 -m pip install -U grpcio-tools \
- && python3 -m pip install -U grpclib \
- && python3 -m pip install -U PyYAML \
- && python3 -m pip install -U kubernetes
+ && python3 -m pip install --upgrade pip
# Libraries used by the vnf: asyncssh, ansible
#RUN apt-get update && apt-get install software-properties-common \
ADD . /app/EE
# Install as module
-RUN python3 -m pip install -e /app/EE
+RUN python3 -m pip install -e /app/EE -r /app/EE/requirements.txt
# Install SNMP Generator and its dependencies
#RUN apt-get install -y python3-pip unzip build-essential libsnmp-dev wget curl
--- /dev/null
+#!/bin/sh
+
+##
+# 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.
+##
+
+echo "Launching tox"
+TOX_PARALLEL_NO_SPINNER=1 tox --parallel=auto
+
--- /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.
+##
+
+grpcio-tools
+grpclib
+kubernetes
+pyyaml
--- /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.
+#######################################################################################
+cachetools==5.3.3
+ # via google-auth
+certifi==2024.7.4
+ # via
+ # kubernetes
+ # requests
+charset-normalizer==3.3.2
+ # via requests
+google-auth==2.32.0
+ # via kubernetes
+grpcio==1.64.1
+ # via grpcio-tools
+grpcio-tools==1.64.1
+ # via -r requirements.in
+grpclib==0.4.7
+ # via -r requirements.in
+h2==4.1.0
+ # via grpclib
+hpack==4.0.0
+ # via h2
+hyperframe==6.0.1
+ # via h2
+idna==3.7
+ # via requests
+kubernetes==30.1.0
+ # via -r requirements.in
+multidict==6.0.5
+ # via grpclib
+oauthlib==3.2.2
+ # via
+ # kubernetes
+ # requests-oauthlib
+protobuf==5.27.2
+ # via grpcio-tools
+pyasn1==0.6.0
+ # via
+ # pyasn1-modules
+ # rsa
+pyasn1-modules==0.4.0
+ # via google-auth
+python-dateutil==2.9.0.post0
+ # via kubernetes
+pyyaml==6.0.1
+ # via
+ # -r requirements.in
+ # kubernetes
+requests==2.32.3
+ # via
+ # kubernetes
+ # requests-oauthlib
+requests-oauthlib==2.0.0
+ # via kubernetes
+rsa==4.9
+ # via google-auth
+six==1.16.0
+ # via
+ # kubernetes
+ # python-dateutil
+urllib3==2.2.2
+ # via
+ # kubernetes
+ # requests
+websocket-client==1.8.0
+ # via kubernetes
+
+# The following packages are considered to be unsafe in a requirements file:
+# setuptools
_name = "osm_ee"
-_description = 'OSM Resource Orchestrator'
-_author = 'ETSI OSM'
-_author_email = 'illoret@indra.es'
-_maintainer = 'alfonso.tiernosepulveda'
-_maintainer_email = 'alfonso.tiernosepulveda@telefonica.com'
-_license = 'Apache 2.0'
-_url = 'TOBEDEFINED'
+_description = "OSM Resource Orchestrator"
+_author = "ETSI OSM"
+_author_email = "illoret@indra.es"
+_maintainer = "alfonso.tiernosepulveda"
+_maintainer_email = "alfonso.tiernosepulveda@telefonica.com"
+_license = "Apache 2.0"
+_url = "TOBEDEFINED"
_requirements = [
# Libraries needed by the code defined by osm
"PyYAML",
"grpcio-tools",
"grpclib",
"protobuf",
-
# Libraries defined by the vnf code, they should be in an external file
- #"asyncssh",
+ # "asyncssh",
]
setup(
name=_name,
- #version_command=('0.1'), # TODO - replace for a git command
- version='1.0',
+ # version_command=('0.1'), # TODO - replace for a git command
+ version="1.0",
description=_description,
- long_description=open('README.rst').read(),
+ long_description=open("README.rst").read(),
author=_author,
author_email=_author_email,
maintainer=_maintainer,
license=_license,
packages=[_name],
package_dir={_name: _name},
-
install_requires=_requirements,
include_package_data=True,
- setup_requires=['setuptools-version-command'],
-)
\ No newline at end of file
+ setup_requires=["setuptools-version-command"],
+)
--- /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.
+#######################################################################################
+
+[tox]
+envlist = black, flake8, pylint, safety
+
+[tox:jenkins]
+toxworkdir = /tmp/.tox
+
+[testenv]
+usedevelop = True
+basepython = python3.10
+setenv = VIRTUAL_ENV={envdir}
+ PYTHONDONTWRITEBYTECODE = 1
+deps = -r{toxinidir}/requirements.txt
+parallel_show_output = true
+
+#######################################################################################
+[testenv:black]
+deps = black==24.4.2
+skip_install = true
+commands =
+ black --check --diff osm_ee/ --exclude="frontend_pb2.py"
+ black --check --diff setup.py
+
+
+#######################################################################################
+[testenv:flake8]
+deps = flake8==7.1.0
+commands =
+ flake8 osm_ee/ setup.py
+
+
+#######################################################################################
+[testenv:pylint]
+deps = {[testenv]deps}
+ pylint==3.1.1
+commands =
+ pylint -E osm_ee
+
+
+#######################################################################################
+[testenv:safety]
+deps = {[testenv]deps}
+ safety
+commands =
+ - safety check --full-report
+
+
+#######################################################################################
+[testenv:pip-compile]
+deps = pip-tools==6.13.0
+skip_install = true
+allowlist_externals = bash
+ [
+commands =
+ - bash -c "for file in requirements*.in ; do \
+ UNSAFE="" ; \
+ if [[ $file =~ 'dist' ]] ; then UNSAFE='--allow-unsafe' ; fi ; \
+ pip-compile --resolver=backtracking -rU --no-header $UNSAFE $file ;\
+ out=`echo $file | sed 's/.in/.txt/'` ; \
+ sed -i -e '1 e head -16 tox.ini' $out ;\
+ done"
+
+
+#######################################################################################
+[flake8]
+ignore =
+# W291,
+# W293,
+# W503,
+# E123,
+# E125,
+# E226,
+# E241,
+# E203
+exclude =
+ .git,
+ __pycache__,
+ .tox,
+ osm_ee/frontend_pb2.py,
+max-line-length = 120
+show-source = True
+builtins = _