Modify vnfres code according to PEP8 standard 81/14181/1
authorying.yunlong <ying.yunlong@zte.com.cn>
Thu, 21 Sep 2017 05:51:33 +0000 (13:51 +0800)
committerying.yunlong <ying.yunlong@zte.com.cn>
Thu, 21 Sep 2017 05:51:33 +0000 (13:51 +0800)
Change-Id: Ifa8afcb1a619c571261514b91191be9cc01520c8
Issue-ID: VFC-410
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
18 files changed:
res/.gitreview
res/README.md
res/assembly/bin/initDB.sh
res/assembly/dbscripts/mysql/onap-gvnfm-vnfres-createdb.sql
res/assembly/dbscripts/mysql/onap-gvnfm-vnfres-createobj.sql
res/initialize.sh
res/manage.py
res/res/pub/config/config.py
res/res/pub/database/models.py
res/res/pub/utils/values.py
res/res/resources/tests.py
res/res/resources/urls.py
res/res/resources/views.py
res/res/samples/urls.py
res/res/samples/views.py
res/res/settings.py
res/res/urls.py
res/res/wsgi.py

index a01f5b0..a95c6f1 100644 (file)
@@ -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
index ec4a35a..28f16fe 100644 (file)
@@ -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.
index 5ad52f5..ec213fd 100755 (executable)
@@ -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
index 941ad16..d15e63e 100644 (file)
@@ -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;
index 1facf38..66e5a75 100644 (file)
@@ -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` (
index 1bde84f..3425019 100755 (executable)
@@ -13,5 +13,4 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
 pip install -r requirements.txt
index a9dc4bf..790d22b 100644 (file)
@@ -12,7 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
 import os
 import sys
 
index 6c06553..dacb0fc 100644 (file)
@@ -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'
index af794b7..9642d2f 100644 (file)
@@ -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'
index 0cd09ac..4adb7ba 100644 (file)
@@ -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
-
index 7211b81..b865ab6 100644 (file)
@@ -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()
index 5920115..b855a60 100644 (file)
@@ -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
 
index 8171c5c..65259e0 100644 (file)
@@ -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
 
index 8c44ae8..5cd9b5f 100644 (file)
@@ -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())
+]
index 828b182..5162f23 100644 (file)
@@ -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"})
index e7de314..6b19ab5 100644 (file)
@@ -12,7 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
 import os
 import sys
 
index 29cdac7..9db7895 100644 (file)
@@ -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
 
index a9eee32..854f501 100644 (file)
@@ -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