diff options
author | Sastry Isukapalli <sastry@research.att.com> | 2018-03-27 17:23:40 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-03-27 17:23:40 +0000 |
commit | a775ec8b904a0ea7ed863726ffe7f7d9b363d47a (patch) | |
tree | 890e6ecab0262132c7f08c6df1ac5177c4b30f3c /test | |
parent | 477092abdb41449158538dfd49d8cd25c5c8e42a (diff) | |
parent | f1e95cd95c05be145c3fde9f08404724937edf49 (diff) |
Merge "Updates to address new HPA policies"
Diffstat (limited to 'test')
34 files changed, 177 insertions, 770 deletions
diff --git a/test/conductor/test_conductor_translation.py b/test/conductor/test_conductor_translation.py index b277b6a..0c7da94 100644 --- a/test/conductor/test_conductor_translation.py +++ b/test/conductor/test_conductor_translation.py @@ -44,7 +44,9 @@ class TestConductorTranslation(unittest.TestCase): pass def test_gen_demands(self): - res = tr.gen_demands(self.request_json, self.policies) + # need to run this only on vnf policies + vnf_policies = [x for x in self.policies if x["content"]["policyType"] == "vnfPolicy"] + res = tr.gen_demands(self.request_json, vnf_policies) assert res is not None diff --git a/test/config/common_config.yaml b/test/config/common_config.yaml index 6a5f5e1..2461fd8 100644 --- a/test/config/common_config.yaml +++ b/test/config/common_config.yaml @@ -38,6 +38,14 @@ references: value: content.properties.subscriberRole policy_info: + prioritization_attributes: + policy_type: + - content.policyType + resources: + - content.resources + - content.objectiveParameter.parameterAttributes.resources + service_name: + - content.serviceName placement: policy_fetch: by_scope policy_scope: diff --git a/test/config/has_config.yaml b/test/config/has_config.yaml index 8cbeda2..c31d666 100644 --- a/test/config/has_config.yaml +++ b/test/config/has_config.yaml @@ -10,7 +10,7 @@ policy_config_mapping: country: country, geo_region: geoRegion, exclusivity_groups: exclusivityGroups, - replication_role: replicationRole, + replication_role: replicationRole remapping: model-invariant-id: modelInvariantId, model-version-id: modelVersionId diff --git a/test/operation/test_responses.py b/test/operation/test_responses.py index 2e089ec..c023ef2 100644 --- a/test/operation/test_responses.py +++ b/test/operation/test_responses.py @@ -27,22 +27,11 @@ class TestLocalPolicies(unittest.TestCase): def __init__(self, *args, **kwargs): super(self.__class__, self).__init__(*args, **kwargs) self.folder = './test/policy-local-files' - self.invalid_policies = ['INVALID-one.json', 'INVALID-two.json'] - self.valid_policies = [ - 'Affinity_vCPE_1.json', - 'Capacity_vG_1.json', - 'Distance_vG_1.json', - 'Placement_Optimization_1.json', - 'hpa_policy_vGMuxInfra_1.json', - 'vnfPolicy_vG.json', - 'Capacity_vGMuxInfra.json', - 'Distance_vGMuxInfra_1.json', - 'Min_Guarantee_vGMuxInfra_1.json', - 'QueryPolicy_vCPE.json', - 'hpa_policy_vG_1.json', - 'vnfPolicy_vGMuxInfra.json' - ] - + self.valid_policies_file = self.folder + '/' + 'meta-valid-policies.txt' + self.invalid_policies_file = self.folder + '/' + 'meta-invalid-policies.txt' + self.valid_policies = local_policies.get_policy_names_from_file(self.valid_policies_file) + self.invalid_policies = local_policies.get_policy_names_from_file(self.invalid_policies_file) + def test_get_local_policies_no_policies(self): with self.assertRaises(FileNotFoundError): res = local_policies.get_local_policies(self.folder, self.invalid_policies) @@ -60,25 +49,3 @@ class TestLocalPolicies(unittest.TestCase): if __name__ == "__main__": unittest.main() - -from flask import Response - -from osdf import ACCEPTED_MESSAGE_TEMPLATE - - -def osdf_response_for_request_accept(req_id="", text="", response_code=202, as_http=True): - """Helper method to create a response object for request acceptance, so that the object can be sent to a client - :param req_id: request ID provided by the caller - :param text: extra text description about accepting the request (e.g. "Request accepted") - :param response_code: the HTTP status code to send -- default is 202 (accepted) - :param as_http: whether to send response as HTTP response object or as a string - :return: if as_http is True, return a HTTP Response object. Otherwise, return json-encoded-message - """ - response_message = ACCEPTED_MESSAGE_TEMPLATE.render(description=text, request_id=req_id) - if not as_http: - return response_message - - response = Response(response_message, content_type='application/json; charset=utf-8') - response.headers.add('content-length', len(response_message)) - response.status_code = response_code - return response diff --git a/test/placement-tests/policy_response.json b/test/placement-tests/policy_response.json index ed5b4ab..19c66f8 100644 --- a/test/placement-tests/policy_response.json +++ b/test/placement-tests/policy_response.json @@ -93,7 +93,7 @@ "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\"}}", + "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\", \"vim_fit\"], \"resources\": [\"vG\"], \"capacityProperty\": {\"controller\": \"multicloud\", \"request\": \"{\\\"vCPU\\\": 10, \\\"Memory\\\": {\\\"quantity\\\": {\\\"get_param\\\": \\\"REQUIRED_MEM\\\"}, \\\"unit\\\": \\\"GB\\\"}, \\\"Storage\\\": {\\\"quantity\\\": {\\\"get_param\\\": \\\"REQUIRED_DISK\\\", \\\"unit\\\": \\\"GB\\\"}}}\"}, \"policyType\": \"vim_fit\", \"applicableResources\": \"any\"}}", "policyName": "oofBeijing.Config_MS_capacityPolicy_vG.1.xml", "policyVersion": "1", "matchingConditions": { @@ -111,7 +111,7 @@ "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\"}}", + "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\", \"attribute_location\": \"customerLocation\", \"value\": \"\"}, {\"attribute\": \"id\", \"attribute_location\": \"vpnInfo.vpnId\", \"value\": \"\"}, {\"attribute\": \"upstreamBW\", \"attribute_location\": \"vpnInfo.upstreamBW\", \"value\": \"\"}, {\"attribute\": \"customerLatitude\", \"attribute_location\": \"customerLatitude\", \"value\": 32.89748}, {\"attribute\": \"customerLongitude\", \"attribute_location\": \"customerLongitude\", \"value\": -97.040443}], \"policyScope\": [\"vCPE\", \"US\", \"INTERNATIONAL\", \"ip\", \"vGMuxInfra\", \"vG\", \"optimizationQueryPolicy\"], \"policyType\": \"optimizationQueryPolicy\"}}", "policyName": "oofBeijing.Config_MS_queryPolicy_vCPE.1.xml", "policyVersion": "1", "matchingConditions": { @@ -165,7 +165,7 @@ "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\"}}", + "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\", \"vim_fit\"], \"resources\": [\"vGMuxInfra\"], \"capacityProperty\": {\"controller\": \"multicloud\", \"request\": \"{\\\"vCPU\\\": 10, \\\"Memory\\\": {\\\"quantity\\\": {\\\"get_param\\\": \\\"REQUIRED_MEM\\\"}, \\\"unit\\\": \\\"GB\\\"}, \\\"Storage\\\": {\\\"quantity\\\": {\\\"get_param\\\": \\\"REQUIRED_DISK\\\", \\\"unit\\\": \\\"GB\\\"}}}\"}, \"policyType\": \"vim_fit\", \"applicableResources\": \"any\"}}", "policyName": "oofBeijing.Config_MS_capacityPolicy_vGMuxInfra.1.xml", "policyVersion": "1", "matchingConditions": { diff --git a/test/policy-local-files/Affinity_vCPE_1.json b/test/policy-local-files/Affinity_vCPE_1.json index c42e9d8..4a3e086 100644 --- a/test/policy-local-files/Affinity_vCPE_1.json +++ b/test/policy-local-files/Affinity_vCPE_1.json @@ -15,7 +15,8 @@ "qualifier": "different", "category": "complex" }, - "policyType": "affinityPolicy", - "resources": ["vGMuxInfra", "vG"] + "policyType": "zone", + "resources": ["vGMuxInfra", "vG"], + "applicableResources": "all" } -} +}
\ No newline at end of file diff --git a/test/policy-local-files/Capacity_vGMuxInfra.json b/test/policy-local-files/Capacity_vGMuxInfra.json index 9eec54d..06896c3 100644 --- a/test/policy-local-files/Capacity_vGMuxInfra.json +++ b/test/policy-local-files/Capacity_vGMuxInfra.json @@ -10,12 +10,13 @@ "guard": "False", "content": { "identity": "capacity_vGMuxInfra", - "policyScope": ["VCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra"], - "resources": ["vGMuxInfra"], + "policyScope": ["VCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "vim_fit"], + "resources": ["vGMuxInfra"], "capacityProperty": { - "cpu": {"value": 2, "operator": ">"}, - "memory": {"value": 4, "operator": ">", "unit": "Gb"} + "controller": "multicloud", + "request": "{\"vCPU\": 10, \"Memory\": {\"quantity\": {\"get_param\": \"REQUIRED_MEM\"}, \"unit\": \"GB\"}, \"Storage\": {\"quantity\": {\"get_param\": \"REQUIRED_DISK\", \"unit\": \"GB\"}}}" }, - "policyType": "capacityPolicy" + "policyType": "vim_fit", + "applicableResources": "any" } } diff --git a/test/policy-local-files/Capacity_vG_1.json b/test/policy-local-files/Capacity_vG_1.json index d5644a8..851ea49 100644 --- a/test/policy-local-files/Capacity_vG_1.json +++ b/test/policy-local-files/Capacity_vG_1.json @@ -1,7 +1,7 @@ { "service": "capacityPolicy", - "policyName": "oofBeijing.capacityPolicy_vGMuxInfra", - "description": "Capacity policy for vGMuxInfra", + "policyName": "oofBeijing.capacityPolicy_vG", + "description": "Capacity policy for vG", "templateVersion": "1702.03", "version": "oofBeijing", "priority": "5", @@ -9,13 +9,14 @@ "riskLevel": "2", "guard": "False", "content": { - "identity": "capacity_vGMuxInfra", - "policyScope": ["VCPE", "US", "INTERNATIONAL", "ip", "vG"], - "resources": ["vG"], + "identity": "capacity_vG", + "policyScope": ["VCPE", "US", "INTERNATIONAL", "ip", "vG", "vim_fit"], + "resources": ["vG"], "capacityProperty": { - "cpu": {"value": 2, "operator": ">"}, - "memory": {"value": 4, "operator": ">", "unit": "Gb"} + "controller": "multicloud", + "request": "{\"vCPU\": 10, \"Memory\": {\"quantity\": {\"get_param\": \"REQUIRED_MEM\"}, \"unit\": \"GB\"}, \"Storage\": {\"quantity\": {\"get_param\": \"REQUIRED_DISK\", \"unit\": \"GB\"}}}" }, - "policyType": "capacityPolicy" + "policyType": "vim_fit", + "applicableResources": "any" } } diff --git a/test/policy-local-files/Distance_vGMuxInfra_1.json b/test/policy-local-files/Distance_vGMuxInfra_1.json index a835ef1..992e9ec 100644 --- a/test/policy-local-files/Distance_vGMuxInfra_1.json +++ b/test/policy-local-files/Distance_vGMuxInfra_1.json @@ -15,7 +15,8 @@ }, "identity": "distance-vGMuxInfra", "resources": ["vGMuxInfra"], - "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra"], - "policyType": "distancePolicy" + "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "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 1af021a..07baabd 100644 --- a/test/policy-local-files/Distance_vG_1.json +++ b/test/policy-local-files/Distance_vG_1.json @@ -15,7 +15,8 @@ }, "identity": "distance-vG", "resources": ["vG"], - "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vG"], - "policyType": "distancePolicy" + "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vG", "distancePolicy"], + "policyType": "distance_to_location", + "applicableResources": "any" } } diff --git a/test/policy-local-files/Min_Guarantee_vGMuxInfra_1.json b/test/policy-local-files/Min_Guarantee_vGMuxInfra_1.json deleted file mode 100644 index 654c548..0000000 --- a/test/policy-local-files/Min_Guarantee_vGMuxInfra_1.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "service": "minGuaranteePolicy", - "policyName": "oofBeijing.minGuaranee_vGMuxInfra", - "description": "Min guarantee policy for vGMuxInfra", - "templateVersion": "1702.03", - "version": "oofBeijing", - "priority": "5", - "riskType": "test", - "riskLevel": "2", - "guard": "False", - "content": { - "identity": "minGuarantee_vGMuxInfra", - "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra"], - "minGuaranteeProperty": { - "cpu": {"value": "true", "operator": "="}, - "memory": {"value": "false", "operator": "="} - }, - "policyType": "minGuaraneePolicy", - "resourceInstanceType": ["vGMuxInfra"] - } -} diff --git a/test/policy-local-files/Placement_Optimization_1.json b/test/policy-local-files/Placement_Optimization_1.json index 5748c99..6d09b82 100644 --- a/test/policy-local-files/Placement_Optimization_1.json +++ b/test/policy-local-files/Placement_Optimization_1.json @@ -12,14 +12,14 @@ "objectiveParameter": { "parameterAttributes": [ { - "resource": ["vGMuxInfra"], + "resources": ["vGMuxInfra"], "customerLocationInfo": "customer_loc", "parameter": "distance", "weight": "1", "operator": "product" }, { - "resource": ["vG"], + "resources": ["vG"], "customerLocationInfo": "customer_loc", "parameter": "distance", "weight": "1", @@ -29,7 +29,7 @@ "operator": "sum" }, "identity": "optimization", - "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "vG"], + "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "vG", "placementOptimization"], "policyType": "placementOptimization", "objective": "minimize" } diff --git a/test/policy-local-files/QueryPolicy_vCPE.json b/test/policy-local-files/QueryPolicy_vCPE.json index 4ed83f9..03c457e 100644 --- a/test/policy-local-files/QueryPolicy_vCPE.json +++ b/test/policy-local-files/QueryPolicy_vCPE.json @@ -10,11 +10,14 @@ "guard": "False", "content": { "queryProperties": [ - {"attribute":"locationId", "value": "orderInfo.customerLocation"}, - {"attribute":"id", "value": "orderInfo.vpnInfo"}, - {"attribute":"upstreamBW", "value": "orderInfo.vpnInfo"} + {"attribute":"locationId", "attribute_location": "customerLocation", "value": ""}, + {"attribute":"id", "attribute_location": "vpnInfo.vpnId", "value": ""}, + {"attribute":"upstreamBW", "attribute_location": "vpnInfo.upstreamBW", "value": ""}, + {"attribute":"customerLatitude", "attribute_location": "customerLatitude", "value": 32.89748}, + {"attribute":"customerLongitude", "attribute_location": "customerLongitude", "value": -97.040443} ], - "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "vG"], - "type": "optimizationQueryPolicy" + "serviceName": "vCPE", + "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "vG", "optimizationQueryPolicy"], + "policyType": "optimizationQueryPolicy" } } diff --git a/test/policy-local-files/has_policies_r2/Affinity_vCPE_1.json b/test/policy-local-files/has_policies_r2/Affinity_vCPE_1.json deleted file mode 100644 index 9a9de6b..0000000 --- a/test/policy-local-files/has_policies_r2/Affinity_vCPE_1.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "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", - "optimizationQueryPolicy" - ], - "policyType": "optimizationQueryPolicy" - } -} diff --git a/test/policy-local-files/has_policies_r2/Capacity_vGMuxInfra.json b/test/policy-local-files/has_policies_r2/Capacity_vGMuxInfra.json deleted file mode 100644 index 06896c3..0000000 --- a/test/policy-local-files/has_policies_r2/Capacity_vGMuxInfra.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "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", "vim_fit"], - "resources": ["vGMuxInfra"], - "capacityProperty": { - "controller": "multicloud", - "request": "{\"vCPU\": 10, \"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/has_policies_r2/Capacity_vG_1.json b/test/policy-local-files/has_policies_r2/Capacity_vG_1.json deleted file mode 100644 index 851ea49..0000000 --- a/test/policy-local-files/has_policies_r2/Capacity_vG_1.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "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", "vim_fit"], - "resources": ["vG"], - "capacityProperty": { - "controller": "multicloud", - "request": "{\"vCPU\": 10, \"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/has_policies_r2/Distance_vGMuxInfra_1.json b/test/policy-local-files/has_policies_r2/Distance_vGMuxInfra_1.json deleted file mode 100644 index ee7d89e..0000000 --- a/test/policy-local-files/has_policies_r2/Distance_vGMuxInfra_1.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "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", "distancePolicy"], - "policyType": "distancePolicy", - "applicableResources": "any" - } -} diff --git a/test/policy-local-files/has_policies_r2/Distance_vG_1.json b/test/policy-local-files/has_policies_r2/Distance_vG_1.json deleted file mode 100644 index 953dcc3..0000000 --- a/test/policy-local-files/has_policies_r2/Distance_vG_1.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "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", "distancePolicy"], - "policyType": "distancePolicy", - "applicableResources": "any" - } -} diff --git a/test/policy-local-files/has_policies_r2/Min_Guarantee_vGMuxInfra_1.json b/test/policy-local-files/has_policies_r2/Min_Guarantee_vGMuxInfra_1.json deleted file mode 100644 index b8f958d..0000000 --- a/test/policy-local-files/has_policies_r2/Min_Guarantee_vGMuxInfra_1.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "service": "minGuaranteePolicy", - "policyName": "oofBeijing.minGuaranee_vGMuxInfra", - "description": "Min guarantee policy for vGMuxInfra", - "templateVersion": "1702.03", - "version": "oofBeijing", - "priority": "5", - "riskType": "test", - "riskLevel": "2", - "guard": "False", - "content": { - "identity": "minGuarantee_vGMuxInfra", - "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "minGuaranteePolicy"], - "minGuaranteeProperty": { - "cpu": "true", - "memory": "false", - }, - "policyType": "minGuaranteePolicy", - "resources": ["vGMuxInfra"], - "applicableResources": "any" - } -}
\ No newline at end of file diff --git a/test/policy-local-files/has_policies_r2/Placement_Optimization_1.json b/test/policy-local-files/has_policies_r2/Placement_Optimization_1.json deleted file mode 100644 index f8b0a6f..0000000 --- a/test/policy-local-files/has_policies_r2/Placement_Optimization_1.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "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", "placementOptimization"], - "policyType": "placementOptimization", - "objective": "minimize" - } -} diff --git a/test/policy-local-files/has_policies_r2/QueryPolicy_vCPE.json b/test/policy-local-files/has_policies_r2/QueryPolicy_vCPE.json deleted file mode 100644 index 508d7d6..0000000 --- a/test/policy-local-files/has_policies_r2/QueryPolicy_vCPE.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "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", "attribute_location": "customerLocation", "value": ""}, - {"attribute":"id", "attribute_location": "vpnInfo.vpnId", "value": ""}, - {"attribute":"upstreamBW", "attribute_location": "vpnInfo.upstreamBW", "value": ""}, - {"attribute":"customerLatitude", "attribute_location": "customerLatitude", "value": 32.89748}, - {"attribute":"customerLongitude", "attribute_location": "customerLongitude", "value": -97.040443} - ], - "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "vG", "optimizationQueryPolicy"], - "policyType": "optimizationQueryPolicy" - } -} diff --git a/test/policy-local-files/has_policies_r2/hpa_policy_vGMuxInfra_1.json b/test/policy-local-files/has_policies_r2/hpa_policy_vGMuxInfra_1.json deleted file mode 100644 index 7b68578..0000000 --- a/test/policy-local-files/has_policies_r2/hpa_policy_vGMuxInfra_1.json +++ /dev/null @@ -1,144 +0,0 @@ -{ - "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", "hpaPolicy"], - "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": ""} - ] - } - ] - } - ] - } -} diff --git a/test/policy-local-files/has_policies_r2/hpa_policy_vG_1.json b/test/policy-local-files/has_policies_r2/hpa_policy_vG_1.json deleted file mode 100644 index 95f9247..0000000 --- a/test/policy-local-files/has_policies_r2/hpa_policy_vG_1.json +++ /dev/null @@ -1,144 +0,0 @@ -{ - "service": "hpaPolicy", - "policyName": "oofBeijing.hpaPolicy_vG", - "description": "HPA policy for vG", - "templateVersion": "0.0.1", - "version": "1.0", - "priority": "3", - "riskType": "test", - "riskLevel": "2", - "guard": "False", - "content": { - "resources": "vG", - "identity": "hpaPolicy_vG", - "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vG", "hpaPolicy"], - "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": ""} - ] - } - ] - } - ] - } -} diff --git a/test/policy-local-files/has_policies_r2/vnfPolicy_vG.json b/test/policy-local-files/has_policies_r2/vnfPolicy_vG.json deleted file mode 100644 index a5694a3..0000000 --- a/test/policy-local-files/has_policies_r2/vnfPolicy_vG.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "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", "vnf_policy"], - "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" - } - ] - } -} diff --git a/test/policy-local-files/has_policies_r2/vnfPolicy_vGMuxInfra.json b/test/policy-local-files/has_policies_r2/vnfPolicy_vGMuxInfra.json deleted file mode 100644 index 682fb62..0000000 --- a/test/policy-local-files/has_policies_r2/vnfPolicy_vGMuxInfra.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "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", "vnf_policy"], - "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" - } - ] - } -} diff --git a/test/policy-local-files/hpa_policy_vGMuxInfra_1.json b/test/policy-local-files/hpa_policy_vGMuxInfra_1.json index bf09532..7b68578 100644 --- a/test/policy-local-files/hpa_policy_vGMuxInfra_1.json +++ b/test/policy-local-files/hpa_policy_vGMuxInfra_1.json @@ -11,49 +11,49 @@ "content": { "resources": "vGMuxInfra", "identity": "hpaPolicy_vGMuxInfra", - "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra"], + "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "hpaPolicy"], "policyType": "hpaPolicy", "flavorFeatures": [ { "flavorLabel": "flavor_label_vm_01", "flavorProperties":[ { - "hpa_feature" : "cpuTopology", + "hpa-feature" : "cpuTopology", "mandatory" : "True", "architecture": "generic", - "featureAttributes": [ - {"attribute":"numCpuSockets", "values": "2","operator": ">=", "unit": ""}, - {"attribute":"numCpuSockets", "values": "4","operator": "<=", "unit": ""}, - {"attribute":"numCpuCores", "value": "2", "operator":">=", "unit": ""}, - {"attribute":"numCpuCores", "value": "4", "operator":"<=", "unit": ""}, - {"attribute":"numCpuThreads", "value": "4", "operator":">=", "unit": ""}, - {"attribute":"numCpuThreads", "value": "8", "operator":"<=", "unit": ""} + "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", + "hpa-feature" : "basicCapabilities", "mandatory" : "True", "architecture": "generic", - "featureAttributes": [ - {"attribute": "numVirtualCpu", "value": "6", "operator": "=", "unit": ""}, - {"attribute": "virtualMemSize", "value":"6", "operator": "=", "unit": "GB"} + "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", + "hpa-feature" : "ovsDpdk", "mandatory" : "False", "score" : "3", "architecture": "generic", - "featureAttributes": [ - {"attribute":"dataProcessingAccelerationLibrary", "value":"ovsDpdk_version", "operator": "=", "unit":""} + "hpa-feature-attributes": [ + {"hpa-attribute-key":"dataProcessingAccelerationLibrary", "hpa-attribute-value":"ovsDpdk_version", "operator": "=", "unit":""} ] }, { - "hpa_feature" : "cpuInstructionSetExtensions", + "hpa-feature" : "cpuInstructionSetExtensions", "mandatory" : "True", "architecture": "INTEL-64", - "featureAttributes": [ - {"attribute":"instructionSetExtensions", "value":["<CPUINST>", "<CPUINST>"], "operator": "ALL", "unit":""} + "hpa-feature-attributes": [ + {"hpa-attribute-key":"instructionSetExtensions", "hpa-attribute-value":["<CPUINST>", "<CPUINST>"], "operator": "ALL", "unit":""} ] } ] @@ -62,43 +62,43 @@ "flavorLabel": "flavor_label_vm_02", "flavorProperties":[ { - "hpa_feature" : "cpuPinningy", + "hpa-feature" : "cpuPinningy", "mandatory" : "True", "architecture": "generic", - "featureAttributes": [ - {"attribute":"logicalCpuThreadPinningPolicy", "value":"<CPUTHREADPOLICY>", "operator": "=", "unit":""}, - {"attribute":"logicalCpuPinningPolicy", "value": "<CPUPOLICY>","operator": "=", "unit":""} + "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", + "hpa-feature" : "basicCapabilities", "mandatory" : "True", "architecture": "generic", - "featureAttributes": [ - {"attribute": "numVirtualCpu", "value": "6", "operator": "=", "unit": ""}, - {"attribute": "virtualMemSize", "value":"6", "operator": "=", "unit": "GB"} + "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", + "hpa-feature" : "localStorage", "mandatory" : "False", "score" : "5", "architecture": "generic", - "featureAttributes": [ - {"attribute": "diskSize", "value": "2", "operator": "=", "unit": "GB"}, - {"attribute": "ephemeralDiskSize", "value": "2", "operator": "=", "unit": "GB"}, - {"attribute": "swapMemSize", "value":"16", "operator": "=", "unit": "MB"} + "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", + "hpa-feature" : "pcie", "mandatory" : "True", "architecture": "generic", - "featureAttributes": [ - {"attribute": "pciCount", "value": "2", "operator": "=", "unit": ""}, - {"attribute": "pciVendorId", "value":"8086", "operator": "=", "unit": ""}, - {"attribute": "pciDeviceId", "value": "2", "operator": "=", "unit": ""}, - {"attribute": "functionType", "value": "<PCITYPEVALUE>","operator": "=", "unit": ""} + "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": ""} ] } ] @@ -107,34 +107,34 @@ "flavorLabel": "flavor_label_vm_03", "flavorProperties":[ { - "hpa_feature" : "numa", + "hpa-feature" : "numa", "mandatory" : "False", "score" : "5", "architecture": "generic", - "featureAttributes": [ - {"attribute": "numaNodes", "value": "2", "operator": "=", "unit": ""}, - {"attribute": "numaCpu-0", "values":"2", "operator": "=", "unit": ""}, - {"attribute": "numaMem-0", "value": "2048", "operator": "=", "unit": "MB"}, - {"attribute": "numaCpu-1", "values":"4", "operator": "=", "unit": ""}, - {"attribute": "numaMem-1", "value": "4096", "operator": "=", "unit": "MB"} + "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", + "hpa-feature" : "basicCapabilities", "mandatory" : "True", "architecture": "generic", - "featureAttributes": [ - {"attribute": "numVirtualCpu", "value": "6", "operator": "=", "unit": ""}, - {"attribute": "virtualMemSize", "value":"6", "operator": "=", "unit": "GB"} + "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", + "hpa-feature" : "hugePages", "mandatory" : "False", "score" : "7", "architecture": "generic", - "featureAttributes": [ - {"attribute": "memoryPageSize", "value": "<MEMORYPAGESIZE>", "operator": "=", "unit": ""} + "hpa-feature-attributes": [ + {"hpa-attribute-key": "memoryPageSize", "hpa-attribute-value": "<MEMORYPAGESIZE>", "operator": "=", "unit": ""} ] } ] diff --git a/test/policy-local-files/hpa_policy_vG_1.json b/test/policy-local-files/hpa_policy_vG_1.json index 98d8cea..95f9247 100644 --- a/test/policy-local-files/hpa_policy_vG_1.json +++ b/test/policy-local-files/hpa_policy_vG_1.json @@ -11,49 +11,49 @@ "content": { "resources": "vG", "identity": "hpaPolicy_vG", - "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vG"], + "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vG", "hpaPolicy"], "policyType": "hpaPolicy", "flavorFeatures": [ { "flavorLabel": "flavor_label_vm_01", "flavorProperties":[ { - "hpa_feature" : "cpuTopology", + "hpa-feature" : "cpuTopology", "mandatory" : "True", "architecture": "generic", - "featureAttributes": [ - {"attribute":"numCpuSockets", "values": "2","operator": ">=", "unit": ""}, - {"attribute":"numCpuSockets", "values": "4","operator": "<=", "unit": ""}, - {"attribute":"numCpuCores", "value": "2", "operator":">=", "unit": ""}, - {"attribute":"numCpuCores", "value": "4", "operator":"<=", "unit": ""}, - {"attribute":"numCpuThreads", "value": "4", "operator":">=", "unit": ""}, - {"attribute":"numCpuThreads", "value": "8", "operator":"<=", "unit": ""} + "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", + "hpa-feature" : "basicCapabilities", "mandatory" : "True", "architecture": "generic", - "featureAttributes": [ - {"attribute": "numVirtualCpu", "value": "6", "operator": "=", "unit": ""}, - {"attribute": "virtualMemSize", "value":"6", "operator": "=", "unit": "GB"} + "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", + "hpa-feature" : "ovsDpdk", "mandatory" : "False", "score" : "3", "architecture": "generic", - "featureAttributes": [ - {"attribute":"dataProcessingAccelerationLibrary", "value":"ovsDpdk_version", "operator": "=", "unit":""} + "hpa-feature-attributes": [ + {"hpa-attribute-key":"dataProcessingAccelerationLibrary", "hpa-attribute-value":"ovsDpdk_version", "operator": "=", "unit":""} ] }, { - "hpa_feature" : "cpuInstructionSetExtensions", + "hpa-feature" : "cpuInstructionSetExtensions", "mandatory" : "True", "architecture": "INTEL-64", - "featureAttributes": [ - {"attribute":"instructionSetExtensions", "value":["<CPUINST>", "<CPUINST>"], "operator": "ALL", "unit":""} + "hpa-feature-attributes": [ + {"hpa-attribute-key":"instructionSetExtensions", "hpa-attribute-value":["<CPUINST>", "<CPUINST>"], "operator": "ALL", "unit":""} ] } ] @@ -62,43 +62,43 @@ "flavorLabel": "flavor_label_vm_02", "flavorProperties":[ { - "hpa_feature" : "cpuPinningy", + "hpa-feature" : "cpuPinningy", "mandatory" : "True", "architecture": "generic", - "featureAttributes": [ - {"attribute":"logicalCpuThreadPinningPolicy", "value":"<CPUTHREADPOLICY>", "operator": "=", "unit":""}, - {"attribute":"logicalCpuPinningPolicy", "value": "<CPUPOLICY>","operator": "=", "unit":""} + "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", + "hpa-feature" : "basicCapabilities", "mandatory" : "True", "architecture": "generic", - "featureAttributes": [ - {"attribute": "numVirtualCpu", "value": "6", "operator": "=", "unit": ""}, - {"attribute": "virtualMemSize", "value":"6", "operator": "=", "unit": "GB"} + "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", + "hpa-feature" : "localStorage", "mandatory" : "False", "score" : "5", "architecture": "generic", - "featureAttributes": [ - {"attribute": "diskSize", "value": "2", "operator": "=", "unit": "GB"}, - {"attribute": "ephemeralDiskSize", "value": "2", "operator": "=", "unit": "GB"}, - {"attribute": "swapMemSize", "value":"16", "operator": "=", "unit": "MB"} + "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", + "hpa-feature" : "pcie", "mandatory" : "True", "architecture": "generic", - "featureAttributes": [ - {"attribute": "pciCount", "value": "2", "operator": "=", "unit": ""}, - {"attribute": "pciVendorId", "value":"8086", "operator": "=", "unit": ""}, - {"attribute": "pciDeviceId", "value": "2", "operator": "=", "unit": ""}, - {"attribute": "functionType", "value": "<PCITYPEVALUE>","operator": "=", "unit": ""} + "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": ""} ] } ] @@ -107,34 +107,34 @@ "flavorLabel": "flavor_label_vm_03", "flavorProperties":[ { - "hpa_feature" : "numa", + "hpa-feature" : "numa", "mandatory" : "False", "score" : "5", "architecture": "generic", - "featureAttributes": [ - {"attribute": "numaNodes", "value": "2", "operator": "=", "unit": ""}, - {"attribute": "numaCpu-0", "values":"2", "operator": "=", "unit": ""}, - {"attribute": "numaMem-0", "value": "2048", "operator": "=", "unit": "MB"}, - {"attribute": "numaCpu-1", "values":"4", "operator": "=", "unit": ""}, - {"attribute": "numaMem-1", "value": "4096", "operator": "=", "unit": "MB"} + "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", + "hpa-feature" : "basicCapabilities", "mandatory" : "True", "architecture": "generic", - "featureAttributes": [ - {"attribute": "numVirtualCpu", "value": "6", "operator": "=", "unit": ""}, - {"attribute": "virtualMemSize", "value":"6", "operator": "=", "unit": "GB"} + "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", + "hpa-feature" : "hugePages", "mandatory" : "False", "score" : "7", "architecture": "generic", - "featureAttributes": [ - {"attribute": "memoryPageSize", "value": "<MEMORYPAGESIZE>", "operator": "=", "unit": ""} + "hpa-feature-attributes": [ + {"hpa-attribute-key": "memoryPageSize", "hpa-attribute-value": "<MEMORYPAGESIZE>", "operator": "=", "unit": ""} ] } ] diff --git a/test/policy-local-files/meta-valid-policies.txt b/test/policy-local-files/meta-valid-policies.txt index a0ce3fe..7fc72ea 100644 --- a/test/policy-local-files/meta-valid-policies.txt +++ b/test/policy-local-files/meta-valid-policies.txt @@ -3,7 +3,6 @@ Capacity_vGMuxInfra.json Capacity_vG_1.json Distance_vGMuxInfra_1.json Distance_vG_1.json -Min_Guarantee_vGMuxInfra_1.json Placement_Optimization_1.json QueryPolicy_vCPE.json hpa_policy_vGMuxInfra_1.json diff --git a/test/policy-local-files/has_policies_r2/subscriber_policy.json b/test/policy-local-files/subscriber_policy.json index f237f79..f1b818c 100644 --- a/test/policy-local-files/has_policies_r2/subscriber_policy.json +++ b/test/policy-local-files/subscriber_policy.json @@ -16,6 +16,7 @@ "subscriberRole": ["PVT Homing"], "provStatus": ["CAPPED"] }, - "policyType": "subscriberPolicy" + "policyType": "subscriberPolicy", + "serviceName": "vCPE" } }
\ No newline at end of file diff --git a/test/policy-local-files/vnfPolicy_vG.json b/test/policy-local-files/vnfPolicy_vG.json index ead038c..c77cdc7 100644 --- a/test/policy-local-files/vnfPolicy_vG.json +++ b/test/policy-local-files/vnfPolicy_vG.json @@ -10,10 +10,11 @@ "guard": "False", "content": { "identity": "vnf_vG", - "policyScope": ["vCPE", "INTERNATIONAL", "ip", "vG"], - "policyType": "vnf_policy", + "policyScope": ["vCPE", "INTERNATIONAL", "ip", "vG", "vnf_policy"], + "policyType": "vnfPolicy", "resources": ["vG"], - "vnfProperties": [ + "applicableResources": "any", + "vnfProperties": [ { "inventoryProvider": "aai", "serviceType": "", diff --git a/test/policy-local-files/vnfPolicy_vGMuxInfra.json b/test/policy-local-files/vnfPolicy_vGMuxInfra.json index 787563b..3971519 100644 --- a/test/policy-local-files/vnfPolicy_vGMuxInfra.json +++ b/test/policy-local-files/vnfPolicy_vGMuxInfra.json @@ -10,9 +10,10 @@ "guard": "False", "content": { "identity": "vnf_vGMuxInfra", - "policyScope": ["vCPE", "INTERNATIONAL", "ip", "vGMuxInfra"], - "policyType": "vnf_policy", + "policyScope": ["vCPE", "INTERNATIONAL", "ip", "vGMuxInfra", "vnf_policy"], + "policyType": "vnfPolicy", "resources": ["vGMuxInfra"], + "applicableResources": "any", "vnfProperties": [ { "inventoryProvider": "aai", diff --git a/test/policy/test_policy_interface.py b/test/policy/test_policy_interface.py index 5dc75c3..4f1efcf 100644 --- a/test/policy/test_policy_interface.py +++ b/test/policy/test_policy_interface.py @@ -51,10 +51,6 @@ class TestPolicyInterface(unittest.TestCase): def tearDown(self): pass - def test_gen_demands(self): - res = tr.gen_demands(self.request_json, self.policies) - assert res is not None - def test_get_by_name(self): pol.get_by_name(mock.MagicMock(), self.valid_policies_files[0]) diff --git a/test/test_ConductorApiBuilder.py b/test/test_ConductorApiBuilder.py index 8395a47..d13a6a5 100644 --- a/test/test_ConductorApiBuilder.py +++ b/test/test_ConductorApiBuilder.py @@ -29,8 +29,8 @@ class TestConductorApiBuilder(unittest.TestCase): def setUp(self): self.main_dir = "" conductor_api_template = self.main_dir + "osdf/templates/conductor_interface.json" - parameter_data_file = self.main_dir + "test/placement-tests/request.json" - policy_data_path = self.main_dir + "test/policy-local-files/" + parameter_data_file = self.main_dir + "test/placement-tests/request.json" # "test/placement-tests/request.json" + policy_data_path = self.main_dir + "test/policy-local-files" # "test/policy-local-files" local_config_file = self.main_dir + "config/common_config.yaml" valid_policies_list_file = policy_data_path + '/' + 'meta-valid-policies.txt' @@ -42,12 +42,12 @@ class TestConductorApiBuilder(unittest.TestCase): def test_conductor_api_call_builder(self): main_dir = self.main_dir - conductor_api_template = main_dir + "osdf/templates/conductor_interface.json" + conductor_api_template = main_dir + "osdf/templates/conductor_interface.json" # "osdf/templates/conductor_interface.json" local_config_file = main_dir + "config/common_config.yaml" request_json = self.request_json policies = self.policies local_config = yaml.load(open(local_config_file)) - templ_string = conductor_api_builder(request_json, policies, local_config, [], conductor_api_template) + templ_string = conductor_api_builder(request_json, policies, local_config, conductor_api_template) templ_json = json.loads(templ_string) self.assertEqual(templ_json["name"], "yyy-yyy-yyyy") diff --git a/test/test_PolicyCalls.py b/test/test_PolicyCalls.py index 8c0d638..30fc072 100644 --- a/test/test_PolicyCalls.py +++ b/test/test_PolicyCalls.py @@ -80,7 +80,7 @@ class TestPolicyCalls(unittest.TestCase): 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" all_policies = "./test/placement-tests/policy_response.json" @@ -100,7 +100,9 @@ class TestPolicyCalls(unittest.TestCase): genDemandslist = [] req_json = "./test/placement-tests/request.json" req_json = json.loads(open(req_json).read()) - genDemands = translation.gen_demands(req_json, self.policies) + # need to run this only on vnf policies + vnf_policies = [x for x in self.policies if x["content"]["policyType"] == "vnfPolicy"] + genDemands = translation.gen_demands(req_json, vnf_policies) for action in req_json['placementInfo']['placementDemands']: actionsList.append(action['resourceModuleName']) for key2,value in genDemands.items(): |