}
# create_flavor
-c7_data_create_flavor ={
+c7_data_create_flavor = {
"returnCode": 0,
"vimId": "11111",
"vimName": "11111",
create_time=now_time())
t1_apply_grant_result = [0, json.JSONEncoder().encode(
{
- "vim":{
+ "vim": {
"vimid": 'vimid_1',
- "accessinfo":{
+ "accessinfo": {
"tenant": 'tenantname_1'
}
}
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)
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')
'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)
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,
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()
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")
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"]:
'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)
# 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.
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')
# See the License for the specific language governing permissions and
# limitations under the License.
+
def enum(**enums):
return type('Enum', (), enums)