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_RPC_CREATE}
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 Check_Config_Data <data xmlns\="${ODL_NETCONF_NAMESPACE}"/>
72 Invoke_Yang1.1_Action_Via_Xml_Post
73 [Documentation] Send a sample test data label into the device and check that the request went OK.
74 ${template_as_string} = BuiltIn.Create_Dictionary DEVICE_NAME=${device_name}
75 TemplatedRequests.Post_As_Xml_Templated
76 ... ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}dataorigaction
77 ... ${template_as_string}
79 Invoke_Yang1.1_Action_Via_Json_Post
80 [Documentation] Send a sample test data label into the device and check that the request went OK.
81 ${template_as_string} = BuiltIn.Create_Dictionary DEVICE_NAME=${device_name}
82 TemplatedRequests.Post_As_Json_RFC8040_Templated
83 ... ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}dataorigaction
84 ... ${template_as_string}
86 Invoke_Yang1.1_Augmentation_Via_Xml_Post
87 [Documentation] Send a sample test data label into the device and check that the request went OK.
88 ${template_as_string} = BuiltIn.Create_Dictionary DEVICE_NAME=${device_name}
89 TemplatedRequests.Post_As_Xml_Templated ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}augment ${template_as_string}
91 Invoke_Yang1.1_Augmentation_Via_Json_Post
92 [Documentation] Send a sample test data label into the device and check that the request went OK.
93 ${template_as_string} = BuiltIn.Create_Dictionary DEVICE_NAME=${device_name}
94 TemplatedRequests.Post_As_Json_RFC8040_Templated
95 ... ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}augment
96 ... ${template_as_string}
98 Deconfigure_Device_From_Netconf
99 [Documentation] Make request to deconfigure the testtool device on Netconf connector.
101 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
102 NetconfKeywords.Configure_Device_In_Netconf
104 ... device_type=${DEVICE_TYPE_RPC_DELETE}
108 Check_Device_Going_To_Be_Gone_After_Deconfiguring
109 [Documentation] Check that the device is really going to be gone. Fail
110 ... if found after one minute. This is an expected behavior as the
111 ... delete request is sent to the config subsystem which then triggers
112 ... asynchronous destruction of the netconf connector referring to the
113 ... device and the device's data. This test makes sure this
114 ... asynchronous operation does not take unreasonable amount of time
115 ... by making sure that both the netconf connector and the device's
116 ... data is gone before reporting success.
118 NetconfKeywords.Wait_Device_Fully_Removed ${DEVICE_NAME}
123 [Documentation] Initialize SetupUtils. Setup everything needed for the test cases.
124 SetupUtils.Setup_Utils_For_Setup_And_Teardown
125 RequestsLibrary.Create_Session operational http://${ODL_SYSTEM_IP}:${RESTCONFPORT}${REST_API} auth=${AUTH}
126 NetconfKeywords.Setup_Netconf_Keywords
127 ${DEVICE_TYPE_RPC} = BuiltIn.Set_Variable_If
128 ... """${USE_NETCONF_CONNECTOR}""" == """True"""
130 ... ${DEVICE_TYPE_RPC}
131 OperatingSystem.File Should Exist ${RPC_FILE}
132 NetconfKeywords.Install_And_Start_Testtool
134 ... schemas=${CURDIR}/../../../variables/netconf/CRUD/schemas
135 ... rpc_config=${RPC_FILE}
139 [Documentation] Teardown the test infrastructure, perform cleanup and release all resources.
140 RequestsLibrary.Delete_All_Sessions
141 BuiltIn.Run_Keyword_And_Ignore_Error NetconfKeywords.Stop_Testtool
144 [Documentation] Get and return the config data from the device.
145 ${url} = Builtin.Set_Variable
146 ... ${REST_API}/network-topology:network-topology/topology=topology-netconf/node=${DEVICE_NAME}/yang-ext:mount?content=config
147 ${data} = TemplatedRequests.Get_As_Xml_From_Uri ${url}
151 [Arguments] ${expected} ${contains}=False
152 ${data} = Get_Config_Data
154 BuiltIn.Should_Be_Equal_As_Strings ${data} ${expected}
156 IF ${contains} BuiltIn.Should_Contain ${data} ${expected}