aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfengyuanxing <feng.yuanxing@zte.com.cn>2018-03-02 15:16:18 +0800
committerfengyuanxing <feng.yuanxing@zte.com.cn>2018-03-02 15:30:21 +0800
commit6a35534386bf5f2f5d45bb63763d88c3b72a647b (patch)
treeebd8f43205f316fbb1f64d66b4b0630ded776115
parentdd009c18bf71e61ad8b44bdecdc7ac8fc4eff2f6 (diff)
Add code to download scaling json
Change-Id: I97f13443430db70e99c22b9baec2610b58aee191 Issue-ID: VFC-784 Signed-off-by: fengyuanxing <feng.yuanxing@zte.com.cn>
-rw-r--r--lcm/pub/msapi/catalog.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/lcm/pub/msapi/catalog.py b/lcm/pub/msapi/catalog.py
index ebefcab1..7efd63df 100644
--- a/lcm/pub/msapi/catalog.py
+++ b/lcm/pub/msapi/catalog.py
@@ -18,6 +18,7 @@ import logging
from lcm.pub.utils.restcall import req_by_msb
from lcm.pub.utils.values import ignore_case_get
from lcm.pub.exceptions import NSLCMException
+from lcm.pub.database.models import NSInstModel
logger = logging.getLogger(__name__)
@@ -104,3 +105,13 @@ def get_servicetemplate(nsd_id):
if stpl.get("id", "") == nsd_id:
return stpl
return NSLCMException('servicetemplate(%s) does not exist.' % nsd_id)
+
+
+# Gets scaling map json according to nsd id.
+def get_scalingmap_json_package(ns_InstanceId):
+ csar_id = NSInstModel.objects.filter(id=ns_InstanceId)[0]["nspackage_id"]
+ downloadUrl = query_csar_from_catalog(csar_id, "packageInfo")["downloadUrl"]
+ ret = req_by_msb(downloadUrl, 'GET')
+ scalingmap_json = json.JSONDecoder().decode(ret[1])
+
+ return scalingmap_json