Upgrade RF syntax for v3.2 compatibility
[integration/test.git] / csit / libraries / L2GatewayOperations.robot
index 01ab61b2298180e2dcf4c2af4a1c0880f4a72d1f..bbd3d9e8ea23f96b8b6a25889e22af5539c87578 100644 (file)
@@ -21,21 +21,21 @@ Add Ovs Bridge Manager Controller And Verify
     [Documentation]    Keyword to set OVS manager and controller to ${ODL_IP} for the OVS IP connected in ${conn_id} and verify the entries in OVSDB NETWORK TOPOLOGY and NETSTAT results.
     ${output}=    Exec Command    ${conn_id}    ${OVS_RESTART}
     ${output}=    Exec Command    ${conn_id}    ${OVS_DEL_MGR}
-    ${output}=    Exec Command    ${conn_id}    ${OVS_DEL_CTRLR} ${OVS_BRIDGE}
-    ${output}=    Exec Command    ${conn_id}    ${DEL_OVS_BRIDGE} ${OVS_BRIDGE}
+    ${output}=    Exec Command    ${conn_id}    ${OVS_DEL_CTRLR} ${INTEGRATION_BRIDGE}
+    ${output}=    Exec Command    ${conn_id}    ${DEL_OVS_BRIDGE} ${INTEGRATION_BRIDGE}
     ${output}=    Exec Command    ${conn_id}    ${OVS_SHOW}
     Should Not Contain    ${output}    Manager
     Should Not Contain    ${output}    Controller
-    ${output}=    Exec Command    ${conn_id}    ${CREATE_OVS_BRIDGE} ${OVS_BRIDGE}
-    ${output}=    Exec Command    ${conn_id}    ${SET_FAIL_MODE} ${OVS_BRIDGE} secure
+    ${output}=    Exec Command    ${conn_id}    ${CREATE_OVS_BRIDGE} ${INTEGRATION_BRIDGE}
+    ${output}=    Exec Command    ${conn_id}    ${SET_FAIL_MODE} ${INTEGRATION_BRIDGE} secure
     ${output}=    Exec Command    ${conn_id}    ${OVS_SET_MGR}:${ODL_IP}:${OVSDBPORT}
-    ${output}=    Exec Command    ${conn_id}    ${OVS_SET_CTRLR} ${OVS_BRIDGE} tcp:${ODL_IP}:${ODL_OF_PORT}
+    ${output}=    Exec Command    ${conn_id}    ${OVS_SET_CTRLR} ${INTEGRATION_BRIDGE} tcp:${ODL_IP}:${ODL_OF_PORT}
     Wait Until Keyword Succeeds    60s    2s    Verify Strings In Command Output    ${conn_id}    ${OVS_SHOW}    Manager "tcp:${ODL_IP}:${OVSDBPORT}"
     ...    Controller "tcp:${ODL_IP}:${ODL_OF_PORT}"
     ${output}=    Exec Command    ${conn_id}    ${NETSTAT}
     Wait Until Keyword Succeeds    30s    2s    Validate Regexp In String    ${output}    ${NETSTAT_OVSDB_REGEX}
     Wait Until Keyword Succeeds    30s    2s    Validate Regexp In String    ${output}    ${NETSTAT_OF_REGEX}
-    @{list_to_check}=    Create List    bridge/${OVS_BRIDGE}    bridge/${hwvtep_bridge}
+    @{list_to_check}=    Create List    bridge/${INTEGRATION_BRIDGE}    bridge/${hwvtep_bridge}
     Wait Until Keyword Succeeds    30s    2s    Check For Elements At URI    ${OVSDB_NETWORK_TOPOLOGY}    ${list_to_check}    session
 
 Create Itm Tunnel Between Hwvtep and Ovs
@@ -59,7 +59,7 @@ Add Vtep Manager And Verify
     ${output}=    Exec Command    ${conn_id}    ${NETSTAT}
     Should Contain    ${output}    ${OVSDBPORT}
     @{list_to_check}=    Create List    ${odl_ip}
