aboutsummaryrefslogtreecommitdiffstats
path: root/osdf/optimizers/placementopt/conductor/translation.py
diff options
context:
space:
mode:
authorAnkitkumar Patel <ankit@research.att.com>2018-05-22 22:57:54 -0400
committerAnkitkumar Patel <ankit@research.att.com>2018-05-22 22:58:57 -0400
commit61960d0ca9556843596975506fc949ae90ebb776 (patch)
tree9e638df2ab0e4ac5677655815336f71b3eb397a1 /osdf/optimizers/placementopt/conductor/translation.py
parent8a0fb1ecc1bd4f421f18ad10edd8e6f2c78dc003 (diff)
Eliminating emply elements from HAS templatev1.1.1
Eliminating empty elements from HAS template Issue-ID: OPTFRA-243 Change-Id: Iec6acf95f6f0a98757e3d208f102998d197b2daa Signed-off-by: Ankitkumar Patel <ankit@research.att.com>
Diffstat (limited to 'osdf/optimizers/placementopt/conductor/translation.py')
-rw-r--r--osdf/optimizers/placementopt/conductor/translation.py25
1 files changed, 10 insertions, 15 deletions
diff --git a/osdf/optimizers/placementopt/conductor/translation.py b/osdf/optimizers/placementopt/conductor/translation.py
index 7bef01c..4206276 100644
--- a/osdf/optimizers/placementopt/conductor/translation.py
+++ b/osdf/optimizers/placementopt/conductor/translation.py
@@ -222,21 +222,16 @@ def get_demand_properties(demand, policies):
prop = dict(inventory_provider=policy_property['inventoryProvider'],
inventory_type=policy_property['inventoryType'],
service_type=demand['serviceResourceId'])
- attributes = policy_config_mapping['attributes']
- prop['attributes'] = {
- 'global-customer-id': policy_property['customerId'],
- 'orchestration-status': "",
- 'model-invariant-id': demand['resourceModelInfo']['modelInvariantId'],
- 'model-version-id': demand['resourceModelInfo']['modelVersionId'],
- 'service-type': demand['serviceResourceId'],
- 'equipment-role': policy_property['equipmentRole']
- }
- # 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
+ 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