2 Documentation netconf cluster node outage test suite (CRUD operations).
4 ... Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
6 ... This program and the accompanying materials are made available under the
7 ... terms of the Eclipse Public License v1.0 which accompanies this distribution,
8 ... and is available at http://www.eclipse.org/legal/epl-v10.html
11 ... Perform one of the basic operations (Create, Read, Update and Delete or CRUD)
12 ... on device data mounted onto a netconf connector while one of the nodes is
13 ... down and see if they work. Then bring the dead node up and check that it sees
14 ... the operations that were made while it was down are visible on it as well.
16 ... The node is brought down before each of the "Create", "Update" and "Delete"
17 ... operations and brought and back up after these operations. Before the dead
18 ... node is brought up, a test case makes sure the operation is properly
19 ... propagated within the cluster.
21 ... Currently each of the 3 operations is done once. "Create" is done while
22 ... node 1 is down, "Update" while node 2 is down and "Delete" while node 3
26 Library RequestsLibrary
27 Library OperatingSystem
29 Library SSHLibrary timeout=10s
30 Resource ${CURDIR}/../../../libraries/ClusterManagement.robot
31 Resource ${CURDIR}/../../../libraries/FailFast.robot
32 Resource ${CURDIR}/../../../libraries/KarafKeywords.robot
33 Resource ${CURDIR}/../../../libraries/NetconfKeywords.robot
34 Resource ${CURDIR}/../../../libraries/SetupUtils.robot
35 Resource ${CURDIR}/../../../libraries/TemplatedRequests.robot
36 Resource ${CURDIR}/../../../libraries/Utils.robot
37 Variables ${CURDIR}/../../../variables/Variables.py
39 Suite Setup Setup_Everything
40 Suite Teardown Teardown_Everything
41 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
45 ${DEVICE_CHECK_TIMEOUT} 60s
46 ${DEVICE_BOOT_TIMEOUT} 100s
47 ${DEVICE_NAME} netconf-test-device
48 ${MASTER_CONNECT_TIMEOUT} 15s
53 [Documentation] Deploy and start test tool, then wait for all its devices to become online.
54 NetconfKeywords.Install_And_Start_Testtool
56 ... schemas=${CURDIR}/../../../variables/netconf/CRUD/schemas
58 Check_Device_Is_Not_Mounted_At_Beginning
59 [Documentation] Sanity check making sure our device is not there. Fail if found.
60 NetconfKeywords.Check_Device_Has_No_Netconf_Connector ${DEVICE_NAME} session=node1
61 NetconfKeywords.Check_Device_Has_No_Netconf_Connector ${DEVICE_NAME} session=node2
62 NetconfKeywords.Check_Device_Has_No_Netconf_Connector ${DEVICE_NAME} session=node3
64 Configure_Device_On_Netconf
65 [Documentation] Use node 1 to configure a testtool device on Netconf connector
66 NetconfKeywords.Configure_Device_In_Netconf
68 ... device_type=configure-via-topology
70 [Teardown] Utils.Report_Failure_Due_To_Bug 5089
72 Wait_For_Device_To_Become_Visible_For_All_Nodes
73 [Documentation] Check that the cluster communication about a new Netconf device configuration works
74 NetconfKeywords.Wait_Device_Connected ${DEVICE_NAME} session=node1
75 NetconfKeywords.Wait_Device_Connected ${DEVICE_NAME} session=node2
76 NetconfKeywords.Wait_Device_Connected ${DEVICE_NAME} session=node3
78 Check_Device_Data_Is_Seen_As_Empty_On_All_Nodes
79 [Documentation] Sanity check against possible data left-overs from previous suites. Also causes the suite to wait until the entire cluster sees the device and its data mount.
80 ${config_topology} ${operational_topology}= Get_Topology session=node1
81 ${config_topology} ${operational_topology}= Get_Topology session=node2
82 ${config_topology} ${operational_topology}= Get_Topology session=node3
83 BuiltIn.Wait_Until_Keyword_Succeeds ${DEVICE_CHECK_TIMEOUT} 1s Check_Config_Data node1 ${empty_data}
84 BuiltIn.Wait_Until_Keyword_Succeeds ${DEVICE_CHECK_TIMEOUT} 1s Check_Config_Data node2 ${empty_data}
85 BuiltIn.Wait_Until_Keyword_Succeeds ${DEVICE_CHECK_TIMEOUT} 1s Check_Config_Data node3 ${empty_data}
87 Kill_node1_Before_Create
88 [Documentation] Simulate node 1 crashes just before device data is created, fail if node 1 survives.
89 ClusterManagement.Kill_Single_Member 1
91 Create_Device_Data_With_node1_Down
92 [Documentation] Check that the create requests work when node 1 is down.
93 ... As ODL may be in the process of connecting possible new master to the device,
94 ... the action is retried few times.
95 ... TODO: Check exact status before retry. Carbon reports 404 instead of the correct 503.
97 ${template_as_string}= BuiltIn.Create_Dictionary DEVICE_NAME=${DEVICE_NAME}
98 BuiltIn.Wait_Until_Keyword_Succeeds
99 ... ${MASTER_CONNECT_TIMEOUT}
101 ... TemplatedRequests.Post_As_Xml_Templated
102 ... ${directory_with_template_folders}${/}dataorig
103 ... ${template_as_string}
106 Check_New_Device_Data_Is_Visible_On_Nodes_Without_node1
107 [Documentation] Check that the new device data is propagated in the cluster even when node 1 is down.
109 BuiltIn.Wait_Until_Keyword_Succeeds
110 ... ${DEVICE_CHECK_TIMEOUT}
112 ... Check_Config_Data
115 BuiltIn.Wait_Until_Keyword_Succeeds
116 ... ${DEVICE_CHECK_TIMEOUT}
118 ... Check_Config_Data
122 Restart_node1_After_Create_And_Dump_Its_Topology_Data
123 [Documentation] Simulate node 1 restarted by admin just after device data is created and the change propagated in the cluster, fail if node 1 fails to boot.
124 ClusterManagement.Start_Single_Member 1
125 ${config_topology} ${operational_topology}= Get_Topology session=node1
127 Check_New_Device_Data_Is_Visible_On_node1
128 [Documentation] Check that the created device data is propagated to node 1 as well.
130 BuiltIn.Wait_Until_Keyword_Succeeds
131 ... ${DEVICE_BOOT_TIMEOUT}
133 ... Check_Config_Data
136 [Teardown] Utils.Report_Failure_Due_To_Bug 5761
138 Kill_node2_Before_Modify
139 [Documentation] Simulate node 2 crashes just before device data is modified, fail if node 2 survives.
140 ClusterManagement.Kill_Single_Member 2
142 Modify_Device_Data_With_node2_Down
143 [Documentation] Check that the modification requests work when node 2 is down.
144 ... As ODL may be in the process of connecting possible new master to the device,
145 ... the action is retried few times.
146 ... TODO: Check exact status before retry. Carbon reports 404 instead of the correct 503.
148 BuiltIn.Wait_Until_Keyword_Succeeds
149 ... ${MASTER_CONNECT_TIMEOUT}
151 ... TemplatedRequests.Put_As_Xml_Templated
152 ... ${directory_with_template_folders}${/}datamod1
153 ... {'DEVICE_NAME': '${DEVICE_NAME}'}
155 [Teardown] Utils.Report_Failure_Due_To_Bug 5762
157 Check_Modified_Device_Data_Is_Visible_On_Nodes_Without_node2
158 [Documentation] Check that the device data modification is propagated in the cluster even when node 2 is down.
160 BuiltIn.Wait_Until_Keyword_Succeeds
161 ... ${DEVICE_CHECK_TIMEOUT}
163 ... Check_Config_Data
166 BuiltIn.Wait_Until_Keyword_Succeeds
167 ... ${DEVICE_CHECK_TIMEOUT}
169 ... Check_Config_Data
172 [Teardown] Utils.Report_Failure_Due_To_Bug 5762
174 Restart_node2_After_Modify_And_Dump_Its_Topology_Data
175 [Documentation] Simulate node 2 restarted by admin just after device data is modified and the change propagated in the cluster, fail if node 2 fails to boot.
176 ClusterManagement.Start_Single_Member 2
177 ${config_topology} ${operational_topology}= Get_Topology session=node2
179 Check_Modified_Device_Data_Is_Visible_On_node2
180 [Documentation] Check that the device data modification is propagated to node 2 as well.
182 BuiltIn.Wait_Until_Keyword_Succeeds
183 ... ${DEVICE_BOOT_TIMEOUT}
185 ... Check_Config_Data
188 [Teardown] Utils.Report_Failure_Due_To_Bug 5761
190 Kill_node3_Before_Delete
191 [Documentation] Simulate node 3 crashes just before device data is deleted, fail if node 3 survives.
192 ClusterManagement.Kill_Single_Member 3
194 Delete_Device_Data_With_node3_Down
195 [Documentation] Check that the data removal requests work when node 3 is down.
196 ... As ODL may be in the process of connecting possible new master to the device,
197 ... the action is retried few times.
198 ... TODO: Check exact status before retry. Carbon reports 404 instead of the correct 503.
200 BuiltIn.Wait_Until_Keyword_Succeeds
201 ... ${MASTER_CONNECT_TIMEOUT}
203 ... TemplatedRequests.Delete_Templated
204 ... ${directory_with_template_folders}${/}datamod1
205 ... {'DEVICE_NAME': '${DEVICE_NAME}'}
207 [Teardown] Utils.Report_Failure_Due_To_Bug 5762
209 Check_Device_Data_Removal_Is_Visible_On_Nodes_Without_node3
210 [Documentation] Check that the device data removal is propagated in the cluster even when node 3 is down.
212 BuiltIn.Wait_Until_Keyword_Succeeds ${DEVICE_CHECK_TIMEOUT} 1s Check_Config_Data node1 ${empty_data}
213 BuiltIn.Wait_Until_Keyword_Succeeds ${DEVICE_CHECK_TIMEOUT} 1s Check_Config_Data node2 ${empty_data}
214 [Teardown] Utils.Report_Failure_Due_To_Bug 5762
216 Restart_node3_After_Delete_And_Dump_Its_Topology_Data
217 [Documentation] Simulate node 3 restarted by admin just after device data is deleted and the change propagated in the cluster, fail if node 3 fails to boot.
218 ClusterManagement.Start_Single_Member 3
219 ${config_topology} ${operational_topology}= Get_Topology session=node3
221 Check_Device_Data_Removal_Is_Visible_On_node3
222 [Documentation] Check that the device data removal is propagated to node 3 as well.
224 BuiltIn.Wait_Until_Keyword_Succeeds ${DEVICE_BOOT_TIMEOUT} 1s Check_Config_Data node3 ${empty_data}
225 [Teardown] Utils.Report_Failure_Due_To_Bug 5761
227 Deconfigure_Device_In_Netconf
228 [Documentation] Make request to deconfigure the device on Netconf connector to clean things up and also check that it still works after all the node outages.
229 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
230 NetconfKeywords.Remove_Device_From_Netconf ${DEVICE_NAME} session=node1
232 Check_Device_Deconfigured
233 [Documentation] Check that the device deconfiguration is propagated throughout the cluster correctly.
234 NetconfKeywords.Wait_Device_Fully_Removed ${DEVICE_NAME} session=node1
235 NetconfKeywords.Wait_Device_Fully_Removed ${DEVICE_NAME} session=node2
236 NetconfKeywords.Wait_Device_Fully_Removed ${DEVICE_NAME} session=node3
241 [Documentation] Setup everything needed for the test cases.
242 # Setup resources used by the suite.
243 SetupUtils.Setup_Utils_For_Setup_And_Teardown
244 ClusterManagement.ClusterManagement_Setup
245 NetconfKeywords.Setup_Netconf_Keywords create_session_for_templated_requests=False
246 # TODO: Refactor the suite to use ClusterManagement.Resolve_Http_Session_For_Member instead of these 3 "hardcoded" sessions.
247 RequestsLibrary.Create_Session
249 ... http://${ODL_SYSTEM_1_IP}:${RESTCONFPORT}
250 ... headers=${HEADERS_XML}
252 RequestsLibrary.Create_Session
254 ... http://${ODL_SYSTEM_2_IP}:${RESTCONFPORT}
255 ... headers=${HEADERS_XML}
257 RequestsLibrary.Create_Session
259 ... http://${ODL_SYSTEM_3_IP}:${RESTCONFPORT}
260 ... headers=${HEADERS_XML}
262 BuiltIn.Set_Suite_Variable ${directory_with_template_folders} ${CURDIR}/../../../variables/netconf/CRUD
263 BuiltIn.Set_Suite_Variable ${empty_data} <data xmlns="${ODL_NETCONF_NAMESPACE}"></data>
264 BuiltIn.Set_Suite_Variable
266 ... <data xmlns="${ODL_NETCONF_NAMESPACE}"><cont xmlns="urn:opendaylight:test:netconf:crud"><l>Content</l></cont></data>
267 BuiltIn.Set_Suite_Variable
269 ... <data xmlns="${ODL_NETCONF_NAMESPACE}"><cont xmlns="urn:opendaylight:test:netconf:crud"><l>Modified Content</l></cont></data>
270 ${url}= Builtin.Set_Variable /network-topology:network-topology/topology=topology-netconf
271 BuiltIn.Set_Suite_Variable ${config_topology_url} ${REST_API}${url}
272 BuiltIn.Set_Suite_Variable ${operational_topology_url} ${REST_API}${url}
275 [Documentation] Get both versions of topology (config and operational), log them and return them for further processing.
276 [Arguments] ${session}
277 ${config_topology}= TemplatedRequests.Get_As_Json_From_Uri ${config_topology_url} session=${session}
278 BuiltIn.Log ${config_topology}
279 ${operational_topology}= TemplatedRequests.Get_As_Json_From_Uri
280 ... ${operational_topology_url}
281 ... session=${session}
282 BuiltIn.Log ${operational_topology}
283 RETURN ${config_topology} ${operational_topology}
286 [Documentation] Repeatedly try to get the topologies using Get_Topology_Core until either the request succeeds or boot timeout period expires.
287 [Arguments] ${session}
288 ${result}= BuiltIn.Wait_Until_Keyword_Succeeds
289 ... ${DEVICE_BOOT_TIMEOUT}
291 ... Get_Topology_Core
296 [Documentation] Teardown the test infrastructure, perform cleanup and release all resources.
297 RequestsLibrary.Delete_All_Sessions
298 NetconfKeywords.Stop_Testtool
300 Check_Device_Instance_Count
301 [Documentation] Check that the specified session sees the specified count of instances of the test tool device.
302 [Arguments] ${expected} ${session}
303 ${count}= NetconfKeywords.Count_Netconf_Connectors_For_Device ${DEVICE_NAME} session=${session}
304 Builtin.Should_Be_Equal_As_Strings ${count} ${expected}
307 [Documentation] Check that the specified session sees the specified data in the test tool device.
308 [Arguments] ${node} ${expected} ${contains}=False
309 ${url}= Builtin.Set_Variable
310 ... ${REST_API}/network-topology:network-topology/topology=topology-netconf/node=${DEVICE_NAME}/yang-ext:mount?content=config
311 ${data}= TemplatedRequests.Get_As_Xml_From_Uri ${url} session=${node}
313 BuiltIn.Should_Be_Equal_As_Strings ${data} ${expected}
315 IF ${contains} BuiltIn.Should_Contain ${data} ${expected}