aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorvrvarma <vv8305@att.com>2020-01-22 14:05:33 -0500
committerLukasz Rajewski <lukasz.rajewski@orange.com>2020-01-24 14:20:40 +0000
commit0f8d7692d2aad99c68d5ee0c59b20a75724b1ada (patch)
tree0a0975df71e4bdeb329f725ca821a43d33db8704 /test
parent533f2b3e9f9c2d2ca3ad3d9899ffba8a18645e4e (diff)
Add passthrough attributes
Added passthrough attributes in placement request. Current attributes HAS request section changed to filtering_attributes and new passthrough attributes added in HAS request - this one is read from vnf policy passthroughAttributes section. Change-Id: Ic1e9dcafb0aa0ce5c1b4ddcf35d034d457ac7d48 Signed-off-by: vrvarma <vv8305@att.com> Signed-off-by: Lukasz Rajewski <lukasz.rajewski@orange.com> Issue-ID: OPTFRA-611
Diffstat (limited to 'test')
-rwxr-xr-xtest/functest/simulators/build_sim_image.sh1
-rw-r--r--test/placement-tests/request_placement_vfmod.json195
-rw-r--r--test/policy-local-files/vnfPolicy_vFW_TD.json5
-rw-r--r--test/policy-local-files/vnfPolicy_vPGN_TD.json89
-rw-r--r--test/test-requirements.txt1
-rw-r--r--test/test_ConductorApiBuilder.py4
6 files changed, 165 insertions, 130 deletions
diff --git a/test/functest/simulators/build_sim_image.sh b/test/functest/simulators/build_sim_image.sh
index 8efb273..6d6cb13 100755
--- a/test/functest/simulators/build_sim_image.sh
+++ b/test/functest/simulators/build_sim_image.sh
@@ -32,6 +32,7 @@ cp $SIMULATORS_DIR/Dockerfile $DOCKER_DIR/.
cp -r $OSDF_DIR/osdf $DOCKER_DIR/sim
mkdir -p $DOCKER_DIR/sim/config/
cp $SIMULATORS_DIR/simulated-config/*.yaml $DOCKER_DIR/sim/config/
+cp $SIMULATORS_DIR/simulated-config/*.yml $DOCKER_DIR/sim/config/
cp $SIMULATORS_DIR/simulated-config/*.config $DOCKER_DIR/sim/config/
cp -r $SIMULATORS_DIR/configdb $DOCKER_DIR/sim
cp -r $SIMULATORS_DIR/has-api $DOCKER_DIR/sim
diff --git a/test/placement-tests/request_placement_vfmod.json b/test/placement-tests/request_placement_vfmod.json
index e9f1966..4b2b852 100644
--- a/test/placement-tests/request_placement_vfmod.json
+++ b/test/placement-tests/request_placement_vfmod.json
@@ -1,92 +1,113 @@
{
- "name": "de4f04e3-0a65-470b-9d07-8ea6c2fb3e10",
- "template": {
- "constraints": {
- "affinity_vFW_TD": {
- "demands": ["vFW-SINK", "vPGN"],
- "properties": {
- "category": "region",
- "qualifier": "same"
- },
- "type": "zone"
- }
- },
- "parameters": {
- "service_name": "vFW_TD",
- "chosen_region": "RegionOne",
- "service_id": "3e8d118c-10ca-4b4b-b3db-089b5e9e6a1c",
- "customer_long": 2.2,
- "REQUIRED_MEM": "",
- "customer_lat": 1.1,
- "REQUIRED_DISK": ""
+ "name": "de4f04e3-0a65-470b-9d07-8ea6c2fb3e10",
+ "files": {},
+ "timeout": 1200,
+ "num_solution": "100",
+ "template": {
+ "homing_template_version": "2017-10-10",
+ "parameters": {
+ "REQUIRED_MEM": "",
+ "REQUIRED_DISK": "",
+ "customer_lat": 1.1,
+ "customer_long": 2.2,
+ "service_name": "vFW_TD",
+ "service_id": "3e8d118c-10ca-4b4b-b3db-089b5e9e6a1c",
+ "chosen_region": "RegionOne"
+ },
+ "locations": {
+ "customer_loc": {
+ "latitude": {
+ "get_param": "customer_lat"
},
- "locations": {
- "customer_loc": {
- "longitude": {
- "get_param": "customer_long"
- },
- "latitude": {
- "get_param": "customer_lat"
- }
+ "longitude": {
+ "get_param": "customer_long"
+ }
+ }
+ },
+ "demands": {
+ "vFW-SINK": [
+ {
+ "inventory_provider": "aai",
+ "inventory_type": "vfmodule",
+ "service_type": "vFW-SINK-XX",
+ "service_resource_id": "vFW-SINK-XX",
+ "filtering_attributes": {
+ "global-customer-id": {
+ "get_param": "chosen_customer_id"
+ },
+ "model-invariant-id": "e7227847-dea6-4374-abca-4561b070fe7d",
+ "model-version-id": "763731df-84fd-494b-b824-01fc59a5ff2d",
+ "orchestration-status": [
+ "active"
+ ],
+ "prov-status": "ACTIVE",
+ "cloud-region-id": {
+ "get_param": "chosen_region"
+ },
+ "service_instance_id": {
+ "get_param": "service_id"
}
- },
- "demands": {
- "vFW-SINK": [{
- "attributes": {
- "global-customer-id": {
- "get_param": "chosen_customer_id"
- },
- "cloud-region-id": {
- "get_param": "chosen_region"
- },
- "model-version-id": "763731df-84fd-494b-b824-01fc59a5ff2d",
- "orchestration-status": ["active"],
- "model-invariant-id": "e7227847-dea6-4374-abca-4561b070fe7d",
- "service_instance_id": {
- "get_param": "service_id"
- },
- "prov-status": "ACTIVE"
- },
- "inventory_provider": "aai",
- "service_resource_id": "vFW-SINK-XX",
- "inventory_type": "vfmodule",
- "service_type": "vFW-SINK-XX",
- "excluded_candidates": [{
- "inventory_type": "vfmodule",
- "candidate_id": ["e765d576-8755-4145-8536-0bb6d9b1dc9a"]
- }]
- }],
- "vPGN": [{
- "attributes": {
- "global-customer-id": {
- "get_param": "chosen_customer_id"
- },
- "cloud-region-id": {
- "get_param": "chosen_region"
- },
- "model-version-id": "e02a7e5c-9d27-4360-ab7c-73bb83b07e3b",
- "orchestration-status": ["active"],
- "model-invariant-id": "762472ef-5284-4daa-ab32-3e7bee2ec355",
- "service_instance_id": {
- "get_param": "service_id"
- },
- "prov-status": "ACTIVE"
- },
- "inventory_provider": "aai",
- "service_resource_id": "vPGN-XX",
- "unique": "False",
- "inventory_type": "vfmodule",
- "service_type": "vPGN-XX"
- }]
- },
- "optimization": {
- "minimize": {
- "sum": []
+ },
+ "passthrough_attributes": {
+ "td-role": "destination"
+ },
+ "excluded_candidates": [
+ {
+ "inventory_type": "vfmodule",
+ "candidate_id": [
+ "e765d576-8755-4145-8536-0bb6d9b1dc9a"
+ ]
}
- },
- "homing_template_version": "2017-10-10"
+ ]
+ }
+ ],
+ "vPGN": [
+ {
+ "inventory_provider": "aai",
+ "inventory_type": "vfmodule",
+ "service_type": "vPGN-XX",
+ "service_resource_id": "vPGN-XX",
+ "unique": "False",
+ "filtering_attributes": {
+ "global-customer-id": {
+ "get_param": "chosen_customer_id"
+ },
+ "model-invariant-id": "762472ef-5284-4daa-ab32-3e7bee2ec355",
+ "model-version-id": "e02a7e5c-9d27-4360-ab7c-73bb83b07e3b",
+ "orchestration-status": [
+ "active"
+ ],
+ "prov-status": "ACTIVE",
+ "cloud-region-id": {
+ "get_param": "chosen_region"
+ },
+ "service_instance_id": {
+ "get_param": "service_id"
+ }
+ },
+ "passthrough_attributes": {
+ "td-role": "anchor"
+ }
+ }
+ ]
+ },
+ "constraints": {
+ "affinity_vFW_TD": {
+ "type": "zone",
+ "demands": [
+ "vFW-SINK",
+ "vPGN"
+ ],
+ "properties": {
+ "category": "region",
+ "qualifier": "same"
+ }
+ }
},
- "num_solution": "100",
- "files": {},
- "timeout": 1200
-}
+ "optimization": {
+ "minimize": {
+ "sum": []
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/test/policy-local-files/vnfPolicy_vFW_TD.json b/test/policy-local-files/vnfPolicy_vFW_TD.json
index 9a9cbe0..a471a77 100644
--- a/test/policy-local-files/vnfPolicy_vFW_TD.json
+++ b/test/policy-local-files/vnfPolicy_vFW_TD.json
@@ -35,7 +35,10 @@
"service_instance_id": {
"get_param": "service_id"
}
+ },
+ "passthroughAttributes": {
+ "td-role": "destination"
}
}]
}
-} \ No newline at end of file
+}
diff --git a/test/policy-local-files/vnfPolicy_vPGN_TD.json b/test/policy-local-files/vnfPolicy_vPGN_TD.json
index 3724f8a..2e79f2f 100644
--- a/test/policy-local-files/vnfPolicy_vPGN_TD.json
+++ b/test/policy-local-files/vnfPolicy_vPGN_TD.json
@@ -1,42 +1,51 @@
{
- "service": "vnfPolicy",
- "policyName": "OSDF_DUBLIN.vnfPolicy_vPGN_TD",
- "description": "vnfPolicy",
- "templateVersion": "OpenSource.version.1",
- "version": "oofDublin",
- "priority": "6",
- "riskType": "test",
- "riskLevel": "3",
- "guard": "False",
- "content": {
- "identity": "vnf_vPGN_TD",
- "policyScope": [
- "td",
- "us",
- "vPGN"
- ],
- "policyType": "vnfPolicy",
- "resources": ["vPGN"],
- "applicableResources": "any",
- "vnfProperties": [{
- "inventoryProvider": "aai",
- "serviceType": "",
- "inventoryType": "vfmodule",
- "customerId": {
- "get_param": "chosen_customer_id"
- },
- "equipmentRole": "",
- "unique": "False",
- "attributes": {
- "orchestrationStatus": ["active"],
- "provStatus": "ACTIVE",
- "cloudRegionId": {
- "get_param": "chosen_region"
- },
- "service_instance_id": {
- "get_param": "service_id"
- }
- }
- }]
- }
+ "service": "vnfPolicy",
+ "policyName": "OSDF_DUBLIN.vnfPolicy_vPGN_TD",
+ "description": "vnfPolicy",
+ "templateVersion": "OpenSource.version.1",
+ "version": "oofDublin",
+ "priority": "6",
+ "riskType": "test",
+ "riskLevel": "3",
+ "guard": "False",
+ "content": {
+ "identity": "vnf_vPGN_TD",
+ "policyScope": [
+ "td",
+ "us",
+ "vPGN"
+ ],
+ "policyType": "vnfPolicy",
+ "resources": [
+ "vPGN"
+ ],
+ "applicableResources": "any",
+ "vnfProperties": [
+ {
+ "inventoryProvider": "aai",
+ "serviceType": "",
+ "inventoryType": "vfmodule",
+ "customerId": {
+ "get_param": "chosen_customer_id"
+ },
+ "equipmentRole": "",
+ "unique": "False",
+ "attributes": {
+ "orchestrationStatus": [
+ "active"
+ ],
+ "provStatus": "ACTIVE",
+ "cloudRegionId": {
+ "get_param": "chosen_region"
+ },
+ "service_instance_id": {
+ "get_param": "service_id"
+ }
+ },
+ "passthroughAttributes": {
+ "td-role": "anchor"
+ }
+ }
+ ]
+ }
} \ No newline at end of file
diff --git a/test/test-requirements.txt b/test/test-requirements.txt
index 043d87a..c8d5613 100644
--- a/test/test-requirements.txt
+++ b/test/test-requirements.txt
@@ -3,3 +3,4 @@ moto
pytest
pytest-tap
requests-mock
+pylint
diff --git a/test/test_ConductorApiBuilder.py b/test/test_ConductorApiBuilder.py
index e69e954..07cb3bb 100644
--- a/test/test_ConductorApiBuilder.py
+++ b/test/test_ConductorApiBuilder.py
@@ -47,7 +47,7 @@ class TestConductorApiBuilder(unittest.TestCase):
main_dir = self.main_dir
request_json = self.request_json
policies = self.policies
- local_config = yaml.load(open(self.local_config_file))
+ local_config = yaml.safe_load(open(self.local_config_file))
templ_string = conductor_api_builder(request_json, policies, local_config, self.conductor_api_template)
templ_json = json.loads(templ_string)
self.assertEqual(templ_json["name"], "yyy-yyy-yyyy")
@@ -55,7 +55,7 @@ class TestConductorApiBuilder(unittest.TestCase):
def test_conductor_api_call_builder_vfmod(self):
request_json = self.request_vfmod_json
policies = self.policies
- local_config = yaml.load(open(self.local_config_file))
+ local_config = yaml.safe_load(open(self.local_config_file))
templ_string = conductor_api_builder(request_json, policies, local_config, self.conductor_api_template)
templ_json = json.loads(templ_string)
self.assertEqual(templ_json, self.request_placement_vfmod_json)