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/KarafKeywords.robot
45 Resource ${CURDIR}/../../../libraries/NetconfKeywords.robot
46 Resource ${CURDIR}/../../../libraries/NetconfViaRestconf.robot
47 Resource ${CURDIR}/../../../libraries/SetupUtils.robot
48 Resource ${CURDIR}/../../../libraries/Utils.robot
49 Variables ${CURDIR}/../../../variables/Variables.py
52 ${NODE_CONFIGURER} node1
55 ${DEVICE_CHECK_TIMEOUT} 60s
56 ${DIRECTORY_WITH_TEMPLATE_FOLDERS} ${CURDIR}/../../../variables/netconf/CRUD
57 ${DEVICE_NAME} netconf-test-device
58 ${EMPTY_DATA} <data xmlns="${ODL_NETCONF_NAMESPACE}"></data>
59 ${ORIGINAL_DATA} <data xmlns="${ODL_NETCONF_NAMESPACE}"><cont xmlns="urn:opendaylight:test:netconf:crud"><l>Content</l></cont></data>
60 ${MODIFIED_DATA} <data xmlns="${ODL_NETCONF_NAMESPACE}"><cont xmlns="urn:opendaylight:test:netconf:crud"><l>Modified Content</l></cont></data>
63 Check_Device_Is_Not_Mounted_At_Beginning
64 [Documentation] Sanity check making sure our device is not there. Fail if found.
66 NetconfViaRestconf.Activate_NVR_Session ${NODE_CONFIGURER}
67 NetconfKeywords.Check_Device_Has_No_Netconf_Connector ${DEVICE_NAME}
69 Configure_Device_On_Netconf
70 [Documentation] Make request to configure a testtool device on Netconf connector
72 NetconfViaRestconf.Activate_NVR_Session ${NODE_CONFIGURER}
73 NetconfKeywords.Configure_Device_In_Netconf ${DEVICE_NAME} device_type=configure-via-topology
75 Check_Configurer_Has_Netconf_Connector_For_Device
76 [Documentation] Get the list of mounts and search for our device there. Fail if not found.
78 NetconfViaRestconf.Activate_NVR_Session ${NODE_CONFIGURER}
79 BuiltIn.Wait_Until_Keyword_Succeeds ${DEVICE_CHECK_TIMEOUT} 1s Check_Device_Instance_Count 1
81 Wait_For_Device_To_Become_Visible_For_Configurer
82 [Documentation] Wait until the device becomes visible on configurer node.
83 NetconfViaRestconf.Activate_NVR_Session ${NODE_CONFIGURER}
84 NetconfKeywords.Wait_Device_Connected ${DEVICE_NAME}
86 Wait_For_Device_To_Become_Visible_For_Checker
87 [Documentation] Wait until the device becomes visible on checker node.
88 NetconfViaRestconf.Activate_NVR_Session ${NODE_CHECKER}
89 NetconfKeywords.Wait_Device_Connected ${DEVICE_NAME}
91 Wait_For_Device_To_Become_Visible_For_Setter
92 [Documentation] Wait until the device becomes visible on setter node.
93 NetconfViaRestconf.Activate_NVR_Session ${NODE_SETTER}
94 NetconfKeywords.Wait_Device_Connected ${DEVICE_NAME}
96 Check_Device_Data_Is_Seen_As_Empty_On_Configurer
97 [Documentation] Get the device data as seen by configurer and make sure it is empty.
98 BuiltIn.Wait_Until_Keyword_Succeeds ${DEVICE_CHECK_TIMEOUT} 1s Check_Config_Data ${NODE_CONFIGURER} ${EMPTY_DATA}
100 Check_Device_Data_Is_Seen_As_Empty_On_Checker
101 [Documentation] Get the device data as seen by checker and make sure it is empty.
102 BuiltIn.Wait_Until_Keyword_Succeeds ${DEVICE_CHECK_TIMEOUT} 1s Check_Config_Data ${NODE_CHECKER} ${EMPTY_DATA}
104 Check_Device_Data_Is_Seen_As_Empty_On_Setter
105 [Documentation] Get the device data as seen by setter and make sure it is empty.
106 BuiltIn.Wait_Until_Keyword_Succeeds ${DEVICE_CHECK_TIMEOUT} 1s Check_Config_Data ${NODE_SETTER} ${EMPTY_DATA}
109 [Documentation] Send some sample test data into the device and check that the request went OK.
110 NetconfViaRestconf.Activate_NVR_Session ${NODE_SETTER}
111 ${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${DEVICE_NAME}'}
112 NetconfViaRestconf.Post_Xml_Template_Folder_Via_Restconf ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}dataorig ${template_as_string}
114 Check_New_Device_Data_Is_Visible_On_Setter
115 [Documentation] Get the device data and make sure it contains the created content.
116 BuiltIn.Wait_Until_Keyword_Succeeds ${DEVICE_CHECK_TIMEOUT} 1s Check_Config_Data ${NODE_SETTER} ${ORIGINAL_DATA}
118 Check_New_Device_Data_Is_Visible_On_Checker
119 [Documentation] Check that the created device data make their way into the checker node.
120 BuiltIn.Wait_Until_Keyword_Succeeds ${DEVICE_CHECK_TIMEOUT} 1s Check_Config_Data ${NODE_CHECKER} ${ORIGINAL_DATA}
122 Check_New_Device_Data_Is_Visible_On_Configurer
123 [Documentation] Check that the created device data make their way into the configurer node.
124 BuiltIn.Wait_Until_Keyword_Succeeds ${DEVICE_CHECK_TIMEOUT} 1s Check_Config_Data ${NODE_CONFIGURER} ${ORIGINAL_DATA}
127 [Documentation] Send a request to change the sample test data and check that the request went OK.
128 NetconfViaRestconf.Activate_NVR_Session ${NODE_SETTER}
129 ${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${DEVICE_NAME}'}
130 NetconfViaRestconf.Put_Xml_Template_Folder_Via_Restconf ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}datamod1 ${template_as_string}
131 [Teardown] Utils.Report_Failure_Due_To_Bug 4968
133 Check_Device_Data_Is_Modified
134 [Documentation] Get the device data and make sure it contains the modified content.
135 Check_Config_Data ${NODE_SETTER} ${MODIFIED_DATA}
136 [Teardown] Utils.Report_Failure_Due_To_Bug 4968
138 Check_Modified_Device_Data_Is_Visible_On_Checker
139 [Documentation] Check that the modified device data make their way into the checker node.
140 BuiltIn.Wait_Until_Keyword_Succeeds 60s 1s Check_Config_Data ${NODE_CHECKER} ${MODIFIED_DATA}
141 [Teardown] Utils.Report_Failure_Due_To_Bug 4968
143 Check_Modified_Device_Data_Is_Visible_On_Configurer
144 [Documentation] Check that the modified device data make their way into the configurer node.
145 BuiltIn.Wait_Until_Keyword_Succeeds 60s 1s Check_Config_Data ${NODE_CONFIGURER} ${MODIFIED_DATA}
146 [Teardown] Utils.Report_Failure_Due_To_Bug 4968
149 [Documentation] Send a request to delete the sample test data on the device and check that the request went OK.
150 NetconfViaRestconf.Activate_NVR_Session ${NODE_SETTER}
151 ${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${DEVICE_NAME}'}
152 NetconfViaRestconf.Delete_Xml_Template_Folder_Via_Restconf ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}datamod1 ${template_as_string}
153 [Teardown] Utils.Report_Failure_Due_To_Bug 4968
155 Check_Device_Data_Is_Deleted
156 [Documentation] Get the device data and make sure it is empty again.
157 Check_Config_Data ${NODE_SETTER} ${EMPTY_DATA}
158 [Teardown] Utils.Report_Failure_Due_To_Bug 4968
160 Check_Device_Data_Deletion_Is_Visible_On_Checker
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_CHECKER} ${EMPTY_DATA}
163 [Teardown] Utils.Report_Failure_Due_To_Bug 4968
165 Check_Device_Data_Deletion_Is_Visible_On_Configurer
166 [Documentation] Check that the device data deletion makes its way into the checker node.
167 BuiltIn.Wait_Until_Keyword_Succeeds 60s 1s Check_Config_Data ${NODE_CONFIGURER} ${EMPTY_DATA}
168 [Teardown] Utils.Report_Failure_Due_To_Bug 4968
170 Deconfigure_Device_In_Netconf
171 [Documentation] Make request to deconfigure the device on Netconf connector.
173 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
174 NetconfViaRestconf.Activate_NVR_Session ${NODE_CONFIGURER}
175 NetconfKeywords.Remove_Device_From_Netconf ${DEVICE_NAME}
177 Check_Device_Deconfigured_On_Configurer
178 [Documentation] Check that the device is really going to be gone. Fail if still there after one minute.
179 ... This is an expected behavior as the unmount request is sent to the config subsystem which
180 ... then triggers asynchronous disconnection of the device which is reflected in the operational
181 ... data once completed. This test makes sure this asynchronous operation does not take
182 ... unreasonable amount of time.
184 NetconfViaRestconf.Activate_NVR_Session ${NODE_CONFIGURER}
185 NetconfKeywords.Wait_Device_Fully_Removed ${DEVICE_NAME}
187 Check_Device_Deconfigured_On_Checker
188 [Documentation] Check that the device is going to be gone from the checker node. Fail if still there after one minute.
190 NetconfViaRestconf.Activate_NVR_Session ${NODE_CHECKER}
191 NetconfKeywords.Wait_Device_Fully_Removed ${DEVICE_NAME}
193 Check_Device_Deconfigured_On_Setter
194 [Documentation] Check that the device is going to be gone from the setter node. Fail if still there after one minute.
196 NetconfViaRestconf.Activate_NVR_Session ${NODE_SETTER}
197 NetconfKeywords.Wait_Device_Fully_Removed ${DEVICE_NAME}
201 [Documentation] Setup everything needed for the test cases.
202 # Setup resources used by the suite.
203 SetupUtils.Setup_Utils_For_Setup_And_Teardown
204 NetconfKeywords.Setup_Netconf_Keywords
205 NetconfViaRestconf.Create_NVR_Session node1 ${ODL_SYSTEM_1_IP}
206 NetconfViaRestconf.Create_NVR_Session node2 ${ODL_SYSTEM_2_IP}
207 NetconfViaRestconf.Create_NVR_Session node3 ${ODL_SYSTEM_3_IP}
208 # Connect to the Mininet machine
209 SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP} prompt=${TOOLS_SYSTEM_PROMPT}
210 Utils.Flexible_Mininet_Login
211 NetconfKeywords.Install_And_Start_Testtool device-count=1 schemas=${CURDIR}/../../../variables/netconf/CRUD/schemas
214 [Documentation] Teardown the test infrastructure, perform cleanup and release all resources.
215 Teardown_Netconf_Via_Restconf
216 RequestsLibrary.Delete_All_Sessions
217 NetconfKeywords.Stop_Testtool
219 Check_Device_Instance_Count
220 [Arguments] ${expected}
221 ${count} NetconfKeywords.Count_Netconf_Connectors_For_Device ${DEVICE_NAME}
222 Builtin.Should_Be_Equal_As_Strings ${count} ${expected}
225 [Arguments] ${node} ${expected} ${contains}=False
226 NetconfViaRestconf.Activate_NVR_Session ${node}
227 ${url}= Builtin.Set_Variable network-topology:network-topology/topology/topology-netconf/node/${DEVICE_NAME}/yang-ext:mount
228 ${data}= NetconfViaRestconf.Get_Config_Data_From_URI ${url} headers=${ACCEPT_XML}
229 BuiltIn.Run_Keyword_Unless ${contains} BuiltIn.Should_Be_Equal_As_Strings ${data} ${expected}
230 BuiltIn.Run_Keyword_If ${contains} BuiltIn.Should_Contain ${data} ${expected}