Fix python3 issues in OFP 2 14/90614/4
authorLuis Gomez <ecelgp@gmail.com>
Wed, 24 Jun 2020 01:37:08 +0000 (18:37 -0700)
committerLuis Gomez <ecelgp@gmail.com>
Wed, 24 Jun 2020 03:57:08 +0000 (20:57 -0700)
JIRA: INTTEST-105

Change-Id: I35d00e8a98df9ad1763e9de16da7915d17ef18cd
Signed-off-by: Luis Gomez <ecelgp@gmail.com>
csit/libraries/ClusterManagement.robot
csit/libraries/ClusterOpenFlow.robot
csit/libraries/Common.py
csit/libraries/ScaleClient.py
csit/libraries/Utils.robot
csit/libraries/VsctlListParser.py
csit/suites/openflowplugin/Clustered_Reconciliation/010_Group_Flows.robot
csit/suites/openflowplugin/Inventory_Scalability_OF10/010__restconf_inventory.robot
csit/suites/openflowplugin/Inventory_Scalability_OF10/020__restconf_topology.robot
csit/suites/openflowplugin/Inventory_Scalability_OF13/010__restconf_inventory.robot
csit/suites/openflowplugin/Inventory_Scalability_OF13/020__restconf_topology.robot

index ecf281066830ff41af8b79c0ac8e40e50d9ba99f..2d3150024970a6e71f21038c89fffb2a01e28041 100644 (file)
@@ -239,19 +239,19 @@ Get_Owner_And_Candidates_For_Device_Old
     ...    ELSE IF    '${device_type}' == 'org.opendaylight.mdsal.ServiceEntityType'    Extract_Service_Entity_Type    ${data}
     ...    ELSE    Fail    Not recognized device type: ${device_type}
     ${json} =    RequestsLibrary.To_Json    ${clear_data}
-    ${entity_type_list} =    Collections.Get_From_Dictionary    &{json}[entity-owners]    entity-type
+    ${entity_type_list} =    Collections.Get_From_Dictionary    ${json}[entity-owners]    entity-type
     ${entity_type_index} =    Utils.Get_Index_From_List_Of_Dictionaries    ${entity_type_list}    type    ${entity_type}
     BuiltIn.Should_Not_Be_Equal_As_Integers    ${entity_type_index}    -1    No Entity Owner found for ${device_type}
-    ${entity_list} =    Collections.Get_From_Dictionary    @{entity_type_list}[${entity_type_index}]    entity
+    ${entity_list} =    Collections.Get_From_Dictionary    ${entity_type_list}[${entity_type_index}]    entity
     ${entity_index} =    Utils.Get_Index_From_List_Of_Dictionaries    ${entity_list}    id    ${device_name}
     BuiltIn.Should_Not_Be_Equal_As_Integers    ${entity_index}    -1    Device ${device_name} not found in Entity Owner ${device_type}
-    ${entity_owner} =    Collections.Get_From_Dictionary    @{entity_list}[${entity_index}]    owner
+    ${entity_owner} =    Collections.Get_From_Dictionary    ${entity_list}[${entity_index}]    owner
     BuiltIn.Should_Not_Be_Empty    ${entity_owner}    No owner found for ${device_name}
     ${owner} =    String.Replace_String    ${entity_owner}    member-    ${EMPTY}
     ${owner} =    BuiltIn.Convert_To_Integer    ${owner}
-    ${entity_candidates_list} =    Collections.Get_From_Dictionary    @{entity_list}[${entity_index}]    candidate
+    ${entity_candidates_list} =    Collections.Get_From_Dictionary    ${entity_list}[${entity_index}]    candidate
     FOR    ${entity_candidate}    IN    @{entity_candidates_list}
-        ${candidate} =    String.Replace_String    &{entity_candidate}[name]    member-    ${EMPTY}
+        ${candidate} =    String.Replace_String    ${entity_candidate}[name]    member-    ${EMPTY}
         ${candidate} =    BuiltIn.Convert_To_Integer    ${candidate}
         Collections.Append_To_List    ${candidate_list}    ${candidate}
     END
