Pip standerdization and tox replacement
Change-Id: Ic8e6495c9c0a4b46e876fb9f2f8376b7c210f545
Signed-off-by: sousaedu <eduardo.sousa@canonical.com>
diff --git a/NG-RO/MANIFEST.in b/NG-RO/MANIFEST.in
index b774a75..04f621c 100644
--- a/NG-RO/MANIFEST.in
+++ b/NG-RO/MANIFEST.in
@@ -13,5 +13,5 @@
#
##
-recursive-include osm_ng_ro *.py *.sh *.cfg *.yml
+recursive-include osm_ng_ro *.py *.sh *.cfg *.yml *.txt
recursive-include osm_ng_ro/html_public *
diff --git a/NG-RO/debian/python3-osm-ng-ro.postinst b/NG-RO/debian/python3-osm-ng-ro.postinst
deleted file mode 100755
index 87416ac..0000000
--- a/NG-RO/debian/python3-osm-ng-ro.postinst
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/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-RO-NG"
-echo "Installing python dependencies via pip..."
-
-# python3 -m pip install -U pip
-python3 -m pip install -U "cherrypy==18.1.2" "cryptography>=2.5"
diff --git a/NG-RO/osm_ng_ro/__init__.py b/NG-RO/osm_ng_ro/__init__.py
index 3f15629..2995bad 100644
--- a/NG-RO/osm_ng_ro/__init__.py
+++ b/NG-RO/osm_ng_ro/__init__.py
@@ -1,15 +1,18 @@
-##
-# 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
+#!/usr/bin/env python3
+# 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
+#
+# 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.
##
version = "8.0.1.post0"
diff --git a/NG-RO/osm_ng_ro/ns.py b/NG-RO/osm_ng_ro/ns.py
index e62eef5..9841852 100644
--- a/NG-RO/osm_ng_ro/ns.py
+++ b/NG-RO/osm_ng_ro/ns.py
@@ -687,9 +687,7 @@
"dhcp_start_address": ip_profile.get("dhcp-params", {}).get(
"start-address", None
),
- "dhcp_count": ip_profile.get("dhcp-params", {}).get(
- "count", None
- ),
+ "dhcp_count": ip_profile.get("dhcp-params", {}).get("count", None),
}
if ip_profile.get("dns-server"):
@@ -787,13 +785,13 @@
extra_dict["depends_on"].append(net_text)
if "port-security-enabled" in interface:
- interface["port_security"] = (
- interface.pop("port-security-enabled")
+ interface["port_security"] = interface.pop(
+ "port-security-enabled"
)
if "port-security-disable-strategy" in interface:
- interface["port_security_disable_strategy"] = (
- interface.pop("port-security-disable-strategy")
+ interface["port_security_disable_strategy"] = interface.pop(
+ "port-security-disable-strategy"
)
net_item = {
diff --git a/NG-RO/Makefile b/NG-RO/osm_ng_ro/tests/__init__.py
similarity index 61%
rename from NG-RO/Makefile
rename to NG-RO/osm_ng_ro/tests/__init__.py
index ee09e5c..04f7d49 100644
--- a/NG-RO/Makefile
+++ b/NG-RO/osm_ng_ro/tests/__init__.py
@@ -1,4 +1,5 @@
-# Copyright 2020 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.
@@ -12,13 +13,4 @@
# 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_ng_ro-*.tar.gz osm_ng_ro.egg-info .eggs .temp-tox
-
-package:
- python3 setup.py --command-packages=stdeb.command sdist_dsc
- cp debian/python3-osm-ng-ro.postinst deb_dist/osm-ng-ro*/debian
- cd deb_dist/osm-ng-ro*/ && dpkg-buildpackage -rfakeroot -uc -us
+#######################################################################################
diff --git a/NG-RO/requirements.txt b/NG-RO/requirements.txt
deleted file mode 100644
index c9d56cb..0000000
--- a/NG-RO/requirements.txt
+++ /dev/null
@@ -1,21 +0,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.
-##
-
-PyYAML
-CherryPy==18.1.2
-osm-common @ git+https://osm.etsi.org/gerrit/osm/common.git#egg=osm-common
-requests
-cryptography
-osm-ro-plugin @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin
-logutils
diff --git a/NG-RO/setup.py b/NG-RO/setup.py
index 31c3b35..4661386 100644
--- a/NG-RO/setup.py
+++ b/NG-RO/setup.py
@@ -19,31 +19,29 @@
from setuptools import setup, find_packages
_name = "osm_ng_ro"
+_version_command = ("git describe --match v* --tags --long --dirty", "pep440-git-full")
+_description = "OSM Resource Orchestrator"
+_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/RO.git;a=summary"
+
_readme = "osm-ng-ro is the New Generation Resource Orchestrator for OSM"
+
setup(
name=_name,
- description="OSM Resource Orchestrator",
+ description=_description,
long_description=_readme,
- version_command=(
- "git describe --match v* --tags --long --dirty",
- "pep440-git-full",
- ),
- author="ETSI OSM",
- author_email="alfonso.tiernosepulveda@telefonica.com",
- maintainer="Alfonso Tierno",
- maintainer_email="alfonso.tiernosepulveda@telefonica.com",
- url="https://osm.etsi.org/gitweb/?p=osm/RO.git;a=summary",
- license="Apache 2.0",
+ version_command=_version_command,
+ author=_author,
+ author_email=_author_email,
+ maintainer=_maintainer,
+ maintainer_email=_maintainer_email,
+ url=_url,
+ license=_license,
packages=find_packages(exclude=["temp", "local"]),
include_package_data=True,
- install_requires=[
- "CherryPy==18.1.2",
- "osm-common @ git+https://osm.etsi.org/gerrit/osm/common.git#egg=osm-common",
- "jsonschema",
- "PyYAML",
- "requests",
- "cryptography", # >=2.5 installed right version with the debian post-install script
- "osm-ro-plugin @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin",
- ],
setup_requires=["setuptools-version-command"],
)
diff --git a/NG-RO/stdeb.cfg b/NG-RO/stdeb.cfg
index d111b74..074f69a 100644
--- a/NG-RO/stdeb.cfg
+++ b/NG-RO/stdeb.cfg
@@ -12,5 +12,3 @@
[DEFAULT]
X-Python3-Version : >= 3.5
-Depends3 : python3-osm-common, python3-cherrypy3, python3-yaml, python3-jsonschema,
- python3-pip, python3-requests, python3-osm-ro-plugin
diff --git a/NG-RO/tox.ini b/NG-RO/tox.ini
deleted file mode 100644
index fe01272..0000000
--- a/NG-RO/tox.ini
+++ /dev/null
@@ -1,33 +0,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.
-
-[tox]
-envlist = flake8
-toxworkdir={toxinidir}/../.tox
-
-[testenv]
-usedevelop = True
-basepython = python3
-install_command = python3 -m pip install -r requirements.txt -U {opts} {packages}
-
-[testenv:flake8]
-basepython = python3
-deps = flake8
-commands = flake8 osm_ng_ro --max-line-length 120 \
- --exclude .svn,CVS,.gz,.git,__pycache__,.tox,local,temp,osm_im --ignore W291,W293,W503,W605,E123,E125,E203,E226,E241
-
-[testenv:build]
-basepython = python3
-deps = stdeb
- setuptools-version-command
-commands = python3 setup.py --command-packages=stdeb.command bdist_deb