Fix to remove resources with no policies 95/49395/1
authorPatel, Ankitkumar <ankit@research.att.com>
Tue, 29 May 2018 16:34:06 +0000 (12:34 -0400)
committerPatel, Ankitkumar <ankit@research.att.com>
Tue, 29 May 2018 16:37:16 +0000 (12:37 -0400)
Fix to remove resources with no policies from the HAS template

Issue-ID: OPTFRA-247
Change-Id: I8762a5ac13038406d74ee2806a52f78b6df697a2
Signed-off-by: Patel, Ankitkumar <ankit@research.att.com>
osdf/optimizers/placementopt/conductor/translation.py

index f1c12c8..6e42ba2 100644 (file)
@@ -247,6 +247,7 @@ def gen_demands(req_json, vnf_policies):
     """
     demand_dictionary = {}
     for demand in req_json['placementInfo']['placementDemands']:
-        demand_dictionary.update(
-            {demand['resourceModuleName']: get_demand_properties(demand, vnf_policies)})
+        prop = get_demand_properties(demand, vnf_policies)
+        if len(prop) > 0:
+            demand_dictionary.update({demand['resourceModuleName']: prop})
     return demand_dictionary