2 Documentation netconf clustered CRUD test suite.
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
35 Suite Setup Setup_Everything
36 Suite Teardown Teardown_Everything
37 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
39 Library RequestsLibrary
40 Library OperatingSystem
42 Library SSHLibrary timeout=10s
43 Resource ${CURDIR}/../../../libraries/FailFast.robot
44 Resource ${CURDIR}/../../../libraries/NetconfKeywords.robot
45 Resource ${CURDIR}/../../../libraries/SetupUtils.robot
46 Resource ${CURDIR}/../../../libraries/TemplatedRequests.robot
47 Resource ${CURDIR}/../../../libraries/Utils.robot
48 Variables ${CURDIR}/../../../variables/Variables.py
51 ${NODE_CONFIGURER} node1
54 ${DEVICE_CHECK_TIMEOUT} 10s
55 ${DEVICE_NAME} netconf-test-device
56 ${directory_with_template_folders} ${CURDIR}/../../../variables/netconf/CRUD
57 ${empty_data} <data xmlns="${ODL_NETCONF_NAMESPACE}"></data>
58 ${original_data} <data xmlns="${ODL_NETCONF_NAMESPACE}"><cont xmlns="urn:opendaylight:test:netconf:crud"><l>Content</l></cont></data>
59 ${modified_data} <data xmlns="${ODL_NETCONF_NAMESPACE}"><cont xmlns="urn:opendaylight:test:netconf:crud"><l>Modified Content</l></cont></data>
63 [Documentation] Deploy and start test tool, then wait for all its devices to become online.
64 NetconfKeywords.Install_And_Start_Testtool device-count=1 schemas=${CURDIR}/../../../variables/netconf/CRUD/schemas
66 Check_Device_Is_Not_Mounted_At_Beginning
67 [Documentation] Sanity check making sure our device is not there. Fail if found.
69 NetconfKeywords.Check_Device_Has_No_Netconf_Connector ${DEVICE_NAME} session=${NODE_CONFIGURER}
71 Configure_Device_On_Netconf
72 [Documentation] Make request to configure a testtool device on Netconf connector
74 NetconfKeywords.Configure_Device_In_Netconf ${DEVICE_NAME} device_type=configure-via-topology session=${NODE_CONFIGURER}
75 [Teardown] Utils.Report_Failure_Due_To_Bug 5089
77 Check_Configurer_Has_Netconf_Connector_For_Device
78 [Documentation] Get the list of mounts and search for our device there. Fail if not found.
80 BuiltIn.Wait_Until_Keyword_Succeeds ${DEVICE_CHECK_TIMEOUT} 1s Check_Device_Instance_Count 1 session=${NODE_CONFIGURER}
82 Wait_For_Device_To_Become_Visible_For_Configurer
83 [Documentation] Wait until the device becomes visible on configurer node.
84 NetconfKeywords.Wait_Device_Connected ${DEVICE_NAME} session=${NODE_CONFIGURER}
86 Wait_For_Device_To_Become_Visible_For_Checker
87 [Documentation] Wait until the device becomes visible on checker node.
88 NetconfKeywords.Wait_Device_Connected ${DEVICE_NAME} session=${NODE_CHECKER}
90 Wait_For_Device_To_Become_Visible_For_Setter
91 [Documentation] Wait until the device becomes visible on setter node.
92 NetconfKeywords.Wait_Device_Connected ${DEVICE_NAME} session=${NODE_SETTER}
94 Check_Device_Data_Is_Seen_As_Empty_On_Configurer
95 [Documentation] Get the device data as seen by configurer and make sure it is empty.
96 BuiltIn.Wait_Until_Keyword_Succeeds ${DEVICE_CHECK_TIMEOUT} 1s Check_Config_Data ${NODE_CONFIGURER} ${empty_data}
98 Check_Device_Data_Is_Seen_As_Empty_On_Checker
99 [Documentation] Get the device data as seen by checker and make sure it is empty.
100 BuiltIn.Wait_Until_Keyword_Succeeds ${DEVICE_CHECK_TIMEOUT} 1s Check_Config_Data ${NODE_CHECKER} ${empty_data}
102 Check_Device_Data_Is_Seen_As_Empty_On_Setter
103 [Documentation] Get the device data as seen by setter and make sure it is empty.
104 BuiltIn.Wait_Until_Keyword_Succeeds ${DEVICE_CHECK_TIMEOUT} 1s Check_Config_Data ${NODE_SETTER} ${empty_data}
107 [Documentation] Send some sample test data into the device and check that the request went OK.
108 ${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${DEVICE_NAME}'}
109 TemplatedRequests.Post_As_Xml_Templated ${directory_with_template_folders}${/}dataorig ${template_as_string} session=${NODE_SETTER}
111 Check_New_Device_Data_Is_Visible_On_Setter
112 [Documentation] Get the device data and make sure it contains the created content.
113 BuiltIn.Wait_Until_Keyword_Succeeds ${DEVICE_CHECK_TIMEOUT} 1s Check_Config_Data ${NODE_SETTER} ${original_data}
115 Check_New_Device_Data_Is_Visible_On_Checker
116 [Documentation] Check that the created device data make their way into the checker node.
117 BuiltIn.Wait_Until_Keyword_Succeeds ${DEVICE_CHECK_TIMEOUT} 1s Check_Config_Data ${NODE_CHECKER} ${original_data}
119 Check_New_Device_Data_Is_Visible_On_Configurer
120 [Documentation] Check that the created device data make their way into the configurer node.
121 BuiltIn.Wait_Until_Keyword_Succeeds ${DEVICE_CHECK_TIMEOUT} 1s Check_Config_Data ${NODE_CONFIGURER} ${original_data}
124 [Documentation] Send a request to change the sample test data and check that the request went OK.
125 ${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${DEVICE_NAME}'}
126 TemplatedRequests.Put_As_Xml_Templated ${directory_with_template_folders}${/}datamod1 ${template_as_string} session=${NODE_SETTER}
127 [Teardown] Utils.Report_Failure_Due_To_Bug 4968
129 Check_Device_Data_Is_Modified
130 [Documentation] Get the device data and make sure it contains the modified content.
131 Check_Config_Data ${NODE_SETTER} ${modified_data}
132 [Teardown] Utils.Report_Failure_Due_To_Bug 4968
134 Check_Modified_Device_Data_Is_Visible_On_Checker
135 [Documentation] Check that the modified device data make their way into the checker node.
136 BuiltIn.Wait_Until_Keyword_Succeeds 60s 1s Check_Config_Data ${NODE_CHECKER} ${modified_data}
137 [Teardown] Utils.Report_Failure_Due_To_Bug 4968
139 Check_Modified_Device_Data_Is_Visible_On_Configurer
140 [Documentation] Check that the modified device data make their way into the configurer node.
141 BuiltIn.Wait_Until_Keyword_Succeeds 60s 1s Check_Config_Data ${NODE_CONFIGURER} ${modified_data}
142 [Teardown] Utils.Report_Failure_Due_To_Bug 4968
145 [Documentation] Send a request to delete the sample test data on the device and check that the request went OK.
146 ${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${DEVICE_NAME}'}
147 TemplatedRequests.Delete_Templated ${directory_with_template_folders}${/}datamod1 ${template_as_string} session=${NODE_SETTER}
148 [Teardown] Utils.Report_Failure_Due_To_Bug 4968
150 Check_Device_Data_Is_Deleted
151 [Documentation] Get the device data and make sure it is empty again.
152 Check_Config_Data ${NODE_SETTER} ${empty_data}
153 [Teardown] Utils.Report_Failure_Due_To_Bug 4968
155 Check_Device_Data_Deletion_Is_Visible_On_Checker
156 [Documentation] Check that the device data deletion makes its way into the checker node.
157 BuiltIn.Wait_Until_Keyword_Succeeds 60s 1s Check_Config_Data ${NODE_CHECKER} ${empty_data}
158 [Teardown] Utils.Report_Failure_Due_To_Bug 4968
160 Check_Device_Data_Deletion_Is_Visible_On_Configurer
161 [Documentation] Check that the device data deletion makes its way into the checker node.
162 BuiltIn.Wait_Until_Keyword_Succeeds 60s 1s Check_Config_Data ${NODE_CONFIGURER} ${empty_data}
163 [Teardown] Utils.Report_Failure_Due_To_Bug 4968
165 Deconfigure_Device_In_Netconf
166 [Documentation] Make request to deconfigure the device on Netconf connector.
168 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
169 NetconfKeywords.Remove_Device_From_Netconf ${DEVICE_NAME} session=${NODE_CONFIGURER}
171 Check_Device_Deconfigured_On_Configurer
172 [Documentation] Check that the device is really going to be gone. Fail if still there after one minute.
173 ... This is an expected behavior as the unmount request is sent to the config subsystem which
174 ... then triggers asynchronous disconnection of the device which is reflected in the operational
175 ... data once completed. This test makes sure this asynchronous operation does not take
176 ... unreasonable amount of time.
178 NetconfKeywords.Wait_Device_Fully_Removed ${DEVICE_NAME} session=${NODE_CONFIGURER}
180 Check_Device_Deconfigured_On_Checker
181 [Documentation] Check that the device is going to be gone from the checker node. Fail if still there after one minute.
183 NetconfKeywords.Wait_Device_Fully_Removed ${DEVICE_NAME} session=${NODE_CHECKER}
185 Check_Device_Deconfigured_On_Setter
186 [Documentation] Check that the device is going to be gone from the setter node. Fail if still there after one minute.
188 NetconfKeywords.Wait_Device_Fully_Removed ${DEVICE_NAME} session=${NODE_SETTER}
192 [Documentation] Initialize SetupUtils, setup everything needed for the test cases.
193 # Setup resources used by the suite.
194 SetupUtils.Setup_Utils_For_Setup_And_Teardown
195 NetconfKeywords.Setup_Netconf_Keywords create_session_for_templated_requests=False
196 RequestsLibrary.Create_Session node1 http://${ODL_SYSTEM_1_IP}:${RESTCONFPORT} headers=${HEADERS_XML} auth=${AUTH}
197 RequestsLibrary.Create_Session node2 http://${ODL_SYSTEM_2_IP}:${RESTCONFPORT} headers=${HEADERS_XML} auth=${AUTH}
198 RequestsLibrary.Create_Session node3 http://${ODL_SYSTEM_3_IP}:${RESTCONFPORT} headers=${HEADERS_XML} auth=${AUTH}
201 [Documentation] Teardown the test infrastructure, perform cleanup and release all resources.
202 RequestsLibrary.Delete_All_Sessions
203 NetconfKeywords.Stop_Testtool
205 Check_Device_Instance_Count
206 [Arguments] ${expected} ${session}
207 ${count} NetconfKeywords.Count_Netconf_Connectors_For_Device ${DEVICE_NAME} session=${session}
208 Builtin.Should_Be_Equal_As_Strings ${count} ${expected}
211 [Arguments] ${node} ${expected} ${contains}=False
212 ${url}= Builtin.Set_Variable ${CONFIG_API}/network-topology:network-topology/topology/topology-netconf/node/${DEVICE_NAME}/yang-ext:mount
213 ${data}= TemplatedRequests.Get_As_Xml_From_Uri ${url} session=${node}
214 BuiltIn.Run_Keyword_Unless ${contains} BuiltIn.Should_Be_Equal_As_Strings ${data} ${expected}
215 BuiltIn.Run_Keyword_If ${contains} BuiltIn.Should_Contain ${data} ${expected}