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