Add lispflowmapping 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}        ${CURDIR}/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}    --port    4342    ${REPLAY_FILE}
30     ${partial}=    Fetch From Left    ${result.stdout}    s =
31     Log    ${partial}
32     ${seconds}=    Fetch From Right    ${partial}    ${SPACE}
33     ${seconds}=    Convert To Number    ${seconds}
34     Log    ${seconds}
35     Set Suite Variable    ${seconds}
36
37 Compute And Export MapReply Rate
38     ${txmrep}=    Get Transmitted Map-Requests Stats
39     ${pps}=    Evaluate    ${txmrep}/${seconds}
40     Log    ${pps}
41     Create File    ${RESULTS_FILE}    replies/s\n
42     Append To File    ${RESULTS_FILE}    ${pps}\n
43
44 *** Keywords ***
45 Reset Stats
46     ${resp}=    RequestsLibrary.Post    session    ${LFM_SB_RPC_API}:reset-stats
47     Log    ${resp.content}
48     Should Be Equal As Strings    ${resp.status_code}    200
49
50 Get Transmitted Map-Requests Stats
51     ${resp}=    RequestsLibrary.Post    session    ${LFM_SB_RPC_API}:get-stats
52     Log    ${resp.content}
53     ${output}=     Get From Dictionary    ${resp.json()}    output
54     ${stats}=      Get From Dictionary    ${output}         control-message-stats
55     ${ctrlmsg}=    Get From Dictionary    ${stats}          control-message
56     ${replies}=    Get From List          ${ctrlmsg}        2
57     ${txmrep}=     Get From Dictionary    ${replies}        tx-count
58     ${txmrep}=     Convert To Integer     ${txmrep}
59     Log    ${txmrep}
60     [Return]    ${txmrep}
61
62 Prepare Environment
63     Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
64     Run Process With Logging And Status Check    wget    -P    ${TOOLS_DIR}    ${LISP_SCAPY}
65     Run Process With Logging And Status Check    ${PCAP_CREATOR}    --requests    ${MAPPINGS}
66
67 Destroy Environment
68     Delete All Sessions
69     Remove File    ${TOOLS_DIR}/lisp.py*
70     Remove File    ${REPLAY_FILE}