summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-09-21 13:51:33 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-09-21 13:51:33 +0800
commit0b3ba5a4a5125bea3f3a3b5a6412d752dc6e48c6 (patch)
tree2df68198fc1637ebd79005f60cd3710d00dcf6c4
parent52e436b79e962defe89cf4593beceac70ea5c5e4 (diff)
Modify vnfres code according to PEP8 standard
Change-Id: Ifa8afcb1a619c571261514b91191be9cc01520c8 Issue-ID: VFC-410 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r--res/.gitreview2
-rw-r--r--res/README.md1
-rwxr-xr-xres/assembly/bin/initDB.sh1
-rw-r--r--res/assembly/dbscripts/mysql/onap-gvnfm-vnfres-createdb.sql2
-rw-r--r--res/assembly/dbscripts/mysql/onap-gvnfm-vnfres-createobj.sql2
-rwxr-xr-xres/initialize.sh1
-rw-r--r--res/manage.py1
-rw-r--r--res/res/pub/config/config.py3
-rw-r--r--res/res/pub/database/models.py77
-rw-r--r--res/res/pub/utils/values.py1
-rw-r--r--res/res/resources/tests.py3
-rw-r--r--res/res/resources/urls.py1
-rw-r--r--res/res/resources/views.py13
-rw-r--r--res/res/samples/urls.py3
-rw-r--r--res/res/samples/views.py3
-rw-r--r--res/res/settings.py1
-rw-r--r--res/res/urls.py1
-rw-r--r--res/res/wsgi.py1
18 files changed, 4 insertions, 113 deletions
diff --git a/res/.gitreview b/res/.gitreview
index a01f5b0..a95c6f1 100644
--- a/res/.gitreview
+++ b/res/.gitreview
@@ -1,4 +1,4 @@
[gerrit]
host=gerrit.onap.org
port=29418
-project=vfc/gvnfm/vnfres \ No newline at end of file
+project=vfc/gvnfm/vnfres
diff --git a/res/README.md b/res/README.md
index ec4a35a..28f16fe 100644
--- a/res/README.md
+++ b/res/README.md
@@ -12,5 +12,4 @@ 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.
-
Micro service of vnf resource management.
diff --git a/res/assembly/bin/initDB.sh b/res/assembly/bin/initDB.sh
index 5ad52f5..ec213fd 100755
--- a/res/assembly/bin/initDB.sh
+++ b/res/assembly/bin/initDB.sh
@@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
DIRNAME=`dirname $0`
HOME=`cd $DIRNAME/; pwd`
user=$1
diff --git a/res/assembly/dbscripts/mysql/onap-gvnfm-vnfres-createdb.sql b/res/assembly/dbscripts/mysql/onap-gvnfm-vnfres-createdb.sql
index 941ad16..d15e63e 100644
--- a/res/assembly/dbscripts/mysql/onap-gvnfm-vnfres-createdb.sql
+++ b/res/assembly/dbscripts/mysql/onap-gvnfm-vnfres-createdb.sql
@@ -1,4 +1,3 @@
---
-- Copyright 2017 ZTE Corporation.
--
-- Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,7 +12,6 @@
-- See the License for the specific language governing permissions and
-- limitations under the License.
-
/******************drop old database and user***************************/
use mysql;
drop database IF EXISTS gvnfm;
diff --git a/res/assembly/dbscripts/mysql/onap-gvnfm-vnfres-createobj.sql b/res/assembly/dbscripts/mysql/onap-gvnfm-vnfres-createobj.sql
index 1facf38..66e5a75 100644
--- a/res/assembly/dbscripts/mysql/onap-gvnfm-vnfres-createobj.sql
+++ b/res/assembly/dbscripts/mysql/onap-gvnfm-vnfres-createobj.sql
@@ -1,4 +1,3 @@
---
-- Copyright 2017 ZTE Corporation.
--
-- Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,7 +12,6 @@
-- See the License for the specific language governing permissions and
-- limitations under the License.
-
use gvnfm;
CREATE TABLE `NFINST` (
diff --git a/res/initialize.sh b/res/initialize.sh
index 1bde84f..3425019 100755
--- a/res/initialize.sh
+++ b/res/initialize.sh
@@ -13,5 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
pip install -r requirements.txt
diff --git a/res/manage.py b/res/manage.py
index a9dc4bf..790d22b 100644
--- a/res/manage.py
+++ b/res/manage.py
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
import os
import sys
diff --git a/res/res/pub/config/config.py b/res/res/pub/config/config.py
index 6c06553..dacb0fc 100644
--- a/res/res/pub/config/config.py
+++ b/res/res/pub/config/config.py
@@ -12,9 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
-import os
-
# [MSB]
MSB_SERVICE_IP = '127.0.0.1'
MSB_SERVICE_PORT = '80'
diff --git a/res/res/pub/database/models.py b/res/res/pub/database/models.py
index af794b7..9642d2f 100644
--- a/res/res/pub/database/models.py
+++ b/res/res/pub/database/models.py
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
from django.db import models
@@ -41,48 +40,6 @@ class NfInstModel(models.Model):
localizationLanguage = models.CharField(db_column='LOCALIZATIONLANGUAGE', max_length=255, null=True)
-# class JobModel(models.Model):
-# class Meta:
-# db_table = 'JOB'
-#
-# _database = 'job'
-#
-# jobid = models.CharField(db_column='JOBID', primary_key=True, max_length=255)
-# jobtype = models.CharField(db_column='JOBTYPE', max_length=255)
-# jobaction = models.CharField(db_column='JOBACTION', max_length=255)
-# resid = models.CharField(db_column='RESID', max_length=255)
-# status = models.IntegerField(db_column='STATUS', null=True, blank=True)
-# starttime = models.CharField(db_column='STARTTIME', max_length=255, null=True, blank=True)
-# endtime = models.CharField(db_column='ENDTIME', max_length=255, null=True, blank=True)
-# progress = models.IntegerField(db_column='PROGRESS', null=True, blank=True)
-# user = models.CharField(db_column='USER', max_length=255, null=True, blank=True)
-# parentjobid = models.CharField(db_column='PARENTJOBID', max_length=255, null=True, blank=True)
-# resname = models.CharField(db_column='RESNAME', max_length=255, null=True, blank=True)
-#
-# def toJSON(self):
-# import json
-# return json.dumps(dict([(attr, getattr(self, attr)) for attr in [f.name for f in self._meta.fields]]))
-#
-#
-# class JobStatusModel(models.Model):
-# class Meta:
-# db_table = 'JOB_STATUS'
-#
-# _database = 'job'
-#
-# indexid = models.IntegerField(db_column='INDEXID')
-# jobid = models.CharField(db_column='JOBID', max_length=255)
-# status = models.CharField(db_column='STATUS', max_length=255)
-# progress = models.IntegerField(db_column='PROGRESS', null=True, blank=True)
-# descp = models.TextField(db_column='DESCP', max_length=1024)
-# errcode = models.CharField(db_column='ERRCODE', max_length=255, null=True, blank=True)
-# addtime = models.CharField(db_column='ADDTIME', max_length=255, null=True, blank=True)
-#
-# def toJSON(self):
-# import json
-# return json.dumps(dict([(attr, getattr(self, attr)) for attr in [f.name for f in self._meta.fields]]))
-
-
class CPInstModel(models.Model):
class Meta:
db_table = 'CPINST'
@@ -257,40 +214,6 @@ class VNFCInstModel(models.Model):
is_predefined = models.IntegerField(db_column='ISPREDEFINED', default=0, null=True)
-# class VimModel(models.Model):
-# vimid = models.IntegerField(db_column='CMSERVERID', primary_key=True)
-# name = models.CharField(db_column='NAME', max_length=255, blank=True, null=True)
-# type = models.CharField(db_column='CMSTYPE', max_length=255, blank=True, null=True)
-# imageurl = models.CharField(db_column='IMAGEURL', max_length=1024, blank=True, null=True)
-# apiurl = models.CharField(db_column='APIURL', max_length=1024, blank=True, null=True)
-# version = models.CharField(db_column='VER', max_length=1024, blank=True, null=True)
-# supportnotification = models.IntegerField(db_column='SUPPORTNOTIFICATION', default=0)
-# longitude = models.CharField(db_column='LONGITUDE', max_length=1024, blank=True, null=True)
-# latitude = models.CharField(db_column='LATITUDE', max_length=1024, blank=True, null=True)
-# grantexclude = models.CharField(db_column='GRANTEXCLUDE', max_length=1, default='0', blank=True, null=True)
-# slalevel = models.IntegerField(db_column='SLALEVEL', default=0)
-#
-# class Meta:
-# db_table = 'CMSSERVER'
-#
-# def __unicode__(self):
-# return '%s' % self.name
-#
-#
-# class VimUserModel(models.Model):
-# class Meta:
-# db_table = 'CMSSERVER_USER'
-#
-# uuid = models.CharField(db_column='UUID', primary_key=True, max_length=255)
-# vimid = models.IntegerField(db_column='CMSERVERID')
-# username = models.CharField(db_column='USERNAME', max_length=255)
-# password = models.CharField(db_column='PWD', max_length=255, blank=True)
-# defaulttenant = models.CharField(db_column='TENANT', max_length=255, blank=True)
-#
-# def __unicode__(self):
-# return '%s' % self.username
-
-
class FlavourInstModel(models.Model):
class Meta:
db_table = 'FLAVOURINST'
diff --git a/res/res/pub/utils/values.py b/res/res/pub/utils/values.py
index 0cd09ac..4adb7ba 100644
--- a/res/res/pub/utils/values.py
+++ b/res/res/pub/utils/values.py
@@ -21,4 +21,3 @@ def ignore_case_get(args, key, def_val=""):
if old_key.upper() == key.upper():
return args[old_key]
return def_val
-
diff --git a/res/res/resources/tests.py b/res/res/resources/tests.py
index 7211b81..b865ab6 100644
--- a/res/res/resources/tests.py
+++ b/res/res/resources/tests.py
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
from django.test import TestCase, Client
from rest_framework import status
@@ -156,14 +155,12 @@ class ResourceTest(TestCase):
self.failUnlessEqual(status.HTTP_200_OK, response.status_code)
self.assertEqual(self.test_data, response.data)
-
def test_get_vnfs(self):
for i in range(1):
NfInstModel(nfinstid='%s' % i, nf_name='VNF%s' % i).save()
StorageInstModel(storageid='s0%s' % i, vimid='vim0%s' % i, resouceid='resource0%s' % i, insttype=1, instid='%s' % i, storagetype='desc%s' % i, size='ten').save()
response = self.client.get("/api/vnfres/v1/vnfs")
self.failUnlessEqual(status.HTTP_200_OK, response.status_code)
- # self.assertEqual(self.test_data, response.data)
def test_get_vms(self):
NfInstModel(nfinstid='%s' % '01', nf_name='VFS%s' % '01').save()
diff --git a/res/res/resources/urls.py b/res/res/resources/urls.py
index 5920115..b855a60 100644
--- a/res/res/resources/urls.py
+++ b/res/res/resources/urls.py
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns
diff --git a/res/res/resources/views.py b/res/res/resources/views.py
index 8171c5c..65259e0 100644
--- a/res/res/resources/views.py
+++ b/res/res/resources/views.py
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
import json
import logging
import os
@@ -242,6 +241,7 @@ def fill_flavours_data(f):
}
return flavours_data
+
@api_view(http_method_names=['GET'])
def get_networks(request, *args, **kwargs):
logger.debug("Query all the networks by vnfInstanceId[%s]", fun_name())
@@ -267,17 +267,6 @@ def fill_networks_data(network):
"insttype": network.insttype,
"instid": network.instid,
"name": network.name
- # "tenant": network.tenant,
- # "is_shared": network.is_shared,
- # "is_predefined": network.is_predefined,
- # "desc": network.desc,
- # "vendor": network.vendor,
- # "bandwidth": network.bandwidth,
- # "mtu": network.mtu,
- # "network_type": network.network_type,
- # "segmentid": network.segmentid,
- # "vlantrans": network.vlantrans,
- # "networkqos": network.networkqos
}
return networks_data
diff --git a/res/res/samples/urls.py b/res/res/samples/urls.py
index 8c44ae8..5cd9b5f 100644
--- a/res/res/samples/urls.py
+++ b/res/res/samples/urls.py
@@ -16,4 +16,5 @@ from django.conf.urls import url
from res.samples import views
urlpatterns = [
- url(r'^samples/$', views.SampleList.as_view()), ]
+ url(r'^samples/$', views.SampleList.as_view())
+]
diff --git a/res/res/samples/views.py b/res/res/samples/views.py
index 828b182..5162f23 100644
--- a/res/res/samples/views.py
+++ b/res/res/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/res/res/settings.py b/res/res/settings.py
index e7de314..6b19ab5 100644
--- a/res/res/settings.py
+++ b/res/res/settings.py
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
import os
import sys
diff --git a/res/res/urls.py b/res/res/urls.py
index 29cdac7..9db7895 100644
--- a/res/res/urls.py
+++ b/res/res/urls.py
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
from django.conf.urls import include, url
from res.pub.config.config import REG_TO_MSB_WHEN_START, REG_TO_MSB_REG_URL, REG_TO_MSB_REG_PARAM
diff --git a/res/res/wsgi.py b/res/res/wsgi.py
index a9eee32..854f501 100644
--- a/res/res/wsgi.py
+++ b/res/res/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