netvirt-csit: Show neutron debugs only once
[integration/test.git] / csit / libraries / OpenStackOperations.robot
index b41296082263f6c1d8696db3724c48d38fad52f1..62185dd0c2b5b42fa244b6955fd228610c9ad69b 100644 (file)
@@ -67,11 +67,11 @@ Delete Network
     Should Match Regexp    ${output}    Deleted network: ${network_name}|Deleted network\\(s\\): ${network_name}
 
 Create SubNet
-    [Arguments]    ${network_name}    ${subnet}    ${range_ip}
+    [Arguments]    ${network_name}    ${subnet}    ${range_ip}    ${additional_args}=${EMPTY}
     [Documentation]    Create SubNet for the Network with neutron request.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron -v subnet-create ${network_name} ${range_ip} --name ${subnet}    30s
+    ${output}=    Write Commands Until Prompt    neutron -v subnet-create ${network_name} ${range_ip} --name ${subnet} ${additional_args}    30s
     Close Connection
     Log    ${output}
     Should Contain    ${output}    Created a new subnet
@@ -105,6 +105,21 @@ List Ports
     Log    ${output}
     [Return]    ${output}
 
+Create And Associate Floating IPs
+    [Arguments]    ${external_net}    @{vm_list}
+    [Documentation]    Create and associate floating IPs to VMs with nova request
+    ${devstack_conn_id}=    Get ControlNode Connection
+    Switch Connection    ${devstack_conn_id}
+    ${ip_list}=    Create List    @{EMPTY}
+    : FOR    ${vm}    IN    @{vm_list}
+    \    ${output}=    Write Commands Until Prompt    nova floating-ip-create ${external_net} | grep "${external_net}"    30s
+    \    Log    ${output}
+    \    @{output_words}    Split String    ${output}
+    \    Append To List    ${ip_list}    @{output_words}[3]
+    \    ${output}=    Write Commands Until Prompt    nova floating-ip-associate ${vm} @{output_words}[3]    30s
+    \    Log    ${output}
+    [Return]    ${ip_list}
+
 Verify Gateway Ips
     [Documentation]    Verifies the Gateway Ips with dump flow.
     ${output}=    Write Commands Until Prompt    sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
@@ -217,7 +232,7 @@ Verify VM Is ACTIVE
 
 Verify VMs Received DHCP Lease
     [Arguments]    @{vm_list}
-    [Documentation]    Using nova console-log on the provided ${vm_name} to search for the string "obtained" which
+    [Documentation]    Using nova console-log on the provided ${vm_list} to search for the string "obtained" which
     ...    correlates to the instance receiving it's IP address via DHCP. This should provide a good indication
     ...    that the instance is fully up and ready.
     ${devstack_conn_id}=    Get ControlNode Connection
@@ -268,6 +283,17 @@ Ping From DHCP Should Not Succeed
     Log    ${output}
     Should Not Contain    ${output}    64 bytes
 
+Ping Vm From Control Node
+    [Arguments]    ${vm_floating_ip}
+    [Documentation]    Ping VM floating IP from control node
+    Log    ${vm_floating_ip}
+    ${devstack_conn_id}=    Get ControlNode Connection
+    Switch Connection    ${devstack_conn_id}
+    ${output}=    Write Commands Until Prompt    ping -c 3 ${vm_floating_ip}    20s
+    Log    ${output}
+    Close Connection
+    Should Contain    ${output}    64 bytes
+
 Ping From Instance
     [Arguments]    ${dest_vm_ip}
     [Documentation]    Ping to the expected destination ip.
@@ -373,6 +399,14 @@ Add Router Interface
     Close Connection
     Should Contain    ${output}    Added interface
 
+Add Router Gateway
+    [Arguments]    ${router_name}    ${network_name}
+    ${devstack_conn_id}=    Get ControlNode Connection
+    Switch Connection    ${devstack_conn_id}
+    ${output}=    Write Commands Until Prompt    neutron -v router-gateway-set ${router_name} ${network_name}
+    Close Connection
+    Should Contain    ${output}    Set gateway
+
 Remove Interface
     [Arguments]    ${router_name}    ${interface_name}
     [Documentation]    Remove Interface to the subnets.
@@ -447,7 +481,7 @@ Get OvsDebugInfo
     Run Keyword If    2 < ${NUM_OS_SYSTEM}    Get DumpFlows And Ovsconfig    ${OS_COMPUTE_2_IP}
 
 Show Debugs
-    [Arguments]    ${vm_indices}
+    [Arguments]    @{vm_indices}
     [Documentation]    Run these commands for debugging, it can list state of VM instances and ip information in control node
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}