aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRuoyu Ying <ruoyu.ying@intel.com>2019-04-11 02:31:44 +0800
committerRuoyu Ying <ruoyu.ying@intel.com>2019-04-11 02:38:24 +0800
commitc014e9208017bb712665fd70ee1f60f0ac519f99 (patch)
tree7ceb3af2f8a6190803135d024a47aa59e346c360
parent124bd57e9cf4efab66335848fb989f43aafb4167 (diff)
Add CSIT testing for optf-has
Add one more test case for OOF homing. Change-Id: I2e022964c1448b53cb629ccd850b3660fe069270 Issue-ID: OPTFRA-449 Signed-off-by: Ruoyu Ying <ruoyu.ying@intel.com>
-rw-r--r--robot/assets/templates/optf-has/plan_with_wrong_version.json40
-rw-r--r--robot/resources/oof_interface.robot22
-rw-r--r--robot/testsuites/oof-has.robot10
-rwxr-xr-xsetup.sh3
4 files changed, 73 insertions, 2 deletions
diff --git a/robot/assets/templates/optf-has/plan_with_wrong_version.json b/robot/assets/templates/optf-has/plan_with_wrong_version.json
new file mode 100644
index 00000000..670bcb6d
--- /dev/null
+++ b/robot/assets/templates/optf-has/plan_with_wrong_version.json
@@ -0,0 +1,40 @@
+{
+ "name":"onap template with wrong version",
+ "template":{
+ "homing_template_version":"xxxx-yy-zz",
+ "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/robot/resources/oof_interface.robot b/robot/resources/oof_interface.robot
index 24a23459..aad06526 100644
--- a/robot/resources/oof_interface.robot
+++ b/robot/resources/oof_interface.robot
@@ -1,5 +1,6 @@
*** Settings ***
Documentation The main interface for interacting with OOF: SNIRO and Homing Service
+Library json5
Library RequestsLibrary
Library UUID
Library String
@@ -16,11 +17,14 @@ ${OOF_CMSO_HEALTH_CHECK_PATH} /cmso/v1/health?checkInterfaces=true
${OOF_CMSO_TEMPLATE_FOLDER} robot/assets/templates/cmso
${OOF_CMSO_UTC} %Y-%m-%dT%H:%M:%SZ
+${OOF_HOMING_PLAN_FOLDER} robot/assets/templates/optf-has
${OOF_HOMING_ENDPOINT} ${GLOBAL_OOF_SERVER_PROTOCOL}://${GLOBAL_INJECTED_OOF_HOMING_IP_ADDR}:${GLOBAL_OOF_HOMING_SERVER_PORT}
${OOF_SNIRO_ENDPOINT} ${GLOBAL_OOF_SERVER_PROTOCOL}://${GLOBAL_INJECTED_OOF_SNIRO_IP_ADDR}:${GLOBAL_OOF_SNIRO_SERVER_PORT}
${OOF_CMSO_ENDPOINT} ${GLOBAL_OOF_CMSO_PROTOCOL}://${GLOBAL_INJECTED_OOF_CMSO_IP_ADDR}:${GLOBAL_OOF_CMSO_SERVER_PORT}
+${OOF_HOMING_AUTH} Basic YWRtaW4xOnBsYW4uMTU=
+
*** Keywords ***
Run OOF-Homing Health Check
[Documentation] Runs OOF-Homing Health check
@@ -36,6 +40,22 @@ Run OOF-Homing Get Request
Log Received response from OOF-Homing ${resp.text}
[Return] ${resp}
+RUN OOF-Homing SendPlanWithWrongVersion
+ [Documentation] It sends a POST request to conductor
+ ${session}= Create Session optf-cond ${OOF_HOMING_ENDPOINT}
+ ${data}= Get Binary File ${OOF_HOMING_PLAN_FOLDER}${/}plan_with_wrong_version.json
+ &{headers}= Create Dictionary Authorization=${OOF_HOMING_Auth} Content-Type=application/json Accept=application/json
+ ${resp}= Post Request optf-cond /v1/plans data=${data} headers=${headers}
+ Log *********************
+ Log response = ${resp}
+ Log body = ${resp.text}
+ ${response_json} json5.Loads ${resp.content}
+ ${generatedPlanId}= Convert To String ${response_json['id']}
+ Set Global Variable ${generatedPlanId}
+ Log generatedPlanId = ${generatedPlanId}
+ Should Be Equal As Integers ${resp.status_code} 201
+ Sleep 10s Wait Plan Resolution
+
Run OOF-SNIRO Health Check
[Documentation] Runs OOF-SNIRO Health check
${resp}= Run OOF-SNIRO Get Request ${OOF_SNIRO_HEALTH_CHECK_PATH}
@@ -143,4 +163,4 @@ OOF-CMSO Json Escape
[Arguments] ${json}
${json_string}= Evaluate json.dumps(${json}) json
${escaped}= Replace String ${json_string} " \\"
- [Return] ${escaped} \ No newline at end of file
+ [Return] ${escaped}
diff --git a/robot/testsuites/oof-has.robot b/robot/testsuites/oof-has.robot
new file mode 100644
index 00000000..f0dd0475
--- /dev/null
+++ b/robot/testsuites/oof-has.robot
@@ -0,0 +1,10 @@
+*** Settings ***
+Documentation Testing OOF-HAS
+...
+... Testing OOF-HAS SEND PLANS
+Resource ../resources/oof_interface.robot
+
+*** Test Cases ***
+Basic OOF-HAS CSIT
+ [Tags] has
+ Run OOF-Homing SendPlanWithWrongVersion
diff --git a/setup.sh b/setup.sh
index e91555e4..cf9b6ed1 100755
--- a/setup.sh
+++ b/setup.sh
@@ -32,6 +32,7 @@ pip install \
'robotframework-httplibrary==0.4.2' \
'robotframework-archivelibrary==0.3.2' \
'PyYAML==3.12' \
+'json5==0.7.0' \
'robotframework-kafkalibrary==0.0.2'
@@ -156,4 +157,4 @@ case $OS in
brew install protobuf ;;
Linux)
apt-get -y install protobuf-compiler
-esac \ No newline at end of file
+esac