diff options
author | Chayal, Avteet (ac229e) <ac229e@att.com> | 2020-03-19 03:13:27 -0400 |
---|---|---|
committer | Chayal, Avteet (ac229e) <ac229e@att.com> | 2020-03-19 19:38:06 -0400 |
commit | fdeaf8b56c8d342ef8145aae15c87525fe105f2a (patch) | |
tree | d954fda2eec3faa1ebd47d3222c27ad39ae5005f /apps/placement/optimizers/conductor/api_builder.py | |
parent | d39860b859417c1a7773f39ad8db311848ec0676 (diff) |
OSDF migration to new Policy API
Map policy type with constraints type for HAS payload
Added new attribute policies for Network Sliciing reference
Fixed the logic to proccess Attribute policy translation
Issue-ID: OPTFRA-721
Change-Id: I6b01815963b48b3df97c1a3109cc39b2a8bc2c3c
Signed-off-by: Chayal, Avteet (ac229e) <ac229e@att.com>
Diffstat (limited to 'apps/placement/optimizers/conductor/api_builder.py')
-rw-r--r-- | apps/placement/optimizers/conductor/api_builder.py | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/apps/placement/optimizers/conductor/api_builder.py b/apps/placement/optimizers/conductor/api_builder.py index cefde51..398db8d 100644 --- a/apps/placement/optimizers/conductor/api_builder.py +++ b/apps/placement/optimizers/conductor/api_builder.py @@ -63,32 +63,28 @@ def conductor_api_builder(request_json, flat_policies: list, local_config, demand_vnf_name_list = [] for placementDemand in request_json['placementInfo']['placementDemands']: demand_vnf_name_list.append(placementDemand['resourceModuleName'].lower()) - demand_list = tr.gen_demands(request_json, gp['onap.policies.optimization.VnfPolicy']) - # What's the attribute policy? Need an example - attribute_policy_list = tr.gen_attribute_policy(demand_vnf_name_list, gp['attribute']) + demand_list = tr.gen_demands( + request_json, gp['onap.policies.optimization.VnfPolicy']) + attribute_policy_list = tr.gen_attribute_policy( + demand_vnf_name_list, gp['onap.policies.optimization.AttributePolicy']) distance_to_location_policy_list = tr.gen_distance_to_location_policy( demand_vnf_name_list, gp['onap.policies.optimization.DistancePolicy']) - # What's the inventory group policy? A policy to choose the inventory group from existing list? - inventory_policy_list = tr.gen_inventory_group_policy(demand_vnf_name_list, gp['inventory_group']) - # What's the instance fit policy, a policy to choose the instance from existing list? + inventory_policy_list = tr.gen_inventory_group_policy( + demand_vnf_name_list, gp['onap.policies.optimization.InventoryGroupPolicy']) resource_instance_policy_list = tr.gen_resource_instance_policy( - demand_vnf_name_list, gp['instance_fit']) - # Need an example for the resource_region_policy - resource_region_policy_list = tr.gen_resource_region_policy(demand_vnf_name_list, gp['region_fit']) - zone_policy_list = tr.gen_zone_policy(demand_vnf_name_list, gp['onap.policies.optimization.AffinityPolicy']) - optimization_policy_list = tr.gen_optimization_policy(demand_vnf_name_list, - gp['onap.policies.optimization.OptimizationPolicy']) - # Need an example for the instance reservation policy - reservation_policy_list = tr.gen_reservation_policy(demand_vnf_name_list, gp['instance_reservation']) - capacity_policy_list = tr.gen_capacity_policy(demand_vnf_name_list, gp['onap.policies.optimization.Vim_fit']) - hpa_policy_list = tr.gen_hpa_policy(demand_vnf_name_list, gp['onap.policies.optimization.HpaPolicy']) - #distance_to_location_policy_list = tr.gen_distance_to_location_policy( - # demand_vnf_name_list, gp['distance_to_location']) - # demand_list = tr.gen_demands(request_json, gp['vnfPolicy']) - #zone_policy_list = tr.gen_zone_policy(demand_vnf_name_list, gp['zone']) - #optimization_policy_list = tr.gen_optimization_policy(demand_vnf_name_list, gp['placement_optimization']) - #capacity_policy_list = tr.gen_capacity_policy(demand_vnf_name_list, gp['vim_fit']) - #hpa_policy_list = tr.gen_hpa_policy(demand_vnf_name_list, gp['hpa']) + demand_vnf_name_list, gp['onap.policies.optimization.ResourceInstancePolicy']) + resource_region_policy_list = tr.gen_resource_region_policy( + demand_vnf_name_list, gp['onap.policies.optimization.ResourceRegionPolicy']) + zone_policy_list = tr.gen_zone_policy( + demand_vnf_name_list, gp['onap.policies.optimization.AffinityPolicy']) + optimization_policy_list = tr.gen_optimization_policy( + demand_vnf_name_list, gp['onap.policies.optimization.OptimizationPolicy']) + reservation_policy_list = tr.gen_reservation_policy( + demand_vnf_name_list, gp['onap.policies.optimization.InstanceReservationPolicy']) + capacity_policy_list = tr.gen_capacity_policy( + demand_vnf_name_list, gp['onap.policies.optimization.Vim_fit']) + hpa_policy_list = tr.gen_hpa_policy( + demand_vnf_name_list, gp['onap.policies.optimization.HpaPolicy']) req_params_dict = _build_parameters(gp, request_json) conductor_policies = [attribute_policy_list, distance_to_location_policy_list, inventory_policy_list, resource_instance_policy_list, resource_region_policy_list, zone_policy_list, |