-    Utils.Check For Elements At URI    ${HWVTEP_NETWORK_TOPOLOGY}    ${list_to_check}    session
+    Wait Until Keyword Succeeds    30s    2s    Utils.Check For Elements At URI    ${HWVTEP_NETWORK_TOPOLOGY}    ${list_to_check}    session
 
 Create Verify L2Gateway
     [Arguments]    ${bridge_name}    ${intf_name}    ${gw_name}
@@ -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}
-    Utils.Check For Elements Not At URI    ${L2GW_LIST_REST_URL}    ${list_to_check}    session
+    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}
@@ -116,16 +119,18 @@ Verify L2Gateway Connection
     Should Contain    ${output}    ${l2gw_id}
     @{list_to_check}=    Create List    ${l2gw_id}
     Utils.Check For Elements At URI    ${L2GW_CONN_LIST_REST_URL}    ${list_to_check}    session
-    [Return]    ${l2gw_output}
 
 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}
-    @{list_to_check}=    Create List    ${l2gw_conn_id}
-    Utils.Check For Elements Not At URI    ${L2GW_CONN_LIST_REST_URL}    ${list_to_check}    session
     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}
@@ -163,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}
@@ -174,7 +180,7 @@ Verify Ping In Namespace Extra Timeout
     ${output}=    Exec Command    ${conn_id}    ${NETNS_EXEC} ${ns_name} ping -c3 ${vm_ip}    30s
     Log    ${output}
     Should Not Contain    ${output}    ${PACKET_LOSS}
-    Wait Until Keyword Succeeds    30s    2s    Verify Mcas Local Table While Ping    ${ns_port_mac}    ${conn_id}
+    Wait Until Keyword Succeeds    30s    2s    Verify Macs Local Table While Ping    ${ns_port_mac}    ${conn_id}
 
 Verify Ping Fails In Namespace
     [Arguments]    ${ns_name}    ${ns_port_mac}    ${vm_ip}    ${conn_id}=${hwvtep_conn_id}    ${hwvtep_ip}=${HWVTEP_IP}
@@ -183,7 +189,7 @@ Verify Ping Fails In Namespace
     Log    ${output}
     Should Contain    ${output}    ${PACKET_LOSS}
 
-Verify Mcas Local Table While Ping
+Verify Macs Local Table While Ping
     [Arguments]    ${mac}    ${conn_id}
     [Documentation]    Keyword to check if ${mac} is available under UCAST_MACS_LOCALE_TABLE of HWVTEP dump table.
     Verify Vtep List    ${conn_id}    ${UCAST_MACS_LOCALE_TABLE}    ${mac}
@@ -217,7 +223,7 @@ Start Command In Hwvtep
     Log    ${conn_id}
     Flexible SSH Login    ${DEFAULT_USER}    ${DEFAULT_PASSWORD}
     Start Command    ${command}
-    ${output}=    Exec Command    ${conn_id}    sudo ovs-ofctl dump-flows br-int -O Openflow13
+    ${output}=    Exec Command    ${conn_id}    sudo ovs-ofctl dump-flows ${INTEGRATION_BRIDGE} -O Openflow13
     Log    ${output}
     close connection
 
@@ -225,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}
@@ -279,24 +286,24 @@ Exec Command
 Verify Elan Flow Entries
     [Arguments]    ${ip}    ${srcMacAddrs}    ${destMacAddrs}
     [Documentation]    Verify Flows Are Present For ELAN service
-    ${flow_output} =    Run Command On Remote System    ${ip}    sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
+    ${flow_output} =    Run Command On Remote System    ${ip}    sudo ovs-ofctl -O OpenFlow13 dump-flows ${INTEGRATION_BRIDGE}
     Log    ${flow_output}
     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}
 
 Cleanup L2GW Optional Resources
     [Documentation]    Cleanup resources that are only allocated on certain combos...
-    BuiltIn.Pass_Execution_If    "skip_if_${OPENSTACK_BRANCH}" in @{TEST_TAGS}    Not supported in Ocata/Pike
-    CompareStream.Run_Keyword_If_At_Most_Nitrogen    BuiltIn.Pass_Execution    Only run on oxygen and later
     OpenStackOperations.Delete Port    ${HWVTEP_PORT_3}