Fix netconf csit looking up nonexistant version
[integration/test.git] / csit / libraries / OvsManager.robot
index 2ee870ac6f6086c47fe138af7c2f1d6de78638ac..0edf59aade942d01045c7cd9d5a9aba467b604a2 100644 (file)
@@ -57,8 +57,9 @@ Set Bridge Controllers
     ${output}=    SSHLibrary.Read_Until    ${lprompt}
     Log    ${output}
     ${cmd}=    BuiltIn.Set Variable    ${lcmd_prefix} ovs-vsctl set-controller ${bridge}
-    : FOR    ${cntl}    IN    @{controllers}
-    \    ${cmd}=    BuiltIn.Set Variable If    ${disconnected}==${False}    ${cmd} tcp:${cntl}:6653    ${cmd} tcp:${cntl}:6654
+    FOR    ${cntl}    IN    @{controllers}
+        ${cmd}=    BuiltIn.Set Variable If    ${disconnected}==${False}    ${cmd} tcp:${cntl}:6653    ${cmd} tcp:${cntl}:6654
+    END
     BuiltIn.Log    ${cmd}
     SSHLibrary.Write    ${cmd}
     ${output}=    SSHLibrary.Read_Until    ${lprompt}
@@ -143,11 +144,12 @@ Get Master Node
     ${bridge}=    Collections.Get From Dictionary    ${ovs_switch_data}    ${switch}
     ${cntls_dict}=    Collections.Get From Dictionary    ${bridge}    controller
     ${cntls_items}=    Collections.Get Dictionary Items    ${cntls_dict}
-    : FOR    ${key}    ${value}    IN    @{cntls_items}
-    \    Log    ${key} : ${value}
-    \    ${role}=    Collections.Get From Dictionary    ${value}    role
-    \    Run Keyword If    "${role}"=="master"    BuiltIn.Should Be Equal    ${master}    ${None}
-    \    ${master}=    BuiltIn.Set Variable If    "${role}"=="master"    ${key}    ${master}
+    FOR    ${key}    ${value}    IN    @{cntls_items}
+        Log    ${key} : ${value}
+        ${role}=    Collections.Get From Dictionary    ${value}    role
+        Run Keyword If    "${role}"=="master"    BuiltIn.Should Be Equal    ${master}    ${None}
+        ${master}=    BuiltIn.Set Variable If    "${role}"=="master"    ${key}    ${master}
+    END
     BuiltIn.Should Not Be Equal    ${master}    ${None}
     Return From Keyword    ${master}
 
@@ -159,10 +161,11 @@ Get Slave Nodes
     ${bridge}=    Collections.Get From Dictionary    ${ovs_switch_data}    ${switch}
     ${cntls_dict}=    Collections.Get From Dictionary    ${bridge}    controller
     ${cntls_items}=    Collections.Get Dictionary Items    ${cntls_dict}
-    : FOR    ${key}    ${value}    IN    @{cntls_items}
-    \    Log    ${key} : ${value}
-    \    ${role}=    Collections.Get From Dictionary    ${value}    role
-    \    Run Keyword If    "${role}"=="slave"    Collections.Append To List    ${slaves}    ${key}
+    FOR    ${key}    ${value}    IN    @{cntls_items}
+        Log    ${key} : ${value}
+        ${role}=    Collections.Get From Dictionary    ${value}    role
+        Run Keyword If    "${role}"=="slave"    Collections.Append To List    ${slaves}    ${key}
+    END
     Return From Keyword    ${slaves}
 
 Setup Clustered Controller For Switches
@@ -170,14 +173,16 @@ Setup Clustered Controller For Switches
     [Documentation]    The idea of this keyword is to setup clustered controller and to be more or less sure that the role is filled correctly. The problem is when
     ...    more controllers are being set up at once, the role shown in Controller ovsdb table is not the same as we can see from wireshark traces.
     ...    Now we set disconnected controllers and we will connect them expecting that the first connected controller will be master.
-    : FOR    ${switch_name}    IN    @{switches}
-    \    Set Bridge Controllers    ${switch_name}    ${controller_ips}    disconnected=${True}
-    # now we need to enable one node which will be master
+    FOR    ${switch_name}    IN    @{switches}
+        Set Bridge Controllers    ${switch_name}    ${controller_ips}    disconnected=${True}
+        # now we need to enable one node which will be master
+    END
     OvsManager.Get Ovsdb Data
-    : FOR    ${switch_name}    IN    @{switches}
-    \    ${own}=    Collections.Get From List    ${controller_ips}    0
-    \    Reconnect Switch To Controller And Verify Connected    ${switch_name}    ${own}    verify_connected=${False}
-    # now we need to wait till master controllers are connected
+    FOR    ${switch_name}    IN    @{switches}
+        ${own}=    Collections.Get From List    ${controller_ips}    0
+        Reconnect Switch To Controller And Verify Connected    ${switch_name}    ${own}    verify_connected=${False}
+        # now we need to wait till master controllers are connected
+    END
     BuiltIn.Wait Until Keyword Succeeds    5x    2s    OvsManager__Verify_Masters_Connected    ${switches}    update_data=${True}
     # now we can enable slaves
     OvsManager__Enable_Slaves    ${switches}    verify_connected=${verify_connected}
