aboutsummaryrefslogtreecommitdiffstats
path: root/test/csit/tests
diff options
context:
space:
mode:
Diffstat (limited to 'test/csit/tests')
-rw-r--r--test/csit/tests/common.robot22
-rw-r--r--test/csit/tests/integration/vCPE/__init__.robot2
-rw-r--r--test/csit/tests/integration/vCPE/test1.robot34
-rw-r--r--test/csit/tests/vfc/nfvo-lcm/jsoninput/create_ns.json6
-rw-r--r--test/csit/tests/vfc/nfvo-lcm/test.robot36
5 files changed, 98 insertions, 2 deletions
diff --git a/test/csit/tests/common.robot b/test/csit/tests/common.robot
new file mode 100644
index 000000000..944be6b9f
--- /dev/null
+++ b/test/csit/tests/common.robot
@@ -0,0 +1,22 @@
+#Robot functions that will be shared also with other tests
+
+*** Keywords ***
+json_from_file
+#Robot function to extract the json object from a file
+ [Arguments] ${file_path}
+ ${json_file}= Get file ${file_path}
+ ${json_object}= Evaluate json.loads('''${json_file}''') json
+ [return] ${json_object}
+
+string_from_json
+#Robot function to transform the json object to a string
+ [Arguments] ${json_value}
+ ${json_string}= Stringify Json ${json_value}
+ [return] ${json_string}
+
+random_ip
+#Robot function to generate a random IP
+ [Arguments]
+ ${numbers}= Evaluate random.sample([x for x in range(1, 256)], 4) random
+ ${generated_ip}= Catenate ${numbers[0]}.${numbers[1]}.${numbers[2]}.${numbers[3]}
+ [return] ${generated_ip} \ No newline at end of file
diff --git a/test/csit/tests/integration/vCPE/__init__.robot b/test/csit/tests/integration/vCPE/__init__.robot
new file mode 100644
index 000000000..b2057b0d1
--- /dev/null
+++ b/test/csit/tests/integration/vCPE/__init__.robot
@@ -0,0 +1,2 @@
+*** Settings ***
+Documentation Integration - vCPE
diff --git a/test/csit/tests/integration/vCPE/test1.robot b/test/csit/tests/integration/vCPE/test1.robot
new file mode 100644
index 000000000..d9a9baf95
--- /dev/null
+++ b/test/csit/tests/integration/vCPE/test1.robot
@@ -0,0 +1,34 @@
+*** Settings ***
+Library OperatingSystem
+Library RequestsLibrary
+Library Process
+
+*** Test Cases ***
+SO ServiceInstance health check
+ ${SO_IP}= Run Docker nexus3.onap.org:10001/openecomp/mso i-so
+ Wait Until Keyword Succeeds 1 min 5 sec CheckUrl http://${SO_IP}:8080
+ Create Session refrepo http://${SO_IP}:8080
+ &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json
+ ${resp}= Get Request refrepo /ecomp/mso/infra/orchestrationRequests/v2 headers=${headers}
+ Should Not Contain ${resp.content} null
+ Kill Docker i-so
+
+*** Keywords ***
+Run Docker
+ [Arguments] ${image} ${name} ${parameters}=${EMPTY}
+ ${result}= Run Process docker run --name ${name} ${parameters} -d ${image} shell=True
+ Log all output: ${result.stdout}
+ ${result}= Run Process docker inspect --format '{{ .NetworkSettings.IPAddress }}' ${name} shell=True
+ [Return] ${result.stdout}
+
+Kill Docker
+ [Arguments] ${name}
+ ${result}= Run Process docker logs ${name} shell=True
+ ${result}= Run Process docker kill ${name} shell=True
+ ${result}= Run Process docker rm ${name} shell=True
+
+CheckUrl
+ [Arguments] ${url}
+ Create Session session ${url} disable_warnings=True
+ ${resp}= Get Request session /
+ Should Be Equal As Integers ${resp.status_code} 200
diff --git a/test/csit/tests/vfc/nfvo-lcm/jsoninput/create_ns.json b/test/csit/tests/vfc/nfvo-lcm/jsoninput/create_ns.json
new file mode 100644
index 000000000..bb39364bb
--- /dev/null
+++ b/test/csit/tests/vfc/nfvo-lcm/jsoninput/create_ns.json
@@ -0,0 +1,6 @@
+{
+ "nsName": "ns1",
+ "csarId": "123",
+ "description": "ns1 desc",
+ "test": "test"
+} \ No newline at end of file
diff --git a/test/csit/tests/vfc/nfvo-lcm/test.robot b/test/csit/tests/vfc/nfvo-lcm/test.robot
index 7f6a0d8b8..44d23292e 100644
--- a/test/csit/tests/vfc/nfvo-lcm/test.robot
+++ b/test/csit/tests/vfc/nfvo-lcm/test.robot
@@ -1,12 +1,22 @@
*** settings ***
+Resource ../../common.robot
Library Collections
Library RequestsLibrary
Library OperatingSystem
Library json
+Library HttpLibrary.HTTP
*** Variables ***
-@{return_ok_list}= 200 201 202
+@{return_ok_list}= 200 201 202 204
${queryswagger_url} /api/nslcm/v1/swagger.json
+${create_ns_url} /api/nslcm/v1/ns
+${delete_ns_url} /api/nslcm/v1/ns
+
+#json files
+${create_ns_json} ${SCRIPTS}/../tests/vfc/nfvo-lcm/jsoninput/create_ns.json
+
+#global variables
+${nsInstId}
*** Test Cases ***
NslcmSwaggerTest
@@ -29,4 +39,26 @@ NslcmSwaggerByMSBTest
List Should Contain Value ${return_ok_list} ${responese_code}
${response_json} json.loads ${resp.content}
${swagger_version}= Convert To String ${response_json['swagger']}
- Should Be Equal ${swagger_version} 2.0 \ No newline at end of file
+ Should Be Equal ${swagger_version} 2.0
+
+CreateNSTest
+ [Documentation] Create NS function test
+ ${json_value}= json_from_file ${create_ns_json}
+ ${json_string}= string_from_json ${json_value}
+ ${headers} Create Dictionary Content-Type=application/json Accept=application/json
+ Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
+ Set Request Body ${json_string}
+ ${resp}= Post Request web_session ${create_ns_url} ${json_string}
+ ${responese_code}= Convert To String ${resp.status_code}
+ List Should Contain Value ${return_ok_list} ${responese_code}
+ ${response_json} json.loads ${resp.content}
+ ${nsInstId}= Convert To String ${response_json['nsInstanceId']}
+ Set Global Variable ${nsInstId}
+
+DeleteNS Test
+ [Documentation] Delete NS function test
+ ${headers} Create Dictionary Content-Type=application/json Accept=application/json
+ Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers}
+ ${resp}= Delete Request web_session ${delete_ns_url}/${nsInstId}
+ ${responese_code}= Convert To String ${resp.status_code}
+ List Should Contain Value ${return_ok_list} ${responese_code}