From 0917c1b86b2ca2c584791a12cc941cd9ff92b78c Mon Sep 17 00:00:00 2001 From: "Chayal, Avteet (ac229e)" Date: Thu, 1 Nov 2018 07:06:38 +0000 Subject: Fixed tosca models and updated policies Fixed tosca models and updated policies for vFW Issue-ID: OPTFRA-384 Change-Id: If84cd3117f3c7b3d91a22e379b38c567ed3804e2 Signed-off-by: Chayal, Avteet (ac229e) --- .../policy/placement/tosca/hpaPolicy-v20181031.yml | 2 +- .../tosca/optimizationPolicy-v20181031.yml | 6 +- .../placement/tosca/queryPolicy-v20181031.yml | 2 +- .../policy/placement/tosca/vnfPolicy-v20180326.yml | 68 ---- .../policy/placement/tosca/vnfPolicy-v20181031.yml | 68 ++++ .../simulators/simulated-config/common_config.yaml | 2 +- test/policy-local-files/hpa_policy_vFW_1.json | 375 ++++++++++----------- test/policy-local-files/subscriber_policy.json | 22 -- .../policy-local-files/subscriber_policy_vCPE.json | 22 ++ test/policy-local-files/subscriber_policy_vFW.json | 22 ++ 10 files changed, 305 insertions(+), 284 deletions(-) delete mode 100644 osdf/models/policy/placement/tosca/vnfPolicy-v20180326.yml create mode 100644 osdf/models/policy/placement/tosca/vnfPolicy-v20181031.yml delete mode 100644 test/policy-local-files/subscriber_policy.json create mode 100644 test/policy-local-files/subscriber_policy_vCPE.json create mode 100644 test/policy-local-files/subscriber_policy_vFW.json diff --git a/osdf/models/policy/placement/tosca/hpaPolicy-v20181031.yml b/osdf/models/policy/placement/tosca/hpaPolicy-v20181031.yml index baa654a..bf7380d 100644 --- a/osdf/models/policy/placement/tosca/hpaPolicy-v20181031.yml +++ b/osdf/models/policy/placement/tosca/hpaPolicy-v20181031.yml @@ -32,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-v20181031.yml b/osdf/models/policy/placement/tosca/optimizationPolicy-v20181031.yml index 166799c..2c7e6c7 100644 --- a/osdf/models/policy/placement/tosca/optimizationPolicy-v20181031.yml +++ b/osdf/models/policy/placement/tosca/optimizationPolicy-v20181031.yml @@ -32,11 +32,11 @@ node_types: - valid_values: - minimize - maximize - objectiveParameters: - type: policy.data.objectiveParameters_properties + objectiveParameter: + type: policy.data.objectiveParameter_properties required: true data_types: - policy.data.objectiveParameters_properties: + policy.data.objectiveParameter_properties: derived_from: tosca.nodes.Root properties: parameterAttributes: diff --git a/osdf/models/policy/placement/tosca/queryPolicy-v20181031.yml b/osdf/models/policy/placement/tosca/queryPolicy-v20181031.yml index 805b5a2..7f2b550 100644 --- a/osdf/models/policy/placement/tosca/queryPolicy-v20181031.yml +++ b/osdf/models/policy/placement/tosca/queryPolicy-v20181031.yml @@ -27,7 +27,7 @@ node_types: type: list required: true entry_schema: - - type: policy.data.queryProperties_properties + type:policy.data.queryProperties_properties data_types: policy.data.queryProperties_properties: derived_from: tosca.nodes.Root diff --git a/osdf/models/policy/placement/tosca/vnfPolicy-v20180326.yml b/osdf/models/policy/placement/tosca/vnfPolicy-v20180326.yml deleted file mode 100644 index 3880cea..0000000 --- a/osdf/models/policy/placement/tosca/vnfPolicy-v20180326.yml +++ /dev/null @@ -1,68 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -node_types: - policy.nodes.vnfPolicy: - derived_from: policy.nodes.Root - properties: - policyScope: - type: list - description: scope where the policy is applicable - required: true - matchable: true - entry_schema: - type: string - policyType: - type: list - description: type of a policy - required: true - matchable: true - entry_schema: - type: string - consraints: - - valid_values: - - vnfPolicy - identity: - type: string - required: true - resources: - type: list - required: true - entry_schema: - type: string - applicableResources: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - any - - all - vnfProperties: - type: list - required: true - entry_schema: - - type: policy.data.vnfProperties_properties -data_types: - policy.data.vnfProperties_properties: - derived_from: tosca.nodes.Root - properties: - inventoryProvider: - type: string - required: true - serviceType: - type: string - required: true - inventoryType: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - serviceInstanceId - - vnfName - - cloudRegionId - - vimId - customerId: - type: string - required: true diff --git a/osdf/models/policy/placement/tosca/vnfPolicy-v20181031.yml b/osdf/models/policy/placement/tosca/vnfPolicy-v20181031.yml new file mode 100644 index 0000000..02f4051 --- /dev/null +++ b/osdf/models/policy/placement/tosca/vnfPolicy-v20181031.yml @@ -0,0 +1,68 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + policy.nodes.vnfPolicy: + derived_from: policy.nodes.Root + properties: + policyScope: + type: list + description: scope where the policy is applicable + required: true + matchable: true + entry_schema: + type: string + policyType: + type: list + description: type of a policy + required: true + matchable: true + entry_schema: + type: string + consraints: + - valid_values: + - vnfPolicy + identity: + type: string + required: true + resources: + type: list + required: true + entry_schema: + type: string + applicableResources: + type: list + required: true + entry_schema: + type: string + constraints: + - valid_values: + - any + - all + vnfProperties: + type: list + required: true + entry_schema: + type:policy.data.vnfProperties_properties +data_types: + policy.data.vnfProperties_properties: + derived_from: tosca.nodes.Root + properties: + inventoryProvider: + type: string + required: true + serviceType: + type: string + required: true + inventoryType: + type: list + required: true + entry_schema: + type: string + constraints: + - valid_values: + - serviceInstanceId + - vnfName + - cloudRegionId + - vimId + customerId: + type: string + required: true diff --git a/test/functest/simulators/simulated-config/common_config.yaml b/test/functest/simulators/simulated-config/common_config.yaml index 1a85714..1249dc0 100644 --- a/test/functest/simulators/simulated-config/common_config.yaml +++ b/test/functest/simulators/simulated-config/common_config.yaml @@ -23,7 +23,7 @@ osdf_temp: # special configuration required for "workarounds" or testing - hpa_policy_vG_1.json - vnfPolicy_vG.json - vnfPolicy_vGMuxInfra.json - - subscriber_policy.json + - subscriber_policy_vCPE.json service_info: vCPE: vcpeHostName: requestParameters.vcpeHostName diff --git a/test/policy-local-files/hpa_policy_vFW_1.json b/test/policy-local-files/hpa_policy_vFW_1.json index 5d2499f..f2306d3 100644 --- a/test/policy-local-files/hpa_policy_vFW_1.json +++ b/test/policy-local-files/hpa_policy_vFW_1.json @@ -1,190 +1,189 @@ { - "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": ""} - ] - } - ] - } - ] - } + "service": "hpaPolicy", + "policyName": "OSDF_CASABLANCA.hpa_policy_vFW_1", + "description": "HPA policy for vFW", + "templateVersion": "OpenSource.version.1", + "version": "test1", + "priority": "3", + "riskType": "test", + "riskLevel": "2", + "guard": "False", + "content": { + "resources": ["vFW"], + "identity": "hpa-vFW", + "policyScope": ["vFW", "US", "INTERNATIONAL", "ip"], + "policyType": "hpa", + "flavorFeatures": [ + { + "flavorProperties": [ + { + "architecture": "generic", + "directives": [], + "hpa-version": "v1", + "hpa-feature-attributes": [ + { + "unit": "", + "operator": ">=", + "hpa-attribute-value": "2", + "hpa-attribute-key": "numVirtualCpu" + }, + { + "unit": "MB", + "operator": ">=", + "hpa-attribute-value": "8", + "hpa-attribute-key": "virtualMemSize" + } + ], + "hpa-feature": "basicCapabilities", + "mandatory": "True" + }, + { + "architecture": "generic", + "directives": [], + "hpa-version": "v1", + "hpa-feature-attributes": [ + { + "unit": "", + "operator": "=", + "hpa-attribute-value": "2", + "hpa-attribute-key": "numaNodes" + }, + { + "operator": "=", + "hpa-attribute-value": "2", + "hpa-attribute-key": "numaCpu-0" + }, + { + "operator": "=", + "hpa-attribute-value": "4", + "hpa-attribute-key": "numaCpu-1" + }, + { + "unit": "GB", + "operator": "=", + "hpa-attribute-value": "2", + "hpa-attribute-key": "numaMem-0" + }, + { + "unit": "GB", + "operator": "=", + "hpa-attribute-value": "4", + "hpa-attribute-key": "numaMem-1" + } + ], + "hpa-feature": "numa", + "mandatory": "True" + }, + { + "architecture": "generic", + "directives": [], + "hpa-version": "v1", + "hpa-feature-attributes": [ + { + "unit": "MB", + "operator": "=", + "hpa-attribute-value": "2", + "hpa-attribute-key": "memoryPageSize" + }, + { + "operator": "=", + "hpa-attribute-value": "4", + "hpa-attribute-key": "numberOfPages" + } + ], + "hpa-feature": "hugePages", + "mandatory": "True" + }, + { + "architecture": "Intel64", + "hpa-feature": "sriovNICNetwork", + "hpa-version": "v1", + "directives": [ + { + "type": "sriovNICNetwork_directives", + "attributes": [ + { + "attribute_name": "oof_returned_vnic_type_for_firewall_protected", + "attribute_value": "direct" + } + ] + } + ], + "hpa-feature-attributes": [ + { + "unit": "", + "operator": "=", + "hpa-attribute-value": "1", + "hpa-attribute-key": "pciCount" + }, + { + "unit": "", + "operator": "=", + "hpa-attribute-value": "1234", + "hpa-attribute-key": "pciVendorId" + }, + { + "unit": "", + "operator": "=", + "hpa-attribute-value": "7890", + "hpa-attribute-key": "pciDeviceId" + } + ], + "score": "100", + "mandatory": "False" + } + ], + "type": "vnfc", + "id": "vfw_1", + "directives": [ + { + "type": "flavor_directives", + "attributes": [ + { + "attribute_name": "label_1", + "attribute_value": "" + } + ] + } + ] + }, + { + "flavorProperties": [ + { + "architecture": "generic", + "directives": [], + "hpa-version": "v1", + "hpa-feature-attributes": [ + { + "operator": ">=", + "hpa-attribute-value": "1", + "hpa-attribute-key": "numVirtualCpu" + }, + { + "unit": "GB", + "operator": ">=", + "hpa-attribute-value": "7", + "hpa-attribute-key": "virtualMemSize" + } + ], + "hpa-feature": "basicCapabilities", + "mandatory": "True" + } + ], + "type": "vnfc", + "id": "vfw_2", + "directives": [ + { + "type": "flavor_directives", + "attributes": [ + { + "attribute_name": "label_2", + "attribute_value": "" + } + ] + } + ] + } + ] + } } diff --git a/test/policy-local-files/subscriber_policy.json b/test/policy-local-files/subscriber_policy.json deleted file mode 100644 index 504399f..0000000 --- a/test/policy-local-files/subscriber_policy.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "service": "subscriberPolicy", - "policyName": "OSDF_CASABLANCA.SubscriberPolicy_v1", - "description": "Subscriber Policy", - "templateVersion": "OpenSource.version.1", - "version": "test1", - "priority": "1", - "riskType": "test", - "riskLevel": "3", - "guard": "False", - "content": { - "identity": "subscriber", - "policyScope": ["vCPE", "subscriber_x", "subscriber_y", "subscriberPolicy"], - "properties": { - "subscriberName": ["subscriber_x", "subscriber_y"], - "subscriberRole": ["PVT Homing"], - "provStatus": ["CAPPED"] - }, - "policyType": "subscriberPolicy", - "serviceName": "vCPE" - } -} diff --git a/test/policy-local-files/subscriber_policy_vCPE.json b/test/policy-local-files/subscriber_policy_vCPE.json new file mode 100644 index 0000000..bd56dfc --- /dev/null +++ b/test/policy-local-files/subscriber_policy_vCPE.json @@ -0,0 +1,22 @@ +{ + "service": "subscriberPolicy", + "policyName": "OSDF_CASABLANCA.SubscriberPolicy_v1", + "description": "Subscriber Policy for vCPE", + "templateVersion": "OpenSource.version.1", + "version": "test1", + "priority": "1", + "riskType": "test", + "riskLevel": "3", + "guard": "False", + "content": { + "identity": "subscriber_vCPE", + "policyScope": ["vCPE", "subscriber_x", "subscriber_y", "subscriberPolicy"], + "properties": { + "subscriberName": ["subscriber_x", "subscriber_y"], + "subscriberRole": ["PVT Homing"], + "provStatus": ["CAPPED"] + }, + "policyType": "subscriberPolicy", + "serviceName": "vCPE" + } +} diff --git a/test/policy-local-files/subscriber_policy_vFW.json b/test/policy-local-files/subscriber_policy_vFW.json new file mode 100644 index 0000000..38e615c --- /dev/null +++ b/test/policy-local-files/subscriber_policy_vFW.json @@ -0,0 +1,22 @@ +{ + "service": "subscriberPolicy", + "policyName": "OSDF_CASABLANCA.SubscriberPolicy_v1", + "description": "Subscriber Policy for VFW", + "templateVersion": "OpenSource.version.1", + "version": "test1", + "priority": "1", + "riskType": "test", + "riskLevel": "3", + "guard": "False", + "content": { + "identity": "subscriber_vFW", + "policyScope": ["vFW", "subscriber_x", "subscriber_y", "subscriberPolicy"], + "properties": { + "subscriberName": ["subscriber_x", "subscriber_y"], + "subscriberRole": ["PVT Homing"], + "provStatus": ["CAPPED"] + }, + "policyType": "subscriberPolicy", + "serviceName": "vFW" + } +} -- cgit 1.2.3-korg