@@ -359,19 +359,19 @@ Get_Owner_And_Candidates_For_Type_And_Id
     ${data} =    TemplatedRequests.Get_As_Json_From_Uri    uri=${ENTITY_OWNER_URI}    session=${session}    http_timeout=${http_timeout}
     ${candidate_list} =    BuiltIn.Create_List
     ${json} =    RequestsLibrary.To_Json    ${data}
-    ${entity_type_list} =    Collections.Get_From_Dictionary    &{json}[entity-owners]    entity-type
+    ${entity_type_list} =    Collections.Get_From_Dictionary    ${json}[entity-owners]    entity-type
     ${entity_type_index} =    Utils.Get_Index_From_List_Of_Dictionaries    ${entity_type_list}    type    ${type}
     BuiltIn.Should_Not_Be_Equal_As_Integers    ${entity_type_index}    -1    No Entity Owner found for ${type}
-    ${entity_list} =    Collections.Get_From_Dictionary    @{entity_type_list}[${entity_type_index}]    entity
+    ${entity_list} =    Collections.Get_From_Dictionary    ${entity_type_list}[${entity_type_index}]    entity
     ${entity_index} =    Utils.Get_Index_From_List_Of_Dictionaries    ${entity_list}    id    ${id}
     BuiltIn.Should Not_Be_Equal_As_Integers    ${entity_index}    -1    Id ${id} not found in Entity Owner ${type}
-    ${entity_owner} =    Collections.Get_From_Dictionary    @{entity_list}[${entity_index}]    owner
+    ${entity_owner} =    Collections.Get_From_Dictionary    ${entity_list}[${entity_index}]    owner
     BuiltIn.Should_Not_Be_Empty    ${entity_owner}    No owner found for type=${type} id=${id}
     ${owner} =    String.Replace_String    ${entity_owner}    member-    ${EMPTY}
     ${owner} =    BuiltIn.Convert_To_Integer    ${owner}
-    ${entity_candidates_list} =    Collections.Get_From_Dictionary    @{entity_list}[${entity_index}]    candidate
+    ${entity_candidates_list} =    Collections.Get_From_Dictionary    ${entity_list}[${entity_index}]    candidate
     FOR    ${entity_candidate}    IN    @{entity_candidates_list}
-        ${candidate} =    String.Replace_String    &{entity_candidate}[name]    member-    ${EMPTY}
+        ${candidate} =    String.Replace_String    ${entity_candidate}[name]    member-    ${EMPTY}
         ${candidate} =    BuiltIn.Convert_To_Integer    ${candidate}
         Collections.Append_To_List    ${candidate_list}    ${candidate}
     END
index 4936e3de43f70c834cf42a4c3dec40a65775c444..cd1ce15b06ccba421f5155609dae588faac26329 100644 (file)
@@ -155,18 +155,18 @@ Check Linear Topology On Member
     [Documentation]    Check Linear topology.
     ${session} =    Resolve_Http_Session_For_Member    member_index=${member_index}
     ${resp}    RequestsLibrary.Get Request    ${session}    ${OPERATIONAL_TOPO_API}
-    Log    ${resp.content}
+    Log    ${resp.text}
     Should Be Equal As Strings    ${resp.status_code}    200
     FOR    ${switch}    IN RANGE    1    ${switches+1}
-        Should Contain    ${resp.content}    "node-id":"openflow:${switch}"
-        Should Contain    ${resp.content}    "tp-id":"openflow:${switch}:1"
-        Should Contain    ${resp.content}    "tp-id":"openflow:${switch}:2"
-        Should Contain    ${resp.content}    "source-tp":"openflow:${switch}:2"
-        Should Contain    ${resp.content}    "dest-tp":"openflow:${switch}:2"
+        Should Contain    ${resp.text}    "node-id":"openflow:${switch}"
+        Should Contain    ${resp.text}    "tp-id":"openflow:${switch}:1"
+        Should Contain    ${resp.text}    "tp-id":"openflow:${switch}:2"
+        Should Contain    ${resp.text}    "source-tp":"openflow:${switch}:2"
+        Should Contain    ${resp.text}    "dest-tp":"openflow:${switch}:2"
         ${edge}    Evaluate    ${switch}==1 or ${switch}==${switches}
