Netconf readiness test suite 46/26446/5
authorJozef Behran <jbehran@cisco.com>
Thu, 3 Sep 2015 09:11:19 +0000 (11:11 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 22 Sep 2015 00:10:48 +0000 (00:10 +0000)
It tries to get the list of modules. If that fails, a minute
is given to netconf to become ready.

Change-Id: Idff6cae00e652469c7ade68ebfe2a61d8c41d790
Signed-off-by: Jozef Behran <jbehran@cisco.com>
csit/suites/netconf/ready/netconfready.robot [new file with mode: 0644]
csit/testplans/bgpcep-userfeatures.txt

diff --git a/csit/suites/netconf/ready/netconfready.robot b/csit/suites/netconf/ready/netconfready.robot
new file mode 100644 (file)
index 0000000..f33acac
--- /dev/null
@@ -0,0 +1,61 @@
+*** Settings ***
+Documentation     netconf-connector readiness test suite.
+...
+...               Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+...
+...               This program and the accompanying materials are made available under the
+...               terms of the Eclipse Public License v1.0 which accompanies this distribution,
+...               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.
+...
+...               If the netconf-connector is not ready upon startup (as seen by
+...               the first test case failing), the second case starts to repeat
+...               the query for a minute to see whether it is going "to fix itself"
+...               within the minute. If yes, then the testcase will pass, which
+...               indicates that the "ODL cooldown" of 1 minute is not long enough
+...               to allow for netconf-connector to initialize properly.
+...
+...               If the first test case passed, then the second test case does
+...               nothing.
+Suite Setup       Setup_Everything
+Suite Teardown    Teardown_Everything
+Library           RequestsLibrary
+Variables         ${CURDIR}/../../../variables/Variables.py
+
+*** Variables ***
+${first_case_ok}    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
+
+Wait_For_Netconf_Connector
+    [Documentation]    Attempt to wait for the netconf-connector for 1 minute.
+    [Tags]    critical
+    BuiltIn.Run_Keyword_Unless    ${first_case_ok}    BuiltIn.Wait_Until_Keyword_Succeeds    60s    1s    Check_Netconf_Connector
+
+*** Keywords ***
+Setup_Everything
+    [Documentation]    Setup requests library.
+    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.
+
+Teardown_Everything
+    [Documentation]    Destroy all sessions in the requests library.
+    RequestsLibrary.Delete_All_Sessions
+
+Check_Netconf_Connector
+    [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
+    BuiltIn.Log    ${response.text}
+    BuiltIn.Should_Be_Equal_As_Strings    ${response.status_code}    200
index 074ebe7d3d59ee9730db363510e6499d116f1cbe..299e43cf6008c2adcf3fe3637a75b94aad32cd7f 100644 (file)
@@ -5,6 +5,7 @@
 # and is available at http://www.eclipse.org/legal/epl-v10.html
 
 # Place the suites in run order:
 # and is available at http://www.eclipse.org/legal/epl-v10.html
 
 # Place the suites in run order:
+integration/test/csit/suites/netconf/ready
 integration/test/csit/suites/bgpcep/pcepuser
 integration/test/csit/suites/bgpcep/tcpmd5user
 integration/test/csit/suites/bgpcep/bgpuser
 integration/test/csit/suites/bgpcep/pcepuser
 integration/test/csit/suites/bgpcep/tcpmd5user
 integration/test/csit/suites/bgpcep/bgpuser