Migrate Get Requests invocations(libraries)
[integration/test.git] / csit / suites / distribution / size.robot
1 *** Settings ***
2 Documentation       Suite for testing ODL distribution zip file size.
3 ...
4 ...                 Copyright (c) 2016-2017 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 ...                 Variables needed to be rovided on pybot invocation:
12 ...                 ${BUNDLEFOLDER} (directory name of ODL installation, as it is suffxed by the distribution version).
13 ...                 This suite assumes the .zip file is stll present on ${ODL_SYSTEM_IP} in ${WORKSPACE} directory.
14
15 Resource            ${CURDIR}/../../libraries/distribution/StreamDistro.robot
16 Resource            ${CURDIR}/../../libraries/SetupUtils.robot
17 Resource            ${CURDIR}/../../libraries/SSHKeywords.robot
18
19 Suite Setup         SetupUtils.Setup_Utils_For_Setup_And_Teardown
20 Test Setup          SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
21 Test Teardown       SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
22
23 Default Tags        critical    distribution    size
24
25
26 *** Variables ***
27 ${BUNDLE_SUFFIX}                .zip
28 ${DISTRIBUTION_SIZE_LIMIT}      469762048    # == 7 * 64 MiB, Nexus limit is 8 * 64 MiB.
29
30
31 *** Test Cases ***
32 Distribution_Size
33     [Documentation]    Run "ls" on ODL_SYSTEM, parse file size and compare to ${DISTRIBUTION_SIZE_LIMIT}.
34     SSHKeywords.Open_Connection_To_ODL_System
35     ${bundle_prefix} =    StreamDistro.Compose_Zip_Filename_Prefix
36     # TODO: 'du -b' is shorter, but gives less info. Is that better than ls?
37     ${ls_output} =    SSHKeywords.Execute_Command_Should_Pass
38     ...    command=bash -c 'ls -lAn ${WORKSPACE}/${bundle_prefix}*${BUNDLE_SUFFIX}'
39     ${size} =    SSHKeywords.Execute_Command_Should_Pass    command=echo '${ls_output}' | cut -d ' ' -f 5
40     # The following probably fails of there were multiple *.zip files listed.
41     BuiltIn.Should_Be_True
42     ...    ${size} < ${DISTRIBUTION_SIZE_LIMIT}
43     ...    Distribution size ${size} is not smaller than limit ${DISTRIBUTION_SIZE_LIMIT}.