Update lisp performance tests
[integration/test.git] / csit / suites / lispflowmapping / performance / 010_Southbound_MapRequest.robot
1 *** Settings ***
2 Documentation     Test suite to determine the southbound Map-Request serving rate
3 Suite Setup       Prepare Environment
4 Suite Teardown    Destroy Environment
5 Library           Collections
6 Library           OperatingSystem
7 Library           RequestsLibrary
8 Library           String
9 Resource          ../../../libraries/Utils.robot
10 Variables         ../../../variables/Variables.py
11
12 *** Variables ***
13 ${MAPPINGS}       10000
14 ${LISP_SCAPY}     https://raw.githubusercontent.com/intouch/py-lispnetworking/master/lisp.py
15 ${TOOLS_DIR}      ${CURDIR}/../../../../tools/odl-lispflowmapping-performance-tests/
16 ${PCAP_CREATOR}    ${TOOLS_DIR}/create_map_request_pcap.py
17 ${MAPPING_BLASTER}    ${TOOLS_DIR}/mapping_blaster.py
18 ${REPLAY_PPS}     100000
19 ${REPLAY_CNT}     1000
20 ${REPLAY_FILE}    encapsulated-map-requests-sequential.pcap
21 ${RESULTS_FILE}    pps.csv
22
23 *** Test Cases ***
24 Add Simple IPv4 Mappings
25     Run Process With Logging And Status Check    ${MAPPING_BLASTER}    --host    ${CONTROLLER}    --mappings    ${MAPPINGS}
26
27 Generate Test Traffic
28     Reset Stats
29     ${result}=    Run Process With Logging And Status Check    /usr/local/bin/udpreplay    --pps    ${REPLAY_PPS}    --repeat    ${REPLAY_CNT}
30     ...    --host    ${CONTROLLER}    --port    4342    ${REPLAY_FILE}
31     ${partial}=    Fetch From Left    ${result.stdout}    s =
32     Log    ${partial}
33     ${seconds}=    Fetch From Right    ${partial}    ${SPACE}
34     ${seconds}=    Convert To Number    ${seconds}
35     Log    ${seconds}
36     Set Suite Variable    ${seconds}
37
38 Compute And Export MapReply Rate
39     ${txmrep}=    Get Transmitted Map-Requests Stats
40     ${pps}=    Evaluate    ${txmrep}/${seconds}
41     Log    ${pps}
42     Create File    ${RESULTS_FILE}    replies/s\n
43     Append To File    ${RESULTS_FILE}    ${pps}\n
44
45 *** Keywords ***
46 Reset Stats
47     ${resp}=    RequestsLibrary.Post    session    ${LFM_SB_RPC_API}:reset-stats
48     Log    ${resp.content}
49     Should Be Equal As Strings    ${resp.status_code}    200
50
51 Get Transmitted Map-Requests Stats
52     ${resp}=    RequestsLibrary.Post    session    ${LFM_SB_RPC_API}:get-stats
53     Log    ${resp.content}
54     ${output}=    Get From Dictionary    ${resp.json()}    output
55     ${stats}=    Get From Dictionary    ${output}    control-message-stats
56     ${ctrlmsg}=    Get From Dictionary    ${stats}    control-message
57     ${replies}=    Get From List    ${ctrlmsg}    2
58     ${txmrep}=    Get From Dictionary    ${replies}    tx-count
59     ${txmrep}=    Convert To Integer    ${txmrep}
60     Log    ${txmrep}
61     [Return]    ${txmrep}
62
63 Prepare Environment
64     Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
65     Run Process With Logging And Status Check    wget    -P    ${TOOLS_DIR}    ${LISP_SCAPY}
66     Run Process With Logging And Status Check    ${PCAP_CREATOR}    --requests    ${MAPPINGS}
67
68 Destroy Environment
69     Delete All Sessions
70     Remove File    ${TOOLS_DIR}/lisp.py*
71     Remove File    ${REPLAY_FILE}