From ae827090b00bb716da56711fc0094a615c8399f9 Mon Sep 17 00:00:00 2001 From: Jozef Behran Date: Thu, 19 Nov 2015 10:33:14 +0100 Subject: [PATCH] Do not crash if attempt to open ODL Netconf connection fails 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 --- csit/suites/netconf/MDSAL/northbound.robot | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/csit/suites/netconf/MDSAL/northbound.robot b/csit/suites/netconf/MDSAL/northbound.robot index 68b9322e0b..8f0763e39c 100644 --- a/csit/suites/netconf/MDSAL/northbound.robot +++ b/csit/suites/netconf/MDSAL/northbound.robot @@ -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 -- 2.36.6