summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJerry Flood <jflood@att.com>2019-03-28 06:46:34 -0400
committerJerry Flood <jflood@att.com>2019-03-28 06:47:04 -0400
commit8684696712cfe4120092b291cb124accc5712f62 (patch)
tree5333b80f6274917093e588109f148a60e1f1ffb6
parent0b477ebe952a088c278482f2d30b843559266a37 (diff)
Testsuie for Optimizer mS
Issue-ID: OPTFRA-430 Change-Id: I4c9f42517019a5b30dd3ecd744bf8f15c939da58 Signed-off-by: Jerry Flood <jflood@att.com>
-rw-r--r--cmso-robot/robot/assets/templates/OptimizerValidation/EmptyChangeWindows.json37
-rw-r--r--cmso-robot/robot/assets/templates/OptimizerValidation/EmptyElements.json32
-rw-r--r--cmso-robot/robot/assets/templates/OptimizerValidation/InvalidChangeWindow.json41
-rw-r--r--cmso-robot/robot/assets/templates/OptimizerValidation/MissingChangeWindow.json35
-rw-r--r--cmso-robot/robot/assets/templates/OptimizerValidation/MissingConcurrencyLimit.json40
-rw-r--r--cmso-robot/robot/assets/templates/OptimizerValidation/MissingElementId.json40
-rw-r--r--cmso-robot/robot/assets/templates/OptimizerValidation/MissingElements.json30
-rw-r--r--cmso-robot/robot/assets/templates/OptimizerValidation/MissingEndTime.json40
-rw-r--r--cmso-robot/robot/assets/templates/OptimizerValidation/MissingNormalDuration.json40
-rw-r--r--cmso-robot/robot/assets/templates/OptimizerValidation/MissingRequestId.json40
-rw-r--r--cmso-robot/robot/assets/templates/OptimizerValidation/MissingStartTime.json40
-rw-r--r--cmso-robot/robot/assets/test_properties.py5
-rw-r--r--cmso-robot/robot/resources/misc.robot5
-rw-r--r--cmso-robot/robot/resources/optimizer_common.robot59
-rw-r--r--cmso-robot/robot/resources/test_templates/optimizer.robot24
-rw-r--r--cmso-robot/robot/testsuites/OptimizerValidation.robot48
16 files changed, 555 insertions, 1 deletions
diff --git a/cmso-robot/robot/assets/templates/OptimizerValidation/EmptyChangeWindows.json b/cmso-robot/robot/assets/templates/OptimizerValidation/EmptyChangeWindows.json
new file mode 100644
index 0000000..1cb07f1
--- /dev/null
+++ b/cmso-robot/robot/assets/templates/OptimizerValidation/EmptyChangeWindows.json
@@ -0,0 +1,37 @@
+{
+ "requestId": "${uuid}",
+ "concurrencyLimit": 0,
+ "normalDuration": 0,
+ "additionalDuration": 0,
+ "commonData": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ],
+ "changeWindows": [
+ ],
+ "elements": [
+ {
+ "elementId": "string",
+ "elementData": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ]
+ }
+ ],
+ "policies": [
+ {
+ "policyName": "string",
+ "policyDescription": "string",
+ "policyModifiers": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/cmso-robot/robot/assets/templates/OptimizerValidation/EmptyElements.json b/cmso-robot/robot/assets/templates/OptimizerValidation/EmptyElements.json
new file mode 100644
index 0000000..ae0d07f
--- /dev/null
+++ b/cmso-robot/robot/assets/templates/OptimizerValidation/EmptyElements.json
@@ -0,0 +1,32 @@
+{
+ "requestId": "${uuid}",
+ "concurrencyLimit": 0,
+ "normalDuration": 0,
+ "additionalDuration": 0,
+ "commonData": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ],
+ "changeWindows": [
+ {
+ "startTime": "2019-03-27T12:44:37.340Z",
+ "endTime": "2019-03-27T12:44:37.340Z"
+ }
+ ],
+ "elements": [
+ ],
+ "policies": [
+ {
+ "policyName": "string",
+ "policyDescription": "string",
+ "policyModifiers": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/cmso-robot/robot/assets/templates/OptimizerValidation/InvalidChangeWindow.json b/cmso-robot/robot/assets/templates/OptimizerValidation/InvalidChangeWindow.json
new file mode 100644
index 0000000..d85f2c4
--- /dev/null
+++ b/cmso-robot/robot/assets/templates/OptimizerValidation/InvalidChangeWindow.json
@@ -0,0 +1,41 @@
+{
+ "requestId": "${uuid}",
+ "concurrencyLimit": 0,
+ "normalDuration": 0,
+ "additionalDuration": 0,
+ "commonData": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ],
+ "changeWindows": [
+ {
+ "startTime": "2019-03-27T12:44:37.340Z",
+ "endTime": "2019-03-27T12:44:37.340Z"
+ }
+ ],
+ "elements": [
+ {
+ "elementId": "string",
+ "elementData": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ]
+ }
+ ],
+ "policies": [
+ {
+ "policyName": "string",
+ "policyDescription": "string",
+ "policyModifiers": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/cmso-robot/robot/assets/templates/OptimizerValidation/MissingChangeWindow.json b/cmso-robot/robot/assets/templates/OptimizerValidation/MissingChangeWindow.json
new file mode 100644
index 0000000..37611dc
--- /dev/null
+++ b/cmso-robot/robot/assets/templates/OptimizerValidation/MissingChangeWindow.json
@@ -0,0 +1,35 @@
+{
+ "requestId": "${uuid}",
+ "concurrencyLimit": 0,
+ "normalDuration": 0,
+ "additionalDuration": 0,
+ "commonData": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ],
+ "elements": [
+ {
+ "elementId": "string",
+ "elementData": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ]
+ }
+ ],
+ "policies": [
+ {
+ "policyName": "string",
+ "policyDescription": "string",
+ "policyModifiers": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/cmso-robot/robot/assets/templates/OptimizerValidation/MissingConcurrencyLimit.json b/cmso-robot/robot/assets/templates/OptimizerValidation/MissingConcurrencyLimit.json
new file mode 100644
index 0000000..5d6cbca
--- /dev/null
+++ b/cmso-robot/robot/assets/templates/OptimizerValidation/MissingConcurrencyLimit.json
@@ -0,0 +1,40 @@
+{
+ "requestId": "${uuid}",
+ "normalDuration": 0,
+ "additionalDuration": 0,
+ "commonData": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ],
+ "changeWindows": [
+ {
+ "startTime": "2019-03-27T12:44:37.340Z",
+ "endTime": "2019-03-27T12:44:37.340Z"
+ }
+ ],
+ "elements": [
+ {
+ "elementId": "string",
+ "elementData": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ]
+ }
+ ],
+ "policies": [
+ {
+ "policyName": "string",
+ "policyDescription": "string",
+ "policyModifiers": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/cmso-robot/robot/assets/templates/OptimizerValidation/MissingElementId.json b/cmso-robot/robot/assets/templates/OptimizerValidation/MissingElementId.json
new file mode 100644
index 0000000..4397a99
--- /dev/null
+++ b/cmso-robot/robot/assets/templates/OptimizerValidation/MissingElementId.json
@@ -0,0 +1,40 @@
+{
+ "requestId": "${uuid}",
+ "concurrencyLimit": 0,
+ "normalDuration": 0,
+ "additionalDuration": 0,
+ "commonData": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ],
+ "changeWindows": [
+ {
+ "startTime": "2019-03-27T12:44:37.340Z",
+ "endTime": "2019-03-27T12:44:37.340Z"
+ }
+ ],
+ "elements": [
+ {
+ "elementData": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ]
+ }
+ ],
+ "policies": [
+ {
+ "policyName": "string",
+ "policyDescription": "string",
+ "policyModifiers": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/cmso-robot/robot/assets/templates/OptimizerValidation/MissingElements.json b/cmso-robot/robot/assets/templates/OptimizerValidation/MissingElements.json
new file mode 100644
index 0000000..2d1cea9
--- /dev/null
+++ b/cmso-robot/robot/assets/templates/OptimizerValidation/MissingElements.json
@@ -0,0 +1,30 @@
+{
+ "requestId": "${uuid}",
+ "concurrencyLimit": 0,
+ "normalDuration": 0,
+ "additionalDuration": 0,
+ "commonData": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ],
+ "changeWindows": [
+ {
+ "startTime": "2019-03-27T12:44:37.340Z",
+ "endTime": "2019-03-27T12:44:37.340Z"
+ }
+ ],
+ "policies": [
+ {
+ "policyName": "string",
+ "policyDescription": "string",
+ "policyModifiers": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/cmso-robot/robot/assets/templates/OptimizerValidation/MissingEndTime.json b/cmso-robot/robot/assets/templates/OptimizerValidation/MissingEndTime.json
new file mode 100644
index 0000000..8c9d8bb
--- /dev/null
+++ b/cmso-robot/robot/assets/templates/OptimizerValidation/MissingEndTime.json
@@ -0,0 +1,40 @@
+{
+ "requestId": "${uuid}",
+ "concurrencyLimit": 0,
+ "normalDuration": 0,
+ "additionalDuration": 0,
+ "commonData": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ],
+ "changeWindows": [
+ {
+ "startTime": "2019-03-27T12:44:37.340Z"
+ }
+ ],
+ "elements": [
+ {
+ "elementId": "string",
+ "elementData": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ]
+ }
+ ],
+ "policies": [
+ {
+ "policyName": "string",
+ "policyDescription": "string",
+ "policyModifiers": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/cmso-robot/robot/assets/templates/OptimizerValidation/MissingNormalDuration.json b/cmso-robot/robot/assets/templates/OptimizerValidation/MissingNormalDuration.json
new file mode 100644
index 0000000..97152af
--- /dev/null
+++ b/cmso-robot/robot/assets/templates/OptimizerValidation/MissingNormalDuration.json
@@ -0,0 +1,40 @@
+{
+ "requestId": "${uuid}",
+ "concurrencyLimit": 0,
+ "additionalDuration": 0,
+ "commonData": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ],
+ "changeWindows": [
+ {
+ "startTime": "2019-03-27T12:44:37.340Z",
+ "endTime": "2019-03-27T12:44:37.340Z"
+ }
+ ],
+ "elements": [
+ {
+ "elementId": "string",
+ "elementData": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ]
+ }
+ ],
+ "policies": [
+ {
+ "policyName": "string",
+ "policyDescription": "string",
+ "policyModifiers": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/cmso-robot/robot/assets/templates/OptimizerValidation/MissingRequestId.json b/cmso-robot/robot/assets/templates/OptimizerValidation/MissingRequestId.json
new file mode 100644
index 0000000..388c437
--- /dev/null
+++ b/cmso-robot/robot/assets/templates/OptimizerValidation/MissingRequestId.json
@@ -0,0 +1,40 @@
+{
+ "concurrencyLimit": 0,
+ "normalDuration": 0,
+ "additionalDuration": 0,
+ "commonData": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ],
+ "changeWindows": [
+ {
+ "startTime": "2019-03-27T12:44:37.340Z",
+ "endTime": "2019-03-28T12:44:37.340Z"
+ }
+ ],
+ "elements": [
+ {
+ "elementId": "string",
+ "elementData": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ]
+ }
+ ],
+ "policies": [
+ {
+ "policyName": "string",
+ "policyDescription": "string",
+ "policyModifiers": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/cmso-robot/robot/assets/templates/OptimizerValidation/MissingStartTime.json b/cmso-robot/robot/assets/templates/OptimizerValidation/MissingStartTime.json
new file mode 100644
index 0000000..d59aa32
--- /dev/null
+++ b/cmso-robot/robot/assets/templates/OptimizerValidation/MissingStartTime.json
@@ -0,0 +1,40 @@
+{
+ "requestId": "${uuid}",
+ "concurrencyLimit": 0,
+ "normalDuration": 0,
+ "additionalDuration": 0,
+ "commonData": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ],
+ "changeWindows": [
+ {
+ "endTime": "2019-03-27T12:44:37.340Z"
+ }
+ ],
+ "elements": [
+ {
+ "elementId": "string",
+ "elementData": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ]
+ }
+ ],
+ "policies": [
+ {
+ "policyName": "string",
+ "policyDescription": "string",
+ "policyModifiers": [
+ {
+ "name": "string",
+ "value": {}
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/cmso-robot/robot/assets/test_properties.py b/cmso-robot/robot/assets/test_properties.py
index bced8ba..74c5aed 100644
--- a/cmso-robot/robot/assets/test_properties.py
+++ b/cmso-robot/robot/assets/test_properties.py
@@ -7,6 +7,11 @@ GLOBAL_SCHEDULER_URL = "http://127.0.0.1:8080"
GLOBAL_SCHEDULER_USER = "oof@oof.onap.org"
GLOBAL_SCHEDULER_PASSWORD = "demo123456!"
+GLOBAL_OPTIMIZER_URL = "http://127.0.0.1:7997"
+GLOBAL_OPTIMIZER_USER = "oof@oof.onap.org"
+GLOBAL_OPTIMIZER_PASSWORD = "demo123456!"
+
+
GLOBAL_CALLBACK_USERID = "onap-user"
GLOBAL_CALLBACK_PASSWORD = "onap-user"
diff --git a/cmso-robot/robot/resources/misc.robot b/cmso-robot/robot/resources/misc.robot
index d782400..0dd15e9 100644
--- a/cmso-robot/robot/resources/misc.robot
+++ b/cmso-robot/robot/resources/misc.robot
@@ -22,9 +22,12 @@ Validate Status
Validate JSON Error
[Documentation] Fails if messageIds do not match. expected_errors should be a list but a string would likely work as well
- [Arguments] ${resp_json} ${expected_errors}
+ [Arguments] ${resp_json} ${expected_errors} ${listVars}
${result}= Get From Dictionary ${resp_json['requestError']} messageId
+ ${variables}= Get From Dictionary ${resp_json['requestError']} variables
Should Contain ${expected_errors} ${result} #checks expected_errors list for the actual error received from schedule
+ :for ${var} IN @{listVars}
+ \ Should Contain ${variables} ${var}
Check ATTIDs Template
[Documentation] This just checks a list of uuids
diff --git a/cmso-robot/robot/resources/optimizer_common.robot b/cmso-robot/robot/resources/optimizer_common.robot
new file mode 100644
index 0000000..81c0c75
--- /dev/null
+++ b/cmso-robot/robot/resources/optimizer_common.robot
@@ -0,0 +1,59 @@
+*** Settings ***
+Documentation The private interface for interacting with Openstack. It handles low level stuff like managing the authtoken and Openstack required fields
+
+Library Collections
+Library RequestsLibrary
+Library UUID
+Library HTTPUtils
+Library String
+Resource misc.robot
+*** Variables ***
+*** Variables ***
+${OPTIMIZER_PATH} /optimizer/v1
+${valid_status_codes} 200 202 400 404 204 409
+#**************** Test Case Variables ******************
+
+*** Keywords ***
+
+
+Post Optimizer
+ [Documentation] Runs a scheduler POST request
+ [Arguments] ${alias} ${resource} ${data}={}
+ ${data_path}= Catenate ${OPTIMIZER_PATH}/${resource}
+ ${url}= Catenate ${GLOBAL_OPTIMIZER_URL}
+ ${uuid}= Generate UUID
+ ${proxies}= Create Dictionary no=pass
+ ${session}= Create Session ${alias} ${url}
+ ${auth_string}= B64 Encode ${GLOBAL_OPTIMIZER_USER}:${GLOBAL_OPTIMIZER_PASSWORD}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} Authorization=Basic ${auth_string}
+ ${resp}= Post Request ${alias} ${data_path} headers=${headers} data=${data}
+ Log Received response from scheduler ${resp.text}
+ [Return] ${resp}
+
+Delete Optimizer
+ [Documentation] Runs a scheduler DELETE request (this may need to be changed for 1802 US change Delete schedule to Cancel Schedule)
+ [Arguments] ${alias} ${resource}
+ ${data_path}= Catenate ${OPTIMIZER_PATH}/${resource}
+ ${url}= Catenate ${GLOBAL_OPTIMIZER_URL}
+ ${uuid}= Generate UUID
+ ${proxies}= Create Dictionary no=pass
+ ${session}= Create Session ${alias} ${url}
+ ${auth_string}= B64 Encode ${GLOBAL_OPTIMIZER_USER}:${GLOBAL_OPTIMIZER_PASSWORD}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} Authorization=Basic ${auth_string}
+ ${resp}= Delete Request ${alias} ${data_path} headers=${headers}
+ Log Received response from scheduler ${resp.text}
+ [Return] ${resp}
+
+Get Optimizer
+ [Documentation] Runs a scheduler GET request
+ [Arguments] ${alias} ${resource}
+ ${data_path}= Catenate ${OPTIMIZER_PATH}/${resource}
+ ${url}= Catenate ${GLOBAL_OPTIMIZER_URL}
+ ${uuid}= Generate UUID
+ ${proxies}= Create Dictionary no=pass
+ ${session}= Create Session ${alias} ${url}
+ ${auth_string}= B64 Encode ${GLOBAL_OPTIMIZER_USER}:${GLOBAL_OPTIMIZER_PASSWORD}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} Authorization=Basic ${auth_string}
+ ${resp}= Get Request ${alias} ${data_path} headers=${headers}
+ Log Received response from scheduler ${resp.json()}
+ [Return] ${resp}
diff --git a/cmso-robot/robot/resources/test_templates/optimizer.robot b/cmso-robot/robot/resources/test_templates/optimizer.robot
new file mode 100644
index 0000000..9c4d563
--- /dev/null
+++ b/cmso-robot/robot/resources/test_templates/optimizer.robot
@@ -0,0 +1,24 @@
+*** Settings ***
+Documentation Creates VID VNF Instance
+Library StringTemplater
+Library String
+Library OperatingSystem
+Library UUID
+Library Collections
+Library DateTime
+Resource ../optimizer_common.robot
+Resource ../json_templater.robot
+Resource ../files.robot
+*** Variables ****
+
+
+*** Keywords ***
+Optimizer Validation Template
+ [Arguments] ${template_folder} ${request_file} ${expected_status_code} ${expected_message} ${variables}=[]
+ ${uuid}= Generate UUID
+ ${map}= Create Dictionary uuid=${uuid}
+ ${data}= Fill JSON Template File ${template_folder}/${request_file} ${map}
+ ${resp}= Post Optimizer alias optimize/schedule ${data}
+ @{listVars}= Evaluate ${variables}
+ Validate JSON Error ${resp.json()} ${expected_Message} ${listVars}
+
diff --git a/cmso-robot/robot/testsuites/OptimizerValidation.robot b/cmso-robot/robot/testsuites/OptimizerValidation.robot
new file mode 100644
index 0000000..f676ce7
--- /dev/null
+++ b/cmso-robot/robot/testsuites/OptimizerValidation.robot
@@ -0,0 +1,48 @@
+*** Settings ***
+Documentation Creates VID VNF Instance
+
+Library StringTemplater
+Library UUID
+Library OperatingSystem
+Resource ../resources/test_templates/optimizer.robot
+
+# Test Setup
+Test Template Optimizer Validation Template
+# Test Teardown
+*** Variable ***
+${status_code_variable}= 400
+${template_folder}= robot/assets/templates/OptimizerValidation
+*** Test Cases ***
+
+Missing RequestId ${template_folder} MissingRequestId.json 400 CMSO.MISSING_REQUIRED_ATTRIBUTE ["requestId"]
+ [Tags] opt_validation
+
+Missing ConcurrencyLimit ${template_folder} MissingConcurrencyLimit.json 400 CMSO.MISSING_REQUIRED_ATTRIBUTE ["concurrencyLimit"]
+ [Tags] opt_validation
+
+Missing NormalDuration ${template_folder} MissingNormalDuration.json 400 CMSO.MISSING_REQUIRED_ATTRIBUTE ["normalDuration"]
+ [Tags] opt_validation
+
+Missing ChangeWindow ${template_folder} MissingChangeWindow.json 400 CMSO.MISSING_REQUIRED_ATTRIBUTE ["changeWindows"]
+ [Tags] opt_validation
+
+Empty ChangeWindows ${template_folder} EmptyChangeWindows.json 400 CMSO.MISSING_REQUIRED_ATTRIBUTE ["changeWindows"]
+ [Tags] opt_validation
+
+Missing Elements ${template_folder} MissingElements.json 400 CMSO.MISSING_REQUIRED_ATTRIBUTE ["elements"]
+ [Tags] opt_validation
+
+Empty Elements ${template_folder} EmptyElements.json 400 CMSO.MISSING_REQUIRED_ATTRIBUTE ["elements"]
+ [Tags] opt_validation
+
+Missing ElementId ${template_folder} MissingElementId.json 400 CMSO.MISSING_REQUIRED_ATTRIBUTE ["elementId"]
+ [Tags] opt_validation
+
+Missing StartTime ${template_folder} MissingStartTime.json 400 CMSO.MISSING_REQUIRED_ATTRIBUTE ["startTime"]
+ [Tags] opt_validation
+
+Missing EndTime ${template_folder} MissingEndTime.json 400 CMSO.MISSING_REQUIRED_ATTRIBUTE ["endTime"]
+ [Tags] opt_validation
+
+Invalid Change Window ${template_folder} InvalidChangeWindow.json 400 CMSO.INVALID_CHANGE_WINDOW
+ [Tags] opt_validation