2 Documentation netconf-connector CRUD-Action test suite.
4 ... Copyright (c) 2019 Ericsson Software Technology AB. 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 using RPC for node supporting Yang 1.1
13 ... addition and see if invoking Action Operation work.
16 Library RequestsLibrary
17 Library OperatingSystem
19 Library SSHLibrary timeout=10s
20 Resource ${CURDIR}/../../../libraries/CompareStream.robot
21 Resource ${CURDIR}/../../../libraries/FailFast.robot
22 Resource ${CURDIR}/../../../libraries/NetconfKeywords.robot
23 Resource ${CURDIR}/../../../libraries/SetupUtils.robot
24 Resource ${CURDIR}/../../../libraries/TemplatedRequests.robot
25 Resource ${CURDIR}/../../../variables/Variables.robot
27 Suite Setup Setup_Everything
28 Suite Teardown Teardown_Everything
29 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
33 ${DIRECTORY_WITH_TEMPLATE_FOLDERS} ${CURDIR}/../../../variables/netconf/CRUD
34 ${DEVICE_NAME} netconf-test-device
35 ${DEVICE_TYPE_RPC} rpc-device
36 ${DEVICE_TYPE_RPC_CREATE} rpc-create-device
37 ${DEVICE_TYPE_RPC_DELETE} rpc-delete-device
38 ${USE_NETCONF_CONNECTOR} ${False}
39 ${DELETE_LOCATION} delete_location
40 ${RPC_FILE} ${CURDIR}/../../../variables/netconf/CRUD/customaction/customaction.xml
44 Check_Device_Is_Not_Configured_At_Beginning
45 [Documentation] Sanity check making sure our device is not there. Fail if found.
47 NetconfKeywords.Check_Device_Has_No_Netconf_Connector ${DEVICE_NAME}
49 Configure_Device_On_Netconf
50 [Documentation] Make request to configure a testtool device on Netconf connector.
52 NetconfKeywords.Configure_Device_In_Netconf
54 ... device_type=${DEVICE_TYPE}
58 Check_ODL_Has_Netconf_Connector_For_Device
59 [Documentation] Get the list of configured devices and search for our device there. Fail if not found.
61 ${count} = NetconfKeywords.Count_Netconf_Connectors_For_Device ${DEVICE_NAME}
62 Builtin.Should_Be_Equal_As_Strings ${count} 1
64 Wait_For_Device_To_Become_Connected
65 [Documentation] Wait until the device becomes available through Netconf.
66 NetconfKeywords.Wait_Device_Connected ${DEVICE_NAME}
68 Check_Device_Data_Is_Empty
69 [Documentation] Get the device data and make sure it is empty.
70 Run_Keyword_If_Less_Than_Neon Check_Config_Data <data xmlns\="${ODL_NETCONF_NAMESPACE}"></data>
71 Run_Keyword_If_At_Least_Neon Check_Config_Data <data xmlns\="${ODL_NETCONF_NAMESPACE}"/>
73 Invoke_Yang1.1_Action_Via_Xml_Post
74 [Documentation] Send a sample test data label into the device and check that the request went OK.
75 ${template_as_string} = BuiltIn.Create_Dictionary DEVICE_NAME=${device_name}
76 TemplatedRequests.Post_As_Xml_Templated
77 ... ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}dataorigaction
78 ... ${template_as_string}
80 Invoke_Yang1.1_Action_Via_Json_Post
81 [Documentation] Send a sample test data label into the device and check that the request went OK.
82 ${template_as_string} = BuiltIn.Create_Dictionary DEVICE_NAME=${device_name}
83 TemplatedRequests.Post_As_Json_RFC8040_Templated
84 ... ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}dataorigaction
85 ... ${template_as_string}
87 Invoke_Yang1.1_Augmentation_Via_Xml_Post
88 [Documentation] Send a sample test data label into the device and check that the request went OK.
89 ${template_as_string} = BuiltIn.Create_Dictionary DEVICE_NAME=${device_name}
90 TemplatedRequests.Post_As_Xml_Templated ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}augment ${template_as_string}
92 Invoke_Yang1.1_Augmentation_Via_Json_Post
93 [Documentation] Send a sample test data label into the device and check that the request went OK.
94 ${template_as_string} = BuiltIn.Create_Dictionary DEVICE_NAME=${device_name}
95 TemplatedRequests.Post_As_Json_RFC8040_Templated
96 ... ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}augment
97 ... ${template_as_string}
99 Deconfigure_Device_From_Netconf
100 [Documentation] Make request to deconfigure the testtool device on Netconf connector.
102 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
103 CompareStream.Run_Keyword_If_At_Most_Nitrogen
104 ... NetconfKeywords.Remove_Device_From_Netconf
106 ... location=${DELETE_LOCATION}
107 CompareStream.Run_Keyword_If_At_Least_Oxygen
108 ... NetconfKeywords.Configure_Device_In_Netconf
110 ... device_type=${DEVICE_TYPE_RPC_DELETE}
114 Check_Device_Going_To_Be_Gone_After_Deconfiguring
115 [Documentation] Check that the device is really going to be gone. Fail
116 ... if found after one minute. This is an expected behavior as the
117 ... delete request is sent to the config subsystem which then triggers
118 ... asynchronous destruction of the netconf connector referring to the
119 ... device and the device's data. This test makes sure this
120 ... asynchronous operation does not take unreasonable amount of time
121 ... by making sure that both the netconf connector and the device's
122 ... data is gone before reporting success.
124 NetconfKeywords.Wait_Device_Fully_Removed ${DEVICE_NAME}
129 [Documentation] Initialize SetupUtils. Setup everything needed for the test cases.
130 SetupUtils.Setup_Utils_For_Setup_And_Teardown
131 RequestsLibrary.Create_Session operational http://${ODL_SYSTEM_IP}:${RESTCONFPORT}${REST_API} auth=${AUTH}
132 NetconfKeywords.Setup_Netconf_Keywords
133 ${DEVICE_TYPE_RPC} = BuiltIn.Set_Variable_If
134 ... """${USE_NETCONF_CONNECTOR}""" == """True"""
136 ... ${DEVICE_TYPE_RPC}
137 ${DEVICE_TYPE} = CompareStream.Set_Variable_If_At_Most_Nitrogen
138 ... ${DEVICE_TYPE_RPC}
139 ... ${DEVICE_TYPE_RPC_CREATE}
140 BuiltIn.Set_Suite_Variable ${DEVICE_TYPE}
141 OperatingSystem.File Should Exist ${RPC_FILE}
142 NetconfKeywords.Install_And_Start_Testtool
144 ... schemas=${CURDIR}/../../../variables/netconf/CRUD/schemas
145 ... rpc_config=${RPC_FILE}
149 [Documentation] Teardown the test infrastructure, perform cleanup and release all resources.
150 RequestsLibrary.Delete_All_Sessions
151 BuiltIn.Run_Keyword_And_Ignore_Error NetconfKeywords.Stop_Testtool
154 [Documentation] Get and return the config data from the device.
155 ${url} = Builtin.Set_Variable
156 ... ${REST_API}/network-topology:network-topology/topology=topology-netconf/node=${DEVICE_NAME}/yang-ext:mount?content=config
157 ${data} = TemplatedRequests.Get_As_Xml_From_Uri ${url}
161 [Arguments] ${expected} ${contains}=False
162 ${data} = Get_Config_Data
164 BuiltIn.Should_Be_Equal_As_Strings ${data} ${expected}
166 IF ${contains} BuiltIn.Should_Contain ${data} ${expected}