aboutsummaryrefslogtreecommitdiffstats
path: root/cmso-robot/robot
diff options
context:
space:
mode:
authorJerry Flood <jflood@att.com>2019-03-19 17:16:19 -0400
committerJerry Flood <jflood@att.com>2019-03-20 09:02:21 -0400
commit40ca157ce955a0ee4975b0d41bf5807c0f9a3808 (patch)
tree9b38093739b5fe68b8b1353e54340b5710f65388 /cmso-robot/robot
parent536e4cef3b2fd8b0d0c845157ecde717e37c57da (diff)
Upgrade robot to Python37
Issue-ID: OPTFRA-462 Change-Id: I16358fecf3085c395062b019503a5cbb0aed5416 Signed-off-by: Jerry Flood <jflood@att.com>
Diffstat (limited to 'cmso-robot/robot')
-rw-r--r--cmso-robot/robot/assets/test_properties.py4
-rw-r--r--cmso-robot/robot/locallibrary/cmsoUtils/HTTPUtils.py2
-rw-r--r--cmso-robot/robot/locallibrary/cmsoUtils/JSONUtils.py26
-rw-r--r--cmso-robot/robot/resources/browser_setup.robot2
-rw-r--r--cmso-robot/robot/resources/files.robot1
-rw-r--r--cmso-robot/robot/resources/misc.robot3
-rw-r--r--cmso-robot/robot/resources/scheduler_common.robot4
-rw-r--r--cmso-robot/robot/resources/scheduler_requests/create_schedule.robot4
-rw-r--r--cmso-robot/robot/resources/test_templates/change_management.robot15
-rw-r--r--cmso-robot/robot/resources/test_templates/change_management_ete.robot2
10 files changed, 17 insertions, 46 deletions
diff --git a/cmso-robot/robot/assets/test_properties.py b/cmso-robot/robot/assets/test_properties.py
index 9afd43d..bced8ba 100644
--- a/cmso-robot/robot/assets/test_properties.py
+++ b/cmso-robot/robot/assets/test_properties.py
@@ -4,8 +4,8 @@ from os.path import isfile, join
# 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"
diff --git a/cmso-robot/robot/locallibrary/cmsoUtils/HTTPUtils.py b/cmso-robot/robot/locallibrary/cmsoUtils/HTTPUtils.py
index f9d380c..8749af8 100644
--- a/cmso-robot/robot/locallibrary/cmsoUtils/HTTPUtils.py
+++ b/cmso-robot/robot/locallibrary/cmsoUtils/HTTPUtils.py
@@ -17,5 +17,5 @@ class HTTPUtils:
def b64_encode(self, instring):
""
- return base64.b64encode(instring)
+ return base64.b64encode(bytes(instring,encoding='utf8'))
diff --git a/cmso-robot/robot/locallibrary/cmsoUtils/JSONUtils.py b/cmso-robot/robot/locallibrary/cmsoUtils/JSONUtils.py
index 5df1e5c..4daccb3 100644
--- a/cmso-robot/robot/locallibrary/cmsoUtils/JSONUtils.py
+++ b/cmso-robot/robot/locallibrary/cmsoUtils/JSONUtils.py
@@ -1,37 +1,11 @@
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
diff --git a/cmso-robot/robot/resources/browser_setup.robot b/cmso-robot/robot/resources/browser_setup.robot
index 032759e..9361de1 100644
--- a/cmso-robot/robot/resources/browser_setup.robot
+++ b/cmso-robot/robot/resources/browser_setup.robot
@@ -3,7 +3,7 @@ Documentation The main interface for interacting with VID. It handles low le
Library Collections
Library OSUtils
Library OperatingSystem
-Library Selenium2Library
+Library SeleniumLibrary
*** Variables ***
${CHROME_DRIVER_WIN32_PATH} drivers/win32
diff --git a/cmso-robot/robot/resources/files.robot b/cmso-robot/robot/resources/files.robot
index fcfffbb..9ccdd71 100644
--- a/cmso-robot/robot/resources/files.robot
+++ b/cmso-robot/robot/resources/files.robot
@@ -2,7 +2,6 @@
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
diff --git a/cmso-robot/robot/resources/misc.robot b/cmso-robot/robot/resources/misc.robot
index 8409601..d782400 100644
--- a/cmso-robot/robot/resources/misc.robot
+++ b/cmso-robot/robot/resources/misc.robot
@@ -3,7 +3,6 @@ Library Collections
Library String
Library UUID
Library Process
-Library HttpLibrary.HTTP
Documentation Miscellaneous keywords
Resource json_templater.robot
@@ -33,7 +32,7 @@ Check ATTIDs Template
${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}
diff --git a/cmso-robot/robot/resources/scheduler_common.robot b/cmso-robot/robot/resources/scheduler_common.robot
index 0784d71..1256480 100644
--- a/cmso-robot/robot/resources/scheduler_common.robot
+++ b/cmso-robot/robot/resources/scheduler_common.robot
@@ -44,8 +44,8 @@ Post Scheduler
${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}
diff --git a/cmso-robot/robot/resources/scheduler_requests/create_schedule.robot b/cmso-robot/robot/resources/scheduler_requests/create_schedule.robot
index c7b79e7..44443f8 100644
--- a/cmso-robot/robot/resources/scheduler_requests/create_schedule.robot
+++ b/cmso-robot/robot/resources/scheduler_requests/create_schedule.robot
@@ -28,7 +28,7 @@ Create Schedule
${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
@@ -36,7 +36,7 @@ Create Schedule
\ ${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
diff --git a/cmso-robot/robot/resources/test_templates/change_management.robot b/cmso-robot/robot/resources/test_templates/change_management.robot
index 0584cce..6f4167d 100644
--- a/cmso-robot/robot/resources/test_templates/change_management.robot
+++ b/cmso-robot/robot/resources/test_templates/change_management.robot
@@ -5,7 +5,6 @@ Library String
Library OperatingSystem
Library UUID
Library Collections
-Library HttpLibrary.HTTP
Library DateTime
Resource ../scheduler_common.robot
Resource ../json_templater.robot
@@ -103,14 +102,14 @@ Get Schedule Test Template
${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}
@@ -121,13 +120,13 @@ Wait For All VNFs Reach Status
[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
@@ -143,8 +142,8 @@ Add To Status List
[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}
@@ -153,7 +152,7 @@ Compare Status 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
diff --git a/cmso-robot/robot/resources/test_templates/change_management_ete.robot b/cmso-robot/robot/resources/test_templates/change_management_ete.robot
index 74dfdc2..270d546 100644
--- a/cmso-robot/robot/resources/test_templates/change_management_ete.robot
+++ b/cmso-robot/robot/resources/test_templates/change_management_ete.robot
@@ -43,7 +43,7 @@ Change Management Immediate 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