Do not crash if attempt to open ODL Netconf connection fails 14/29914/2
authorJozef Behran <jbehran@cisco.com>
Thu, 19 Nov 2015 09:33:14 +0000 (10:33 +0100)
committerJozef Behran <jbehran@cisco.com>
Thu, 19 Nov 2015 11:43:00 +0000 (12:43 +0100)
When the Connect_To_ODL_Netconf keyword fails for any reason,
the Close_ODL_Netconf_Connection in teardown crashes,
flagging all tests as failed. Avoid that by checking that
there indeed is an ODL Netconf connection to be closed before
trying to do so..

Change-Id: If33fc6a90daf7a2c5ceff750953b8cf99c438cf1
Signed-off-by: Jozef Behran <jbehran@cisco.com>
csit/suites/netconf/MDSAL/northbound.robot

index 68b9322e0bebdb08d8ba11723c1d5d774ca204cf..8f0763e39c4e442621447fa9597abbb6ad2742dc 100644 (file)
@@ -36,6 +36,7 @@ Variables         ${CURDIR}/../../../variables/Variables.py
 *** Variables ***
 ${datadir}        ${CURDIR}/../../../variables/netconf/MDSAL
 ${dataext}        msg
+${ssh_netconf_pid}    -1
 
 *** Test Cases ***
 Connect_To_ODL_Netconf
@@ -317,8 +318,11 @@ Load_Expected_Reply
 
 Close_ODL_Netconf_Connection
     [Documentation]    Correctly close the Netconf connection and make sure it is really dead.
+    BuiltIn.Return_From_Keyword_If    ${ssh_netconf_pid} == -1
+    ${kill_command}=    BuiltIn.Set_Variable    kill ${ssh_netconf_pid}
+    BuiltIn.Set_Suite_Variable    ${ssh_netconf_pid}    -1
     SSHLibrary.Switch_Connection    ${ssh_control}
-    SSHLibrary.Write    kill ${ssh_netconf_pid}
+    SSHLibrary.Write    ${kill_command}
     SSHLibrary.Read_Until_Prompt
     SSHLibrary.Switch_Connection    ${ssh_netconf}
     SSHLibrary.Read_Until_Prompt