diff options
author | Gary Wu <gary.i.wu@huawei.com> | 2018-03-27 17:45:05 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-03-27 17:45:05 +0000 |
commit | 3facc2cec88b2dc16b128a29f51c3b7fb6a05f1d (patch) | |
tree | de123b2013003eb59579202288c02790990b2cb6 /test | |
parent | 2fb89c00d20a456b86107ea60041c85c69deabb9 (diff) | |
parent | d776cf56f04032fa42727ad94b6712e52022fb8d (diff) |
Merge "Complete optf-has csit for M4"
Diffstat (limited to 'test')
-rwxr-xr-x | test/csit/scripts/optf-has/has/music_script.sh | 2 | ||||
-rw-r--r-- | test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json | 49 | ||||
-rw-r--r-- | test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json.service | 51 | ||||
-rw-r--r-- | test/csit/tests/optf-has/has/data/plan_with_short_distance_constraint.json | 21 | ||||
-rw-r--r-- | test/csit/tests/optf-has/has/data/plan_with_wrong_distance_constraint.json (renamed from test/csit/tests/optf-has/has/data/plan_with_long_distance_constraint.json.orig) | 22 | ||||
-rw-r--r-- | test/csit/tests/optf-has/has/optf_has_test.robot | 65 |
6 files changed, 100 insertions, 110 deletions
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.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_long_distance_constraint.json.orig b/test/csit/tests/optf-has/has/data/plan_with_wrong_distance_constraint.json index be410086c..9f25c2dff 100644 --- 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_wrong_distance_constraint.json @@ -1,5 +1,5 @@ { - "name":"onap template with long distance constraint", + "name":"onap template with wrong distance constraint", "template":{ "homing_template_version":"2017-10-10", "parameters":{ @@ -32,18 +32,32 @@ }, "constraints":{ "distance-vg":{ - "type":"distance_to_location", "demands":[ "vG" ], "properties":{ - "distance":"> 100 km", + "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 *** |