Splitted the "get active session" and "activate session" 85/32585/2
authorJozef Behran <jbehran@cisco.com>
Thu, 14 Jan 2016 13:21:54 +0000 (14:21 +0100)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 14 Jan 2016 16:54:54 +0000 (16:54 +0000)
Previously "Activate_NVR_Session" returned the previously
active NVR session. This complicated setup as it was not
possible to simply use "Activate_NVR_Session" command in
the NVR setup procedure but the internal state had to be
set directly. But the feature (returning the previously
active session) was not used for anything.

The new way of doing things is to have a separate keyword
for getting the active session and to have the
"Activate_NVR_Session" setting the internal state but not
attempting to read it so it can be used in the setup call,
improving encapsulation of the internal state handling.

Change-Id: Ie40e086b8cc9054f67a9be4a7fc29b8c962d3db3
Signed-off-by: Jozef Behran <jbehran@cisco.com>
csit/libraries/NetconfViaRestconf.robot

index 89e5c3c706fe2440d8e4788aecc6faf3b3b52e7b..83619c6f19f06c244731410c9d66880b0cebc79f 100644 (file)
@@ -41,7 +41,7 @@ Setup_Netconf_Via_Restconf
     [Documentation]    Creates Requests session to be used by subsequent keywords.
     # Do not append slash at the end uf URL, Requests would add another, resulting in error.
     Create_NVR_Session    nvr_session    ${ODL_SYSTEM_IP}
-    BuiltIn.Set_Suite_Variable    ${NetconfViaRestconf__active_session}    nvr_session
+    Activate_NVR_Session    nvr_session
 
 Teardown_Netconf_Via_Restconf
     [Documentation]    Teardown to pair with Setup (otherwise no-op).
@@ -132,9 +132,11 @@ Create_NVR_Session
     [Documentation]    Create a Netconf Via Restconf session pointing to the given host with the given name. The new session is NOT made active.
     RequestsLibrary.Create_Session    ${name}    http://${host}:${RESTCONFPORT}${CONFIG_API}    headers=${HEADERS_XML}    auth=${AUTH}
 
+Get_Active_NVR_Session
+    [Documentation]    Get the name of the currently active NVR session.
+    [Return]    ${NetconfViaRestconf__active_session}
+
 Activate_NVR_Session
     [Arguments]    ${name}
-    [Documentation]    Activate the given session and return the name of the previously active session.
-    ${result}=    BuiltIn.Set_Variable    ${NetconfViaRestconf__active_session}
+    [Documentation]    Activate the given NVR session.
     BuiltIn.Set_Suite_Variable    ${NetconfViaRestconf__active_session}    ${name}
-    [Return]    ${result}