diff options
-rw-r--r-- | catalog/pub/config/config.py | 9 | ||||
-rw-r--r-- | catalog/pub/msapi/extsys.py | 8 | ||||
-rw-r--r-- | catalog/pub/msapi/nfvolcm.py | 13 |
3 files changed, 17 insertions, 13 deletions
diff --git a/catalog/pub/config/config.py b/catalog/pub/config/config.py index 9a13876a..0f418942 100644 --- a/catalog/pub/config/config.py +++ b/catalog/pub/config/config.py @@ -54,11 +54,12 @@ CATALOG_ROOT_PATH = None CATALOG_URL_PATH = None # [sdc config] -SDC_BASE_URL = "https://127.0.0.1:1234/api" -SDC_USER = "admin" -SDC_PASSWD = "admin" +SDC_BASE_URL = "https://127.0.0.1:8443/api/sdc/v1" +SDC_USER = "SDC" +SDC_PASSWD = "SDC" -NFVOLCM_BASE_URL = "https://127.0.0.1:1234/api" +# [nslcm config] +NFVOLCM_BASE_URL = "http://127.0.0.1:8403/api" NFVOLCM_USER = "admin" NFVOLCM_PASSWD = "admin" diff --git a/catalog/pub/msapi/extsys.py b/catalog/pub/msapi/extsys.py index ad300fe4..e038f261 100644 --- a/catalog/pub/msapi/extsys.py +++ b/catalog/pub/msapi/extsys.py @@ -29,7 +29,6 @@ def call_aai(resource, method, content=''): 'X-FromAppId': 'VFC-CATALOG', 'X-TransactionId': str(uuid.uuid1()) } - return restcall.call_req(AAI_BASE_URL, AAI_USER, AAI_PASSWD, @@ -45,7 +44,6 @@ def get_vims(): if ret[0] != 0: logger.error("Status code is %s, detail is %s.", ret[2], ret[1]) raise CatalogException("Failed to query vims from extsys.") - # convert vim_info_aai to internal vim_info vims_aai = json.JSONDecoder().decode(ret[1]) vims_aai = ignore_case_get(vims_aai, "cloud-region") @@ -63,7 +61,6 @@ def get_vim_by_id(vim_id): if ret[0] != 0: logger.error("Status code is %s, detail is %s.", ret[2], ret[1]) raise CatalogException("Failed to query vim(%s) from extsys." % vim_id) - # convert vim_info_aai to internal vim_info vim_info_aai = json.JSONDecoder().decode(ret[1]) vim_info = convert_vim_info(vim_info_aai) @@ -103,7 +100,6 @@ def get_sdn_controller_by_id(sdn_ontroller_id): if ret[0] != 0: logger.error("Failed to query sdn ontroller(%s) from extsys. detail is %s.", sdn_ontroller_id, ret[1]) raise CatalogException("Failed to query sdn ontroller(%s) from extsys." % sdn_ontroller_id) - # convert vim_info_aai to internal vim_info sdnc_info_aai = json.JSONDecoder().decode(ret[1]) sdnc_info = convert_sdnc_info(sdnc_info_aai) @@ -130,7 +126,7 @@ def convert_sdnc_info(sdnc_info_aai): def get_vnfm_by_id(vnfm_inst_id): - uri = '/external-system/esr-vnfm-list/esr-vnfm/%s?depth=all' % vnfm_inst_id + uri = "/external-system/esr-vnfm-list/esr-vnfm/%s?depth=all" % vnfm_inst_id ret = call_aai(uri, "GET") if ret[0] > 0: logger.error('Send get VNFM information request to extsys failed.') @@ -161,7 +157,7 @@ def convert_vnfm_info(vnfm_info_aai): def select_vnfm(vnfm_type, vim_id): - uri = '/external-system/esr-vnfm-list?depth=all' + uri = "/external-system/esr-vnfm-list?depth=all" ret = call_aai(uri, "GET") if ret[0] > 0: logger.error("Failed to call %s: %s", uri, ret[1]) diff --git a/catalog/pub/msapi/nfvolcm.py b/catalog/pub/msapi/nfvolcm.py index 619195d8..14aa3270 100644 --- a/catalog/pub/msapi/nfvolcm.py +++ b/catalog/pub/msapi/nfvolcm.py @@ -26,13 +26,14 @@ ASSETTYPE_SERVICES = "services" def call_lcm(resource, method, content=''): return restcall.call_req(base_url=NFVOLCM_BASE_URL, - user=NFVOLCM_USER, - passwd=NFVOLCM_PASSWD, + user="", + passwd="", auth_type=restcall.rest_no_auth, resource=resource, method=method, content=content) + def get_nsInstances(csarid): ret=call_lcm("/nslcm/v1/ns?nsPackageId=%s"% csarid,"get") if ret[0] != 0: @@ -40,6 +41,7 @@ def get_nsInstances(csarid): raise CatalogException("Failed to query NS Instances(%s) from NSLCM." % csarid) return json.JSONDecoder().decode(ret[1]) + def get_vnfInstances(csarid): ret=call_lcm("/nslcm/v1/vnfs?vnfPackageId=%s"% csarid,"get") if ret[0] != 0: @@ -47,14 +49,17 @@ def get_vnfInstances(csarid): raise CatalogException("Failed to query VNF Instances(%s) from NSLCM." % csarid) return json.JSONDecoder().decode(ret[1]) + # Mock code because the REST API from nfvolcm to delete ns instance is not implemented def delete_ns_inst_mock(): return [0,'success'] + # Mock code because the REST API from nfvolcm to delete nf instance is not implemented def delete_nf_inst_mock(): return [0,'success'] + def delete_ns(asset_type): resource = "/nfvolcm/v1/ns/" resource = resource.format(assetType=asset_type) @@ -64,6 +69,7 @@ def delete_ns(asset_type): raise CatalogException("Failed to query artifacts(%s) from sdc." % asset_type) return json.JSONDecoder().decode(ret[1]) + def getNsInsts_mock(): return [ { @@ -75,6 +81,7 @@ def getNsInsts_mock(): "nsInstanceName": "vnf2" }] + def getNfInsts_mock(): return [ { @@ -84,4 +91,4 @@ def getNfInsts_mock(): { "vnfInstanceId": 2, "vnfInstanceName": "vnf2" - }]
\ No newline at end of file + }] |