Add FIXMEs to point out maintenance that becomes due
[integration/test.git] / csit / libraries / ConfigViaRestconf.robot
index dd83c246bd43dfcece5564f25eeb61478dc3b260..94cd6602c7a370f855c524ea88af25b7227aef81 100644 (file)
@@ -26,8 +26,11 @@ Documentation     Robot keyword library (Resource) for runtime changes to config
 ...
 ...               Prerequisities:
 ...               * netconf-connector feature installed on ODL.
-...               * Setup_Config_Via_Restconf called from suite Setup once
-...               (or before any other keyword from this library, but just once).
+...               * Setup_Config_Via_Restconf called from suite Setup
+...               (or before any other call to a keyword from this library) at least once.
+...
+...               FIXME: This module needs merging with NetconfViaRestconf.robot and fixing.
+...               See comments in NetconfViaRestconf.robot for more details.
 Library           OperatingSystem
 Library           RequestsLibrary
 Library           String
@@ -37,15 +40,18 @@ Variables         ${CURDIR}/../variables/Variables.py
 *** Variables ***
 # TODO: Make the following list more narrow when Bug 2594 is fixed.
 @{allowed_status_codes}    ${200}    ${201}    ${204}    # List of integers, not strings. Used by both PUT and DELETE.
-cvr_workspace     /tmp
+${cvr_workspace}    /tmp
 
 *** Keywords ***
 Setup_Config_Via_Restconf
     [Documentation]    Creates Requests session to be used by subsequent keywords.
     ...    Also remembers worspace to use when needed and two temp files for JSON data.
+    # Check for multiple Setup calls.
+    ${variable_was_set}=    BuiltIn.Get_Variable_Value    ${cvr_actfile}    NEVER
+    BuiltIn.Return_From_Keyword_If    '''${variable_was_set}''' != '''NEVER'''
     # Do not append slash at the end uf URL, Requests would add another, resulting in error.
     RequestsLibrary.Create_Session    cvr_session    http://${CONTROLLER}:${RESTCONFPORT}${CONTROLLER_CONFIG_MOUNT}    headers=${HEADERS_XML}    auth=${AUTH}
-    ${workspace_defined}    BuiltIn.Run_Keyword_And_return_Status    BuiltIn.Variable_Should_Exist    ${WORKSPACE}
+    ${workspace_defined}=    BuiltIn.Run_Keyword_And_return_Status    BuiltIn.Variable_Should_Exist    ${WORKSPACE}
     BuiltIn.Run_Keyword_If    ${workspace_defined}    BuiltIn.Set_Suite_Variable    ${cvr_workspace}    ${WORKSPACE}
     BuiltIn.Set_Suite_Variable    ${cvr_actfile}    ${cvr_workspace}${/}actual.json
     BuiltIn.Set_Suite_Variable    ${cvr_expfile}    ${cvr_workspace}${/}expected.json
@@ -214,4 +220,5 @@ Post_Xml_Config_Via_Restconf
     ${response}=    RequestsLibrary.Post_Request    cvr_session    ${uri_part}    data=${xml_data}
     BuiltIn.Log    ${response.text}
     BuiltIn.Should_Be_Empty    ${response.text}
+    # TODO: status_code is integrer, so compare to ${204}. Also, there is a Improvement for 201 to be a better code.
     BuiltIn.Should_Be_Equal_As_Strings    ${response.status_code}    204