Fix for requesting the eos on isolated node
[integration/test.git] / csit / suites / distribution / version.robot
1 *** Settings ***
2 Documentation     Suite for testing ODL distribution ability to report ist version via Restconf.
3 ...
4 ...               Copyright (c) 2016 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 ...               Features needed to be installed:
12 ...               odl-distribution-version (the main feature, defines the version string holder as a config module)
13 ...               odl-netconf-connector (controller-config device is used to access the config subsystem)
14 ...               odl-restconf (or odl-restconf-noauth, to get restconf access to the data mounted by controller-config)
15 ...
16 ...               Variables needed to be rovided on pybot invocation:
17 ...               ${BUNDLEFOLDER} (directory name of ODL installation, as it is suffxed by the distribution version)
18 ...
19 ...               This suite require both Restconf and Netconf-connector to be ready,
20 ...               so it is recommended to run netconfready.robot before running this suite.
21 ...
22 ...               TODO: Figure out a way to reliably predict Odlparent version.
23 ...               Possibly, inspection of system/org/opendaylight/odlparent/ would be required.
24 Suite Setup       Suite_Setup
25 Suite Teardown    Suite_Teardown
26 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
27 Test Teardown     SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
28 Default Tags      critical    distribution    version
29 Resource          ${CURDIR}/../../libraries/TemplatedRequests.robot
30 Resource          ${CURDIR}/../../libraries/SetupUtils.robot
31
32 *** Variables ***
33 ${VERSION_VARDIR}    ${CURDIR}/../../variables/distribution/version
34 ${DEVICE_NAME}    controller-config
35 ${NETCONF_DEV_FOLDER}    ${CURDIR}/../../variables/netconf/device/full-uri-device
36 ${NETCONF_MOUNT_FOLDER}    ${CURDIR}/../../variables/netconf/device/full-uri-mount
37
38 *** Test Cases ***
39 Distribution_Version
40     [Documentation]    Get version string as a part of ${BUNDLEFOLDER} and match with what RESTCONF says.
41     # ${BUNDLEFOLDER} typically looks like this: distribution-karaf-0.5.0-SNAPSHOT
42     ${version} =    BuiltIn.Evaluate    '''${BUNDLEFOLDER}'''[len("distribution-karaf-"):]
43     TemplatedRequests.Get_As_Json_Templated    folder=${VERSION_VARDIR}    mapping={"VERSION":"${version}"}    verify=True
44
45 *** Keywords ***
46 Suite_Setup
47     SetupUtils.Setup_Utils_For_Setup_And_Teardown
48     TemplatedRequests.Create_Default_Session
49     BuiltIn.Run_Keyword_If    """${USE_NETCONF_CONNECTOR}""" == """False"""    Configure_Netconf_Device
50
51 Suite_Teardown
52     BuiltIn.Run_Keyword_If    """${USE_NETCONF_CONNECTOR}""" == """False"""    Remove_Netconf_Device
53
54 Configure_Netconf_Device
55     [Documentation]    Configures netconf device if ${USE_NETCONF_CONNECTOR} is False.
56     &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${ODL_SYSTEM_IP}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
57     TemplatedRequests.Put_As_Xml_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}
58     BuiltIn.Wait_Until_Keyword_Succeeds    10x    3s    TemplatedRequests.Get_As_Xml_Templated    ${NETCONF_MOUNT_FOLDER}    mapping=${mapping}
59
60 Remove_Netconf_Device
61     [Documentation]    Removes netconf device if ${USE_NETCONF_CONNECTOR} is False.
62     &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}
63     TemplatedRequests.Delete_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}