From: beierlm Date: Tue, 16 Feb 2021 18:30:35 +0000 (-0500) Subject: Feature 10296 Pip Standardization X-Git-Tag: v9.1.2~2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=9fc04a17d25d805b15c5e52c7b2047719053ad0a;p=osm%2FMON.git Feature 10296 Pip Standardization Creates standard template for tox.ini Introduces 'safety' for listing upstream CVEs Pins all versions of all upstream modules Removes Makefile step and places all build logic into tox.ini Change-Id: I572b68a6f89bf2afc07365b8e1109243fd6592a1 Signed-off-by: beierlm --- diff --git a/.gitignore b/.gitignore index aee2396..a022457 100644 --- a/.gitignore +++ b/.gitignore @@ -86,5 +86,7 @@ __pycache__/ !.vscode/extensions.json *.code-workspace .vscode +.project +.pydevproject deb_dist *.tar.gz diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..eb9750e --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,17 @@ +# Copyright Contributors to ETSI OSM +# +# 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. + +include: + - project: 'devops/cicd' + file: '/templates/osm-base.yml' diff --git a/Dockerfile b/Dockerfile index 376bb2b..17053d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,29 +1,40 @@ -# Copyright 2017 Intel Research and Development Ireland Limited -# ************************************************************* - -# This file is part of OSM Monitoring module -# All Rights Reserved to Intel Corporation - -# 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 - +# 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. +# 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. +######################################################################################## +# 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 +# + +FROM ubuntu:20.04 -# For those usages not covered by the Apache License, Version 2.0 please -# contact: prithiv.mohan@intel.com or adrian.hoban@intel.com +RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get -y install \ + debhelper \ + dh-python \ + git \ + python3 \ + python3-all \ + python3-dev \ + python3-setuptools -#__author__ = "Prithiv Mohan" -#__date__ = "25/Sep/2017" +RUN python3 -m easy_install pip==21.0.1 +RUN pip3 install tox==3.22.0 -FROM ubuntu:18.04 -RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get --yes install git tox make python-all python3 python3-pip debhelper wget && \ - DEBIAN_FRONTEND=noninteractive apt-get --yes install libxml2 python3-all libssl-dev && \ - DEBIAN_FRONTEND=noninteractive pip3 install -U setuptools setuptools-version-command stdeb +ENV LC_ALL C.UTF-8 +ENV LANG C.UTF-8 diff --git a/MANIFEST.in b/MANIFEST.in index d95867d..99d819d 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -19,8 +19,5 @@ # For those usages not covered by the Apache License, Version 2.0 please # contact: prithiv.mohan@intel.com or adrian.hoban@intel.com. -include requirements.txt -include test-requirements.txt include README.rst -recursive-include osm_mon *.py *.xml *.sh *.yaml *.json -recursive-include devops-stages * +recursive-include osm_mon *.py *.xml *.sh *.yaml *.json *.txt diff --git a/Makefile b/Makefile deleted file mode 100644 index 902909a..0000000 --- a/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2018 Whitestack, LLC -# ************************************************************* - -# This file is part of OSM Monitoring module -# All Rights Reserved to Whitestack, LLC - -# 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: bdiaz@whitestack.com or glavado@whitestack.com -## - -all: clean package - -clean: - rm -rf dist deb_dist osm_mon-*.tar.gz osm_mon.egg-info .eggs - -package: - python3 setup.py --command-packages=stdeb.command sdist_dsc - cp debian/python3-osm-mon.postinst deb_dist/osm-mon*/debian - cd deb_dist/osm-mon*/ && dpkg-buildpackage -rfakeroot -uc -us \ No newline at end of file diff --git a/debian/python3-osm-mon.postinst b/debian/python3-osm-mon.postinst deleted file mode 100644 index 8f55b68..0000000 --- a/debian/python3-osm-mon.postinst +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Whitestack, LLC -# ************************************************************* - -# This file is part of OSM Monitoring module -# All Rights Reserved to Whitestack, LLC - -# 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: bdiaz@whitestack.com or glavado@whitestack.com -## - -echo "Installing python dependencies via pip..." -pip3 install aiokafka==0.6.0 -pip3 install requests==2.25.* -pip3 install python-keystoneclient==4.2.0 -pip3 install six==1.15.0 -pip3 install pyyaml>=5.1.2 -pip3 install prometheus_client==0.4.* -pip3 install gnocchiclient==7.0.* -pip3 install pyvcloud==23.0.* -pip3 install python-ceilometerclient==2.9.* -pip3 install python-novaclient==12.0.* -pip3 install python-neutronclient==5.1.* -echo "Installation of python dependencies finished" diff --git a/devops-stages/stage-build.sh b/devops-stages/stage-build.sh index 8a8d332..9e78a73 100755 --- a/devops-stages/stage-build.sh +++ b/devops-stages/stage-build.sh @@ -1,26 +1,18 @@ -# Copyright 2017 Intel Research and Development Ireland Limited -# ************************************************************* - -# This file is part of OSM Monitoring module -# All Rights Reserved to Intel Corporation - -# 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 +#!/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. - -# For those usages not covered by the Apache License, Version 2.0 please -# contact: prithiv.mohan@intel.com or adrian.hoban@intel.com +# 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. -#__author__ = "Prithiv Mohan" -#__date__ = "14/Sep/2017" +rm -rf dist deb_dist osm*.tar.gz *.egg-info .eggs -#!/bin/bash -make +tox -e dist \ No newline at end of file diff --git a/devops-stages/stage-test.sh b/devops-stages/stage-test.sh index 4ad4f08..75a3c61 100755 --- a/devops-stages/stage-test.sh +++ b/devops-stages/stage-test.sh @@ -16,11 +16,5 @@ # 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: prithiv.mohan@intel.com or adrian.hoban@intel.com - -#__author__ = "Prithiv Mohan" -#__date__ = "14/Sep/2017" - -#!/bin/bash -tox --recreate +OUTPUT=$(TOX_PARALLEL_NO_SPINNER=1 tox --parallel=auto) +printf "$OUTPUT" diff --git a/osm_mon/collector/infra_collectors/vmware.py b/osm_mon/collector/infra_collectors/vmware.py index 6accd65..89717dc 100644 --- a/osm_mon/collector/infra_collectors/vmware.py +++ b/osm_mon/collector/infra_collectors/vmware.py @@ -21,6 +21,8 @@ # contact: osslegalrouting@vmware.com ## +# pylint: disable=E1101 + import logging from typing import List from xml.etree import ElementTree as XmlElementTree diff --git a/osm_mon/tests/unit/collector/vnf_collectors/test_openstack.py b/osm_mon/tests/unit/collector/vnf_collectors/test_openstack.py index 42df03c..9af1492 100644 --- a/osm_mon/tests/unit/collector/vnf_collectors/test_openstack.py +++ b/osm_mon/tests/unit/collector/vnf_collectors/test_openstack.py @@ -20,6 +20,9 @@ # For those usages not covered by the Apache License, Version 2.0 please # contact: bdiaz@whitestack.com or glavado@whitestack.com ## + +# pylint: disable=E1101 + import datetime from unittest import TestCase, mock diff --git a/requirements-dev.in b/requirements-dev.in new file mode 100644 index 0000000..41f4d13 --- /dev/null +++ b/requirements-dev.in @@ -0,0 +1,20 @@ +# 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@v9.0#egg=osm-common +-r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=v9.0 + +-e git+https://osm.etsi.org/gerrit/osm/N2VC.git@v9.0#egg=n2vc +-r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..e683ead --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,210 @@ +-e git+https://osm.etsi.org/gerrit/osm/N2VC.git@v9.0#egg=n2vc + # via -r requirements-dev.in +-e git+https://osm.etsi.org/gerrit/osm/common.git@v9.0#egg=osm-common + # via -r requirements-dev.in +aiokafka==0.7.0 + # via -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=v9.0 +async-timeout==3.0.1 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # retrying-async +bcrypt==3.2.0 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # paramiko +cachetools==4.2.1 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # google-auth +certifi==2020.12.5 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # kubernetes + # requests +cffi==1.14.5 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # bcrypt + # cryptography + # pynacl +chardet==4.0.0 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # requests +cryptography==3.4.7 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # paramiko +dataclasses==0.6 + # via -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=v9.0 +google-auth==1.28.0 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # kubernetes +idna==2.10 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # requests +juju==2.8.4 + # via -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 +jujubundlelib==0.5.6 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # theblues +kafka-python==2.0.2 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # aiokafka +kubernetes==10.0.1 + # via -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 +macaroonbakery==1.3.1 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # juju + # theblues +motor==1.3.1 + # via -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 +mypy-extensions==0.4.3 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # typing-inspect +oauthlib==3.1.0 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # requests-oauthlib +paramiko==2.7.2 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # juju +protobuf==3.15.6 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # macaroonbakery +pyasn1-modules==0.2.8 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # google-auth +pyasn1==0.4.8 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # juju + # pyasn1-modules + # rsa +pycparser==2.20 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # cffi +pycrypto==2.6.1 + # via -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=v9.0 +pymacaroons==0.13.0 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # macaroonbakery +pymongo==3.11.3 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # motor +pynacl==1.4.0 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # macaroonbakery + # paramiko + # pymacaroons +pyrfc3339==1.1 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # juju + # macaroonbakery +python-dateutil==2.8.1 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # kubernetes +pytz==2021.1 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # pyrfc3339 +pyyaml==5.4.1 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # juju + # jujubundlelib + # kubernetes +requests-oauthlib==1.3.0 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # kubernetes +requests==2.25.1 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # kubernetes + # macaroonbakery + # requests-oauthlib + # theblues +retrying-async==1.2.0 + # via -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 +rsa==4.7.2 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # google-auth +six==1.15.0 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # bcrypt + # google-auth + # kubernetes + # macaroonbakery + # protobuf + # pymacaroons + # pynacl + # python-dateutil + # websocket-client +theblues==0.5.2 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # juju +toposort==1.6 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # juju +typing-extensions==3.7.4.3 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # typing-inspect +typing-inspect==0.6.0 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # juju +urllib3==1.26.4 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # kubernetes + # requests +websocket-client==0.58.0 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # kubernetes +websockets==7.0 + # via + # -r https://osm.etsi.org/gitweb/?p=osm/N2VC.git;a=blob_plain;f=requirements.txt;hb=v9.0 + # 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. +####################################################################################### diff --git a/requirements-dist.in b/requirements-dist.in new file mode 100644 index 0000000..11f0a2a --- /dev/null +++ b/requirements-dist.in @@ -0,0 +1,17 @@ +# 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 diff --git a/requirements-dist.txt b/requirements-dist.txt new file mode 100644 index 0000000..7393626 --- /dev/null +++ b/requirements-dist.txt @@ -0,0 +1,23 @@ +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. +####################################################################################### diff --git a/requirements-test.in b/requirements-test.in new file mode 100644 index 0000000..febfdae --- /dev/null +++ b/requirements-test.in @@ -0,0 +1,25 @@ +# Copyright 2017 Intel Research and Development Ireland Limited +# ************************************************************* + +# This file is part of OSM Monitoring module +# All Rights Reserved to Intel Corporation + +# 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: helena.mcgough@intel.com or adrian.hoban@intel.com +## +coverage +mock +nose2 +requests-mock diff --git a/requirements-test.txt b/requirements-test.txt new file mode 100644 index 0000000..871fdef --- /dev/null +++ b/requirements-test.txt @@ -0,0 +1,40 @@ +certifi==2020.12.5 + # via requests +chardet==4.0.0 + # via requests +coverage==5.5 + # via + # -r requirements-test.in + # nose2 +idna==2.10 + # via requests +mock==4.0.3 + # via -r requirements-test.in +nose2==0.10.0 + # via -r requirements-test.in +requests-mock==1.8.0 + # via -r requirements-test.in +requests==2.25.1 + # via requests-mock +six==1.15.0 + # via + # nose2 + # requests-mock +urllib3==1.26.4 + # via requests +####################################################################################### +# 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. +####################################################################################### diff --git a/requirements.in b/requirements.in new file mode 100644 index 0000000..51603ff --- /dev/null +++ b/requirements.in @@ -0,0 +1,33 @@ +# Copyright 2017 Intel Research and Development Ireland Limited +# ************************************************************* + +# This file is part of OSM Monitoring module +# All Rights Reserved to Intel Corporation + +# 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: prithiv.mohan@intel.com or adrian.hoban@intel.com +aiokafka +gnocchiclient +humanfriendly +lxml +prometheus_client +python-ceilometerclient +python-keystoneclient +python-neutronclient +python-novaclient +pyvcloud==23.0.* +pyyaml +requests +six diff --git a/requirements.txt b/requirements.txt index 1661913..22bf875 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,40 +1,276 @@ -# Copyright 2017 Intel Research and Development Ireland Limited -# ************************************************************* - -# This file is part of OSM Monitoring module -# All Rights Reserved to Intel Corporation - -# 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: prithiv.mohan@intel.com or adrian.hoban@intel.com -chardet==3.0.4 -lxml==4.6.2 -humanfriendly==9.0.* -aiokafka==0.6.0 -requests==2.25.* +aiokafka==0.7.0 + # via -r requirements.in +appdirs==1.4.4 + # via openstacksdk +attrs==20.3.0 + # via cmd2 +certifi==2020.12.5 + # via requests +cffi==1.14.5 + # via cryptography +chardet==4.0.0 + # via requests +cliff==3.7.0 + # via + # gnocchiclient + # osc-lib + # python-neutronclient +cmd2==1.5.0 + # via cliff +colorama==0.4.4 + # via cmd2 +cryptography==3.4.7 + # via openstacksdk +debtcollector==2.2.0 + # via + # gnocchiclient + # oslo.config + # oslo.context + # oslo.log + # oslo.utils + # python-keystoneclient + # python-neutronclient +decorator==4.4.2 + # via + # dogpile.cache + # openstacksdk +dogpile.cache==1.1.2 + # via openstacksdk +futurist==2.3.0 + # via gnocchiclient +gnocchiclient==7.0.7 + # via -r requirements.in +humanfriendly==9.1 + # via + # -r requirements.in + # pyvcloud +idna==2.10 + # via requests +iso8601==0.1.14 + # via + # gnocchiclient + # keystoneauth1 + # openstacksdk + # oslo.utils + # python-ceilometerclient + # python-neutronclient + # python-novaclient +jmespath==0.10.0 + # via openstacksdk +jsonpatch==1.32 + # via openstacksdk +jsonpointer==2.1 + # via jsonpatch +kafka-python==2.0.2 + # via aiokafka +keystoneauth1==4.3.1 + # via + # gnocchiclient + # openstacksdk + # osc-lib + # python-ceilometerclient + # python-keystoneclient + # python-neutronclient + # python-novaclient +lxml==4.6.3 + # via + # -r requirements.in + # pyvcloud +monotonic==1.5 + # via gnocchiclient +msgpack==1.0.2 + # via oslo.serialization +munch==2.5.0 + # via openstacksdk +netaddr==0.8.0 + # via + # oslo.config + # oslo.utils + # python-neutronclient +netifaces==0.10.9 + # via + # openstacksdk + # oslo.utils +openstacksdk==0.55.0 + # via + # os-client-config + # osc-lib +os-client-config==2.1.0 + # via python-neutronclient +os-service-types==1.7.0 + # via + # keystoneauth1 + # openstacksdk +osc-lib==2.3.1 + # via python-neutronclient +oslo.config==8.5.0 + # via + # oslo.log + # python-keystoneclient +oslo.context==3.2.0 + # via oslo.log +oslo.i18n==5.0.1 + # via + # osc-lib + # oslo.config + # oslo.log + # oslo.utils + # python-ceilometerclient + # python-keystoneclient + # python-neutronclient + # python-novaclient +oslo.log==4.4.0 + # via python-neutronclient +oslo.serialization==4.1.0 + # via + # oslo.log + # python-ceilometerclient + # python-keystoneclient + # python-neutronclient + # python-novaclient +oslo.utils==4.8.0 + # via + # osc-lib + # oslo.log + # oslo.serialization + # python-ceilometerclient + # python-keystoneclient + # python-neutronclient + # python-novaclient +packaging==20.9 + # via oslo.utils +pbr==5.5.1 + # via + # cliff + # debtcollector + # futurist + # gnocchiclient + # keystoneauth1 + # openstacksdk + # os-service-types + # osc-lib + # oslo.context + # oslo.i18n + # oslo.log + # oslo.serialization + # oslo.utils + # python-ceilometerclient + # python-keystoneclient + # python-neutronclient + # python-novaclient + # stevedore +prettytable==0.7.2 + # via + # cliff + # python-ceilometerclient + # python-novaclient +prometheus-client==0.9.0 + # via -r requirements.in +pycparser==2.20 + # via cffi +pygments==2.8.1 + # via pyvcloud +pyinotify==0.9.6 + # via oslo.log +pyparsing==2.4.7 + # via + # cliff + # oslo.utils + # packaging +pyperclip==1.8.2 + # via cmd2 +python-ceilometerclient==2.9.0 + # via -r requirements.in +python-dateutil==2.8.1 + # via + # gnocchiclient + # oslo.log + # pyvcloud python-keystoneclient==4.2.0 + # via + # -r requirements.in + # python-neutronclient +python-neutronclient==7.3.0 + # via -r requirements.in +python-novaclient==17.4.0 + # via -r requirements.in +pytz==2021.1 + # via + # oslo.serialization + # oslo.utils +pyvcloud==23.0.0 + # via -r requirements.in +pyyaml==5.4.1 + # via + # -r requirements.in + # cliff + # openstacksdk + # oslo.config + # pyvcloud +requests==2.25.1 + # via + # -r requirements.in + # keystoneauth1 + # oslo.config + # python-ceilometerclient + # python-keystoneclient + # python-neutronclient + # pyvcloud +requestsexceptions==1.4.0 + # via openstacksdk +rfc3986==1.4.0 + # via oslo.config +simplejson==3.17.2 + # via + # osc-lib + # python-neutronclient six==1.15.0 -pyyaml>=5.1.2 -prometheus_client==0.4.* -gnocchiclient==7.0.* -pyvcloud==23.0.* -python-ceilometerclient==2.9.* -python-novaclient==12.0.* -python-neutronclient==5.1.* -pymongo==3.11.* -pycrypto==2.6.* -juju==2.8.* -kubernetes==10.0.* -git+https://osm.etsi.org/gerrit/osm/common.git@v9.0#egg=osm-common -git+https://osm.etsi.org/gerrit/osm/N2VC.git@v9.0#egg=n2vc + # via + # -r requirements.in + # debtcollector + # futurist + # gnocchiclient + # keystoneauth1 + # munch + # oslo.i18n + # python-ceilometerclient + # python-dateutil + # python-keystoneclient +stevedore==3.3.0 + # via + # cliff + # dogpile.cache + # keystoneauth1 + # osc-lib + # oslo.config + # python-ceilometerclient + # python-keystoneclient + # python-novaclient +ujson==4.0.2 + # via gnocchiclient +unittest-xml-reporting==3.0.4 + # via pyvcloud +urllib3==1.26.4 + # via requests +vcd-api-schemas-type==9.1.2.dev10 + # via pyvcloud +wcwidth==0.2.5 + # via cmd2 +wrapt==1.12.1 + # via debtcollector +####################################################################################### +# 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. +####################################################################################### diff --git a/setup.py b/setup.py index 4377e45..3c91487 100644 --- a/setup.py +++ b/setup.py @@ -21,27 +21,21 @@ from setuptools import setup - -def parse_requirements(requirements): - with open(requirements) as f: - return [l.strip('\n') for l in f if l.strip('\n') and not l.startswith('#') and '://' not in l] - - -_name = 'osm_mon' -_version_command = ('git describe --match v* --tags --long --dirty', 'pep440-git-full') -_description = 'OSM Monitoring Module' -_author = "Benjamín Díaz" -_author_email = 'bdiaz@whitestack.com' -_maintainer = 'Gianpietro Lavado' -_maintainer_email = 'glavado@whitestack.com' -_license = 'Apache 2.0' -_url = 'https://osm.etsi.org/gitweb/?p=osm/MON.git;a=tree' +_name = "osm_mon" +_version_command = ("git describe --match v* --tags --long --dirty", "pep440-git-full") +_description = "OSM Monitoring Module" +_author = "OSM Support" +_author_email = "osmsupport@etsi.org" +_maintainer = "OSM Support" +_maintainer_email = "osmsupport@etsi.org" +_license = "Apache 2.0" +_url = "https://osm.etsi.org/gitweb/?p=osm/MON.git;a=tree" setup( name=_name, version_command=_version_command, description=_description, - long_description=open('README.rst', encoding='utf-8').read(), + long_description=open("README.rst", encoding="utf-8").read(), author=_author, author_email=_author_email, maintainer=_maintainer, @@ -50,34 +44,15 @@ setup( license=_license, packages=[_name], package_dir={_name: _name}, - install_requires=[ - "aiokafka==0.6.0", - "requests==2.25.*", - "python-keystoneclient==4.2.0", - "six", - "pyyaml>=5.1.2", - "prometheus_client==0.4.*", - "gnocchiclient==7.0.*", - "pyvcloud==23.0.*", - "python-ceilometerclient==2.9.*", - "python-novaclient==12.0.*", - "python-neutronclient==5.1.*", - "osm-common", - "n2vc" - ], include_package_data=True, entry_points={ "console_scripts": [ "osm-mon-server = osm_mon.cmd.mon_server:main", "osm-mon-evaluator = osm_mon.cmd.mon_evaluator:main", "osm-mon-collector = osm_mon.cmd.mon_collector:main", - "osm-mon-dashboarder = osm_mon.cmd.mon_dashboarder:main", + "osm-mon-dashboarder = osm_mon.cmd.mon_dashboarder:main", "osm-mon-healthcheck = osm_mon.cmd.mon_healthcheck:main", ] }, - dependency_links=[ - 'git+https://osm.etsi.org/gerrit/osm/common.git#egg=osm-common@v5.0', - 'git+https://osm.etsi.org/gerrit/osm/common.git#egg=n2vc@v5.0' - ], - setup_requires=['setuptools-version-command'] + setup_requires=["setuptools-version-command"], ) diff --git a/stdeb.cfg b/stdeb.cfg index cb16aaa..c6a1b3a 100644 --- a/stdeb.cfg +++ b/stdeb.cfg @@ -1,20 +1,17 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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 +# Copyright ETSI Contributors and Others. # -# http://www.apache.org/licenses/LICENSE-2.0 +# 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 # -# 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. +# 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. [DEFAULT] -X-Python3-Version : >= 3.4 -Depends3 : libssl-dev, libffi-dev, libxml2-dev, libxslt-dev, python3-pip, python3-osm-common, python3-n2vc +X-Python3-Version : >= 3.5 diff --git a/test-requirements.txt b/test-requirements.txt deleted file mode 100644 index 554e6b8..0000000 --- a/test-requirements.txt +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2017 Intel Research and Development Ireland Limited -# ************************************************************* - -# This file is part of OSM Monitoring module -# All Rights Reserved to Intel Corporation - -# 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: helena.mcgough@intel.com or adrian.hoban@intel.com -## -flake8<3.0 -mock -requests-mock -coverage==4.5.3 diff --git a/tox.ini b/tox.ini index 595b5a9..db88368 100644 --- a/tox.ini +++ b/tox.ini @@ -1,73 +1,124 @@ -# Copyright 2017 Intel Research and Development Ireland Limited -# ************************************************************* - -# This file is part of OSM Monitoring module -# All Rights Reserved to Intel Corporation - -# 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 - +####################################################################################### +# 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. - -# For those usages not covered by the Apache License, Version 2.0 please -# contact: helena.mcgough@intel.com or adrian.hoban@intel.com -## - -# Tox (http://tox.testrun.org/) is a tool for running tests -# in multiple virtualenvs. This configuration file will run the -# test suite on all supported python versions. To use it, "pip install tox" -# and then run "tox" from this directory. +# 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 = cover, py3, flake8 +envlist = black, cover, flake8, pylint, safety +[tox:jenkins] +toxworkdir = /tmp/.tox [testenv] usedevelop = True -install_command = pip install -U {opts} {packages} +basepython = python3 setenv = VIRTUAL_ENV={envdir} PYTHONDONTWRITEBYTECODE = 1 - TESTS_DIR=./osm_mon/tests/unit/ -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt +deps = -r{toxinidir}/requirements.txt + +####################################################################################### +[testenv:black] +deps = black +skip_install = true commands = - coverage erase + - black --check --diff osm_mon/ + - black --check --diff setup.py + +####################################################################################### [testenv:cover] -basepython = python3 -deps = nose2 - -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt +deps = {[testenv]deps} + -r{toxinidir}/requirements-dev.txt + -r{toxinidir}/requirements-test.txt commands = - coverage erase - nose2 -C --coverage osm_mon --plugin nose2.plugins.junitxml - 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_mon + 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 - -r{toxinidir}/requirements.txt commands = - flake8 osm_mon + flake8 osm_mon/ setup.py -[testenv:build] -basepython = python3 -deps = stdeb - setuptools-version-command -commands = python3 setup.py --command-packages=stdeb.command bdist_deb +####################################################################################### +[testenv:pylint] +deps = {[testenv]deps} + -r{toxinidir}/requirements-dev.txt + -r{toxinidir}/requirements-test.txt + pylint +commands = + pylint -E osm_mon + + +####################################################################################### +[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_mon/requirements.txt' + python3 setup.py --command-packages=stdeb.command sdist_dsc + sh -c 'cd deb_dist/osm-mon*/ && dpkg-buildpackage -rfakeroot -uc -us' + sh -c 'rm osm_mon/requirements.txt' +whitelist_externals = sh + +####################################################################################### [flake8] -# E123, E125 skipped as they are invalid PEP-8. +ignore = + W291, + W293, + W503, + E123, + E125, + E226, + E241 +exclude = + .git, + __pycache__, + .tox, max-line-length = 120 show-source = True -ignore = E123,E125,E241,W503 builtins = _ -exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,devops_stages/*,.rst