diff options
Diffstat (limited to 'cmso-robot')
-rw-r--r-- | cmso-robot/docker/Dockerfile | 2 | ||||
-rw-r--r-- | cmso-robot/docker/assembly/cmso-files.xml | 7 | ||||
-rwxr-xr-x | cmso-robot/ete.sh | 15 | ||||
-rwxr-xr-x | cmso-robot/mocking/mock.py | 100 | ||||
-rw-r--r-- | cmso-robot/robot/testsuites/ChangeManagementCancel.robot | 2 | ||||
-rw-r--r-- | cmso-robot/robot/testsuites/ChangeManagementDBFailover.robot | 2 | ||||
-rw-r--r-- | cmso-robot/robot/testsuites/ChangeManagementFailure.robot | 2 | ||||
-rw-r--r-- | cmso-robot/robot/testsuites/ChangeManagementFuture.robot | 2 | ||||
-rw-r--r-- | cmso-robot/robot/testsuites/ChangeManagementImmediate.robot | 2 | ||||
-rw-r--r-- | cmso-robot/robot/testsuites/ChangeManagementImmediateFailure.robot | 2 | ||||
-rw-r--r-- | cmso-robot/robot/testsuites/ChangeManagementRejection.robot | 2 | ||||
-rw-r--r-- | cmso-robot/robot/testsuites/CheckLog.robot | 2 | ||||
-rw-r--r-- | cmso-robot/robot/testsuites/CheckScheduleStatus.robot | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | cmso-robot/robot/testsuites/MiscTests.robot | 149 | ||||
-rwxr-xr-x[-rw-r--r--] | cmso-robot/setup.sh | 0 |
15 files changed, 219 insertions, 72 deletions
diff --git a/cmso-robot/docker/Dockerfile b/cmso-robot/docker/Dockerfile index aa41520..91630a9 100644 --- a/cmso-robot/docker/Dockerfile +++ b/cmso-robot/docker/Dockerfile @@ -27,6 +27,7 @@ RUN apt-get update \ COPY /onap-cmso/robot /opt/cmso-robot/robot +COPY /onap-cmso/mocking /opt/cmso-robot/mocking COPY /onap-cmso/ete.sh /opt/cmso-robot RUN chmod 777 /opt/cmso-robot/ete.sh @@ -40,6 +41,7 @@ RUN pip --version RUN pip install robotframework==3.1.1 RUN pip install Flask +RUN pip install requests RUN pip install selenium RUN pip install robotframework-sshlibrary RUN pip install robotframework-requests diff --git a/cmso-robot/docker/assembly/cmso-files.xml b/cmso-robot/docker/assembly/cmso-files.xml index cb61e5a..4865639 100644 --- a/cmso-robot/docker/assembly/cmso-files.xml +++ b/cmso-robot/docker/assembly/cmso-files.xml @@ -35,6 +35,13 @@ </fileSet> <fileSet> <includes> + <include>**</include> + </includes> + <directory>${project.basedir}/mocking</directory> + <outputDirectory>/mocking</outputDirectory> + </fileSet> + <fileSet> + <includes> <include>ete.sh</include> <include>server.py</include> </includes> diff --git a/cmso-robot/ete.sh b/cmso-robot/ete.sh index 107c661..dbd058f 100755 --- a/cmso-robot/ete.sh +++ b/cmso-robot/ete.sh @@ -1,17 +1,30 @@ #!/bin/bash # + ROBOT_CMD="python -m robot.run" ROBOT_HOME=`pwd` -ROBOT_PATH=${ROBOT_PATH}:${ROBOT_HOME}/robot/library +ROBOT_PATH=${ROBOT_PATH}:${ROBOT_HOME}/library ROBOT_PATH=${ROBOT_PATH}:${ROBOT_HOME}/robot/locallibrary/cmsoUtils VARIABLE_FILES="${VARIABLE_FILES} -V ${ROBOT_HOME}/robot/assets/test_properties.py" VARIABLES="${VARIABLES} -v GLOBAL_SCHEDULER_URL:${GLOBAL_SCHEDULER_URL}" VARIABLES="${VARIABLES} -v GLOBAL_OPTIMIZER_URL:${GLOBAL_OPTIMIZER_URL}" +VARIABLES="${VARIABLES} -v GLOBAL_TICKET_MGT_URL:${GLOBAL_TICKET_MGT_URL}" +VARIABLES="${VARIABLES} -v GLOBAL_TOPOLOGY_URL:${GLOBAL_TOPOLOGY_URL}" VARIABLES="${VARIABLES} -v CMSO_STARTUP_WAIT_TIME:${CMSO_STARTUP_WAIT_TIME}" HTTP_PROXY= HTTPS_PROXY= +export PYTHONPATH=${ROBOT_PATH}:${PYTHONPATH} +echo PYTHONPATH=${PYTHONPATH} +pgrep -f mock.py +if [ $? == 1 ] +then + nohup python ${ROBOT_HOME}/mocking/mock.py & +fi + + ${ROBOT_CMD} ${OUTPUT} -P ${ROBOT_PATH} ${VARIABLE_FILES} ${VARIABLES} ${TAGS} ${ROBOT_HOME} +pkill -f mock.py
\ No newline at end of file diff --git a/cmso-robot/mocking/mock.py b/cmso-robot/mocking/mock.py new file mode 100755 index 0000000..2cb8c3c --- /dev/null +++ b/cmso-robot/mocking/mock.py @@ -0,0 +1,100 @@ +from flask import Flask
+from flask import request
+from flask import Response
+from flask import json
+from flask import send_from_directory
+import requests
+from threading import Thread
+import time
+
+import os
+import fnmatch
+import re
+import time
+import datetime
+
+app = Flask(__name__)
+ROOT_MOCK_DIR = os.path.dirname(os.path.abspath(__file__))
+DATA_DIR = os.path.join(ROOT_MOCK_DIR, "data")
+global requestNum
+requestNum = 1
+
+########################################################################
+########################################################################
+@app.route('/onap/so/infra/orchestrationRequests/v7/schedule/<VNFNAME>', methods=['GET', 'POST'])
+def soSchedule(VNFNAME):
+ if request.method == 'POST':
+ testid = request.headers.environ["HTTP_X_TRANSACTIONID"]
+ response = {
+ "status" : "202",
+ "entity" : {
+ "requestReferences" : {
+ "requestId" : "000001"
+ }
+ }
+ }
+ resp = Response(json.dumps(response), 200, mimetype='application/json')
+ return resp
+
+
+ else :
+ return "Helloooooo!!!!"
+
+########################################################################
+########################################################################
+@app.route('/onap/so/infra/orchestrationRequests/v7/<REQUESTID>', methods=['GET'])
+def soStatus(REQUESTID):
+ response = {"request" : { "requestStatus" : {
+ "requestState" : "COMPLETE",
+ "statusMessage" : "Done.",
+ "percentProgress" : 100,
+ "finishTime" : ""
+ }}}
+ now = datetime.datetime.utcnow()
+ #response["finishTime"] = now.strftime("%Y-%m-%dT%H:%M:%SZ")
+ response["request"]["requestStatus"]["finishTime"] = now.strftime("%a, %d %b %Y %H:%M:%S GMT")
+ resp = Response(json.dumps(response), 200, mimetype='application/json')
+
+ return resp
+
+
+########################################################################
+########################################################################
+@app.route('/optimizer/v1/optimize/schedule', methods=['POST'])
+def optimizePost():
+ response = {}
+ resp = Response(json.dumps(response), 200, mimetype='application/json')
+ return resp
+
+
+########################################################################
+########################################################################
+@app.route('/optimizer/v1/optimize/schedule/<ID>', methods=['GET'])
+def optimizeGet(ID):
+ response = {}
+ resp = Response(json.dumps(response), 200, mimetype='application/json')
+
+ return resp
+
+########################################################################
+########################################################################
+@app.route('/optimizer/v1/optimize/schedule/<ID>', methods=['DELETE'])
+def optimizeDelete(ID):
+ response = {}
+ resp = Response(json.dumps(response), 200, mimetype='application/json')
+ return resp
+
+########################################################################
+########################################################################
+@app.route('/optimizer/v1/policies', methods=['GET'])
+def getPolicies():
+ reponse = []
+ resp = Response(json.dumps(response), 200, mimetype='application/json')
+
+ return resp
+
+########################################################################
+########################################################################
+if __name__ == "__main__":
+ app.run(host= '0.0.0.0',port=5000)
+ #app.run()
\ No newline at end of file diff --git a/cmso-robot/robot/testsuites/ChangeManagementCancel.robot b/cmso-robot/robot/testsuites/ChangeManagementCancel.robot index ad193f6..30ad8c0 100644 --- a/cmso-robot/robot/testsuites/ChangeManagementCancel.robot +++ b/cmso-robot/robot/testsuites/ChangeManagementCancel.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Creates VID VNF Instance +Documentation Verify CMSO schedule cancel. Library StringTemplater Library UUID diff --git a/cmso-robot/robot/testsuites/ChangeManagementDBFailover.robot b/cmso-robot/robot/testsuites/ChangeManagementDBFailover.robot index a951145..81268e1 100644 --- a/cmso-robot/robot/testsuites/ChangeManagementDBFailover.robot +++ b/cmso-robot/robot/testsuites/ChangeManagementDBFailover.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Creates VID VNF Instance +Documentation Test specialized DB failover scenarios (not part of ete) Library StringTemplater Library UUID diff --git a/cmso-robot/robot/testsuites/ChangeManagementFailure.robot b/cmso-robot/robot/testsuites/ChangeManagementFailure.robot index 5e74105..14d96fa 100644 --- a/cmso-robot/robot/testsuites/ChangeManagementFailure.robot +++ b/cmso-robot/robot/testsuites/ChangeManagementFailure.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Creates VID VNF Instance +Documentation Change Management Validation Testing Library StringTemplater Library UUID diff --git a/cmso-robot/robot/testsuites/ChangeManagementFuture.robot b/cmso-robot/robot/testsuites/ChangeManagementFuture.robot index 5dad749..8218233 100644 --- a/cmso-robot/robot/testsuites/ChangeManagementFuture.robot +++ b/cmso-robot/robot/testsuites/ChangeManagementFuture.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Creates VID VNF Instance +Documentation Verifies ETE Scheduling for future requests Library StringTemplater Library UUID diff --git a/cmso-robot/robot/testsuites/ChangeManagementImmediate.robot b/cmso-robot/robot/testsuites/ChangeManagementImmediate.robot index f7e399a..761deb7 100644 --- a/cmso-robot/robot/testsuites/ChangeManagementImmediate.robot +++ b/cmso-robot/robot/testsuites/ChangeManagementImmediate.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Creates VID VNF Instance +Documentation Verifies ETE Scheduling for immediate requests Library StringTemplater Library UUID diff --git a/cmso-robot/robot/testsuites/ChangeManagementImmediateFailure.robot b/cmso-robot/robot/testsuites/ChangeManagementImmediateFailure.robot index 74f1959..a2de1a9 100644 --- a/cmso-robot/robot/testsuites/ChangeManagementImmediateFailure.robot +++ b/cmso-robot/robot/testsuites/ChangeManagementImmediateFailure.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Creates VID VNF Instance +Documentation Verifies immediate request failures Library StringTemplater Library UUID diff --git a/cmso-robot/robot/testsuites/ChangeManagementRejection.robot b/cmso-robot/robot/testsuites/ChangeManagementRejection.robot index ea63ac8..e00fe99 100644 --- a/cmso-robot/robot/testsuites/ChangeManagementRejection.robot +++ b/cmso-robot/robot/testsuites/ChangeManagementRejection.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Creates VID VNF Instance +Documentation Verifies rejection of optimized schedules Library StringTemplater Library UUID diff --git a/cmso-robot/robot/testsuites/CheckLog.robot b/cmso-robot/robot/testsuites/CheckLog.robot index 13d7b1c..d1d1304 100644 --- a/cmso-robot/robot/testsuites/CheckLog.robot +++ b/cmso-robot/robot/testsuites/CheckLog.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Creates VID VNF Instance +Documentation Verifies log output (Not part of ETE) Library StringTemplater Library UUID diff --git a/cmso-robot/robot/testsuites/CheckScheduleStatus.robot b/cmso-robot/robot/testsuites/CheckScheduleStatus.robot index 2f96ecb..6ee3c65 100644 --- a/cmso-robot/robot/testsuites/CheckScheduleStatus.robot +++ b/cmso-robot/robot/testsuites/CheckScheduleStatus.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Creates VID VNF Instance +Documentation Verifies scheduler queries Library StringTemplater Library UUID diff --git a/cmso-robot/robot/testsuites/MiscTests.robot b/cmso-robot/robot/testsuites/MiscTests.robot index a3b9428..12da302 100644..100755 --- a/cmso-robot/robot/testsuites/MiscTests.robot +++ b/cmso-robot/robot/testsuites/MiscTests.robot @@ -1,62 +1,87 @@ -*** Settings *** -Documentation Creates VID VNF Instance - -Library StringTemplater -Library UUID -Library Collections - -Resource ../resources/optimizer_common.robot -Resource ../resources/scheduler_common.robot -Resource ../resources/ticketmgt_common.robot -Resource ../resources/topology_common.robot - -# Test Setup -# Test Teardown -*** Variable*** -${user_name}= -${password}= -${uuid_list_file}= robot/assets/get_schedule_UUIDs.txt -${template_folder}= robot/assets/templates/changemanagement -*** Test Cases *** -Test CMSO Optimizer Admin - [Tags] ete - ${response}= Get Optimizer Plain Text alias admin/password - Should Contain ${response.text} kECFDaLusYNHTN6Q4DmsYw== - -Test CMSO Service Admin - [Tags] ete - ${response}= Get Scheduler Plain Text alias /cmso/v1/admin/password - Should Contain ${response.text} kECFDaLusYNHTN6Q4DmsYw== - -Test CMSO Ticket Mgt Admin - [Tags] ete - ${response}= Get Ticket Mgt Plain Text alias admin/password - Should Contain ${response.text} kECFDaLusYNHTN6Q4DmsYw== - -Test CMSO Topology Admin - [Tags] ete - ${response}= Get Topology Plain Text alias admin/password - Should Contain ${response.text} kECFDaLusYNHTN6Q4DmsYw== - -Test CMSO Optimizer Health - [Tags] ete - ${response}= Get Optimizer alias health - Dictionary Should Contain Item ${response.json()} healthy True - -Test CMSO Service Health - [Tags] ete - ${response}= Get Scheduler alias /cmso/v1/health - Dictionary Should Contain Item ${response.json()} healthy True - - -Test CMSO Ticket Mgt Health - [Tags] ete - ${response}= Get Ticket Mgt alias health - Dictionary Should Contain Item ${response.json()} healthy True - - -Test CMSO Topology Health - [Tags] ete - ${response}= Get Topology alias health - Dictionary Should Contain Item ${response.json()} healthy True - +*** Settings ***
+Documentation Creates VID VNF Instance
+
+Library StringTemplater
+Library UUID
+Library Collections
+
+Resource ../resources/optimizer_common.robot
+Resource ../resources/scheduler_common.robot
+Resource ../resources/ticketmgt_common.robot
+Resource ../resources/topology_common.robot
+
+# Test Setup
+# Test Teardown
+*** Variable***
+${user_name}=
+${password}=
+${uuid_list_file}= robot/assets/get_schedule_UUIDs.txt
+${template_folder}= robot/assets/templates/changemanagement
+*** Test Cases ***
+Test CMSO Optimizer Admin
+ [Tags] ete
+ ${response}= Get Optimizer Plain Text alias admin/password
+ Should Contain ${response.text} kECFDaLusYNHTN6Q4DmsYw==
+
+Test CMSO Service Admin
+ [Tags] ete
+ ${response}= Get Scheduler Plain Text alias /cmso/v1/admin/password
+ Should Contain ${response.text} kECFDaLusYNHTN6Q4DmsYw==
+
+Test CMSO Ticket Mgt Admin
+ [Tags] ete
+ ${response}= Get Ticket Mgt Plain Text alias admin/password
+ Should Contain ${response.text} kECFDaLusYNHTN6Q4DmsYw==
+
+Test CMSO Topology Admin
+ [Tags] ete
+ ${response}= Get Topology Plain Text alias admin/password
+ Should Contain ${response.text} kECFDaLusYNHTN6Q4DmsYw==
+
+Test CMSO Optimizer Health
+ [Tags] ete
+ ${response}= Get Optimizer alias health
+ Dictionary Should Contain Item ${response.json()} healthy True
+
+Test CMSO Service Health
+ [Tags] ete
+ ${response}= Get Scheduler alias /cmso/v1/health
+ Dictionary Should Contain Item ${response.json()} healthy True
+
+
+Test CMSO Ticket Mgt Health
+ [Tags] ete
+ ${response}= Get Ticket Mgt alias health
+ Dictionary Should Contain Item ${response.json()} healthy True
+
+
+Test CMSO Topology Health
+ [Tags] ete
+ ${response}= Get Topology alias health
+ Dictionary Should Contain Item ${response.json()} healthy True
+
+Test CMSO Optimizer Policies
+ [Tags] ete
+ ${response}= Get Optimizer alias policies
+ ##Should Contain ${response.json()} kECFDaLusYNHTN6Q4DmsYw==
+
+Test CMSO Optimizer Get Schedule
+ [Tags] ete
+ ${response}= Get Optimizer alias optimize/schedule/id1
+ ##Should Contain ${response.json()} kECFDaLusYNHTN6Q4DmsYw==
+
+Test CMSO Optimizer Delete Schedule
+ [Tags] ete
+ ${response}= Delete Optimizer alias optimize/schedule/id1
+ ##Should Contain ${response.json()} kECFDaLusYNHTN6Q4DmsYw==
+
+
+Test CMSO Ticket Mgt Get Tickets
+ [Tags] ete
+ ${response}= Get Ticket Mgt alias tickets
+ ##Dictionary Should Contain Item ${response.json()} healthy True
+
+Test CMSO Ticket Mgt Get Ticket
+ [Tags] ete
+ ${response}= Get Ticket Mgt alias ticket/none
+ ##Dictionary Should Contain Item ${response.json()} healthy True
diff --git a/cmso-robot/setup.sh b/cmso-robot/setup.sh index ae15e62..ae15e62 100644..100755 --- a/cmso-robot/setup.sh +++ b/cmso-robot/setup.sh |