-        Run Keyword Unless    ${edge}    Should Contain    ${resp.content}    "tp-id":"openflow:${switch}:3"
-        Run Keyword Unless    ${edge}    Should Contain    ${resp.content}    "source-tp":"openflow:${switch}:3"
-        Run Keyword Unless    ${edge}    Should Contain    ${resp.content}    "dest-tp":"openflow:${switch}:3
+        Run Keyword Unless    ${edge}    Should Contain    ${resp.text}    "tp-id":"openflow:${switch}:3"
+        Run Keyword Unless    ${edge}    Should Contain    ${resp.text}    "source-tp":"openflow:${switch}:3"
+        Run Keyword Unless    ${edge}    Should Contain    ${resp.text}    "dest-tp":"openflow:${switch}:3
     END
 
 Check No Switches On Member
@@ -174,10 +174,10 @@ Check No Switches On Member
     [Documentation]    Check no switch is in topology
     ${session} =    Resolve_Http_Session_For_Member    member_index=${member_index}
     ${resp}    RequestsLibrary.Get Request    ${session}    ${OPERATIONAL_TOPO_API}
-    Log    ${resp.content}
+    Log    ${resp.text}
     Should Be Equal As Strings    ${resp.status_code}    200
     FOR    ${switch}    IN RANGE    1    ${switches+1}
-        Should Not Contain    ${resp.content}    openflow:${switch}
+        Should Not Contain    ${resp.text}    openflow:${switch}
     END
 
 Check Number Of Flows On Member
@@ -185,9 +185,9 @@ Check Number Of Flows On Member
     [Documentation]    Check number of flows in the inventory.
     ${session} =    Resolve_Http_Session_For_Member    member_index=${member_index}
     ${resp}=    RequestsLibrary.Get Request    ${session}    ${OPERATIONAL_NODES_API}
-    Log    ${resp.content}
+    Log    ${resp.text}
     Should Be Equal As Strings    ${resp.status_code}    200
-    ${count}=    Get Count    ${resp.content}    "priority"
+    ${count}=    Get Count    ${resp.text}    "priority"
     Should Be Equal As Integers    ${count}    ${flows}
 
 Check Number Of Groups On Member
@@ -195,7 +195,7 @@ Check Number Of Groups On Member
     [Documentation]    Check number of groups in the inventory.
     ${session} =    Resolve_Http_Session_For_Member    member_index=${member_index}
     ${resp}=    RequestsLibrary.Get Request    ${session}    ${OPERATIONAL_NODES_API}
-    Log    ${resp.content}
+    Log    ${resp.text}
     Should Be Equal As Strings    ${resp.status_code}    200
-    ${group_count}=    Get Count    ${resp.content}    "group-type"
+    ${group_count}=    Get Count    ${resp.text}    "group-type"
     Should Be Equal As Integers    ${group_count}    ${groups}
