2 Documentation Test suite to check North-South connectivity in L3 using a router and an external network
3 Suite Setup Devstack Suite Setup source_pwd=yes
4 Suite Teardown Close All Connections
5 Test Teardown Run Keywords Get OvsDebugInfo
6 ... AND Get Model Dump ${ODL_SYSTEM_IP}
8 Library OperatingSystem
9 Library RequestsLibrary
10 Resource ../../../libraries/DevstackUtils.robot
11 Resource ../../../libraries/Netvirt.robot
12 Resource ../../../libraries/OpenStackOperations.robot
13 Resource ../../../libraries/Utils.robot
16 @{NETWORKS_NAME} l3_net
17 @{SUBNETS_NAME} l3_subnet
18 @{VM_INSTANCES} VmInstance1_net VmInstance2_net
19 @{SUBNETS_RANGE} 90.0.0.0/24
20 ${external_gateway} 10.10.10.250
21 ${external_subnet} 10.10.10.0/24
22 ${external_physical_network} physnet1
23 ${external_net_name} external-net
24 ${external_subnet_name} external-subnet
27 Create All Controller Sessions
28 [Documentation] Create sessions for all three controllers
29 ClusterManagement.ClusterManagement Setup
31 Create Private Network
32 [Documentation] Create Network with neutron request.
33 : FOR ${NetworkElement} IN @{NETWORKS_NAME}
34 \ OpenStackOperations.Create Network ${NetworkElement}
36 Create Subnet For Private Network
37 [Documentation] Create Sub Nets for the Networks with neutron request.
38 OpenStackOperations.Create SubNet @{NETWORKS_NAME}[0] @{SUBNETS_NAME}[0] @{SUBNETS_RANGE}[0]
40 Create External Network And Subnet
41 Create Network ${external_net_name} --router:external --provider:network_type=flat --provider:physical_network=${external_physical_network}
42 Create Subnet ${external_net_name} ${external_subnet_name} ${external_subnet} --gateway ${external_gateway}
45 [Documentation] Create Router and Add Interface to the subnets.
46 OpenStackOperations.Create Router router1
48 Add Interfaces To Router
49 [Documentation] Add Interfaces
50 : FOR ${interface} IN @{SUBNETS_NAME}
51 \ OpenStackOperations.Add Router Interface router1 ${interface}
53 Add Router Gateway To Router
54 [Documentation] Add Router Gateway
55 OpenStackOperations.Add Router Gateway router1 ${external_net_name}
57 Verify Created Routers
58 [Documentation] Check created routers using northbound rest calls
59 ${data} Utils.Get Data From URI 1 ${NEUTRON_ROUTERS_API}
61 Should Contain ${data} router1
64 [Documentation] Create VM instances using flavor and image names for a network.
65 OpenStackOperations.Create Vm Instances @{NETWORKS_NAME}[0] ${VM_INSTANCES} sg=csit
67 Check Vm Instances Have Ip Address
68 [Documentation] Test case to verify that all created VMs are ready and have received their ip addresses.
69 ... We are polling first and longest on the last VM created assuming that if it's received it's address
70 ... already the other instances should have theirs already or at least shortly thereafter.
71 # first, ensure all VMs are in ACTIVE state. if not, we can just fail the test case and not waste time polling
73 : FOR ${vm} IN @{VM_INSTANCES}
74 \ Wait Until Keyword Succeeds 15s 5s Verify VM Is ACTIVE ${vm}
75 Wait Until Keyword Succeeds 180s 10s Verify VMs Received DHCP Lease @{VM_INSTANCES}
76 [Teardown] Run Keywords Show Debugs ${VM_INSTANCES}
77 ... AND Get OvsDebugInfo
78 ... AND Get Model Dump ${ODL_SYSTEM_IP}
80 Create And Associate Floating IPs for VMs
81 [Documentation] Create and associate a floating IP for the VM
82 ${VM_FLOATING_IPS} OpenStackOperations.Create And Associate Floating IPs ${external_net_name} @{VM_INSTANCES}
83 Set Suite Variable ${VM_FLOATING_IPS}
84 [Teardown] Run Keywords Show Debugs ${VM_INSTANCES}
85 ... AND Get OvsDebugInfo
86 ... AND Get Model Dump ${ODL_SYSTEM_IP}
88 Ping External Gateway From Control Node
89 [Documentation] Check reachability of external gateway by pinging it from the control node.
90 OpenStackOperations.Ping Vm From Control Node ${external_gateway}
92 Ping Vm Instance1 Floating IP From Control Node
93 [Documentation] Check reachability of VM instance through floating IP by pinging them.
94 OpenStackOperations.Ping Vm From Control Node @{VM_FLOATING_IPS}[0]
96 Ping Vm Instance2 Floating IP From Control Node
97 [Documentation] Check reachability of VM instance through floating IP by pinging them.
98 OpenStackOperations.Ping Vm From Control Node @{VM_FLOATING_IPS}[1]
101 [Documentation] Delete Vm instances using instance names.
102 : FOR ${VmElement} IN @{VM_INSTANCES}
103 \ OpenStackOperations.Delete Vm Instance ${VmElement}
105 Delete Router Interfaces
106 [Documentation] Remove Interface to the subnets.
107 : FOR ${interface} IN @{SUBNETS_NAME}
108 \ OpenStackOperations.Remove Interface router1 ${interface}
111 [Documentation] Delete Router and Interface to the subnets.
112 OpenStackOperations.Delete Router router1
114 Verify Deleted Routers
115 [Documentation] Check deleted routers using northbound rest calls
116 ${data} Utils.Get Data From URI 1 ${NEUTRON_ROUTERS_API}
118 Should Not Contain ${data} router1
121 [Documentation] Delete Sub Nets for the Networks with neutron request.
122 OpenStackOperations.Delete SubNet @{SUBNETS_NAME}[0]
125 [Documentation] Delete Networks with neutron request.
126 : FOR ${NetworkElement} IN @{NETWORKS_NAME}
127 \ OpenStackOperations.Delete Network ${NetworkElement}
128 OpenStackOperations.Delete Network ${external_net_name}