Reduce logging in model dumps
[integration/test.git] / csit / suites / openstack / extensions / sfc.robot
index 51fd0c5380cdafda8369b19a5bfbf1051c419ed2..9355baf7269bb2dbca93308319ed2538ab3faff3 100644 (file)
@@ -2,9 +2,11 @@
 Documentation     Test suite to verify SFC configuration and packet flows.
 Suite Setup       BuiltIn.Run Keywords    SetupUtils.Setup_Utils_For_Setup_And_Teardown
 ...               AND    DevstackUtils.Devstack Suite Setup
-Suite Teardown    Close All Connections
+Suite Teardown    BuiltIn.Run Keywords    Delete Configurations
+...               AND    Close All Connections
 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
 Test Teardown     Get Test Teardown Debugs
+...               AND    Get Test Teardown Debugs For SFC
 Library           SSHLibrary
 Library           OperatingSystem
 Library           RequestsLibrary
@@ -15,6 +17,7 @@ Resource          ../../../libraries/Utils.robot
 Resource          ../../../libraries/KarafKeywords.robot
 
 *** Variables ***
+${SECURITY_GROUP}    sg-sfc
 @{NETWORKS_NAME}    network_1
 @{SUBNETS_NAME}    l2_subnet_1
 @{VM_INSTANCES}    sf1    sf2    sf3    source_vm    dest_vm
@@ -32,27 +35,21 @@ Create Subnets For network_1
     Create SubNet    @{NETWORKS_NAME}[0]    @{SUBNETS_NAME}[0]    @{SUBNETS_RANGE}[0]
 
 Add Allow All Rules
-    [Documentation]    Allow all packets for this suite
-    Neutron Security Group Create    sg-sfc
-    Neutron Security Group Rule Create    sg-sfc    direction=ingress    port_range_max=65535    port_range_min=1    protocol=tcp
-    Neutron Security Group Rule Create    sg-sfc    direction=egress    port_range_max=65535    port_range_min=1    protocol=tcp
-    Neutron Security Group Rule Create    sg-sfc    direction=ingress    port_range_max=65535    port_range_min=1    protocol=udp
-    Neutron Security Group Rule Create    sg-sfc    direction=egress    port_range_max=65535    port_range_min=1    protocol=udp
-    Neutron Security Group Rule Create    sg-sfc    direction=ingress    protocol=icmp
-    Neutron Security Group Rule Create    sg-sfc    direction=egress    protocol=icmp
+    [Documentation]    Allow all TCP/UDP/ICMP packets for this suite
+    OpenStackOperations.Create Allow All SecurityGroup    ${SECURITY_GROUP}
 
 Create Neutron Ports
     [Documentation]    Precreate neutron ports to be used for SFC VMs
     : FOR    ${port}    IN    @{PORTS}
-    \    Create Port    @{NETWORKS_NAME}[0]    ${port}    sg=sg-sfc
+    \    Create Port    @{NETWORKS_NAME}[0]    ${port}    sg=${SECURITY_GROUP}
 
 Create Vm Instances
     [Documentation]    Create Four Vm instances using flavor and image names for a network.
-    Create Vm Instance With Ports    p1in    p1out    sf1    sg=sg-sfc
-    Create Vm Instance With Ports    p2in    p2out    sf2    sg=sg-sfc
-    Create Vm Instance With Ports    p3in    p3out    sf3    sg=sg-sfc
-    Create Vm Instance With Port    source_vm_port    source_vm    sg=sg-sfc
-    Create Vm Instance With Port    dest_vm_port    dest_vm    sg=sg-sfc
+    Create Vm Instance With Ports    p1in    p1out    sf1    sg=${SECURITY_GROUP}
+    Create Vm Instance With Ports    p2in    p2out    sf2    sg=${SECURITY_GROUP}
+    Create Vm Instance With Ports    p3in    p3out    sf3    sg=${SECURITY_GROUP}
+    Create Vm Instance With Port    source_vm_port    source_vm    sg=${SECURITY_GROUP}
+    Create Vm Instance With Port    dest_vm_port    dest_vm    sg=${SECURITY_GROUP}
 
 Check Vm Instances Have Ip Address
     [Documentation]    Test case to verify that all created VMs are ready and have received their ip addresses.
