diff options
author | Ruoyu Ying <ruoyu.ying@intel.com> | 2019-04-16 18:09:51 +0800 |
---|---|---|
committer | Ruoyu Ying <ruoyu.ying@intel.com> | 2019-04-21 23:39:36 +0800 |
commit | 3a0866a29f8eb8910e950e699ce71ffacfcf06f7 (patch) | |
tree | d7f3dc6b6a70b18b9333aeb68a7cee68893fe4bc /osdf/adapters | |
parent | e1f6d80752920a7ef990134f02abb3db9b5a6232 (diff) |
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 <ruoyu.ying@intel.com>
Diffstat (limited to 'osdf/adapters')
-rw-r--r-- | osdf/adapters/policy/interface.py | 6 |
1 files changed, 3 insertions, 3 deletions
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)) |