From d776cf56f04032fa42727ad94b6712e52022fb8d Mon Sep 17 00:00:00 2001 From: Leonardo Bellini Date: Tue, 27 Mar 2018 11:52:58 -0500 Subject: Complete optf-has csit for M4 Issue-ID: OPTFRA-204 Change-Id: I09afb088c343699be78d2195638596ac09a0c875 Signed-off-by: Leonardo Bellini --- test/csit/scripts/optf-has/has/music_script.sh | 2 +- .../data/plan_with_long_distance_constraint.json | 49 ---------------- .../plan_with_long_distance_constraint.json.orig | 49 ---------------- ...plan_with_long_distance_constraint.json.service | 51 ----------------- .../data/plan_with_short_distance_constraint.json | 21 ++++++- .../data/plan_with_wrong_distance_constraint.json | 63 +++++++++++++++++++++ test/csit/tests/optf-has/has/optf_has_test.robot | 65 +++++++++++++++++++++- 7 files changed, 145 insertions(+), 155 deletions(-) delete mode 100644 test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json delete mode 100644 test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json.orig delete mode 100644 test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json.service create mode 100644 test/csit/tests/optf-has/has/data/plan_with_wrong_distance_constraint.json (limited to 'test') diff --git a/test/csit/scripts/optf-has/has/music_script.sh b/test/csit/scripts/optf-has/has/music_script.sh index fb43e1b8b..39cab6194 100755 --- a/test/csit/scripts/optf-has/has/music_script.sh +++ b/test/csit/scripts/optf-has/has/music_script.sh @@ -55,7 +55,7 @@ docker run -d --name music-war -v music-vol:/app ${MUSIC_IMG}; docker run -d --name music-zk --network music-net -p "2181:2181" -p "2888:2888" -p "3888:3888" ${ZK_IMG}; # Delay for Cassandra -sleep 20; +sleep 30; # Start Up tomcat - Needs to have properties,logs dir and war file volume mapped. docker run -d --name music-tomcat --network music-net -p "8080:8080" -v music-vol:/usr/local/tomcat/webapps -v ${WORK_DIR}/properties:/opt/app/music/etc:ro -v ${WORK_DIR}/logs:/opt/app/music/logs ${TOMCAT_IMG}; diff --git a/test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json b/test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json deleted file mode 100644 index 3e6d26791..000000000 --- a/test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name":"onap template with short distance constraint", - "template":{ - "homing_template_version":"2017-10-10", - "parameters":{ - "service_name":"Residential vCPE", - "service_id":"vcpe_service_id", - "customer_lat":25.395968, - "customer_long":-51.135344, - "physical_location":"DLLSTX233", - "REQUIRED_MEM":4, - "REQUIRED_DISK":100, - "pnf_id":"some_pnf_id" - }, - "locations":{ - "customer_loc":{ - "latitude":{ - "get_param":"customer_lat" - }, - "longitude":{ - "get_param":"customer_long" - } - } - }, - "demands":{ - "vG":[ - { - "inventory_provider":"aai", - "inventory_type":"cloud" - } - ] - }, - "constraints":{ - "distance-vg":{ - "type":"distance_to_location", - "demands":[ - "vG" - ], - "properties":{ - "distance":"< 1 km", - "location":"customer_loc" - } - } - }, - "optimization":{ - - } - } -} diff --git a/test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json.orig b/test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json.orig deleted file mode 100644 index be410086c..000000000 --- a/test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json.orig +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name":"onap template with long distance constraint", - "template":{ - "homing_template_version":"2017-10-10", - "parameters":{ - "service_name":"Residential vCPE", - "service_id":"vcpe_service_id", - "customer_lat":45.395968, - "customer_long":-71.135344, - "physical_location":"DLLSTX233", - "REQUIRED_MEM":4, - "REQUIRED_DISK":100, - "pnf_id":"some_pnf_id" - }, - "locations":{ - "customer_loc":{ - "latitude":{ - "get_param":"customer_lat" - }, - "longitude":{ - "get_param":"customer_long" - } - } - }, - "demands":{ - "vG":[ - { - "inventory_provider":"aai", - "inventory_type":"cloud" - } - ] - }, - "constraints":{ - "distance-vg":{ - "type":"distance_to_location", - "demands":[ - "vG" - ], - "properties":{ - "distance":"> 100 km", - "location":"customer_loc" - } - } - }, - "optimization":{ - - } - } -} diff --git a/test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json.service b/test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json.service deleted file mode 100644 index b0d6478fc..000000000 --- a/test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json.service +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name":"onap template with long distance constraint", - "template":{ - "homing_template_version":"2017-10-10", - "parameters":{ - "service_name":"Residential vCPE", - "service_id":"vcpe_service_id", - "customer_lat":45.395968, - "customer_long":-71.135344, - "physical_location":"DLLSTX233", - "REQUIRED_MEM":4, - "REQUIRED_DISK":100, - "pnf_id":"some_pnf_id" - }, - "locations":{ - "customer_loc":{ - "latitude":{ - "get_param":"customer_lat" - }, - "longitude":{ - "get_param":"customer_long" - } - } - }, - "demands":{ - "vG":[ - { - "inventory_provider":"aai", - "inventory_type":"service", - "service_type": "VVIG", - "customer_id": "21014aa2-526b-11e6-beb8-9e71128cae77" - } - ] - }, - "constraints":{ - "distance-vg":{ - "type":"distance_to_location", - "demands":[ - "vG" - ], - "properties":{ - "distance":"> 100 km", - "location":"customer_loc" - } - } - }, - "optimization":{ - - } - } -} diff --git a/test/csit/tests/optf-has/has/data/plan_with_short_distance_constraint.json b/test/csit/tests/optf-has/has/data/plan_with_short_distance_constraint.json index 85a1a7387..68a7e119b 100644 --- a/test/csit/tests/optf-has/has/data/plan_with_short_distance_constraint.json +++ b/test/csit/tests/optf-has/has/data/plan_with_short_distance_constraint.json @@ -5,8 +5,8 @@ "parameters":{ "service_name":"Residential vCPE", "service_id":"vcpe_service_id", - "customer_lat":45.395968, - "customer_long":-71.135344, + "customer_lat":25.395968, + "customer_long":-51.135344, "physical_location":"DLLSTX233", "REQUIRED_MEM":4, "REQUIRED_DISK":100, @@ -43,7 +43,22 @@ } }, "optimization":{ - + "minimize": { + "sum": [ + { + "distance_between": [ + "customer_loc", + "vG" + ] + }, + { + "distance_between": [ + "customer_loc", + "vG" + ] + } + ] + } } } } diff --git a/test/csit/tests/optf-has/has/data/plan_with_wrong_distance_constraint.json b/test/csit/tests/optf-has/has/data/plan_with_wrong_distance_constraint.json new file mode 100644 index 000000000..9f25c2dff --- /dev/null +++ b/test/csit/tests/optf-has/has/data/plan_with_wrong_distance_constraint.json @@ -0,0 +1,63 @@ +{ + "name":"onap template with wrong distance constraint", + "template":{ + "homing_template_version":"2017-10-10", + "parameters":{ + "service_name":"Residential vCPE", + "service_id":"vcpe_service_id", + "customer_lat":45.395968, + "customer_long":-71.135344, + "physical_location":"DLLSTX233", + "REQUIRED_MEM":4, + "REQUIRED_DISK":100, + "pnf_id":"some_pnf_id" + }, + "locations":{ + "customer_loc":{ + "latitude":{ + "get_param":"customer_lat" + }, + "longitude":{ + "get_param":"customer_long" + } + } + }, + "demands":{ + "vG":[ + { + "inventory_provider":"aai", + "inventory_type":"cloud" + } + ] + }, + "constraints":{ + "distance-vg":{ + "demands":[ + "vG" + ], + "properties":{ + "distance":"< 1 km", + "location":"customer_loc" + } + } + }, + "optimization":{ + "minimize": { + "sum": [ + { + "distance_between": [ + "customer_loc", + "vG" + ] + }, + { + "distance_between": [ + "customer_loc", + "vG" + ] + } + ] + } + } + } +} diff --git a/test/csit/tests/optf-has/has/optf_has_test.robot b/test/csit/tests/optf-has/has/optf_has_test.robot index d6de27632..62db10774 100644 --- a/test/csit/tests/optf-has/has/optf_has_test.robot +++ b/test/csit/tests/optf-has/has/optf_has_test.robot @@ -170,8 +170,6 @@ GetPlanWithWrongVersion Should Be Equal As Integers ${resp.status_code} 200 Should Be Equal error ${resultStatus} - - SendPlanWithoutDemandSection [Documentation] It sends a POST request to conductor Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT} @@ -203,6 +201,37 @@ GetPlanWithoutDemandSection Should Be Equal As Integers ${resp.status_code} 200 Should Be Equal error ${resultStatus} +SendPlanWithWrongConstraint + [Documentation] It sends a POST request to conductor + Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT} + ${data}= Get Binary File ${CURDIR}${/}data${/}plan_with_wrong_distance_constraint.json + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Post Request optf-cond /v1/plans data=${data} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + ${response_json} json.loads ${resp.content} + ${generatedPlanId}= Convert To String ${response_json['id']} + Set Global Variable ${generatedPlanId} + Log To Console generatedPlanId = ${generatedPlanId} + Should Be Equal As Integers ${resp.status_code} 201 + Sleep 10s Wait Plan Resolution + +GetPlanWithWrongConstraint + [Documentation] It sends a REST GET request to capture error + Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT} + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Get Request optf-cond /v1/plans/${generatedPlanId} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + ${response_json} json.loads ${resp.content} + ${resultStatus}= Convert To String ${response_json['plans'][0]['status']} + Set Global Variable ${resultStatus} + Log To Console resultStatus = ${resultStatus} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + Should Be Equal error ${resultStatus} + SendPlanWithLatiAndLongi [Documentation] It sends a POST request to conductor @@ -235,6 +264,38 @@ GetPlanWithLatiAndLongi Should Be Equal As Integers ${resp.status_code} 200 Should Be Equal done ${resultStatus} +SendPlanWithShortDistanceConstraint + [Documentation] It sends a POST request to conductor + Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT} + ${data}= Get Binary File ${CURDIR}${/}data${/}plan_with_short_distance_constraint.json + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Post Request optf-cond /v1/plans data=${data} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + ${response_json} json.loads ${resp.content} + ${generatedPlanId}= Convert To String ${response_json['id']} + Set Global Variable ${generatedPlanId} + Log To Console generatedPlanId = ${generatedPlanId} + Should Be Equal As Integers ${resp.status_code} 201 + Sleep 60s Wait Plan Resolution + +GetPlanWithShortDistanceConstraint + [Documentation] It sends a REST GET request to capture recommendations + Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT} + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Get Request optf-cond /v1/plans/${generatedPlanId} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + ${response_json} json.loads ${resp.content} + ${resultStatus}= Convert To String ${response_json['plans'][0]['status']} + Set Global Variable ${resultStatus} + Log To Console resultStatus = ${resultStatus} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + Should Be Equal not found ${resultStatus} + + *** Keywords *** -- cgit 1.2.3-korg