don't log ssh errors
[integration/test.git] / csit / libraries / OpenStackOperations.robot
index efc9bb0534585f93d3a39e24c424c6a92b36ee81..672904552c4836ac85df6abf2c380f00a9e44d92 100644 (file)
@@ -17,7 +17,6 @@ Resource          Utils.robot
 Resource          ../variables/Variables.robot
 Resource          ../variables/netvirt/Variables.robot
 Variables         ../variables/netvirt/Modules.py
-Variables         ../variables/netvirt/Exceptions_Whitelist.py
 
 *** Keywords ***
 Get Tenant ID From Security Group
@@ -34,7 +33,7 @@ Get Tenant ID From Network
 
 Create Network
     [Arguments]    ${network_name}    ${additional_args}=${EMPTY}    ${verbose}=TRUE
-    [Documentation]    Create Network with neutron request.
+    [Documentation]    Create Network with openstack request.
     ${output} =    OpenStack CLI    openstack network create ${network_name} ${additional_args}
     [Return]    ${output}
 
@@ -72,10 +71,16 @@ Create SubNet
 
 Update SubNet
     [Arguments]    ${subnet_name}    ${additional_args}=${EMPTY}
-    [Documentation]    Update subnet with neutron request.
+    [Documentation]    Update subnet with openstack subnet set request.
     ${output} =    OpenStack CLI    openstack subnet set ${subnet_name} ${additional_args}
     [Return]    ${output}
 
+Unset SubNet
+    [Arguments]    ${subnet_name}    ${additional_args}=${EMPTY}
+    [Documentation]    Update subnet with openstack subnet unset request
+    ${output} =    OpenStack CLI    openstack subnet unset ${subnet_name} ${additional_args}
+    [Return]    ${output}
+
 Show SubNet
     [Arguments]    ${subnet_name}
     [Documentation]    Show subnet with neutron request.
@@ -132,6 +137,11 @@ Create And Associate Floating IPs
     \    ${output} =    OpenStack CLI    openstack server add floating ip ${vm} @{ip}[0]
     [Return]    ${ip_list}
 
+Remove Floating Ip From Vm
+    [Arguments]    ${vm_name}    ${fip}
+    [Documentation]    Remove the Floating IP From VM Instance
+    ${output} =    OpenStack CLI    openstack server remove floating ip ${vm_name} ${fip}
+
 Delete Floating IP
     [Arguments]    ${fip}
     [Documentation]    Delete floating ip with neutron request.
@@ -289,6 +299,15 @@ Get VM IPs
     OpenStackOperations.Copy DHCP Files From Control Node
     [Return]    @{vm_ips}    ${ips_and_console_log[1]}
 
+Get Subnet Gateway Ip
+    [Arguments]    ${subnet_name}
+    [Documentation]    Show information of a subnet and grep for subnet gateway ip address
+    ${output} =    OpenStackOperations.OpenStack CLI    openstack subnet show ${subnet_name} | grep gateway_ip | awk '{print $4}'
+    ${splitted_output} =    String.Split String    ${output}    ${EMPTY}
+    ${matches} =    Collections.Get Matches    ${splitted_output}    regexp=(\\d\.)+
+    ${subnet_gateway_ip} =    String.Strip String    ${matches[0]}    characters=','
+    [Return]    ${subnet_gateway_ip}
+
 Collect VM IPv6 SLAAC Addresses
     [Arguments]    ${fail_on_none}    ${vm_list}    ${network}    ${subnet}
     [Documentation]    For each VM parse output of "openstack server show" to get its IPv6 address from Neutron DB.
@@ -524,8 +543,7 @@ Get Test Teardown Debugs
     [Arguments]    ${test_name}=${SUITE_NAME}.${TEST_NAME}
     OpenStackOperations.Get OvsDebugInfo
     BuiltIn.Run Keyword And Ignore Error    DataModels.Get Model Dump    ${HA_PROXY_IP}    ${netvirt_data_models}
-    KarafKeywords.Get Karaf Log Events From Test Start    ${test_name}
-    Run Keyword If    "${FAIL_ON_EXCEPTIONS}"=="True"    Fail If Exceptions Found During Test    ${test_name}    ${NETVIRT_EXCEPTIONS_WHITELIST}
+    Run Keyword If    "${FAIL_ON_EXCEPTIONS}"=="True"    KarafKeywords.Fail If Exceptions Found During Test    ${test_name}
 
 Get Test Teardown Debugs For SFC
     [Arguments]    ${test_name}=${TEST_NAME}
@@ -904,7 +922,7 @@ Wait For Routes To Propogate
     \    ${is_ipv6} =    String.Get Regexp Matches    @{subnets}[${INDEX}]    ${IP6_REGEX}
     \    ${length} =    BuiltIn.Get Length    ${is_ipv6}
     \    ${cmd} =    BuiltIn.Set Variable If    ${length} == 0    ip route    ip -6 route
-    \    ${output} =    Utils.Write Commands Until Expected Prompt    sudo ip netns exec qdhcp-${net_id} ${cmd}    ]>
+    \    ${output} =    Utils.Write Commands Until Expected Prompt    sudo ip netns exec qdhcp-${net_id} ${cmd}    ${DEFAULT_LINUX_PROMPT_STRICT}
     \    BuiltIn.Should Contain    ${output}    @{subnets}[${INDEX}]
 
 Neutron Cleanup
@@ -991,6 +1009,8 @@ Cleanup Router
 OpenStack Suite Setup
     [Documentation]    Wrapper teardown keyword that can be used in any suite running in an openstack environement
     SetupUtils.Setup_Utils_For_Setup_And_Teardown
+    @{loggers} =    BuiltIn.Create List    org.apache.karaf.shell.support.ShellUtil    org.apache.sshd.server.session.ServerSessionImpl
+    Setuputils.Setup_Logging_For_Debug_Purposes_On_List_Or_All    OFF    ${loggers}
     DevstackUtils.Devstack Suite Setup
     @{tcpdump_port_6653_conn_ids} =    OpenStackOperations.Start Packet Capture On Nodes    tcpdump_port_6653    port 6653    @{OS_ALL_IPS}
     BuiltIn.Set Suite Variable    @{tcpdump_port_6653_conn_ids}