X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Fsuites%2Fnetconf%2Fnotifications%2Fnotifications_basic.robot;h=391dc6b585e6130af9010de268b413827c878066;hb=be97c174c1ad8a32ba91c826a441008264b0f515;hp=1e2e45aa457b2c5b552e0c9ac225592fb9f675c0;hpb=7feb3e40725da419b2fbb05b6023f231303d630c;p=integration%2Ftest.git diff --git a/csit/suites/netconf/notifications/notifications_basic.robot b/csit/suites/netconf/notifications/notifications_basic.robot index 1e2e45aa45..391dc6b585 100644 --- a/csit/suites/netconf/notifications/notifications_basic.robot +++ b/csit/suites/netconf/notifications/notifications_basic.robot @@ -1,61 +1,62 @@ *** Settings *** -Documentation Basic tests for BGP application peer. +Documentation Basic tests for BGP application peer. ... -... Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved. +... 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 +... 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 +... 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. +... 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. +... 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 +... 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 -Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing -Test Teardown SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed -Library Collections -Library OperatingSystem -Library RequestsLibrary -Library SSHLibrary timeout=10s -Library XML -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 +... TODO: Use cars/people model for data + +Library Collections +Library OperatingSystem +Library RequestsLibrary +Library SSHLibrary timeout=10s +Library XML +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 + +Suite Setup Setup_Everything +Suite Teardown Teardown_Everything +Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing +Test Teardown SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed + *** Variables *** -${TEMPLATE_FOLDER} ${CURDIR}/templates -${DRAFT_STREAMS_URI} restconf/streams -${RFC8040_STREAMS_URI} rests/data/ietf-restconf-monitoring:restconf-state/streams -${NODES_STREAM_PATH} network-topology:network-topology/datastore=CONFIGURATION/scope=BASE -${DRAFT_DCN_STREAM_URI} ${DRAFT_STREAMS_URI}/stream/data-change-event-subscription/${NODES_STREAM_PATH} -${RFC8040_DCN_STREAM_URI} ${RFC8040_STREAMS_URI}/stream/data-change-event-subscription/${NODES_STREAM_PATH} -${RESTCONF_SUBSCRIBE_DATA} subscribe.xml -${RESTCONF_CONFIG_DATA} config_data.xml -${RECEIVER_LOG_FILE} receiver.log -${RECEIVER_OPTIONS} ${EMPTY} -${CONTROLLER_LOG_LEVEL} INFO +${TEMPLATE_FOLDER} ${CURDIR}/templates +${RFC8040_STREAMS_URI} rests/data/ietf-restconf-monitoring:restconf-state/streams +${NODES_STREAM_PATH} network-topology:network-topology/datastore=CONFIGURATION/scope=BASE +${RFC8040_DCN_STREAM_URI} ${RFC8040_STREAMS_URI}/stream/data-change-event-subscription/${NODES_STREAM_PATH} +${RESTCONF_SUBSCRIBE_DATA} subscribe.xml +${RESTCONF_CONFIG_DATA} config_data.xml +${RECEIVER_LOG_FILE} receiver.log +${CONTROLLER_LOG_LEVEL} INFO + *** Test Cases *** Create_DCN_Stream @@ -64,15 +65,21 @@ Create_DCN_Stream Comment Create DCN subscription ${body} = OperatingSystem.Get_File ${TEMPLATE_FOLDER}/${RESTCONF_SUBSCRIBE_DATA} ${uri} = Restconf.Generate URI sal-remote:create-data-change-event-subscription rpc - ${resp} = RequestsLibrary.Post_Request restconf ${uri} headers=${SEND_ACCEPT_XML_HEADERS} data=${body} + ${resp} = RequestsLibrary.Post_On_Session + ... restconf + ... ${uri} + ... headers=${SEND_ACCEPT_XML_HEADERS} + ... data=${body} Log_Response ${resp} BuiltIn.Should_Contain ${ALLOWED_STATUS_CODES} ${resp.status_code} Subscribe_To_DCN_Stream [Documentation] Subscribe to DCN streams. [Tags] critical - ${uri} = Set Variable If "${USE_RFC8040}" == "False" ${DRAFT_DCN_STREAM_URI} ${RFC8040_DCN_STREAM_URI} - ${resp} = RequestsLibrary.Get_Request restconf ${uri} headers=${SEND_ACCEPT_XML_HEADERS} + ${resp} = RequestsLibrary.Get_On_Session + ... restconf + ... url=${RFC8040_DCN_STREAM_URI} + ... headers=${SEND_ACCEPT_XML_HEADERS} Log_Response ${resp} BuiltIn.Should_Contain ${ALLOWED_STATUS_CODES} ${resp.status_code} ${location} = XML.Get_Element_Text ${resp.content} @@ -84,17 +91,18 @@ Subscribe_To_DCN_Stream List_DCN_Streams [Documentation] List DCN streams. [Tags] critical - ${uri} = BuiltIn.Set_Variable_If "${USE_RFC8040}" == "False" ${DRAFT_STREAMS_URI} ${RFC8040_STREAMS_URI} - ${resp} = RequestsLibrary.Get_Request restconf ${uri} headers=${SEND_ACCEPT_XML_HEADERS} + ${resp} = RequestsLibrary.Get_On_Session + ... restconf + ... url=${RFC8040_DCN_STREAM_URI} + ... headers=${SEND_ACCEPT_XML_HEADERS} Log_Response ${resp} BuiltIn.Should_Contain ${ALLOWED_STATUS_CODES} ${resp.status_code} Comment Stream only shows in RFC URL. - BuiltIn.Run_Keyword_If "${USE_RFC8040}" == "True" BuiltIn.Should_Contain ${resp.text} ${NODES_STREAM_PATH} + BuiltIn.Should_Contain ${resp.text} ${NODES_STREAM_PATH} Start_Receiver [Documentation] Start the websocket listener - ${output} = BuiltIn.Run_Keyword_If "${USE_RFC8040}" == "False" SSHLibrary.Write python3 wsreceiver.py --uri ${location} --count 2 --logfile ${RECEIVER_LOG_FILE} ${RECEIVER_OPTIONS} - ... ELSE SSHLibrary.Write python3 ssereceiver.py --uri ${location} --logfile ${RECEIVER_LOG_FILE} + ${output} = SSHLibrary.Write python3 ssereceiver.py --uri ${location} --logfile ${RECEIVER_LOG_FILE} BuiltIn.Log ${output} ${output} = SSHLibrary.Read delay=2s BuiltIn.Log ${output} @@ -103,14 +111,16 @@ Change_DS_Config [Documentation] Make a change in DS configuration. [Tags] critical ${body} = OperatingSystem.Get_File ${TEMPLATE_FOLDER}/${RESTCONF_CONFIG_DATA} - ${uri} = BuiltIn.Set_Variable_If "${USE_RFC8040}" == "False" /restconf/config/network-topology:network-topology - ... /rests/data/network-topology:network-topology - ${resp} = RequestsLibrary.Put_Request restconf ${uri} headers=${SEND_ACCEPT_XML_HEADERS} data=${body} + ${uri} = BuiltIn.Set_Variable /rests/data/network-topology:network-topology + ${resp} = RequestsLibrary.Put_On_Session + ... restconf + ... ${uri} + ... headers=${SEND_ACCEPT_XML_HEADERS} + ... data=${body} Log_Response ${resp} BuiltIn.Should_Contain ${ALLOWED_STATUS_CODES} ${resp.status_code} - ${uri} = BuiltIn.Set_Variable_If "${USE_RFC8040}" == "False" /restconf/config/network-topology:network-topology/topology/netconf-notif - ... /rests/data/network-topology:network-topology/topology=netconf-notif - ${resp} = RequestsLibrary.Delete_Request restconf ${uri} headers=${SEND_ACCEPT_XML_HEADERS} + ${uri} = BuiltIn.Set_Variable /rests/data/network-topology:network-topology/topology=netconf-notif + ${resp} = RequestsLibrary.Delete_On_Session restconf ${uri} headers=${SEND_ACCEPT_XML_HEADERS} Log_Response ${resp} BuiltIn.Should_Contain ${ALLOWED_STATUS_CODES} ${resp.status_code} @@ -147,6 +157,7 @@ Check_Bug_3934 BuiltIn.Should_Contain ${packed_notification} ${packed_data} [Teardown] Report_Failure_Due_To_Bug 3934 + *** Keywords *** Setup_Everything [Documentation] SSH-login to mininet machine, create HTTP session, @@ -156,10 +167,16 @@ Setup_Everything SSHKeywords.Open_Connection_To_Tools_System SSHLibrary.Put_File ${CURDIR}/../../../../tools/wstools/wsreceiver.py SSHLibrary.Put_File ${CURDIR}/../../../../tools/wstools/ssereceiver.py - SSHLibrary.Execute Command sudo apt-get install -y python-pip return_stdout=True return_stderr=True - SSHLibrary.Execute_Command sudo pip install websocket-client return_stdout=True return_stderr=True - SSHLibrary.Execute Command sudo python3 -m pip install asyncio aiohttp aiohttp-sse-client coroutine return_stdout=True return_stderr=True - RequestsLibrary.Create Session restconf http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} + SSHLibrary.Execute_Command sudo apt-get install -y python3-pip return_stdout=True return_stderr=True + SSHLibrary.Execute_Command + ... sudo python3 -m pip install --upgrade pip setuptools wheel + ... return_stdout=True + ... return_stderr=True + SSHLibrary.Execute_Command + ... sudo python3 -m pip install websocket-client asyncio aiohttp aiohttp-sse-client coroutine + ... return_stdout=True + ... return_stderr=True + RequestsLibrary.Create_Session restconf http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set ${CONTROLLER_LOG_LEVEL} Teardown_Everything @@ -169,8 +186,8 @@ Teardown_Everything SSHLibrary.Close_All_Connections Log_Response - [Arguments] ${resp} [Documentation] Log response. + [Arguments] ${resp} BuiltIn.Log ${resp} BuiltIn.Log ${resp.headers} BuiltIn.Log ${resp.text}