summaryrefslogtreecommitdiffstats
path: root/starlingx
diff options
context:
space:
mode:
authorHaibin Huang <haibin.huang@intel.com>2019-08-28 19:51:31 +0800
committerHaibin Huang <haibin.huang@intel.com>2019-08-29 10:22:48 +0800
commitf75e4c22cb928d11bd78f15b45b1c42098e588d4 (patch)
tree2bb6072e9890fc5874a79058be997f8bc6a51b02 /starlingx
parent3f9d312fabb805bb16e89b662d5c70efe91c6b79 (diff)
update starlingx plugin to python3
Issue-ID: MULTICLOUD-794 Signed-off-by: Haibin Huang <haibin.huang@intel.com> Change-Id: I41d11465d24ea4d15f37db2146d7a77998f535f0
Diffstat (limited to 'starlingx')
-rw-r--r--starlingx/docker/Dockerfile13
-rwxr-xr-xstarlingx/initialize.sh2
-rwxr-xr-xstarlingx/mvn-phase-script.sh2
-rw-r--r--starlingx/pom.xml13
-rw-r--r--starlingx/requirements.txt14
-rw-r--r--starlingx/starlingx/proxy/tests/test_service_proxy.py28
-rw-r--r--starlingx/starlingx/proxy/urls.py4
-rw-r--r--starlingx/starlingx/proxy/urlsV1.py4
-rw-r--r--starlingx/starlingx/registration/tests/test_registration.py20
-rw-r--r--starlingx/starlingx/registration/tests/test_registration2.py25
-rw-r--r--starlingx/starlingx/requests/urls.py4
-rw-r--r--starlingx/starlingx/requests/urlsV1.py4
-rw-r--r--starlingx/starlingx/resource/tests/test_capacity.py14
-rw-r--r--starlingx/starlingx/samples/urls.py5
-rw-r--r--starlingx/starlingx/swagger/urls.py4
-rw-r--r--starlingx/test-requirements.txt2
-rw-r--r--starlingx/tox.ini16
-rw-r--r--starlingx/uwsgi-requirements.txt2
18 files changed, 104 insertions, 72 deletions
diff --git a/starlingx/docker/Dockerfile b/starlingx/docker/Dockerfile
index 8d6e6bc9..bc169f92 100644
--- a/starlingx/docker/Dockerfile
+++ b/starlingx/docker/Dockerfile
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-FROM python:2-alpine
+FROM python:3-alpine
ARG HTTP_PROXY=${HTTP_PROXY}
ARG HTTPS_PROXY=${HTTPS_PROXY}
@@ -32,15 +32,16 @@ ENV AAI_PASSWORD "AAI"
EXPOSE 9009
RUN addgroup -S onap && adduser -S -G onap onap
-
+# COPY ./ /opt/
+COPY ./multicloud-openstack-starlingx-*.zip /opt/multicloud-openstack-starlingx.zip
RUN apk update && \
- apk add bash uwsgi curl memcached wget unzip gcc make libc-dev libffi-dev openssl-dev && \
+ apk add pcre pcre-dev uwsgi memcached wget unzip gcc make libc-dev libffi-dev openssl-dev && \
cd /opt/ && \
- wget -O /opt/multicloud-openstack-starlingx.zip "https://nexus.onap.org/service/local/artifact/maven/redirect?r=staging&g=org.onap.multicloud.openstack&a=multicloud-openstack-starlingx&e=zip&v=1.4.0" && \
unzip -q -o -B /opt/multicloud-openstack-starlingx.zip -d /opt/ && \
rm -f /opt/multicloud-openstack-starlingx.zip && \
- pip install -r /opt/starlingx/requirements.txt && \
- apk del wget unzip gcc make libc-dev libffi-dev openssl-dev && \
+ pip3 install -r /opt/starlingx/requirements.txt && \
+ pip3 install -r /opt/starlingx/uwsgi-requirements.txt && \
+ apk del wget unzip gcc make libc-dev libffi-dev openssl-dev pcre-dev && \
mkdir -p /var/log/onap/multicloud/openstack/starlingx && \
chown onap:onap /var/log/onap -R && \
chown onap:onap /opt/starlingx -R
diff --git a/starlingx/initialize.sh b/starlingx/initialize.sh
index 758d0324..fca55299 100755
--- a/starlingx/initialize.sh
+++ b/starlingx/initialize.sh
@@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-pip install -r requirements.txt
+pip3 install -r requirements.txt
diff --git a/starlingx/mvn-phase-script.sh b/starlingx/mvn-phase-script.sh
index c8d09ce0..43a4ef1e 100755
--- a/starlingx/mvn-phase-script.sh
+++ b/starlingx/mvn-phase-script.sh
@@ -53,7 +53,7 @@ run_tox_test()
DIR=$(echo "$TOXINI" | rev | cut -f2- -d'/' | rev)
cd "${CURDIR}/${DIR}"
rm -rf ./venv-tox ./.tox
- virtualenv ./venv-tox
+ virtualenv ./venv-tox --python=python3
source ./venv-tox/bin/activate
pip install --upgrade pip
pip install --upgrade tox argparse
diff --git a/starlingx/pom.xml b/starlingx/pom.xml
index db0cbdd2..b11267a0 100644
--- a/starlingx/pom.xml
+++ b/starlingx/pom.xml
@@ -125,17 +125,28 @@
<executions>
<execution>
<id>copy-resources</id>
- <phase>validate</phase>
+ <phase>install</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
+ <overwrite>true</overwrite>
+ <nonFilteredFileExtensions>
+ <nonFilteredFileExtension>zip</nonFilteredFileExtension>
+ </nonFilteredFileExtensions>
<outputDirectory>${project.basedir}/docker_target</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/docker</directory>
<filtering>true</filtering>
</resource>
+ <resource>
+ <directory>${project.basedir}/target</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>*.zip</include>
+ </includes>
+ </resource>
</resources>
</configuration>
</execution>
diff --git a/starlingx/requirements.txt b/starlingx/requirements.txt
index c016f77f..854d64b9 100644
--- a/starlingx/requirements.txt
+++ b/starlingx/requirements.txt
@@ -13,20 +13,20 @@
# limitations under the License.
# rest framework
-Django==1.9.6
-djangorestframework==3.3.3
+Django==2.2.3
+djangorestframework==3.9.4
# for call rest api
-httplib2==0.9.2
+httplib2==0.13.0
# for call openstack auth and transport api
keystoneauth1==2.18.0
-#python-memcached
+# python-memcached
python-memcached
-#uwsgi for parallel processing
-uwsgi
+# uwsgi for parallel processing
+# uwsgi
# for unit test
# coverage==4.2
@@ -34,4 +34,4 @@ uwsgi
# unittest_xml_reporting==1.12.0
# for onap logging
-onappylog>=1.0.8
+onappylog>=1.0.9
diff --git a/starlingx/starlingx/proxy/tests/test_service_proxy.py b/starlingx/starlingx/proxy/tests/test_service_proxy.py
index 858fbeec..5d38f44e 100644
--- a/starlingx/starlingx/proxy/tests/test_service_proxy.py
+++ b/starlingx/starlingx/proxy/tests/test_service_proxy.py
@@ -718,12 +718,12 @@ class TestServiceProxy(unittest.TestCase):
response = self.client.head(
"/api/multicloud-starlingx/v0/starlingx_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers",
{}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_200_OK, response.status_code)
+ self.assertEqual(status.HTTP_200_OK, response.status_code)
def test_unauthorized_access(self):
response = self.client.get(
"/api/multicloud-starlingx/v0/starlingx_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers")
- self.assertEquals(status.HTTP_403_FORBIDDEN, response.status_code)
+ self.assertEqual(status.HTTP_403_FORBIDDEN, response.status_code)
@mock.patch.object(VimDriverUtils, 'get_vim_info')
def test_expired_auth_token(self, mock_get_vim_info):
@@ -732,7 +732,7 @@ class TestServiceProxy(unittest.TestCase):
response = self.client.get(
"/api/multicloud-starlingx/v0/starlingx_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers",
{}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_403_FORBIDDEN, response.status_code)
+ self.assertEqual(status.HTTP_403_FORBIDDEN, response.status_code)
@mock.patch.object(VimDriverUtils, 'get_token_cache')
@mock.patch.object(VimDriverUtils, 'get_vim_info')
@@ -744,14 +744,14 @@ class TestServiceProxy(unittest.TestCase):
url_part3 = "/v2.1/fcca3cc49d5e42caae15459e27103efc/servers"
url = (url_part1 + servicetype + url_part3)
response = self.client.get(url, {}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_500_INTERNAL_SERVER_ERROR, response.status_code)
+ self.assertEqual(status.HTTP_500_INTERNAL_SERVER_ERROR, response.status_code)
metadata_catalog = copy.deepcopy(MOCK_INTERNAL_METADATA_CATALOG)
metadata_catalog[servicetype] = None
mock_get_token_cache.return_value = (json.dumps(MOCK_AUTH_STATE), json.dumps(metadata_catalog))
response = self.client.get(url, {}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_500_INTERNAL_SERVER_ERROR, response.status_code)
+ self.assertEqual(status.HTTP_500_INTERNAL_SERVER_ERROR, response.status_code)
metadata_catalog = copy.deepcopy(MOCK_INTERNAL_METADATA_CATALOG)
metadata_catalog[servicetype]['prefix'] = None
@@ -759,7 +759,7 @@ class TestServiceProxy(unittest.TestCase):
mock_get_token_cache.return_value = (json.dumps(MOCK_AUTH_STATE), json.dumps(metadata_catalog))
response = self.client.get(url, {}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_500_INTERNAL_SERVER_ERROR, response.status_code)
+ self.assertEqual(status.HTTP_500_INTERNAL_SERVER_ERROR, response.status_code)
@mock.patch.object(VimDriverUtils, 'get_vim_info')
@mock.patch.object(VimDriverUtils, 'get_session')
@@ -818,29 +818,29 @@ class TestServiceProxy(unittest.TestCase):
"/api/multicloud-starlingx/v0/starlingx_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers",
MOCK_POST_SERVER_REQUEST, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_202_ACCEPTED, response.status_code)
+ self.assertEqual(status.HTTP_202_ACCEPTED, response.status_code)
context = response.json()
- self.assertEquals(MOCK_TOKEN_ID, response['X-Subject-Token'])
+ self.assertEqual(MOCK_TOKEN_ID, response['X-Subject-Token'])
self.assertIsNotNone(context['server'])
# Retrieve resource
response = self.client.get(
"/api/multicloud-starlingx/v0/starlingx_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers",
{}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_200_OK, response.status_code)
+ self.assertEqual(status.HTTP_200_OK, response.status_code)
context = response.json()
- self.assertEquals(MOCK_TOKEN_ID, response['X-Subject-Token'])
+ self.assertEqual(MOCK_TOKEN_ID, response['X-Subject-Token'])
self.assertIsNotNone(context['servers'])
# Update resource
response = self.client.get(
"/api/multicloud-starlingx/v0/starlingx_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers",
{}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_200_OK, response.status_code)
+ self.assertEqual(status.HTTP_200_OK, response.status_code)
context = response.json()
- self.assertEquals(MOCK_TOKEN_ID, response['X-Subject-Token'])
+ self.assertEqual(MOCK_TOKEN_ID, response['X-Subject-Token'])
self.assertIsNotNone(context['servers'])
# simulate client to make the request
@@ -848,5 +848,5 @@ class TestServiceProxy(unittest.TestCase):
"/api/multicloud-starlingx/v0/starlingx_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers/324dfb7d-f4a9-419a-9a19-237df04b443b",
HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_204_NO_CONTENT, response.status_code)
- self.assertEquals(MOCK_TOKEN_ID, response['X-Subject-Token'])
+ self.assertEqual(status.HTTP_204_NO_CONTENT, response.status_code)
+ self.assertEqual(MOCK_TOKEN_ID, response['X-Subject-Token'])
diff --git a/starlingx/starlingx/proxy/urls.py b/starlingx/starlingx/proxy/urls.py
index 7fee0927..cde9e2b2 100644
--- a/starlingx/starlingx/proxy/urls.py
+++ b/starlingx/starlingx/proxy/urls.py
@@ -19,7 +19,7 @@ from starlingx.proxy.views import identityV3
from starlingx.proxy.views import services
from newton_base.proxy import dnsaasdelegate
-urlpatterns = [
+URLPATTERNS = [
# url(r'^identity/v2)$',
# identityV2.Tokens.as_view()),
url(r'^identity/v3/auth/tokens/?$',
@@ -38,4 +38,4 @@ urlpatterns = [
services.Services.as_view()),
]
-urlpatterns = format_suffix_patterns(urlpatterns)
+urlpatterns = format_suffix_patterns(URLPATTERNS)
diff --git a/starlingx/starlingx/proxy/urlsV1.py b/starlingx/starlingx/proxy/urlsV1.py
index 0009b7fb..7fca18e1 100644
--- a/starlingx/starlingx/proxy/urlsV1.py
+++ b/starlingx/starlingx/proxy/urlsV1.py
@@ -19,7 +19,7 @@ from starlingx.proxy.views import identityV3
from starlingx.proxy.views import services
from newton_base.proxy import dnsaasdelegate
-urlpatterns = [
+URLPATTERNS = [
url(r'^identity/v3/auth/tokens/?$',
identityV3.APIv1Tokens.as_view()),
url(r'^identity/v3/?$',
@@ -36,4 +36,4 @@ urlpatterns = [
services.APIv1Services.as_view()),
]
-urlpatterns = format_suffix_patterns(urlpatterns)
+urlpatterns = format_suffix_patterns(URLPATTERNS)
diff --git a/starlingx/starlingx/registration/tests/test_registration.py b/starlingx/starlingx/registration/tests/test_registration.py
index d4af22b6..4f76880a 100644
--- a/starlingx/starlingx/registration/tests/test_registration.py
+++ b/starlingx/starlingx/registration/tests/test_registration.py
@@ -245,7 +245,7 @@ class TestRegistration(test_base.TestRequest):
"registry"), TEST_REGISTER_ENDPOINT_REQUEST,
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_202_ACCEPTED,
+ self.assertEqual(status.HTTP_202_ACCEPTED,
response.status_code)
# @mock.patch.object(VimDriverUtils, 'delete_vim_info')
@@ -258,7 +258,7 @@ class TestRegistration(test_base.TestRequest):
# "registry"), "{}", content_type="application/json",
# HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
- # self.assertEquals(status.HTTP_202_ACCEPTED,
+ # self.assertEqual(status.HTTP_202_ACCEPTED,
# response.status_code)
@mock.patch.object(VimDriverUtils, 'delete_vim_info')
@@ -271,7 +271,7 @@ class TestRegistration(test_base.TestRequest):
"registry"), "{}", content_type="application/json",
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_204_NO_CONTENT,
+ self.assertEqual(status.HTTP_204_NO_CONTENT,
response.status_code)
@mock.patch.object(VimDriverUtils, 'get_session')
@@ -301,7 +301,7 @@ class TestRegistration(test_base.TestRequest):
"registry"), TEST_REGISTER_ENDPOINT_REQUEST,
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_202_ACCEPTED,
+ self.assertEqual(status.HTTP_202_ACCEPTED,
response.status_code)
@mock.patch.object(VimDriverUtils, 'get_session')
@@ -331,7 +331,7 @@ class TestRegistration(test_base.TestRequest):
"registry"), TEST_REGISTER_ENDPOINT_REQUEST,
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_202_ACCEPTED,
+ self.assertEqual(status.HTTP_202_ACCEPTED,
response.status_code)
@mock.patch.object(VimDriverUtils, 'get_session')
@@ -361,7 +361,7 @@ class TestRegistration(test_base.TestRequest):
"registry"), TEST_REGISTER_ENDPOINT_REQUEST,
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_202_ACCEPTED,
+ self.assertEqual(status.HTTP_202_ACCEPTED,
response.status_code)
@mock.patch.object(VimDriverUtils, 'get_session')
@@ -391,7 +391,7 @@ class TestRegistration(test_base.TestRequest):
"registry"), TEST_REGISTER_ENDPOINT_REQUEST,
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_202_ACCEPTED,
+ self.assertEqual(status.HTTP_202_ACCEPTED,
response.status_code)
@mock.patch.object(VimDriverUtils, 'get_session')
@@ -421,7 +421,7 @@ class TestRegistration(test_base.TestRequest):
"registry"), TEST_REGISTER_ENDPOINT_REQUEST,
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_202_ACCEPTED,
+ self.assertEqual(status.HTTP_202_ACCEPTED,
response.status_code)
@mock.patch.object(VimDriverUtils, 'get_session')
@@ -451,7 +451,7 @@ class TestRegistration(test_base.TestRequest):
"registry"), TEST_REGISTER_ENDPOINT_REQUEST,
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_202_ACCEPTED,
+ self.assertEqual(status.HTTP_202_ACCEPTED,
response.status_code)
@mock.patch.object(VimDriverUtils, 'get_session')
@@ -481,5 +481,5 @@ class TestRegistration(test_base.TestRequest):
"registry"), TEST_REGISTER_ENDPOINT_REQUEST,
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_202_ACCEPTED,
+ self.assertEqual(status.HTTP_202_ACCEPTED,
response.status_code)
diff --git a/starlingx/starlingx/registration/tests/test_registration2.py b/starlingx/starlingx/registration/tests/test_registration2.py
index d2084ecf..f2ba80c5 100644
--- a/starlingx/starlingx/registration/tests/test_registration2.py
+++ b/starlingx/starlingx/registration/tests/test_registration2.py
@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import mock
+# import mock
import unittest
+from unittest import mock
from django.test import Client
from rest_framework import status
from common.utils import restcall
@@ -83,29 +84,33 @@ class TestRegistration2(unittest.TestCase):
restcall.req_to_aai = mock.Mock()
restcall.req_to_aai.return_value = (0, {}, status.HTTP_200_OK)
mock_session = test_base.get_mock_session(
- ["get"], {"get": {
- "content": MOCK_GET_FLAVOR_RESPONSE}}),
+ ["get"], {
+ "side_effect": [
+ test_base.get_mock_response(MOCK_GET_FLAVOR_RESPONSE)
+ ]
+ })
retcode, content = self.view.register_helper._discover_flavors(
vimid="starlingx_RegionOne",
session=mock_session, viminfo=MOCK_VIM_INFO
)
- self.assertEquals(retcode, 11)
+ self.assertEqual(retcode, 0)
def test_discover_flavors_w_hpa_numa(self):
restcall.req_to_aai = mock.Mock()
restcall.req_to_aai.return_value = (0, {}, status.HTTP_200_OK)
mock_session = test_base.get_mock_session(
- ["get"], {"side_effect": [{
- "content": MOCK_GET_FLAVOR_RESPONSE_w_hpa_numa},
- {
- "content": MOCK_GET_FLAVOR_EXTRASPECS_RESPONSE_w_hpa_numa}
- ]}),
+ ["get"], {
+ "side_effect": [
+ test_base.get_mock_response(MOCK_GET_FLAVOR_RESPONSE_w_hpa_numa),
+ test_base.get_mock_response(MOCK_GET_FLAVOR_EXTRASPECS_RESPONSE_w_hpa_numa),
+ ]
+ }),
retcode, content = self.view.register_helper._discover_flavors(
vimid="starlingx_RegionOne",
session=mock_session, viminfo=MOCK_VIM_INFO
)
- self.assertEquals(retcode, 11)
+ self.assertEqual(retcode, 11)
diff --git a/starlingx/starlingx/requests/urls.py b/starlingx/starlingx/requests/urls.py
index fbd088e3..30685740 100644
--- a/starlingx/starlingx/requests/urls.py
+++ b/starlingx/starlingx/requests/urls.py
@@ -25,7 +25,7 @@ from newton_base.openoapi import limits
from newton_base.openoapi import hosts
from newton_base.openoapi import flavor
-urlpatterns = [
+URLPATTERNS = [
url(r'^networks(/(?P<networkid>[0-9a-zA-Z_-]+))?',
network.Networks.as_view()),
url(r'^subnets(/(?P<subnetid>[0-9a-zA-Z_-]+))?',
@@ -46,4 +46,4 @@ urlpatterns = [
url(r'^hosts(/(?P<hostname>[0-9a-zA-Z_-]+))?', hosts.Hosts.as_view()),
]
-urlpatterns = format_suffix_patterns(urlpatterns)
+urlpatterns = format_suffix_patterns(URLPATTERNS)
diff --git a/starlingx/starlingx/requests/urlsV1.py b/starlingx/starlingx/requests/urlsV1.py
index 1318e82b..d7885172 100644
--- a/starlingx/starlingx/requests/urlsV1.py
+++ b/starlingx/starlingx/requests/urlsV1.py
@@ -25,7 +25,7 @@ from newton_base.openoapi import limits
from newton_base.openoapi import hosts
from newton_base.openoapi import flavor
-urlpatterns = [
+URLPATTERNS = [
url(r'^networks(/(?P<networkid>[0-9a-zA-Z_-]+))?',
network.APIv1Networks.as_view()),
url(r'^subnets(/(?P<subnetid>[0-9a-zA-Z_-]+))?',
@@ -46,4 +46,4 @@ urlpatterns = [
url(r'^hosts(/(?P<hostname>[0-9a-zA-Z_-]+))?', hosts.APIv1Hosts.as_view()),
]
-urlpatterns = format_suffix_patterns(urlpatterns)
+urlpatterns = format_suffix_patterns(URLPATTERNS)
diff --git a/starlingx/starlingx/resource/tests/test_capacity.py b/starlingx/starlingx/resource/tests/test_capacity.py
index ee30985f..22340aa4 100644
--- a/starlingx/starlingx/resource/tests/test_capacity.py
+++ b/starlingx/starlingx/resource/tests/test_capacity.py
@@ -142,7 +142,7 @@ class TestCapacity(test_base.TestRequest):
TEST_REQ_SUCCESS_SOURCE,
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_200_OK, response.status_code)
+ self.assertEqual(status.HTTP_200_OK, response.status_code)
self.assertEqual({'AZs': [], "result": True}, response.data)
@mock.patch.object(VimDriverUtils, 'get_session')
@@ -163,7 +163,7 @@ class TestCapacity(test_base.TestRequest):
TEST_REQ_FAILED_SOURCE,
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_200_OK, response.status_code)
+ self.assertEqual(status.HTTP_200_OK, response.status_code)
self.assertEqual({'AZs': [], "result": False}, response.data)
@mock.patch.object(VimDriverUtils, 'get_session')
@@ -185,7 +185,7 @@ class TestCapacity(test_base.TestRequest):
content_type='application/json',
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_200_OK, response.status_code)
+ self.assertEqual(status.HTTP_200_OK, response.status_code)
self.assertEqual({'AZs': [], "result": False}, response.data)
@mock.patch.object(VimDriverUtils, 'get_session')
@@ -207,7 +207,7 @@ class TestCapacity(test_base.TestRequest):
content_type='application/json',
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_200_OK, response.status_code)
+ self.assertEqual(status.HTTP_200_OK, response.status_code)
self.assertEqual({'AZs': [], "result": False}, response.data)
@mock.patch.object(VimDriverUtils, 'get_session')
@@ -229,7 +229,7 @@ class TestCapacity(test_base.TestRequest):
content_type='application/json',
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_200_OK, response.status_code)
+ self.assertEqual(status.HTTP_200_OK, response.status_code)
self.assertEqual({'AZs': [], "result": False}, response.data)
@mock.patch.object(VimDriverUtils, 'get_session')
@@ -251,7 +251,7 @@ class TestCapacity(test_base.TestRequest):
content_type='application/json',
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_200_OK, response.status_code)
+ self.assertEqual(status.HTTP_200_OK, response.status_code)
self.assertEqual({'AZs': [], "result": False}, response.data)
@mock.patch.object(VimDriverUtils, 'get_session')
@@ -273,5 +273,5 @@ class TestCapacity(test_base.TestRequest):
content_type='application/json',
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_200_OK, response.status_code)
+ self.assertEqual(status.HTTP_200_OK, response.status_code)
self.assertEqual({'AZs': [], "result": False}, response.data)
diff --git a/starlingx/starlingx/samples/urls.py b/starlingx/starlingx/samples/urls.py
index 5df38ed1..4eafa013 100644
--- a/starlingx/starlingx/samples/urls.py
+++ b/starlingx/starlingx/samples/urls.py
@@ -13,7 +13,10 @@
# limitations under the License.
from django.conf.urls import url
+from rest_framework.urlpatterns import format_suffix_patterns
from starlingx.samples import views
-urlpatterns = [
+URLPATTERNS = [
url(r'^samples/$', views.SampleList.as_view()), ]
+
+urlpatterns = format_suffix_patterns(URLPATTERNS)
diff --git a/starlingx/starlingx/swagger/urls.py b/starlingx/starlingx/swagger/urls.py
index da518866..3f1bc2e8 100644
--- a/starlingx/starlingx/swagger/urls.py
+++ b/starlingx/starlingx/swagger/urls.py
@@ -18,9 +18,9 @@ from rest_framework.urlpatterns import format_suffix_patterns
from starlingx.swagger.views import SwaggerJsonView
from starlingx.swagger.views import APIv1SwaggerJsonView
-urlpatterns = [
+URLPATTERNS = [
url(r'^api/multicloud-starlingx/v0/swagger.json$', SwaggerJsonView.as_view()),
url(r'^api/multicloud-starlingx/v1/swagger.json$', APIv1SwaggerJsonView.as_view()),
]
-urlpatterns = format_suffix_patterns(urlpatterns)
+urlpatterns = format_suffix_patterns(URLPATTERNS)
diff --git a/starlingx/test-requirements.txt b/starlingx/test-requirements.txt
index cc3059e2..d91d31db 100644
--- a/starlingx/test-requirements.txt
+++ b/starlingx/test-requirements.txt
@@ -1,6 +1,6 @@
# for unit test
coverage==4.2
-mock==2.0.0
+mock==3.0.5
unittest_xml_reporting==1.12.0
pylint # GPLv2
diff --git a/starlingx/tox.ini b/starlingx/tox.ini
index 78dc9675..72c4b46d 100644
--- a/starlingx/tox.ini
+++ b/starlingx/tox.ini
@@ -13,7 +13,7 @@
# limitations under the License.
[tox]
-envlist = py27,pep8,cov
+envlist = py36,cov,pylint
skipsdist = true
[tox:jenkins]
@@ -25,6 +25,10 @@ exclude = ./venv-tox,./.tox
max-complexity = 27
[testenv]
+basepython =
+ py36: python3
+ cov: python3
+ pylint: python3
setenv =
PYTHONPATH = {toxinidir}/../share
deps =
@@ -36,8 +40,14 @@ commands =
[testenv:pep8]
deps=flake8
-commands=flake8
+commands=python3 -m flake8
[testenv:cov]
-commands = coverage xml --omit="./venv-tox/*,./.tox/*,*tests*,*__init__.py,*newton_base*,*starlingx_base*,*common*, *site-packages*"
+commands = coverage xml --omit="./venv-tox/*,./.tox/*,*tests*,*__init__.py,*newton_base*,*common*,*starlingx_base* *site-packages*"
+
+[testenv:pylint]
+whitelist_externals = bash
+commands =
+ bash -c "\
+ pylint -f parseable --reports=y starlingx | tee pylint.out"
diff --git a/starlingx/uwsgi-requirements.txt b/starlingx/uwsgi-requirements.txt
new file mode 100644
index 00000000..5b24077b
--- /dev/null
+++ b/starlingx/uwsgi-requirements.txt
@@ -0,0 +1,2 @@
+# uwsgi for parallel processing
+uwsgi \ No newline at end of file