@@ -61,7 +58,7 @@ Check Vm Instances Have Ip Address
     # first, ensure all VMs are in ACTIVE state.    if not, we can just fail the test case and not waste time polling
     # for dhcp addresses
     : FOR    ${vm}    IN    @{VM_INSTANCES}
-    \    Wait Until Keyword Succeeds    15s    5s    Verify VM Is ACTIVE    ${vm}
+    \    Poll VM Is ACTIVE    ${vm}
     ${status}    ${message}    Run Keyword And Ignore Error    Wait Until Keyword Succeeds    60s    5s    Collect VM IP Addresses
     ...    true    @{VM_INSTANCES}
     ${NET1_VM_IPS}    ${NET1_DHCP_IP}    Collect VM IP Addresses    false    @{VM_INSTANCES}
@@ -70,7 +67,7 @@ Check Vm Instances Have Ip Address
     ${LOOP_COUNT}    Get Length    ${VM_INSTANCES}
     : FOR    ${index}    IN RANGE    0    ${LOOP_COUNT}
     \    ${status}    ${message}    Run Keyword And Ignore Error    Should Not Contain    @{VM_IPS}[${index}]    None
-    \    Run Keyword If    '${status}' == 'FAIL'    Write Commands Until Prompt    nova console-log @{VM_INSTANCES}[${index}]    30s
+    \    Run Keyword If    '${status}' == 'FAIL'    Write Commands Until Prompt    openstack console log show @{VM_INSTANCES}[${index}]    30s
     Set Suite Variable    ${NET1_VM_IPS}
     Should Not Contain    ${NET1_VM_IPS}    None
     Should Not Contain    ${NET1_DHCP_IP}    None
@@ -117,13 +114,15 @@ Connectivity Tests From Vm Instance1 In network_1
     Test Operations From Vm Instance    network_1    @{NET1_VM_IPS}[3]    ${DEST_VM_LIST}
     Execute Command on VM Instance    @{NETWORKS_NAME}[0]    @{NET1_VM_IPS}[3]    curl http://@{NET1_VM_IPS}[4]
 
-Delete Vm Instances In network_1
-    [Documentation]    Delete Vm instances using instance names in network_1.
+*** Keywords ***
+Delete Configurations
+    [Documentation]    Delete all elements that were created in the test case section. These are done
+    ...    in a local keyword so this can be called as part of the Suite Teardown. When called as part
+    ...    of the Suite Teardown, all steps will be attempted. This prevents robot framework from bailing
+    ...    on the rest of a test case if one step intermittently has trouble and fails. The goal is to attempt
+    ...    to leave the test environment as clean as possible upon completion of this suite.
     : FOR    ${VmElement}    IN    @{VM_INSTANCES}
     \    Delete Vm Instance    ${VmElement}
-
-Delete All SFC Objects
-    [Documentation]    Delete all previously created SFC objects
     Delete SFC Port Chain    PC1
     Delete SFC Port Pair Group    PG1
     Delete SFC Port Pair Group    PG2
@@ -131,17 +130,8 @@ Delete All SFC Objects
     Delete SFC Port Pair    PP2
     Delete SFC Port Pair    PP3
     Delete SFC Flow Classifier    FC_http
-
-Delete Neutron Ports
-    [Documentation]    Delete neutron ports that were used for SFC VMs
     : FOR    ${port}    IN    @{PORTS}
     \    Delete Port    ${port}
-
-Delete Sub Networks In network_1
-    [Documentation]    Delete Sub Nets for the Networks with neutron request.
     Delete SubNet    l2_subnet_1
-
-Delete Networks
-    [Documentation]    Delete Networks with neutron request.
     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
     \    Delete Network    ${NetworkElement}