Search for errors/warnings in karaf log for test teardown
[integration/test.git] / csit / suites / openstack / connectivity / 03_external_network_tests.robot
1 *** Settings ***
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     Get Test Teardown Debugs
6 Library           SSHLibrary
7 Library           OperatingSystem
8 Library           RequestsLibrary
9 Resource          ../../../libraries/DevstackUtils.robot
10 Resource          ../../../libraries/OpenStackOperations.robot
11 Resource          ../../../libraries/Utils.robot
12
13 *** Variables ***
14 @{NETWORKS_NAME}    l3_net
15 @{SUBNETS_NAME}    l3_subnet
16 @{VM_INSTANCES}    VmInstance1_net    VmInstance2_net
17 @{SUBNETS_RANGE}    90.0.0.0/24
18 ${external_gateway}    10.10.10.250
19 ${external_subnet}    10.10.10.0/24
20 ${external_physical_network}    physnet1
21 ${external_net_name}    external-net
22 ${external_subnet_name}    external-subnet
23
24 *** Test Cases ***
25 Create All Controller Sessions
26     [Documentation]    Create sessions for all three controllers
27     ClusterManagement.ClusterManagement Setup
28
29 Create Private Network
30     [Documentation]    Create Network with neutron request.
31     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
32     \    OpenStackOperations.Create Network    ${NetworkElement}
33
34 Create Subnet For Private Network
35     [Documentation]    Create Sub Nets for the Networks with neutron request.
36     OpenStackOperations.Create SubNet    @{NETWORKS_NAME}[0]    @{SUBNETS_NAME}[0]    @{SUBNETS_RANGE}[0]
37
38 Create External Network And Subnet
39     Create Network    ${external_net_name} --router:external --provider:network_type=flat --provider:physical_network=${external_physical_network}
40     Create Subnet    ${external_net_name}    ${external_subnet_name}    ${external_subnet}    --gateway ${external_gateway}
41
42 Create Router
43     [Documentation]    Create Router and Add Interface to the subnets.
44     OpenStackOperations.Create Router    router1
45
46 Add Interfaces To Router
47     [Documentation]    Add Interfaces
48     : FOR    ${interface}    IN    @{SUBNETS_NAME}
49     \    OpenStackOperations.Add Router Interface    router1    ${interface}
50
51 Add Router Gateway To Router
52     [Documentation]    Add Router Gateway
53     OpenStackOperations.Add Router Gateway    router1    ${external_net_name}
54
55 Verify Created Routers
56     [Documentation]    Check created routers using northbound rest calls
57     ${data}    Utils.Get Data From URI    1    ${NEUTRON_ROUTERS_API}
58     Log    ${data}
59     Should Contain    ${data}    router1
60
61 Create Vm Instances
62     [Documentation]    Create VM instances using flavor and image names for a network.
63     OpenStackOperations.Create Vm Instances    @{NETWORKS_NAME}[0]    ${VM_INSTANCES}    sg=csit
64
65 Check Vm Instances Have Ip Address
66     [Documentation]    Test case to verify that all created VMs are ready and have received their ip addresses.
67     ...    We are polling first and longest on the last VM created assuming that if it's received it's address
68     ...    already the other instances should have theirs already or at least shortly thereafter.
69     # first, ensure all VMs are in ACTIVE state.    if not, we can just fail the test case and not waste time polling
70     # for dhcp addresses
71     : FOR    ${vm}    IN    @{VM_INSTANCES}
72     \    Wait Until Keyword Succeeds    15s    5s    Verify VM Is ACTIVE    ${vm}
73     Wait Until Keyword Succeeds    180s    10s    Verify VMs Received DHCP Lease    @{VM_INSTANCES}
74     [Teardown]    Run Keywords    Show Debugs    ${VM_INSTANCES}
75     ...    AND    Get Test Teardown Debugs
76
77 Create And Associate Floating IPs for VMs
78     [Documentation]    Create and associate a floating IP for the VM
79     ${VM_FLOATING_IPS}    OpenStackOperations.Create And Associate Floating IPs    ${external_net_name}    @{VM_INSTANCES}
80     Set Suite Variable    ${VM_FLOATING_IPS}
81     [Teardown]    Run Keywords    Show Debugs    ${VM_INSTANCES}
82     ...    AND    Get Test Teardown Debugs
83
84 Ping External Gateway From Control Node
85     [Documentation]    Check reachability of external gateway by pinging it from the control node.
86     OpenStackOperations.Ping Vm From Control Node    ${external_gateway}
87
88 Ping Vm Instance1 Floating IP From Control Node
89     [Documentation]    Check reachability of VM instance through floating IP by pinging them.
90     OpenStackOperations.Ping Vm From Control Node    @{VM_FLOATING_IPS}[0]
91
92 Ping Vm Instance2 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}[1]
95
96 Delete Vm Instances
97     [Documentation]    Delete Vm instances using instance names.
98     : FOR    ${VmElement}    IN    @{VM_INSTANCES}
99     \    OpenStackOperations.Delete Vm Instance    ${VmElement}
100
101 Delete Router Interfaces
102     [Documentation]    Remove Interface to the subnets.
103     : FOR    ${interface}    IN    @{SUBNETS_NAME}
104     \    OpenStackOperations.Remove Interface    router1    ${interface}
105
106 Delete Routers
107     [Documentation]    Delete Router and Interface to the subnets.
108     OpenStackOperations.Delete Router    router1
109
110 Verify Deleted Routers
111     [Documentation]    Check deleted routers using northbound rest calls
112     ${data}    Utils.Get Data From URI    1    ${NEUTRON_ROUTERS_API}
113     Log    ${data}
114     Should Not Contain    ${data}    router1
115
116 Delete Sub Networks
117     [Documentation]    Delete Sub Nets for the Networks with neutron request.
118     OpenStackOperations.Delete SubNet    @{SUBNETS_NAME}[0]
119
120 Delete Networks
121     [Documentation]    Delete Networks with neutron request.
122     : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
123     \    OpenStackOperations.Delete Network    ${NetworkElement}
124     OpenStackOperations.Delete Network    ${external_net_name}