summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukasz Rajewski <lukasz.rajewski@orange.com>2019-04-23 16:27:02 +0200
committerLukasz Rajewski <lukasz.rajewski@orange.com>2019-04-23 16:27:02 +0200
commit0a358ab8f3f546f11c36f913018edef63ff17ed3 (patch)
treec3901a5c1f4d351c7ce5ab190ee2ab42087a0baf
parent153223d6c985aba266df11243a0c112cb33377e8 (diff)
Fix for required/excluded candidates
The fix changes how required and excluded candiates list is generated for HAS request by OSDF. After the change it is now alligned with request format of HAS. Change-Id: I6c4a88c3672971e53b996d416caeda63771e08c1 Issue-ID: OPTFRA-483 Signed-off-by: Lukasz Rajewski <lukasz.rajewski@orange.com>
-rw-r--r--osdf/optimizers/placementopt/conductor/translation.py5
-rw-r--r--test/placement-tests/request_placement_vfmod.json2
2 files changed, 5 insertions, 2 deletions
diff --git a/osdf/optimizers/placementopt/conductor/translation.py b/osdf/optimizers/placementopt/conductor/translation.py
index d14f3e1..e09ecd3 100644
--- a/osdf/optimizers/placementopt/conductor/translation.py
+++ b/osdf/optimizers/placementopt/conductor/translation.py
@@ -206,7 +206,10 @@ def get_candidates_demands(demand):
for k, v in policy_config_mapping['candidates'].items():
if k not in demand:
continue
- res[v] = [{'inventory_type': x['identifierType'], 'candidate_id': x['identifiers']} for x in demand[k]]
+ res[v] = list()
+ for x in demand[k]:
+ for candidate_id in x['identifiers']:
+ res[v].append({'inventory_type': x['identifierType'], 'candidate_id': candidate_id})
return res
diff --git a/test/placement-tests/request_placement_vfmod.json b/test/placement-tests/request_placement_vfmod.json
index 4233416..9e85e74 100644
--- a/test/placement-tests/request_placement_vfmod.json
+++ b/test/placement-tests/request_placement_vfmod.json
@@ -51,7 +51,7 @@
"service_type": "vFW-SINK-XX",
"excluded_candidates": [{
"inventory_type": "vfmodule",
- "candidate_id": ["e765d576-8755-4145-8536-0bb6d9b1dc9a"]
+ "candidate_id": "e765d576-8755-4145-8536-0bb6d9b1dc9a"
}]
}],
"vPGN": [{