From 49570621115a7f5c89e607e52decb7aa583af4f6 Mon Sep 17 00:00:00 2001 From: "Chayal, Avteet (ac229e)" Date: Thu, 1 Nov 2018 03:47:26 +0000 Subject: [PATCH] Fixed tosca models, updated code and policies Fixed tosca models, updated policies and code for conductor payload changes for vFW and vCPE Change-Id: Ia98c632fc2fd564efa3b96e8a7888bc97d1c5448 Issue-ID: OPTFRA-384 Signed-off-by: Chayal, Avteet (ac229e) --- config/common_config.yaml | 22 ++- ...-v20180326.yml => affinityPolicy-v20181031.yml} | 2 +- ...-v20180326.yml => distancePolicy-v20181031.yml} | 2 +- ...olicy-v20180326.yml => hpaPolicy-v20181031.yml} | 10 +- ...180326.yml => optimizationPolicy-v20181031.yml} | 2 +- ...icy-v20180326.yml => queryPolicy-v20181031.yml} | 2 +- .../placementopt/conductor/api_builder.py | 6 +- osdf/templates/conductor_interface.json | 8 +- test/policy-local-files/Affinity_vCPE_1.json | 6 +- test/policy-local-files/Capacity_vFW_1.json | 22 +++ test/policy-local-files/Capacity_vGMuxInfra.json | 2 +- test/policy-local-files/Capacity_vG_1.json | 2 +- test/policy-local-files/Distance_vFW_1.json | 22 +++ test/policy-local-files/Distance_vGMuxInfra_1.json | 8 +- test/policy-local-files/Distance_vG_1.json | 8 +- .../Placement_Optimization_1.json | 19 ++- test/policy-local-files/QueryPolicy_vCPE.json | 8 +- test/policy-local-files/QueryPolicy_vCPE_2.json | 17 +- test/policy-local-files/QueryPolicy_vFW.json | 21 +++ test/policy-local-files/hpa_policy_vFW_1.json | 190 +++++++++++++++++++++ .../hpa_policy_vGMuxInfra_1.json | 8 +- test/policy-local-files/hpa_policy_vG_1.json | 8 +- test/policy-local-files/subscriber_policy.json | 10 +- test/policy-local-files/vnfPolicy_vFW.json | 29 ++++ test/policy-local-files/vnfPolicy_vG.json | 2 +- test/policy-local-files/vnfPolicy_vGMuxInfra.json | 2 +- 26 files changed, 377 insertions(+), 61 deletions(-) rename osdf/models/policy/placement/tosca/{affinityPolicy-v20180326.yml => affinityPolicy-v20181031.yml} (97%) rename osdf/models/policy/placement/tosca/{distancePolicy-v20180326.yml => distancePolicy-v20181031.yml} (98%) rename osdf/models/policy/placement/tosca/{hpaPolicy-v20180326.yml => hpaPolicy-v20181031.yml} (94%) rename osdf/models/policy/placement/tosca/{optimizationPolicy-v20180326.yml => optimizationPolicy-v20181031.yml} (98%) rename osdf/models/policy/placement/tosca/{queryPolicy-v20180326.yml => queryPolicy-v20181031.yml} (96%) create mode 100644 test/policy-local-files/Capacity_vFW_1.json create mode 100644 test/policy-local-files/Distance_vFW_1.json create mode 100644 test/policy-local-files/QueryPolicy_vFW.json create mode 100644 test/policy-local-files/hpa_policy_vFW_1.json create mode 100644 test/policy-local-files/vnfPolicy_vFW.json diff --git a/config/common_config.yaml b/config/common_config.yaml index 9a4f1d7..c513d5e 100644 --- a/config/common_config.yaml +++ b/config/common_config.yaml @@ -16,18 +16,29 @@ osdf_temp: # special configuration required for "workarounds" or testing - Affinity_vCPE_1.json #- Capacity_vGMuxInfra.json #- Capacity_vG_1.json - - Distance_vGMuxInfra_1.json - Distance_vG_1.json + - Distance_vGMuxInfra_1.json + - hpa_policy_vG_1.json + - hpa_policy_vGMuxInfra_1.json - Placement_Optimization_1.json - QueryPolicy_vCPE.json - #- hpa_policy_vGMuxInfra_1.json - #- hpa_policy_vG_1.json - vnfPolicy_vG.json - vnfPolicy_vGMuxInfra.json + placement_policy_dir_vfw: "./test/policy-local-files/" + placement_policy_files_vfw: # workaroud for policy platform glitches (or "work-arounds" for other components) + #- Capacity_vFW_1.json + - Distance_vFW_1.json + - hpa_policy_vFW_1.json + - Placement_Optimization_1.json + - QueryPolicy_vFW.json + - vnfPolicy_vFW.json service_info: vCPE: vcpeHostName: requestParameters.vcpeHostName e2eVpnKey: requestParameters.e2eVpnKey + vFW: + vcpeHostName: requestParameters.vcpeHostName + e2eVpnKey: requestParameters.e2eVpnKey references: service_name: @@ -50,8 +61,9 @@ policy_info: placement: policy_fetch: by_scope policy_scope: - default_scope: OSDF_R2 - vcpe_scope: OSDF_R2 + default_scope: OSDF_CASABLANCA + vcpe_scope: OSDF_CASABLANCA + vfw_scope: OSDF_CASABLANCA secondary_scopes: - - get_param: service_name diff --git a/osdf/models/policy/placement/tosca/affinityPolicy-v20180326.yml b/osdf/models/policy/placement/tosca/affinityPolicy-v20181031.yml similarity index 97% rename from osdf/models/policy/placement/tosca/affinityPolicy-v20180326.yml rename to osdf/models/policy/placement/tosca/affinityPolicy-v20181031.yml index 4db64db..89a3e9d 100644 --- a/osdf/models/policy/placement/tosca/affinityPolicy-v20180326.yml +++ b/osdf/models/policy/placement/tosca/affinityPolicy-v20181031.yml @@ -19,7 +19,7 @@ node_types: type: string consraints: - valid_values: - - affinityPolicy + - zone identity: type: string required: true diff --git a/osdf/models/policy/placement/tosca/distancePolicy-v20180326.yml b/osdf/models/policy/placement/tosca/distancePolicy-v20181031.yml similarity index 98% rename from osdf/models/policy/placement/tosca/distancePolicy-v20180326.yml rename to osdf/models/policy/placement/tosca/distancePolicy-v20181031.yml index 53d15dd..9c3bd29 100644 --- a/osdf/models/policy/placement/tosca/distancePolicy-v20180326.yml +++ b/osdf/models/policy/placement/tosca/distancePolicy-v20181031.yml @@ -19,7 +19,7 @@ node_types: type: string consraints: - valid_values: - - distancePolicy + - distance_to_location identity: type: string required: true diff --git a/osdf/models/policy/placement/tosca/hpaPolicy-v20180326.yml b/osdf/models/policy/placement/tosca/hpaPolicy-v20181031.yml similarity index 94% rename from osdf/models/policy/placement/tosca/hpaPolicy-v20180326.yml rename to osdf/models/policy/placement/tosca/hpaPolicy-v20181031.yml index 293cb63..baa654a 100644 --- a/osdf/models/policy/placement/tosca/hpaPolicy-v20180326.yml +++ b/osdf/models/policy/placement/tosca/hpaPolicy-v20181031.yml @@ -19,10 +19,12 @@ node_types: type: string consraints: - valid_values: - - hpaPolicy - resource: - type: string + - hpa + resources: + type: list required: true + entry_schema: + type: string identity: type: string required: true @@ -30,7 +32,7 @@ node_types: type: list required: true entry_schema: - - type: policy.data.flavorFeatures_properties + type: policy.data.flavorFeatures_properties data_types: policy.data.flavorFeatures_properties: derived_from: tosca.nodes.Root diff --git a/osdf/models/policy/placement/tosca/optimizationPolicy-v20180326.yml b/osdf/models/policy/placement/tosca/optimizationPolicy-v20181031.yml similarity index 98% rename from osdf/models/policy/placement/tosca/optimizationPolicy-v20180326.yml rename to osdf/models/policy/placement/tosca/optimizationPolicy-v20181031.yml index 0a3b94f..166799c 100644 --- a/osdf/models/policy/placement/tosca/optimizationPolicy-v20180326.yml +++ b/osdf/models/policy/placement/tosca/optimizationPolicy-v20181031.yml @@ -19,7 +19,7 @@ node_types: type: string consraints: - valid_values: - - optimizationPolicy + - placement_optimization identity: type: string required: true diff --git a/osdf/models/policy/placement/tosca/queryPolicy-v20180326.yml b/osdf/models/policy/placement/tosca/queryPolicy-v20181031.yml similarity index 96% rename from osdf/models/policy/placement/tosca/queryPolicy-v20180326.yml rename to osdf/models/policy/placement/tosca/queryPolicy-v20181031.yml index 2488769..805b5a2 100644 --- a/osdf/models/policy/placement/tosca/queryPolicy-v20180326.yml +++ b/osdf/models/policy/placement/tosca/queryPolicy-v20181031.yml @@ -19,7 +19,7 @@ node_types: type: string consraints: - valid_values: - - queryPolicy + - request_param_query identity: type: string required: true diff --git a/osdf/optimizers/placementopt/conductor/api_builder.py b/osdf/optimizers/placementopt/conductor/api_builder.py index e841f48..187f9f5 100644 --- a/osdf/optimizers/placementopt/conductor/api_builder.py +++ b/osdf/optimizers/placementopt/conductor/api_builder.py @@ -50,11 +50,11 @@ def conductor_api_builder(request_json, flat_policies: list, local_config, demand_vnf_name_list, gp['instance_fit']) 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['zone']) - optimization_policy_list = tr.gen_optimization_policy(demand_vnf_name_list, gp['placementOptimization']) + optimization_policy_list = tr.gen_optimization_policy(demand_vnf_name_list, gp['placement_optimization']) 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['vim_fit']) hpa_policy_list = tr.gen_hpa_policy(demand_vnf_name_list, gp['hpa']) - req_params_dict = tr.get_opt_query_data(request_json, gp['optimizationQueryPolicy']) + req_params_dict = tr.get_opt_query_data(request_json, gp['request_param_query']) conductor_policies = [attribute_policy_list, distance_to_location_policy_list, inventory_policy_list, resource_instance_policy_list, resource_region_policy_list, zone_policy_list, reservation_policy_list, capacity_policy_list, hpa_policy_list] @@ -74,6 +74,8 @@ def conductor_api_builder(request_json, flat_policies: list, local_config, service_id=request_json['serviceInfo']['serviceInstanceId'], latitude=req_params_dict.get("customerLatitude", 0.0), longitude=req_params_dict.get("customerLongitude", 0.0), + required_disk=req_params_dict.get("requiredDisk", ""), + required_mem=req_params_dict.get("requiredMemory", ""), json=json) json_payload = json.dumps(json.loads(rendered_req)) # need this because template's JSON is ugly! return json_payload diff --git a/osdf/templates/conductor_interface.json b/osdf/templates/conductor_interface.json index d2258a0..7377c48 100755 --- a/osdf/templates/conductor_interface.json +++ b/osdf/templates/conductor_interface.json @@ -6,10 +6,12 @@ "template": { "homing_template_version": "2017-10-10", "parameters": { - "service_name": "{{ service_name }}", + "service_name": "{{ service_type }}", "service_id": "{{ service_id }}", "customer_lat": {{ latitude }}, - "customer_long": {{ longitude }} + "customer_long": {{ longitude }}, + "REQUIRED_DISK": "{{ required_disk }}", + "REQUIRED_MEM": "{{ required_mem }}" }, "locations": { "customer_loc": { @@ -36,4 +38,4 @@ {% endfor %} } } -} \ No newline at end of file +} diff --git a/test/policy-local-files/Affinity_vCPE_1.json b/test/policy-local-files/Affinity_vCPE_1.json index 6f0ecb3..0f7efc3 100644 --- a/test/policy-local-files/Affinity_vCPE_1.json +++ b/test/policy-local-files/Affinity_vCPE_1.json @@ -1,7 +1,7 @@ { - "service": "zone", - "policyName": "OSDF_R2.Affinity_vCPE_1", - "description": "Optimization query policy for vCPE", + "service": "affinityPolicy", + "policyName": "OSDF_CASABLANCA.Affinity_vCPE_1", + "description": "Zone policy for vCPE", "templateVersion": "OpenSource.version.1", "version": "test1", "priority": "3", diff --git a/test/policy-local-files/Capacity_vFW_1.json b/test/policy-local-files/Capacity_vFW_1.json new file mode 100644 index 0000000..3393550 --- /dev/null +++ b/test/policy-local-files/Capacity_vFW_1.json @@ -0,0 +1,22 @@ +{ + "service": "vim_fit", + "policyName": "OSDF_CASABLANCA.Capacity_vFW_1", + "description": "Capacity policy for vFW", + "templateVersion": "OpenSource.version.1", + "version": "test1", + "priority": "5", + "riskType": "test", + "riskLevel": "2", + "guard": "False", + "content": { + "identity": "capacity_vFW", + "policyScope": ["vFW", "US", "INTERNATIONAL", "ip", "vFW"], + "resources": ["vFW"], + "capacityProperty": { + "controller": "multicloud", + "request": "{\"vCPU\": 2, \"Memory\": {\"quantity\": {\"get_param\": \"REQUIRED_MEM\"}, \"unit\": \"GB\"}, \"Storage\": {\"quantity\": {\"get_param\": \"REQUIRED_DISK\"}, \"unit\": \"GB\"}}" + }, + "policyType": "vim_fit", + "applicableResources": "any" + } +} diff --git a/test/policy-local-files/Capacity_vGMuxInfra.json b/test/policy-local-files/Capacity_vGMuxInfra.json index 2578544..f5abc42 100644 --- a/test/policy-local-files/Capacity_vGMuxInfra.json +++ b/test/policy-local-files/Capacity_vGMuxInfra.json @@ -1,6 +1,6 @@ { "service": "vim_fit", - "policyName": "OSDF_R2.Capacity_vGMuxInfra", + "policyName": "OSDF_CASABLANCA.Capacity_vGMuxInfra", "description": "Capacity policy for vGMuxInfra", "templateVersion": "OpenSource.version.1", "version": "test1", diff --git a/test/policy-local-files/Capacity_vG_1.json b/test/policy-local-files/Capacity_vG_1.json index c1682fa..6fa1f2d 100644 --- a/test/policy-local-files/Capacity_vG_1.json +++ b/test/policy-local-files/Capacity_vG_1.json @@ -1,6 +1,6 @@ { "service": "vim_fit", - "policyName": "OSDF_R2.Capacity_vG_1", + "policyName": "OSDF_CASABLANCA.Capacity_vG_1", "description": "Capacity policy for vG", "templateVersion": "OpenSource.version.1", "version": "test1", diff --git a/test/policy-local-files/Distance_vFW_1.json b/test/policy-local-files/Distance_vFW_1.json new file mode 100644 index 0000000..8c94f37 --- /dev/null +++ b/test/policy-local-files/Distance_vFW_1.json @@ -0,0 +1,22 @@ +{ + "service": "distancePolicy", + "policyName": "OSDF_CASABLANCA.Distance_vFW_1", + "description": "Distance Policy for vFW", + "templateVersion": "OpenSource.version.1", + "version": "test1", + "priority": "3", + "riskType": "test", + "riskLevel": "2", + "guard": "False", + "content": { + "distanceProperties": { + "locationInfo": "customer_loc", + "distance": { "value": "100", "operator": "<", "unit": "km" } + }, + "identity": "distance-vFW", + "resources": ["vFW"], + "policyScope": ["vFW", "US", "INTERNATIONAL", "ip"], + "policyType": "distance_to_location", + "applicableResources": "any" + } +} diff --git a/test/policy-local-files/Distance_vGMuxInfra_1.json b/test/policy-local-files/Distance_vGMuxInfra_1.json index 61ec500..5d22702 100644 --- a/test/policy-local-files/Distance_vGMuxInfra_1.json +++ b/test/policy-local-files/Distance_vGMuxInfra_1.json @@ -1,6 +1,6 @@ { - "service": "distance_to_location", - "policyName": "OSDF_R2.Distance_vGMuxInfra", + "service": "distancePolicy", + "policyName": "OSDF_CASABLANCA.Distance_vGMuxInfra", "description": "Distance Policy for vGMuxInfra", "templateVersion": "OpenSource.version.1", "version": "test1", @@ -10,13 +10,13 @@ "guard": "False", "content": { "distanceProperties": { - "locationInfo": "customer_location", + "locationInfo": "customer_loc", "distance": { "value": "500", "operator": "<", "unit": "km" } }, "identity": "distance-vGMuxInfra", "resources": ["vGMuxInfra"], "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra"], - "policyType": "distancePolicy", + "policyType": "distance_to_location", "applicableResources": "any" } } diff --git a/test/policy-local-files/Distance_vG_1.json b/test/policy-local-files/Distance_vG_1.json index 06c3ada..a326331 100644 --- a/test/policy-local-files/Distance_vG_1.json +++ b/test/policy-local-files/Distance_vG_1.json @@ -1,6 +1,6 @@ { - "service": "distance_to_location", - "policyName": "OSDF_R2.Distance_vG_1", + "service": "distancePolicy", + "policyName": "OSDF_CASABLANCA.Distance_vG_1", "description": "Distance Policy for vG", "templateVersion": "OpenSource.version.1", "version": "test1", @@ -10,13 +10,13 @@ "guard": "False", "content": { "distanceProperties": { - "locationInfo": "customer_location", + "locationInfo": "customer_loc", "distance": { "value": "1500", "operator": "<", "unit": "km" } }, "identity": "distance-vG", "resources": ["vG"], "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vG"], - "policyType": "distancePolicy", + "policyType": "distance_to_location", "applicableResources": "any" } } diff --git a/test/policy-local-files/Placement_Optimization_1.json b/test/policy-local-files/Placement_Optimization_1.json index ab3c586..8632b6b 100644 --- a/test/policy-local-files/Placement_Optimization_1.json +++ b/test/policy-local-files/Placement_Optimization_1.json @@ -1,6 +1,6 @@ { - "service": "placementOptimization", - "policyName": "OSDF_R2.Placement_Optimization_1", + "service": "optimizationPolicy", + "policyName": "OSDF_CASABLANCA.Placement_Optimization_1", "description": "Placement Optimization Policy for vGMuxInfra", "templateVersion": "OpenSource.version.1", "version": "test1", @@ -30,13 +30,26 @@ "parameter": "hpa_score", "weight": "200", "operator": "product" + }, + { + "resources": ["vFW"], + "customerLocationInfo": "customer_loc", + "parameter": "distance", + "weight": "100", + "operator": "product" + }, + { + "resources": ["vFW"], + "parameter": "hpa_score", + "weight": "200", + "operator": "product" } ], "operator": "sum" }, "identity": "optimization", "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "vG"], - "policyType": "placementOptimization", + "policyType": "placement_optimization", "objective": "minimize" } } diff --git a/test/policy-local-files/QueryPolicy_vCPE.json b/test/policy-local-files/QueryPolicy_vCPE.json index 27f49d2..7d5aad2 100644 --- a/test/policy-local-files/QueryPolicy_vCPE.json +++ b/test/policy-local-files/QueryPolicy_vCPE.json @@ -1,7 +1,7 @@ { - "service": "optimizationQueryPolicy", - "policyName": "OSDF_R2.QueryPolicy_vCPE", - "description": "Optimization query policy for vCPE", + "service": "queryPolicy", + "policyName": "OSDF_CASABLANCA.QueryPolicy_vCPE", + "description": "Query policy for vCPE", "templateVersion": "OpenSource.version.1", "version": "test1", "priority": "3", @@ -14,7 +14,7 @@ {"attribute":"customerLongitude", "attribute_location": "customerLongitude"} ], "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "vG"], - "policyType": "optimizationQueryPolicy", + "policyType": "request_param_query", "serviceName": "vCPE", "identity": "vCPE_Query_Policy" } diff --git a/test/policy-local-files/QueryPolicy_vCPE_2.json b/test/policy-local-files/QueryPolicy_vCPE_2.json index 7f1db83..512989f 100644 --- a/test/policy-local-files/QueryPolicy_vCPE_2.json +++ b/test/policy-local-files/QueryPolicy_vCPE_2.json @@ -1,10 +1,10 @@ { - "service": "optimizationQueryPolicy", - "policyName": "oofBeijing.queryPolicy_vCPE", - "description": "Optimization query policy for vCPE", - "templateVersion": "0.0.1", - "version": "oofBeijing", - "priority": "5", + "service": "queryPolicy", + "policyName": "OSDF_CASABLANCA.queryPolicy_vCPE", + "description": "Query policy for vCPE", + "templateVersion": "OpenSource.version.1", + "version": "test1", + "priority": "3", "riskType": "test", "riskLevel": "2", "guard": "False", @@ -17,7 +17,8 @@ {"attribute":"customerLongitude", "attribute_location": "customerLongitude", "value": 2.2} ], "serviceName": "vCPE", - "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "vG", "optimizationQueryPolicy"], - "policyType": "optimizationQueryPolicy" + "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "vG"], + "policyType": "request_param_query", + "identity": "vCPE_Query_Policy" } } diff --git a/test/policy-local-files/QueryPolicy_vFW.json b/test/policy-local-files/QueryPolicy_vFW.json new file mode 100644 index 0000000..75ed450 --- /dev/null +++ b/test/policy-local-files/QueryPolicy_vFW.json @@ -0,0 +1,21 @@ +{ + "service": "queryPolicy", + "policyName": "OSDF_CASABLANCA.QueryPolicy_vFW", + "description": "Query policy for vFW", + "templateVersion": "OpenSource.version.1", + "version": "test1", + "priority": "3", + "riskType": "test", + "riskLevel": "2", + "guard": "False", + "content": { + "queryProperties": [ + {"attribute":"customerLatitude", "attribute_location": "customerLatitude"}, + {"attribute":"customerLongitude", "attribute_location": "customerLongitude"} + ], + "policyScope": ["vFW", "US", "INTERNATIONAL", "ip"], + "policyType": "request_param_query", + "serviceName": "vFW", + "identity": "vFW_Query_Policy" + } +} diff --git a/test/policy-local-files/hpa_policy_vFW_1.json b/test/policy-local-files/hpa_policy_vFW_1.json new file mode 100644 index 0000000..5d2499f --- /dev/null +++ b/test/policy-local-files/hpa_policy_vFW_1.json @@ -0,0 +1,190 @@ +{ + "service": "hpaPolicy", + "policyName": "OSDF_R2.hpa_policy_vG_1", + "description": "HPA policy for vG", + "templateVersion": "OpenSource.version.1", + "version": "test1", + "priority": "3", + "riskType": "test", + "riskLevel": "2", + "guard": "False", + "content": { + "resources": "vG", + "identity": "hpaPolicy_vG", + "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vG"], + "policyType": "hpaPolicy", + "flavorFeatures": [ + { + "id": "vg_1", + "type": "vnfc", + "directives": [ + { + "type": "flavor_directives", + "attributes": [ + { + "attribute_name": "flavor_label_vm_01", + "attribute_value": "" + } + ] + } + ], + "flavorProperties":[ + { + "hpa-feature" : "cpuTopology", + "mandatory" : "True", + "architecture": "generic", + "directives": [], + "hpa-feature-attributes": [ + {"hpa-attribute-key":"numCpuSockets", "hpa-attribute-value": "2","operator": ">=", "unit": ""}, + {"hpa-attribute-key":"numCpuSockets", "hpa-attribute-value": "4","operator": "<=", "unit": ""}, + {"hpa-attribute-key":"numCpuCores", "hpa-attribute-value": "2", "operator":">=", "unit": ""}, + {"hpa-attribute-key":"numCpuCores", "hpa-attribute-value": "4", "operator":"<=", "unit": ""}, + {"hpa-attribute-key":"numCpuThreads", "hpa-attribute-value": "4", "operator":">=", "unit": ""}, + {"hpa-attribute-key":"numCpuThreads", "hpa-attribute-value": "8", "operator":"<=", "unit": ""} + ] + }, + { + "hpa-feature" : "basicCapabilities", + "mandatory" : "True", + "architecture": "generic", + "directives": [], + "hpa-feature-attributes": [ + {"hpa-attribute-key": "numVirtualCpu", "hpa-attribute-value": "6", "operator": "=", "unit": ""}, + {"hpa-attribute-key": "virtualMemSize", "hpa-attribute-value":"6", "operator": "=", "unit": "GB"} + ] + }, + { + "hpa-feature" : "ovsDpdk", + "mandatory" : "False", + "score" : "3", + "architecture": "generic", + "directives": [], + "hpa-feature-attributes": [ + {"hpa-attribute-key":"dataProcessingAccelerationLibrary", "hpa-attribute-value":"ovsDpdk_version", "operator": "=", "unit":""} + ] + }, + { + "hpa-feature" : "cpuInstructionSetExtensions", + "mandatory" : "True", + "architecture": "INTEL-64", + "directives": [], + "hpa-feature-attributes": [ + {"hpa-attribute-key":"instructionSetExtensions", "hpa-attribute-value":["", ""], "operator": "ALL", "unit":""} + ] + } + ] + }, + { + "id": "vg_2", + "type": "vnfc", + "directives": [ + { + "type": "flavor_directives", + "attributes": [ + { + "attribute_name": "flavor_label_vm_02", + "attribute_value": "" + } + ] + } + ], + "flavorProperties":[ + { + "hpa-feature" : "cpuPinningy", + "mandatory" : "True", + "architecture": "generic", + "directives": [], + "hpa-feature-attributes": [ + {"hpa-attribute-key":"logicalCpuThreadPinningPolicy", "hpa-attribute-value":"", "operator": "=", "unit":""}, + {"hpa-attribute-key":"logicalCpuPinningPolicy", "hpa-attribute-value": "","operator": "=", "unit":""} + ] + }, + { + "hpa-feature" : "basicCapabilities", + "mandatory" : "True", + "architecture": "generic", + "directives": [], + "hpa-feature-attributes": [ + {"hpa-attribute-key": "numVirtualCpu", "hpa-attribute-value": "6", "operator": "=", "unit": ""}, + {"hpa-attribute-key": "virtualMemSize", "hpa-attribute-value":"6", "operator": "=", "unit": "GB"} + ] + }, + { + "hpa-feature" : "localStorage", + "mandatory" : "False", + "score" : "5", + "architecture": "generic", + "directives": [], + "hpa-feature-attributes": [ + {"hpa-attribute-key": "diskSize", "hpa-attribute-value": "2", "operator": "=", "unit": "GB"}, + {"hpa-attribute-key": "ephemeralDiskSize", "hpa-attribute-value": "2", "operator": "=", "unit": "GB"}, + {"hpa-attribute-key": "swapMemSize", "hpa-attribute-value":"16", "operator": "=", "unit": "MB"} + ] + }, + { + "hpa-feature" : "pciePassthrough", + "mandatory" : "True", + "architecture": "generic", + "directives": [], + "hpa-feature-attributes": [ + {"hpa-attribute-key": "pciCount", "hpa-attribute-value": "2", "operator": "=", "unit": ""}, + {"hpa-attribute-key": "pciVendorId", "hpa-attribute-value":"8086", "operator": "=", "unit": ""}, + {"hpa-attribute-key": "pciDeviceId", "hpa-attribute-value": "2", "operator": "=", "unit": ""} + ] + } + ] + }, + { + "id": "vg_3", + "type": "vnfc", + "directives": [ + { + "type": "flavor_directives", + "attributes": [ + { + "attribute_name": "flavor_label_vm_03", + "attribute_value": "" + } + ] + } + ], + "flavorProperties":[ + { + "hpa-feature" : "numa", + "mandatory" : "False", + "score" : "5", + "architecture": "generic", + "directives": [], + "hpa-feature-attributes": [ + {"hpa-attribute-key": "numaNodes", "hpa-attribute-value": "2", "operator": "=", "unit": ""}, + {"hpa-attribute-key": "numaCpu-0", "hpa-attribute-value":"2", "operator": "=", "unit": ""}, + {"hpa-attribute-key": "numaMem-0", "hpa-attribute-value": "2048", "operator": "=", "unit": "MB"}, + {"hpa-attribute-key": "numaCpu-1", "hpa-attribute-value":"4", "operator": "=", "unit": ""}, + {"hpa-attribute-key": "numaMem-1", "value": "4096", "operator": "=", "unit": "MB"} + ] + }, + { + "hpa-feature" : "basicCapabilities", + "mandatory" : "True", + "architecture": "generic", + "directives": [], + "hpa-feature-attributes": [ + {"hpa-attribute-key": "numVirtualCpu", "hpa-attribute-value": "6", "operator": "=", "unit": ""}, + {"hpa-attribute-key": "virtualMemSize", "hpa-attribute-value":"6", "operator": "=", "unit": "GB"} + ] + }, + { + "hpa-feature" : "hugePages", + "mandatory" : "False", + "score" : "7", + "architecture": "generic", + "directives": [], + "hpa-feature-attributes": [ + {"hpa-attribute-key": "memoryPageSize", "hpa-attribute-value": "", "operator": "=", "unit": ""} + ] + } + ] + } + ] + } +} diff --git a/test/policy-local-files/hpa_policy_vGMuxInfra_1.json b/test/policy-local-files/hpa_policy_vGMuxInfra_1.json index ce0b7e3..8ee0469 100644 --- a/test/policy-local-files/hpa_policy_vGMuxInfra_1.json +++ b/test/policy-local-files/hpa_policy_vGMuxInfra_1.json @@ -1,6 +1,6 @@ { "service": "hpaPolicy", - "policyName": "OSDF_R2.hpa_policy_vGMuxInfra_1", + "policyName": "OSDF_CASABLANCA.hpa_policy_vGMuxInfra_1", "description": "HPA policy for vGMuxInfra", "templateVersion": "OpenSource.version.1", "version": "test1", @@ -9,10 +9,10 @@ "riskLevel": "2", "guard": "False", "content": { - "resources": "vGMuxInfra", - "identity": "hpaPolicy_vGMuxInfra", + "resources": ["vGMuxInfra"], + "identity": "hpa-vGMuxInfra", "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra"], - "policyType": "hpaPolicy", + "policyType": "hpa", "flavorFeatures": [ { "id": "vgmux_1", diff --git a/test/policy-local-files/hpa_policy_vG_1.json b/test/policy-local-files/hpa_policy_vG_1.json index 5d2499f..2bdba31 100644 --- a/test/policy-local-files/hpa_policy_vG_1.json +++ b/test/policy-local-files/hpa_policy_vG_1.json @@ -1,6 +1,6 @@ { "service": "hpaPolicy", - "policyName": "OSDF_R2.hpa_policy_vG_1", + "policyName": "OSDF_CASABLANCA.hpa_policy_vG_1", "description": "HPA policy for vG", "templateVersion": "OpenSource.version.1", "version": "test1", @@ -9,10 +9,10 @@ "riskLevel": "2", "guard": "False", "content": { - "resources": "vG", - "identity": "hpaPolicy_vG", + "resources": ["vG"], + "identity": "hpa-vG", "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vG"], - "policyType": "hpaPolicy", + "policyType": "hpa", "flavorFeatures": [ { "id": "vg_1", diff --git a/test/policy-local-files/subscriber_policy.json b/test/policy-local-files/subscriber_policy.json index f1b818c..504399f 100644 --- a/test/policy-local-files/subscriber_policy.json +++ b/test/policy-local-files/subscriber_policy.json @@ -1,9 +1,9 @@ { - "service": "SubscriberPolicy", - "policyName": "oofBeijing.SubscriberPolicy_v1", + "service": "subscriberPolicy", + "policyName": "OSDF_CASABLANCA.SubscriberPolicy_v1", "description": "Subscriber Policy", - "templateVersion": "0.0.1", - "version": "oofBeijing", + "templateVersion": "OpenSource.version.1", + "version": "test1", "priority": "1", "riskType": "test", "riskLevel": "3", @@ -19,4 +19,4 @@ "policyType": "subscriberPolicy", "serviceName": "vCPE" } -} \ No newline at end of file +} diff --git a/test/policy-local-files/vnfPolicy_vFW.json b/test/policy-local-files/vnfPolicy_vFW.json new file mode 100644 index 0000000..4336aef --- /dev/null +++ b/test/policy-local-files/vnfPolicy_vFW.json @@ -0,0 +1,29 @@ +{ + "service": "vnfPolicy", + "policyName": "OSDF_CASABLANCA.vnfPolicy_vFW", + "description": "vnfPolicy", + "templateVersion": "OpenSource.version.1", + "version": "test1", + "priority": "6", + "riskType": "test", + "riskLevel": "3", + "guard": "False", + "content": { + "identity": "vnf_vFW", + "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vFW"], + "policyType": "vnfPolicy", + "resources": ["vFW"], + "applicableResources": "any", + "vnfProperties": [ + { + "inventoryProvider": "aai", + "serviceType": "", + "inventoryType": "cloud", + "customerId": "", + "orchestrationStatus": "", + "equipmentRole": "" + + } + ] + } +} diff --git a/test/policy-local-files/vnfPolicy_vG.json b/test/policy-local-files/vnfPolicy_vG.json index d215078..2a56426 100644 --- a/test/policy-local-files/vnfPolicy_vG.json +++ b/test/policy-local-files/vnfPolicy_vG.json @@ -1,6 +1,6 @@ { "service": "vnfPolicy", - "policyName": "OSDF_R2.vnfPolicy_vG", + "policyName": "OSDF_CASABLANCA.vnfPolicy_vG", "description": "vnfPolicy", "templateVersion": "OpenSource.version.1", "version": "test1", diff --git a/test/policy-local-files/vnfPolicy_vGMuxInfra.json b/test/policy-local-files/vnfPolicy_vGMuxInfra.json index 6849105..c8fd604 100644 --- a/test/policy-local-files/vnfPolicy_vGMuxInfra.json +++ b/test/policy-local-files/vnfPolicy_vGMuxInfra.json @@ -1,6 +1,6 @@ { "service": "vnfPolicy", - "policyName": "OSDF_R2.vnfPolicy_vGMuxInfra", + "policyName": "OSDF_CASABLANCA.vnfPolicy_vGMuxInfra", "description": "vnfPolicy", "templateVersion": "OpenSource.version.1", "version": "test1", -- 2.16.6