Migrate netconf suites restconf calls to rfc8040
[integration/test.git] / csit / suites / netconf / scale / getsingle.robot
1 *** Settings ***
2 Documentation     netconf-connector scaling test suite (single-threaded GET requests).
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 ...               Performs scaling tests:
12 ...               - Configuring devices one by one.
13 ...               - Sending requests for configuration data.
14 ...               - Deconfiguring devices one by one.
15 Suite Setup       Setup_Everything
16 Suite Teardown    Teardown_Everything
17 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
18 Library           RequestsLibrary
19 Library           SSHLibrary    timeout=10s
20 Resource          ${CURDIR}/../../../libraries/KarafKeywords.robot
21 Resource          ${CURDIR}/../../../libraries/NetconfKeywords.robot
22 Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
23 Resource          ${CURDIR}/../../../libraries/Utils.robot
24 Variables         ${CURDIR}/../../../variables/Variables.py
25
26 *** Variables ***
27 ${DEVICE_COUNT}    500
28 ${TIMEOUT_FACTOR}    10
29 ${device_type}    full-uri-device
30
31 *** Test Cases ***
32 Start_Test_Tool
33     [Documentation]    Deploy and start test tool, then wait for all its devices to become online.
34     Run Keyword If    '${IS_KARAF_APPL}' == 'True'    NetconfKeywords.Install_And_Start_Testtool    device-count=${DEVICE_COUNT}
35     ...    ELSE    NetconfKeywords.Start_Testtool    ${NETCONF_FILENAME}    device-count=${DEVICE_COUNT}
36
37 Configure_Devices_Onto_Netconf
38     [Documentation]    Make requests to configure the testtool devices.
39     [Tags]    critical
40     ${timeout}=    BuiltIn.Evaluate    ${DEVICE_COUNT}*${TIMEOUT_FACTOR}
41     NetconfKeywords.Perform_Operation_On_Each_Device    Configure_Device_And_Verify    timeout=${timeout}
42
43 Get_Data_From_Devices
44     [Documentation]    Ask testtool devices for data.
45     ${timeout}=    BuiltIn.Evaluate    ${DEVICE_COUNT}*${TIMEOUT_FACTOR}
46     NetconfKeywords.Perform_Operation_On_Each_Device    Check_Device_Data    timeout=${timeout}
47
48 Deconfigure_Devices_From_Netconf
49     [Documentation]    Make requests to deconfigure the testtool devices.
50     [Tags]    critical
51     ${timeout}=    BuiltIn.Evaluate    ${DEVICE_COUNT}*${TIMEOUT_FACTOR}
52     NetconfKeywords.Perform_Operation_On_Each_Device    Deconfigure_Device_And_Verify    timeout=${timeout}
53     [Teardown]    Report_Failure_Due_To_Bug    4547
54
55 *** Keywords ***
56 Setup_Everything
57     [Documentation]    Setup everything needed for the test cases.
58     # Setup resources used by the suite.
59     RequestsLibrary.Create_Session    config    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}${REST_API}    auth=${AUTH}
60     RequestsLibrary.Create_Session    operational    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}${REST_API}    auth=${AUTH}
61     SSHLibrary.Set_Default_Configuration    prompt=${TOOLS_SYSTEM_PROMPT}
62     SetupUtils.Setup_Utils_For_Setup_And_Teardown
63     NetconfKeywords.Setup_Netconf_Keywords
64     KarafKeywords.Configure_Timeout_For_Karaf_Console    120s
65     ${device_type}=    BuiltIn.Set_Variable_If    ${USE_NETCONF_CONNECTOR}==${True}    default    ${device_type}
66     BuiltIn.Set_Suite_Variable    ${device_type}
67
68 Teardown_Everything
69     [Documentation]    Teardown the test infrastructure, perform cleanup and release all resources.
70     RequestsLibrary.Delete_All_Sessions
71     NetconfKeywords.Stop_Testtool
72
73 Check_Device_Data
74     [Arguments]    ${current_name}    ${log_response}=True
75     [Documentation]    Opration for getting the configuration data of the device and checking that it matches what is expected.
76     KarafKeywords.Log_Message_To_Controller_Karaf    Getting data from device ${current_name}
77     ${data}=    Utils.Get_Data_From_URI    config    network-topology:network-topology/topology/topology-netconf/node/${current_name}/yang-ext:mount    headers=${ACCEPT_XML}
78     KarafKeywords.Log_Message_To_Controller_Karaf    Got data from device ${current_name}
79     ${expected}=    Run Keyword If    '${IS_KARAF_APPL}' == 'True'    BuiltIn.Set_Variable    '<data xmlns="${ODL_NETCONF_NAMESPACE}"></data>'
80     ...    ELSE    Set Variable    '<data xmlns="${ODL_NETCONF_NAMESPACE}"/>'
81     Should Be Equal As Strings    '${data}'    ${expected}