*** Settings ***
Documentation Basic tests for BGP application peer.
-...
+...
... Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
-...
+...
... This program and the accompanying materials are made available under the
... terms of the Eclipse Public License v1.0 which accompanies this distribution,
... and is available at http://www.eclipse.org/legal/epl-v10.html
-...
+...
... Test suite performs basic subscribtion case for data store notifications.
... For procedure description see the
... https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL:Restconf:Change_event_notification_subscription
-...
-...
+...
+...
... This suite uses inventory (config part) as an area to make dummy writes into,
... just to trigger data change listener to produce a notification.
... Openflowplugin may have some data there, and before Boron, netconf-connector
... was also exposing some data in inventory.
-...
+...
... To avoid unexpected responses, this suite depetes all data from config inventory,
... so this suite should not be followed by any suite expecting default data there.
-...
+...
... Covered bugs:
... Bug 3934 - Websockets: Scope ONE doesn't work correctly
-...
+...
... TODO: Use cars/people model for data
Suite Setup Setup_Everything
Suite Teardown Teardown_Everything
Library RequestsLibrary
Library SSHLibrary timeout=10s
Library XML
-Resource ${CURDIR}/../../../variables/Variables.robot
+Resource ${CURDIR}/../../../libraries/ClusterManagement.robot
Resource ${CURDIR}/../../../libraries/FailFast.robot
Resource ${CURDIR}/../../../libraries/KarafKeywords.robot
+Resource ${CURDIR}/../../../libraries/NetconfKeywords.robot
Resource ${CURDIR}/../../../libraries/Restconf.robot
Resource ${CURDIR}/../../../libraries/SetupUtils.robot
Resource ${CURDIR}/../../../libraries/SSHKeywords.robot
Resource ${CURDIR}/../../../libraries/TemplatedRequests.robot
Resource ${CURDIR}/../../../libraries/WaitForFailure.robot
+Resource ${CURDIR}/../../../variables/Variables.robot
*** Variables ***
${TEMPLATE_FOLDER} ${CURDIR}/templates
${RESTCONF_SUBSCRIBE_DATA} subscribe.xml
${NODES_STREAM_PATH} opendaylight-inventory:nodes/datastore=CONFIGURATION/scope=BASE
${RESTCONF_GET_SUBSCRIPTION_URI} restconf/streams/stream/data-change-event-subscription/${NODES_STREAM_PATH}
-${RFC8040_GET_SUBSCRIPTION_URI} rests/data/ietf-restconf-monitoring:restconf-state/streams/stream/data-change-event-subscription/${NODES_STREAM_PATH}
+${RFC8040_NOTIFICATIONS_STREAMS_URI} rests/data/ietf-restconf-monitoring:restconf-state/streams
+${RFC8040_GET_SUBSCRIPTION_URI} ${RFC8040_NOTIFICATIONS_STREAMS_URI}/stream/data-change-event-subscription/${NODES_STREAM_PATH}
${RESTCONF_CONFIG_DATA} config_data.xml
${RECEIVER_LOG_FILE} wsreceiver.log
${RECEIVER_OPTIONS} ${EMPTY}
[Documentation] Make sure config inventory is empty.
[Tags] critical
${uri} = Restconf.Generate URI opendaylight-inventory:nodes config
- TemplatedRequests.Delete_From_Uri uri=${uri} additional_allowed_status_codes=${DELETED_STATUS_CODE}
+ TemplatedRequests.Delete_From_Uri uri=${uri} additional_allowed_status_codes=${DELETED_STATUS_CODES}
# TODO: Rework also other test cases to use TemplatedRequests.
-Create_Subscribtion
+Create_Subscription
[Documentation] Subscribe for notifications.
[Tags] critical
+ # check get streams url passes prior to creating a subscription
+ ${resp} = RequestsLibrary.Get_Request restconf ${RFC8040_NOTIFICATIONS_STREAMS_URI} headers=${SEND_ACCEPT_XML_HEADERS}
+ Log_Response ${resp}
+ BuiltIn.Should_Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
${body} = OperatingSystem.Get_File ${TEMPLATE_FOLDER}/${RESTCONF_SUBSCRIBE_DATA}
BuiltIn.Log ${RESTCONF_SUBSCRIBE_URI}
BuiltIn.Log ${body}
Log_Response ${resp}
BuiltIn.Should_Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
-Check_Subscribtion
- [Documentation] Get & check subscribtion ...
+Check_Notification_Stream
+ [Documentation] Check any notification stream via RESTCONF is accessible
+ [Tags] critical
+ ${resp} = RequestsLibrary.Get_Request restconf ${RFC8040_NOTIFICATIONS_STREAMS_URI} headers=${SEND_ACCEPT_XML_HEADERS}
+ Log_Response ${resp}
+ BuiltIn.Should_Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
+ ${root}= XML.Parse XML ${resp.content}
+ ${name}= Get Elements Texts ${root} stream/name
+ BuiltIn.Log ${name[0]}
+ ${resp} = RequestsLibrary.Get_Request restconf ${RFC8040_NOTIFICATIONS_STREAMS_URI}/stream=${name[0]}/access=JSON/location headers=${SEND_ACCEPT_XML_HEADERS}
+ Log_Response ${resp}
+ BuiltIn.Should_Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
+
+Check_Subscription
+ [Documentation] Get & check subscription ...
[Tags] critical
${uri} = Set Variable If "${USE_RFC8040}" == "False" ${RESTCONF_GET_SUBSCRIPTION_URI} ${RFC8040_GET_SUBSCRIPTION_URI}
${resp} = RequestsLibrary.Get_Request restconf ${uri} headers=${SEND_ACCEPT_XML_HEADERS}
BuiltIn.Should_Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
${location} = XML.Get Element Text ${resp.content}
BuiltIn.Log ${location}
+ BuiltIn.Log ${resp.headers["Location"]}
+ Should Contain ${location} ${resp.headers["Location"]}
BuiltIn.Set_Suite_Variable ${location}
Start_Receiver
[Documentation] SSH-login to mininet machine, create HTTP session,
... prepare directories for responses, put Python tool to mininet machine, setup imported resources.
SetupUtils.Setup_Utils_For_Setup_And_Teardown
+ Disable SSE On Controller ${CONTROLLER}
+ ClusterManagement.Stop_Members_From_List_Or_All
+ ClusterManagement.Start_Members_From_List_Or_All
+ KarafKeywords.Open_Controller_Karaf_Console_On_Background
TemplatedRequests.Create_Default_Session
SSHLibrary.Set_Default_Configuration prompt=${TOOLS_SYSTEM_PROMPT}
SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP} alias=receiver