Migrate Get Requests invocations(libraries)
[integration/test.git] / csit / suites / sxp / topology / 020_Scalability.robot
1 *** Settings ***
2 Documentation       Test suite to test scalability of SXP
3
4 Library             RequestsLibrary
5 Library             SSHLibrary
6 Library             ../../../libraries/Sxp.py
7 Resource            ../../../libraries/SxpLib.robot
8
9 Suite Setup         Setup SXP Environment    31
10 Suite Teardown      Clean SXP Environment    31
11 Test Setup          Clean Nodes
12
13
14 *** Test Cases ***
15 Test Mega Topology
16     [Documentation]    Stress test that contains of connecting 20 Nodes and exporting their bindings
17     [Tags]    sxp    scalability
18     Setup Mega Topology
19     BuiltIn.Wait Until Keyword Succeeds    10    1    Check Binding Range    2    22
20
21 Test Complex Mega Topology
22     [Documentation]    Stress test that contains of connecting 30 Nodes and exporting their bindings
23     [Tags]    sxp    scalability
24     Setup Complex Mega Topology
25     BuiltIn.Wait Until Keyword Succeeds    10    1    Check Binding Range    22    32
26
27 Text Bindings export
28     [Documentation]    Stress test that consist of exporting 500 Bindings under 5s
29     [Tags]    sxp    scalability
30     FOR    ${num}    IN RANGE    2    502
31         ${ip} =    Sxp.Get Ip From Number    ${num}
32         SxpLib.Add Bindings    ${num}    ${ip}/32    127.0.0.2
33     END
34     SxpLib.Add Connection    version4    listener    127.0.0.2    64999    127.0.0.1
35     SxpLib.Add Connection    version4    speaker    127.0.0.1    64999    127.0.0.2
36     BuiltIn.Wait Until Keyword Succeeds    15    1    Verify Connection    version4    listener    127.0.0.2
37     BuiltIn.Wait Until Keyword Succeeds    10    1    Check Binding Range    2    102
38
39
40 *** Keywords ***
41 Setup Mega Topology
42     [Arguments]    ${version}=version4
43     FOR    ${num}    IN RANGE    2    22
44         ${ip} =    Sxp.Get Ip From Number    ${num}
45         SxpLib.Add Bindings    ${num}    ${ip}/32    ${ip}
46         SxpLib.Add Connection    ${version}    listener    ${ip}    64999    127.0.0.1
47         SxpLib.Add Connection    ${version}    speaker    127.0.0.1    64999    ${ip}
48         BuiltIn.Wait Until Keyword Succeeds    15    1    Verify Connection    ${version}    listener
49         ...    ${ip}
50     END
51
52 Setup Complex Mega Topology
53     [Arguments]    ${version}=version4
54     Setup Mega Topology    ${version}
55     ${second_num} =    Convert To Integer    2
56     FOR    ${num}    IN RANGE    22    32
57         ${ip} =    Sxp.Get Ip From Number    ${num}
58         ${second_ip} =    Sxp.Get Ip From Number    ${second_num}
59         SxpLib.Add Bindings    ${num}    ${ip}/32    ${ip}
60         SxpLib.Add Connection    ${version}    listener    ${ip}    64999    ${second_ip}
61         SxpLib.Add Connection    ${version}    speaker    ${second_ip}    64999    ${ip}
62         BuiltIn.Wait Until Keyword Succeeds    15    1    Verify Connection    ${version}    listener
63         ...    ${ip}    64999    ${second_ip}
64         ${second_num} =    Set Variable    ${second_num + 1}
65         ${second_ip} =    Sxp.Get Ip From Number    ${second_num}
66         SxpLib.Add Connection    ${version}    listener    ${ip}    64999    ${second_ip}
67         SxpLib.Add Connection    ${version}    speaker    ${second_ip}    64999    ${ip}
68         BuiltIn.Wait Until Keyword Succeeds    15    1    Verify Connection    ${version}    listener
69         ...    ${ip}    64999    ${second_ip}
70     END
71
72 Check Binding Range
73     [Documentation]    Check if binding range is contained by node
74     [Arguments]    ${start}    ${end}    ${node}=127.0.0.1
75     ${resp} =    SxpLib.Get Bindings    ${node}
76     FOR    ${num}    IN RANGE    ${start}    ${end}
77         ${ip} =    Sxp.Get Ip From Number    ${num}
78         Should Contain Binding    ${resp}    ${num}    ${ip}/32
79     END
80
81 Clean Nodes
82     FOR    ${num}    IN RANGE    1    32
83         ${ip} =    Sxp.Get Ip From Number    ${num}
84         SxpLib.Clean Bindings    ${ip}
85         SxpLib.Clean Connections    ${ip}
86     END