c00425fc6ea65188d97e3230ae0d6445d9b53dc6
[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 Library           RequestsLibrary
18 Library           SSHLibrary    timeout=10s
19 Resource          ${CURDIR}/../../../libraries/KarafKeywords.robot
20 Resource          ${CURDIR}/../../../libraries/NetconfKeywords.robot
21 Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
22 Resource          ${CURDIR}/../../../libraries/Utils.robot
23 Variables         ${CURDIR}/../../../variables/Variables.py
24
25 *** Variables ***
26 ${DEVICE_COUNT}    500
27
28 *** Test Cases ***
29 Start_Test_Tool
30     [Documentation]    Deploy and start test tool, then wait for all its devices to become online.
31     NetconfKeywords.Install_And_Start_Testtool    device-count=${DEVICE_COUNT}    mdsal=false
32
33 Configure_Devices_Onto_Netconf
34     [Documentation]    Make requests to configure the testtool devices.
35     [Tags]    critical
36     ${timeout}=    BuiltIn.Evaluate    ${DEVICE_COUNT}*10
37     NetconfKeywords.Perform_Operation_On_Each_Device    Configure_Device    timeout=${timeout}
38
39 Get_Data_From_Devices
40     [Documentation]    Ask testtool devices for data.
41     ${timeout}=    BuiltIn.Evaluate    ${DEVICE_COUNT}*2
42     NetconfKeywords.Perform_Operation_On_Each_Device    Check_Device_Data    timeout=${timeout}
43
44 Deconfigure_Devices_From_Netconf
45     [Documentation]    Make requests to deconfigure the testtool devices.
46     [Tags]    critical
47     ${timeout}=    BuiltIn.Evaluate    ${DEVICE_COUNT}*10
48     NetconfKeywords.Perform_Operation_On_Each_Device    Deconfigure_Device    timeout=${timeout}
49     [Teardown]    Report_Failure_Due_To_Bug    4547
50
51 *** Keywords ***
52 Setup_Everything
53     [Documentation]    Setup everything needed for the test cases.
54     # Setup resources used by the suite.
55     RequestsLibrary.Create_Session    config    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}${CONFIG_API}    auth=${AUTH}
56     RequestsLibrary.Create_Session    operational    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}${OPERATIONAL_API}    auth=${AUTH}
57     SSHLibrary.Set_Default_Configuration    prompt=${TOOLS_SYSTEM_PROMPT}
58     SetupUtils.Setup_Utils_For_Setup_And_Teardown
59     NetconfKeywords.Setup_Netconf_Keywords
60     KarafKeywords.Configure_Timeout_For_Karaf_Console    120s
61
62 Teardown_Everything
63     [Documentation]    Teardown the test infrastructure, perform cleanup and release all resources.
64     Teardown_Netconf_Via_Restconf
65     RequestsLibrary.Delete_All_Sessions
66     NetconfKeywords.Stop_Testtool
67
68 Configure_Device
69     [Arguments]    ${current_name}
70     [Documentation]    Operation for configuring the device in the Netconf subsystem and connecting to it.
71     KarafKeywords.Log_Message_To_Controller_Karaf    Connecting device ${current_name}
72     NetconfKeywords.Configure_Device_In_Netconf    ${current_name}    device_port=${current_port}
73     KarafKeywords.Log_Message_To_Controller_Karaf    Waiting for device ${current_name} to connect
74     NetconfKeywords.Wait_Device_Connected    ${current_name}    period=0.5s
75     KarafKeywords.Log_Message_To_Controller_Karaf    Device ${current_name} connected
76
77 Check_Device_Data
78     [Arguments]    ${current_name}
79     [Documentation]    Opration for getting the configuration data of the device and checking that it matches what is expected.
80     KarafKeywords.Log_Message_To_Controller_Karaf    Getting data from device ${current_name}
81     ${data}=    Utils.Get_Data_From_URI    config    network-topology:network-topology/topology/topology-netconf/node/${current_name}/yang-ext:mount    headers=${ACCEPT_XML}
82     KarafKeywords.Log_Message_To_Controller_Karaf    Got data from device ${current_name}
83     BuiltIn.Should_Be_Equal    ${data}    <data xmlns="${ODL_NETCONF_NAMESPACE}"></data>
84
85 Deconfigure_Device
86     [Arguments]    ${current_name}
87     [Documentation]    Operation for deconfiguring the device from Netconf.
88     KarafKeywords.Log_Message_To_Controller_Karaf    Removing device ${current_name}
89     NetconfKeywords.Remove_Device_From_Netconf    ${current_name}
90     KarafKeywords.Log_Message_To_Controller_Karaf    Waiting for device ${current_name} to disappear
91     NetconfKeywords.Wait_Device_Fully_Removed    ${current_name}    period=0.5s    timeout=120s
92     KarafKeywords.Log_Message_To_Controller_Karaf    Device ${current_name} removed