diff options
author | ying.yunlong <ying.yunlong@zte.com.cn> | 2017-09-28 10:33:44 +0800 |
---|---|---|
committer | ying.yunlong <ying.yunlong@zte.com.cn> | 2017-09-28 10:33:44 +0800 |
commit | f8fdb4deb89e5e27bf62d7077cef74b7f49dc5d9 (patch) | |
tree | 1aa3b0ac39e3fa164bff1b663c349acc36c33d97 | |
parent | 4dfcc940a6a36221229ce64f079ae011c2acde9a (diff) |
Fix vfc-lcm/pub/msapi pep8 issue
Change-Id: I7beb73c7407a757ceb25f4d295ff3bdc2c8cb0cc
Issue-ID: VFC-456
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r-- | lcm/pub/database/models.py | 4 | ||||
-rw-r--r-- | lcm/pub/msapi/aai.py | 14 | ||||
-rw-r--r-- | lcm/pub/msapi/resmgr.py | 16 | ||||
-rw-r--r-- | lcm/pub/msapi/sdc.py | 50 |
4 files changed, 40 insertions, 44 deletions
diff --git a/lcm/pub/database/models.py b/lcm/pub/database/models.py index 0f26c238..35de4e44 100644 --- a/lcm/pub/database/models.py +++ b/lcm/pub/database/models.py @@ -301,7 +301,8 @@ class ServiceBaseInfoModel(models.Model): status = models.CharField(db_column='status', max_length=20) creator = models.CharField(db_column='creator', max_length=50) create_time = models.BigIntegerField(db_column='createTime', max_length=20) - + + class WFPlanModel(models.Model): class Meta: db_table = 'NFVO_WF_PLAN' @@ -311,4 +312,3 @@ class WFPlanModel(models.Model): status = models.CharField(db_column='STATUS', max_length=255) message = models.CharField(db_column='MESSAGE', max_length=1024) plan_name = models.CharField(db_column='PLANNAME', max_length=255) - diff --git a/lcm/pub/msapi/aai.py b/lcm/pub/msapi/aai.py index 4be1ff7e..bc3313c2 100644 --- a/lcm/pub/msapi/aai.py +++ b/lcm/pub/msapi/aai.py @@ -31,13 +31,13 @@ def call_aai(resource, method, content=''): } return restcall.call_req(AAI_BASE_URL, - AAI_USER, - AAI_PASSWD, - restcall.rest_no_auth, - resource, - method, - content, - additional_headers) + AAI_USER, + AAI_PASSWD, + restcall.rest_no_auth, + resource, + method, + content, + additional_headers) def create_customer_aai(global_customer_id, data): diff --git a/lcm/pub/msapi/resmgr.py b/lcm/pub/msapi/resmgr.py index fd8275af..3e3e5873 100644 --- a/lcm/pub/msapi/resmgr.py +++ b/lcm/pub/msapi/resmgr.py @@ -25,22 +25,22 @@ def create_vl(req_param): ret = req_by_msb("/api/resmgr/v1/vl", "POST", json.JSONEncoder().encode(req_param)) if ret[0] != 0: logger.error("Failed to create vl to resmgr. detail is %s.", ret[1]) - #raise NSLCMException('Failed to create vl to resmgr.') - #return json.JSONDecoder().decode(ret[1]) + # raise NSLCMException('Failed to create vl to resmgr.') + # return json.JSONDecoder().decode(ret[1]) def delete_vl(vl_inst_id): ret = req_by_msb("/api/resmgr/v1/vl/%s" % vl_inst_id, "DELETE") if ret[0] != 0: logger.error("Failed to delete vl(%s) to resmgr. detail is %s.", vl_inst_id, ret[1]) - #raise NSLCMException("Failed to delete vl(%s) to resmgr." % vl_inst_id) + # raise NSLCMException("Failed to delete vl(%s) to resmgr." % vl_inst_id) def delete_sfc(sfc_inst_id): ret = req_by_msb("/api/resmgr/v1/sfc/%s" % sfc_inst_id, "DELETE") if ret[0] != 0: logger.error("Failed to delete sfc(%s) to resmgr. detail is %s.", sfc_inst_id, ret[1]) - #raise NSLCMException("Failed to delete sfc(%s) to resmgr." % sfc_inst_id) + # raise NSLCMException("Failed to delete sfc(%s) to resmgr." % sfc_inst_id) def grant_vnf(req_param): @@ -48,7 +48,7 @@ def grant_vnf(req_param): ret = req_by_msb("/api/resmgr/v1/resource/grant", "PUT", grant_data) if ret[0] != 0: logger.error("Failed to grant vnf to resmgr. detail is %s.", ret[1]) - #raise NSLCMException('Failed to grant vnf to resmgr.') + # raise NSLCMException('Failed to grant vnf to resmgr.') vim_id = "" if "vimId" in req_param: vim_id = req_param["vimId"] @@ -96,7 +96,7 @@ def create_vnf(data): ret = req_by_msb(uri, "POST", req_param) if ret[0] != 0: logger.error('Send create VNF request to resmgr failed.') - #raise NSLCMException('Send create VNF request to resmgr failed.') + # raise NSLCMException('Send create VNF request to resmgr failed.') def create_vnf_creation_info(data): @@ -110,7 +110,7 @@ def create_vnf_creation_info(data): ret = req_by_msb(uri, "POST", req_param) if ret[0] > 0: logger.error('Send write vnf creation information to resmgr failed.') - #raise NSLCMException('Send write vnf creation information to resmgr failed.') + # raise NSLCMException('Send write vnf creation information to resmgr failed.') def terminate_vnf(vnf_inst_id): @@ -119,4 +119,4 @@ def terminate_vnf(vnf_inst_id): ret = req_by_msb(uri, "DELETE", json.dumps(req_param)) if ret[0] > 0: logger.error('Send terminate VNF request to resmgr failed.') - #raise NSLCMException('Send terminate VNF request to resmgr failed.')
\ No newline at end of file + # raise NSLCMException('Send terminate VNF request to resmgr failed.') diff --git a/lcm/pub/msapi/sdc.py b/lcm/pub/msapi/sdc.py index 76f0d0c6..d4b513ea 100644 --- a/lcm/pub/msapi/sdc.py +++ b/lcm/pub/msapi/sdc.py @@ -22,21 +22,23 @@ from lcm.pub.config.config import SDC_BASE_URL, SDC_USER, SDC_PASSWD logger = logging.getLogger(__name__) -ASSETTYPE_RESOURCES = "resources" +ASSETTYPE_RESOURCES = "resources" ASSETTYPE_SERVICES = "services" + def call_sdc(resource, method, content=''): additional_headers = { 'X-ECOMP-InstanceID': 'VFC', } - return restcall.call_req(base_url=SDC_BASE_URL, - user=SDC_USER, - passwd=SDC_PASSWD, - auth_type=restcall.rest_no_auth, - resource=resource, - method=method, - content=content, - additional_headers=additional_headers) + return restcall.call_req(base_url=SDC_BASE_URL, + user=SDC_USER, + passwd=SDC_PASSWD, + auth_type=restcall.rest_no_auth, + resource=resource, + method=method, + content=content, + additional_headers=additional_headers) + """ sample of return value @@ -55,6 +57,8 @@ sample of return value } ] """ + + def get_artifacts(asset_type): resource = "/sdc/v1/catalog/{assetType}" resource = resource.format(assetType=asset_type) @@ -64,6 +68,7 @@ def get_artifacts(asset_type): raise NSLCMException("Failed to query artifacts(%s) from sdc." % asset_type) return json.JSONDecoder().decode(ret[1]) + def get_artifact(asset_type, csar_id): artifacts = get_artifacts(asset_type) for artifact in artifacts: @@ -71,6 +76,7 @@ def get_artifact(asset_type, csar_id): return artifact raise NSLCMException("Failed to query artifact(%s,%s) from sdc." % (asset_type, csar_id)) + def delete_artifact(asset_type, asset_id, artifact_id): resource = "/sdc/v1/catalog/{assetType}/{uuid}/artifacts/{artifactUUID}" resource = resource.format(assetType=asset_type, uuid=asset_id, artifactUUID=artifact_id) @@ -80,18 +86,19 @@ def delete_artifact(asset_type, asset_id, artifact_id): raise NSLCMException("Failed to delete artifacts(%s) from sdc." % artifact_id) return json.JSONDecoder().decode(ret[1]) + def download_artifacts(download_url, local_path, file_name): additional_headers = { 'X-ECOMP-InstanceID': 'VFC', 'accept': 'application/octet-stream' } - ret = restcall.call_req(base_url=SDC_BASE_URL, - user=SDC_USER, - passwd=SDC_PASSWD, - auth_type=rest_no_auth, - resource=download_url, - method="GET", - additional_headers=additional_headers) + ret = restcall.call_req(base_url=SDC_BASE_URL, + user=SDC_USER, + passwd=SDC_PASSWD, + auth_type=restcall.rest_no_auth, + resource=download_url, + method="GET", + additional_headers=additional_headers) if ret[0] != 0: logger.error("Status code is %s, detail is %s.", ret[2], ret[1]) raise NSLCMException("Failed to download %s from sdc." % download_url) @@ -100,14 +107,3 @@ def download_artifacts(download_url, local_path, file_name): local_file.write(ret[1]) local_file.close() return local_file_name - - - - - - - - - - - |