Suite Teardown Teardown_Everything
Library RequestsLibrary
Resource ${CURDIR}/../../../libraries/KarafKeywords.robot
+Resource ${CURDIR}/../../../libraries/NetconfKeywords.robot
Resource ${CURDIR}/../../../libraries/Utils.robot
Variables ${CURDIR}/../../../variables/Variables.py
BuiltIn.Set_Suite_Variable ${netconf_is_ready} True
[Teardown] Utils.Report_Failure_Due_To_Bug 4583
+Check_For_Bug_5014
+ [Documentation] If Netconf appears to be down, it may be due to bug 5014. Check if it is so and fail if yes.
+ ... Bug 5014 is about Netconf playing dead on boot until a device
+ ... configuration request is sent to it. To uncover this attempt to
+ ... configure and then deconfigure a device and then check if Netconf
+ ... is now up and running. If that turns out to be true, fail the case
+ ... as this signifies the bug 5014 to be present. Skip this testcase
+ ... if Netconf is detected to be up and running.
+ [Tags] critical
+ BuiltIn.Pass_Execution_If ${netconf_is_ready} Netconf was detected to be up and running so bug 5014 did not show up.
+ ${status} ${error}= BuiltIn.Run_Keyword_And_Ignore_Error Check_Netconf_Usable
+ BuiltIn.Run_Keyword_If '${status}'=='PASS' BuiltIn.Set_Suite_Variable ${netconf_is_ready} True
+ BuiltIn.Should_Be_Equal '${status}' 'FAIL'
+ [Teardown] Utils.Report_Failure_Due_To_Bug 5014
+
Check_Whether_Netconf_Can_Pretty_Print
[Documentation] Make one request to netconf-connector and see if it works.
[Tags] critical
+ BuiltIn.Run_Keyword_Unless ${netconf_is_ready} Fail Netconf is not ready so it can't pretty-print now.
Check_Netconf_Up_And_Running ?prettyPrint=true
*** Keywords ***
KarafKeywords.Log_Message_To_Controller_Karaf Starting Netconf readiness test suite
BuiltIn.Run_Keyword_If ${DEBUG_LOGGING_FOR_EVERYTHING} KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set DEBUG
RequestsLibrary.Create_Session ses http://${CONTROLLER}:${RESTCONFPORT} auth=${AUTH}
+ NetconfKeywords.Setup_Netconf_Keywords
Teardown_Everything
[Documentation] Destroy all sessions in the requests library and log into karaf.log that the netconf readiness wait is over.
${response}= RequestsLibrary.Get ses restconf/config/network-topology:network-topology/topology/topology-netconf${netconf_connector}${pretty_print}
BuiltIn.Log ${response.text}
BuiltIn.Should_Be_Equal_As_Strings ${response.status_code} 200
+
+Check_Netconf_Usable
+ NetconfKeywords.Configure_Device_In_Netconf test-device device_type=configure-via-topology
+ NetconfKeywords.Remove_Device_From_Netconf test-device
+ Check_Netconf_Up_And_Running