diff options
author | Ankitkumar Patel <ankit@research.att.com> | 2018-03-28 14:27:53 -0400 |
---|---|---|
committer | Ankitkumar Patel <ankit@research.att.com> | 2018-03-28 14:29:57 -0400 |
commit | ad29f38cbcb164a7f328b26daf789dbff90deb98 (patch) | |
tree | 4074957d65fcbadee2fb2fad0aa71263b15c8a87 /osdf/adapters | |
parent | cf5fe0f8b49f6f354a77fb28b56465a2e18e820d (diff) |
Update the SO sync and async responses.
Updated the sync and async responses and addes testcases related to policy adaptors.
Issue-ID: OPTFRA-208
Change-Id: Ia0f88df1b897b6158674f3c3a7ef239f2328dcfc
Signed-off-by: Ankitkumar Patel <ankit@research.att.com>
Diffstat (limited to 'osdf/adapters')
-rw-r--r-- | osdf/adapters/policy/interface.py | 7 | ||||
-rw-r--r-- | osdf/adapters/policy/utils.py | 6 |
2 files changed, 4 insertions, 9 deletions
diff --git a/osdf/adapters/policy/interface.py b/osdf/adapters/policy/interface.py index a3b5881..016ac44 100644 --- a/osdf/adapters/policy/interface.py +++ b/osdf/adapters/policy/interface.py @@ -159,9 +159,7 @@ def local_policies_location(req_json, osdf_config, service_type): if service_type == "scheduling": return lp.get('{}_policy_dir'.format(service_type)), lp.get('{}_policy_files'.format(service_type)) else: - required_node = osdf_config.core['policy_info'][service_type]['policy_scope']['service_name'] - model_name = retrieve_node(req_json, required_node) - service_name = model_name # TODO: data_mapping.get_service_type(model_name) + service_name = req_json['serviceInfo']['serviceName'] # TODO: data_mapping.get_service_type(model_name) return lp.get('{}_policy_dir_{}'.format(service_type, service_name.lower())), \ lp.get('{}_policy_files_{}'.format(service_type, service_name.lower())) return None @@ -173,7 +171,6 @@ def get_policies(request_json, service_type): :param service_type: the type of service to call: "placement", "scheduling" :return: policies associated with this request and provStatus retrieved from Subscriber policy """ - prov_status = [] req_info = request_json['requestInfo'] req_id = req_info['requestId'] metrics_log.info(MH.requesting("policy", req_id)) @@ -187,4 +184,4 @@ def get_policies(request_json, service_type): else: policies = remote_api(request_json, osdf_config, service_type) - return policies, prov_status + return policies diff --git a/osdf/adapters/policy/utils.py b/osdf/adapters/policy/utils.py index 95d03af..f165079 100644 --- a/osdf/adapters/policy/utils.py +++ b/osdf/adapters/policy/utils.py @@ -103,8 +103,6 @@ def retrieve_node(req_json, reference): For placement and other requests, there are encoded JSONs inside the request or policy, so we need to expand it and then do a search over the parent plus expanded JSON. """ - req_json_copy = copy.deepcopy(req_json) # since we expand the JSON in place, we work on a copy - if 'orderInfo' in req_json_copy['placementInfo']: - req_json_copy['placementInfo']['orderInfo'] = json.loads(req_json_copy['placementInfo']['orderInfo']) + req_json_copy = copy.deepcopy(req_json) info = dot_notation(req_json_copy, reference) - return list_flatten(info) if isinstance(info, list) else info
\ No newline at end of file + return list_flatten(info) if isinstance(info, list) else info |