X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Fsuites%2Fnetconf%2Fready%2Fnetconfready.robot;h=d3c4f7997811269339479a9e184506af0797776b;hb=b577eff1b5f03863c8fbaece0324f1422a9ed9ff;hp=e784dd9f8510be017cd3cb8be331572bd03115b9;hpb=61db9431809065c66d8fb211bf4d711068c58836;p=integration%2Ftest.git diff --git a/csit/suites/netconf/ready/netconfready.robot b/csit/suites/netconf/ready/netconfready.robot index e784dd9f85..d3c4f79978 100644 --- a/csit/suites/netconf/ready/netconfready.robot +++ b/csit/suites/netconf/ready/netconfready.robot @@ -8,10 +8,13 @@ Documentation netconf-connector readiness test suite. ... and is available at http://www.eclipse.org/legal/epl-v10.html ... ... -... Query netconf-connector and see if it works. Some testsuites -... expect netconf-connector to be ready as soon as possible and -... will fail if it is not. We want to see a failure if this is -... the cause of the failure. +... Try to detect whether Netconf is up and running and wait for +... it for a configurable time if it is not yet up and running. +... +... By default this is done by querying netconf-connector and +... seeing whether it works. Some testsuites expect netconf-connector +... to be ready as soon as possible and will fail if it is not. We +... want to see a failure if this is the cause of the failure. ... ... If the netconf-connector is not ready upon startup (as seen by ... the first test case failing), the second case starts to repeat @@ -20,44 +23,94 @@ Documentation netconf-connector readiness test suite. ... indicates that the "ODL cooldown" of 1 minute is not long enough ... to allow for netconf-connector to initialize properly. ... +... If the USE_NETCONF_CONNECTOR is forced to be False by the Robot +... invocation argument, then the suite does not use netconf +... connector for the readiness detection but merely waits for the +... Netconf topology to appear. This is a weaker condition when +... Netconf connector is about to be used but is necessary if the +... suite in question does not use the Netconf connector. +... ... If the first test case passed, then the second test case does ... nothing. +... +... The third test case then checks whether Netconf can pretty print +... data. This sometimes makes problems, most likely due to too +... new Robot Requests library with an interface incompatible with +... this test suite. Suite Setup Setup_Everything 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 *** Variables *** -${first_case_ok} False +${netconf_is_ready} False ${NETCONFREADY_WAIT} 60s +${USE_NETCONF_CONNECTOR} True +${DEBUG_LOGGING_FOR_EVERYTHING} False *** Test Cases *** -Check_Whether_Netconf_Connector_Works - [Documentation] Make one request to netconf-connector and see if it works. - [Tags] critical - Check_Netconf_Connector - BuiltIn.Set_Suite_Variable ${first_case_ok} True +Check_Whether_Netconf_Is_Up_And_Running + [Documentation] Make one request to Netconf topology to see whether Netconf is up and running. + [Tags] exclude + Check_Netconf_Up_And_Running + BuiltIn.Set_Suite_Variable ${netconf_is_ready} True + [Teardown] Utils.Report_Failure_Due_To_Bug 4708 -Wait_For_Netconf_Connector - [Documentation] Attempt to wait for the netconf-connector for configurable time. +Wait_For_Netconf + [Documentation] Wait for the Netconf to go up for configurable time. [Tags] critical - BuiltIn.Run_Keyword_Unless ${first_case_ok} BuiltIn.Wait_Until_Keyword_Succeeds ${NETCONFREADY_WAIT} 1s Check_Netconf_Connector + BuiltIn.Run_Keyword_Unless ${netconf_is_ready} BuiltIn.Wait_Until_Keyword_Succeeds ${NETCONFREADY_WAIT} 1s Check_Netconf_Up_And_Running + 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 *** Setup_Everything - [Documentation] Setup requests library. + [Documentation] Setup requests library and log into karaf.log that the netconf readiness wait starts. + ${connector}= BuiltIn.Set_Variable_If ${USE_NETCONF_CONNECTOR} /node/controller-config/yang-ext:mount/config:modules/module/odl-sal-netconf-connector-cfg:sal-netconf-connector/controller-config ${EMPTY} + BuiltIn.Set_Suite_Variable ${netconf_connector} ${connector} + KarafKeywords.Open_Controller_Karaf_Console_On_Background + 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} - # TODO: Do not include slash in ${OPERATIONAL_TOPO_API}, having it typed here is more readable. - # TODO: Alternatively, create variable in Variables which starts with http. - # Both TODOs would probably need to update every suite relying on current Variables. + NetconfKeywords.Setup_Netconf_Keywords Teardown_Everything - [Documentation] Destroy all sessions in the requests library. + [Documentation] Destroy all sessions in the requests library and log into karaf.log that the netconf readiness wait is over. + KarafKeywords.Log_Message_To_Controller_Karaf Ending Netconf readiness test suite RequestsLibrary.Delete_All_Sessions -Check_Netconf_Connector +Check_Netconf_Up_And_Running + [Arguments] ${pretty_print}=${EMPTY} [Documentation] Make a request to netconf connector's list of mounted devices and check that the request was successful. - ${response}= RequestsLibrary.Get ses restconf/config/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules/module/odl-sal-netconf-connector-cfg:sal-netconf-connector/controller-config/?prettyPrint=true + ${response}= RequestsLibrary.Get_Request 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