Reduce logging in collect ips
[integration/test.git] / csit / suites / openstack / connectivity / 02_l3_tests.robot
index ab48df20895f2593a6ad9eb8649dafeb9b914631..8f58e351b036b05a92ae2394826c07562a2d11c1 100644 (file)
@@ -1,49 +1,88 @@
 *** Settings ***
 Documentation     Test suite to check connectivity in L3 using routers.
-Suite Setup       Devstack Suite Setup Tests
+Suite Setup       BuiltIn.Run Keywords    SetupUtils.Setup_Utils_For_Setup_And_Teardown
+...               AND    DevstackUtils.Devstack Suite Setup
 Suite Teardown    Close All Connections
-Test Setup        Log Testcase Start To Controller Karaf
+Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+Test Teardown     Get Test Teardown Debugs
 Library           SSHLibrary
 Library           OperatingSystem
 Library           RequestsLibrary
-Resource          ../../../libraries/Utils.robot
-Resource          ../../../libraries/OpenStackOperations.robot
 Resource          ../../../libraries/DevstackUtils.robot
+Resource          ../../../libraries/DataModels.robot
+Resource          ../../../libraries/OpenStackOperations.robot
+Resource          ../../../libraries/SetupUtils.robot
+Resource          ../../../libraries/Utils.robot
+Resource          ../../../variables/netvirt/Variables.robot
 
 *** Variables ***
-@{NETWORKS_NAME}    network_1    network_2
-@{SUBNETS_NAME}    subnet_1    subnet_2
-@{NET_1_VM_INSTANCES}    l3_instance_net_1_1    l3_instance_net_1_2    l3_instance_net_1_3
-@{NET_2_VM_INSTANCES}    l3_instance_net_2_1    l3_instance_net_2_2    l3_instance_net_2_3
-@{NET_1_VM_IPS}    50.0.0.3    50.0.0.4    50.0.0.5
-@{NET_2_VM_IPS}    60.0.0.3    60.0.0.4    60.0.0.5
-@{GATEWAY_IPS}    50.0.0.1    60.0.0.1
-@{DHCP_IPS}       50.0.0.2    60.0.0.2
-@{SUBNETS_RANGE}    50.0.0.0/24    60.0.0.0/24
+${SECURITY_GROUP}    sg-connectivity
+@{NETWORKS_NAME}    network_1    network_2    network_3
+@{SUBNETS_NAME}    subnet_1    subnet_2    subnet_3
+@{NET_1_VM_INSTANCES}    l3_net_1_vm_1    l3_net_1_vm_2    l3_net_1_vm_3
+@{NET_2_VM_INSTANCES}    l3_net_2_vm_1    l3_net_2_vm_2    l3_net_2_vm_3
+@{NET_3_VM_INSTANCES}    l3_net_3_vm_1    l3_net_3_vm_2    l3_net_3_vm_3
+@{SUBNETS_RANGE}    50.0.0.0/24    60.0.0.0/24    70.0.0.0/24
+${network1_vlan_id}    1236
 
 *** Test Cases ***
-Create Networks
+Create VLAN Network (network_1)
     [Documentation]    Create Network with neutron request.
-    : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
-    \    Create Network    ${NetworkElement}
+    # 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.
+    : FOR    ${feature_name}    IN    @{legacy_feature_list}
+    \    ${feature_check_status}=    Run Keyword And Return Status    Verify Feature Is Installed    ${feature_name}
+    \    Exit For Loop If    '${feature_check_status}' == 'True'
+    Run Keyword If    '${feature_check_status}' == 'True'    Create Network    @{NETWORKS_NAME}[0]
+    ...    ELSE    Create Network    @{NETWORKS_NAME}[0]    --provider-network-type vlan --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK} --provider-segment ${network1_vlan_id}
+
+Create VXLAN Network (network_2)
+    [Documentation]    Create Network with neutron request.
+    Create Network    @{NETWORKS_NAME}[1]
+
+Create VXLAN Network (network_3)
+    [Documentation]    Create Network with neutron request.
+    Create Network    @{NETWORKS_NAME}[2]
 
 Create Subnets For network_1
     [Documentation]    Create Sub Nets for the Networks with neutron request.
