name netvirt suites consistently
[integration/test.git] / csit / suites / openstack / connectivity / l2.robot
1 *** Settings ***
2 Documentation     Test suite to verify packet flows between vm instances.
3 Suite Setup       BuiltIn.Run Keywords    SetupUtils.Setup_Utils_For_Setup_And_Teardown
4 ...               AND    DevstackUtils.Devstack Suite Setup
5 Suite Teardown    Close All Connections
6 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
7 Test Teardown     Get Test Teardown Debugs
8 Library           SSHLibrary
9 Library           OperatingSystem
10 Library           RequestsLibrary
11 Resource          ../../../libraries/DevstackUtils.robot
12 Resource          ../../../libraries/DataModels.robot
13 Resource          ../../../libraries/OpenStackOperations.robot
14 Resource          ../../../libraries/SetupUtils.robot
15 Resource          ../../../libraries/Utils.robot
16 Resource          ../../../libraries/KarafKeywords.robot
17 Resource          ../../../variables/netvirt/Variables.robot
18
19 *** Variables ***
20 ${SECURITY_GROUP}    sg-connectivity
21 @{NETWORKS_NAME}    l2_network_1    l2_network_2
22 @{SUBNETS_NAME}    l2_subnet_1    l2_subnet_2
23 @{NET_1_VM_GRP_NAME}    NET1-VM
24 @{NET_2_VM_GRP_NAME}    NET2-VM
25 @{NET_1_VM_INSTANCES}    NET1-VM-1    NET1-VM-2    NET1-VM-3
26 @{NET_2_VM_INSTANCES}    NET2-VM-1    NET2-VM-2    NET2-VM-3
27 @{SUBNETS_RANGE}    30.0.0.0/24    40.0.0.0/24
28 ${network1_vlan_id}    1235
29
30 *** Test Cases ***
31 Create VLAN Network (l2_network_1)
32     [Documentation]    Create Network with neutron request.
33     # in the case that the controller under test is using legacy netvirt features, vlan segmentation is not supported,
34     # and we cannot create a vlan network. If those features are installed we will instead stick with vxlan.
35     : FOR    ${feature_name}    IN    @{legacy_feature_list}
36     \    ${feature_check_status}=    Run Keyword And Return Status    Verify Feature Is Installed    ${feature_name}
37     \    Exit For Loop If    '${feature_check_status}' == 'True'
38     Run Keyword If    '${feature_check_status}' == 'True'    Create Network    @{NETWORKS_NAME}[0]
39     ...    ELSE    Create Network    @{NETWORKS_NAME}[0]    --provider-network-type vlan --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK} --provider-segment ${network1_vlan_id}
40
41 Create VXLAN Network (l2_network_2)
42     [Documentation]    Create Network with neutron request.
43     Create Network    @{NETWORKS_NAME}[1]
44
45 Create Subnets For l2_network_1
46     [Documentation]    Create Sub Nets for the Networks with neutron request.
47     Create SubNet    @{NETWORKS_NAME}[0]    @{SUBNETS_NAME}[0]    @{SUBNETS_RANGE}[0]
48
49 Create Subnets For l2_network_2
50     [Documentation]    Create Sub Nets for the Networks with neutron request.
51     Create SubNet    @{NETWORKS_NAME}[1]    @{SUBNETS_NAME}[1]    @{SUBNETS_RANGE}[1]
52
53 Add Ssh Allow Rule
54     [Documentation]    Allow all TCP/UDP/ICMP packets for this suite
55     OpenStackOperations.Create Allow All SecurityGroup    ${SECURITY_GROUP}
56
57 Create Vm Instances For l2_network_1
58     [Documentation]    Create Four Vm instances using flavor and image names for a network.
59     Create Vm Instances    l2_network_1    ${NET_1_VM_GRP_NAME}    sg=${SECURITY_GROUP}    min=3    max=3
60
61 Create Vm Instances For l2_network_2
62     [Documentation]    Create Four Vm instances using flavor and image names for a network.
63     Create Vm Instances    l2_network_2    ${NET_2_VM_GRP_NAME}    sg=${SECURITY_GROUP}    min=3    max=3
64
65 Check Vm Instances Have Ip Address
66     @{NET1_VM_IPS}    ${NET1_DHCP_IP} =    Get VM IPs    @{NET_1_VM_INSTANCES}
67     @{NET2_VM_IPS}    ${NET2_DHCP_IP} =    Get VM IPs    @{NET_2_VM_INSTANCES}
68     Set Suite Variable    @{NET1_VM_IPS}
69     Set Suite Variable    @{NET2_VM_IPS}
70     Should Not Contain    ${NET1_VM_IPS}    None
71     Should Not Contain    ${NET2_VM_IPS}    None
72     Should Not Contain    ${NET1_DHCP_IP}    None
73     Should Not Contain    ${NET2_DHCP_IP}    None
74     [Teardown]    Run Keywords    Show Debugs    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}
75     ...    AND    Get Test Teardown Debugs
76
77 Ping Vm Instance1 In l2_network_1
78     [Documentation]    Check reachability of vm instances by pinging to them.
79     Ping Vm From DHCP Namespace    l2_network_1    @{NET1_VM_IPS}[0]
80
81 Ping Vm Instance2 In l2_network_1
82     [Documentation]    Check reachability of vm instances by pinging to them.
83     Ping Vm From DHCP Namespace    l2_network_1    @{NET1_VM_IPS}[1]
84
85 Ping Vm Instance3 In l2_network_1
86     [Documentation]    Check reachability of vm instances by pinging to them.
87     Ping Vm From DHCP Namespace    l2_network_1    @{NET1_VM_IPS}[2]
88
89 Ping Vm Instance1 In l2_network_2
90     [Documentation]    Check reachability of vm instances by pinging to them.
91     Ping Vm From DHCP Namespace    l2_network_2    @{NET2_VM_IPS}[0]
92
93 Ping Vm Instance2 In l2_network_2
94     [Documentation]    Check reachability of vm instances by pinging to them.
95     Ping Vm From DHCP Namespace    l2_network_2    @{NET2_VM_IPS}[1]
96
97 Ping Vm Instance3 In l2_network_2
98     [Documentation]    Check reachability of vm instances by pinging to them.
99     Ping Vm From DHCP Namespace    l2_network_2    @{NET2_VM_IPS}[2]
100
101 Connectivity Tests From Vm Instance1 In l2_network_1
102     [Documentation]    Login to the vm instance and test some operations
103     Test Operations From Vm Instance    l2_network_1    @{NET1_VM_IPS}[0]    ${NET1_VM_IPS}
104
105 Connectivity Tests From Vm Instance2 In l2_network_1
106     [Documentation]    Login to the vm instance and test operations
107     Test Operations From Vm Instance    l2_network_1    @{NET1_VM_IPS}[1]    ${NET1_VM_IPS}
108
109 Connectivity Tests From Vm Instance3 In l2_network_1
110     [Documentation]    Login to the vm instance and test operations
111     Test Operations From Vm Instance    l2_network_1    @{NET1_VM_IPS}[2]    ${NET1_VM_IPS}
112
113 Connectivity Tests From Vm Instance1 In l2_network_2
114     [Documentation]    Login to the vm instance and test operations
115     Test Operations From Vm Instance    l2_network_2    @{NET2_VM_IPS}[0]    ${NET2_VM_IPS}
116
117 Connectivity Tests From Vm Instance2 In l2_network_2
118     [Documentation]    Logging to the vm instance using generated key pair.
119     Test Operations From Vm Instance    l2_network_2    @{NET2_VM_IPS}[1]    ${NET2_VM_IPS}
120
121 Connectivity Tests From Vm Instance3 In l2_network_2
122     [Documentation]    Login to the vm instance using generated key pair.
123     Test Operations From Vm Instance    l2_network_2    @{NET2_VM_IPS}[2]    ${NET2_VM_IPS}
124
125 Delete A Vm Instance
126     [Documentation]    Delete Vm instances using instance names.
127     Delete Vm Instance    NET1-VM-1
128
129 No Ping For Deleted Vm
130     [Documentation]    Check non reachability of deleted vm instances by pinging to them.
131     ${output}=    Ping From DHCP Should Not Succeed    l2_network_1    @{NET_1_VM_IPS}[0]
132
133 Delete Vm Instances In l2_network_1
134     [Documentation]    Delete Vm instances using instance names in l2_network_1.
135     : FOR    ${VmElement}    IN    @{NET_1_VM_INSTANCES}
136     \    Delete Vm Instance    ${VmElement}
137
138 Delete Vm Instances In l2_network_2
139     [Documentation]    Delete Vm instances using instance names in l2_network_2.
140     : FOR    ${VmElement}    IN    @{NET_2_VM_INSTANCES}
141     \    Delete Vm Instance    ${VmElement}
142     [Teardown]    Run Keywords    Show Debugs    @{NET_1_VM_INSTANCES}    @{NET_2_VM_INSTANCES}
143     ...    AND    Get Test Teardown Debugs
144
145 Delete Sub Networks In l2_network_1
146     [Documentation]    Delete Sub Nets for the Networks with neutron request.
147     Delete SubNet    l2_subnet_1
148
149 Delete Sub Networks In l2_network_2
150     [Documentation]    Delete Sub Nets for the Networks with neutron request.
151     Delete SubNet    l2_subnet_2
152
153 Delete Networks
154     [Documentation]    Delete Networks with neutron request.
155     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
156     \    Delete Network    ${NetworkElement}
157
158 Delete Security Group
159     [Documentation]    Delete security groups with neutron request
160     Delete SecurityGroup    ${SECURITY_GROUP}
161
162 Verify Flows Cleanup
163     [Documentation]    Verify that flows have been cleaned up properly after removing all neutron configurations
164     ${feature_check_status}=    Run Keyword And Return Status    Verify Feature Is Installed    odl-vtn-manager-neutron
165     Run Keyword If    '${feature_check_status}' != 'True'    Verify Flows Are Cleaned Up On All OpenStack Nodes