a6053f5279d956a58d4fbac99cac3a283d333181
[integration/test.git] / csit / suites / sxp / performance / 010_ConnectivityTests.robot
1 *** Settings ***
2 Documentation     Test suite measuring connectivity speed.
3 Suite Setup       Setup SXP Environment
4 Suite Teardown    Clean SXP Environment
5 Test Teardown     Test Clean
6 Library           ../../../libraries/Sxp.py
7 Resource          ../../../libraries/SxpLib.robot
8 Library           Remote    http://${ODL_SYSTEM_IP}:8270/ConnectionTestLibrary    WITH NAME    ConnectionTestLibrary
9
10 *** Variables ***
11 ${TEST_SAMPLES}    5
12
13 *** Test Cases ***
14 Connectivity Test
15     [Documentation]    Test covering speed of connecting to remote peers without TCP-MD5
16     Check Connectivity    80    70    30
17
18 Connectivity TCP-MD5 Test
19     [Documentation]    Test covering speed of connecting to remote peers with TCP-MD5
20     Check Connectivity    80    70    10    passwd
21
22 *** Keywords ***
23 Setup Topology
24     [Arguments]    ${connections}    ${PASSWORD}    ${version}
25     [Documentation]    Adds connections to local and remote nodes
26     : FOR    ${num}    IN RANGE    0    ${connections}
27     \    ${address}    Get Ip From Number    ${num}    2130771968
28     \    Add Connection    ${version}    listener    ${address}    64999    password=${PASSWORD}
29     \    ConnectionTestLibrary.Add Node    ${address}    ${version}    64999    ${PASSWORD}
30     \    ConnectionTestLibrary.Add Connection    ${version}    speaker    127.0.0.1    64999    ${PASSWORD}
31     \    ...    ${address}
32
33 Check Connectivity
34     [Arguments]    ${peers}    ${min_peers}    ${min_speed}    ${PASSWORD}=${EMPTY}    ${version}=version4
35     [Documentation]    Starts SXP nodes and checks if peers are already connected, this is repeated N times
36     @{ITEMS}    Create List
37     : FOR    ${num}    IN RANGE    0    ${TEST_SAMPLES}
38     \    Setup Topology    ${peers}    ${PASSWORD}    ${version}
39     \    ConnectionTestLibrary.Start Nodes
40     \    ConnectionTestLibrary.Initiate Connecting    ${min_peers}
41     \    ${ELEMENT}    Wait Until Keyword Succeeds    120    1    Check Connections Connected
42     \    Append To List    ${ITEMS}    ${ELEMENT}
43     \    Test Clean
44     ${connectivity_speed}    Get Average Of Items    ${ITEMS}
45     Log    Average connectivity speed ${connectivity_speed} connection/s.
46     Should Be True    ${connectivity_speed} > ${min_speed}
47
48 Check Connections Connected
49     [Documentation]    Checking if Peers were connected and return connectivity speed
50     ${peers_connected}    ConnectionTestLibrary.Get Connected Peers
51     ${connect_time}    ConnectionTestLibrary.Get Connect Time
52     Should Not Be Equal As Numbers    ${connect_time}    0
53     ${connectivity_speed}    Evaluate    ${peers_connected}/${connect_time}
54     [Return]    ${connectivity_speed}
55
56 Test Clean
57     ConnectionTestLibrary.Clean Library
58     Clean Connections