summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-09-21 13:29:17 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-09-21 13:29:17 +0800
commitb0cf17c59949c0e274bf29695fb97f094fbacd94 (patch)
tree10862866296b71b85b8e134730b2152787ed365b
parentd49f6fa19f00206060dbd1b942ebfe5811075036 (diff)
Modify vnfmgr code according to PEP8 standard
Change-Id: I31393f8180e126d5628c917a2f447bb0b85a00e6 Issue-ID: VFC-408 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r--mgr/.gitreview2
-rwxr-xr-xmgr/initialize.sh1
-rw-r--r--mgr/mgr/pub/config/config.py1
-rw-r--r--mgr/mgr/pub/database/models.py3
-rw-r--r--mgr/mgr/samples/tests.py3
-rw-r--r--mgr/mgr/samples/views.py3
-rw-r--r--mgr/mgr/swagger/tests.py3
-rw-r--r--mgr/mgr/swagger/urls.py2
-rw-r--r--mgr/mgr/swagger/views.py4
-rw-r--r--mgr/mgr/vnfreg/urls.py1
-rw-r--r--mgr/mgr/vnfreg/views.py5
-rw-r--r--mgr/mgr/wsgi.py1
12 files changed, 9 insertions, 20 deletions
diff --git a/mgr/.gitreview b/mgr/.gitreview
index 212b3df..9850d37 100644
--- a/mgr/.gitreview
+++ b/mgr/.gitreview
@@ -1,4 +1,4 @@
[gerrit]
host=gerrit.onap.org
port=29418
-project=vfc/gvnfm/vnfmgr \ No newline at end of file
+project=vfc/gvnfm/vnfmgr
diff --git a/mgr/initialize.sh b/mgr/initialize.sh
index 7ace382..3425019 100755
--- a/mgr/initialize.sh
+++ b/mgr/initialize.sh
@@ -12,4 +12,5 @@
# 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.
+
pip install -r requirements.txt
diff --git a/mgr/mgr/pub/config/config.py b/mgr/mgr/pub/config/config.py
index 3e10230..542dbd8 100644
--- a/mgr/mgr/pub/config/config.py
+++ b/mgr/mgr/pub/config/config.py
@@ -11,7 +11,6 @@
# 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.
-import os
# [MSB]
MSB_SERVICE_IP = '127.0.0.1'
diff --git a/mgr/mgr/pub/database/models.py b/mgr/mgr/pub/database/models.py
index 3c49353..0c9aa32 100644
--- a/mgr/mgr/pub/database/models.py
+++ b/mgr/mgr/pub/database/models.py
@@ -11,6 +11,7 @@
# 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.
+
from django.db import models
@@ -23,5 +24,3 @@ class VnfRegModel(models.Model):
port = models.CharField(db_column='PORT', max_length=200)
username = models.CharField(db_column='USERNAME', max_length=255)
password = models.CharField(db_column='PASSWORD', max_length=255)
-
-
diff --git a/mgr/mgr/samples/tests.py b/mgr/mgr/samples/tests.py
index 8f1c326..d2673d4 100644
--- a/mgr/mgr/samples/tests.py
+++ b/mgr/mgr/samples/tests.py
@@ -30,6 +30,3 @@ class SampleViewTest(unittest.TestCase):
self.assertEqual(status.HTTP_200_OK, response.status_code, response.content)
resp_data = json.loads(response.content)
self.assertEqual({"status": "active"}, resp_data)
-
- def test_url(self):
- pass
diff --git a/mgr/mgr/samples/views.py b/mgr/mgr/samples/views.py
index 828b182..5162f23 100644
--- a/mgr/mgr/samples/views.py
+++ b/mgr/mgr/samples/views.py
@@ -21,9 +21,6 @@ logger = logging.getLogger(__name__)
class SampleList(APIView):
- """
- List all samples.
- """
def get(self, request, format=None):
logger.debug("get")
return Response({"status": "active"})
diff --git a/mgr/mgr/swagger/tests.py b/mgr/mgr/swagger/tests.py
index 3aed49b..4418b01 100644
--- a/mgr/mgr/swagger/tests.py
+++ b/mgr/mgr/swagger/tests.py
@@ -13,7 +13,7 @@
# limitations under the License.
import unittest
-import json
+
from django.test import Client
from rest_framework import status
@@ -28,4 +28,3 @@ class SwaggerViewTest(unittest.TestCase):
def test_sample(self):
response = self.client.get("/api/vnfmgr/v1/swagger.json")
self.assertEqual(status.HTTP_200_OK, response.status_code, response.content)
-
diff --git a/mgr/mgr/swagger/urls.py b/mgr/mgr/swagger/urls.py
index 587dd14..b59f61b 100644
--- a/mgr/mgr/swagger/urls.py
+++ b/mgr/mgr/swagger/urls.py
@@ -16,5 +16,5 @@ from django.conf.urls import url
from mgr.swagger import views
urlpatterns = [
- url(r'^api/vnfmgr/v1/swagger.json$', views.SwaggerView.as_view()),
+ url(r'^api/vnfmgr/v1/swagger.json$', views.SwaggerView.as_view())
]
diff --git a/mgr/mgr/swagger/views.py b/mgr/mgr/swagger/views.py
index e9c9604..e3de4f6 100644
--- a/mgr/mgr/swagger/views.py
+++ b/mgr/mgr/swagger/views.py
@@ -11,6 +11,7 @@
# 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.
+
import os
import json
from rest_framework.views import APIView
@@ -18,9 +19,6 @@ from rest_framework.response import Response
class SwaggerView(APIView):
- """
- Show rest api swagger.
- """
def get(self, request, format=None):
json_file = os.path.join(os.path.dirname(__file__), 'swagger.json')
f = open(json_file)
diff --git a/mgr/mgr/vnfreg/urls.py b/mgr/mgr/vnfreg/urls.py
index 84b4ad1..f08cb22 100644
--- a/mgr/mgr/vnfreg/urls.py
+++ b/mgr/mgr/vnfreg/urls.py
@@ -23,4 +23,3 @@ urlpatterns = [
]
urlpatterns = format_suffix_patterns(urlpatterns)
-
diff --git a/mgr/mgr/vnfreg/views.py b/mgr/mgr/vnfreg/views.py
index 6df7ce9..f5771c6 100644
--- a/mgr/mgr/vnfreg/views.py
+++ b/mgr/mgr/vnfreg/views.py
@@ -26,6 +26,7 @@ from mgr.pub.utils import restcall
logger = logging.getLogger(__name__)
+
@api_view(http_method_names=['POST'])
def add_vnf(request, *args, **kwargs):
logger.info("Enter %s, data is %s", fun_name(), request.data)
@@ -49,7 +50,7 @@ def access_vnf(request, *args, **kwargs):
vnf_inst_id = ignore_case_get(kwargs, "vnfInstId")
logger.info("Enter %s, method is %s, ", fun_name(), request.method)
logger.info("vnfInstId is %s, data is %s", vnf_inst_id, request.data)
- ret, normal_status = None, None
+ # ret, normal_status = None, None
try:
vnf = VnfRegModel.objects.filter(id=vnf_inst_id)
if not vnf:
@@ -88,6 +89,7 @@ def access_vnf(request, *args, **kwargs):
return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
return Response(data=ret, status=normal_status)
+
@api_view(http_method_names=['POST'])
def vnf_config(request, *args, **kwargs):
logger.info("Enter %s, data is %s", fun_name(), request.data)
@@ -109,4 +111,3 @@ def vnf_config(request, *args, **kwargs):
except Exception as e:
return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
return Response(data={}, status=status.HTTP_202_ACCEPTED)
- \ No newline at end of file
diff --git a/mgr/mgr/wsgi.py b/mgr/mgr/wsgi.py
index dfe3650..a6b401b 100644
--- a/mgr/mgr/wsgi.py
+++ b/mgr/mgr/wsgi.py
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
import os
from django.core.wsgi import get_wsgi_application