Fix vnflcm vnf pep8 error 05/16705/1
authorfujinhua <fu.jinhua@zte.com.cn>
Sat, 30 Sep 2017 01:49:51 +0000 (09:49 +0800)
committerfujinhua <fu.jinhua@zte.com.cn>
Sat, 30 Sep 2017 01:49:51 +0000 (09:49 +0800)
Change-Id: Iba89611125511ea38751f7cd9e3687bd93701c6d
Issue-Id: VFC-485
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
lcm/lcm/nf/vnfs/const.py
lcm/lcm/nf/vnfs/tests/test_vnf_cancel.py
lcm/lcm/nf/vnfs/vnf_cancel/delete_vnf_identifier.py
lcm/lcm/nf/vnfs/vnf_cancel/term_vnf.py
lcm/lcm/nf/vnfs/vnf_create/create_vnf_identifier.py
lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py
lcm/lcm/nf/vnfs/vnf_query/__init__.py
lcm/lcm/nf/vnfs/vnf_query/query_vnf.py
lcm/lcm/pub/utils/enumutil.py

index d348962..bf4343a 100644 (file)
@@ -778,7 +778,7 @@ c6_data_create_port = {
 }
 
 # create_flavor
-c7_data_create_flavor ={
+c7_data_create_flavor = {
     "returnCode": 0,
     "vimId": "11111",
     "vimName": "11111",
index 4d5748c..038cbcf 100644 (file)
@@ -165,9 +165,9 @@ class TestNFTerminate(TestCase):
                                    create_time=now_time())
         t1_apply_grant_result = [0, json.JSONEncoder().encode(
             {
-                "vim":{
+                "vim": {
                     "vimid": 'vimid_1',
-                    "accessinfo":{
+                    "accessinfo": {
                         "tenant": 'tenantname_1'
                     }
                 }
index 3442afa..128ba35 100644 (file)
@@ -34,7 +34,7 @@ class DeleteVnf:
                 self.delete_vnf_in_aai()
             self.delete_info_from_db()
         except NFLCMException as e:
-            logger.debug('Delete VNF instance[%s] from AAI failed' % self.nf_inst_id)
+            logger.debug('Delete VNF instance[%s] failed: %s', self.nf_inst_id, e.message)
         except:
             logger.debug('Delete VNF instance[%s] failed' % self.nf_inst_id)
 
index b9a5e66..c8c85d2 100644 (file)
@@ -67,14 +67,14 @@ class TermVnf(Thread):
         if not vnf_insts.exists():
             logger.warn('VnfInst(%s) does not exist' % self.nf_inst_id)
             return False
-            #raise NFLCMException('VnfInst(%s) does not exist' % self.nf_inst_id)
-        sel_vnf = vnf_insts[0]
-        #if sel_vnf.status != 'VNF_INSTANTIATED':
+            # raise NFLCMException('VnfInst(%s) does not exist' % self.nf_inst_id)
+        sel_vnf = vnf_insts[0]
+        # if sel_vnf.status != 'VNF_INSTANTIATED':
         #    raise NFLCMException("Don't allow to terminate vnf(status:[%s])" % sel_vnf.status)
         if self.terminationType == 'GRACEFUL' and not self.gracefulTerminationTimeout:
             logger.warn("Set Graceful default termination timeout = 60")
             self.gracefulTerminationTimeout = 60
-            #raise NFLCMException("Graceful termination must set timeout")
+            # raise NFLCMException("Graceful termination must set timeout")
 
         NfInstModel.objects.filter(nfinstid=self.nf_inst_id).update(status=VNF_STATUS.TERMINATING)
         JobUtil.add_job_status(self.job_id, 10, 'Nf terminating pre-check finish')
@@ -233,8 +233,8 @@ class TermVnf(Thread):
             'affectedVnfc': affected_vnfc,
             'affectedVirtualLink': affected_vl,
             'affectedVirtualStorage': affected_vs,
-            'affectedCp': affected_cp
-            }
+            'affectedCp': affected_cp}
+
         vnfmInfo = NfvoRegInfoModel.objects.filter(nfvoid=self.nf_inst_id)
         if len(vnfmInfo) == 0:
             raise NFLCMException('nf_inst_id(%s) does not exist in NfvoRegInfoModel' % self.nf_inst_id)
index 3b0e375..9b4231b 100644 (file)
@@ -49,7 +49,7 @@ class CreateVnf:
             if REPORT_TO_AAI:
                 self.create_vnf_in_aai()
         except NFLCMException as e:
-            logger.debug('Create VNF instance[%s] to AAI failed' % self.nf_inst_id)
+            logger.debug('Create VNF instance[%s] to AAI failed: %s', self.nf_inst_id, e.message)
         except:
             NfInstModel.objects.create(nfinstid=self.nf_inst_id,
                                        nf_name=self.vnf_instance_mame,
index b12d81e..50948ca 100644 (file)
@@ -87,7 +87,7 @@ class InstVnf(Thread):
         self.vnfd_info = toscautil.convert_vnfd_model(raw_data["rawData"])  # convert to inner json
         self.vnfd_info = json.JSONDecoder().decode(self.vnfd_info)
 
-        #self.vnfd_info = vnfd_model_dict  # just for test
+        # self.vnfd_info = vnfd_model_dict  # just for test
         self.update_cps()
 
         self.check_parameter_exist()
@@ -112,8 +112,10 @@ class InstVnf(Thread):
                    lastuptime=now_time())
 
         logger.info("self.vim_id = %s" % self.vim_id)
-        NfvoRegInfoModel.objects.create(nfvoid=self.nf_inst_id,
-            vnfminstid=ignore_case_get(self.data, "vnfmId"), apiurl=self.vim_id)
+        NfvoRegInfoModel.objects.create(
+            nfvoid=self.nf_inst_id,
+            vnfminstid=ignore_case_get(self.data, "vnfmId"),
+            apiurl=self.vim_id)
         JobUtil.add_job_status(self.job_id, 15, 'Nf instancing pre-check finish')
         logger.info("Nf instancing pre-check finish")
 
@@ -141,8 +143,8 @@ class InstVnf(Thread):
         content_args['additionalParam']['vimid'] = vnfmInfo[0].apiurl
         logger.info('content_args=%s' % content_args)
         apply_result = apply_grant_to_nfvo(json.dumps(content_args))
-        #vim_info = ignore_case_get(apply_result, "vim")
-        #vim_info = ignore_case_get(json.JSONDecoder().decode(apply_result), "vim")
+        # vim_info = ignore_case_get(apply_result, "vim")
+        # vim_info = ignore_case_get(json.JSONDecoder().decode(apply_result), "vim")
 
         for vdu in ignore_case_get(self.vnfd_info, "vdus"):
             if "location_info" in vdu["properties"]:
@@ -228,8 +230,8 @@ class InstVnf(Thread):
             'affectedVnfc': affected_vnfc,
             'affectedVirtualLink': affected_vl,
             'affectedVirtualStorage': affected_vs,
-            'affectedCp': affected_cp
-            }
+            'affectedCp': affected_cp}
+
         vnfmInfo = NfvoRegInfoModel.objects.filter(nfvoid=self.nf_inst_id)
         if len(vnfmInfo) == 0:
             raise NFLCMException('nf_inst_id(%s) does not exist in NfvoRegInfoModel' % self.nf_inst_id)
index 650d17e..c7b6818 100644 (file)
@@ -10,4 +10,4 @@
 # distributed under the License is distributed on an "AS IS" BASIS,
 # 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.
\ No newline at end of file
+# limitations under the License.
index df62545..80e0d9b 100644 (file)
@@ -40,7 +40,7 @@ class QueryVnf:
         resp_data = []
         for vnf_inst in vnf_insts:
             resp_data.append(self.fill_resp_data(vnf_inst))
-        return  resp_data
+        return resp_data
 
     def fill_resp_data(self, vnf):
         logger.info('Get the list of vloumes')
index 9656f7d..48e4ffe 100644 (file)
@@ -12,5 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+
 def enum(**enums):
     return type('Enum', (), enums)