Delete outdated comments
[integration/test.git] / csit / suites / netconf / ready / netconfready.robot
1 *** Settings ***
2 Documentation     netconf-connector readiness test suite.
3 ...
4 ...               Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
5 ...
6 ...               This program and the accompanying materials are made available under the
7 ...               terms of the Eclipse Public License v1.0 which accompanies this distribution,
8 ...               and is available at http://www.eclipse.org/legal/epl-v10.html
9 ...
10 ...
11 ...               Query netconf-connector and see if it works. Some testsuites
12 ...               expect netconf-connector to be ready as soon as possible and
13 ...               will fail if it is not. We want to see a failure if this is
14 ...               the cause of the failure.
15 ...
16 ...               If the netconf-connector is not ready upon startup (as seen by
17 ...               the first test case failing), the second case starts to repeat
18 ...               the query for a minute to see whether it is going "to fix itself"
19 ...               within the minute. If yes, then the testcase will pass, which
20 ...               indicates that the "ODL cooldown" of 1 minute is not long enough
21 ...               to allow for netconf-connector to initialize properly.
22 ...
23 ...               If the first test case passed, then the second test case does
24 ...               nothing.
25 Suite Setup       Setup_Everything
26 Suite Teardown    Teardown_Everything
27 Library           RequestsLibrary
28 Resource          ${CURDIR}/../../../libraries/KarafKeywords.robot
29 Resource          ${CURDIR}/../../../libraries/Utils.robot
30 Variables         ${CURDIR}/../../../variables/Variables.py
31
32 *** Variables ***
33 ${netconf_is_ready}    False
34 ${NETCONFREADY_WAIT}    60s
35 ${DEBUG_LOGGING_FOR_EVERYTHING}    False
36
37 *** Test Cases ***
38 Check_Whether_Netconf_Connector_Works
39     [Documentation]    Make one request to netconf-connector and see if it works.
40     [Tags]    exclude
41     Check_Netconf_Connector
42     BuiltIn.Set_Suite_Variable    ${netconf_is_ready}    True
43     [Teardown]    Utils.Report_Failure_Due_To_Bug    4708
44
45 Wait_For_Netconf_Connector
46     [Documentation]    Attempt to wait for the netconf-connector for configurable time.
47     [Tags]    critical
48     BuiltIn.Run_Keyword_Unless    ${netconf_is_ready}    BuiltIn.Wait_Until_Keyword_Succeeds    ${NETCONFREADY_WAIT}    1s    Check_Netconf_Connector
49     BuiltIn.Set_Suite_Variable    ${netconf_is_ready}    True
50     [Teardown]    Utils.Report_Failure_Due_To_Bug    4583
51
52 Check_Whether_Netconf_Connector_Can_Pretty_Print
53     [Documentation]    Make one request to netconf-connector and see if it works.
54     [Tags]    critical
55     Check_Netconf_Connector    ?prettyPrint=true
56
57 *** Keywords ***
58 Setup_Everything
59     [Documentation]    Setup requests library and log into karaf.log that the netconf readiness wait starts.
60     KarafKeywords.Open_Controller_Karaf_Console_On_Background
61     KarafKeywords.Log_Message_To_Controller_Karaf    Starting Netconf readiness test suite
62     BuiltIn.Run_Keyword_If    ${DEBUG_LOGGING_FOR_EVERYTHING}    KarafKeywords.Execute_Controller_Karaf_Command_On_Background    log:set DEBUG
63     RequestsLibrary.Create_Session    ses    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}
64
65 Teardown_Everything
66     [Documentation]    Destroy all sessions in the requests library and log into karaf.log that the netconf readiness wait is over.
67     KarafKeywords.Log_Message_To_Controller_Karaf    Ending Netconf readiness test suite
68     RequestsLibrary.Delete_All_Sessions
69
70 Check_Netconf_Connector
71     [Arguments]    ${pretty_print}=${EMPTY}
72     [Documentation]    Make a request to netconf connector's list of mounted devices and check that the request was successful.
73     ${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${pretty_print}
74     BuiltIn.Log    ${response.text}
75     BuiltIn.Should_Be_Equal_As_Strings    ${response.status_code}    200