Do not fail on exceptions in suite teardown
[integration/test.git] / csit / libraries / OpenStackOperations.robot
index 3c8cd6d05a15be772d887115800df5bcafe5d1c4..5c6fd65ab83b6a62f782d405e5605b9cd3b34925 100644 (file)
@@ -489,8 +489,8 @@ Show Router Interface
     [Return]    ${output}
 
 Add Router Gateway
-    [Arguments]    ${router_name}    ${external_network_name}
-    ${output} =    OpenStack CLI    openstack router set ${router_name} --external-gateway ${external_network_name}
+    [Arguments]    ${router_name}    ${external_network_name}    ${additional_args}=${EMPTY}
+    ${output} =    OpenStack CLI    openstack router set ${router_name} --external-gateway ${external_network_name} ${additional_args}
 
 Remove Interface
     [Arguments]    ${router_name}    ${interface_name}
@@ -511,6 +511,7 @@ Show Router
     [Arguments]    ${router_name}    ${options}
     [Documentation]    Show information of a given router. Router name and optional fields should be sent as arguments.
     ${output} =    OpenStack CLI    openstack router show ${router_name}
+    [Return]    ${output}
 
 Delete Router
     [Arguments]    ${router_name}
@@ -548,11 +549,14 @@ Get OvsDebugInfo
     \    OpenStackOperations.Get DumpFlows And Ovsconfig    ${conn_id}
 
 Get Test Teardown Debugs
-    [Arguments]    ${test_name}=${SUITE_NAME}.${TEST_NAME}
+    [Arguments]    ${test_name}=${SUITE_NAME}.${TEST_NAME}    ${fail}=${FAIL_ON_EXCEPTIONS}
     OpenStackOperations.Get OvsDebugInfo
     BuiltIn.Run Keyword And Ignore Error    DataModels.Get Model Dump    ${HA_PROXY_IP}    ${netvirt_data_models}
     BuiltIn.run Keyword And Ignore Error    ODLTools.Get EOS    ${HA_PROXY_IP}
-    Run Keyword If    "${FAIL_ON_EXCEPTIONS}"=="True"    KarafKeywords.Fail If Exceptions Found During Test    ${test_name}
+    KarafKeywords.Fail If Exceptions Found During Test    ${test_name}    fail=${fail}
+
+Get Suite Debugs
+    Get Test Teardown Debugs    test_name=${SUITE_NAME}    fail=False
 
 Get Test Teardown Debugs For SFC
     [Arguments]    ${test_name}=${TEST_NAME}
@@ -1003,6 +1007,7 @@ OpenStack Suite Setup
     BuiltIn.Set Suite Variable    @{tcpdump_port_6653_conn_ids}
     BuiltIn.Run Keyword If    "${PRE_CLEAN_OPENSTACK_ALL}"=="True"    OpenStack Cleanup All
     OpenStackOperations.Add OVS Logging On All OpenStack Nodes
+    Run_Keyword_If_At_Least_Oxygen    Wait Until Keyword Succeeds    60    2    ClusterManagement.Check Status Of Services Is OPERATIONAL    @{NETVIRT_DIAG_SERVICES}
     ClusterManagement.Dump_Local_Shards_For_Each_Member
     Verify Expected Default Tables On Nodes
 
@@ -1011,6 +1016,9 @@ OpenStack Suite Teardown
     ...    to clean up all openstack resources. For example, all instances, networks, ports, etc will be listed and
     ...    and deleted. As other global cleanup tasks are needed, they can be added here and the suites will all
     ...    benefit automatically.
+    # TODO: followup patch will add the list of vms to pass to Show Debugs
+    # OpenStackOperations.Show Debugs    @{NET_1_VMS}    @{NET_2_VMS}
+    OpenStackOperations.Get Suite Debugs
     OpenStack Cleanup All
     OpenStackOperations.Stop Packet Capture On Nodes    ${tcpdump_port_6653_conn_ids}
     SSHLibrary.Close All Connections
@@ -1114,12 +1122,12 @@ Verify Expected Default Tables On Nodes
 Verify Expected Default Tables
     [Arguments]    ${ovs_ip}
     [Documentation]    Verify if Default Table Entries are programmed on specific Node
-    ${flow_dump} =    Utils.Write Commands Until Expected Prompt    sudo ovs-ofctl dump-flows ${INTEGRATION_BRIDGE} -OOpenFlow13    ${DEFAULT_LINUX_PROMPT_STRICT}
+    ${flow_dump} =    Utils.Run Command On Remote System    ${ovs_ip}    sudo ovs-ofctl dump-flows ${INTEGRATION_BRIDGE} -OOpenFlow13
     BuiltIn.Log    ${flow_dump}
-    ${failed_table_list}    BuiltIn.Create List
+    ${failed_table_list}    BuiltIn.Create List
     : FOR    ${table}    IN    @{DEFAULT_FLOW_TABLES}
-    \    Builtin.Run Keyword And Ignore Error    ${rc}    Builtin.Should Match Regexp    ${flow_dump}    .*table=${table}.*priority=0
-    \    BuiltIn.Run Keyword If    ${rc} == "FAIL"    Collections.Append To List    ${failed_table_list}    ${table}
+    \    ${rc} =    Builtin.Run Keyword And Return Status    Builtin.Should Not Match Regexp    ${flow_dump}    .*table=${table}.*priority=0
+    \    BuiltIn.Run Keyword If    ${rc}    Collections.Append To List    ${failed_table_list}    ${table}
     [Return]    ${failed_table_list}
 
 Get Project Id