e6864f372a1fa173b54e398b0c59e1515566075b
[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           DateTime
7 Library           OperatingSystem
8 Library           RequestsLibrary
9 Library           String
10 Resource          ../../../libraries/Utils.robot
11 Variables         ../../../variables/Variables.py
12
13 *** Variables ***
14 ${MAPPINGS}       10000
15 ${LISP_SCAPY}     https://raw.githubusercontent.com/intouch/py-lispnetworking/master/lisp.py
16 ${TOOLS_DIR}      ${CURDIR}/../../../../tools/odl-lispflowmapping-performance-tests/
17 ${PCAP_CREATOR}    ${TOOLS_DIR}/create_map_request_pcap.py
18 ${MAPPING_BLASTER}    ${TOOLS_DIR}/mapping_blaster.py
19 ${REPLAY_PPS}     100000
20 ${REPLAY_CNT}     1000
21 ${REPLAY_FILE}    encapsulated-map-requests-sequential.pcap
22 ${RPCS_RESULTS_FILE}    rpcs.csv
23 ${PPS_RESULTS_FILE}    pps.csv
24
25 *** Test Cases ***
26 Add Simple IPv4 Mappings
27     ${start_date}=    Get Current Date
28     Run Process With Logging And Status Check    ${MAPPING_BLASTER}    --host    ${ODL_SYSTEM_IP}    --mappings    ${MAPPINGS}
29     ${end_date}=    Get Current Date
30     ${add_seconds}=    Subtract Date From Date    ${end_date}    ${start_date}
31     Log    ${add_seconds}
32     Set Suite Variable    ${add_seconds}
33
34 Generate Test Traffic
35     Reset Stats
36     ${result}=    Run Process With Logging And Status Check    /usr/local/bin/udpreplay    --pps    ${REPLAY_PPS}    --repeat    ${REPLAY_CNT}
37     ...    --host    ${ODL_SYSTEM_IP}    --port    4342    ${REPLAY_FILE}
38     ${partial}=    Fetch From Left    ${result.stdout}    s =
39     Log    ${partial}
40     ${get_seconds}=    Fetch From Right    ${partial}    ${SPACE}
41     ${get_seconds}=    Convert To Number    ${get_seconds}
42     Log    ${get_seconds}
43     Set Suite Variable    ${get_seconds}
44
45 Compute And Export Results
46     ${rpcs}=    Evaluate    ${MAPPINGS}/${add_seconds}
47     Log    ${rpcs}
48     Create File    ${RPCS_RESULTS_FILE}    store/s\n
49     Append To File    ${RPCS_RESULTS_FILE}    ${rpcs}\n
50     ${txmrep}=    Get Transmitted Map-Requests Stats
51     ${pps}=    Evaluate    ${txmrep}/${get_seconds}
52     Log    ${pps}
53     Create File    ${PPS_RESULTS_FILE}    replies/s\n
54     Append To File    ${PPS_RESULTS_FILE}    ${pps}\n
55
56 *** Keywords ***
57 Reset Stats
58     ${resp}=    RequestsLibrary.Post Request    session    ${LFM_SB_RPC_API}:reset-stats
59     Log    ${resp.content}
60     Should Be Equal As Strings    ${resp.status_code}    200
61
62 Get Transmitted Map-Requests Stats
63     ${resp}=    RequestsLibrary.Post Request    session    ${LFM_SB_RPC_API}:get-stats
64     Log    ${resp.content}
65     ${output}=    Get From Dictionary    ${resp.json()}    output
66     ${stats}=    Get From Dictionary    ${output}    control-message-stats
67     ${ctrlmsg}=    Get From Dictionary    ${stats}    control-message
68     ${replies}=    Get From List    ${ctrlmsg}    2
69     ${txmrep}=    Get From Dictionary    ${replies}    tx-count
70     ${txmrep}=    Convert To Integer    ${txmrep}
71     Log    ${txmrep}
72     [Return]    ${txmrep}
73
74 Prepare Environment
75     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
76     Run Process With Logging And Status Check    wget    -P    ${TOOLS_DIR}    ${LISP_SCAPY}
77     Run Process With Logging And Status Check    ${PCAP_CREATOR}    --requests    ${MAPPINGS}
78
79 Destroy Environment
80     Delete All Sessions
81     Remove File    ${TOOLS_DIR}/lisp.py*
82     Remove File    ${REPLAY_FILE}