From: Chayal, Avteet (ac229e) Date: Wed, 19 Sep 2018 20:48:25 +0000 (+0000) Subject: Changes while processing optimation policy X-Git-Tag: 1.2.2~9^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=794c278828c1c9682351755984ce5dd79d7c5223;p=optf%2Fosdf.git 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) --- 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}] })