Fix VTN Coordinator and Manager CSIT for Beryllium
[integration/test.git] / csit / libraries / OpenStackOperations.robot
index fee727c4dee67ce038062814f019c463177d2e18..8ed3d26a8c5b7ba5f877e6cbbaea834b4a5477c4 100644 (file)
@@ -84,7 +84,16 @@ Delete Port
     ${output}=    Write Commands Until Prompt    neutron -v port-delete ${port_name}    30s
     Close Connection
     Log    ${output}
-    Should Contain    ${output}    Deleted a new port
+    Should Contain    ${output}    Deleted port: ${port_name}
+
+List Ports
+    [Documentation]    List ports and return output with neutron client.
+    ${devstack_conn_id}=    Get ControlNode Connection
+    Switch Connection    ${devstack_conn_id}
+    ${output}=    Write Commands Until Prompt    neutron port-list    30s
+    Close Connection
+    Log    ${output}
+    [Return]    ${output}
 
 Verify Gateway Ips
     [Documentation]    Verifies the Gateway Ips with dump flow.
@@ -137,7 +146,7 @@ Get Net Id
     [Arguments]    ${network_name}    ${devstack_conn_id}
     [Documentation]    Retrieve the net id for the given network name to create specific vm instance
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron net-list | grep "${network_name}" | get_field 1    30s
+    ${output}=    Write Commands Until Prompt    neutron net-list | grep "${network_name}" | awk '{print $2}'    30s
     Log    ${output}
     ${splitted_output}=    Split String    ${output}    ${EMPTY}
     ${net_id}=    Get from List    ${splitted_output}    0
@@ -148,12 +157,26 @@ Get Port Id
     [Arguments]    ${port_name}    ${devstack_conn_id}
     [Documentation]    Retrieve the port id for the given port name to attach specific vm instance to a particular port
     Switch Connection    ${devstack_conn_id}
-    ${port_id}=    Write Commands Until Prompt    neutron port-list | grep "${port_name}" | awk '{print $2}'    30s
+    ${output}=    Write Commands Until Prompt    neutron port-list | grep "${port_name}" | awk '{print $2}'    30s
+    Log    ${output}
+    ${splitted_output}=    Split String    ${output}    ${EMPTY}
+    ${port_id}=    Get from List    ${splitted_output}    0
     Log    ${port_id}
     [Return]    ${port_id}
 
+Get Router Id
+    [Arguments]    ${router1}    ${devstack_conn_id}
+    [Documentation]    Retrieve the net id for the given network name to create specific vm instance
+    Switch Connection    ${devstack_conn_id}
+    ${output}=    Write Commands Until Prompt    neutron router-list | grep "${router1}" | awk '{print $2}'    30s
+    Log    ${output}
+    ${splitted_output}=    Split String    ${output}    ${EMPTY}
+    ${router_id}=    Get from List    ${splitted_output}    0
+    Log    ${router_id}
+    [Return]    ${router_id}
+
 Create Vm Instances
-    [Arguments]    ${net_name}    ${vm_instance_names}    ${image}=cirros-0.3.4-x86_64-uec    ${flavor}=m1.nano      ${sg}=default
+    [Arguments]    ${net_name}    ${vm_instance_names}    ${image}=cirros-0.3.4-x86_64-uec    ${flavor}=m1.nano    ${sg}=default
     [Documentation]    Create X Vm Instance with the net id of the Netowrk.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
@@ -271,6 +294,7 @@ Test Operations From Vm Instance
     ${rcode}=    Run Keyword And Return Status    Check If Console Is VmInstance
     Run Keyword If    ${rcode}    Write Commands Until Expected Prompt    ifconfig    ${OS_SYSTEM_PROMPT}
     Run Keyword If    ${rcode}    Write Commands Until Expected Prompt    route    ${OS_SYSTEM_PROMPT}
+    Run Keyword If    ${rcode}    Write Commands Until Expected Prompt    arp -an    ${OS_SYSTEM_PROMPT}
     ${dest_vm}=    Get From List    ${list_of_local_dst_ips}    0
     Log    ${dest_vm}
     Run Keyword If    ${rcode}    Check Ping    ${dest_vm}
@@ -351,6 +375,7 @@ Get DumpFlows And Ovsconfig
     \    Write Commands Until Expected Prompt    sudo ip netns exec ${line} ip -o addr    ]>
     \    Write Commands Until Expected Prompt    sudo ip netns exec ${line} ip route    ]>
     Write Commands Until Expected Prompt    sudo ovs-vsctl show    ]>
+    Write Commands Until Expected Prompt    sudo ovs-vsctl list Open_vSwitch    ]>
     Write Commands Until Expected Prompt    sudo ovs-ofctl show br-int -OOpenFlow13    ]>
     Write Commands Until Expected Prompt    sudo ovs-ofctl dump-flows br-int -OOpenFlow13    ]>
     Write Commands Until Expected Prompt    sudo ovs-ofctl dump-groups br-int -OOpenFlow13    ]>
@@ -380,16 +405,19 @@ Show Debugs
     \    ${output}=    Write Commands Until Prompt    nova show ${index}    30s
     \    Log    ${output}
     Close Connection
+    List Networks
+    List Subnets
+    List Ports
 
 Create Security Group
-    [Arguments]    ${sg_name}     ${desc}
+    [Arguments]    ${sg_name}    ${desc}
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    nova secgroup-create ${sg_name} ${desc}      40s
+    ${output}=    Write Commands Until Prompt    nova secgroup-create ${sg_name} ${desc}    40s
     Close Connection
 
 Create Security Rule
-    [Arguments]    ${direction}     ${protocol}      ${min_port}     ${max_port}     ${remote_ip}     ${sg_name}
+    [Arguments]    ${direction}    ${protocol}    ${min_port}    ${max_port}    ${remote_ip}    ${sg_name}
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
     ${output}=    Write Commands Until Prompt    neutron security-group-rule-create --direction ${direction} --protocol ${protocol} --port-range-min ${min_port} --port-range-max ${max_port} --remote-ip-prefix ${remote_ip} ${sg_name}