10ae0c43a3060d46d516be4a7ea8fcf50c1679fc
[integration/test.git] / csit / suites / netvirt / subnet_routing / subnet_routing_and_multicast.robot
1 *** Settings ***
2 Documentation     Test suite to validate subnet routing and multicast functionality in an openstack integrated environment.
3 ...               The assumption of this suite is that the environment is already configured with the proper
4 ...               integration bridges and vxlan tunnels.
5 Suite Setup       Suite Setup
6 Suite Teardown    Stop Suite
7 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
8 Test Teardown     OpenStackOperations.Get Test Teardown Debugs
9 Resource          ../../../libraries/BgpOperations.robot
10 Resource          ../../../libraries/KarafKeywords.robot
11 Resource          ../../../libraries/OpenStackOperations.robot
12 Resource          ../../../libraries/Utils.robot
13 Resource          ../../../libraries/SetupUtils.robot
14 Resource          ../../../variables/Variables.robot
15 Resource          ../../../variables/netvirt/Variables.robot
16 Resource          ../../../libraries/VpnOperations.robot
17
18 *** Variables ***
19 ${AS_ID}          100
20 ${SECURITY_GROUP}    mc_sg
21 ${NUM_OF_PORTS_PER_NETWORK}    4
22 ${NUM_OF_INSTANCES}    20
23 ${VPN_INSTANCE_ID}    4ae8cd92-48ca-49b5-94e1-b2921a261111
24 ${VPN_NAME}       mc_vpn1
25 ${LOOPBACK_IP}    5.5.5.2
26 ${L3VPN_RD}       2200:2
27 ${DCGW_SYSTEM_IP}    ${TOOLS_SYSTEM_1_IP}
28 ${RPING_MIP_IP}    sudo arping -I eth0:1 -c 5 -b -s @{EXTRA_NW_SUBNET}[0] @{EXTRA_NW_SUBNET}[0]
29 ${RPING_MIP_IP1}    sudo arping -I eth0:1 -c 5 -b -s @{EXTRA_NW_SUBNET}[1] @{EXTRA_NW_SUBNET}[1]
30 ${RPING_MIP_IP2}    sudo arping -I eth0:1 -c 5 -b -s @{EXTRA_NW_SUBNET}[2] @{EXTRA_NW_SUBNET}[2]
31 ${RPING_MIP_IP3}    sudo arping -I eth0:1 -c 5 -b -s ${NEW_EXTRA_NW_SUBNET} ${NEW_EXTRA_NW_SUBNET}
32 @{INTERFACE_STATE}    up    down
33 @{NETWORKS}       mc_net_1    mc_net_2    mc_net_3
34 @{NET_1_VMS}      mc_net_1_vm_1    mc_net_1_vm_2    mc_net_1_vm_3    mc_net_1_vm_4
35 @{NET_2_VMS}      mc_net_2_vm_1    mc_net_2_vm_2    mc_net_2_vm_3    mc_net_2_vm_4
36 @{NET_3_VMS}      mc_net_3_vm_1    mc_net_3_vm_2    mc_net_3_vm_3    mc_net_3_vm_4
37 @{NET_1_PORTS}    mc_net_1_port_1    mc_net_1_port_2    mc_net_1_port_3    mc_net_1_port_4
38 @{NET_2_PORTS}    mc_net_2_port_1    mc_net_2_port_2    mc_net_2_port_3    mc_net_2_port_4
39 @{NET_3_PORTS}    mc_net_3_port_1    mc_net_3_port_2    mc_net_3_port_3    mc_net_3_port_4
40 @{SUBNETS}        mc_sub_1    mc_sub_2    mc_sub_3
41 @{SUBNET_CIDR}    10.1.0.0/24    10.2.0.0/24    10.3.0.0/24
42 @{EXTRA_NW_SUBNET}    10.1.0.100    10.2.0.100    10.3.0.100
43 ${NEW_EXTRA_NW_SUBNET}    10.1.0.110
44 ${MASK}           255.255.255.0
45
46 *** Test Cases ***
47 Verify The Subnet Route When Neutron Port Hosting Subnet Route Is Down/up On Single VSwitch Topology
48     [Documentation]    Verify the subnet route when enterprise host is down and up.
49     BuiltIn.Wait Until Keyword Succeeds    30s    5s    OpenStackOperations.Configure_IP_On_Sub_Interface    @{NETWORKS}[0]    @{EXTRA_NW_SUBNET}[0]    @{NET_1_VM_IPS}[0]
50     ...    ${MASK}    @{INTERFACE_STATE}[1]
51     ${allowed_ip_list} =    BuiltIn.Create List    @{EXTRA_NW_SUBNET}[0]
52     BuiltIn.Wait Until Keyword Succeeds    30s    10s    Utils.Check For Elements At URI    ${FIB_ENTRY_URL}    ${allowed_ip_list}
53     BuiltIn.Wait Until Keyword Succeeds    30s    5s    OpenStackOperations.Configure_IP_On_Sub_Interface    @{NETWORKS}[0]    @{EXTRA_NW_SUBNET}[0]    @{NET_1_VM_IPS}[0]
54     ...    ${MASK}    @{INTERFACE_STATE}[0]
55     BuiltIn.Wait Until Keyword Succeeds    30s    5s    OpenStackOperations.Verify_IP_Configured_On_Sub_Interface    @{NETWORKS}[0]    @{EXTRA_NW_SUBNET}[0]    @{NET_1_VM_IPS}[0]
56     BuiltIn.Wait Until Keyword Succeeds    30s    10s    Utils.Check For Elements At URI    ${FIB_ENTRY_URL}    ${allowed_ip_list}
57     Verify Ping between Inter Intra And Enterprise host
58
59 Verify Enterprise Hosts Reachability After VM Reboot
60     [Documentation]    Restart the VSwitch1 which is hosting the enterprise host and check the subnet route
61     OpenStackOperations.Get ControlNode Connection
62     @{NET_1_VM_IPS}    ${NET1_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_1_VMS}
63     OpenStackOperations.Reboot Nova VM    @{NET_1_VMS}[0]
64     @{NET_1_VM_IPS}    ${NET1_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_1_VMS}
65     BuiltIn.Wait Until Keyword Succeeds    30s    5s    OpenStackOperations.Configure_IP_On_Sub_Interface    @{NETWORKS}[0]    @{EXTRA_NW_SUBNET}[0]    @{NET_1_VM_IPS}[0]
66     ...    ${MASK}    @{INTERFACE_STATE}[0]
67     BuiltIn.Wait Until Keyword Succeeds    30s    5s    OpenStackOperations.Verify_IP_Configured_On_Sub_Interface    @{NETWORKS}[0]    @{EXTRA_NW_SUBNET}[0]    @{NET_1_VM_IPS}[0]
68     Verify Ping between Inter Intra And Enterprise host
69
70 Verify The Subnet Route For Multiple Subnets On Multi VSwitch Topology When DC-GW Is Restarted
71     [Documentation]    Restart dcgw and check enterprise hosts reachability
72     BgpOperations.Restart BGP Processes On DCGW    ${DCGW_SYSTEM_IP}
73     Create BGP Config On DCGW
74     Verify Ping between Inter Intra And Enterprise host
75
76 Verify The Subnet Route For Multiple Subnets On Multi VSwitch Topology When Qbgp Is Restarted
77     [Documentation]    Restart qbgp and check enterprise hosts reachability
78     BgpOperations.Restart BGP Processes On ODL    ${ODL_SYSTEM_IP}
79     Verify Ping between Inter Intra And Enterprise host
80
81 Verify The Subnet Route When Vswitch Hosting Subnet Route Is Restarted On Single Vswitch Topology
82     [Documentation]    Restart single OVS node on which subnet route is configured and verify enterprise hosts reachability
83     OVSDB.Restart OVSDB    ${OS_COMPUTE_2_IP}
84     BuiltIn.Wait Until Keyword Succeeds    10s    20s    OVSDB.Verify Ovsdb State    ${OS_COMPUTE_2_IP}
85     VpnOperations.Verify Tunnel Status as UP
86     Verify Ping between Inter Intra And Enterprise host
87
88 Verify The Subnet Route When Vswitch Hosting Subnet Enterprise Host Is Restarted On Multiple Vswitch Topology
89     [Documentation]    Restart the OVS node on both compute nodes and verify the subnet route
90     OVSDB.Restart OVSDB    ${OS_COMPUTE_1_IP}
91     OVSDB.Restart OVSDB    ${OS_COMPUTE_2_IP}
92     BuiltIn.Wait Until Keyword Succeeds    10s    20s    OVSDB.Verify Ovsdb State    ${OS_COMPUTE_1_IP}
93     BuiltIn.Wait Until Keyword Succeeds    10s    20s    OVSDB.Verify Ovsdb State    ${OS_COMPUTE_2_IP}
94     VpnOperations.Verify Tunnel Status as UP
95     Verify Ping between Inter Intra And Enterprise host
96
97 Verify The Subnet Route For One Subnet On Single Vswitch
98     [Documentation]    Verify the subnet route for one subnet on a single VSwitch
99     ${output} =    OpenStackOperations.Execute Command on VM Instance    @{NETWORKS}[2]    @{NET_2_VM_IPS}[1]    ping -c 3 @{EXTRA_NW_SUBNET}[1]
100     BuiltIn.Should Contain    ${output}    64 bytes
101     Utils.Check For Elements At URI    ${FIB_ENTRY_URL}    ${EXTRA_NW_SUBNET}
102     Verify Ping between Inter Intra And Enterprise host
103
104 Verify The Subnet Route For Multiple Subnets On Multi Vswitch Topology
105     [Documentation]    Configure one more IP on sub interface and verify the subnet route for multiple subnets on multi VSwitch topology
106     BuiltIn.Log    Bring up enterprise host in another vswitch
107     Configure_IP_On_Sub_Interface    @{NETWORKS}[0]    ${NEW_EXTRA_NW_SUBNET}    @{NET_1_VM_IPS}[2]    ${MASK}
108     Verify_IP_Configured_On_Sub_Interface    @{NETWORKS}[0]    ${NEW_EXTRA_NW_SUBNET}    @{NET_1_VM_IPS}[2]
109     ${output} =    OpenStackOperations.Execute Command on VM Instance    @{NETWORKS}[0]    @{NET_1_VM_IPS}[2]    ${RPING_MIP_IP3}
110     BuiltIn.Should Contain    ${output}    broadcast
111     BuiltIn.Should Contain    ${output}    Received 0 reply
112     ${output} =    OpenStackOperations.Execute Command on VM Instance    @{NETWORKS}[2]    @{NET_1_VM_IPS}[2]    ping -c 3 ${NEW_EXTRA_NW_SUBNET}
113     BuiltIn.Should Contain    ${output}    64 bytes
114     Verify Ping between Inter Intra And Enterprise host
115
116 *** Keywords ***
117 Suite Setup
118     [Documentation]    Test Suite for Subnet_Routing_and_Multicast_Deployments.
119     VpnOperations.Basic Suite Setup
120     BgpOperations.Start Quagga Processes On ODL    ${ODL_SYSTEM_IP}
121     BgpOperations.Start Quagga Processes On DCGW    ${DCGW_SYSTEM_IP}
122     Create Setup
123
124 Stop Suite
125     [Documentation]    Test Teardown for Subnet_Routing_and_Multicast_Deployments.
126     BgpOperations.Delete BGP Configuration On ODL    session
127     BgpOperations.Delete BGP Config On Quagga    ${DCGW_SYSTEM_IP}    ${AS_ID}
128     BgpOperations.Stop BGP Processes On Node    ${ODL_SYSTEM_IP}
129     BgpOperations.Stop BGP Processes On Node    ${DCGW_SYSTEM_IP}
130     OpenStackOperations.OpenStack Suite Teardown
131
132 Create Setup
133     [Documentation]    Create basic topology
134     OpenStackOperations.OpenStack Suite Setup
135     ${id} =    OpenStackOperations.Get Project Id    ${ODL_RESTCONF_USER}
136     OpenStackOperations.Set Instance Quota For Project    ${NUM_OF_INSTANCES}    ${id}
137     Create Neutron Networks
138     Create Neutron Subnets    ${3}
139     OpenStackOperations.Create And Configure Security Group    ${SECURITY_GROUP}
140     Create Neutron Ports
141     Create Nova VMs
142     Create Sub Interfaces And Verify
143     Create L3VPN
144     : FOR    ${network}    IN    @{NETWORKS}
145     \    ${network_id} =    OpenStackOperations.Get Net Id    ${network}
146     \    VpnOperations.Associate L3VPN To Network    networkid=${network_id}    vpnid=${VPN_INSTANCE_ID}
147     Create BGP Config On ODL
148     Create BGP Config On DCGW
149     BuiltIn.Wait Until Keyword Succeeds    60s    10s    VpnOperations.Verify Tunnel Status as UP
150     ${output} =    OpenStackOperations.Execute Command on VM Instance    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]    ${RPING_MIP_IP}
151     BuiltIn.Should Contain    ${output}    broadcast    Received 0 reply
152     ${output} =    OpenStackOperations.Execute Command on VM Instance    @{NETWORKS}[1]    @{NET_2_VM_IPS}[0]    ${RPING_MIP_IP1}
153     BuiltIn.Should Contain    ${output}    broadcast    Received 0 reply
154     ${output} =    OpenStackOperations.Execute Command on VM Instance    @{NETWORKS}[2]    @{NET_3_VM_IPS}[0]    ${RPING_MIP_IP2}
155     BuiltIn.Should Contain    ${output}    broadcast    Received 0 reply
156
157 Create Neutron Networks
158     [Documentation]    Create required number of networks
159     : FOR    ${net}    IN    @{NETWORKS}
160     \    OpenStackOperations.Create Network    ${net}
161     BuiltIn.Wait Until Keyword Succeeds    3s    1s    Utils.Check For Elements At URI    ${NETWORK_URL}    ${NETWORKS}
162
163 Create Neutron Subnets
164     [Arguments]    ${num_of_network}    ${additional_args}=${EMPTY}    ${verbose}=TRUE
165     [Documentation]    Create required number of subnets for previously created networks
166     : FOR    ${index}    IN RANGE    0    ${num_of_network}
167     \    OpenStackOperations.Create SubNet    @{NETWORKS}[${index}]    @{SUBNETS}[${index}]    @{SUBNET_CIDR}[${index}]
168     BuiltIn.Wait Until Keyword Succeeds    3s    1s    Utils.Check For Elements At URI    ${SUBNETWORK_URL}    ${SUBNETS}
169
170 Create Neutron Ports
171     [Documentation]    Create required number of ports under previously created subnets
172     ${allowed_address_pairs_args1} =    BuiltIn.Set Variable    --allowed-address ip-address=@{EXTRA_NW_SUBNET}[0] --allowed-address ip-address=@{EXTRA_NW_SUBNET}[1]
173     ${allowed_address_pairs_args2} =    BuiltIn.Set Variable    --allowed-address ip-address=@{EXTRA_NW_SUBNET}[1] --allowed-address ip-address=@{EXTRA_NW_SUBNET}[2]
174     ${allowed_address_pairs_args3} =    BuiltIn.Set Variable    --allowed-address ip-address=@{EXTRA_NW_SUBNET}[2] --allowed-address ip-address=@{EXTRA_NW_SUBNET}[0]
175     : FOR    ${index}    IN RANGE    0    ${NUM_OF_PORTS_PER_NETWORK}
176     \    OpenStackOperations.Create Port    @{NETWORKS}[0]    @{NET_1_PORTS}[${index}]    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args1}
177     : FOR    ${index}    IN RANGE    0    ${NUM_OF_PORTS_PER_NETWORK}
178     \    OpenStackOperations.Create Port    @{NETWORKS}[1]    @{NET_2_PORTS}[${index}]    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args2}
179     : FOR    ${index}    IN RANGE    0    ${NUM_OF_PORTS_PER_NETWORK}
180     \    OpenStackOperations.Create Port    @{NETWORKS}[2]    @{NET_3_PORTS}[${index}]    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args3}
181
182 Create Nova VMs
183     [Documentation]    Create Vm instances on compute nodes
184     : FOR    ${index}    IN RANGE    0    2
185     \    OpenStackOperations.Create Vm Instance With Port On Compute Node    @{NET_1_PORTS}[${index}]    @{NET_1_VMS}[${index}]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
186     \    OpenStackOperations.Create Vm Instance With Port On Compute Node    @{NET_1_PORTS}[${index+2}]    @{NET_1_VMS}[${index+2}]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
187     \    OpenStackOperations.Create Vm Instance With Port On Compute Node    @{NET_2_PORTS}[${index}]    @{NET_2_VMS}[${index}]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
188     \    OpenStackOperations.Create Vm Instance With Port On Compute Node    @{NET_2_PORTS}[${index+2}]    @{NET_2_VMS}[${index+2}]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
189     \    OpenStackOperations.Create Vm Instance With Port On Compute Node    @{NET_3_PORTS}[${index}]    @{NET_3_VMS}[${index}]    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
190     \    OpenStackOperations.Create Vm Instance With Port On Compute Node    @{NET_3_PORTS}[${index+2}]    @{NET_3_VMS}[${index+2}]    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
191     @{NET_1_VM_IPS}    ${NET1_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_1_VMS}
192     @{NET_2_VM_IPS}    ${NET2_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_2_VMS}
193     @{NET_3_VM_IPS}    ${NET3_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_3_VMS}
194     BuiltIn.Set Suite Variable    @{NET_1_VM_IPS}
195     BuiltIn.Set Suite Variable    @{NET_2_VM_IPS}
196     BuiltIn.Set Suite Variable    @{NET_3_VM_IPS}
197     BuiltIn.Should Not Contain    ${NET_1_VM_IPS}    None
198     BuiltIn.Should Not Contain    ${NET_2_VM_IPS}    None
199     BuiltIn.Should Not Contain    ${NET_3_VM_IPS}    None
200     OpenStackOperations.Show Debugs    @{NET_1_VMS}    @{NET_2_VMS}    @{NET_3_VMS}
201
202 Create Sub Interfaces And Verify
203     [Documentation]    Create Sub Interface and verify for all VMs
204     BuiltIn.Wait Until Keyword Succeeds    30s    5s    OpenStackOperations.Configure_IP_On_Sub_Interface    @{NETWORKS}[0]    @{EXTRA_NW_SUBNET}[0]    @{NET_1_VM_IPS}[0]
205     ...    ${MASK}    @{INTERFACE_STATE}[0]
206     BuiltIn.Wait Until Keyword Succeeds    30s    5s    OpenStackOperations.Verify_IP_Configured_On_Sub_Interface    @{NETWORKS}[0]    @{EXTRA_NW_SUBNET}[0]    @{NET_1_VM_IPS}[0]
207     BuiltIn.Wait Until Keyword Succeeds    30s    5s    OpenStackOperations.Configure_IP_On_Sub_Interface    @{NETWORKS}[1]    @{EXTRA_NW_SUBNET}[1]    @{NET_2_VM_IPS}[0]
208     ...    ${MASK}    @{INTERFACE_STATE}[0]
209     BuiltIn.Wait Until Keyword Succeeds    30s    5s    OpenStackOperations.Verify_IP_Configured_On_Sub_Interface    @{NETWORKS}[1]    @{EXTRA_NW_SUBNET}[1]    @{NET_2_VM_IPS}[0]
210     BuiltIn.Wait Until Keyword Succeeds    30s    5s    OpenStackOperations.Configure_IP_On_Sub_Interface    @{NETWORKS}[2]    @{EXTRA_NW_SUBNET}[2]    @{NET_3_VM_IPS}[0]
211     ...    ${MASK}    @{INTERFACE_STATE}[0]
212     BuiltIn.Wait Until Keyword Succeeds    30s    5s    OpenStackOperations.Verify_IP_Configured_On_Sub_Interface    @{NETWORKS}[2]    @{EXTRA_NW_SUBNET}[2]    @{NET_3_VM_IPS}[0]
213
214 Create L3VPN
215     [Documentation]    Create L3VPN and verify the same
216     ${net_id} =    OpenStackOperations.Get Net Id    @{NETWORKS}[0]
217     ${tenant_id} =    OpenStackOperations.Get Tenant ID From Network    ${net_id}
218     VpnOperations.VPN Create L3VPN    vpnid=${VPN_INSTANCE_ID}    name=${VPN_NAME}    rd=["${L3VPN_RD}"]    exportrt=["${L3VPN_RD}"]    importrt=["${L3VPN_RD}"]    tenantid=${tenant_id}
219     VpnOperations.Verify L3VPN On ODL    ${VPN_INSTANCE_ID}
220
221 Create BGP Config On ODL
222     [Documentation]    Configure BGP Config on ODL
223     KarafKeywords.Issue Command On Karaf Console    ${BGP_CONFIG_SERVER_CMD}
224     BgpOperations.Create BGP Configuration On ODL    localas=${AS_ID}    routerid=${ODL_SYSTEM_IP}
225     BgpOperations.AddNeighbor To BGP Configuration On ODL    remoteas=${AS_ID}    neighborAddr=${DCGW_SYSTEM_IP}
226     ${output} =    BgpOperations.Get BGP Configuration On ODL    session
227     BuiltIn.Should Contain    ${output}    ${DCGW_SYSTEM_IP}
228
229 Create BGP Config On DCGW
230     [Documentation]    Configure BGP on DCGW
231     BgpOperations.Configure BGP And Add Neighbor On DCGW    ${DCGW_SYSTEM_IP}    ${AS_ID}    ${DCGW_SYSTEM_IP}    ${ODL_SYSTEM_IP}    ${VPN_NAME}    ${L3VPN_RD}
232     ...    ${LOOPBACK_IP}
233     ${output} =    BgpOperations.Execute Show Command On Quagga    ${DCGW_SYSTEM_IP}    ${RUN_CONFIG}
234     BuiltIn.Should Contain    ${output}    ${ODL_SYSTEM_IP}
235     ${output} =    BuiltIn.Wait Until Keyword Succeeds    180s    10s    BgpOperations.Verify BGP Neighbor Status On Quagga    ${DCGW_SYSTEM_IP}    ${ODL_SYSTEM_IP}
236
237 Verify Ping between Inter Intra And Enterprise host
238     [Documentation]    Ping Enterprise Host for Intra, Inter from different and same network
239     ${dst_ip_list} =    BuiltIn.Create List    @{NET_1_VM_IPS}    @{NET_2_VM_IPS}    @{EXTRA_NW_SUBNET}
240     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_VM_IPS}[0]    ${dst_ip_list}
241     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_VM_IPS}[0]    ${dst_ip_list}
242     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[0]    @{NET_1_VM_IPS}[2]    ${dst_ip_list}
243     OpenStackOperations.Test Operations From Vm Instance    @{NETWORKS}[1]    @{NET_2_VM_IPS}[2]    ${dst_ip_list}