LISP: Fix plots to show all graphs
[integration/test.git] / csit / suites / lispflowmapping / performance / 010_Southbound_MapRequest.robot
1 *** Settings ***
2 Documentation     LISP southbound performance tests
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 Resource          ../../../libraries/LISPFlowMapping.robot
12 Variables         ../../../variables/Variables.py
13
14 *** Variables ***
15 ${MAPPINGS}       10000
16 ${LISP_SCAPY}     https://raw.githubusercontent.com/ljakab/py-lispnetworking/opendaylight/lisp.py
17 ${TOOLS_DIR}      ${CURDIR}/../../../../tools/odl-lispflowmapping-performance-tests/
18 ${PCAP_CREATOR}    ${TOOLS_DIR}/create_lisp_control_plane_pcap.py
19 ${MAPPING_BLASTER}    ${TOOLS_DIR}/mapping_blaster.py
20 ${REPLAY_PPS}     100000
21 ${REPLAY_CNT}     1000
22 ${REPLAY_FILE_MREQ}    encapsulated-map-requests-sequential.pcap
23 ${REPLAY_FILE_MREG}    map-registers-sequential-no-auth.pcap
24 ${REPLAY_FILE_MRGA}    map-registers-sequential-sha1-auth.pcap
25 ${RPCS_RESULTS_FILE}    rpcs.csv
26 ${PPS_RESULTS_FILE}    pps.csv
27
28 *** Test Cases ***
29 Add Simple IPv4 Mappings
30     ${start_date}=    Get Current Date
31     Run Process With Logging And Status Check    ${MAPPING_BLASTER}    --host    ${ODL_SYSTEM_IP}    --mappings    ${MAPPINGS}
32     ${end_date}=    Get Current Date
33     ${add_seconds}=    Subtract Date From Date    ${end_date}    ${start_date}
34     Log    ${add_seconds}
35     ${rpcs}=    Evaluate    int(${MAPPINGS}/${add_seconds})
36     Log    ${rpcs}
37     Append To File    ${RPCS_RESULTS_FILE}    ${rpcs}\n
38
39 Generate Map-Request Test Traffic
40     ${pps_mrep}=    Lossy Test    2    ${REPLAY_FILE_MREQ}
41     Set Suite Variable    ${pps_mrep}
42
43 Generate Map-Register Test Traffic
44     Allow Unauthenticated Map-Registers
45     ${pps_mnot}=    Lossy Test    4    ${REPLAY_FILE_MREG}
46     Set Suite Variable    ${pps_mnot}
47
48 Generate Authenticated Map-Register Test Traffic
49     Allow Authenticated Map-Registers
50     ${pps_mnot_auth}=    Lossy Test    4    ${REPLAY_FILE_MRGA}
51     Set Suite Variable    ${pps_mnot_auth}
52
53 *** Keywords ***
54 Clean Up
55     Clear Config Datastore
56     Clear Operational Datastore
57     Sleep    500ms
58
59 Clear Config Datastore
60     ${resp}=    RequestsLibrary.Delete Request    session    /restconf/config/odl-mappingservice:mapping-database
61     Log    ${resp.content}
62
63 Clear Operational Datastore
64     ${resp}=    RequestsLibrary.Delete Request    session    /restconf/operational/odl-mappingservice:mapping-database
65     Log    ${resp.content}
66
67 Lossy Test
68     [Arguments]    ${lisp_type}    ${replay_file}
69     [Documentation]    This test will send traffic at a rate that is known to be
70     ...    higher than the capacity of the LISP Flow Mapping service and count
71     ...    the reply messages. Using the test's time duration, it computes the
72     ...    average reply packet rate in packets per second
73     ${elapsed_time}=    Generate Test Traffic    ${REPLAY_PPS}    ${REPLAY_CNT}    ${replay_file}
74     ${odl_tx_count}=    Get Control Message Stats    ${lisp_type}    tx-count
75     ${pps}=    Evaluate    int(${odl_tx_count}/${elapsed_time})
76     Log    ${pps}
77     Clean Up
78     [Return]    ${pps}
79
80 Generate Test Traffic
81     [Arguments]    ${replay_pps}    ${replay_cnt}    ${replay_file}
82     Reset Stats
83     ${result}=    Run Process With Logging And Status Check    /usr/local/bin/udpreplay    --pps    ${replay_pps}    --repeat    ${replay_cnt}
84     ...    --host    ${ODL_SYSTEM_IP}    --port    4342    ${replay_file}
85     ${partial}=    Fetch From Left    ${result.stdout}    s =
86     Log    ${partial}
87     ${time}=    Fetch From Right    ${partial}    ${SPACE}
88     ${time}=    Convert To Number    ${time}
89     Log    ${time}
90     [Return]    ${time}
91
92 Reset Stats
93     ${resp}=    RequestsLibrary.Post Request    session    ${LFM_SB_RPC_API}:reset-stats
94     Log    ${resp.content}
95     Should Be Equal As Strings    ${resp.status_code}    200
96
97 Allow Unauthenticated Map-Registers
98     ${add_key}=    OperatingSystem.Get File    ${JSON_DIR}/rpc_add-key_default_no-auth.json
99     Post Log Check    ${LFM_RPC_API}:add-key    ${add_key}
100
101 Allow Authenticated Map-Registers
102     ${add_key}=    OperatingSystem.Get File    ${JSON_DIR}/rpc_add-key_default.json
103     Post Log Check    ${LFM_RPC_API}:add-key    ${add_key}
104
105 Get Control Message Stats
106     [Arguments]    ${lisp_type}    ${stat_type}
107     ${resp}=    RequestsLibrary.Post Request    session    ${LFM_SB_RPC_API}:get-stats
108     Log    ${resp.content}
109     ${output}=    Get From Dictionary    ${resp.json()}    output
110     ${stats}=    Get From Dictionary    ${output}    control-message-stats
111     ${ctrlmsg}=    Get From Dictionary    ${stats}    control-message
112     ${ctrlmsg_type}=    Get From List    ${ctrlmsg}    ${lisp_type}
113     ${msg_cnt}=    Get From Dictionary    ${ctrlmsg_type}    ${stat_type}
114     ${msg_cnt}=    Convert To Integer    ${msg_cnt}
115     Log    ${msg_cnt}
116     [Return]    ${msg_cnt}
117
118 Prepare Environment
119     Create File    ${RPCS_RESULTS_FILE}    store/s\n
120     Create File    ${PPS_RESULTS_FILE}    replies/s,notifies/s,auth_notifies/s\n
121     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
122     Run Process With Logging And Status Check    wget    -P    ${TOOLS_DIR}    ${LISP_SCAPY}
123     Run Process With Logging And Status Check    ${PCAP_CREATOR}    --requests    ${MAPPINGS}
124
125 Destroy Environment
126     Append To File    ${PPS_RESULTS_FILE}    ${pps_mrep},${pps_mnot},${pps_mnot_auth}\n
127     Delete All Sessions
128     Remove File    ${TOOLS_DIR}/lisp.py*
129     Remove File    ${REPLAY_FILE_MREQ}
130     Remove File    ${REPLAY_FILE_MREG}
131     Remove File    ${REPLAY_FILE_MRGA}