Remove openstack integration
[integration/test.git] / csit / suites / genius / Configure_ITM.robot
1 *** Settings ***
2 Documentation       Test Suite for ITM
3
4 Library             Collections
5 Library             OperatingSystem
6 Library             RequestsLibrary
7 Library             String
8 Resource            ../../libraries/DataModels.robot
9 Resource            ../../libraries/Genius.robot
10 Resource            ../../libraries/KarafKeywords.robot
11 Resource            ../../libraries/ToolsSystem.robot
12 Resource            ../../libraries/Utils.robot
13 Resource            ../../variables/netvirt/Variables.robot
14 Resource            ../../variables/Variables.robot
15 Variables           ../../variables/genius/Modules.py
16
17 Suite Setup         Genius Suite Setup
18 Suite Teardown      Genius Suite Teardown
19 Test Setup          Genius Test Setup
20 Test Teardown       Genius Test Teardown    ${data_models}
21
22
23 *** Variables ***
24 ${gateway_regex_IPV4}       [0-9]\{1,3}\.[0-9]\{1,3}\.[0-9]\{1,3}\.
25 ${gateway_regex_IPV6}
26 ...                         [0-9a-fA-F]{1,4}:[0-9a-fA-F]{1,4}:[0-9a-fA-F]{1,4}:[0-9a-fA-F]{1,4}:[0-9a-fA-F]{1,4}:[0-9a-fA-F]{1,4}:[0-9a-fA-F]{1,4}:
27
28
29 *** Test Cases ***
30 Create and Verify VTEP -No Vlan
31     [Documentation]    This testcase creates a Internal Transport Manager - ITM tunnel between 2 DPNs without VLAN and Gateway configured in Json.
32     Genius.Create Vteps    ${NO_VLAN}    ${gateway_ip}
33     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Get ITM    ${itm_created[0]}
34     ${type} =    BuiltIn.Set Variable    odl-interface:tunnel-type-vxlan
35     Genius.Update Dpn id list and get tunnels    ${type}
36     Genius.Verify Response Code Of Dpn Endpointconfig API
37     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Ovs Interface Verification
38     BuiltIn.Wait Until Keyword Succeeds    60    5    Genius.Verify Tunnel Status As Up
39     Verify Network Topology
40     Verify Ietf Interface State
41     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Verify Table0 Entry After fetching Port Number
42     ${resp} =    RequestsLibrary.Get Request    session    ${OPERATIONAL_NODES_API}
43     ${respjson} =    RequestsLibrary.To Json    ${resp.content}    pretty_print=True
44     BuiltIn.Log    ${respjson}
45     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    200
46
47 Delete and Verify VTEP -No Vlan
48     [Documentation]    This Delete testcase , deletes the ITM tunnel created between 2 dpns.
49     ${tunnel_list} =    Genius.Get Tunnels List
50     FOR    ${dpn_id}    IN    @{DPN_ID_LIST}
51         CompareStream.Run_Keyword_If_Less_Than_Sodium
52         ...    Utils.Remove All Elements At URI And Verify
53         ...    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/subnets/${SUBNET}%2F16/vteps/${dpn_id}/${port_name}
54         CompareStream.Run_Keyword_If_At_Least_Sodium
55         ...    Utils.Remove All Elements At URI And Verify
56         ...    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/vteps/${dpn_id}
57     END
58     ${output} =    KarafKeywords.Issue Command On Karaf Console    ${TEP_SHOW}
59     BuiltIn.Should Not Contain    ${output}    ${itm_created[0]}
60     Utils.Remove All Elements At URI And Verify    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/
61     ${resp} =    Utils.Get Data From URI    session    ${CONFIG_API}/itm:transport-zones/
62     BuiltIn.Should Not Contain    ${resp} =    ${itm_created[0]}
63     BuiltIn.Wait Until Keyword Succeeds
64     ...    40
65     ...    10
66     ...    Genius.Verify Deleted Tunnels On OVS
67     ...    ${tunnel_list}
68     ...    ${resp}
69     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Check Tunnel Delete On OVS    ${tunnel_list}
70
71 Create and Verify VTEP IPv6 - No Vlan
72     [Documentation]    This testcase creates a Internal Transport Manager - ITM tunnel between 2 DPNs without VLAN and Gateway configured in Json.
73     ${gateway_ip} =    BuiltIn.Set Variable    ::
74     Build Tools System IPV6 List
75     Create Vteps IPv6    ${NO_VLAN}    ${gateway_ip}    ${TOOLS_SYSTEM_IPV6_LIST}
76     BuiltIn.Wait Until Keyword Succeeds    40    10    Get ITM IPV6    ${itm_created[0]}
77     ${type} =    BuiltIn.Set Variable    odl-interface:tunnel-type-vxlan
78     Genius.Update Dpn id list and get tunnels    ${type}
79     FOR    ${dpn}    IN    @{DPN_ID_LIST}
80         BuiltIn.Wait Until Keyword Succeeds
81         ...    40
82         ...    5
83         ...    Utils.Get Data From URI
84         ...    session
85         ...    ${CONFIG_API}/itm-state:dpn-endpoints/DPN-TEPs-info/${dpn}/
86         ...    headers=${ACCEPT_XML}
87     END
88     BuiltIn.Wait Until Keyword Succeeds    40    10    OVS Verification Between IPV6
89     @{all_tunnels} =    BuiltIn.Create List
90     FOR    ${conn_id}    IN    @{TOOLS_SYSTEM_ALL_CONN_IDS}
91         ${tun_names} =    Genius.Get Tunnels On OVS    ${conn_id}
92         Collections.Append To List    ${all_tunnels}    @{tun_names}
93     END
94     @{network_topology_list} =    BuiltIn.Create List    @{all_tunnels}
95     @{network_topology_list} =    Collections.Append To List    ${network_topology_list}    ${Bridge}
96     ${resp} =    BuiltIn.Wait Until Keyword Succeeds
97     ...    40
98     ...    10
99     ...    Get Network Topology with Tunnel
100     ...    ${OPERATIONAL_TOPO_API}
101     ...    ${network_topology_list}
102
103 Delete and Verify VTEP IPv6 -No Vlan
104     [Documentation]    This Delete testcase , deletes the ITM tunnel created between 2 dpns.
105     ${type} =    BuiltIn.Set Variable    odl-interface:tunnel-type-vxlan
106     ${tunnel_list} =    Genius.Get Tunnels List
107     FOR    ${dpn_id}    IN    @{DPN_ID_LIST}
108         CompareStream.Run_Keyword_If_Less_Than_Sodium
109         ...    Utils.Remove All Elements At URI And Verify
110         ...    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/subnets/${SUBNET_IPV6}%2F16/vteps/${dpn_id}/${port_name}
111         CompareStream.Run_Keyword_If_At_Least_Sodium
112         ...    Utils.Remove All Elements At URI And Verify
113         ...    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/vteps/${dpn_id}
114     END
115     ${output} =    KarafKeywords.Issue Command On Karaf Console    ${TEP_SHOW}
116     BuiltIn.Should Not Contain    ${output}    ${itm_created[0]}
117     BuiltIn.Run Keyword And Ignore Error
118     ...    Utils.Remove All Elements At URI And Verify
119     ...    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/
120     ${resp} =    Utils.Get Data From URI    session    ${CONFIG_API}/itm:transport-zones/
121     BuiltIn.Should Not Contain    ${resp}    ${itm_created[0]}
122     BuiltIn.Wait Until Keyword Succeeds
123     ...    40
124     ...    10
125     ...    Genius.Verify Deleted Tunnels On OVS
126     ...    ${tunnel_list}
127     ...    ${resp}
128     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Check Tunnel Delete On OVS    ${tunnel_list}
129
130 Create and Verify VTEP-Vlan
131     [Documentation]    This testcase creates a Internal Transport Manager - ITM tunnel between 2 DPNs with VLAN and without Gateway configured in Json.
132     Genius.Create Vteps    ${VLAN}    ${gateway_ip}
133     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Get ITM    ${itm_created[0]}
134     ${type} =    BuiltIn.Set Variable    odl-interface:tunnel-type-vxlan
135     Genius.Update Dpn id list and get tunnels    ${type}
136     Genius.Verify Response Code Of Dpn Endpointconfig API
137     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Ovs Interface Verification
138     Verify Network Topology
139     Verify Ietf Interface State
140     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Verify Table0 Entry After fetching Port Number
141
142 Delete and Verify VTEP -Vlan
143     [Documentation]    This Delete testcase , deletes the ITM tunnel created between 2 dpns.
144     ${type} =    BuiltIn.Set Variable    odl-interface:tunnel-type-vxlan
145     ${tunnel_list} =    Genius.Get Tunnels List
146     FOR    ${dpn_id}    IN    @{DPN_ID_LIST}
147         CompareStream.Run_Keyword_If_Less_Than_Sodium
148         ...    Utils.Remove All Elements At URI And Verify
149         ...    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/subnets/${SUBNET}%2F16/vteps/${dpn_id}/${port_name}
150         CompareStream.Run_Keyword_If_At_Least_Sodium
151         ...    Utils.Remove All Elements At URI And Verify
152         ...    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/vteps/${dpn_id}
153     END
154     ${output} =    KarafKeywords.Issue Command On Karaf Console    ${TEP_SHOW}
155     BuiltIn.Should Not Contain    ${output}    ${itm_created[0]}
156     Utils.Remove All Elements At URI And Verify    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/
157     ${resp} =    Utils.Get Data From URI    session    ${CONFIG_API}/itm:transport-zones/
158     BuiltIn.Should Not Contain    ${resp}    ${itm_created[0]}
159     BuiltIn.Wait Until Keyword Succeeds
160     ...    40
161     ...    10
162     ...    Genius.Verify Deleted Tunnels On OVS
163     ...    ${tunnel_list}
164     ...    ${resp}
165     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Check Tunnel Delete On OVS    ${tunnel_list}
166
167 Create VTEP - Vlan and Gateway
168     [Documentation]    This testcase creates a Internal Transport Manager - ITM tunnel between 2 DPNs with VLAN and Gateway configured in Json.
169     ${substr} =    BuiltIn.Should Match Regexp    ${TOOLS_SYSTEM_IP}    ${gateway_regex_IPV4}
170     ${gateway_ip} =    BuiltIn.Catenate    ${substr}1
171     Genius.Create Vteps    ${VLAN}    ${gateway_ip}
172     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Get ITM    ${itm_created[0]}
173     ${type} =    BuiltIn.Set Variable    odl-interface:tunnel-type-vxlan
174     Genius.Update Dpn id list and get tunnels    ${type}
175     ${tunnel-type} =    BuiltIn.Set Variable    type: vxlan
176     Genius.Verify Response Code Of Dpn Endpointconfig API
177     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Ovs Interface Verification
178     BuiltIn.Wait Until Keyword Succeeds    60    5    Genius.Verify Tunnel Status As Up
179     Verify Network Topology
180     Verify Ietf Interface State
181     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Verify Table0 Entry After fetching Port Number
182
183 Delete VTEP -Vlan and gateway
184     [Documentation]    This testcase deletes the ITM tunnel created between 2 dpns.
185     ${type} =    BuiltIn.Set Variable    odl-interface:tunnel-type-vxlan
186     ${tunnel_list} =    Genius.Get Tunnels List
187     FOR    ${dpn_id}    IN    @{DPN_ID_LIST}
188         CompareStream.Run_Keyword_If_Less_Than_Sodium
189         ...    Utils.Remove All Elements At URI And Verify
190         ...    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/subnets/${SUBNET}%2F16/vteps/${dpn_id}/${port_name}
191         CompareStream.Run_Keyword_If_At_Least_Sodium
192         ...    Utils.Remove All Elements At URI And Verify
193         ...    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/vteps/${dpn_id}
194     END
195     ${output} =    KarafKeywords.Issue Command On Karaf Console    ${TEP_SHOW}
196     BuiltIn.Should Not Contain    ${output}    ${itm_created[0]}
197     Utils.Remove All Elements At URI And Verify    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/
198     ${resp} =    Utils.Get Data From URI    session    ${CONFIG_API}/itm:transport-zones/
199     BuiltIn.Should Not Contain    ${resp}    ${itm_created[0]}
200     BuiltIn.Wait Until Keyword Succeeds
201     ...    40
202     ...    10
203     ...    Genius.Verify Deleted Tunnels On OVS
204     ...    ${tunnel_list}
205     ...    ${resp}
206     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Check Tunnel Delete On OVS    ${tunnel_list}
207
208
209 *** Keywords ***
210 Create Vteps IPv6
211     [Documentation]    This keyword creates VTEPs between IPV6 ip's
212     [Arguments]    ${vlan}    ${gateway_ip}    ${tools_ips}
213     ${substr} =    BuiltIn.Should Match Regexp    ${tools_ips}[0]    ${gateway_regex_IPV6}
214     ${SUBNET_IPV6} =    BuiltIn.Catenate    ${substr}0
215     BuiltIn.Set Suite Variable    ${SUBNET_IPV6}
216     ${body} =    Genius.Set Json    ${vlan}    ${gateway_ip}    ${SUBNET_IPV6}    @{TOOLS_SYSTEM_IPV6_LIST}
217     Utils.Post Log Check    ${CONFIG_API}/itm:transport-zones/    ${body}    status_codes=${204}
218
219 Get Network Topology with Tunnel
220     [Documentation]    Returns the Network topology with Tunnel info in it.
221     [Arguments]    ${url}    ${network_topology_list}
222     Utils.Check For Elements At URI    ${url}    ${network_topology_list}
223
224 Get ITM IPV6
225     [Documentation]    It returns the created ITM Transport zone with the passed values during the creation is done.
226     [Arguments]    ${itm_created[0]}
227     @{Itm-no-vlan} =    Collections.Combine Lists    ${TOOLS_SYSTEM_IPV6_LIST}    ${DPN_ID_LIST}
228     Collections.Append To List    ${Itm-no-vlan}    ${itm_created[0]}
229     Utils.Check For Elements At URI
230     ...    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}
231     ...    ${Itm-no-vlan}
232
233 OVS Verification Between IPV6
234     [Documentation]    This keyword will verify tunnels available on ovs
235     FOR    ${tools_ip}    IN    @{TOOLS_SYSTEM_ALL_IPS}
236         Genius.Ovs Verification For Each Dpn    ${tools_ip}    ${TOOLS_SYSTEM_IPV6_LIST}
237     END
238
239 Verify Network Topology
240     [Documentation]    This keyword will verify whether all tunnels and bridges are populated in network topology
241     ${all_tunnels} =    Genius.Get Tunnels List
242     @{network_topology_list} =    BuiltIn.Create List
243     @{network_topology_list} =    Collections.Append To List    ${network_topology_list}    ${Bridge}
244     @{network_topology_list} =    Collections.Combine Lists    ${network_topology_list}    ${all_tunnels}
245     ${resp} =    BuiltIn.Wait Until Keyword Succeeds
246     ...    40
247     ...    10
248     ...    Get Network Topology with Tunnel
249     ...    ${OPERATIONAL_TOPO_API}
250     ...    ${network_topology_list}
251
252 Verify Ietf Interface State
253     Utils.Check For Elements At URI
254     ...    ${OPERATIONAL_API}/ietf-interfaces:interfaces-state/
255     ...    ${DPN_ID_LIST}
256     ...    session
257     ...    True
258     ${all_tunnels} =    Genius.Get Tunnels List
259     Utils.Check For Elements At URI
260     ...    ${OPERATIONAL_API}/ietf-interfaces:interfaces-state/
261     ...    ${all_tunnels}
262     ...    session
263     ...    True
264
265 Build Tools System IPV6 List
266     [Documentation]    Create a list of tools system ips with IPV6.
267     @{TOOLS_SYSTEM_IPV6_LIST} =    BuiltIn.Create List
268     FOR    ${tool_system_index}    IN RANGE    ${NUM_TOOLS_SYSTEM}
269         Collections.Append To List    ${TOOLS_SYSTEM_IPV6_LIST}    fd96:2a25:4ad3:3c7d:0:0:${tool_system_index}:1000
270     END
271     BuiltIn.Set Suite Variable    @{TOOLS_SYSTEM_IPV6_LIST}