Add Sdc rest call config 79/7579/1
authorfujinhua <fu.jinhua@zte.com.cn>
Tue, 15 Aug 2017 09:18:58 +0000 (17:18 +0800)
committerfujinhua <fu.jinhua@zte.com.cn>
Tue, 15 Aug 2017 09:18:58 +0000 (17:18 +0800)
Change-Id: Ie5e0c73c1a0ad69a7415e12221b59839c826c192
Issue-Id: VFC-93
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
lcm/pub/config/config.py
lcm/pub/msapi/sdc.py

index 952de29..85ba24d 100644 (file)
@@ -29,9 +29,9 @@ REDIS_PASSWD = ''
 # [mysql]
 DB_IP = "127.0.0.1"
 DB_PORT = 3306
-DB_NAME = "inventory"
-DB_USER = "inventory"
-DB_PASSWD = "inventory"
+DB_NAME = "vfcnfvolcm"
+DB_USER = "vfcnfvolcm"
+DB_PASSWD = "vfcnfvolcm"
 
 # [register]
 REG_TO_MSB_WHEN_START = True
@@ -56,3 +56,12 @@ IGNORE_DEL_IMG_WEHN_DEL_CSAR = True
 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"
+
+
+
+
+
index 263c6cb..1d4569d 100644 (file)
@@ -16,7 +16,8 @@ import json
 import logging
 
 from lcm.pub.exceptions import NSLCMException
-from lcm.pub.utils.restcall import call_req
+from lcm.pub.utils.restcall import call_req, rest_no_auth
+from lcm.pub.config.config import SDC_BASE_URL, SDC_USER, SDC_PASSWD
 
 logger = logging.getLogger(__name__)
 
@@ -24,11 +25,13 @@ ASSETTYPE_RESOURCES = "resources"
 ASSETTYPE_SERVICES = "services"
 
 def call_sdc(resource, method, content=''):
-    base_url = "TODO: SDC Base URL"
-    sdc_user = "TODO: sdc user"
-    sdc_passwd = "TODO: sdc passwd"
-    sdc_auth_type = "TODO: sdc auth type"
-    return call_req(base_url, sdc_user, sdc_passwd, sdc_auth_type, resource, method, content)
+    return call_req(base_url=SDC_BASE_URL, 
+        user=SDC_USER, 
+        passwd=SDC_PASSWD, 
+        auth_type=rest_no_auth, 
+        resource=resource, 
+        method=method, 
+        content=content)
 
 def get_artifacts(asset_type):
     resource = "/sdc/v1/catalog/{assetType}"
@@ -56,10 +59,13 @@ def delete_artifact(asset_type, asset_id, artifact_id):
     return json.JSONDecoder().decode(ret[1])
 
 def download_artifacts(download_url, local_path):
-    sdc_user = "TODO: sdc user"
-    sdc_passwd = "TODO: sdc passwd"
-    sdc_auth_type = "TODO: sdc auth type"
-    ret = call_req(download_url, sdc_user, sdc_passwd, sdc_auth_type, "", "GET")
+    ret = call_req(base_url=download_url, 
+        user=SDC_USER, 
+        passwd=SDC_PASSWD, 
+        auth_type=rest_no_auth, 
+        resource="", 
+        method="GET")
+    # TODO: