From 3a0866a29f8eb8910e950e699ce71ffacfcf06f7 Mon Sep 17 00:00:00 2001 From: Ruoyu Ying Date: Tue, 16 Apr 2019 18:09:51 +0800 Subject: Insert tosca models for policy model uploading - Insert the tosca models that can be recognized by Policy Framework inside another new folder. - Add the path for models inside the osdf config in order to avoid changes in future in case there's a change of path. Change-Id: Ifff83a630bc48b7a3fff4aa17323910e6adedb0d Issue-ID: OPTFRA-415 Signed-off-by: Ruoyu Ying --- osdf/adapters/policy/interface.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'osdf/adapters/policy/interface.py') diff --git a/osdf/adapters/policy/interface.py b/osdf/adapters/policy/interface.py index 7de5858..74126a4 100644 --- a/osdf/adapters/policy/interface.py +++ b/osdf/adapters/policy/interface.py @@ -192,19 +192,19 @@ def get_policies(request_json, service_type): def upload_policy_models(): """Upload all the policy models reside in the folder""" - model_path = "../../models/policy/placement/tosca" requestId = uuid.uuid4() config = osdf_config.deployment + model_path = config['pathPolicyModelUpload'] uid, passwd = config['policyPlatformUsername'], config['policyPlatformPassword'] pcuid, pcpasswd = config['policyClientUsername'], config['policyClientPassword'] headers = {"ClientAuth": base64.b64encode(bytes("{}:{}".format(pcuid, pcpasswd), "ascii"))} headers.update({'Environment': config['policyPlatformEnv']}) headers.update({'X-ONAP-RequestID': requestId}) - url = config['policyPlatformUrlForModelUploading'] + url = config['policyPlatformUrlModelUpload'] rc = RestClient(userid=uid, passwd=passwd, headers=headers, url=url, log_func=debug_log.debug) for file in os.listdir(model_path): - if not file.endswith(".yml"): + if not file.endswith(".yaml"): continue with open(file) as f: file_converted = json.dumps(yaml.load(f)) -- cgit 1.2.3-korg