-    Create SubNet    network_1    subnet_1    @{SUBNETS_RANGE}[0]
+    Create SubNet    @{NETWORKS_NAME}[0]    @{SUBNETS_NAME}[0]    @{SUBNETS_RANGE}[0]
 
 Create Subnets For network_2
     [Documentation]    Create Sub Nets for the Networks with neutron request.
-    Create SubNet    network_2    subnet_2    @{SUBNETS_RANGE}[1]
+    Create SubNet    @{NETWORKS_NAME}[1]    @{SUBNETS_NAME}[1]    @{SUBNETS_RANGE}[1]
+
+Create Subnets For network_3
+    [Documentation]    Create Sub Nets for the Networks with neutron request.
+    Create SubNet    @{NETWORKS_NAME}[2]    @{SUBNETS_NAME}[2]    @{SUBNETS_RANGE}[2]
 
 Create Vm Instances For network_1
     [Documentation]    Create Four Vm instances using flavor and image names for a network.
-    Create Vm Instances    network_1    ${NET_1_VM_INSTANCES}
-    [Teardown]    Show Debugs    ${NET_1_VM_INSTANCES}
+    Create Vm Instances    network_1    ${NET_1_VM_INSTANCES}    sg=${SECURITY_GROUP}
 
 Create Vm Instances For network_2
     [Documentation]    Create Four Vm instances using flavor and image names for a network.
-    Create Vm Instances    network_2    ${NET_2_VM_INSTANCES}
-    [Teardown]    Show Debugs    ${NET_2_VM_INSTANCES}
+    Create Vm Instances    network_2    ${NET_2_VM_INSTANCES}    sg=${SECURITY_GROUP}
+
+Create Vm Instances For network_3
+    [Documentation]    Create Four Vm instances using flavor and image names for a network.
+    Create Vm Instances    network_3    ${NET_3_VM_INSTANCES}    sg=${SECURITY_GROUP}
+
+Check Vm Instances Have Ip Address
+    @{NET1_L3_VM_IPS}    ${NET1_L3_DHCP_IP} =    Get VM IPs    @{NET_1_VM_INSTANCES}
+    @{NET2_L3_VM_IPS}    ${NET2_L3_DHCP_IP} =    Get VM IPs    @{NET_2_VM_INSTANCES}
+    @{NET3_L3_VM_IPS}    ${NET3_L3_DHCP_IP} =    Get VM IPs    @{NET_3_VM_INSTANCES}
+    Set Suite Variable    ${NET1_L3_VM_IPS}
+    Set Suite Variable    ${NET2_L3_VM_IPS}
+    Set Suite Variable    ${NET3_L3_VM_IPS}
+    Should Not Contain    ${NET1_L3_VM_IPS}    None
+    Should Not Contain    ${NET2_L3_VM_IPS}    None
+    Should Not Contain    ${NET3_L3_VM_IPS}    None
+    Should Not Contain    ${NET1_L3_DHCP_IP}    None
+    Should Not Contain    ${NET2_L3_DHCP_IP}    None
+    Should Not Contain    ${NET3_L3_DHCP_IP}    None
+    [Teardown]    Run Keywords    Show Debugs    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}    @{NET_3_VM_INSTANCES}
+    ...    AND    Get Test Teardown Debugs
 
 Create Routers
     [Documentation]    Create Router
@@ -54,77 +93,77 @@ Add Interfaces To Router
     : FOR    ${interface}    IN    @{SUBNETS_NAME}
     \    Add Router Interface    router_1    ${interface}
 
