aboutsummaryrefslogtreecommitdiffstats
path: root/test/csit
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2018-03-26 17:04:02 +0000
committerGerrit Code Review <gerrit@onap.org>2018-03-26 17:04:02 +0000
commit66a014c295cff94a1e3c96e467daa97f2a3cb254 (patch)
tree3acbda29a2aa00de038413dea9eabda6168174a7 /test/csit
parent69123c9971ce76270e59395507a2793dcc2884fe (diff)
parent735c8e14ca903a09c3409957b8b91800774d7f4b (diff)
Merge "Add optf-has healthcheck and other test cases"
Diffstat (limited to 'test/csit')
-rw-r--r--test/csit/scripts/optf-has/has/has-properties/conductor.conf.onap6
-rwxr-xr-xtest/csit/scripts/optf-has/has/has_script.sh11
-rwxr-xr-xtest/csit/scripts/optf-has/has/has_teardown_script.sh5
-rwxr-xr-xtest/csit/scripts/optf-has/has/simulator_script.sh2
-rw-r--r--test/csit/tests/optf-has/has/data/healthcheck.json19
-rw-r--r--test/csit/tests/optf-has/has/data/onboard.json6
-rw-r--r--test/csit/tests/optf-has/has/data/plan_with_lati_and_longi.json41
-rw-r--r--test/csit/tests/optf-has/has/optf_has_test.robot58
8 files changed, 144 insertions, 4 deletions
diff --git a/test/csit/scripts/optf-has/has/has-properties/conductor.conf.onap b/test/csit/scripts/optf-has/has/has-properties/conductor.conf.onap
index d3e391cde..0f9e7494d 100644
--- a/test/csit/scripts/optf-has/has/has-properties/conductor.conf.onap
+++ b/test/csit/scripts/optf-has/has/has-properties/conductor.conf.onap
@@ -247,9 +247,15 @@ timeout = 3600
#
# From conductor
#
+music_new_version = True
# Base URL for Music REST API without a trailing slash. (string value)
server_url = http://localhost:8080/MUSIC/rest/v2
+version = v2
+music_version = "2.4.22"
+aafuser = conductor
+aafpass = c0nduct0r
+aafns = conductor
# DEPRECATED: List of hostnames (round-robin access) (list value)
# This option is deprecated for removal.
diff --git a/test/csit/scripts/optf-has/has/has_script.sh b/test/csit/scripts/optf-has/has/has_script.sh
index 242f5f63e..a5bf9f999 100755
--- a/test/csit/scripts/optf-has/has/has_script.sh
+++ b/test/csit/scripts/optf-has/has/has_script.sh
@@ -53,21 +53,26 @@ sed -i -e "s%localhost:8080/MUSIC%${MUSIC_IP}:8080/MUSIC%g" /tmp/conductor/prop
AAISIM_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' aaisim`
echo "AAISIM_IP=${AAISIM_IP}"
+#onboard conductor into music
+curl -vvvvv --noproxy "*" --request POST http://${MUSIC_IP}:8080/MUSIC/rest/v2/admin/onboardAppWithMusic -H "Content-Type: application/json" --data @${WORKSPACE}/test/csit/tests/optf-has/has/data/onboard.json
+
# change MUSIC reference to the local instance
sed -i -e "s%localhost:8081/%${AAISIM_IP}:8081/%g" /tmp/conductor/properties/conductor.conf
docker run -d --name cond-cont -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf ${IMAGE_NAME}:latest python /usr/local/bin/conductor-controller --config-file=/usr/local/bin/conductor.conf
+sleep 2
docker run -d --name cond-api -p "8091:8091" -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf ${IMAGE_NAME}:latest python /usr/local/bin/conductor-api --port=8091 -- --config-file=/usr/local/bin/conductor.conf
+sleep 2
docker run -d --name cond-solv -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf ${IMAGE_NAME}:latest python /usr/local/bin/conductor-solver --config-file=/usr/local/bin/conductor.conf
+sleep 2
docker run -d --name cond-resv -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf ${IMAGE_NAME}:latest python /usr/local/bin/conductor-reservation --config-file=/usr/local/bin/conductor.conf
+sleep 2
docker run -d --name cond-data -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf -v ${CERT}:/usr/local/bin/cert.cer -v ${KEY}:/usr/local/bin/cert.key -v ${BUNDLE}:/usr/local/bin/cert.pem ${IMAGE_NAME}:latest python /usr/local/bin/conductor-data --config-file=/usr/local/bin/conductor.conf
+sleep 2
COND_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' cond-api`
${WORKSPACE}/test/csit/scripts/optf-has/has/wait_for_port.sh ${COND_IP} 8091
-# wait a while before continuing
-sleep 5
-
echo "inspect docker things for tracing purpose"
docker inspect cond-data
docker inspect cond-cont
diff --git a/test/csit/scripts/optf-has/has/has_teardown_script.sh b/test/csit/scripts/optf-has/has/has_teardown_script.sh
index 40a536a87..dcf41648c 100755
--- a/test/csit/scripts/optf-has/has/has_teardown_script.sh
+++ b/test/csit/scripts/optf-has/has/has_teardown_script.sh
@@ -14,6 +14,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+#echo "print meaningful data before scratching everything"
+#docker exec -it music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM system_schema.keyspaces'
+#docker exec -it music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM admin.keyspace_master'
+#docker exec -it music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM conductor.plans'
+
echo "optf/has scripts docker containers killing";
docker stop cond-api
docker stop cond-solv
diff --git a/test/csit/scripts/optf-has/has/simulator_script.sh b/test/csit/scripts/optf-has/has/simulator_script.sh
index 524728270..e5bc43dbe 100755
--- a/test/csit/scripts/optf-has/has/simulator_script.sh
+++ b/test/csit/scripts/optf-has/has/simulator_script.sh
@@ -59,7 +59,7 @@ echo "AAISIM_IP=${AAISIM_IP}"
${WORKSPACE}/test/csit/scripts/optf-has/has/wait_for_port.sh ${AAISIM_IP} 8081
# wait a while before continuing
-sleep 5
+sleep 2
echo "inspect docker things for tracing purpose"
docker inspect aaisim
diff --git a/test/csit/tests/optf-has/has/data/healthcheck.json b/test/csit/tests/optf-has/has/data/healthcheck.json
new file mode 100644
index 000000000..926bb2898
--- /dev/null
+++ b/test/csit/tests/optf-has/has/data/healthcheck.json
@@ -0,0 +1,19 @@
+{
+ "consistencyInfo": {
+ "type": "eventual"
+ },
+ "values": {
+ "created": 1479482603641,
+ "message": "",
+ "name": "foo",
+ "recommend_max": 1,
+ "solution": "{\"healthcheck\": \" healthcheck\"}",
+ "status": "solved",
+ "template": "{\"healthcheck\": \"healthcheck\"}",
+ "timeout": 3600,
+ "translation": "{\"healthcheck\": \" healthcheck\"}",
+ "updated": 1484324150629
+ }
+}
+
+
diff --git a/test/csit/tests/optf-has/has/data/onboard.json b/test/csit/tests/optf-has/has/data/onboard.json
new file mode 100644
index 000000000..a4939c459
--- /dev/null
+++ b/test/csit/tests/optf-has/has/data/onboard.json
@@ -0,0 +1,6 @@
+{
+ "appname": "conductor",
+ "userId": "conductor",
+ "isAAF": "false",
+ "password": "c0nduct0r"
+}
diff --git a/test/csit/tests/optf-has/has/data/plan_with_lati_and_longi.json b/test/csit/tests/optf-has/has/data/plan_with_lati_and_longi.json
new file mode 100644
index 000000000..5e35d6abf
--- /dev/null
+++ b/test/csit/tests/optf-has/has/data/plan_with_lati_and_longi.json
@@ -0,0 +1,41 @@
+{
+ "name":"onap template with lati and longi without constraints and without optimizations",
+ "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":{
+
+ },
+ "optimization":{
+
+ }
+ }
+}
+
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 4882c229f..08a32105d 100644
--- a/test/csit/tests/optf-has/has/optf_has_test.robot
+++ b/test/csit/tests/optf-has/has/optf_has_test.robot
@@ -11,6 +11,8 @@ ${RESP_MESSAGE_WITHOUT_DEMANDS} Undefined Demand
#global variables
${generatedPlanId}
+${generatedAID}
+${resultStatus}
*** Test Cases ***
Check Cassandra Docker Container
@@ -114,6 +116,62 @@ Get Root Url
Log To Console body = ${resp.text}
Should Be Equal As Integers ${resp.status_code} 200
+Conductor AddHealthcheck Row Into Music
+ [Documentation] It sends a REST PUT request to Music to inject healthcheck plan
+ Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
+ ${data}= Get Binary File ${CURDIR}${/}data${/}healthcheck.json
+ &{headers}= Create Dictionary ns=conductor userId=conductor password=c0nduct0r Content-Type=application/json Accept=application/json
+ ${resp}= Put Request musicaas /MUSIC/rest/v2/keyspaces/conductor/tables/plans/rows?id=healthcheck data=${data} headers=${headers}
+ Log To Console *********************
+ Log To Console response = ${resp}
+ Log To Console body = ${resp.text}
+ ${response_json} json.loads ${resp.content}
+ Should Be Equal As Integers ${resp.status_code} 200
+ Sleep 5s Wait Injection effectiveness
+
+Healthcheck
+ [Documentation] It sends a REST GET request to healthcheck url
+ 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/healthcheck headers=${headers}
+ Log To Console *********************
+ Log To Console response = ${resp}
+ Log To Console body = ${resp.text}
+ Should Be Equal As Integers ${resp.status_code} 200
+
+
+SendPlanWithLatiAndLongi
+ [Documentation] It sends a POST GET request to conductor
+ Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
+ ${data}= Get Binary File ${CURDIR}${/}data${/}plan_with_lati_and_longi.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
+
+GetPlanWithLatiAndLongi
+ [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 done ${resultStatus}
+
+
*** Keywords ***