summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2017-08-15 17:18:58 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2017-08-15 17:18:58 +0800
commit8c9f559f82fdf7f44b99f83d7b68e780d336a43e (patch)
tree0c01a146dc1672c6c836b396845ee8e803284b30
parent697a142e5db5a02103d85e6a241a8049caac1fe5 (diff)
Add Sdc rest call config
Change-Id: Ie5e0c73c1a0ad69a7415e12221b59839c826c192 Issue-Id: VFC-93 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r--lcm/pub/config/config.py15
-rw-r--r--lcm/pub/msapi/sdc.py26
2 files changed, 28 insertions, 13 deletions
diff --git a/lcm/pub/config/config.py b/lcm/pub/config/config.py
index 952de29d..85ba24d8 100644
--- a/lcm/pub/config/config.py
+++ b/lcm/pub/config/config.py
@@ -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"
+
+
+
+
+
diff --git a/lcm/pub/msapi/sdc.py b/lcm/pub/msapi/sdc.py
index 263c6cbf..1d4569db 100644
--- a/lcm/pub/msapi/sdc.py
+++ b/lcm/pub/msapi/sdc.py
@@ -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: