Update Robot Framework format - step 14
[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
25 Resource            ${CURDIR}/../../libraries/distribution/StreamDistro.robot
26 Resource            ${CURDIR}/../../libraries/TemplatedRequests.robot
27 Resource            ${CURDIR}/../../libraries/SetupUtils.robot
28
29 Suite Setup         Suite_Setup
30 Suite Teardown      Suite_Teardown
31 Test Setup          SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
32 Test Teardown       SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
33
34 Default Tags        critical    distribution    version
35
36
37 *** Variables ***
38 ${VERSION_VARDIR}           ${CURDIR}/../../variables/distribution/version
39 ${DEVICE_NAME}              controller-config
40 ${NETCONF_DEV_FOLDER}       ${CURDIR}/../../variables/netconf/device/full-uri-device
41 ${NETCONF_MOUNT_FOLDER}     ${CURDIR}/../../variables/netconf/device/full-uri-mount
42
43
44 *** Test Cases ***
45 Distribution_Version
46     [Documentation]    Get version string as a part of ${BUNDLEFOLDER} and match with what RESTCONF says.
47     # ${BUNDLEFOLDER} typically looks like this: karaf-0.8.0-SNAPSHOT
48     ${filename_prefix} =    StreamDistro.Compose_Zip_Filename_Prefix
49     ${version} =    BuiltIn.Evaluate    """${BUNDLEFOLDER}"""[len("""${filename_prefix}-"""):]
50     BuiltIn.Wait_Until_Keyword_Succeeds
51     ...    60x
52     ...    3s
53     ...    TemplatedRequests.Get_As_Json_Templated
54     ...    folder=${VERSION_VARDIR}
55     ...    mapping={"VERSION":"${version}"}
56     ...    verify=True
57
58
59 *** Keywords ***
60 Suite_Setup
61     SetupUtils.Setup_Utils_For_Setup_And_Teardown
62     TemplatedRequests.Create_Default_Session
63     IF    """${USE_NETCONF_CONNECTOR}""" == """False"""
64         Configure_Netconf_Device
65     END
66
67 Suite_Teardown
68     IF    """${USE_NETCONF_CONNECTOR}""" == """False"""    Remove_Netconf_Device
69
70 Configure_Netconf_Device
71     [Documentation]    Configures netconf device if ${USE_NETCONF_CONNECTOR} is False.
72     &{mapping} =    BuiltIn.Create_Dictionary
73     ...    DEVICE_NAME=${DEVICE_NAME}
74     ...    DEVICE_PORT=1830
75     ...    DEVICE_IP=${ODL_SYSTEM_IP}
76     ...    DEVICE_USER=admin
77     ...    DEVICE_PASSWORD=admin
78     TemplatedRequests.Put_As_Xml_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}
79     BuiltIn.Wait_Until_Keyword_Succeeds
80     ...    10x
81     ...    3s
82     ...    TemplatedRequests.Get_As_Xml_Templated
83     ...    ${NETCONF_MOUNT_FOLDER}
84     ...    mapping=${mapping}
85
86 Remove_Netconf_Device
87     [Documentation]    Removes netconf device if ${USE_NETCONF_CONNECTOR} is False.
88     &{mapping} =    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}
89     TemplatedRequests.Delete_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}