from lcm.ns_vnfs.const import NFVO_VNF_INST_TIMEOUT_SECOND
from lcm.ns_vnfs.biz.subscribe import SubscriptionCreation
from lcm.ns_vnfs.biz.wait_job import wait_job_finish
-from lcm.ns_vnfs.enum import VNF_STATUS, INST_TYPE, INST_TYPE_NAME
+from lcm.ns_vnfs.enum import VNF_STATUS, INST_TYPE
from lcm.pub.config.config import REPORT_TO_AAI
from lcm.pub.config.config import REG_TO_MSB_REG_PARAM, OOF_BASE_URL, OOF_PASSWD, OOF_USER
from lcm.pub.config.config import CUST_NAME, CUST_LAT, CUST_LONG
from lcm.pub.database.models import NfInstModel, NSInstModel, VmInstModel, VNFFGInstModel, VLInstModel, OOFDataModel
-from lcm.pub.enum import JOB_MODEL_STATUS, JOB_TYPE, JOB_PROGRESS, JOB_ERROR_CODE
+from lcm.jobs.enum import JOB_MODEL_STATUS, JOB_ACTION, JOB_PROGRESS, JOB_ERROR_CODE, JOB_TYPE
from lcm.pub.exceptions import NSLCMException
from lcm.pub.msapi.aai import create_vnf_aai
from lcm.pub.msapi.extsys import get_vnfm_by_id
create_time=now_time(),
lastuptime=now_time()
).save()
- job_id = JobUtil.create_job(INST_TYPE_NAME.VNF, JOB_TYPE.CREATE_VNF, nf_inst_id)
+ job_id = JobUtil.create_job(JOB_TYPE.VNF, JOB_ACTION.CREATE, nf_inst_id)
JobUtil.add_job_status(job_id, JOB_PROGRESS.STARTED, 'create vnf record in database.', JOB_ERROR_CODE.NO_ERROR)
return nf_inst_id, job_id
self.save_info_to_db()
JobUtil.add_job_status(self.job_id, JOB_PROGRESS.FINISHED, 'vnf instantiation success', JOB_ERROR_CODE.NO_ERROR)
except NSLCMException as e:
- self.vnf_inst_failed_handle(e.message)
+ self.vnf_inst_failed_handle(e.args[0])
except Exception:
logger.error(traceback.format_exc())
self.vnf_inst_failed_handle('unexpected exception')
# identifiers.append(vim_info[1])
# cloudOwner = vim_info[0]
identifiers = list()
+ if type(self.vim_id) == str:
+ self.vim_id = json.loads(self.vim_id)
identifiers.append(self.vim_id['cloud_regionid'])
cloudOwner = self.vim_id['cloud_owner']
required_candidate = [
req_body = self.build_homing_request()
base_url = OOF_BASE_URL
resources = "/api/oof/v1/placement"
- resp = restcall.call_req(
- base_url=base_url,
- user=OOF_USER,
- passwd=OOF_PASSWD,
- auth_type=restcall.rest_no_auth,
- resource=resources,
- method="POST",
- content=json.dumps(req_body),
- additional_headers="")
+ resp = restcall.call_req(base_url, OOF_USER, OOF_PASSWD, restcall.rest_no_auth, resources, "POST",
+ json.dumps(req_body), "")
+ # resp = restcall.call_req(
+ # base_url=base_url,
+ # user=OOF_USER,
+ # passwd=OOF_PASSWD,
+ # auth_type=restcall.rest_no_auth,
+ # resource=resources,
+ # method="POST",
+ # content=json.dumps(req_body),
+ # additional_headers="")
resp_body = resp[-2]
resp_status = resp[-1]
if resp_body:
}
try:
SubscriptionCreation(data).do_biz()
+ except NSLCMException as e:
+ logger.error("subscribe failed: %s", e.args[0])
except Exception as e:
- logger.error("subscribe failed: %s", e.message)
+ logger.error("subscribe failed: %s", e.args[0])
def write_vnf_creation_info(self):
logger.debug("write_vnf_creation_info start")
% (self.nf_inst_id, self.ns_inst_id, resp_status))
except NSLCMException as e:
logger.debug("Fail to create vnf[%s] to aai, ns instance=[%s], detail message: %s"
- % (self.nf_inst_id, self.ns_inst_id, e.message))
+ % (self.nf_inst_id, self.ns_inst_id, e.args[0]))
except:
logger.error(traceback.format_exc())