unable to terminate netconf session due to process ID is truncated
[integration/test.git] / csit / suites / netconf / MDSAL / northbound.robot
index 80e26b6e9ab0432ca5f8da667d9d157658cd9cb8..ec7343616dec480927e8a45b6142f36a02a32f61 100644 (file)
@@ -26,12 +26,18 @@ Documentation     Metconf MDSAL Northbound test suite.
 ...               invocations (see Check_Multiple_Modules_Merge_Replace for a particularly bad
 ...               example). Create a resource that will be able to extract the data from the
 ...               requests and search for them in the response, then convert to usage of this
-...               resource (think "Thou shall not repeat yourself").
+...               resource (think "Thou shall not repeat yourself"). The following resource was
+...               found when doing research on this:
+...               http://robotframework.org/robotframework/latest/libraries/XML.html
 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_If_Test_Failed
 Library           RequestsLibrary
 Library           SSHLibrary
+Library           String
+Library           XML
+Resource          ${CURDIR}/../../../libraries/CompareStream.robot
 Resource          ${CURDIR}/../../../libraries/FailFast.robot
 Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
 Resource          ${CURDIR}/../../../libraries/SSHKeywords.robot
@@ -69,12 +75,11 @@ Additional_Attributes_In_Message
 Send_Stuff_In_Undefined_Namespace
     [Documentation]    Try to send something within an undefined namespace and check the reply complains about the nonexistent namespace and element.
     ${reply}=    Load_And_Send_Message    merge-nonexistent-namespace
-    BuiltIn.Set_Test_Variable    ${bugno}    5125
+    SetupUtils.Set_Known_Bug_Id    5125
     BuiltIn.Should_Not_Contain    ${reply}    java.lang.NullPointerException
-    BuiltIn.Set_Test_Variable    ${bugno}    ${EMPTY}
+    SetupUtils.Set_Unknown_Bug_Id
     BuiltIn.Should_Contain    ${reply}    urn:this:is:in:a:nonexistent:namespace
-    BuiltIn.Should_Contain    ${reply}    does-not-exist
-    [Teardown]    BuiltIn.Run_Keyword_If    '${bugno}' != '${EMPTY}'    Utils.Report_Failure_Due_To_Bug    5125
+    BuiltIn.Should_Contain    ${reply}    <rpc-error>
 
 Edit_Config_First_Batch_Merge
     [Documentation]    Request a "merge" operation adding an element in candidate configuration and check the reply.
@@ -130,6 +135,7 @@ Get_Config_Running_To_Confirm_Delete_After_Commit
 Commit_No_Transaction
     [Documentation]    Attempt to perform "commit" when there are no changes in the candidate configuration and check that it returns OK status.
     Perform_Test    commit-no-transaction
+    [Teardown]    Utils.Report_Failure_Due_To_Bug    4455
 
 Edit_Config_Second_Batch_Merge
     [Documentation]    Create an element to be discarded and check the reply.
@@ -273,6 +279,23 @@ Commit_Test_Data_Removal
     [Documentation]    Commit the removal and check the reply.
     Perform_Test    merge-multiple-remove-commit
 
+Connector_Simplified_Pattern
+    [Documentation]    Several requests in a (simplified) pattern typical for requests from netconf-connector.
+    Perform_Test    none-replace
+    Perform_Test    commit-edit
+    Perform_Test    delete
+    Perform_Test    commit-edit
+
+Test_Bug_7791
+    [Documentation]    Send (checking replies) series of netconf messages to trigger
+    ...    https://bugs.opendaylight.org/show_bug.cgi?id=7791
+    Perform_Test    bug7791-1
+    Perform_Test    bug7791-2
+    Perform_Test    commit-edit
+    Perform_Test    delete
+    Perform_Test    commit-edit
+    [Teardown]    Utils.Report_Failure_Due_To_Bug    7791
+
 Delete_Not_Existing_Element
     [Documentation]    Attempt to delete the elements again and check that it fails with the correct error.
     Perform_Test    delete-not-existing
@@ -280,6 +303,7 @@ Delete_Not_Existing_Element
 Commit_Delete_Not_Existing_Module
     [Documentation]    Attempt to commit and check the reply.
     Perform_Test    commit-no-transaction
+    [Teardown]    Utils.Report_Failure_Due_To_Bug    4455
 
 Remove_Not_Existing_Module
     [Documentation]    Attempt to remove the "module" element again and check that the operation is "silently ignored".
@@ -288,6 +312,7 @@ Remove_Not_Existing_Module
 Commit_Remove_Not_Existing_Module
     [Documentation]    Attempt to commit and check the reply.
     Perform_Test    remove-not-existing-commit
+    [Teardown]    Utils.Report_Failure_Due_To_Bug    4455
 
 Close_Session
     [Documentation]    Close the session and check that it was closed properly.
