a49beb71ca17f2286b0d820f5208b204e0c3b601
[integration/test.git] / csit / suites / sxp / performance / 020_BindingExportTests.robot
1 *** Settings ***
2 Documentation     Test suite measuring binding export and forwarding speed.
3 Test Setup        Setup SXP Environment
4 Test Teardown     Clean Custom SXP Environment
5 Library           ../../../libraries/Sxp.py
6 Resource          ../../../libraries/SxpLib.robot
7 Library           Remote    http://${ODL_SYSTEM_IP}:8270/ExportTestLibrary    WITH NAME    ExportLibrary
8
9 *** Variables ***
10 # Tested Nodes IPs
11 ${SOURCE_IP}      127.1.0.1
12 ${DESTINATION_IP}    127.2.0.1
13 # Testing variables
14 ${EXPORT_AMOUNT}    65536
15 ${TEST_SAMPLES}    5
16 ${MINIMAL_SPEED}    2000
17 # Testing Domains
18 ${DOMAIN_0}       global
19 ${DOMAIN_1}       test-domain
20
21 *** Test Cases ***
22 Binding Export Test
23     [Documentation]    Test binding export speed without any filters
24     Add Bindings Range    112    84213760    ${EXPORT_AMOUNT}
25     ${export_speed}    Simple Export    ${EXPORT_AMOUNT}    ${TEST_SAMPLES}
26     Log    Average export speed ${export_speed} bindings/s.
27     Should Be True    ${export_speed} > ${MINIMAL_SPEED}
28
29 Binding Forwarding Export Test
30     [Documentation]    Test binding forwarding speed without any filters
31     ${export_speed}    Forwarding Export    ${EXPORT_AMOUNT}    ${TEST_SAMPLES}
32     Log    Average export speed ${export_speed} bindings/s.
33     Should Be True    ${export_speed} > ${MINIMAL_SPEED}
34
35 Binding Outbound Filter Export Test
36     [Documentation]    Test binding export speed with Outbound filter and multiple passrates.
37     Add Bindings Range    112    84213760    ${EXPORT_AMOUNT}
38     : FOR    ${num}    IN RANGE    16    20
39     \    ${passrate}    Evaluate    100.0/(2**(${num} - 16))
40     \    ${exported_bindings}    Evaluate    int(math.ceil( ${EXPORT_AMOUNT}*${passrate}/100 ))    modules=math
41     \    ${exported_bindings}    Convert To String    ${exported_bindings}
42     \    Setup Filter    ${num}    outbound
43     \    ${export_speed}    Simple Export    ${exported_bindings}    ${TEST_SAMPLES}
44     \    Log    Outbound Export speed ${export_speed} with passrate ${passrate}%.
45     \    Should Be True    ${export_speed} > ${MINIMAL_SPEED}
46
47 Binding Inbound Filter Forwarding Export Test
48     [Documentation]    Test binding forwarding speed with Inbound filter and multiple passrates.
49     : FOR    ${num}    IN RANGE    16    20
50     \    ${passrate}    Evaluate    100.0/(2**(${num} - 16))
51     \    ${exported_bindings}    Evaluate    math.ceil( ${EXPORT_AMOUNT}*${passrate}/100 )    modules=math
52     \    ${exported_bindings}    Convert To String    ${exported_bindings}
53     \    Setup Filter    ${num}    inbound-discarding
54     \    ${export_speed}    Forwarding Export    ${exported_bindings}    ${TEST_SAMPLES}
55     \    Log    Outbound Export speed ${export_speed} with passrate ${passrate}%.
56     \    Should Be True    ${export_speed} > ${MINIMAL_SPEED}
57
58 Binding Inbound-Discarding Filter Forwarding Export Test
59     [Documentation]    Test binding forwarding speed with Inbound-discarding filter and multiple passrates.
60     : FOR    ${num}    IN RANGE    16    20
61     \    ${passrate}    Evaluate    100.0/(2**(${num} - 16))
62     \    ${exported_bindings}    Evaluate    math.ceil( ${EXPORT_AMOUNT}*${passrate}/100 )    modules=math
63     \    ${exported_bindings}    Convert To String    ${exported_bindings}
64     \    Setup Filter    ${num}    inbound-discarding
65     \    ${export_speed}    Forwarding Export    ${exported_bindings}    ${TEST_SAMPLES}
66     \    Log    Outbound Export speed ${export_speed} with passrate ${passrate}%.
67     \    Should Be True    ${export_speed} > ${MINIMAL_SPEED}
68
69 Binding Domain Filter Export Test
70     [Documentation]    Test binding export speed with domain filter and multiple passrates.
71     Add Bindings Range    112    84213760    ${EXPORT_AMOUNT}
72     : FOR    ${num}    IN RANGE    16    20
73     \    ${passrate}    Evaluate    100.0/(2**(${num} - 16))
74     \    ${exported_bindings}    Evaluate    math.ceil( ${EXPORT_AMOUNT}*${passrate}/100 )    modules=math
75     \    ${exported_bindings}    Convert To String    ${exported_bindings}
76     \    Run Keyword And Ignore Error    Setup Domain Filter    ${num}    ${DOMAIN_1}
77     \    ${export_speed}    Simple Export    ${exported_bindings}    ${TEST_SAMPLES}    ${DOMAIN_1}
78     \    Log    Outbound Export speed ${export_speed} with passrate ${passrate}%.
79     \    Should Be True    ${export_speed} > ${MINIMAL_SPEED}
80
81 Binding Domain Filter Forwarding Export Test
82     [Documentation]    Test binding forward speed with domain filter and multiple passrates.
83     : FOR    ${num}    IN RANGE    16    20
84     \    ${passrate}    Evaluate    100.0/(2**(${num} - 16))
85     \    ${exported_bindings}    Evaluate    math.ceil( ${EXPORT_AMOUNT}*${passrate}/100 )    modules=math
86     \    ${exported_bindings}    Convert To String    ${exported_bindings}
87     \    Run Keyword And Ignore Error    Setup Domain Filter    ${num}    ${DOMAIN_1}
88     \    ${export_speed}    Forwarding Export    ${exported_bindings}    ${TEST_SAMPLES}    ${DOMAIN_1}
89     \    Log    Outbound Export speed ${export_speed} with passrate ${passrate}%.
90     \    Should Be True    ${export_speed} > ${MINIMAL_SPEED}
91
92 Binding Combined Filter Export Test
93     [Documentation]    Test binding export speed with domain filter, Outbound filter and multiple passrates.
94     Add Bindings Range    112    84213760    ${EXPORT_AMOUNT}
95     : FOR    ${num}    IN RANGE    16    20
96     \    ${passrate}    Evaluate    100.0/(2**(${num} - 16))
97     \    ${exported_bindings}    Evaluate    math.ceil( ${EXPORT_AMOUNT}*${passrate}/100 )    modules=math
98     \    ${exported_bindings}    Convert To String    ${exported_bindings}
99     \    Run Keyword And Ignore Error    Setup Domain Filter    ${num}    ${DOMAIN_1}
100     \    Setup Filter    ${num}    outbound
101     \    ${export_speed}    Simple Export    ${exported_bindings}    ${TEST_SAMPLES}    ${DOMAIN_1}
102     \    Log    Outbound Export speed ${export_speed} with passrate ${passrate}%.
103     \    Should Be True    ${export_speed} > ${MINIMAL_SPEED}
104
105 Binding Combined Filter Forwarding Export Test
106     [Documentation]    Test binding forward speed with domain filter, Inbound-discarding filter and multiple passrates.
107     : FOR    ${num}    IN RANGE    16    20
108     \    ${passrate}    Evaluate    100.0/(2**(${num} - 16))
109     \    ${exported_bindings}    Evaluate    math.ceil( ${EXPORT_AMOUNT}*${passrate}/100 )    modules=math
110     \    ${exported_bindings}    Convert To String    ${exported_bindings}
111     \    Run Keyword And Ignore Error    Setup Domain Filter    ${num}    ${DOMAIN_1}
112     \    Setup Filter    ${num}    inbound-discarding
113     \    ${export_speed}    Forwarding Export    ${exported_bindings}    ${TEST_SAMPLES}    ${DOMAIN_1}
114     \    Log    Outbound Export speed ${export_speed} with passrate ${passrate}%.
115     \    Should Be True    ${export_speed} > ${MINIMAL_SPEED}
116
117 *** Keywords ***
118 Setup Binding Export Topology
119     [Arguments]    ${version}=version4    ${PASSWORD}=${EMPTY}    ${destination_nodes}=3    ${destination_domain}=global
120     [Documentation]    Adds connections to local and remote nodes and wait until they are connected
121     Setup Simple Binding Export Topology    ${version}    ${PASSWORD}    ${destination_nodes}    1    ${destination_domain}
122     : FOR    ${num}    IN RANGE    0    ${destination_nodes}
123     \    ${DESTINATION_NODE}    Get Ip From Number And Ip    ${num}    ${DESTINATION_IP}
124     \    ExportLibrary.Add Connection    ${version}    listener    127.0.0.1    64999    ${PASSWORD}
125     \    ...    ${DESTINATION_NODE}
126     \    Wait Until Keyword Succeeds    15    1    Verify Connection    ${version}    speaker
127     \    ...    ${DESTINATION_NODE}    64999    domain=${destination_domain}
128
129 Setup Simple Binding Export Topology
130     [Arguments]    ${version}=version4    ${PASSWORD}=${EMPTY}    ${destination_nodes}=3    ${source_nodes}=1    ${destination_domain}=global
131     [Documentation]    Adds connections to local and remote nodes and wait until they are connected
132     : FOR    ${num}    IN RANGE    0    ${source_nodes}
133     \    ${SOURCE_NODE}    Get Ip From Number And Ip    ${num}    ${SOURCE_IP}
134     \    ExportLibrary.Add Node    ${SOURCE_NODE}    ${version}    64999    ${PASSWORD}
135     \    ExportLibrary.Add Connection    ${version}    speaker    127.0.0.1    64999    ${PASSWORD}
136     \    ...    ${SOURCE_NODE}
137     : FOR    ${num}    IN RANGE    0    ${destination_nodes}
138     \    ${DESTINATION_NODE}    Get Ip From Number And Ip    ${num}    ${DESTINATION_IP}
139     \    ExportLibrary.Add Destination Node    ${DESTINATION_NODE}    ${version}    64999    ${PASSWORD}
140     \    Add Connection    ${version}    speaker    ${DESTINATION_NODE}    64999    password=${PASSWORD}
141     \    ...    domain=${destination_domain}
142     ExportLibrary.Start Nodes
143     : FOR    ${num}    IN RANGE    0    ${source_nodes}
144     \    ${SOURCE_NODE}    Get Ip From Number And Ip    ${num}    ${SOURCE_IP}
145     \    Add Connection    ${version}    listener    ${SOURCE_NODE}    64999    password=${PASSWORD}
146     \    Wait Until Keyword Succeeds    60    2    Verify Connection    ${version}    listener
147     \    ...    ${SOURCE_NODE}    64999
148
149 Simple Export
150     [Arguments]    ${check_amount}    ${samples}=10    ${destination_domain}=global
151     [Documentation]    Starts SXP nodes and checks if bindings are already exported, this is repeated N times
152     @{ITEMS}    Create List
153     : FOR    ${num}    IN RANGE    0    ${samples}
154     \    Setup Simple Binding Export Topology    destination_domain=${destination_domain}
155     \    ExportLibrary.Set Export Amount    ${check_amount}
156     \    ExportLibrary.Initiate Simple Export    127.0.0.1
157     \    ${ELEMENT}    Wait Until Keyword Succeeds    120    1    Check Bindings Exported
158     \    Append To List    ${ITEMS}    ${ELEMENT}
159     \    Test Clean
160     ${export_speed}    Get Average Of Items    ${ITEMS}
161     [Return]    ${export_speed}
162
163 Forwarding Export
164     [Arguments]    ${check_amount}    ${samples}=10    ${destination_domain}=global
165     [Documentation]    Starts SXP nodes and checks if bindings are already forwarded, this is repeated N times
166     @{ITEMS}    Create List
167     : FOR    ${num}    IN RANGE    0    ${samples}
168     \    Setup Binding Export Topology    destination_domain=${destination_domain}
169     \    ExportLibrary.Set Export Amount    ${check_amount}
170     \    ExportLibrary.Initiate Export    132.5.0.0/16    112
171     \    ${ELEMENT}    Wait Until Keyword Succeeds    360    1    Check Bindings Exported
172     \    Append To List    ${ITEMS}    ${ELEMENT}
173     \    Test Clean
174     ${export_speed}    Get Average Of Items    ${ITEMS}
175     [Return]    ${export_speed}
176
177 Check Bindings Exported
178     [Documentation]    Checking if bindings were exported and return export speed
179     ${all_exported}    ExportLibrary.All Exported
180     ${bindings_exported}    ExportLibrary.Get Bindings Exchange Count
181     Log    ${bindings_exported}
182     Should Be True    ${all_exported}
183     ${export_time}    ExportLibrary.Get Export Time
184     ${export_speed}    Evaluate    ${bindings_exported}/${export_time}
185     [Return]    ${export_speed}
186
187 Setup Filter
188     [Arguments]    ${bits}    ${type}
189     [Documentation]    Creates peer-group and its filter with specific matching.
190     Add PeerGroup    GROUP    ${EMPTY}
191     ${entry}    Get Filter Entry    10    permit    pl=132.5.0.0/${bits}
192     Add Filter    GROUP    ${type}    ${entry}
193
194 Setup Domain Filter
195     [Arguments]    ${bits}    ${domain}
196     [Documentation]    Creates domain and its filter with specific matching.
197     Add Domain    ${domain}
198     ${domains}    Add Domains    ${domain}
199     ${entry}    Get Filter Entry    10    permit    pl=132.5.0.0/${bits}
200     Add Domain Filter    ${DOMAIN_0}    ${domains}    ${entry}
201
202 Test Clean
203     ExportLibrary.Clean Library
204     Clean Connections
205     Clean Connections    domain=${DOMAIN_1}
206     Clean Peer Groups
207
208 Clean Custom SXP Environment
209     [Documentation]    Cleans test resources
210     Test Clean
211     Clean SXP Environment