2 Documentation Basic tests for BGP application peer.
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
10 ... Test suite performs basic subscribtion case for data store notifications.
11 ... For procedure description see the
12 ... https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL:Restconf:Change_event_notification_subscription
15 ... This suite uses inventory (config part) as an area to make dummy writes into,
16 ... just to trigger data change listener to produce a notification.
17 ... Openflowplugin may have some data there, and before Boron, netconf-connector
18 ... was also exposing some data in inventory.
20 ... To avoid unexpected responses, this suite depetes all data from config inventory,
21 ... so this suite should not be followed by any suite expecting default data there.
24 ... Bug 3934 - Websockets: Scope ONE doesn't work correctly
26 ... TODO: Use cars/people model for data
29 Library OperatingSystem
30 Library RequestsLibrary
31 Library SSHLibrary timeout=10s
33 Resource ${CURDIR}/../../../libraries/ClusterManagement.robot
34 Resource ${CURDIR}/../../../libraries/FailFast.robot
35 Resource ${CURDIR}/../../../libraries/KarafKeywords.robot
36 Resource ${CURDIR}/../../../libraries/NetconfKeywords.robot
37 Resource ${CURDIR}/../../../libraries/Restconf.robot
38 Resource ${CURDIR}/../../../libraries/SetupUtils.robot
39 Resource ${CURDIR}/../../../libraries/SSHKeywords.robot
40 Resource ${CURDIR}/../../../libraries/TemplatedRequests.robot
41 Resource ${CURDIR}/../../../libraries/WaitForFailure.robot
42 Resource ${CURDIR}/../../../variables/Variables.robot
44 Suite Setup Setup_Everything
45 Suite Teardown Teardown_Everything
46 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
47 Test Teardown SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed
51 ${TEMPLATE_FOLDER} ${CURDIR}/templates
52 ${RFC8040_STREAMS_URI} rests/data/ietf-restconf-monitoring:restconf-state/streams
53 ${NODES_STREAM_PATH} network-topology:network-topology/datastore=CONFIGURATION/scope=BASE
54 ${RFC8040_DCN_STREAM_URI} ${RFC8040_STREAMS_URI}/stream/data-change-event-subscription/${NODES_STREAM_PATH}
55 ${RESTCONF_SUBSCRIBE_DATA} subscribe.xml
56 ${RESTCONF_CONFIG_DATA} config_data.xml
57 ${RECEIVER_LOG_FILE} receiver.log
58 ${CONTROLLER_LOG_LEVEL} INFO
63 [Documentation] Create DCN stream.
65 Comment Create DCN subscription
66 ${body} = OperatingSystem.Get_File ${TEMPLATE_FOLDER}/${RESTCONF_SUBSCRIBE_DATA}
67 ${uri} = Restconf.Generate URI sal-remote:create-data-change-event-subscription rpc
68 ${resp} = RequestsLibrary.Post_On_Session
71 ... headers=${SEND_ACCEPT_XML_HEADERS}
74 BuiltIn.Should_Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
76 Subscribe_To_DCN_Stream
77 [Documentation] Subscribe to DCN streams.
79 ${resp} = RequestsLibrary.Get_On_Session
81 ... url=${RFC8040_DCN_STREAM_URI}
82 ... headers=${SEND_ACCEPT_XML_HEADERS}
84 BuiltIn.Should_Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
85 ${location} = XML.Get_Element_Text ${resp.content}
86 BuiltIn.Log ${location}
87 BuiltIn.Log ${resp.headers["Location"]}
88 Should Contain ${location} ${resp.headers["Location"]}
89 BuiltIn.Set_Suite_Variable ${location}
92 [Documentation] List DCN streams.
94 ${resp} = RequestsLibrary.Get_On_Session
96 ... url=${RFC8040_DCN_STREAM_URI}
97 ... headers=${SEND_ACCEPT_XML_HEADERS}
99 BuiltIn.Should_Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
100 Comment Stream only shows in RFC URL.
101 BuiltIn.Should_Contain ${resp.text} ${NODES_STREAM_PATH}
104 [Documentation] Start the websocket listener
105 ${output} = SSHLibrary.Write python3 ssereceiver.py --uri ${location} --logfile ${RECEIVER_LOG_FILE}
106 BuiltIn.Log ${output}
107 ${output} = SSHLibrary.Read delay=2s
108 BuiltIn.Log ${output}
111 [Documentation] Make a change in DS configuration.
113 ${body} = OperatingSystem.Get_File ${TEMPLATE_FOLDER}/${RESTCONF_CONFIG_DATA}
114 ${uri} = BuiltIn.Set_Variable /rests/data/network-topology:network-topology
115 ${resp} = RequestsLibrary.Put_On_Session
118 ... headers=${SEND_ACCEPT_XML_HEADERS}
121 BuiltIn.Should_Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
122 ${uri} = BuiltIn.Set_Variable /rests/data/network-topology:network-topology/topology=netconf-notif
123 ${resp} = RequestsLibrary.Delete_On_Session restconf ${uri} headers=${SEND_ACCEPT_XML_HEADERS}
125 BuiltIn.Should_Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
128 [Documentation] Check the WSS/SSE listener log for a change notification.
130 ${notification} = SSHLibrary.Execute_Command cat ${RECEIVER_LOG_FILE}
131 BuiltIn.Log ${notification}
132 BuiltIn.Set_Suite_Variable ${notification}
133 BuiltIn.Should_Contain ${notification} <notification xmlns=
134 BuiltIn.Should_Contain ${notification} <eventTime>
135 BuiltIn.Should_Contain ${notification} <data-changed-notification xmlns=
136 BuiltIn.Should_Contain ${notification} <operation>updated</operation>
137 BuiltIn.Should_Contain ${notification} </data-change-event>
138 BuiltIn.Should_Contain ${notification} </data-changed-notification>
139 BuiltIn.Should_Contain ${notification} </notification>
141 Check_Delete_Notification
142 [Documentation] Check the websocket listener log for a delete notification.
144 BuiltIn.Should_Contain ${notification} <operation>deleted</operation>
147 [Documentation] Check the websocket listener log for the bug correction.
149 ${data} = OperatingSystem.Get_File ${TEMPLATE_FOLDER}/${RESTCONF_CONFIG_DATA}
151 BuiltIn.Log ${notification}
152 ${packed_data} = String.Remove_String ${data} \n
153 ${packed_data} = String.Remove_String ${packed_data} ${SPACE}
154 ${packed_notification} = String.Remove_String ${notification} \n
155 ${packed_notification} = String.Remove_String ${packed_notification} \\n
156 ${packed_notification} = String.Remove_String ${packed_notification} ${SPACE}
157 BuiltIn.Should_Contain ${packed_notification} ${packed_data}
158 [Teardown] Report_Failure_Due_To_Bug 3934
163 [Documentation] SSH-login to mininet machine, create HTTP session,
164 ... prepare directories for responses, put Python tool to mininet machine, setup imported resources.
165 SetupUtils.Setup_Utils_For_Setup_And_Teardown
166 KarafKeywords.Open_Controller_Karaf_Console_On_Background
167 SSHKeywords.Open_Connection_To_Tools_System
168 SSHLibrary.Put_File ${CURDIR}/../../../../tools/wstools/wsreceiver.py
169 SSHLibrary.Put_File ${CURDIR}/../../../../tools/wstools/ssereceiver.py
170 SSHLibrary.Execute_Command sudo apt-get install -y python3-pip return_stdout=True return_stderr=True
171 SSHLibrary.Execute_Command
172 ... sudo python3 -m pip install --upgrade pip setuptools wheel
173 ... return_stdout=True
174 ... return_stderr=True
175 SSHLibrary.Execute_Command
176 ... sudo python3 -m pip install websocket-client asyncio aiohttp aiohttp-sse-client coroutine
177 ... return_stdout=True
178 ... return_stderr=True
179 RequestsLibrary.Create_Session restconf http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
180 KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set ${CONTROLLER_LOG_LEVEL}
183 [Documentation] Close connections.
184 ... Tear down imported Resources.
185 RequestsLibrary.Delete_All_Sessions
186 SSHLibrary.Close_All_Connections
189 [Documentation] Log response.
192 BuiltIn.Log ${resp.headers}
193 BuiltIn.Log ${resp.text}