diff options
author | Chayal, Avteet (ac229e) <ac229e@att.com> | 2018-09-19 20:48:25 +0000 |
---|---|---|
committer | Chayal, Avteet (ac229e) <ac229e@att.com> | 2018-09-19 20:51:45 +0000 |
commit | 794c278828c1c9682351755984ce5dd79d7c5223 (patch) | |
tree | 595b185d1ad1380731573761b36d66ab91f7acb6 | |
parent | d7eb44a65b37000d5d30245e6ac26bd68827804d (diff) |
Changes while processing optimation policy
Generalize the logic that fetches the "parameter" and
"resource" fields while processing optimization policy
Issue-ID: OPTFRA-354
Change-Id: Ic84f837b63d430a9adabf4a17d0b396ff1e8ac54
Signed-off-by: Chayal, Avteet (ac229e) <ac229e@att.com>
-rw-r--r-- | osdf/optimizers/placementopt/conductor/translation.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/osdf/optimizers/placementopt/conductor/translation.py b/osdf/optimizers/placementopt/conductor/translation.py index 6e42ba2..76cbabd 100644 --- a/osdf/optimizers/placementopt/conductor/translation.py +++ b/osdf/optimizers/placementopt/conductor/translation.py @@ -54,12 +54,13 @@ def gen_optimization_policy(vnf_list, optimization_policy): for policy in optimization_policy: content = policy['content'] parameter_list = [] + parameters = ["cloud_version"] for attr in content['objectiveParameter']['parameterAttributes']: - parameter = attr['parameter'] if attr['parameter'] == "cloud_version" else attr['parameter']+"_between" + parameter = attr['parameter'] if attr['parameter'] in parameters else attr['parameter']+"_between" vnfs = get_matching_vnfs(attr['resources'], vnf_list) for vnf in vnfs: - value = [vnf] if attr['parameter'] == "cloud_version" else [attr['customerLocationInfo'], vnf] + value = [vnf] if attr['parameter'] in parameters else [attr['customerLocationInfo'], vnf] parameter_list.append({ attr['operator']: [attr['weight'], {parameter: value}] }) |