summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHaibin Huang <haibin.huang@intel.com>2019-01-28 14:00:38 +0800
committerHaibin Huang <haibin.huang@intel.com>2019-01-28 15:46:05 +0800
commitf2138cc59231602b31e60a3b9f39cc59a1860892 (patch)
tree8b0eeff773d46b498fe371faa072c783621b663a
parentbfa1edf6c3838a710ceedc27a7aef83ebbe4529d (diff)
Extract some code to share
Change-Id: I6dffc1bf47c5839f077f3c7f93f021ed0b414d24 Issue-ID: MULTICLOUD-428 Signed-off-by: Haibin Huang <haibin.huang@intel.com>
-rw-r--r--share/newton_base/resource/__init__.py10
-rw-r--r--share/newton_base/resource/capacity.py (renamed from windriver/titanium_cloud/resource/views/capacity.py)4
-rw-r--r--share/newton_base/resource/infra_workload.py (renamed from windriver/titanium_cloud/resource/views/infra_workload.py)0
-rw-r--r--share/starlingx_base/__init__.py (renamed from windriver/titanium_cloud/registration/views/__init__.py)0
-rw-r--r--share/starlingx_base/registration/__init__.py (renamed from windriver/titanium_cloud/resource/views/__init__.py)0
-rw-r--r--share/starlingx_base/registration/registration.py (renamed from windriver/titanium_cloud/registration/views/registration.py)1
-rw-r--r--windriver/titanium_cloud/pub/config/log.yml4
-rw-r--r--windriver/titanium_cloud/registration/tests/test_registration2.py11
-rw-r--r--windriver/titanium_cloud/resource/tests/tests_infra_workload.py6
-rw-r--r--windriver/titanium_cloud/urls.py6
-rw-r--r--windriver/tox.ini2
11 files changed, 21 insertions, 23 deletions
diff --git a/share/newton_base/resource/__init__.py b/share/newton_base/resource/__init__.py
new file mode 100644
index 00000000..387c54c2
--- /dev/null
+++ b/share/newton_base/resource/__init__.py
@@ -0,0 +1,10 @@
+# Copyright (c) 2017-2018 Wind River Systems, Inc.
+#
+# 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.
diff --git a/windriver/titanium_cloud/resource/views/capacity.py b/share/newton_base/resource/capacity.py
index 669cb659..1a08b9a5 100644
--- a/windriver/titanium_cloud/resource/views/capacity.py
+++ b/share/newton_base/resource/capacity.py
@@ -13,12 +13,8 @@
# limitations under the License.
import logging
-# import json
import traceback
-# from rest_framework import status
-
-# from django.conf import settings
from common.exceptions import VimDriverNewtonException
from newton_base.util import VimDriverUtils
diff --git a/windriver/titanium_cloud/resource/views/infra_workload.py b/share/newton_base/resource/infra_workload.py
index 74c187fe..74c187fe 100644
--- a/windriver/titanium_cloud/resource/views/infra_workload.py
+++ b/share/newton_base/resource/infra_workload.py
diff --git a/windriver/titanium_cloud/registration/views/__init__.py b/share/starlingx_base/__init__.py
index ae1ce9db..ae1ce9db 100644
--- a/windriver/titanium_cloud/registration/views/__init__.py
+++ b/share/starlingx_base/__init__.py
diff --git a/windriver/titanium_cloud/resource/views/__init__.py b/share/starlingx_base/registration/__init__.py
index ae1ce9db..ae1ce9db 100644
--- a/windriver/titanium_cloud/resource/views/__init__.py
+++ b/share/starlingx_base/registration/__init__.py
diff --git a/windriver/titanium_cloud/registration/views/registration.py b/share/starlingx_base/registration/registration.py
index 17992af7..e07dda85 100644
--- a/windriver/titanium_cloud/registration/views/registration.py
+++ b/share/starlingx_base/registration/registration.py
@@ -20,7 +20,6 @@ import traceback
from django.conf import settings
from newton_base.registration import registration as newton_registration
-# from common.exceptions import VimDriverNewtonException
from rest_framework import status
from rest_framework.response import Response
from common.msapi import extsys
diff --git a/windriver/titanium_cloud/pub/config/log.yml b/windriver/titanium_cloud/pub/config/log.yml
index 5cf448d4..ca3a5497 100644
--- a/windriver/titanium_cloud/pub/config/log.yml
+++ b/windriver/titanium_cloud/pub/config/log.yml
@@ -14,6 +14,10 @@ loggers:
handlers: [titanium_cloud_handler]
level: "DEBUG"
propagate: False
+ starlingx_base:
+ handlers: [titanium_cloud_handler]
+ level: "DEBUG"
+ propagate: False
handlers:
titanium_cloud_handler:
level: "DEBUG"
diff --git a/windriver/titanium_cloud/registration/tests/test_registration2.py b/windriver/titanium_cloud/registration/tests/test_registration2.py
index 9f0cd4d2..840f982f 100644
--- a/windriver/titanium_cloud/registration/tests/test_registration2.py
+++ b/windriver/titanium_cloud/registration/tests/test_registration2.py
@@ -18,17 +18,8 @@ import unittest
# import json
from django.test import Client
from rest_framework import status
-
-# from django.core.cache import cache
-# from common.msapi import extsys
-
from common.utils import restcall
-# from newton_base.tests import mock_info
-# from newton_base.tests import test_base
-# from newton_base.util import VimDriverUtils
-
-# from newton_base.registration import registration as newton_registration
-from titanium_cloud.registration.views import registration
+from starlingx_base.registration import registration
from newton_base.tests import test_base
MOCK_VIM_INFO = {
diff --git a/windriver/titanium_cloud/resource/tests/tests_infra_workload.py b/windriver/titanium_cloud/resource/tests/tests_infra_workload.py
index c6991837..cd8fe558 100644
--- a/windriver/titanium_cloud/resource/tests/tests_infra_workload.py
+++ b/windriver/titanium_cloud/resource/tests/tests_infra_workload.py
@@ -15,13 +15,11 @@
import mock
import unittest
-# import json
from rest_framework import status
-# from common.utils import restcall
from common.msapi.helper import Helper as helper
-from titanium_cloud.resource.views.infra_workload import InfraWorkload
-from titanium_cloud.resource.views.infra_workload import APIv1InfraWorkload
+from newton_base.resource.infra_workload import InfraWorkload
+from newton_base.resource.infra_workload import APIv1InfraWorkload
MOCK_TOKEN_RESPONSE = {
"access":
diff --git a/windriver/titanium_cloud/urls.py b/windriver/titanium_cloud/urls.py
index e953140e..f4adc10b 100644
--- a/windriver/titanium_cloud/urls.py
+++ b/windriver/titanium_cloud/urls.py
@@ -14,11 +14,11 @@
from django.conf.urls import include, url
-from titanium_cloud.registration.views import registration
+from starlingx_base.registration import registration
from newton_base.openoapi import tenants
-from titanium_cloud.resource.views import capacity
+from newton_base.resource import capacity
from titanium_cloud.vesagent import vesagent_ctrl
-from titanium_cloud.resource.views import infra_workload
+from newton_base.resource import infra_workload
urlpatterns = [
url(r'^', include('titanium_cloud.swagger.urls')),
diff --git a/windriver/tox.ini b/windriver/tox.ini
index 113f9c1b..dd34e479 100644
--- a/windriver/tox.ini
+++ b/windriver/tox.ini
@@ -16,7 +16,7 @@ setenv =
deps = -r{toxinidir}/requirements.txt
commands =
coverage run --branch manage.py test titanium_cloud
- coverage report --omit="./venv-tox/*,./.tox/*,*tests*,*__init__.py,*newton_base*,*common*" --fail-under=30
+ coverage report --omit="./venv-tox/*,./.tox/*,*tests*,*__init__.py,*newton_base*,*common*,*starlingx_base*" --fail-under=30
[testenv:pep8]
deps=flake8