Disable port security for l2gw csit netvirt
[integration/test.git] / csit / suites / netconf / notifications / notifications_basic.robot
index 7e23842a8995ee3cc246a89c7e516bba4e927026..155bfce1f9846412a621ae16d7389fbc2950a7f4 100644 (file)
@@ -11,6 +11,15 @@ Documentation     Basic tests for BGP application peer.
 ...               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
 ...
@@ -18,19 +27,17 @@ Documentation     Basic tests for BGP application peer.
 Suite Setup       Setup_Everything
 Suite Teardown    Teardown_Everything
 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
-Test Teardown     FailFast.Start_Failing_Fast_If_This_Failed
+Test Teardown     SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed
 Library           OperatingSystem
 Library           SSHLibrary    timeout=10s
 Library           RequestsLibrary
 Library           Collections
-Library           ${CURDIR}/../../../libraries/HsfJson/hsf_json.py
 Variables         ${CURDIR}/../../../variables/Variables.py
-Resource          ${CURDIR}/../../../libraries/ConfigViaRestconf.robot
 Resource          ${CURDIR}/../../../libraries/FailFast.robot
 Resource          ${CURDIR}/../../../libraries/KarafKeywords.robot
 Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
 Resource          ${CURDIR}/../../../libraries/SSHKeywords.robot
-Resource          ${CURDIR}/../../../libraries/Utils.robot
+Resource          ${CURDIR}/../../../libraries/TemplatedRequests.robot
 Resource          ${CURDIR}/../../../libraries/WaitForFailure.robot
 
 *** Variables ***
@@ -38,7 +45,6 @@ ${TEMPLATE_FOLDER}    ${CURDIR}/templates
 ${RESTCONF_SUBSCRIBE_URI}    restconf/operations/sal-remote:create-data-change-event-subscription
 ${RESTCONF_SUBSCRIBE_DATA}    subscribe.xml
 ${RESTCONF_GET_SUBSCRIPTION_URI}    restconf/streams/stream/data-change-event-subscription/opendaylight-inventory:nodes/datastore=CONFIGURATION/scope=BASE
-${RESTCONF_GET_SUBSCRIPTION_URI_LITHIUM}    restconf/streams/stream/opendaylight-inventory:nodes/datastore=CONFIGURATION/scope=BASE
 ${RESTCONF_CONFIG_URI}    restconf/config
 ${RESTCONF_CONFIG_DATA}    config_data.xml
 ${RECEIVER_LOG_FILE}    wsreceiver.log
@@ -47,12 +53,11 @@ ${CONTROLLER_LOG_LEVEL}    INFO
 
 *** Test Cases ***
 Clean_Config
-    [Documentation]    Delete item in configuration.
+    [Documentation]    Make sure config inventory is empty.
     [Tags]    critical
     BuiltIn.Log    ${CONFIG_NODES_API}
-    ${resp} =    RequestsLibrary.Delete_Request    restconf    ${CONFIG_NODES_API}    headers=${SEND_ACCEPT_XML_HEADERS}
-    Log_Response    ${resp}
-    BuiltIn.Should_Be_Equal_As_Strings    ${resp.status_code}    200
+    TemplatedRequests.Delete_From_Uri    uri=${CONFIG_NODES_API}    additional_allowed_status_codes=${DELETED_STATUS_CODE}
+    # TODO: Rework also other test cases to use TemplatedRequests.
 
 Create_Subscribtion
     [Documentation]    Subscribe for notifications.
@@ -67,7 +72,7 @@ Create_Subscribtion
 Check_Subscribtion
     [Documentation]    Get & check subscribtion ...
     [Tags]    critical
-    ${resp} =    RequestsLibrary.Get_Request    restconf    ${restconf_subscription_stream_uri}    headers=${SEND_ACCEPT_XML_HEADERS}
+    ${resp} =    RequestsLibrary.Get_Request    restconf    ${RESTCONF_GET_SUBSCRIPTION_URI}    headers=${SEND_ACCEPT_XML_HEADERS}
     Log_Response    ${resp}
     BuiltIn.Should_Be_Equal_As_Strings    ${resp.status_code}    200    Response    status code error
     ${location} =    Collections.Get_From_Dictionary    ${resp.headers}    location
@@ -130,9 +135,10 @@ Setup_Everything
     [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
+    TemplatedRequests.Create_Default_Session
     SSHLibrary.Set_Default_Configuration    prompt=${TOOLS_SYSTEM_PROMPT}
     SSHLibrary.Open_Connection    ${TOOLS_SYSTEM_IP}    alias=receiver
-    Utils.Flexible_Mininet_Login
+    SSHKeywords.Flexible_Mininet_Login
     SSHLibrary.Put_File    ${CURDIR}/../../../../tools/wstools/wsreceiver.py
     ${output_log}    ${error_log} =    SSHLibrary.Execute Command    sudo apt-get install -y python-pip    return_stdout=True    return_stderr=True
     BuiltIn.Log    ${output_log}
@@ -144,14 +150,11 @@ Setup_Everything
     Should Contain    ${output_log}    websocket
     RequestsLibrary.Create Session    restconf    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}
     BuiltIn.Log    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}
-    ${restconf_subscription_stream_uri} =    BuiltIn.Set_Variable_If    """"ODL_STREAM""" == "stable-lithium"    ${RESTCONF_GET_SUBSCRIPTION_URI_LITHIUM}    ${RESTCONF_GET_SUBSCRIPTION_URI}
-    BuiltIn.Set_Suite_Variable    \${restconf_subscription_stream_uri}
     KarafKeywords.Execute_Controller_Karaf_Command_On_Background    log:set ${CONTROLLER_LOG_LEVEL}
 
 Teardown_Everything
     [Documentation]    Close connections.
     ...    Tear down imported Resources.
-    ConfigViaRestconf.Teardown_Config_Via_Restconf
     RequestsLibrary.Delete_All_Sessions
     SSHLibrary.Close_All_Connections