--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>cmso-robot</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.python.pydev.PyDevBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.robotframework.ide.eclipse.main.plugin.robotLibrariesBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.robotframework.ide.eclipse.main.plugin.robotNature</nature>
+ <nature>org.python.pydev.pythonNature</nature>
+ </natures>
+</projectDescription>
-FROM ppodgorsek/robot-framework:latest
+FROM robotframework/rfdocker:3.1.1
MAINTAINER "CMSO"
COPY /onap-cmso/server.py /opt/cmso-robot
RUN pip install Flask
-RUN pip install 'PyYAML==3.12'
-RUN pip install 'selenium'
-RUN pip install 'requests'
-RUN pip install 'robotframework-selenium2library'
-RUN pip install 'robotframework-databaselibrary'
-RUN pip install 'robotframework-extendedselenium2library'
-RUN pip install 'robotframework-requests'
-RUN pip install 'robotframework-sshlibrary'
-RUN pip install 'robotframework-sudslibrary'
-RUN pip install 'robotframework-ftplibrary'
-RUN pip install 'robotframework-rammbock'
-RUN pip install 'deepdiff'
-RUN pip install 'dnspython'
-RUN pip install 'robotframework-httplibrary'
-RUN pip install 'robotframework-archivelibrary'
-
-
###Just to keep it running
CMD ["/usr/bin/python", "/opt/cmso-robot/server.py"]
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
-<!--\r
- Copyright © 2017-2018 AT&T Intellectual Property.\r
- Modifications Copyright © 2018 IBM.\r
- \r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
- \r
- http://www.apache.org/licenses/LICENSE-2.0\r
- \r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
- \r
- \r
- Unless otherwise specified, all documentation contained herein is licensed\r
- under the Creative Commons License, Attribution 4.0 Intl. (the "License");\r
- you may not use this documentation except in compliance with the License.\r
- You may obtain a copy of the License at\r
- \r
- https://creativecommons.org/licenses/by/4.0/\r
- \r
- Unless required by applicable law or agreed to in writing, documentation\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
--->\r
-\r
-<projectConfiguration>\r
- <configVersion>1.0</configVersion>\r
- <robotExecEnvironment path="C:\Python27"/>\r
- <relativeTo>PROJECT</relativeTo>\r
- <referencedLibrary type="PYTHON" name="PycURLLibrary" path="cmso-robot/robot/library"/>\r
- <referencedLibrary type="PYTHON" name="RequestsLibrary" path="cmso-robot/robot/library"/>\r
- <referencedLibrary type="PYTHON" name="Selenium2Library" path="cmso-robot/robot/library"/>\r
- <referencedLibrary type="PYTHON" name="selenium" path="cmso-robot/robot/library"/>\r
- <referencedLibrary type="PYTHON" name="SSHLibrary" path="cmso-robot/robot/library"/>\r
- <referencedLibrary type="PYTHON" name="HttpLibrary" path="cmso-robot/robot/library"/>\r
- <referencedLibrary type="PYTHON" name="HttpLibrary.HTTP" path="cmso-robot/robot/library"/>\r
- <referencedLibrary type="PYTHON" name="StringTemplater" path="cmso-robot/robot/locallibrary/cmsoUtils"/>\r
- <referencedLibrary type="PYTHON" name="UUID" path="cmso-robot/robot/locallibrary/cmsoUtils"/>\r
- <referencedLibrary type="PYTHON" name="OSUtils" path="cmso-robot/robot/locallibrary/cmsoUtils"/>\r
- <referencedLibrary type="PYTHON" name="HTTPUtils" path="cmso-robot/robot/locallibrary/cmsoUtils"/>\r
- <referencedLibrary type="PYTHON" name="JSONUtils" path="cmso-robot/robot/locallibrary/cmsoUtils"/>\r
- <pythonpath>\r
- <path location="robot/library"/>\r
- </pythonpath>\r
- <classpath/>\r
- <variableFiles path="cmso-robot/robot/assets/test_properties.py"/>\r
- <excludedForValidation/>\r
- <isValidatedFileSizeCheckingEnabled>true</isValidatedFileSizeCheckingEnabled>\r
- <validatedFileMaxSize>1024</validatedFileMaxSize>\r
- <isReferencedLibrariesAutoReloadEnabled>true</isReferencedLibrariesAutoReloadEnabled>\r
- <isReferencedLibrariesAutoDiscoveringEnabled>true</isReferencedLibrariesAutoDiscoveringEnabled>\r
- <isLibrariesAutoDiscoveringSummaryWindowEnabled>false</isLibrariesAutoDiscoveringSummaryWindowEnabled>\r
-</projectConfiguration>\r
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+ Copyright © 2017-2019 AT&T Intellectual Property.
+ Modifications Copyright © 2018 IBM.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+ Unless otherwise specified, all documentation contained herein is licensed
+ under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ you may not use this documentation except in compliance with the License.
+ You may obtain a copy of the License at
+
+ https://creativecommons.org/licenses/by/4.0/
+
+ Unless required by applicable law or agreed to in writing, documentation
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<projectConfiguration>
+ <configVersion>1</configVersion>
+ <relativeTo>WORKSPACE</relativeTo>
+ <referencedLibrary type="PYTHON" name="RequestsLibrary" path="cmso-robot/library"/>
+ <referencedLibrary type="PYTHON" name="SeleniumLibrary" path="cmso-robot/library"/>
+ <referencedLibrary type="PYTHON" name="selenium" path="cmso-robot/library"/>
+ <referencedLibrary type="PYTHON" name="SSHLibrary" path="cmso-robot/library"/>
+ <referencedLibrary type="PYTHON" name="StringTemplater" path="cmso-robot/robot/locallibrary/cmsoUtils"/>
+ <referencedLibrary type="PYTHON" name="UUID" path="cmso-robot/robot/locallibrary/cmsoUtils"/>
+ <referencedLibrary type="PYTHON" name="OSUtils" path="cmso-robot/robot/locallibrary/cmsoUtils"/>
+ <referencedLibrary type="PYTHON" name="HTTPUtils" path="cmso-robot/robot/locallibrary/cmsoUtils"/>
+ <referencedLibrary type="PYTHON" name="JSONUtils" path="cmso-robot/robot/locallibrary/cmsoUtils"/>
+
+ <pythonpath>
+ <path location="cmso-robot/library"/>
+ </pythonpath>
+ <classpath/>
+ <variableFiles path="cmso-robot/robot/assets/test_properties.py"/>
+
+ <excludedForValidation/>
+ <isValidatedFileSizeCheckingEnabled>true</isValidatedFileSizeCheckingEnabled>
+ <validatedFileMaxSize>1024</validatedFileMaxSize>
+ <isReferencedLibrariesAutoReloadEnabled>true</isReferencedLibrariesAutoReloadEnabled>
+ <isReferencedLibrariesAutoDiscoveringEnabled>true</isReferencedLibrariesAutoDiscoveringEnabled>
+ <isLibrariesAutoDiscoveringSummaryWindowEnabled>false</isLibrariesAutoDiscoveringSummaryWindowEnabled>
+</projectConfiguration>
# Should be provided in Jenkins job
GLOBAL_SCHEDULER_URL = "http://127.0.0.1:8080"
-GLOBAL_SCHEDULER_USER = "onap-user"
-GLOBAL_SCHEDULER_PASSWORD = "pwd"
+GLOBAL_SCHEDULER_USER = "oof@oof.onap.org"
+GLOBAL_SCHEDULER_PASSWORD = "demo123456!"
GLOBAL_CALLBACK_USERID = "onap-user"
GLOBAL_CALLBACK_PASSWORD = "onap-user"
def b64_encode(self, instring):
""
- return base64.b64encode(instring)
+ return base64.b64encode(bytes(instring,encoding='utf8'))
import json
-from deepdiff import DeepDiff
-
class JSONUtils:
"""JSONUtils is common resource for simple json helper keywords."""
- def json_equals(self, left, right):
- """JSON Equals takes in two strings or json objects, converts them into json if needed and then compares them, returning if they are equal or not."""
- if isinstance(left, basestring):
- left_json = json.loads(left);
- else:
- left_json = left;
- if isinstance(right, basestring):
- right_json = json.loads(right);
- else:
- right_json = right;
-
- ddiff = DeepDiff(left_json, right_json, ignore_order=True);
- if ddiff == {}:
- return True;
- else:
- return False;
def json_escape(self, jsonObject):
jsonstr = json.dumps(jsonObject)
outstr = jsonstr.replace('"', '\\"').replace('\n', '\\n')
return outstr
- def make_list_into_dict(self, listOfDicts, key):
- """ Converts a list of dicts that contains a field that has a unique key into a dict of dicts """
- d = {}
- if isinstance(listOfDicts, list):
- for thisDict in listOfDicts:
- v = thisDict[key]
- d[v] = thisDict
- return d
\ No newline at end of file
Library Collections
Library OSUtils
Library OperatingSystem
-Library Selenium2Library
+Library SeleniumLibrary
*** Variables ***
${CHROME_DRIVER_WIN32_PATH} drivers/win32
Documentation Some handy Keywords for accessing log files over SSH. Assumptions are that logs will belong to users other than the currently logged in user and that sudo will be required
Library OperatingSystem
Library SSHLibrary
-Library HttpLibrary.HTTP
Library String
Library Collections
Library String
Library UUID
Library Process
-Library HttpLibrary.HTTP
Documentation Miscellaneous keywords
Resource json_templater.robot
${request_file}= Convert to String OneVnfImmediateATTID.json.template
${attid_file}= OperatingSystem.Get File robot/assets/AOTS_CM_IDs.txt
@{attids}= Split to lines ${attid_file}
- :for ${attid} in @{attids}
+ :for ${attid} IN @{attids}
\ ${uuid}= Generate UUID
\ ${resp}= Run Keyword and Continue on Failure Create Schedule ${uuid} ${request_file} ${template_folder} attid=${attid}
\ Run Keyword and Continue on Failure Should Be Equal as Strings ${resp.status_code} ${expected_status_code}
${url}= Catenate ${GLOBAL_SCHEDULER_URL}
${uuid}= Generate UUID
${proxies}= Create Dictionary no=pass
- ${session}= Create Session ${alias} ${url}
- ${auth_string}= B64 Encode ${GLOBAL_SCHEDULER_USER}:${GLOBAL_SCHEDULER_PASSWORD}
+ ${session}= Create Session ${alias} ${url}
+ ${auth_string}= B64 Encode ${GLOBAL_SCHEDULER_USER}:${GLOBAL_SCHEDULER_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}
${nodelist}= Split String ${NODES} ,
${nn}= Catenate 1
# Support up to 4 ChangeWindows
- : For ${i} in range 1 4
+ : For ${i} IN RANGE 1 4
\ ${today}= Evaluate ((${i}-1)*1440)+${minutesFromNow}
\ ${tomorrow} Evaluate ${today}+1440
\ ${last_time} Evaluate ${today}+30
\ ${end_time}= Get Current Date UTC + ${tomorrow} minutes result_format=${UTC}
\ Set To Dictionary ${map} start_time${i}=${start_time} end_time${i}=${end_time}
- : For ${vnf} in @{nodelist}
+ : For ${vnf} IN @{nodelist}
\ Set To Dictionary ${map} node${nn} ${vnf}
\ ${nn}= Evaluate ${nn}+1
Library OperatingSystem
Library UUID
Library Collections
-Library HttpLibrary.HTTP
Library DateTime
Resource ../scheduler_common.robot
Resource ../json_templater.robot
${uuid_file}= OperatingSystem.Get File ${existing_uuid_file} #this file works with the dev server as of 11/9/2017
@{file_lines}= Split to Lines ${uuid_file}
&{uuid_dictionary}= Create Dictionary
- :For ${line} in @{file_lines}
+ :For ${line} IN @{file_lines}
\ @{line_array}= Split String ${line}
\ log ${line_array[1]}
\ Set To Dictionary ${uuid_dictionary} @{line_array}[0] @{line_array}[1] #You can pass singular list items as scalar variables
\
Log ${uuid_dictionary}
@{resp_list}= Create List
- :For ${uuid} in @{uuid_dictionary.keys()}
+ :For ${uuid} IN @{uuid_dictionary.keys()}
\ ${resp}= Get Change Management auth schedules/${uuid}
\ ${actual_status}= Get from dictionary ${uuid_dictionary} ${uuid}
\ Should be equal as Strings ${actual_status} ${resp.status_code}
[Documentation] Checks the status of the VNFs in a schedule.
[Arguments] ${status} ${uuid}
${resp}= Get Change Management auth schedules/scheduleDetails?request.scheduleId=${uuid}
- : for ${vnf} in @{resp.json()}
+ : for ${vnf} IN @{resp.json()}
\ Dictionary Should Contain Item ${vnf} status Completed
Wait For All VNFs Reach Status and Add to Status
[Documentation] This records the status of the vnf in the global status list
[Arguments] ${status} ${uuid}
${resp}= Get Change Management auth schedules/scheduleDetails?request.scheduleId=${uuid}
- : for ${vnf} in @{resp.json()}
+ : for ${vnf} IN @{resp.json()}
\ Dictionary Should Contain Item ${vnf} status Completed
Add to Status List Completed ${uuid} #This only runs if there are no failures in Dictionary should Contain Item for loop previously
Wait for Schedule to Complete
[Documentation] Takes List and Schedule ID and changes global list of Statuses #A global list was used because Wait for Keyword to Succeed only seems to return pass or fail
[Arguments] ${end_status} ${uuid}
${resp}= Get Change Management auth schedules/${uuid}
- ${json}= Stringify Json ${resp.json()}
- ${status}= Get Json Value ${json} /status
+ ${json}= Set Variable ${resp.json()}
+ ${status}= Get From Dictionary ${json} status
${temp_list}= Catenate ${status_list} ${status},
${temp_list}= Replace String ${temp_list} ${SPACE}" ${EMPTY}"
Set Global Variable ${status_list} ${temp_list}
[Arguments] ${expected} ${actual}
@{expected_list}= Split String ${expected} ,
@{actual_list}= Split String ${actual} ,
- :For ${current} in @{expected_list}
+ :For ${current} IN @{expected_list}
\ Should Contain ${actual_list} ${current}
Change Management DB Failover Template
Wait For All VNFs Reach Status
[Arguments] ${status} ${uuid}
${resp}= Get Change Management auth schedules/scheduleDetails?request.scheduleId=${uuid}
- : for ${vnf} in @{resp.json()}
+ : for ${vnf} IN @{resp.json()}
\ Dictionary Should Contain Item ${vnf} status Completed
Wait for Schedule to Complete
# get the path
path=$(pwd)
-pip install --upgrade pip
-pip install --no-cache-dir --target="$path/robot/library" 'selenium<=3.0.0'
-pip install --no-cache-dir --target="$path/robot/library" 'requests==2.11.1'
-pip install --no-cache-dir --target="$path/robot/library" 'robotframework-selenium2library==1.8.0'
-pip install --no-cache-dir --target="$path/robot/library" 'robotframework-databaselibrary==0.8.1'
-pip install --no-cache-dir --target="$path/robot/library" 'robotframework-extendedselenium2library==0.9.1'
-pip install --no-cache-dir --target="$path/robot/library" 'robotframework-requests==0.4.5'
-pip install --no-cache-dir --target="$path/robot/library" 'robotframework-sshlibrary==2.1.2'
-pip install --no-cache-dir --target="$path/robot/library" 'robotframework-sudslibrary==0.8'
-pip install --no-cache-dir --target="$path/robot/library" 'robotframework-ftplibrary==1.3'
-pip install --no-cache-dir --target="$path/robot/library" 'robotframework-rammbock==0.4.0.1'
-pip install --no-cache-dir --target="$path/robot/library" 'deepdiff==2.5.1'
-pip install --no-cache-dir --target="$path/robot/library" 'dnspython==1.15.0'
-pip install --no-cache-dir --target="$path/robot/library" 'robotframework-httplibrary==0.4.2'
-pip install --no-cache-dir --target="$path/robot/library" 'robotframework-archivelibrary==0.3.2'
-pip install --no-cache-dir --target="$path/robot/library" 'PyYAML==3.12'
-
-# NOTE: Patch to incude explicit install of paramiko to 2.0.2 to work with sshlibrary 2.1.2
-# This should be removed on new release of paramiko (2.1.2) or sshlibrary
-# https://github.com/robotframework/SSHLibrary/issues/157
-pip install --no-cache-dir --target="$path/robot/library" -U 'paramiko==2.0.2'
-
+pip install --no-cache-dir --target="$path/library" \
+ 'robotframework' \
+ 'requests' \
+ 'robotframework-requests' \
+ 'selenium' \
+ 'robotframework-seleniumlibrary' \
+ 'robotframework-sshlibrary' \
+ 'paramiko'
#
# Get the appropriate chromedriver. Default to linux64
#