Add suite setup keywords
[integration/test.git] / csit / suites / openstack / connectivity / l2.robot
index c38eac350e6350ff4fce58f62223ad26c78a6a21..b1c51114bb3010b436c480e7e9f13fce03527472 100644 (file)
@@ -1,7 +1,6 @@
 *** Settings ***
 Documentation     Test suite to verify packet flows between vm instances.
-Suite Setup       BuiltIn.Run Keywords    SetupUtils.Setup_Utils_For_Setup_And_Teardown
-...               AND    DevstackUtils.Devstack Suite Setup
+Suite Setup       Suite Setup
 Suite Teardown    OpenStackOperations.OpenStack Suite Teardown
 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
 Test Teardown     OpenStackOperations.Get Test Teardown Debugs
@@ -26,50 +25,6 @@ ${SECURITY_GROUP}    l2_sg
 ${NET_1_VLAN_ID}    1121
 
 *** Test Cases ***
-Create VLAN Network net_1
-    [Documentation]    Create Network with neutron request.
-    # in the case that the controller under test is using legacy netvirt features, vlan segmentation is not supported,
-    # and we cannot create a vlan network. If those features are installed we will instead stick with vxlan.
-    ${feature_check_status} =    OpenStackOperations.Is Feature Installed    ${legacy_feature_list}
-    BuiltIn.Run Keyword If    '${feature_check_status}' == 'True'    OpenStackOperations.Create Network    @{NETWORKS}[0]
-    ...    ELSE    OpenStackOperations.Create Network    @{NETWORKS}[0]    --provider-network-type vlan --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK} --provider-segment ${NET_1_VLAN_ID}
-
-Create Subnet For net_1
-    [Documentation]    Create Sub Nets for the Networks with neutron request.
-    OpenStackOperations.Create SubNet    @{NETWORKS}[0]    @{SUBNETS}[0]    @{SUBNET_CIDRS}[0]
-
-Create VXLAN Network net_2
-    [Documentation]    Create Network with neutron request.
-    OpenStackOperations.Create Network    @{NETWORKS}[1]
-
-Create Subnet For net_2
-    [Documentation]    Create Sub Nets for the Networks with neutron request.
-    OpenStackOperations.Create SubNet    @{NETWORKS}[1]    @{SUBNETS}[1]    @{SUBNET_CIDRS}[1]
-
-Add Ssh Allow All Rule
-    [Documentation]    Allow all TCP/UDP/ICMP packets for this suite
-    OpenStackOperations.Create Allow All SecurityGroup    ${SECURITY_GROUP}
-
-Create Vm Instances For net_1
-    [Documentation]    Create Vm instances using flavor and image names for a network.
-    OpenStackOperations.Create Vm Instances    @{NETWORKS}[0]    ${NET_1_VMS}    sg=${SECURITY_GROUP}
-
-Create Vm Instances For net_2
-    [Documentation]    Create Vm instances using flavor and image names for a network.
-    OpenStackOperations.Create Vm Instances    @{NETWORKS}[1]    ${NET_2_VMS}    sg=${SECURITY_GROUP}
-
-Check Vm Instances Have Ip Address
-    @{NET_1_VM_IPS}    ${NET_1_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_1_VMS}
-    @{NET_2_VM_IPS}    ${NET_2_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_2_VMS}
-    BuiltIn.Set Suite Variable    @{NET_1_VM_IPS}
-    BuiltIn.Set Suite Variable    @{NET_2_VM_IPS}
-    BuiltIn.Should Not Contain    ${NET_1_VM_IPS}    None
-    BuiltIn.Should Not Contain    ${NET_2_VM_IPS}    None
-    BuiltIn.Should Not Contain    ${NET_1_DHCP_IP}    None
-    BuiltIn.Should Not Contain    ${NET_2_DHCP_IP}    None
-    [Teardown]    BuiltIn.Run Keywords    OpenStackOperations.Show Debugs    @{NET_1_VMS}    @{NET_2_VMS}
-    ...    AND    OpenStackOperations.Get Test Teardown Debugs
-
 Ping Vm Instance1 In net_1
     [Documentation]    Check reachability of vm instances by pinging to them.
     OpenStackOperations.Ping Vm From DHCP Namespace    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]
