diff options
Diffstat (limited to 'osdf/optimizers/placementopt')
-rw-r--r-- | osdf/optimizers/placementopt/conductor/conductor.py | 2 | ||||
-rw-r--r-- | osdf/optimizers/placementopt/conductor/translation.py | 18 |
2 files changed, 12 insertions, 8 deletions
diff --git a/osdf/optimizers/placementopt/conductor/conductor.py b/osdf/optimizers/placementopt/conductor/conductor.py index 49e7bfc..c872e5a 100644 --- a/osdf/optimizers/placementopt/conductor/conductor.py +++ b/osdf/optimizers/placementopt/conductor/conductor.py @@ -106,7 +106,7 @@ def initial_request_to_conductor(rc, conductor_url, conductor_req_json): raise RequestException(response=raw_resp, request=raw_resp.request) time.sleep(10) # 10 seconds wait time to avoid being too quick! plan_url = resp["links"][0][0]["href"] - debug_log.debug("Attemping to read the plan from the conductor provided url {}".format(plan_url)) + debug_log.debug("Attempting to read the plan from the conductor provided url {}".format(plan_url)) raw_resp = rc.request(raw_response=True, url=plan_url) # TODO: check why a list of lists for links resp = raw_resp.json() diff --git a/osdf/optimizers/placementopt/conductor/translation.py b/osdf/optimizers/placementopt/conductor/translation.py index 5f44c83..4206276 100644 --- a/osdf/optimizers/placementopt/conductor/translation.py +++ b/osdf/optimizers/placementopt/conductor/translation.py @@ -221,13 +221,17 @@ def get_demand_properties(demand, policies): for policy_property in get_policy_properties(demand, policies): prop = dict(inventory_provider=policy_property['inventoryProvider'], inventory_type=policy_property['inventoryType'], - service_resource_id=demand['serviceResourceId']) - if 'attributes' in policy_property: - prop['attributes'] = get_augmented_policy_attributes(policy_property, demand) - for k1, v1, k2, v2 in policy_config_mapping['extra_fields']: - if k1 == v1: - prop[k2] = v2 - prop.update(get_candidates_demands(demand)) # for excluded and partial-rehoming cases + service_type=demand['serviceResourceId']) + prop['attributes'] = dict() + prop['attributes'].update({'global-customer-id': policy_property['customerId']} + if policy_property['customerId'] else {}) + prop['attributes'].update({'model-invariant-id': demand['resourceModelInfo']['modelInvariantId']} + if demand['resourceModelInfo']['modelInvariantId'] else {}) + prop['attributes'].update({'model-version-id': demand['resourceModelInfo']['modelVersionId']} + if demand['resourceModelInfo']['modelVersionId'] else {}) + prop['attributes'].update({'equipment-role': policy_property['equipmentRole']} + if policy_property['equipmentRole'] else {}) + prop.update(get_candidates_demands(demand)) demand_properties.append(prop) return demand_properties |