2 Documentation Simplified netconf clustered CRUD test suite in Bug 8086 setup.
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 basic operations (Create, Read, Update and Delete or CRUD) on device
12 ... data mounted onto a netconf connector and see if they work.
14 ... The suite recognizes 3 nodes, "CONFIGURER" (the node that configures the
15 ... device at the beginning and then deconfigures it at the end), "SETTER" (the
16 ... node that manipulates the data on the device) and "CHECKER" (the node that
17 ... checks the data on the device). The configured device and the results of each
18 ... data operation on it is expected to be visible on all nodes so after each
19 ... operation three test cases make sure they can see the result on their
22 ... The 3 nodes are configured by placing "node1", "node2" or "node3" into the
23 ... ${NODE_CONFIGURER}, ${NODE_SETTER} and ${NODE_CHECKER} to make the node
24 ... a "CONFIGURER", "SETTER" and "CHECKER" respectively. The "nodeX" name refers
25 ... to the node with its IP address configured with the ${ODL_SYSTEM_X_IP}
26 ... variable where the "X" is 1, 2 or 3.
28 ... The suite checks the integrity of the presence of the device and the data
29 ... seen on the device only for nodes that have at least one of the roles
30 ... ("CONFIGURER", "SETTER" and "CHECKER") assigned. A better design would have
31 ... a "checker list" of sorts and have only one checking test case that runs
32 ... through the check list and performs the test on each node listed. However
33 ... this currently has fairly low priority due to Beryllium delivery date so
36 Library RequestsLibrary
37 Resource ${CURDIR}/../../../libraries/NetconfKeywords.robot
38 Resource ${CURDIR}/../../../libraries/NexusKeywords.robot
39 Resource ${CURDIR}/../../../libraries/SetupUtils.robot
40 Resource ${CURDIR}/../../../libraries/TemplatedRequests.robot
41 Resource ${CURDIR}/../../../variables/Variables.robot
43 Suite Setup Setup_Everything
44 Suite Teardown Teardown_Everything
45 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
49 ${NODE_CONFIGURER} node1
52 ${DEVICE_CHECK_TIMEOUT} 10s
53 ${DEVICE_NAME} netconf-test-device
54 ${directory_with_template_folders} ${CURDIR}/../../../variables/netconf/CRUD
55 ${empty_data} <data xmlns="${ODL_NETCONF_NAMESPACE}"></data>
57 ... <data xmlns="${ODL_NETCONF_NAMESPACE}"><cont xmlns="urn:opendaylight:test:netconf:crud"><l>Content</l></cont></data>
59 ... <data xmlns="${ODL_NETCONF_NAMESPACE}"><cont xmlns="urn:opendaylight:test:netconf:crud"><l>Modified Content</l></cont></data>
60 ${SCHEMA_DIRECTORY} /tmp/schema
65 [Documentation] Deploy and start test tool, then wait for all its devices to become online.
66 NetconfKeywords.Install_And_Start_Testtool
68 ... schemas=${CURDIR}/../../../variables/netconf/CRUD/schemas
70 Check_Device_Is_Not_Mounted_At_Beginning
71 [Documentation] Sanity check making sure our device is not there. Fail if found.
73 NetconfKeywords.Check_Device_Has_No_Netconf_Connector ${DEVICE_NAME} session=${NODE_CONFIGURER}
75 Configure_Device_On_Netconf
76 [Documentation] Make request to configure a testtool device on Netconf connector
78 NetconfKeywords.Configure_Device_In_Netconf
80 ... device_type=bug8086
81 ... session=${NODE_CONFIGURER}
82 ... schema_directory=${SCHEMA_DIRECTORY}
84 Check_Configurer_Has_Netconf_Connector_For_Device
85 [Documentation] Get the list of mounts and search for our device there. Fail if not found.
87 BuiltIn.Wait_Until_Keyword_Succeeds
88 ... ${DEVICE_CHECK_TIMEOUT}
90 ... Check_Device_Instance_Count
92 ... session=${NODE_CONFIGURER}
94 Wait_For_Device_To_Become_Visible_For_Configurer
95 [Documentation] Wait until the device becomes visible on configurer node.
96 NetconfKeywords.Wait_Device_Connected ${DEVICE_NAME} session=${NODE_CONFIGURER}
98 Wait_For_Device_To_Become_Visible_For_Checker
99 [Documentation] Wait until the device becomes visible on checker node.
100 NetconfKeywords.Wait_Device_Connected ${DEVICE_NAME} session=${NODE_CHECKER}
102 Wait_For_Device_To_Become_Visible_For_Setter
103 [Documentation] Wait until the device becomes visible on setter node.
104 NetconfKeywords.Wait_Device_Connected ${DEVICE_NAME} session=${NODE_SETTER}
106 Check_Device_Data_Is_Seen_As_Empty_On_Configurer
107 [Documentation] Get the device data as seen by configurer and make sure it is empty.
108 BuiltIn.Wait_Until_Keyword_Succeeds
109 ... ${DEVICE_CHECK_TIMEOUT}
111 ... Check_Config_Data
112 ... ${NODE_CONFIGURER}
115 Check_Device_Data_Is_Seen_As_Empty_On_Checker
116 [Documentation] Get the device data as seen by checker and make sure it is empty.
117 BuiltIn.Wait_Until_Keyword_Succeeds
118 ... ${DEVICE_CHECK_TIMEOUT}
120 ... Check_Config_Data
124 Check_Device_Data_Is_Seen_As_Empty_On_Setter
125 [Documentation] Get the device data as seen by setter and make sure it is empty.
126 BuiltIn.Wait_Until_Keyword_Succeeds
127 ... ${DEVICE_CHECK_TIMEOUT}
129 ... Check_Config_Data
134 [Documentation] Send some sample test data into the device and check that the request went OK.
135 ${template_as_string}= BuiltIn.Create_Dictionary DEVICE_NAME=${device_name}
136 TemplatedRequests.Post_As_Xml_Templated
137 ... ${directory_with_template_folders}${/}dataorig
138 ... ${template_as_string}
139 ... session=${NODE_SETTER}
141 Check_New_Device_Data_Is_Visible_On_Setter
142 [Documentation] Get the device data and make sure it contains the created content.
143 BuiltIn.Wait_Until_Keyword_Succeeds
144 ... ${DEVICE_CHECK_TIMEOUT}
146 ... Check_Config_Data
150 Check_New_Device_Data_Is_Visible_On_Checker
151 [Documentation] Check that the created device data make their way into the checker node.
152 BuiltIn.Wait_Until_Keyword_Succeeds
153 ... ${DEVICE_CHECK_TIMEOUT}
155 ... Check_Config_Data
159 Check_New_Device_Data_Is_Visible_On_Configurer
160 [Documentation] Check that the created device data make their way into the configurer node.
161 BuiltIn.Wait_Until_Keyword_Succeeds
162 ... ${DEVICE_CHECK_TIMEOUT}
164 ... Check_Config_Data
165 ... ${NODE_CONFIGURER}
169 [Documentation] Send a request to change the sample test data and check that the request went OK.
170 ${template_as_string}= BuiltIn.Create_Dictionary DEVICE_NAME=${device_name}
171 TemplatedRequests.Put_As_Xml_Templated
172 ... ${directory_with_template_folders}${/}datamod1
173 ... ${template_as_string}
174 ... session=${NODE_SETTER}
176 Check_Device_Data_Is_Modified
177 [Documentation] Get the device data and make sure it contains the modified content.
178 Check_Config_Data ${NODE_SETTER} ${modified_data}
180 Check_Modified_Device_Data_Is_Visible_On_Checker
181 [Documentation] Check that the modified device data make their way into the checker node.
182 BuiltIn.Wait_Until_Keyword_Succeeds 60s 1s Check_Config_Data ${NODE_CHECKER} ${modified_data}
184 Check_Modified_Device_Data_Is_Visible_On_Configurer
185 [Documentation] Check that the modified device data make their way into the configurer node.
186 BuiltIn.Wait_Until_Keyword_Succeeds 60s 1s Check_Config_Data ${NODE_CONFIGURER} ${modified_data}
189 [Documentation] Send a request to delete the sample test data on the device and check that the request went OK.
190 ${template_as_string}= BuiltIn.Create_Dictionary DEVICE_NAME=${device_name}
191 TemplatedRequests.Delete_Templated
192 ... ${directory_with_template_folders}${/}datamod1
193 ... ${template_as_string}
194 ... session=${NODE_SETTER}
196 Check_Device_Data_Is_Deleted
197 [Documentation] Get the device data and make sure it is empty again.
198 Check_Config_Data ${NODE_SETTER} ${empty_data}
200 Check_Device_Data_Deletion_Is_Visible_On_Checker
201 [Documentation] Check that the device data deletion makes its way into the checker node.
202 BuiltIn.Wait_Until_Keyword_Succeeds 60s 1s Check_Config_Data ${NODE_CHECKER} ${empty_data}
204 Check_Device_Data_Deletion_Is_Visible_On_Configurer
205 [Documentation] Check that the device data deletion makes its way into the checker node.
206 BuiltIn.Wait_Until_Keyword_Succeeds 60s 1s Check_Config_Data ${NODE_CONFIGURER} ${empty_data}
208 Deconfigure_Device_In_Netconf
209 [Documentation] Make request to deconfigure the device on Netconf connector.
211 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
212 NetconfKeywords.Remove_Device_From_Netconf ${DEVICE_NAME} session=${NODE_CONFIGURER}
214 Check_Device_Deconfigured_On_Configurer
215 [Documentation] Check that the device is really going to be gone. Fail if still there after one minute.
216 ... This is an expected behavior as the unmount request is sent to the config subsystem which
217 ... then triggers asynchronous disconnection of the device which is reflected in the operational
218 ... data once completed. This test makes sure this asynchronous operation does not take
219 ... unreasonable amount of time.
221 NetconfKeywords.Wait_Device_Fully_Removed ${DEVICE_NAME} session=${NODE_CONFIGURER}
223 Check_Device_Deconfigured_On_Checker
224 [Documentation] Check that the device is going to be gone from the checker node. Fail if still there after one minute.
226 NetconfKeywords.Wait_Device_Fully_Removed ${DEVICE_NAME} session=${NODE_CHECKER}
228 Check_Device_Deconfigured_On_Setter
229 [Documentation] Check that the device is going to be gone from the setter node. Fail if still there after one minute.
231 NetconfKeywords.Wait_Device_Fully_Removed ${DEVICE_NAME} session=${NODE_SETTER}
236 [Documentation] Initialize resources, sreate sessions, on each ODL machine create a directory and copy the car model there.
237 # Setup resources used by the suite.
238 SetupUtils.Setup_Utils_For_Setup_And_Teardown
239 NetconfKeywords.Setup_Netconf_Keywords create_session_for_templated_requests=False
240 RequestsLibrary.Create_Session
242 ... http://${ODL_SYSTEM_1_IP}:${RESTCONFPORT}
243 ... headers=${HEADERS_XML}
245 RequestsLibrary.Create_Session
247 ... http://${ODL_SYSTEM_2_IP}:${RESTCONFPORT}
248 ... headers=${HEADERS_XML}
250 RequestsLibrary.Create_Session
252 ... http://${ODL_SYSTEM_3_IP}:${RESTCONFPORT}
253 ... headers=${HEADERS_XML}
255 ${index_list}= ClusterManagement.List_All_Indices
256 ClusterManagement.Safe_With_Ssh_To_List_Or_All_Run_Keyword
258 ... Populate_Schema_Directory_Over_Active_Connection
261 [Documentation] Teardown the test infrastructure, perform cleanup and release all resources.
262 RequestsLibrary.Delete_All_Sessions
263 NetconfKeywords.Stop_Testtool
265 Check_Device_Instance_Count
266 [Documentation] Count device instances over ${session} and check the count is ${expected}.
267 [Arguments] ${expected} ${session}
268 ${count}= NetconfKeywords.Count_Netconf_Connectors_For_Device ${DEVICE_NAME} session=${session}
269 Builtin.Should_Be_Equal_As_Strings ${count} ${expected}
272 [Documentation] Get device data from ${node}. Match against ${expected}, strictness given by ${contains}.
273 [Arguments] ${node} ${expected} ${contains}=False
274 ${url}= Builtin.Set_Variable
275 ... ${REST_API}/network-topology:network-topology/topology=topology-netconf/node=${DEVICE_NAME}/yang-ext:mount?content=config
276 ${data}= TemplatedRequests.Get_As_Xml_From_Uri ${url} session=${node}
278 BuiltIn.Should_Be_Equal_As_Strings ${data} ${expected}
280 IF ${contains} BuiltIn.Should_Contain ${data} ${expected}
282 Populate_Schema_Directory_Over_Active_Connection
283 [Documentation] Create ${SCHEMA_DIRECTORY}, unpack car.yang there from temporarily downloaded sources jar.
284 ... TODO: Make this configurable and move to NexusKeywords.
285 ${filename}= NexusKeywords.Deploy_Artifact
286 ... component=carpeople
287 ... artifact=clustering-it-model
288 ... name_suffix=-sources.jar
289 ${dir}= BuiltIn.Set_Variable '${SCHEMA_DIRECTORY}'
290 SSHKeywords.Execute_Command_Should_Pass
291 ... mkdir -p '${SCHEMA_DIRECTORY}' && unzip -j '${filename}' META-INF/yang/car@2014-08-18.yang -d '${SCHEMA_DIRECTORY}/' && rm '${filename}'