Detect bug 5014 76/32276/17
authorJozef Behran <jbehran@cisco.com>
Fri, 8 Jan 2016 12:47:51 +0000 (13:47 +0100)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 28 Jan 2016 09:20:42 +0000 (09:20 +0000)
Netconf gained another bad habit. It appears to be down until
the user tries to configure a device, then it wakes up and
starts to be visible.

This bad habit was reported as bug 5014 as it breaks the
Netconf readiness suite (and probably other production
workflows that depend on the ability to determine when
Netconf becomes available). This adds a test case that
detects this bug by trying to configure a dummy device when
Netconf appears to be down after the wait is completed.
If Netconf mysteriously raises from the dead, the test case
fails, reporting that bug 5014 was found.

Change-Id: I29e8be136aaddaa13169b533805415729fcc4959
Signed-off-by: Jozef Behran <jbehran@cisco.com>
csit/suites/netconf/ready/netconfready.robot

index 9d038a6114d8c8cfd3991f1f644b85f22aeed558..8444bcd55f264b22c92c79664284da88744d4dfd 100644 (file)
@@ -41,6 +41,7 @@ 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
 
@@ -65,9 +66,25 @@ Wait_For_Netconf
     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 ***
@@ -79,6 +96,7 @@ Setup_Everything
     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.
@@ -91,3 +109,8 @@ Check_Netconf_Up_And_Running
     ${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