Update l2 tests for combo nodes
[integration/test.git] / csit / libraries / OpenStackOperations.robot
index 5d64a0656b1fa3808f7024cf870eee8be8b13e39..9fc431d06f1b7eaeda44f503df17645206f279b0 100644 (file)
@@ -544,9 +544,8 @@ Get ControlNode Connection
 
 Get OvsDebugInfo
     [Documentation]    Get the OvsConfig and Flow entries from all Openstack nodes
-    BuiltIn.Run Keyword If    0 < ${NUM_OS_SYSTEM}    OpenStackOperations.Get DumpFlows And Ovsconfig    ${OS_CNTL_CONN_ID}
-    BuiltIn.Run Keyword If    1 < ${NUM_OS_SYSTEM}    OpenStackOperations.Get DumpFlows And Ovsconfig    ${OS_CMP1_CONN_ID}
-    BuiltIn.Run Keyword If    2 < ${NUM_OS_SYSTEM}    OpenStackOperations.Get DumpFlows And Ovsconfig    ${OS_CMP2_CONN_ID}
+    : FOR    ${conn_id}    IN    @{OS_ALL_CONN_IDS}
+    \    OpenStackOperations.Get DumpFlows And Ovsconfig    ${conn_id}
 
 Get Test Teardown Debugs
     [Arguments]    ${test_name}=${SUITE_NAME}.${TEST_NAME}
@@ -659,19 +658,15 @@ Delete All Security Group Rules
     \    ${output} =    OpenStack CLI    openstack security group rule delete ${rule}
 
 Create Allow All SecurityGroup
-    [Arguments]    ${sg_name}    ${ether_type}=IPv4    ${additional_args}=${EMPTY}
+    [Arguments]    ${sg_name}    ${ether_type}=IPv4
     [Documentation]    Allow all TCP/UDP/ICMP packets for this suite
     OpenStackOperations.Neutron Security Group Create    ${sg_name}
     OpenStackOperations.Neutron Security Group Rule Create    ${sg_name}    direction=ingress    ethertype=${ether_type}    port_range_max=65535    port_range_min=1    protocol=tcp
-    ...    ${additional_args}
     OpenStackOperations.Neutron Security Group Rule Create    ${sg_name}    direction=egress    ethertype=${ether_type}    port_range_max=65535    port_range_min=1    protocol=tcp
-    ...    ${additional_args}
-    OpenStackOperations.Neutron Security Group Rule Create    ${sg_name}    direction=ingress    ethertype=${ether_type}    protocol=icmp    ${additional_args}
-    OpenStackOperations.Neutron Security Group Rule Create    ${sg_name}    direction=egress    ethertype=${ether_type}    protocol=icmp    ${additional_args}
+    OpenStackOperations.Neutron Security Group Rule Create    ${sg_name}    direction=ingress    ethertype=${ether_type}    protocol=icmp
+    OpenStackOperations.Neutron Security Group Rule Create    ${sg_name}    direction=egress    ethertype=${ether_type}    protocol=icmp
     OpenStackOperations.Neutron Security Group Rule Create    ${sg_name}    direction=ingress    ethertype=${ether_type}    port_range_max=65535    port_range_min=1    protocol=udp
-    ...    ${additional_args}
     OpenStackOperations.Neutron Security Group Rule Create    ${sg_name}    direction=egress    ethertype=${ether_type}    port_range_max=65535    port_range_min=1    protocol=udp
-    ...    ${additional_args}
 
 Create Neutron Port With Additional Params
     [Arguments]    ${network_name}    ${port_name}    ${additional_args}=${EMPTY}
@@ -936,8 +931,7 @@ Neutron Cleanup
 OpenStack List All
     [Documentation]    Get a list of different OpenStack resources that might be in use.
     @{modules} =    BuiltIn.Create List    server    port    network    subnet    security group
-    ...    security group rule
-    BuiltIn.Run Keyword If    "${ODL_ENABLE_L3_FWD}"=="yes"    Collections.Append To List    ${modules}    floating ip    router
+    ...    security group rule    floating ip    router
     : FOR    ${module}    IN    @{modules}
     \    ${output} =    OpenStack CLI    openstack ${module} list
 
@@ -968,15 +962,13 @@ OpenStack CLI With No Log
 OpenStack Cleanup All
     [Documentation]    Cleanup all Openstack resources with best effort. The keyword will query for all resources
     ...    in use and then attempt to delete them. Errors are ignored to allow the cleanup to continue.