@@ -119,41 +74,36 @@ Connectivity Tests From Vm Instance3 In net_2
     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_VM_IPS}[2]    ${NET_2_VM_IPS}
 
 Delete A Vm Instance
-    [Documentation]    Delete Vm instances using instance names.
+    [Documentation]    Delete Vm instances using instance names. Also remove the VM from the
+    ...    list so that later cleanup will not try to delete it.
     OpenStackOperations.Delete Vm Instance    @{NET_1_VMS}[0]
+    Remove From List    ${NET_1_VMS}    0
 
 No Ping For Deleted Vm
     [Documentation]    Check non reachability of deleted vm instances by pinging to them.
     OpenStackOperations.Ping From DHCP Should Not Succeed    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]
 
-Delete Vm Instances In net_1
-    [Documentation]    Delete Vm instances using instance names in net_1.
-    : FOR    ${vm}    IN    @{NET_1_VMS}
-    \    OpenStackOperations.Delete Vm Instance    ${vm}
-
-Delete Vm Instances In net_2
-    [Documentation]    Delete Vm instances using instance names in net_2.
-    : FOR    ${vm}    IN    @{NET_2_VMS}
-    \    OpenStackOperations.Delete Vm Instance    ${vm}
-
-Delete Sub Network In net_1
-    [Documentation]    Delete Sub Net for the Networks with neutron request.
-    OpenStackOperations.Delete SubNet    @{SUBNETS}[0]
-
-Delete Sub Network In net_2
-    [Documentation]    Delete Sub Net for the Networks with neutron request.
-    OpenStackOperations.Delete SubNet    @{SUBNETS}[1]
-
-Delete Networks
-    [Documentation]    Delete Networks with neutron request.
-    : FOR    ${networks}    IN    @{NETWORKS}
-    \    OpenStackOperations.Delete Network    ${networks}
-
-Delete Security Group
-    [Documentation]    Delete security group with neutron request
-    OpenStackOperations.Delete SecurityGroup    ${SECURITY_GROUP}
-
-Verify Flows Cleanup
-    [Documentation]    Verify that flows have been cleaned up properly after removing all neutron configurations
-    ${feature_check_status}=    Run Keyword And Return Status    Verify Feature Is Installed    odl-vtn-manager-neutron
-    BuiltIn.Run Keyword If    '${feature_check_status}' != 'True'    DataModels.Verify Flows Are Cleaned Up On All OpenStack Nodes
+*** Keywords ***
+Suite Setup
+    OpenStackOperations.OpenStack Suite Setup
+    OpenStackOperations.Create Network    @{NETWORKS}[0]    --provider-network-type vlan --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK} --provider-segment ${NET_1_VLAN_ID}
+    OpenStackOperations.Create SubNet    @{NETWORKS}[0]    @{SUBNETS}[0]    @{SUBNET_CIDRS}[0]
+    OpenStackOperations.Create Network    @{NETWORKS}[1]
+    OpenStackOperations.Create SubNet    @{NETWORKS}[1]    @{SUBNETS}[1]    @{SUBNET_CIDRS}[1]
+    OpenStackOperations.Create Allow All SecurityGroup    ${SECURITY_GROUP}
+    OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
+    OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[1]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
+    OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    @{NET_1_VMS}[2]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
+    OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[0]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
+    OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[1]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
+    OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    @{NET_2_VMS}[2]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
+    @{NET_1_VM_IPS}    ${NET_1_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_1_VMS}
+    @{NET_2_VM_IPS}    ${NET_2_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_2_VMS}
+    BuiltIn.Set Suite Variable    @{NET_1_VM_IPS}
+    BuiltIn.Set Suite Variable    @{NET_2_VM_IPS}
+    BuiltIn.Should Not Contain    ${NET_1_VM_IPS}    None
+    BuiltIn.Should Not Contain    ${NET_2_VM_IPS}    None
+    BuiltIn.Should Not Contain    ${NET_1_DHCP_IP}    None
+    BuiltIn.Should Not Contain    ${NET_2_DHCP_IP}    None
+    OpenStackOperations.Show Debugs    @{NET_1_VMS}    @{NET_2_VMS}
+    OpenStackOperations.Get Suite Debugs