Upgrade robot to Python37 27/82727/4
authorJerry Flood <jflood@att.com>
Tue, 19 Mar 2019 21:16:19 +0000 (17:16 -0400)
committerJerry Flood <jflood@att.com>
Wed, 20 Mar 2019 13:02:21 +0000 (09:02 -0400)
Issue-ID: OPTFRA-462
Change-Id: I16358fecf3085c395062b019503a5cbb0aed5416
Signed-off-by: Jerry Flood <jflood@att.com>
14 files changed:
cmso-robot/.project [new file with mode: 0644]
cmso-robot/docker/Dockerfile
cmso-robot/red.xml
cmso-robot/robot/assets/test_properties.py
cmso-robot/robot/locallibrary/cmsoUtils/HTTPUtils.py
cmso-robot/robot/locallibrary/cmsoUtils/JSONUtils.py
cmso-robot/robot/resources/browser_setup.robot
cmso-robot/robot/resources/files.robot
cmso-robot/robot/resources/misc.robot
cmso-robot/robot/resources/scheduler_common.robot
cmso-robot/robot/resources/scheduler_requests/create_schedule.robot
cmso-robot/robot/resources/test_templates/change_management.robot
cmso-robot/robot/resources/test_templates/change_management_ete.robot
cmso-robot/setup.sh

diff --git a/cmso-robot/.project b/cmso-robot/.project
new file mode 100644 (file)
index 0000000..356fc8a
--- /dev/null
@@ -0,0 +1,23 @@
+<?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>
index 4fd80d0..b70c16b 100644 (file)
@@ -1,4 +1,4 @@
-FROM ppodgorsek/robot-framework:latest
+FROM robotframework/rfdocker:3.1.1
 
 MAINTAINER "CMSO"
 
@@ -12,23 +12,6 @@ RUN chmod 777 /opt/cmso-robot/ete.sh
 
 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"]
index 6d935dd..2936755 100644 (file)
@@ -1,60 +1,57 @@
-<?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>
index 9afd43d..bced8ba 100644 (file)
@@ -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"
index f9d380c..8749af8 100644 (file)
@@ -17,5 +17,5 @@ class HTTPUtils:
     
     def b64_encode(self, instring):
         "" 
-        return base64.b64encode(instring)
+        return base64.b64encode(bytes(instring,encoding='utf8'))
 
index 5df1e5c..4daccb3 100644 (file)
@@ -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
index 032759e..9361de1 100644 (file)
@@ -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
index fcfffbb..9ccdd71 100644 (file)
@@ -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
 
index 8409601..d782400 100644 (file)
@@ -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}
index 0784d71..1256480 100644 (file)
@@ -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}
index c7b79e7..44443f8 100644 (file)
@@ -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     
 
index 0584cce..6f4167d 100644 (file)
@@ -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
index 74dfdc2..270d546 100644 (file)
@@ -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
index 1cbd3f9..fa2cc59 100644 (file)
@@ -6,28 +6,14 @@
 
 # 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
 #