summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAnkitkumar Patel <ankit@research.att.com>2018-03-25 19:27:39 -0400
committerAnkitkumar Patel <ankit@research.att.com>2018-03-25 19:31:24 -0400
commitbc1d288ac29c3c9bf968cea5ac2d95b8bcd67eae (patch)
treee7dc43bd3bc59ab1855263c4a61832966283025c /test
parented70b5c6d6589e4e1ce80229612ea5b680736c4c (diff)
Update the policy adaptor and related testcases
Generalized the policy adaptor code by removing homing specific logic. Issue-ID: OPTFRA-27 Change-Id: I331030a2f3f5c0c17af1a72af9794131555a9217 Signed-off-by: Ankitkumar Patel <ankit@research.att.com>
Diffstat (limited to 'test')
-rw-r--r--test/config/common_config.yaml22
-rw-r--r--test/placement-tests/policy_response.json182
-rw-r--r--test/placement-tests/policy_response_error1.json164
-rw-r--r--test/placement-tests/policy_response_error2.json182
-rw-r--r--test/placement-tests/request.json1
-rw-r--r--test/placement-tests/request_error1.json101
-rw-r--r--test/placement-tests/scopePolicies.json21
-rw-r--r--test/placement-tests/testScoperequest.json240
-rw-r--r--test/placement-tests/test_by_scope.yaml30
-rw-r--r--test/test_PolicyCalls.py110
10 files changed, 809 insertions, 244 deletions
diff --git a/test/config/common_config.yaml b/test/config/common_config.yaml
index 1c041d9..6a5f5e1 100644
--- a/test/config/common_config.yaml
+++ b/test/config/common_config.yaml
@@ -29,15 +29,27 @@ service_info:
vcpeHostName: requestParameters.vcpeHostName
e2eVpnKey: requestParameters.e2eVpnKey
+references:
+ service_name:
+ source: request
+ value: serviceInfo.serviceName
+ subscriber_role:
+ source: SubscriberPolicy
+ value: content.properties.subscriberRole
+
policy_info:
placement:
policy_fetch: by_scope
policy_scope:
default_scope: OSDF_R2
- scope_vcpe: OSDF_R2
- service_name: placementInfo.serviceModelInfo.modelName
- policy_subscriber: SubscriberPolicy
- subscriber_name: placementInfo.subscriberInfo.subscriberName
+ vcpe_scope: OSDF_R2
+ secondary_scopes:
+ -
+ - get_param: service_name
+ - SubscriberPolicy
+ -
+ - get_param: service_name
+ - get_param: subscriber_role
default: # if no explicit service related information is needed
policy_fetch: by_name
- policy_scope: none
+ policy_scope: none \ No newline at end of file
diff --git a/test/placement-tests/policy_response.json b/test/placement-tests/policy_response.json
new file mode 100644
index 0000000..ed5b4ab
--- /dev/null
+++ b/test/placement-tests/policy_response.json
@@ -0,0 +1,182 @@
+[
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"SubscriberPolicy\",\"policyName\":\"oofBeijing.SubscriberPolicy_v1\",\"description\":\"Subscriber Policy\",\"templateVersion\":\"0.0.1\",\"version\":\"oofBeijing\",\"priority\":\"1\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"identity\":\"subscriber\",\"policyScope\":[\"vCPE\",\"subscriber_x\",\"subscriber_y\"],\"properties\":{\"subscriberName\":[\"subscriber_x\",\"subscriber_y\"],\"subscriberRole\":[\"PVT Homing\"],\"provStatus\":[\"CAPPED\"]},\"policyType\":\"SubscriberPolicy\"}}",
+ "policyName": "oofBeijing.Config_MS_SubscriberPolicy_v1.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "SubscriberPolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"hpaPolicy\",\"policyName\":\"oofBeijing.hpaPolicy_vGMuxInfra\",\"description\":\"HPA policy for vGMuxInfra\",\"templateVersion\":\"0.0.1\",\"version\":\"1.0\",\"priority\":\"3\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"resources\":\"vGMuxInfra\",\"identity\":\"hpaPolicy_vGMuxInfra\",\"policyScope\":[\"vCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vGMuxInfra\"],\"policyType\":\"hpaPolicy\",\"flavorFeatures\":[{\"flavorLabel\":\"flavor_label_vm_01\",\"flavorProperties\":[{\"hpa-feature\":\"cpuTopology\",\"mandatory\":\"True\",\"architecture\":\"generic\",\"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\",\"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\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"dataProcessingAccelerationLibrary\",\"hpa-attribute-value\":\"ovsDpdk_version\",\"operator\":\"=\",\"unit\":\"\"}]},{\"hpa-feature\":\"cpuInstructionSetExtensions\",\"mandatory\":\"True\",\"architecture\":\"INTEL-64\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"instructionSetExtensions\",\"hpa-attribute-value\":[\"<CPUINST>\",\"<CPUINST>\"],\"operator\":\"ALL\",\"unit\":\"\"}]}]},{\"flavorLabel\":\"flavor_label_vm_02\",\"flavorProperties\":[{\"hpa-feature\":\"cpuPinningy\",\"mandatory\":\"True\",\"architecture\":\"generic\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"logicalCpuThreadPinningPolicy\",\"hpa-attribute-value\":\"<CPUTHREADPOLICY>\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"logicalCpuPinningPolicy\",\"hpa-attribute-value\":\"<CPUPOLICY>\",\"operator\":\"=\",\"unit\":\"\"}]},{\"hpa-feature\":\"basicCapabilities\",\"mandatory\":\"True\",\"architecture\":\"generic\",\"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\",\"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\":\"pcie\",\"mandatory\":\"True\",\"architecture\":\"generic\",\"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\":\"\"},{\"hpa-attribute-key\":\"functionType\",\"hpa-attribute-value\":\"<PCITYPEVALUE>\",\"operator\":\"=\",\"unit\":\"\"}]}]},{\"flavorLabel\":\"flavor_label_vm_03\",\"flavorProperties\":[{\"hpa-feature\":\"numa\",\"mandatory\":\"False\",\"score\":\"5\",\"architecture\":\"generic\",\"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\",\"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\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"memoryPageSize\",\"hpa-attribute-value\":\"<MEMORYPAGESIZE>\",\"operator\":\"=\",\"unit\":\"\"}]}]}]}}",
+ "policyName": "oofBeijing.Config_MS_hpaPolicy_vGMuxInfra.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "hpaPolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"VnfPolicy\",\"policyName\":\"oofBeijing.vnfPolicy_vG\",\"description\":\"vnfPolicy\",\"templateVersion\":\"1702.03\",\"version\":\"oofBeijing\",\"priority\":\"6\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"identity\":\"vnf_vG\",\"policyScope\":[\"vCPE\",\"INTERNATIONAL\",\"ip\",\"vG\"],\"policyType\":\"vnf_policy\",\"resources\":[\"vG\"],\"applicableResources\":\"any\",\"vnfProperties\":[{\"inventoryProvider\":\"aai\",\"serviceType\":\"\",\"inventoryType\":\"cloud\",\"customerId\":\"\"},{\"inventoryProvider\":\"multicloud\",\"serviceType\":\"HNGATEWAY\",\"inventoryType\":\"service\",\"customerId\":\"21014aa2-526b-11e6-beb8-9e71128cae77\"}]}}",
+ "policyName": "oofBeijing.Config_MS_vnfPolicy_vG.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "VnfPolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"VnfPolicy\",\"policyName\":\"oofBeijing.vnfPolicy_vGMuxInfra\",\"description\":\"vnfPolicy\",\"templateVersion\":\"1702.03\",\"version\":\"oofBeijing\",\"priority\":\"6\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"identity\":\"vnf_vGMuxInfra\",\"policyScope\":[\"vCPE\",\"INTERNATIONAL\",\"ip\",\"vGMuxInfra\"],\"policyType\":\"vnf_policy\",\"resources\":[\"vGMuxInfra\"],\"applicableResources\":\"any\",\"vnfProperties\":[{\"inventoryProvider\":\"aai\",\"serviceType\":\"\",\"inventoryType\":\"cloud\",\"customerId\":\"\"},{\"inventoryProvider\":\"multicloud\",\"serviceType\":\"HNGATEWAY\",\"inventoryType\":\"service\",\"customerId\":\"21014aa2-526b-11e6-beb8-9e71128cae77\"}]}}",
+ "policyName": "oofBeijing.Config_MS_vnfPolicy_vGMuxInfra.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "VnfPolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"distancePolicy\",\"policyName\":\"oofBeijing.distancePolicy_vG\",\"description\":\"Distance Policy for vG\",\"templateVersion\":\"0.0.1\",\"version\":\"oofBeijing\",\"priority\":\"3\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"distanceProperties\":{\"locationInfo\":\"customer_location\",\"distance\":{\"value\":\"1500\",\"operator\":\"<\",\"unit\":\"km\"}},\"identity\":\"distance-vG\",\"resources\":[\"vG\"],\"policyScope\":[\"vCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vG\"],\"policyType\":\"distancePolicy\",\"applicableResources\":\"any\"}}",
+ "policyName": "oofBeijing.Config_MS_distancePolicy_vG.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "distancePolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"capacityPolicy\",\"policyName\":\"oofBeijing.capacityPolicy_vG\",\"description\":\"Capacity policy for vG\",\"templateVersion\":\"1702.03\",\"version\":\"oofBeijing\",\"priority\":\"5\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"identity\":\"capacity_vG\",\"policyScope\":[\"VCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vG\"],\"resources\":[\"vG\"],\"capacityProperty\":{\"cpu\":{\"value\":2,\"operator\":\">\"},\"memory\":{\"value\":4,\"operator\":\">\",\"unit\":\"GB\"}},\"policyType\":\"capacityPolicy\",\"applicableResources\":\"any\"}}",
+ "policyName": "oofBeijing.Config_MS_capacityPolicy_vG.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "capacityPolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"optimizationQueryPolicy\",\"policyName\":\"oofBeijing.queryPolicy_vCPE\",\"description\":\"Optimization query policy for vCPE\",\"templateVersion\":\"0.0.1\",\"version\":\"oofBeijing\",\"priority\":\"3\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"queryProperties\":[{\"attribute\":\"locationId\",\"value\":\"orderInfo.customerLocation\"},{\"attribute\":\"id\",\"value\":\"orderInfo.vpnInfo\"},{\"attribute\":\"upstreamBW\",\"value\":\"orderInfo.vpnInfo\"}],\"policyScope\":[\"vCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vGMuxInfra\",\"vG\"],\"policyType\":\"optimizationQueryPolicy\"}}",
+ "policyName": "oofBeijing.Config_MS_queryPolicy_vCPE.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "optimizationQueryPolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"PlacementOptimizationPolicy\",\"policyName\":\"oofBeijing.PlacementOptimizationPolicy_vGMuxInfra\",\"description\":\"Placement Optimization Policy for vGMuxInfra\",\"templateVersion\":\"1702.03\",\"version\":\"oofBeijing\",\"priority\":\"5\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"objectiveParameter\":{\"parameterAttributes\":[{\"resource\":[\"vGMuxInfra\"],\"customerLocationInfo\":\"customer_loc\",\"parameter\":\"distance\",\"weight\":\"1\",\"operator\":\"product\"},{\"resource\":[\"vG\"],\"customerLocationInfo\":\"customer_loc\",\"parameter\":\"distance\",\"weight\":\"1\",\"operator\":\"product\"}],\"operator\":\"sum\"},\"identity\":\"optimization\",\"policyScope\":[\"vCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vGMuxInfra\",\"vG\"],\"policyType\":\"placementOptimization\",\"objective\":\"minimize\"}}",
+ "policyName": "oofBeijing.Config_MS_PlacementOptimizationPolicy_vGMuxInfra.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "PlacementOptimizationPolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"distancePolicy\",\"policyName\":\"oofBeijing.distancePolicy_vGMuxInfra\",\"description\":\"Distance Policy for vGMuxInfra\",\"templateVersion\":\"0.0.1\",\"version\":\"oofBeijing\",\"priority\":\"3\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"distanceProperties\":{\"locationInfo\":\"customer_location\",\"distance\":{\"value\":\"500\",\"operator\":\"<\",\"unit\":\"km\"}},\"identity\":\"distance-vGMuxInfra\",\"resources\":[\"vGMuxInfra\"],\"policyScope\":[\"vCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vGMuxInfra\"],\"policyType\":\"distancePolicy\",\"applicableResources\":\"any\"}}",
+ "policyName": "oofBeijing.Config_MS_distancePolicy_vGMuxInfra.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "distancePolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"capacityPolicy\",\"policyName\":\"oofBeijing.capacityPolicy_vGMuxInfra\",\"description\":\"Capacity policy for vGMuxInfra\",\"templateVersion\":\"1702.03\",\"version\":\"oofBeijing\",\"priority\":\"5\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"identity\":\"capacity_vGMuxInfra\",\"policyScope\":[\"VCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vGMuxInfra\"],\"resources\":[\"vGMuxInfra\"],\"capacityProperty\":{\"cpu\":{\"value\":2,\"operator\":\">\"},\"memory\":{\"value\":4,\"operator\":\">\",\"unit\":\"GB\"}},\"policyType\":\"capacityPolicy\",\"applicableResources\":\"any\"}}",
+ "policyName": "oofBeijing.Config_MS_capacityPolicy_vGMuxInfra.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "capacityPolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ }
+] \ No newline at end of file
diff --git a/test/placement-tests/policy_response_error1.json b/test/placement-tests/policy_response_error1.json
new file mode 100644
index 0000000..788c5c4
--- /dev/null
+++ b/test/placement-tests/policy_response_error1.json
@@ -0,0 +1,164 @@
+[
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"hpaPolicy\",\"policyName\":\"oofBeijing.hpaPolicy_vGMuxInfra\",\"description\":\"HPA policy for vGMuxInfra\",\"templateVersion\":\"0.0.1\",\"version\":\"1.0\",\"priority\":\"3\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"resources\":\"vGMuxInfra\",\"identity\":\"hpaPolicy_vGMuxInfra\",\"policyScope\":[\"vCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vGMuxInfra\"],\"policyType\":\"hpaPolicy\",\"flavorFeatures\":[{\"flavorLabel\":\"flavor_label_vm_01\",\"flavorProperties\":[{\"hpa-feature\":\"cpuTopology\",\"mandatory\":\"True\",\"architecture\":\"generic\",\"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\",\"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\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"dataProcessingAccelerationLibrary\",\"hpa-attribute-value\":\"ovsDpdk_version\",\"operator\":\"=\",\"unit\":\"\"}]},{\"hpa-feature\":\"cpuInstructionSetExtensions\",\"mandatory\":\"True\",\"architecture\":\"INTEL-64\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"instructionSetExtensions\",\"hpa-attribute-value\":[\"<CPUINST>\",\"<CPUINST>\"],\"operator\":\"ALL\",\"unit\":\"\"}]}]},{\"flavorLabel\":\"flavor_label_vm_02\",\"flavorProperties\":[{\"hpa-feature\":\"cpuPinningy\",\"mandatory\":\"True\",\"architecture\":\"generic\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"logicalCpuThreadPinningPolicy\",\"hpa-attribute-value\":\"<CPUTHREADPOLICY>\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"logicalCpuPinningPolicy\",\"hpa-attribute-value\":\"<CPUPOLICY>\",\"operator\":\"=\",\"unit\":\"\"}]},{\"hpa-feature\":\"basicCapabilities\",\"mandatory\":\"True\",\"architecture\":\"generic\",\"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\",\"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\":\"pcie\",\"mandatory\":\"True\",\"architecture\":\"generic\",\"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\":\"\"},{\"hpa-attribute-key\":\"functionType\",\"hpa-attribute-value\":\"<PCITYPEVALUE>\",\"operator\":\"=\",\"unit\":\"\"}]}]},{\"flavorLabel\":\"flavor_label_vm_03\",\"flavorProperties\":[{\"hpa-feature\":\"numa\",\"mandatory\":\"False\",\"score\":\"5\",\"architecture\":\"generic\",\"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\",\"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\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"memoryPageSize\",\"hpa-attribute-value\":\"<MEMORYPAGESIZE>\",\"operator\":\"=\",\"unit\":\"\"}]}]}]}}",
+ "policyName": "oofBeijing.Config_MS_hpaPolicy_vGMuxInfra.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "hpaPolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"VnfPolicy\",\"policyName\":\"oofBeijing.vnfPolicy_vG\",\"description\":\"vnfPolicy\",\"templateVersion\":\"1702.03\",\"version\":\"oofBeijing\",\"priority\":\"6\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"identity\":\"vnf_vG\",\"policyScope\":[\"vCPE\",\"INTERNATIONAL\",\"ip\",\"vG\"],\"policyType\":\"vnf_policy\",\"resources\":[\"vG\"],\"applicableResources\":\"any\",\"vnfProperties\":[{\"inventoryProvider\":\"aai\",\"serviceType\":\"\",\"inventoryType\":\"cloud\",\"customerId\":\"\"},{\"inventoryProvider\":\"multicloud\",\"serviceType\":\"HNGATEWAY\",\"inventoryType\":\"service\",\"customerId\":\"21014aa2-526b-11e6-beb8-9e71128cae77\"}]}}",
+ "policyName": "oofBeijing.Config_MS_vnfPolicy_vG.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "VnfPolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"VnfPolicy\",\"policyName\":\"oofBeijing.vnfPolicy_vGMuxInfra\",\"description\":\"vnfPolicy\",\"templateVersion\":\"1702.03\",\"version\":\"oofBeijing\",\"priority\":\"6\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"identity\":\"vnf_vGMuxInfra\",\"policyScope\":[\"vCPE\",\"INTERNATIONAL\",\"ip\",\"vGMuxInfra\"],\"policyType\":\"vnf_policy\",\"resources\":[\"vGMuxInfra\"],\"applicableResources\":\"any\",\"vnfProperties\":[{\"inventoryProvider\":\"aai\",\"serviceType\":\"\",\"inventoryType\":\"cloud\",\"customerId\":\"\"},{\"inventoryProvider\":\"multicloud\",\"serviceType\":\"HNGATEWAY\",\"inventoryType\":\"service\",\"customerId\":\"21014aa2-526b-11e6-beb8-9e71128cae77\"}]}}",
+ "policyName": "oofBeijing.Config_MS_vnfPolicy_vGMuxInfra.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "VnfPolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"distancePolicy\",\"policyName\":\"oofBeijing.distancePolicy_vG\",\"description\":\"Distance Policy for vG\",\"templateVersion\":\"0.0.1\",\"version\":\"oofBeijing\",\"priority\":\"3\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"distanceProperties\":{\"locationInfo\":\"customer_location\",\"distance\":{\"value\":\"1500\",\"operator\":\"<\",\"unit\":\"km\"}},\"identity\":\"distance-vG\",\"resources\":[\"vG\"],\"policyScope\":[\"vCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vG\"],\"policyType\":\"distancePolicy\",\"applicableResources\":\"any\"}}",
+ "policyName": "oofBeijing.Config_MS_distancePolicy_vG.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "distancePolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"capacityPolicy\",\"policyName\":\"oofBeijing.capacityPolicy_vG\",\"description\":\"Capacity policy for vG\",\"templateVersion\":\"1702.03\",\"version\":\"oofBeijing\",\"priority\":\"5\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"identity\":\"capacity_vG\",\"policyScope\":[\"VCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vG\"],\"resources\":[\"vG\"],\"capacityProperty\":{\"cpu\":{\"value\":2,\"operator\":\">\"},\"memory\":{\"value\":4,\"operator\":\">\",\"unit\":\"GB\"}},\"policyType\":\"capacityPolicy\",\"applicableResources\":\"any\"}}",
+ "policyName": "oofBeijing.Config_MS_capacityPolicy_vG.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "capacityPolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"optimizationQueryPolicy\",\"policyName\":\"oofBeijing.queryPolicy_vCPE\",\"description\":\"Optimization query policy for vCPE\",\"templateVersion\":\"0.0.1\",\"version\":\"oofBeijing\",\"priority\":\"3\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"queryProperties\":[{\"attribute\":\"locationId\",\"value\":\"orderInfo.customerLocation\"},{\"attribute\":\"id\",\"value\":\"orderInfo.vpnInfo\"},{\"attribute\":\"upstreamBW\",\"value\":\"orderInfo.vpnInfo\"}],\"policyScope\":[\"vCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vGMuxInfra\",\"vG\"],\"policyType\":\"optimizationQueryPolicy\"}}",
+ "policyName": "oofBeijing.Config_MS_queryPolicy_vCPE.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "optimizationQueryPolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"PlacementOptimizationPolicy\",\"policyName\":\"oofBeijing.PlacementOptimizationPolicy_vGMuxInfra\",\"description\":\"Placement Optimization Policy for vGMuxInfra\",\"templateVersion\":\"1702.03\",\"version\":\"oofBeijing\",\"priority\":\"5\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"objectiveParameter\":{\"parameterAttributes\":[{\"resource\":[\"vGMuxInfra\"],\"customerLocationInfo\":\"customer_loc\",\"parameter\":\"distance\",\"weight\":\"1\",\"operator\":\"product\"},{\"resource\":[\"vG\"],\"customerLocationInfo\":\"customer_loc\",\"parameter\":\"distance\",\"weight\":\"1\",\"operator\":\"product\"}],\"operator\":\"sum\"},\"identity\":\"optimization\",\"policyScope\":[\"vCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vGMuxInfra\",\"vG\"],\"policyType\":\"placementOptimization\",\"objective\":\"minimize\"}}",
+ "policyName": "oofBeijing.Config_MS_PlacementOptimizationPolicy_vGMuxInfra.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "PlacementOptimizationPolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"distancePolicy\",\"policyName\":\"oofBeijing.distancePolicy_vGMuxInfra\",\"description\":\"Distance Policy for vGMuxInfra\",\"templateVersion\":\"0.0.1\",\"version\":\"oofBeijing\",\"priority\":\"3\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"distanceProperties\":{\"locationInfo\":\"customer_location\",\"distance\":{\"value\":\"500\",\"operator\":\"<\",\"unit\":\"km\"}},\"identity\":\"distance-vGMuxInfra\",\"resources\":[\"vGMuxInfra\"],\"policyScope\":[\"vCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vGMuxInfra\"],\"policyType\":\"distancePolicy\",\"applicableResources\":\"any\"}}",
+ "policyName": "oofBeijing.Config_MS_distancePolicy_vGMuxInfra.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "distancePolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"capacityPolicy\",\"policyName\":\"oofBeijing.capacityPolicy_vGMuxInfra\",\"description\":\"Capacity policy for vGMuxInfra\",\"templateVersion\":\"1702.03\",\"version\":\"oofBeijing\",\"priority\":\"5\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"identity\":\"capacity_vGMuxInfra\",\"policyScope\":[\"VCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vGMuxInfra\"],\"resources\":[\"vGMuxInfra\"],\"capacityProperty\":{\"cpu\":{\"value\":2,\"operator\":\">\"},\"memory\":{\"value\":4,\"operator\":\">\",\"unit\":\"GB\"}},\"policyType\":\"capacityPolicy\",\"applicableResources\":\"any\"}}",
+ "policyName": "oofBeijing.Config_MS_capacityPolicy_vGMuxInfra.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "capacityPolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ }
+] \ No newline at end of file
diff --git a/test/placement-tests/policy_response_error2.json b/test/placement-tests/policy_response_error2.json
new file mode 100644
index 0000000..c302a72
--- /dev/null
+++ b/test/placement-tests/policy_response_error2.json
@@ -0,0 +1,182 @@
+[
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"SubscriberPolicy\",\"policyName\":\"oofBeijing.SubscriberPolicy_v1\",\"description\":\"Subscriber Policy\",\"templateVersion\":\"0.0.1\",\"version\":\"oofBeijing\",\"priority\":\"1\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"identity\":\"subscriber\",\"policyScope\":[\"vCPE\",\"subscriber_x\",\"subscriber_y\"],\"properties\":{\"subscriberName\":[\"subscriber_x\",\"subscriber_y\"],\"subscriberRole\":[],\"provStatus\":[\"CAPPED\"]},\"policyType\":\"SubscriberPolicy\"}}",
+ "policyName": "oofBeijing.Config_MS_SubscriberPolicy_v1.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "SubscriberPolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"hpaPolicy\",\"policyName\":\"oofBeijing.hpaPolicy_vGMuxInfra\",\"description\":\"HPA policy for vGMuxInfra\",\"templateVersion\":\"0.0.1\",\"version\":\"1.0\",\"priority\":\"3\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"resources\":\"vGMuxInfra\",\"identity\":\"hpaPolicy_vGMuxInfra\",\"policyScope\":[\"vCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vGMuxInfra\"],\"policyType\":\"hpaPolicy\",\"flavorFeatures\":[{\"flavorLabel\":\"flavor_label_vm_01\",\"flavorProperties\":[{\"hpa-feature\":\"cpuTopology\",\"mandatory\":\"True\",\"architecture\":\"generic\",\"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\",\"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\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"dataProcessingAccelerationLibrary\",\"hpa-attribute-value\":\"ovsDpdk_version\",\"operator\":\"=\",\"unit\":\"\"}]},{\"hpa-feature\":\"cpuInstructionSetExtensions\",\"mandatory\":\"True\",\"architecture\":\"INTEL-64\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"instructionSetExtensions\",\"hpa-attribute-value\":[\"<CPUINST>\",\"<CPUINST>\"],\"operator\":\"ALL\",\"unit\":\"\"}]}]},{\"flavorLabel\":\"flavor_label_vm_02\",\"flavorProperties\":[{\"hpa-feature\":\"cpuPinningy\",\"mandatory\":\"True\",\"architecture\":\"generic\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"logicalCpuThreadPinningPolicy\",\"hpa-attribute-value\":\"<CPUTHREADPOLICY>\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"logicalCpuPinningPolicy\",\"hpa-attribute-value\":\"<CPUPOLICY>\",\"operator\":\"=\",\"unit\":\"\"}]},{\"hpa-feature\":\"basicCapabilities\",\"mandatory\":\"True\",\"architecture\":\"generic\",\"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\",\"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\":\"pcie\",\"mandatory\":\"True\",\"architecture\":\"generic\",\"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\":\"\"},{\"hpa-attribute-key\":\"functionType\",\"hpa-attribute-value\":\"<PCITYPEVALUE>\",\"operator\":\"=\",\"unit\":\"\"}]}]},{\"flavorLabel\":\"flavor_label_vm_03\",\"flavorProperties\":[{\"hpa-feature\":\"numa\",\"mandatory\":\"False\",\"score\":\"5\",\"architecture\":\"generic\",\"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\",\"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\",\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"memoryPageSize\",\"hpa-attribute-value\":\"<MEMORYPAGESIZE>\",\"operator\":\"=\",\"unit\":\"\"}]}]}]}}",
+ "policyName": "oofBeijing.Config_MS_hpaPolicy_vGMuxInfra.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "hpaPolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"VnfPolicy\",\"policyName\":\"oofBeijing.vnfPolicy_vG\",\"description\":\"vnfPolicy\",\"templateVersion\":\"1702.03\",\"version\":\"oofBeijing\",\"priority\":\"6\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"identity\":\"vnf_vG\",\"policyScope\":[\"vCPE\",\"INTERNATIONAL\",\"ip\",\"vG\"],\"policyType\":\"vnf_policy\",\"resources\":[\"vG\"],\"applicableResources\":\"any\",\"vnfProperties\":[{\"inventoryProvider\":\"aai\",\"serviceType\":\"\",\"inventoryType\":\"cloud\",\"customerId\":\"\"},{\"inventoryProvider\":\"multicloud\",\"serviceType\":\"HNGATEWAY\",\"inventoryType\":\"service\",\"customerId\":\"21014aa2-526b-11e6-beb8-9e71128cae77\"}]}}",
+ "policyName": "oofBeijing.Config_MS_vnfPolicy_vG.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "VnfPolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"VnfPolicy\",\"policyName\":\"oofBeijing.vnfPolicy_vGMuxInfra\",\"description\":\"vnfPolicy\",\"templateVersion\":\"1702.03\",\"version\":\"oofBeijing\",\"priority\":\"6\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"identity\":\"vnf_vGMuxInfra\",\"policyScope\":[\"vCPE\",\"INTERNATIONAL\",\"ip\",\"vGMuxInfra\"],\"policyType\":\"vnf_policy\",\"resources\":[\"vGMuxInfra\"],\"applicableResources\":\"any\",\"vnfProperties\":[{\"inventoryProvider\":\"aai\",\"serviceType\":\"\",\"inventoryType\":\"cloud\",\"customerId\":\"\"},{\"inventoryProvider\":\"multicloud\",\"serviceType\":\"HNGATEWAY\",\"inventoryType\":\"service\",\"customerId\":\"21014aa2-526b-11e6-beb8-9e71128cae77\"}]}}",
+ "policyName": "oofBeijing.Config_MS_vnfPolicy_vGMuxInfra.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "VnfPolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"distancePolicy\",\"policyName\":\"oofBeijing.distancePolicy_vG\",\"description\":\"Distance Policy for vG\",\"templateVersion\":\"0.0.1\",\"version\":\"oofBeijing\",\"priority\":\"3\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"distanceProperties\":{\"locationInfo\":\"customer_location\",\"distance\":{\"value\":\"1500\",\"operator\":\"<\",\"unit\":\"km\"}},\"identity\":\"distance-vG\",\"resources\":[\"vG\"],\"policyScope\":[\"vCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vG\"],\"policyType\":\"distancePolicy\",\"applicableResources\":\"any\"}}",
+ "policyName": "oofBeijing.Config_MS_distancePolicy_vG.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "distancePolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"capacityPolicy\",\"policyName\":\"oofBeijing.capacityPolicy_vG\",\"description\":\"Capacity policy for vG\",\"templateVersion\":\"1702.03\",\"version\":\"oofBeijing\",\"priority\":\"5\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"identity\":\"capacity_vG\",\"policyScope\":[\"VCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vG\"],\"resources\":[\"vG\"],\"capacityProperty\":{\"cpu\":{\"value\":2,\"operator\":\">\"},\"memory\":{\"value\":4,\"operator\":\">\",\"unit\":\"GB\"}},\"policyType\":\"capacityPolicy\",\"applicableResources\":\"any\"}}",
+ "policyName": "oofBeijing.Config_MS_capacityPolicy_vG.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "capacityPolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"optimizationQueryPolicy\",\"policyName\":\"oofBeijing.queryPolicy_vCPE\",\"description\":\"Optimization query policy for vCPE\",\"templateVersion\":\"0.0.1\",\"version\":\"oofBeijing\",\"priority\":\"3\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"queryProperties\":[{\"attribute\":\"locationId\",\"value\":\"orderInfo.customerLocation\"},{\"attribute\":\"id\",\"value\":\"orderInfo.vpnInfo\"},{\"attribute\":\"upstreamBW\",\"value\":\"orderInfo.vpnInfo\"}],\"policyScope\":[\"vCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vGMuxInfra\",\"vG\"],\"policyType\":\"optimizationQueryPolicy\"}}",
+ "policyName": "oofBeijing.Config_MS_queryPolicy_vCPE.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "optimizationQueryPolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"PlacementOptimizationPolicy\",\"policyName\":\"oofBeijing.PlacementOptimizationPolicy_vGMuxInfra\",\"description\":\"Placement Optimization Policy for vGMuxInfra\",\"templateVersion\":\"1702.03\",\"version\":\"oofBeijing\",\"priority\":\"5\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"objectiveParameter\":{\"parameterAttributes\":[{\"resource\":[\"vGMuxInfra\"],\"customerLocationInfo\":\"customer_loc\",\"parameter\":\"distance\",\"weight\":\"1\",\"operator\":\"product\"},{\"resource\":[\"vG\"],\"customerLocationInfo\":\"customer_loc\",\"parameter\":\"distance\",\"weight\":\"1\",\"operator\":\"product\"}],\"operator\":\"sum\"},\"identity\":\"optimization\",\"policyScope\":[\"vCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vGMuxInfra\",\"vG\"],\"policyType\":\"placementOptimization\",\"objective\":\"minimize\"}}",
+ "policyName": "oofBeijing.Config_MS_PlacementOptimizationPolicy_vGMuxInfra.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "PlacementOptimizationPolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"distancePolicy\",\"policyName\":\"oofBeijing.distancePolicy_vGMuxInfra\",\"description\":\"Distance Policy for vGMuxInfra\",\"templateVersion\":\"0.0.1\",\"version\":\"oofBeijing\",\"priority\":\"3\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"distanceProperties\":{\"locationInfo\":\"customer_location\",\"distance\":{\"value\":\"500\",\"operator\":\"<\",\"unit\":\"km\"}},\"identity\":\"distance-vGMuxInfra\",\"resources\":[\"vGMuxInfra\"],\"policyScope\":[\"vCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vGMuxInfra\"],\"policyType\":\"distancePolicy\",\"applicableResources\":\"any\"}}",
+ "policyName": "oofBeijing.Config_MS_distancePolicy_vGMuxInfra.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "distancePolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"capacityPolicy\",\"policyName\":\"oofBeijing.capacityPolicy_vGMuxInfra\",\"description\":\"Capacity policy for vGMuxInfra\",\"templateVersion\":\"1702.03\",\"version\":\"oofBeijing\",\"priority\":\"5\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"identity\":\"capacity_vGMuxInfra\",\"policyScope\":[\"VCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vGMuxInfra\"],\"resources\":[\"vGMuxInfra\"],\"capacityProperty\":{\"cpu\":{\"value\":2,\"operator\":\">\"},\"memory\":{\"value\":4,\"operator\":\">\",\"unit\":\"GB\"}},\"policyType\":\"capacityPolicy\",\"applicableResources\":\"any\"}}",
+ "policyName": "oofBeijing.Config_MS_capacityPolicy_vGMuxInfra.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ONAPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "capacityPolicy",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": { },
+ "property": null
+ }
+] \ No newline at end of file
diff --git a/test/placement-tests/request.json b/test/placement-tests/request.json
index c4cb31f..d9b16ca 100644
--- a/test/placement-tests/request.json
+++ b/test/placement-tests/request.json
@@ -11,6 +11,7 @@
},
"placementInfo": {
"requestParameters": { "customerLatitude": 32.89748, "customerLongitude": -97.040443, "customerName": "xyz" },
+ "subscriberInfo": {"globalSubscriberId": "xxx-xx-xxx", "subscriberName": "subscriber_x"},
"placementDemands": [
{
"resourceModuleName": "vGMuxInfra",
diff --git a/test/placement-tests/request_error1.json b/test/placement-tests/request_error1.json
new file mode 100644
index 0000000..65a145f
--- /dev/null
+++ b/test/placement-tests/request_error1.json
@@ -0,0 +1,101 @@
+{
+ "requestInfo": {
+ "transactionId": "xxx-xxx-xxxx",
+ "requestId": "yyy-yyy-yyyy",
+ "callbackUrl": "https://wiki.onap.org:5000/callbackUrl/",
+ "sourceId": "SO",
+ "requestType": "create",
+ "numSolutions": 1,
+ "optimizers": ["placement"],
+ "timeout": 600
+ },
+ "placementInfo": {
+ "requestParameters": { "customerLatitude": 32.89748, "customerLongitude": -97.040443, "customerName": "xyz" },
+ "subscriberInfo": {"globalSubscriberId": "xxx-xx-xxx", "subscriberName": "subscriber_x"},
+ "placementDemands": [
+ {
+ "resourceModuleName": "vGMuxInfra",
+ "serviceResourceId": "vGMuxInfra-xx",
+ "tenantId": "vGMuxInfra-tenant",
+ "resourceModelInfo": {
+ "modelInvariantId": "vGMuxInfra-modelInvariantId",
+ "modelVersionId": "vGMuxInfra-versionId",
+ "modelName": "vGMuxInfra-model",
+ "modelType": "resource",
+ "modelVersion": "1.0",
+ "modelCustomizationName": "vGMuxInfra-customeModelName"
+ }
+ },
+ {
+ "resourceModuleName": "vG",
+ "serviceResourceId": "71d563e8-e714-4393-8f99-cc480144a05e",
+ "tenantId": "vG-tenant",
+ "resourceModelInfo": {
+ "modelInvariantId": "vG-modelInvariantId",
+ "modelVersionId": "vG-versionId",
+ "modelName": "vG-model",
+ "modelType": "resource",
+ "modelVersion": "1.0",
+ "modelCustomizationName": "vG-customeModelName"
+ },
+ "existingCandidates": [
+ {
+ "identifierType": "serviceInstanceId",
+ "cloudOwner": "",
+ "identifiers": ["gjhd-098-fhd-987"]
+ }
+ ],
+ "excludedCandidates": [
+ {
+ "identifierType": "serviceInstanceId",
+ "cloudOwner": "",
+ "identifiers": ["gjhd-098-fhd-987"]
+ },
+ {
+ "identifierType": "vimId",
+ "cloudOwner": "vmware",
+ "identifiers": ["NYMDT67"]
+ }
+ ],
+ "requiredCandidates": [
+ {
+ "identifierType": "vimId",
+ "cloudOwner": "amazon",
+ "identifiers": ["TXAUS219"]
+ }
+ ]
+ }
+ ]
+ },
+ "serviceInfo": {
+ "serviceInstanceId": "d61b2543-5914-4b8f-8e81-81e38575b8ec",
+ "modelInfo": {
+ "modelInvariantId": "vCPE-invariantId",
+ "modelVersionId": "vCPE-versionId",
+ "modelName": "vCPE-model",
+ "modelType": "service",
+ "modelVersion": "1.0",
+ "modelCustomizationName": "vCPE-customeModelName"
+ }
+ },
+ "licenseInfo": {
+ "licenseDemands": [
+ {
+ "resourceModuleName": "vGMuxInfra",
+ "serviceResourceId": "vGMuxInfra-xx",
+ "resourceModelInfo": {
+ "modelInvariantId": "vGMuxInfra-modelInvariantId",
+ "modelVersionId": "vGMuxInfra-versionId",
+ "modelName": "vGMuxInfra-model",
+ "modelType": "resource",
+ "modelVersion": "1.0",
+ "modelCustomizationName": "vGMuxInfra-customeModelName"
+ },
+ "existingLicenses": {
+ "entitlementPoolUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", "43257b49-9602-4fe5-9337-094e52bc9435"],
+ "licenseKeyGroupUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", "43257b49-9602-4fe5-9337-094e52bc9435"]
+ }
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/test/placement-tests/scopePolicies.json b/test/placement-tests/scopePolicies.json
deleted file mode 100644
index 123c8e2..0000000
--- a/test/placement-tests/scopePolicies.json
+++ /dev/null
@@ -1,21 +0,0 @@
- {
- "policyConfigMessage": "Config Retrieved! ",
- "policyConfigStatus": "CONFIG_RETRIEVED",
- "type": "JSON",
- "config": "{\"service\":\"ResourceRegionPolicy\",\"policyName\":\"bg4702.ResourceRegionPolicy_vhnportal_v1\",\"description\":\"ResourceRegionPolicy@CreatedBy:mh7921\",\"templateVersion\":\"1802V01\",\"version\":\"1802V01\",\"priority\":\"1\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"identity\":\"vhnPortalResourceRegion\",\"policyScope\":{\"serviceType\":[\"DHV\"],\"geoRegion\":[\"US\",\"INTERNATIONAL\"],\"subscriberRole\":[\"FFA Homing\"],\"networkType\":[\"ip\"],\"resourceInstanceType\":[\"Primary Service_Admin\",\"Secondary Service_Admin\"]},\"resourceRegionProperty\":{\"request\":\"{\\\"dhv_service_instance\\\": {\\\"get_param\\\": \\\"SERVICE_INST\\\"}, \\\"service_type\\\": \\\"vHNPortal\\\", \\\"e2evpnkey\\\": {\\\"get_param\\\": \\\"E2EVPNKEY\\\"}}\",\"controller\":\"SDN-C\"},\"type\":\"region_fit\",\"resourceInstanceType\":[\"Primary Service_Admin\",\"Secondary Service_Admin\"]}}",
- "policyName": "bg4702.Config_MS_ResourceRegionPolicy_vhnportal_v1.1.xml",
- "policyVersion": "1",
- "matchingConditions": {
- "serviceType": "DHV",
- "ECOMPName": "SNIRO-Placement",
- "ONAPName": "SNIRO-Placement",
- "geoRegion": "US,INTERNATIONAL",
- "service": "ResourceRegionPolicy",
- "subscriberRole": "FFA Homing",
- "type": "region_fit",
- "networkType": "ip",
- "resourceInstanceType": "Primary Service_Admin,Secondary Service_Admin"
- },
- "responseAttributes": {},
- "property": null
- } \ No newline at end of file
diff --git a/test/placement-tests/testScoperequest.json b/test/placement-tests/testScoperequest.json
index 36f0c17..d7bb213 100644
--- a/test/placement-tests/testScoperequest.json
+++ b/test/placement-tests/testScoperequest.json
@@ -1,144 +1,102 @@
{
- "placementInfo": {
- "serviceModelInfo": {
- "modelVersion": "1.0",
- "modelName": "vCPE",
- "modelInvariantId": "250c90b4-42f9-4cd9-9270-fd33a0676f92",
- "modelVersionId": "c233e7f3-bd70-4a2c-a88f-4f5743109e8d",
- "modelType": "service"
- },
- "orderInfo":" { \"requestParameters\": { \"e2eVpnKey\": \"VPNL61657\", \"dhvVendorName\": \"VELOCLOUD\", \"dhvIPSec2TransportBandwidthUp\": \"10\", \"vpnList\": [ { \"vpnInfo\": { \"pvcId\": \"5952413\", \"vpnId\": \"61657\" } } ], \"dhvSiteEffectiveTransportBandwidth\": \"10\", \"ucpeHostName\": \"US292IORLFL0102UJZZ01\", \"commonSiteId\": \"90101124\", \"dhvIPSec2TransportBandwidthDown\": \"10\", \"vnfList\": [ { \"vnfInfo\": { \"vnfType\": \"HN\", \"veloCloudNominalThroughput\": \"100\", \"vnfHostName\": \"US292IORLFL0102UVHN01\", \"vnfPartNumber\": \"DHV-VNF-VC-10M\", \"vnfManagementOption\": \"ATT\", \"vnfSoftwareVersion\": \"2.4.1\" } } ] } }",
- "serviceInstanceId": "4701bd3c-b722-4d07-abc0-183ea398fac5",
- "demandInfo": {
- "placementDemand": [
- {
- "tenantName": "",
- "tenantId": "",
- "serviceResourceId": "a297f69d-4d68-4d1f-8b06-be61bddf9e7f",
- "resourceInstanceType": "vVIGaaS",
- "resourceModuleName": "Primary Tunnel_XConn for DHV Testing_1 0",
- "resourceModelInfo": {
- "modelVersion": "1.0",
- "modelName": "Tunnel_XConn for DHV Testing_1",
- "modelInvariantId": "b2ac0b6a-c157-4f27-a226-4fc6c1d5b08c",
- "modelCustomizationId": "8ade4a5f-a446-4b14-9d12-3ccdd80ef55c",
- "modelVersionId": "c3c3531a-a0c6-498f-8512-03793f7772fa",
- "modelType": "allottedResource"
- }
- },
- {
- "tenantName": "",
- "tenantId": "",
- "serviceResourceId": "73190cfb-e9de-4185-8f18-cb339df6b92a",
- "resourceInstanceType": "vVIGaaS",
- "resourceModuleName": "Secondary Tunnel_XConn for DHV Testing_1 1",
- "resourceModelInfo": {
- "modelVersion": "1.0",
- "modelName": "Tunnel_XConn for DHV Testing_1",
- "modelInvariantId": "b2ac0b6a-c157-4f27-a226-4fc6c1d5b08c",
- "modelCustomizationId": "32b80123-84ea-4bda-82d9-4c70e812b450",
- "modelVersionId": "c3c3531a-a0c6-498f-8512-03793f7772fa",
- "modelType": "allottedResource"
- }
- },
- {
- "tenantName": "",
- "tenantId": "",
- "serviceResourceId": "f8489f98-db3d-4e84-9ec7-7f7b17b9857f",
- "resourceInstanceType": "vHNPortalaaS",
- "resourceModuleName": "Primary Service_Admin for DHV Test_1 0",
- "resourceModelInfo": {
- "modelVersion": "1.0",
- "modelName": "Service_Admin for DHV Test_1",
- "modelInvariantId": "a8031455-34bc-4608-b731-973c258822d2",
- "modelCustomizationId": "bace7e9f-c0e7-4479-93df-aa10d387038b",
- "modelVersionId": "0e830d97-39fc-4310-a11d-ebab6c71b35e",
- "modelType": "allottedResource"
- }
- },
- {
- "tenantName": "",
- "tenantId": "",
- "serviceResourceId": "8a8973d4-3a91-4fe6-a846-6f4c282f9005",
- "resourceInstanceType": "vHNPortalaaS",
- "resourceModuleName": "Secondary Service_Admin for DHV Test_1 1",
- "resourceModelInfo": {
- "modelVersion": "1.0",
- "modelName": "Service_Admin for DHV Test_1",
- "modelInvariantId": "a8031455-34bc-4608-b731-973c258822d2",
- "modelCustomizationId": "cb6d359d-8f83-41b6-b0cc-fb3cdf978e25",
- "modelVersionId": "0e830d97-39fc-4310-a11d-ebab6c71b35e",
- "modelType": "allottedResource"
- }
- },
- {
- "tenantName": "",
- "tenantId": "",
- "serviceResourceId": "3f2b0c6d-6867-4369-b597-d929305da414",
- "resourceInstanceType": "vHNGWaaS",
- "resourceModuleName": "Primary IP_Mux_Demux updated_1 0",
- "resourceModelInfo": {
- "modelVersion": "1.0",
- "modelName": "IP_Mux_Demux updated_1",
- "modelInvariantId": "72ad23e8-575d-4bc1-a88d-bb63ca66b85f",
- "modelCustomizationId": "925db703-945a-4b14-aafa-607c99c32f46",
- "modelVersionId": "cb760674-1c09-4316-837f-1ee1e816c26f",
- "modelType": "allottedResource"
- }
- },
- {
- "tenantName": "",
- "tenantId": "",
- "serviceResourceId": "caea369e-90e6-4bf0-9aa4-c80ffb10c77e",
- "resourceInstanceType": "vHNGWaaS",
- "resourceModuleName": "Secondary IP_Mux_Demux updated_1 1",
- "resourceModelInfo": {
- "modelVersion": "1.0",
- "modelName": "IP_Mux_Demux updated_1",
- "modelInvariantId": "72ad23e8-575d-4bc1-a88d-bb63ca66b85f",
- "modelCustomizationId": "5f5793d7-843c-4f8e-b01d-35ece0b17ead",
- "modelVersionId": "cb760674-1c09-4316-837f-1ee1e816c26f",
- "modelType": "allottedResource"
- }
+ "requestInfo": {
+ "transactionId": "xxx-xxx-xxxx",
+ "requestId": "yyy-yyy-yyyy",
+ "callbackUrl": "https://wiki.onap.org:5000/callbackUrl/",
+ "sourceId": "SO",
+ "requestType": "create",
+ "numSolutions": 1,
+ "optimizers": ["placement"],
+ "timeout": 600
+ },
+ "placementInfo": {
+ "requestParameters": { "customerLatitude": 32.89748, "customerLongitude": -97.040443, "customerName": "xyz" },
+ "subscriberInfo": {"globalSubscriberId": "xxx-xx-xxx", "subscriberName": "subscriber_x"},
+ "placementDemands": [
+ {
+ "resourceModuleName": "vGMuxInfra",
+ "serviceResourceId": "vGMuxInfra-xx",
+ "tenantId": "vGMuxInfra-tenant",
+ "resourceModelInfo": {
+ "modelInvariantId": "vGMuxInfra-modelInvariantId",
+ "modelVersionId": "vGMuxInfra-versionId",
+ "modelName": "vGMuxInfra-model",
+ "modelType": "resource",
+ "modelVersion": "1.0",
+ "modelCustomizationName": "vGMuxInfra-customeModelName"
}
- ]
- },
- "subscriberInfo": {
- "subscriberCommonSiteId": null,
- "globalSubscriberId": "300NCQ",
- "subscriberName": "Test Customer"
- },
- "policyId": [
- "SNIRO.DistanceToLocationPolicy_vhngw",
- "SNIRO.VNFPolicy_vhngatewayprimary1_v1",
- "SNIRO.ResourceInstancePolicy_hngateway",
- "SNIRO.ResourceRegionPolicy_hngateway_v1",
- "SNIRO.VNFPolicy_vhngatewaysecondary1_v1",
- "SNIRO.ZonePolicy_vhngw",
- "SNIRO.PlacementOptimizationPolicy_dhv_v3",
- "SNIRO.VNFPolicy_vhnportal_primary1_v1",
- "SNIRO.ResourceInstancePolicy_vhnportal_v3",
- "SNIRO.ResourceRegionPolicy_vhnportal_v1",
- "SNIRO.VNFPolicy_vhnportalsecondary1_v1",
- "SNIRO.ZonePolicy_vhnportal",
- "SNIRO.DistanceToLocationPolicy_vvig",
- "SNIRO.InventoryGroupPolicy_vvig",
- "SNIRO.VNFPolicy_vvigprimary1_v1",
- "SNIRO.ResourceInstancePolicy_vvig",
- "SNIRO.VNFPolicy_vvigsecondary1_v1"
+ },
+ {
+ "resourceModuleName": "vG",
+ "serviceResourceId": "71d563e8-e714-4393-8f99-cc480144a05e",
+ "tenantId": "vG-tenant",
+ "resourceModelInfo": {
+ "modelInvariantId": "vG-modelInvariantId",
+ "modelVersionId": "vG-versionId",
+ "modelName": "vG-model",
+ "modelType": "resource",
+ "modelVersion": "1.0",
+ "modelCustomizationName": "vG-customeModelName"
+ },
+ "existingCandidates": [
+ {
+ "identifierType": "serviceInstanceId",
+ "cloudOwner": "",
+ "identifiers": ["gjhd-098-fhd-987"]
+ }
+ ],
+ "excludedCandidates": [
+ {
+ "identifierType": "serviceInstanceId",
+ "cloudOwner": "",
+ "identifiers": ["gjhd-098-fhd-987"]
+ },
+ {
+ "identifierType": "vimId",
+ "cloudOwner": "vmware",
+ "identifiers": ["NYMDT67"]
+ }
+ ],
+ "requiredCandidates": [
+ {
+ "identifierType": "vimId",
+ "cloudOwner": "amazon",
+ "identifiers": ["TXAUS219"]
+ }
+ ]
+ }
+ ]
+ },
+ "serviceInfo": {
+ "serviceInstanceId": "d61b2543-5914-4b8f-8e81-81e38575b8ec",
+ "serviceName": "vCPE",
+ "modelInfo": {
+ "modelInvariantId": "vCPE-invariantId",
+ "modelVersionId": "vCPE-versionId",
+ "modelName": "vCPE-model",
+ "modelType": "service",
+ "modelVersion": "1.0",
+ "modelCustomizationName": "vCPE-customeModelName"
+ }
+ },
+ "licenseInfo": {
+ "licenseDemands": [
+ {
+ "resourceModuleName": "vGMuxInfra",
+ "serviceResourceId": "vGMuxInfra-xx",
+ "resourceModelInfo": {
+ "modelInvariantId": "vGMuxInfra-modelInvariantId",
+ "modelVersionId": "vGMuxInfra-versionId",
+ "modelName": "vGMuxInfra-model",
+ "modelType": "resource",
+ "modelVersion": "1.0",
+ "modelCustomizationName": "vGMuxInfra-customeModelName"
+ },
+ "existingLicenses": {
+ "entitlementPoolUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", "43257b49-9602-4fe5-9337-094e52bc9435"],
+ "licenseKeyGroupUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", "43257b49-9602-4fe5-9337-094e52bc9435"]
+ }
+ }
]
- },
- "requestInfo": {
- "transactionId": "264e9db9-6d59-4888-9c90-51245d7c811f",
- "sourceId": "mso",
- "requestType": "initial",
- "callbackUrl": "http://127.0.0.1:7001",
- "requestId": "264e9db9-6d59-4888-9c90-51245d7c811f",
- "optimizer": [
- "placement",
- "license"
- ],
- "numSolutions": 1,
- "timeout": 1800
- }
-}
+ }
+} \ No newline at end of file
diff --git a/test/placement-tests/test_by_scope.yaml b/test/placement-tests/test_by_scope.yaml
index 0b53e5f..2cdd4e4 100644
--- a/test/placement-tests/test_by_scope.yaml
+++ b/test/placement-tests/test_by_scope.yaml
@@ -1,20 +1,24 @@
+references:
+ service_name:
+ source: request
+ value: serviceInfo.serviceName
+ subscriber_role:
+ source: SubscriberPolicy
+ value: content.properties.subscriberRole
+
policy_info:
placement:
policy_fetch: by_scope
policy_scope:
- default_scope: XXX_1802
- scope_vcpe: oof_beijing
- service_name: placementInfo.serviceModelInfo.modelName
- policy_subscriber: SubscriberPolicy
- subscriber_name: placementInfo.subscriberInfo.subscriberName
- policy_type_vcpe:
- - CloudAttributePolicy
- - DistanceToLocationPolicy
- - instanceReservationPolicy
- - PlacementOptimizationPolicy
- - ResourceInstancePolicy
- - VNFPolicy
- - ZonePolicy
+ default_scope: OSDF_R2
+ vcpe_scope: OSDF_R2
+ secondary_scopes:
+ -
+ - get_param: service_name
+ - SubscriberPolicy
+ -
+ - get_param: service_name
+ - get_param: subscriber_role
default: # if no explicit service related information is needed
policy_fetch: by_name
policy_scope: none
diff --git a/test/test_PolicyCalls.py b/test/test_PolicyCalls.py
index 83cce55..8c0d638 100644
--- a/test/test_PolicyCalls.py
+++ b/test/test_PolicyCalls.py
@@ -25,6 +25,7 @@ from osdf.utils.interfaces import RestClient, json_from_file
import yaml
from mock import patch
from osdf.optimizers.placementopt.conductor import translation
+from osdf.operation.exceptions import BusinessException
class TestPolicyCalls(unittest.TestCase):
@@ -44,75 +45,56 @@ class TestPolicyCalls(unittest.TestCase):
def tearDown(self):
pass
- def test_get_subscriber_name(self):
- req_json_obj = json.loads(open("./test/placement-tests/request_mso.json").read())
- config_core = osdf_config.core
- pmain = config_core['policy_info']['placement']
- print(pmain)
- subs_name = interface.get_subscriber_name(req_json_obj, pmain)
- print("subscriber_name=", subs_name)
- self.assertEquals(subs_name, "Avteet_Chayal")
+ def test_policy_api_call(self):
+ req_json_file = "./test/placement-tests/request.json"
+ req_json = json.loads(open(req_json_file).read())
+ policy_response_file = "./test/placement-tests/policy_response.json"
+ policy_response = json.loads(open(policy_response_file).read())
+ with patch('osdf.adapters.policy.interface.policy_api_call', return_value=policy_response):
+ policy_list = interface.remote_api(req_json, osdf_config, service_type="placement")
+ self.assertIsNotNone(policy_list)
- def test_get_subscriber_name_null(self):
- req_json_file = "./test/placement-tests/request_mso_subs_name_null.json"
- req_json_obj = json.loads(open(req_json_file).read())
- config_core = osdf_config.core
-
- pmain = config_core['policy_info']['placement']
- print(pmain)
- subs_name = interface.get_subscriber_name(req_json_obj, pmain)
- print("subscriber_name=", subs_name)
- self.assertEquals(subs_name, "DEFAULT")
-
- def test_get_subscriber_name_blank(self):
- req_json_file = "./test/placement-tests/request_mso_subs_name_blank.json"
- req_json_obj = json.loads(open(req_json_file).read())
- config_core = osdf_config.core
-
- pmain = config_core['policy_info']['placement']
- print(pmain)
- subs_name = interface.get_subscriber_name(req_json_obj, pmain)
- print("subscriber_name=", subs_name)
- self.assertEquals(subs_name, "DEFAULT")
-
- def test_get_subscriber_name_default(self):
- req_json_file = "./test/placement-tests/request_mso_subs_name_default.json"
- req_json_obj = json.loads(open(req_json_file).read())
- config_core = osdf_config.core
-
- pmain = config_core['policy_info']['placement']
- print(pmain)
- subs_name = interface.get_subscriber_name(req_json_obj, pmain)
- print("subscriber_name=", subs_name)
- self.assertEquals(subs_name, "DEFAULT")
-
- def test_get_subscriber_name_none(self):
- req_json_file = "./test/placement-tests/request_mso_subs_name_none.json"
- req_json_obj = json.loads(open(req_json_file).read())
- config_core = osdf_config.core
-
- pmain = config_core['policy_info']['placement']
- print(pmain)
- subs_name = interface.get_subscriber_name(req_json_obj, pmain)
- print("subscriber_name=", subs_name)
- self.assertEquals(subs_name, "DEFAULT")
+ def test_policy_api_call_failed_1(self):
+ req_json_file = "./test/placement-tests/request_error1.json"
+ req_json = json.loads(open(req_json_file).read())
+ policy_response_file = "./test/placement-tests/policy_response.json"
+ policy_response = json.loads(open(policy_response_file).read())
+ with patch('osdf.adapters.policy.interface.policy_api_call', return_value=policy_response):
+ self.assertRaises(BusinessException,
+ lambda: interface.remote_api(req_json, osdf_config, service_type="placement"))
+
+ def test_policy_api_call_failed_2(self):
+ req_json_file = "./test/placement-tests/request.json"
+ req_json = json.loads(open(req_json_file).read())
+ policy_response_file = "./test/placement-tests/policy_response_error1.json"
+ policy_response = json.loads(open(policy_response_file).read())
+ with patch('osdf.adapters.policy.interface.policy_api_call', return_value=policy_response):
+ self.assertRaises(BusinessException,
+ lambda: interface.remote_api(req_json, osdf_config, service_type="placement"))
+
+ def test_policy_api_call_failed_3(self):
+ req_json_file = "./test/placement-tests/request.json"
+ req_json = json.loads(open(req_json_file).read())
+ policy_response_file = "./test/placement-tests/policy_response_error2.json"
+ policy_response = json.loads(open(policy_response_file).read())
+ with patch('osdf.adapters.policy.interface.policy_api_call', return_value=policy_response):
+ self.assertRaises(BusinessException,
+ lambda: interface.remote_api(req_json, osdf_config, service_type="placement"))
def test_get_by_scope(self):
req_json_file = "./test/placement-tests/testScoperequest.json"
- allPolicies = "./test/placement-tests/scopePolicies.json"
+ all_policies = "./test/placement-tests/policy_response.json"
req_json_obj = json.loads(open(req_json_file).read())
- req_json_obj2 = json.loads(open(allPolicies).read())
- yamlFile = "./test/placement-tests/test_by_scope.yaml"
-
- with open(yamlFile) as yamlFile2:
- policy_config_file = yaml.load(yamlFile2)
- with patch('osdf.adapters.policy.interface.get_subscriber_role',
- return_value=('FFA Homing', [])) as mock_open:
- with patch('osdf.utils.interfaces.RestClient.request', return_value=req_json_obj2):
- policiesList = interface.get_by_scope(RestClient, req_json_obj, policy_config_file, 'placement')
- self.assertTrue(policiesList, 'is null')
- self.assertRaises(Exception)
-
+ req_json_obj2 = json.loads(open(all_policies).read())
+ yaml_file = "./test/placement-tests/test_by_scope.yaml"
+
+ with open(yaml_file) as yaml_file2:
+ policy_config_file = yaml.load(yaml_file2)
+ with patch('osdf.utils.interfaces.RestClient.request', return_value=req_json_obj2):
+ policies_list = interface.get_by_scope(RestClient, req_json_obj, policy_config_file, 'placement')
+ self.assertTrue(policies_list, 'is null')
+ self.assertRaises(Exception)
+
def test_gen_demands(self):
actionsList = []
genDemandslist = []