index 2304398f11d87b131d2bf926fb74576bd6a0d411..eb27b9d358641aa6303531af798ecff251a593c0 100644 (file)
@@ -30,7 +30,7 @@ def combine_strings(*strings):
     """
     result = ''
     for s in strings:
-        if isinstance(s, str) or isinstance(s, unicode):
+        if isinstance(s, str) or isinstance(s, str):
             result += s
     if result == '':
         return None
@@ -61,7 +61,7 @@ def num_of_nodes(depth, fanout):
     with particular depth and fanout parameters
     '''
     result = 0
-    for i in xrange(depth):
+    for i in range(depth):
         result += fanout**i
     return result
 
@@ -81,4 +81,4 @@ def num_of_links_for_node(nodeid, leaflist, fanout):
 
 
 if __name__ == '__main__':
-    print(num_of_nodes(3, 4))
+    print((num_of_nodes(3, 4)))
index 3a963667d1afb411ea112cbf1dcb79d98c8364a5..e328d3aff86d15b7f233712452a977a440715f59 100644 (file)
@@ -370,7 +370,7 @@ def _wt_request_sender(thread_id, preparefnc, inqueue=None, exitevent=None, cont
     while loop:
         try:
             flowlist = inqueue.get(timeout=1)
-        except Queue.Empty:
+        except queue.Empty:
             if exitevent.is_set() and inqueue.empty():
                 loop = False
             continue
@@ -452,14 +452,14 @@ def _task_executor(method='', flow_template=None, flow_details=[], controllers=[
     # lets fill the queue with details needed for one http requests
     # we have lists with flow details for particular (switch, table) tupples, now we need to split the lists
     # according to the flows per request (fpr) paramer
-    sendqueue = Queue.Queue()
+    sendqueue = queue.Queue()
     for flowgroup, flow_list in flowgroups.items():
         while len(flow_list) > 0:
             sendqueue.put(flow_list[:int(fpr)])
             flow_list = flow_list[int(fpr):]
 
     # result_gueue
-    resultqueue = Queue.Queue()
+    resultqueue = queue.Queue()
     # creaet exit event
     exitevent = threading.Event()
 
index 7a4b62c0a3fbe6f9cbbe95d3dbb584e2b619e390..f195cfdc2fdf06f99b1486f1ff2e55ed7c280a13 100644 (file)
@@ -415,7 +415,7 @@ Get Index From List Of Dictionaries
     ${index}=    Set Variable    -1
     FOR    ${i}    IN RANGE    ${length}
         ${dictionary}=    Get From List    ${dictionary_list}    ${i}
-        Run Keyword If    """&{dictionary}[${key}]""" == """${value}"""    Set Test Variable    ${index}    ${i}
+        Run Keyword If    """${dictionary}[${key}]""" == """${value}"""    Set Test Variable    ${index}    ${i}
     END
     [Return]    ${index}
 
@@ -423,7 +423,7 @@ Check Item Occurrence
     [Arguments]    ${string}    ${dictionary_item_occurrence}
     [Documentation]    Check string for occurrences of items expressed in a list of dictionaries {item=occurrences}. 0 occurences means item is not present.
     FOR    ${item}    IN    @{dictionary_item_occurrence}
-        Should Contain X Times    ${string}    ${item}    &{dictionary_item_occurrence}[${item}]
+        Should Contain X Times    ${string}    ${item}    ${dictionary_item_occurrence}[${item}]
     END
 
 Post Log Check
index 531d23e1b039296bfc35ad8c6646bd1a26202553..d5678c45164978c6395e6157485332e33802b686 100644 (file)
@@ -22,7 +22,7 @@ def _parse_stdout(stdout):
     regroups = re.finditer(pat, text)
     outdict = {}
     for g in regroups:
-        print(g.group())
+        print((g.group()))
         if g.group('key') == '_uuid':
             cntl_uuid = g.group('value')
             outdict[cntl_uuid] = {}
@@ -40,7 +40,7 @@ def _postprocess_data(bridges, controllers):
     cntls = copy.deepcopy(controllers)
 
     # replacing string value of is_connected key with boolean
-    for key, cntl in cntls.iteritems():
+    for key, cntl in cntls.items():
         if cntl['is_connected'] == 'false':
             cntl['is_connected'] = False
         elif cntl['is_connected'] == 'true':
@@ -49,11 +49,11 @@ def _postprocess_data(bridges, controllers):
             cntl['is_connected'] = None
 
     # replacing keys with the same values
-    for key, value in bridges.iteritems():
+    for key, value in bridges.items():
         brs[value['name'][1:-1]] = brs[key]
         del brs[key]
 
-    for key, value in brs.iteritems():
+    for key, value in brs.items():
         # replace string with references with dict of controllers
         ctl_refs = value['controller'][1:-1].split(',')
         value['controller'] = {}
@@ -61,9 +61,9 @@ def _postprocess_data(bridges, controllers):
             if ctl_ref is not '':
                 value['controller'][ctl_ref] = cntls[ctl_ref]
 
-    for brkey, bridge in brs.iteritems():
+    for brkey, bridge in brs.items():
         new_cntls = {}
-        for cnkey, cntl in bridge['controller'].iteritems():
+        for cnkey, cntl in bridge['controller'].items():
             # port 6654 is set by OvsMAnager.robot to disconnect from controller
             if '6653' in cntl['target'] or '6633' in cntl['target'] or '6654' in cntl['target']:
                 new_key = cntl['target'].split(":")[1]     # getting middle from "tcp:ip:6653"
index dd5df5a25a95ea5db8d374b806f366eacc83ffc7..795d7d5c211839eea87a22a5372552c97a298739 100644 (file)
@@ -421,6 +421,6 @@ Extract Flow Duration
     Log    ${resp.content}
     ${json_resp} =    RequestsLibrary.To_Json    ${resp.content}
     ${flow_list} =    Collections.Get_From_Dictionary    ${json_resp}    flow-node-inventory:flow
-    ${flow_stats} =    Collections.Get_From_Dictionary    @{flow_list}[0]    opendaylight-flow-statistics:flow-statistics
-    ${duration} =    Collections.Get_From_Dictionary    &{flow_stats}[duration]    second
+    ${flow_stats} =    Collections.Get_From_Dictionary    ${flow_list}[0]    opendaylight-flow-statistics:flow-statistics
+    ${duration} =    Collections.Get_From_Dictionary    ${flow_stats}[duration]    second
     Return From Keyword    ${duration}
index 47ab13cea001a72ba8049f004e78c6d952dd33b4..8e0d92787449b66607da70e4fa455f5b18bd7124 100644 (file)
@@ -22,9 +22,9 @@ Get nodeconnector for the root node
     [Documentation]    Get the inventory for the root node
     ${TOPO_TREE_FANOUT}    Convert To Integer    ${TOPO_TREE_FANOUT}
     ${resp}    RequestsLibrary.Get Request    session    ${REST_CONTEXT}/node/openflow:1
-    Log    ${resp.content}
+    Log    ${resp.text}
     Should Be Equal As Strings    ${resp.status_code}    200
-    Wait Until Keyword Succeeds    30s    2s    Check conn loop    ${TOPO_TREE_FANOUT}    1    ${resp.content}
+    Wait Until Keyword Succeeds    30s    2s    Check conn loop    ${TOPO_TREE_FANOUT}    1    ${resp.text}
 
 Get nodeconnector for a node
     [Documentation]    Get the inventory for a node
@@ -46,26 +46,26 @@ Check Every Nodes
     ${resp}    RequestsLibrary.Get Request    session    ${REST_CONTEXT}
     Should Be Equal As Strings    ${resp.status_code}    200
     FOR    ${IND}    IN RANGE    1    ${numnodes+1}
-        Should Contain    ${resp.content}    openflow:${IND}
+        Should Contain    ${resp.text}    openflow:${IND}
     END
 
 Check Every Nodes Stats
     [Arguments]    ${numnodes}
     FOR    ${IND}    IN RANGE    1    ${numnodes+1}
         ${resp}    RequestsLibrary.Get Request    session    ${REST_CONTEXT}/node/openflow:${IND}
-        Log    ${resp.content}
+        Log    ${resp.text}
         Should Be Equal As Strings    ${resp.status_code}    200
-        Should Contain    ${resp.content}    flow-capable-node-connector-statistics
-        Should Contain    ${resp.content}    flow-table-statistics
+        Should Contain    ${resp.text}    flow-capable-node-connector-statistics
+        Should Contain    ${resp.text}    flow-table-statistics
     END
 
 Check Every Nodes Nodeconnector
     [Arguments]    ${numnodes}
     FOR    ${IND}    IN RANGE    2    ${numnodes+1}
         ${resp}    RequestsLibrary.Get Request    session    ${REST_CONTEXT}/node/openflow:${IND}
-        Log    ${resp.content}
+        Log    ${resp.text}
         Should Be Equal As Strings    ${resp.status_code}    200
-        Check conn loop    ${TOPO_TREE_FANOUT+1}    ${IND}    ${resp.content}
+        Check conn loop    ${TOPO_TREE_FANOUT+1}    ${IND}    ${resp.text}
     END
 
 Check conn loop
index be620b659bf8fe858360437462ed30e98316cbc9..512ebaac184f0f2bf77892d92bbdcc3e1916d0ba 100644 (file)
@@ -31,7 +31,7 @@ Get Links Count
 Verify Element Count
     [Arguments]    ${URI}    ${xpath_location}    ${expected_count}
     ${resp}    RequestsLibrary.Get Request    session    ${REST_CONTEXT}    headers=${ACCEPT_XML}
-    Log    ${resp.content}
+    Log    ${resp.text}
     Should Be Equal As Strings    ${resp.status_code}    200
-    ${count}=    Get Element Count    ${resp.content}    xpath=${xpath_location}
+    ${count}=    Get Element Count    ${resp.text}    xpath=${xpath_location}
     Should Be Equal As Numbers    ${count}    ${expected_count}
index 47ab13cea001a72ba8049f004e78c6d952dd33b4..8e0d92787449b66607da70e4fa455f5b18bd7124 100644 (file)
@@ -22,9 +22,9 @@ Get nodeconnector for the root node
     [Documentation]    Get the inventory for the root node
     ${TOPO_TREE_FANOUT}    Convert To Integer    ${TOPO_TREE_FANOUT}
     ${resp}    RequestsLibrary.Get Request    session    ${REST_CONTEXT}/node/openflow:1
-    Log    ${resp.content}
+    Log    ${resp.text}
     Should Be Equal As Strings    ${resp.status_code}    200
-    Wait Until Keyword Succeeds    30s    2s    Check conn loop    ${TOPO_TREE_FANOUT}    1    ${resp.content}
+    Wait Until Keyword Succeeds    30s    2s    Check conn loop    ${TOPO_TREE_FANOUT}    1    ${resp.text}
 
 Get nodeconnector for a node
     [Documentation]    Get the inventory for a node
@@ -46,26 +46,26 @@ Check Every Nodes
     ${resp}    RequestsLibrary.Get Request    session    ${REST_CONTEXT}
     Should Be Equal As Strings    ${resp.status_code}    200
     FOR    ${IND}    IN RANGE    1    ${numnodes+1}
-        Should Contain    ${resp.content}    openflow:${IND}
+        Should Contain    ${resp.text}    openflow:${IND}
     END
 
 Check Every Nodes Stats
     [Arguments]    ${numnodes}
     FOR    ${IND}    IN RANGE    1    ${numnodes+1}
         ${resp}    RequestsLibrary.Get Request    session    ${REST_CONTEXT}/node/openflow:${IND}
-        Log    ${resp.content}
+        Log    ${resp.text}
         Should Be Equal As Strings    ${resp.status_code}    200
-        Should Contain    ${resp.content}    flow-capable-node-connector-statistics
-        Should Contain    ${resp.content}    flow-table-statistics
+        Should Contain    ${resp.text}    flow-capable-node-connector-statistics
+        Should Contain    ${resp.text}    flow-table-statistics
     END
 
 Check Every Nodes Nodeconnector
     [Arguments]    ${numnodes}
     FOR    ${IND}    IN RANGE    2    ${numnodes+1}
         ${resp}    RequestsLibrary.Get Request    session    ${REST_CONTEXT}/node/openflow:${IND}
-        Log    ${resp.content}
+        Log    ${resp.text}
         Should Be Equal As Strings    ${resp.status_code}    200
-        Check conn loop    ${TOPO_TREE_FANOUT+1}    ${IND}    ${resp.content}
+        Check conn loop    ${TOPO_TREE_FANOUT+1}    ${IND}    ${resp.text}
     END
 
 Check conn loop
index be620b659bf8fe858360437462ed30e98316cbc9..512ebaac184f0f2bf77892d92bbdcc3e1916d0ba 100644 (file)
@@ -31,7 +31,7 @@ Get Links Count
 Verify Element Count
     [Arguments]    ${URI}    ${xpath_location}    ${expected_count}
     ${resp}    RequestsLibrary.Get Request    session    ${REST_CONTEXT}    headers=${ACCEPT_XML}
-    Log    ${resp.content}
+    Log    ${resp.text}
     Should Be Equal As Strings    ${resp.status_code}    200
-    ${count}=    Get Element Count    ${resp.content}    xpath=${xpath_location}
+    ${count}=    Get Element Count    ${resp.text}    xpath=${xpath_location}
     Should Be Equal As Numbers    ${count}    ${expected_count}