@@ -301,7 +326,7 @@ Get_Data
     [Return]    ${data}
 
 Create_ODL_Netconf_Connection
-    [Arguments]    ${host}=${CONTROLLER}    ${port}=${ODL_NETCONF_PORT}    ${user}=${ODL_NETCONF_USER}    ${password}=${ODL_NETCONF_PASSWORD}
+    [Arguments]    ${host}=${ODL_SYSTEM_IP}    ${port}=${ODL_NETCONF_MDSAL_PORT}    ${user}=${ODL_NETCONF_USER}    ${password}=${ODL_NETCONF_PASSWORD}
     [Documentation]    Open a netconf connecion to the given machine.
     # The "-s netconf" flag (see the "SSHLibrary.Write" line below)    is not
     # supported by SSHLibrary, therefore we need to use this elaborate and
@@ -316,11 +341,11 @@ Create_ODL_Netconf_Connection
     #    object and pull the data out of it rather than relying on
     #    global variables. This will allow for tracking more Netconf
     #    connections, increasing utility.
-    ${control}=    SSHLibrary.Open_Connection    ${host}    prompt=${ODL_SYSTEM_PROMPT}    timeout=10s
-    Utils.Flexible_Controller_Login
+    ${control}=    SSHLibrary.Open_Connection    ${host}    prompt=${ODL_SYSTEM_PROMPT}    timeout=60s
+    SSHKeywords.Flexible_Controller_Login
     BuiltIn.Set_Suite_Variable    ${ssh_control}    ${control}
-    ${netconf}=    SSHLibrary.Open_Connection    ${host}    prompt=${ODL_SYSTEM_PROMPT}    timeout=10s
-    Utils.Flexible_Controller_Login
+    ${netconf}=    SSHLibrary.Open_Connection    ${host}    prompt=${ODL_SYSTEM_PROMPT}    timeout=60s
+    SSHKeywords.Flexible_Controller_Login
     BuiltIn.Set_Suite_Variable    ${ssh_netconf}    ${netconf}
     BuiltIn.Set_Suite_Variable    ${ssh_port}    ${port}
     BuiltIn.Set_Suite_Variable    ${ssh_user}    ${user}
@@ -331,7 +356,7 @@ Reopen_ODL_Netconf_Connection
     SSHLibrary.Write    sshpass -p ${ssh_password} ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ${ssh_user}\@127.0.0.1 -p ${ssh_port} -s netconf
     ${hello}=    SSHLibrary.Read_Until    ${ODL_NETCONF_PROMPT}
     SSHLibrary.Switch_Connection    ${ssh_control}
-    ${pid}=    SSHLibrary.Execute_Command    ps -A | grep sshpass | cut -b 1-6
+    ${pid}=    SSHLibrary.Execute_Command    ps -A | grep sshpass | awk '{print $1}'
     BuiltIn.Set_Suite_Variable    ${ssh_netconf_pid}    ${pid}
     SSHLibrary.Switch_Connection    ${ssh_netconf}
     [Return]    ${hello}
@@ -378,8 +403,7 @@ Load_Expected_Reply
     [Arguments]    ${name}
     [Documentation]    Load the expected reply from the data file set and return it.
     ${expected_reply}=    Get_Data    ${name}-reply
-    ${expected}=    Prepare_For_Search    ${expected_reply}
-    [Return]    ${expected}
+    [Return]    ${expected_reply}
 
 Abort_ODL_Netconf_Connection
     [Documentation]    Correctly close the Netconf connection and make sure it is really dead.
@@ -399,7 +423,7 @@ Close_ODL_Netconf_Connection_Gracefully
 Setup_Everything
     [Documentation]    Setup resources and create session for Restconf checking.
     SetupUtils.Setup_Utils_For_Setup_And_Teardown
-    RequestsLibrary.Create_Session    config    http://${CONTROLLER}:${RESTCONFPORT}${CONFIG_API}    auth=${AUTH}
+    RequestsLibrary.Create_Session    config    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}${REST_API}    auth=${AUTH}
 
 Teardown_Everything
     [Documentation]    Close the Netconf connection and destroy all sessions in the requests library.
@@ -485,8 +509,9 @@ Perform_Test
     [Documentation]    Load and send the request from the dataset and compare the returned reply to the one stored in the dataset.
     ${actual}=    Load_And_Send_Message    ${name}
     ${expected}=    Load_Expected_Reply    ${name}
-    ${newline}=    BuiltIn.Evaluate    "\\r\\n"
-    BuiltIn.Should_Be_Equal    ${newline}${expected}${ODL_NETCONF_PROMPT}    ${actual}
+    ${actual}=    String.Remove String    ${actual}    ]]>]]>
+    ${actual}=    String.Strip String    ${actual}    mode=both
+    XML.Elements Should Be Equal    ${actual}    ${expected}    normalize_whitespace=True
     [Return]    ${actual}
 
 Send_And_Check