-    @{fips} =    BuiltIn.Run Keyword If    "${ODL_ENABLE_L3_FWD}"=="yes"    OpenStack CLI Get List    openstack floating ip list -f json
-    ...    ELSE    BuiltIn.Create List    @{EMPTY}
+    @{fips} =    OpenStack CLI Get List    openstack floating ip list -f json
     : FOR    ${fip}    IN    @{fips}
     \    BuiltIn.Run Keyword And Ignore Error    Delete Floating IP    ${fip['ID']}
     @{vms} =    OpenStack CLI Get List    openstack server list -f json
     : FOR    ${vm}    IN    @{vms}
     \    BuiltIn.Run Keyword And Ignore Error    Delete Vm Instance    ${vm['ID']}
-    @{routers} =    BuiltIn.Run Keyword If    "${ODL_ENABLE_L3_FWD}"=="yes"    OpenStack CLI Get List    openstack router list -f json
-    ...    ELSE    BuiltIn.Create List    @{EMPTY}
+    @{routers} =    OpenStack CLI Get List    openstack router list -f json
     : FOR    ${router}    IN    @{routers}
     \    BuiltIn.Run Keyword And Ignore Error    Cleanup Router    ${router['ID']}
     @{ports} =    OpenStack CLI Get List    openstack port list -f json
@@ -1012,6 +1004,7 @@ OpenStack Suite Setup
     BuiltIn.Run Keyword If    "${PRE_CLEAN_OPENSTACK_ALL}"=="True"    OpenStack Cleanup All
     OpenStackOperations.Add OVS Logging On All OpenStack Nodes
     ClusterManagement.Dump_Local_Shards_For_Each_Member
+    Verify Expected Default Tables On Nodes
 
 OpenStack Suite Teardown
     [Documentation]    Wrapper teardown keyword that can be used in any suite running in an openstack environement
@@ -1042,15 +1035,13 @@ Is Feature Installed
 
 Add OVS Logging On All OpenStack Nodes
     [Documentation]    Add higher levels of OVS logging to all the OpenStack nodes
-    BuiltIn.Run Keyword If    0 < ${NUM_OS_SYSTEM}    OVSDB.Add OVS Logging    ${OS_CNTL_CONN_ID}
-    BuiltIn.Run Keyword If    1 < ${NUM_OS_SYSTEM}    OVSDB.Add OVS Logging    ${OS_CMP1_CONN_ID}
-    BuiltIn.Run Keyword If    2 < ${NUM_OS_SYSTEM}    OVSDB.Add OVS Logging    ${OS_CMP2_CONN_ID}
+    : FOR    ${conn_id}    IN    @{OS_ALL_CONN_IDS}
+    \    OVSDB.Add OVS Logging    ${conn_id}
 
 Reset OVS Logging On All OpenStack Nodes
     [Documentation]    Reset the OVS logging to all the OpenStack nodes
-    BuiltIn.Run Keyword If    0 < ${NUM_OS_SYSTEM}    OVSDB.Reset OVS Logging    ${OS_CNTL_CONN_ID}
-    BuiltIn.Run Keyword If    1 < ${NUM_OS_SYSTEM}    OVSDB.Reset OVS Logging    ${OS_CMP1_CONN_ID}
-    BuiltIn.Run Keyword If    2 < ${NUM_OS_SYSTEM}    OVSDB.Reset OVS Logging    ${OS_CMP2_CONN_ID}
+    : FOR    ${conn_id}    IN    @{OS_ALL_CONN_IDS}
+    \    OVSDB.Reset OVS Logging    ${conn_id}
 
 Start Packet Capture On Nodes
     [Arguments]    ${tag}    ${filter}    @{ips}
@@ -1108,6 +1099,20 @@ Get Network Segmentation Id
     @{list} =    String.Split String    ${output}
     [Return]    @{list}[0]
 
+Verify Expected Default Tables On Nodes
+    [Arguments]    ${node_ips}=@{OS_ALL_IPS}
+    [Documentation]    Verify if Default Table Entries are programmed on all Nodes
+    : FOR    ${node_ip}    IN    @{node_ips}
+    \    Verify Expected Default Tables    ${node_ip}
+
+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}
+    BuiltIn.Log    ${flow_dump}
+    : FOR    ${table}    IN    @{DEFAULT_FLOW_TABLES}
+    \    Builtin.Should Match Regexp    ${flow_dump}    .*table=${table}.*priority=0
+
 Get Project Id
     [Arguments]    ${project_name}
     [Documentation]    Returns project ID for the given project name.