Upgrade RF syntax for v3.2 compatibility
[integration/test.git] / csit / libraries / L2GatewayOperations.robot
index ed9bcc2c61a3a772ae118a41f6ff96ebb87105c0..bbd3d9e8ea23f96b8b6a25889e22af5539c87578 100644 (file)
@@ -87,12 +87,15 @@ Update And Verify L2Gateway
     [Return]    ${l2gw_output}
 
 Delete L2Gateway
-    [Arguments]    ${gw_name}
+    [Arguments]    ${gw_name}    ${check_for_null}=False
     [Documentation]    Keyword to delete the L2 Gateway ${gw_name} received in argument.
+    ...    If ${check_for_null} is True return of 404 is treated as empty list. From Neon onwards,
+    ...    an empty list is always returned as null, giving 404 on rest call.
     ${output}=    Exec Command    ${OS_CNTL_CONN_ID}    ${L2GW_DELETE} ${gw_name}
     Log    ${output}
     @{list_to_check}=    Create List    ${gw_name}
     BuiltIn.Wait Until Keyword Succeeds    5s    1s    Utils.Check For Elements Not At URI    ${L2GW_LIST_REST_URL}    ${list_to_check}    session
+    ...    check_for_null=${check_for_null}
 
 Create Verify L2Gateway Connection
     [Arguments]    ${gw_name}    ${net_name}
@@ -118,13 +121,16 @@ Verify L2Gateway Connection
     Utils.Check For Elements At URI    ${L2GW_CONN_LIST_REST_URL}    ${list_to_check}    session
 
 Delete L2Gateway Connection
-    [Arguments]    ${gw_name}
+    [Arguments]    ${gw_name}    ${check_for_null}=False
     [Documentation]    Delete the L2 Gateway connection existing for Gateway ${gw_name} received in argument (Using Neutron CLI).
+    ...    If ${check_for_null} is True return of 404 is treated as empty list. From Neon onwards, an empty list is always
+    ...    returned as null, giving 404 on rest call.
     ${l2gw_conn_id}=    OpenStackOperations.Get L2gw Connection Id    ${gw_name}
     ${output}=    Exec Command    ${OS_CNTL_CONN_ID}    ${L2GW_CONN_DELETE} ${l2gw_conn_id}
     Log    ${output}
     @{list_to_check}=    Create List    ${l2gw_conn_id}
     BuiltIn.Wait Until Keyword Succeeds    5s    1s    Utils.Check For Elements Not At URI    ${L2GW_CONN_LIST_REST_URL}    ${list_to_check}    session
+    ...    check_for_null=${check_for_null}
 
 Update Port For Hwvtep
     [Arguments]    ${port_name}
@@ -162,8 +168,9 @@ Verify Strings In Command Output
     [Arguments]    ${conn_id}    ${command}    @{string_list}
     [Documentation]    Keyword to run the ${command} in ${conn_id} and verify if the output contains the list @{string_list}.
     ${output}=    Exec Command    ${conn_id}    ${command}
-    : FOR    ${item}    IN    @{string_list}
-    \    Should Contain    ${output}    ${item}
+    FOR    ${item}    IN    @{string_list}
+        Should Contain    ${output}    ${item}
+    END
 
 Verify Ping In Namespace Extra Timeout
     [Arguments]    ${ns_name}    ${ns_port_mac}    ${vm_ip}    ${conn_id}=${hwvtep_conn_id}    ${hwvtep_ip}=${HWVTEP_IP}
@@ -224,8 +231,9 @@ Verify Vtep List
     [Arguments]    ${conn_id}    ${table_name}    @{list}
     [Documentation]    Keyword to run vtep-ctl list for the table ${table_name} and verify the list @{list} contents exists in output.
     ${output}=    Exec Command    ${conn_id}    ${VTEP LIST} ${table_name}
-    : FOR    ${item}    IN    @{list}
-    \    Should Contain    ${output}    ${item}
+    FOR    ${item}    IN    @{list}
+        Should Contain    ${output}    ${item}
+    END
 
 Get Vtep List
     [Arguments]    ${table_name}    ${conn_id}=${hwvtep_conn_id}
@@ -283,13 +291,15 @@ Verify Elan Flow Entries
     Should Contain    ${flow_output}    table=50
     ${sMac_output} =    Get Lines Containing String    ${flow_output}    table=50
     Log    ${sMac_output}
-    : FOR    ${sMacAddr}    IN    @{srcMacAddrs}
-    \    ${resp}=    Should Contain    ${sMac_output}    dl_src=${sMacAddr}
+    FOR    ${sMacAddr}    IN    @{srcMacAddrs}
+        ${resp}=    Should Contain    ${sMac_output}    dl_src=${sMacAddr}
+    END
     Should Contain    ${flow_output}    table=51
     ${dMac_output} =    Get Lines Containing String    ${flow_output}    table=51
     Log    ${dMac_output}
-    : FOR    ${dMacAddr}    IN    @{destMacAddrs}
-    \    ${resp}=    Should Contain    ${dMac_output}    dl_dst=${dMacAddr}
+    FOR    ${dMacAddr}    IN    @{destMacAddrs}
+        ${resp}=    Should Contain    ${dMac_output}    dl_dst=${dMacAddr}
+    END
     Should Contain    ${flow_output}    table=52
     ${sMac_output} =    Get Lines Containing String    ${flow_output}    table=52
     Log    ${sMac_output}