@@ -186,15 +191,17 @@ OvsManager__Verify_Masters_Connected
     [Arguments]    ${switches}    ${update_data}=${False}
     [Documentation]    Private keyword, the existence of master means it is verified
     Run Keyword If    ${update_data}==${True}    Get Ovsdb Data
-    : FOR    ${switch_name}    IN    @{switches}
-    \    Get Master Node    ${switch_name}
+    FOR    ${switch_name}    IN    @{switches}
+        Get Master Node    ${switch_name}
+    END
 
 OvsManager__Enable_Slaves
     [Arguments]    ${switches}    ${update_data}=${False}    ${verify_connected}=${False}
     [Documentation]    This is a private keyword to enable diconnected controllers
     Run Keyword If    ${update_data}==${True}    Get Ovsdb Data
-    : FOR    ${switch_name}    IN    @{switches}
-    \    OvsManager__Enable_Slaves_For_Switch    ${switch_name}    verify_connected=${verify_connected}
+    FOR    ${switch_name}    IN    @{switches}
+        OvsManager__Enable_Slaves_For_Switch    ${switch_name}    verify_connected=${verify_connected}
+    END
 
 OvsManager__Enable_Slaves_For_Switch
     [Arguments]    ${switch}    ${update_data}=${False}    ${verify_connected}=${False}
@@ -203,11 +210,12 @@ OvsManager__Enable_Slaves_For_Switch
     ${bridge}=    Collections.Get From Dictionary    ${ovs_switch_data}    ${switch}
     ${cntls_dict}=    Collections.Get From Dictionary    ${bridge}    controller
     ${cntls_items}=    Collections.Get Dictionary Items    ${cntls_dict}
-    : FOR    ${cntl_id}    ${cntl_value}    IN    @{cntls_items}
-    \    Log    ${cntl_id} : ${cntl_value}
-    \    ${role}=    Collections.Get From Dictionary    ${cntl_value}    role
-    \    ${connected}=    Collections.Get From Dictionary    ${cntl_value}    is_connected
-    \    Run Keyword If    ${connected}==${False}    Reconnect Switch To Controller And Verify Connected    ${switch}    ${cntl_id}    verify_connected=${verify_connected}
+    FOR    ${cntl_id}    ${cntl_value}    IN    @{cntls_items}
+        Log    ${cntl_id} : ${cntl_value}
+        ${role}=    Collections.Get From Dictionary    ${cntl_value}    role
+        ${connected}=    Collections.Get From Dictionary    ${cntl_value}    is_connected
+        Run Keyword If    ${connected}==${False}    Reconnect Switch To Controller And Verify Connected    ${switch}    ${cntl_id}    verify_connected=${verify_connected}
+    END
 
 Get Dump Flows Count
     [Arguments]    ${conn_id}    ${acl_sr_table_id}    ${port_mac}=""
@@ -240,18 +248,19 @@ Get Packet Count In Table For IP
     ${count} =    Collections.Get From List    ${packetcount_list}    0
     [Return]    ${count}
 
-Check Ovs Version Is Higher Than
+Verify Ovs Version Greater Than Or Equal To
     [Arguments]    ${ovs_version}    @{nodes}
     [Documentation]    Get ovs version and verify greater than required version
-    : FOR    ${ip}    IN    @{nodes}
-    \    ${output} =    Utils.Run Command On Remote System    ${ip}    ${SHOW_OVS_VERSION}
-    \    ${version} =    String.Get Regexp Matches    ${output}    \[0-9].\[0-9]
-    \    ${result} =    BuiltIn.Convert To Number    ${version[0]}
-    \    BuiltIn.Should Be True    ${result} > ${ovs_version}
+    FOR    ${ip}    IN    @{nodes}
+        ${output} =    Utils.Run Command On Remote System    ${ip}    ${SHOW_OVS_VERSION}
+        ${version} =    String.Get Regexp Matches    ${output}    \[0-9].\[0-9]
+        ${result} =    BuiltIn.Convert To Number    ${version[0]}
+        BuiltIn.Should Be True    ${result} >= ${ovs_version}
+    END
 
 Get OVS Local Ip
     [Arguments]    ${ip}
     [Documentation]    Get local ip of compute node ovsdb
     ${cmd_output} =    Utils.Run Command On Remote System    ${ip}    ${GET_LOCAL_IP}
     ${localip} =    String.Get Regexp Matches    ${cmd_output}    (\[0-9]+\.\[0-9]+\.\[0-9]+\.\[0-9]+)
-    [Return]    @{localip}[0]
+    [Return]    ${localip}[0]