summaryrefslogtreecommitdiffstats
path: root/robot
diff options
context:
space:
mode:
authorJerry Flood <jflood@att.com>2019-04-09 18:34:22 -0400
committerJerry Flood <jflood@att.com>2019-04-09 18:34:50 -0400
commit124bd57e9cf4efab66335848fb989f43aafb4167 (patch)
treea89d76e09a81be040cdab9e1be3daf58a1a10140 /robot
parent288abb6262d005090ab3288f44e97cc728230e02 (diff)
Added CSIT test case for CMSO Dublin
Issue-ID: OPTFRA-473 Change-Id: Ib2bc8f73083b4320ad46109b52b4ec5131d4aebe Signed-off-by: Jerry Flood <jflood@att.com>
Diffstat (limited to 'robot')
-rw-r--r--robot/assets/templates/cmso/OneVnfOneChangeWindow.json.template30
-rw-r--r--robot/assets/templates/cmso/VidCallbackData.json.template36
-rw-r--r--robot/resources/oof_interface.robot93
-rw-r--r--robot/testsuites/oof-cmso.robot10
4 files changed, 166 insertions, 3 deletions
diff --git a/robot/assets/templates/cmso/OneVnfOneChangeWindow.json.template b/robot/assets/templates/cmso/OneVnfOneChangeWindow.json.template
new file mode 100644
index 00000000..158f5919
--- /dev/null
+++ b/robot/assets/templates/cmso/OneVnfOneChangeWindow.json.template
@@ -0,0 +1,30 @@
+{
+ "domain" : "ChangeManagement",
+ "scheduleId" : "${uuid}",
+ "scheduleName" : "${uuid}",
+ "userId" : "${userId}",
+ "domainData" : [{
+ "CallbackUrl" : "${callbackUrl}",
+ "CallbackData" : "${callbackData}",
+ "WorkflowName" : "${workflow}"
+ }
+ ],
+ "schedulingInfo" : {
+ "normalDurationInSeconds" : 3600,
+ "additionalDurationInSeconds" : 0,
+ "concurrencyLimit" : 10,
+ "policyId" : "AllDayEveryDay",
+ "vnfDetails" : [{
+ "groupId" : "group",
+ "node" : [
+ "${node1}"
+ ],
+ "changeWindow" : [{
+ "startTime" : "${start_time1}",
+ "endTime" : "${end_time1}"
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/robot/assets/templates/cmso/VidCallbackData.json.template b/robot/assets/templates/cmso/VidCallbackData.json.template
new file mode 100644
index 00000000..9abf9b9b
--- /dev/null
+++ b/robot/assets/templates/cmso/VidCallbackData.json.template
@@ -0,0 +1,36 @@
+{
+ "vnfName" : "${vnfName}",
+ "vnfInstanceId" : "dummy-vnfinstance-id",
+ "modelInfo" : {
+ "modelType" : "vnf",
+ "modelInvariantId" : "dummy-id",
+ "modelVersionId" : "dummy-id",
+ "modelName" : "dummy",
+ "modelCustomizationId" : "dummy-id"
+ },
+ "cloudConfiguration" : {
+ "lcpCloudRegionId" : "dummy",
+ "tenantId" : "dummy-id"
+ },
+ "requestInfo" : {
+ "source" : "VID",
+ "suppressRollback" : false,
+ "requestorId" : "az2016"
+ },
+ "relatedInstanceList" : [{
+ "relatedInstance" : {
+ "instanceId" : "dummy-id",
+ "modelInfo" : {
+ "modelType" : "service",
+ "modelInvariantId" : "dummy-id",
+ "modelVersionId" : "dummy-id",
+ "modelName" : "dummy-id",
+ "modelVersion" : "4.0"
+ }
+ }
+ }
+ ],
+ "requestParameters" : {
+ "usePreload" : true
+ }
+}
diff --git a/robot/resources/oof_interface.robot b/robot/resources/oof_interface.robot
index 02b81776..24a23459 100644
--- a/robot/resources/oof_interface.robot
+++ b/robot/resources/oof_interface.robot
@@ -1,13 +1,21 @@
*** Settings ***
Documentation The main interface for interacting with OOF: SNIRO and Homing Service
Library RequestsLibrary
-
+Library UUID
+Library String
+Library DateTime
+Library Collections
+Library JSONUtils
Resource global_properties.robot
+Resource json_templater.robot
*** Variables ***
${OOF_HOMING_HEALTH_CHECK_PATH} /v1/plans/healthcheck
${OOF_SNIRO_HEALTH_CHECK_PATH} /api/oof/v1/healthcheck
-${OOF_CMSO_HEALTH_CHECK_PATH} /cmso/v1/health?checkInterfaces=false
+${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_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}
@@ -27,7 +35,7 @@ Run OOF-Homing Get Request
Should Be Equal As Integers ${resp.status_code} 200
Log Received response from OOF-Homing ${resp.text}
[Return] ${resp}
-
+
Run OOF-SNIRO Health Check
[Documentation] Runs OOF-SNIRO Health check
${resp}= Run OOF-SNIRO Get Request ${OOF_SNIRO_HEALTH_CHECK_PATH}
@@ -57,3 +65,82 @@ Run OOF-CMSO Get Request
Should Be Equal As Integers ${resp.status_code} 200
Log Received response from OOF-CMSO ${resp.text}
[Return] ${resp}
+
+Run OOF-CMSO Post Scheduler
+ [Documentation] Runs a scheduler POST request
+ [Arguments] ${data_path} ${data}={}
+ ${auth}= Create List ${GLOBAL_OOF_CMSO_USERNAME} ${GLOBAL_OOF_CMSO_PASSWORD}
+ ${session}= Create Session session ${OOF_CMSO_ENDPOINT} auth=${auth}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Post Request session ${data_path} headers=${headers} data=${data}
+ Log Received response from scheduler ${resp.text}
+ [Return] ${resp}
+
+Run OOF-CMSO Future Schedule
+ [Documentation] Runs CMSO Future Schedule ETE test. One VNF, One Change Window
+ [Arguments] ${request_file}=OneVnfOneChangeWindow.json.template ${workflow}=Replace ${minutesFromNow}=3
+ ${uuid}= Generate UUID
+ ${resp}= OOF-CMSO Create Schedule ${uuid} ${request_file} workflow=${workflow} minutesFromNow=${minutesFromNow}
+ Should Be Equal as Strings ${resp.status_code} 202
+ Wait Until Keyword Succeeds 600s 30s OOF-CMSO Wait For Pending Approval ${uuid}
+ OOF-CMSO Send Tier2 Approval ${uuid} jf9860 Accepted
+ Wait Until Keyword Succeeds 600s 30s OOF-CMSO Wait for Schedule to Complete Completed ${uuid}
+
+
+OOF-CMSO Create Schedule
+ [Documentation] Creates a CMSO future schedule request for the passed template.
+ [Arguments] ${uuid} ${request_file} ${workflow} ${minutesFromNow}=5
+ ${testid}= Catenate ${uuid}
+ ${testid}= Get Substring ${testid} -4
+ ${dict}= Create Dictionary serviceInstanceId=${uuid} parent_service_model_name=${uuid}
+ ${map}= Create Dictionary uuid=${uuid} callbackUrl=http://localhost:8080 testid=${testid} workflow=${workflow} userId=oof@oof.onap.org
+ ${nodelist}= Create List node1 node2 node3 node4
+ ${nn}= Catenate 1
+ # Support up to 4 ChangeWindows
+ : For ${i} IN RANGE 1 4
+ \ ${today}= Evaluate ((${i}-1)*1440)+${minutesFromNow}
+ \ ${tomorrow} Evaluate ${today}+1440
+ \ ${last_time} Evaluate ${today}+30
+ \ ${start_time}= Get Current Date UTC + ${today} minutes result_format=${OOF_CMSO_UTC}
+ \ ${end_time}= Get Current Date UTC + ${tomorrow} minutes result_format=${OOF_CMSO_UTC}
+ \ Set To Dictionary ${map} start_time${i}=${start_time} end_time${i}=${end_time}
+ ${requestList}= Create List
+ : For ${vnf} IN @{nodelist}
+ \ Set To Dictionary ${map} node${nn} ${vnf}
+ \ ${nn}= Evaluate ${nn}+1
+ \ Set To DIctionary ${dict} vnfName=${vnf}
+ \ ${requestInfo}= Fill JSON Template File ${OOF_CMSO_TEMPLATE_FOLDER}/VidCallbackData.json.template ${dict}
+ \ Append To List ${requestList} ${requestInfo}
+ ${callBackDataMap}= Create Dictionary requestType=Update requestDetails=${requestList}
+ ${callbackDataString}= OOF-CMSO Json Escape ${callbackDataMap}
+ Set To Dictionary ${map} callbackData=${callbackDataString}
+ ${data}= Fill JSON Template File ${OOF_CMSO_TEMPLATE_FOLDER}/${request_file} ${map}
+ ${resp}= Run OOF-CMSO Post Scheduler cmso/v1/schedules/${uuid} data=${data}
+ [Return] ${resp}
+
+
+
+OOF-CMSO Wait For Pending Approval
+ [Documentation] Gets the schedule identified by the uuid and checks if it is in the Pending Approval state
+ [Arguments] ${uuid} ${status}=Pending Approval
+ ${resp}= Run OOF-CMSO Get Request cmso/v1/schedules/${uuid}
+ ${json}= Catenate ${resp.json()}
+ Dictionary Should Contain Item ${resp.json()} status ${status}
+
+OOF-CMSO Send Tier2 Approval
+ [Documentation] Sends an approval post request for the given schedule using the UUID and User given and checks that request worked
+ [Arguments] ${uuid} ${user} ${status}
+ ${approval}= Create Dictionary approvalUserId=${user} approvalType=Tier 2 approvalStatus=${status}
+ ${resp}= Run OOF-CMSO Post Scheduler cmso/v1/schedules/${uuid}/approvals data=${approval}
+ Should Be Equal As Strings ${resp.status_code} 204
+
+OOF-CMSO Wait for Schedule to Complete
+ [Arguments] ${status} ${uuid}
+ ${resp}= Run OOF-CMSO Get Request cmso/v1/schedules/${uuid}
+ Dictionary Should Contain Item ${resp.json()} status Completed
+
+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
diff --git a/robot/testsuites/oof-cmso.robot b/robot/testsuites/oof-cmso.robot
new file mode 100644
index 00000000..98cf63aa
--- /dev/null
+++ b/robot/testsuites/oof-cmso.robot
@@ -0,0 +1,10 @@
+*** Settings ***
+Documentation Testing OOF-CMSO
+...
+... Testing OOF-CMSO Future Schedule ETE
+Resource ../resources/oof_interface.robot
+
+*** Test Cases ***
+Basic OOF-CMSO CSIT
+ [Tags] cmso
+ Run OOF-CMSO Future Schedule \ No newline at end of file