-Ping Vm Instance1 In network_2 From network_1
+Ping Vm Instance1 In network_2 From network_1(vxlan to vlan)
+    [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
+    Ping Vm From DHCP Namespace    network_1    @{NET2_L3_VM_IPS}[0]
+
+Ping Vm Instance2 In network_2 From network_1(vxlan to vlan)
     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
-    Ping Vm From DHCP Namespace    network_1    @{NET_2_VM_IPS}[0]
+    Ping Vm From DHCP Namespace    network_1    @{NET2_L3_VM_IPS}[1]
 
-Ping Vm Instance2 In network_2 From network_1
+Ping Vm Instance3 In network_2 From network_1(vxlan to vlan)
     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
-    Ping Vm From DHCP Namespace    network_1    @{NET_2_VM_IPS}[1]
+    Ping Vm From DHCP Namespace    network_1    @{NET2_L3_VM_IPS}[2]
 
-Ping Vm Instance3 In network_2 From network_1
+Ping Vm Instance1 In network_1 From network_2(vlan to vxlan)
     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
-    Ping Vm From DHCP Namespace    network_1    @{NET_2_VM_IPS}[2]
+    Ping Vm From DHCP Namespace    network_2    @{NET1_L3_VM_IPS}[0]
 
-Ping Vm Instance1 In network_1 From network_2
+Ping Vm Instance2 In network_1 From network_2(vlan to vxlan)
     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
-    Ping Vm From DHCP Namespace    network_2    @{NET_1_VM_IPS}[0]
+    Ping Vm From DHCP Namespace    network_2    @{NET1_L3_VM_IPS}[1]
 
-Ping Vm Instance2 In network_1 From network_2
+Ping Vm Instance3 In network_1 From network_2(vlan to vxlan)
     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
-    Ping Vm From DHCP Namespace    network_2    @{NET_1_VM_IPS}[1]
+    Ping Vm From DHCP Namespace    network_2    @{NET1_L3_VM_IPS}[2]
 
-Ping Vm Instance3 In network_1 From network_2
+Ping Vm Instance1 In network_3 From network_2(vxlan to vxlan)
     [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
-    Ping Vm From DHCP Namespace    network_2    @{NET_1_VM_IPS}[2]
+    Ping Vm From DHCP Namespace    network_2    @{NET3_L3_VM_IPS}[0]
+
+Ping Vm Instance2 In network_3 From network_2(vxlan to vxlan)
+    [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
+    Ping Vm From DHCP Namespace    network_2    @{NET3_L3_VM_IPS}[1]
+
+Ping Vm Instance3 In network_3 From network_2(vxlan to vxlan)
+    [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
+    Ping Vm From DHCP Namespace    network_2    @{NET3_L3_VM_IPS}[2]
 
 Connectivity Tests From Vm Instance1 In network_1
-    [Documentation]    Logging to the vm instance using generated key pair.
-    ${dst_ip_list}=    Create List    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
-    Log    ${dst_ip_list}
-    ${other_dst_ip_list}=    Create List    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[0]    @{NET_2_VM_IPS}[1]    @{NET_2_VM_IPS}[2]
-    Log    ${other_dst_ip_list}
-    Test Operations From Vm Instance    network_1    @{NET_1_VM_IPS}[0]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
+    [Documentation]    Login to the VM instance and test operations
+    ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
+    Log    ${dst_list}
+    Test Operations From Vm Instance    network_1    @{NET1_L3_VM_IPS}[0]    ${dst_list}
 
 Connectivity Tests From Vm Instance2 In network_1
-    [Documentation]    Logging to the vm instance using generated key pair.
-    ${dst_ip_list}=    Create List    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
-    Log    ${dst_ip_list}
-    ${other_dst_ip_list}=    Create List    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[0]    @{NET_2_VM_IPS}[1]    @{NET_2_VM_IPS}[2]
-    Log    ${other_dst_ip_list}
-    Test Operations From Vm Instance    network_1    @{NET_1_VM_IPS}[1]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
+    [Documentation]    Login to the vm instance and test operations
+    ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
+    Log    ${dst_list}
+    Test Operations From Vm Instance    network_1    @{NET1_L3_VM_IPS}[1]    ${dst_list}
 
 Connectivity Tests From Vm Instance3 In network_1
-    [Documentation]    Logging to the vm instance using generated key pair.
-    ${dst_ip_list}=    Create List    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
-    Log    ${dst_ip_list}
-    ${other_dst_ip_list}=    Create List    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[0]    @{NET_2_VM_IPS}[1]    @{NET_2_VM_IPS}[2]
-    Log    ${other_dst_ip_list}
-    Test Operations From Vm Instance    network_1    @{NET_1_VM_IPS}[2]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
+    [Documentation]    Login to the vm instance and test operations
+    ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
+    Log    ${dst_list}
+    Test Operations From Vm Instance    network_1    @{NET1_L3_VM_IPS}[2]    ${dst_list}
 
 Connectivity Tests From Vm Instance1 In network_2
-    [Documentation]    Logging to the vm instance using generated key pair.
-    ${dst_ip_list}=    Create List    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[1]    @{NET_2_VM_IPS}[2]
-    Log    ${dst_ip_list}
-    ${other_dst_ip_list}=    Create List    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
-    Log    ${other_dst_ip_list}
-    Test Operations From Vm Instance    network_2    @{NET_2_VM_IPS}[0]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
+    [Documentation]    Login to the vm instance and test operations
+    ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
+    Log    ${dst_list}
+    Test Operations From Vm Instance    network_2    @{NET2_L3_VM_IPS}[0]    ${dst_list}
 
 Connectivity Tests From Vm Instance2 In network_2
     [Documentation]    Logging to the vm instance using generated key pair.
-    ${dst_ip_list}=    Create List    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[0]    @{NET_2_VM_IPS}[2]
-    Log    ${dst_ip_list}
-    ${other_dst_ip_list}=    Create List    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
-    Log    ${other_dst_ip_list}
-    Test Operations From Vm Instance    network_2    @{NET_2_VM_IPS}[1]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
+    ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
+    Log    ${dst_list}
+    Test Operations From Vm Instance    network_2    @{NET2_L3_VM_IPS}[1]    ${dst_list}
 
 Connectivity Tests From Vm Instance3 In network_2
     [Documentation]    Logging to the vm instance using generated key pair.
-    ${dst_ip_list}=    Create List    @{DHCP_IPS}[1]    @{NET_2_VM_IPS}[0]    @{NET_2_VM_IPS}[1]
-    Log    ${dst_ip_list}
-    ${other_dst_ip_list}=    Create List    @{DHCP_IPS}[0]    @{NET_1_VM_IPS}[0]    @{NET_1_VM_IPS}[1]    @{NET_1_VM_IPS}[2]
-    Log    ${other_dst_ip_list}
-    Test Operations From Vm Instance    network_2    @{NET_2_VM_IPS}[2]    ${dst_ip_list}    l2_or_l3=l3    list_of_external_dst_ips=${other_dst_ip_list}
+    ${dst_list}=    Create List    @{NET1_L3_VM_IPS}    @{NET2_L3_VM_IPS}
+    Log    ${dst_list}
+    Test Operations From Vm Instance    network_2    @{NET2_L3_VM_IPS}[2]    ${dst_list}
 
 Delete Vm Instances In network_1
     [Documentation]    Delete Vm instances using instance names in network_1.
@@ -136,6 +175,13 @@ Delete Vm Instances In network_2
     : FOR    ${VmElement}    IN    @{NET_2_VM_INSTANCES}
     \    Delete Vm Instance    ${VmElement}
 
+Delete Vm Instances In network_3
+    [Documentation]    Delete Vm instances using instance names in network_3.
+    : FOR    ${VmElement}    IN    @{NET_3_VM_INSTANCES}
+    \    Delete Vm Instance    ${VmElement}
+    [Teardown]    Run Keywords    Show Debugs    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}    @{NET_3_VM_INSTANCES}
+    ...    AND    Get Test Teardown Debugs
+
 Delete Router Interfaces
     [Documentation]    Remove Interface to the subnets.
     : FOR    ${interface}    IN    @{SUBNETS_NAME}
@@ -153,7 +199,15 @@ Delete Sub Networks In network_2
     [Documentation]    Delete Sub Nets for the Networks with neutron request.
     Delete SubNet    subnet_2
 
+Delete Sub Networks In network_3
+    [Documentation]    Delete Sub Nets for the Networks with neutron request.
+    Delete SubNet    subnet_3
+
 Delete Networks
     [Documentation]    Delete Networks with neutron request.
     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
     \    Delete Network    ${NetworkElement}
+
+Verify Flows Cleanup
+    [Documentation]    Verify that flows have been cleaned up properly after removing all neutron configurations
+    Verify Flows Are Cleaned Up On All OpenStack Nodes