summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/csit/plans/vnfsdk-ice/sanity-check/setup.sh34
-rw-r--r--test/csit/plans/vnfsdk-ice/sanity-check/teardown.sh22
-rw-r--r--test/csit/plans/vnfsdk-ice/sanity-check/testplan.txt3
-rw-r--r--test/csit/tests/vnfsdk-ice/ice-server/validation_test.robot69
4 files changed, 128 insertions, 0 deletions
diff --git a/test/csit/plans/vnfsdk-ice/sanity-check/setup.sh b/test/csit/plans/vnfsdk-ice/sanity-check/setup.sh
new file mode 100644
index 000000000..7e777a133
--- /dev/null
+++ b/test/csit/plans/vnfsdk-ice/sanity-check/setup.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+#
+# Copyright 2018 Orange Labs.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# These scripts are sourced by run-csit.sh.
+
+
+#Start ice server
+docker run --rm --name vnfsdk-ice -d -p 5000:5000 onap/vnfsdk/ice
+
+# Wait for server initialization
+echo Wait for vnfsdk-ice initialization
+until [ "`/usr/bin/docker inspect -f {{.State.Running}} vnfsdk-ice`"=="true" ]; do
+ sleep 1;
+done;
+ICE_IP=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' vnfsdk-ice`
+
+
+# Pass any variables required by Robot test suites in ROBOT_VARIABLES
+ROBOT_VARIABLES="-v SCRIPTS:${SCRIPTS} -v ICE_IP:${ICE_IP}"
+echo ${ROBOT_VARIABLES}
+
diff --git a/test/csit/plans/vnfsdk-ice/sanity-check/teardown.sh b/test/csit/plans/vnfsdk-ice/sanity-check/teardown.sh
new file mode 100644
index 000000000..c84ea757b
--- /dev/null
+++ b/test/csit/plans/vnfsdk-ice/sanity-check/teardown.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+#
+# Copyright 2018 Orange Labs.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# This script is sourced by run-csit.sh after Robot test completion.
+
+
+kill-instance.sh vnfsdk-ice
+
+
diff --git a/test/csit/plans/vnfsdk-ice/sanity-check/testplan.txt b/test/csit/plans/vnfsdk-ice/sanity-check/testplan.txt
new file mode 100644
index 000000000..c84eb0312
--- /dev/null
+++ b/test/csit/plans/vnfsdk-ice/sanity-check/testplan.txt
@@ -0,0 +1,3 @@
+## Test suites are relative paths under [integration.git]/test/csit/tests/.
+## Place the suites in run order.
+vnfsdk-ice/ice-server/validation_test.robot
diff --git a/test/csit/tests/vnfsdk-ice/ice-server/validation_test.robot b/test/csit/tests/vnfsdk-ice/ice-server/validation_test.robot
new file mode 100644
index 000000000..1a134b017
--- /dev/null
+++ b/test/csit/tests/vnfsdk-ice/ice-server/validation_test.robot
@@ -0,0 +1,69 @@
+*** settings ***
+Library OperatingSystem
+Library Process
+Library String
+Library Collections
+Library RequestsLibrary
+Library json
+
+
+*** Variables ***
+${valid_heat_zip} ${SCRIPTS}/../tests/vnfsdk-ice/ice-server/heat_template_ok.zip
+${empty_heat_zip} ${SCRIPTS}/../tests/vnfsdk-ice/ice-server/heat_template_empty.zip
+${ice_uri} /onapapi/ice/v1/
+
+*** Test Cases ***
+
+ICE health Check
+ [Documentation] Validate that ICE is up
+ Create Session ice_session http://${ICE_IP}:5000
+ &{headers}= Create Dictionary Content-Type=application/json
+
+ ${resp}= Get Request ice_session ${ice_uri} headers=${headers}
+
+ Should Be Equal As Strings ${resp.status_code} 200
+
+Check status code for valid HEAT based VNF package
+ [Documentation] Post a valid VNF package and expect 200 Response
+ ${fileData}= Get Binary File ${valid_heat_zip}
+ ${fileDir} ${fileName}= Split Path ${valid_heat_zip}
+ ${partData}= Create List ${fileName} ${fileData} application/octet-stream
+ &{fileParts}= Create Dictionary
+ Set To Dictionary ${fileParts} file=${partData}
+
+ ${resp}= Post Request ice_session ${ice_uri} files=${fileParts}
+
+ Log Receive HTTP Status code ${resp.status_code}
+ Should Be Equal As Strings ${resp.status_code} 200
+ ${json} = Set Variable ${resp.json()}
+ ${message} = Get From Dictionary ${json} message
+ Should Be Equal ${message} OK
+
+Check status code for empty VNF package
+ [Documentation] Post an empty VNF package and expect 422 Response
+ ${fileData}= Get Binary File ${empty_heat_zip}
+ ${fileDir} ${fileName}= Split Path ${empty_heat_zip}
+ ${partData}= Create List ${fileName} ${fileData} application/octet-stream
+ &{fileParts}= Create Dictionary
+ Set To Dictionary ${fileParts} file=${partData}
+
+ ${resp}= Post Request ice_session ${ice_uri} files=${fileParts}
+
+ Log Receive HTTP Status code ${resp.status_code}
+ Should Be Equal As Strings ${resp.status_code} 422
+ ${json} = Set Variable ${resp.json()}
+ ${message} = Get From Dictionary ${json} message
+ Should Be Equal ${message} Tests failed
+
+Check status code for invalid request
+ [Documentation] Post an invalid request and expect 400 Response
+ ${fileData}= Get Binary File ${empty_heat_zip}
+ ${fileDir} ${fileName}= Split Path ${empty_heat_zip}
+ ${partData}= Create List ${fileName} ${fileData} application/octet-stream
+ &{fileParts}= Create Dictionary
+ Set To Dictionary ${fileParts} foo=${partData}
+
+ ${resp}= Post Request ice_session ${ice_uri} files=${fileParts}
+
+ Log Receive HTTP Status code ${resp.status_code}
+ Should Be Equal As Strings ${resp.status_code} 400