New OpenFlow REST perf test
[integration/test.git] / csit / suites / openflowplugin / Performance_Restconf / 100K_Flows_100DPN_3Node_Cluster_Perf_Test.robot
1 *** Settings ***
2 Documentation     Test suite for 3Node Cluster - 100K flows and 10 DPNs in Cluster Scale Up scenario
3 Suite Setup       ClusterManagement Setup
4 Suite Teardown    Delete All Sessions
5 Library           DateTime
6 Library           OperatingSystem
7 Library           ../../../libraries/ScaleClient.py
8 Resource          ../../../libraries/MininetKeywords.robot
9 Resource          ../../../libraries/ClusterManagement.robot
10 Resource          ../../../libraries/ClusterOpenFlow.robot
11 Variables         ../../../variables/Variables.py
12
13 *** Variables ***
14 ${operation_timeout}    250s
15 ${oper_ds_timeout}    400s
16 ${mininet_timeout}    120s
17 ${flow_count}     100000
18 ${switch_count}    100
19 ${swspread}       linear
20 ${tabspread}      first
21 ${fpr}            10
22 ${nrthreads}      5
23 ${karaf_log_level}    log:set ERROR
24 ${rate_results_file}    rate.csv
25 ${time_results_file}    time.csv
26
27 *** Test Cases ***
28 Check Shards Status And Initialize Variables
29     [Documentation]    Check Status for all shards in OpenFlow application and set the logs across cluster nodes.
30     ClusterOpenFlow.Check OpenFlow Shards Status
31     Wait Until Keyword Succeeds    3x    3s    ClusterManagement.Run_Karaf_Command_On_List_Or_All    ${karaf_log_level}
32     ${flows}    ${notes}    ScaleClient.Generate New Flow Details    flows=${flow_count}    switches=${switch_count}    swspread=${swspread}    tabspread=${tabspread}
33     Set Suite Variable    ${flows}
34
35 Get Inventory Config Shard Follower And Leader
36     [Documentation]    Find a leader and followers in the inventory config shard
37     ${inventory_leader}    ${inventory_followers}    ClusterOpenFlow.Get InventoryConfig Shard Status
38     ${Follower_Node_1}=    Get From List    ${Inventory_Followers}    0
39     ${Follower_Node_2}=    Get From List    ${Inventory_Followers}    1
40     ${Inventory_Leader_List}=    Create List    ${inventory_leader}
41     ${Inventory_Follower_Node2_List}=    Create List    ${ODL_SYSTEM_${Follower_Node_2}_IP}
42     BuiltIn.Log to console    ${\n}
43     BuiltIn.Log to console    The follower Node1 is ${Follower_Node_1}
44     BuiltIn.Log to console    The follower Node2 is ${Follower_Node_2}
45     BuiltIn.Log to console    The leader Node is ${Inventory_Leader}
46     BuiltIn.Set Suite Variable    ${Follower_Node_1}
47     BuiltIn.Set Suite Variable    ${Follower_Node_2}
48     BuiltIn.Set Suite Variable    ${Inventory_Leader}
49     BuiltIn.Set Suite Variable    ${Inventory_Follower_Node2_List}
50
51 Start Mininet Connect To Follower Node1
52     [Documentation]    Start mininet with connection to follower node1.
53     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${Follower_Node_1}_IP}    --topo linear,${switch_count} --switch ovsk,protocols=OpenFlow13
54     BuiltIn.Set Suite Variable    ${mininet_conn_id}
55     BuiltIn.Wait Until Keyword Succeeds    ${mininet_timeout}    2s    ClusterOpenFlow.Verify_Switch_Connections_Running_On_Member    ${switch_count}    ${Inventory_Leader}
56
57 Add Bulk Flow via REST From Follower Node2
58     [Documentation]    100K Flows (1K Flows per DPN) in 100 DPN added via Follower Node2 and verify it gets applied in all instances.
59     ${config_datastore_write_start_time}=    DateTime.Get Current Date    result_format=timestamp
60     ScaleClient.Configure Flows Bulk    flow_details=${flows}    controllers=${Inventory_Follower_Node2_List}    nrthreads=${nrthreads}    fpr=${fpr}
61     ${config_datastore_write_end_time}=    DateTime.Get Current Date    result_format=timestamp
62     ${config_datastore_write_time}=    DateTime.Subtract Date From Date    ${config_datastore_write_end_time}    ${config_datastore_write_start_time}
63     ${config_datastore_write_rate}=    BuiltIn.Evaluate    ${flow_count} / ${config_datastore_write_time}
64     BuiltIn.Set Suite Variable    ${config_datastore_write_start_time}
65     BuiltIn.Log to console    ${\n}
66     BuiltIn.Log to console    The config_datastore_write_time is ${config_datastore_write_time}
67     BuiltIn.Log to console    The config_datastore_write_rate is ${config_datastore_write_rate}
68     BuiltIn.Set Suite Variable    ${config_datastore_write_time}
69     BuiltIn.Set Suite Variable    ${config_datastore_write_rate}
70
71 Verify Flows In Switch
72     [Documentation]    Verify 100K flows are installed in 10 switches.
73     ${Mininet_write_start_time}=    DateTime.Get Current Date    result_format=timestamp
74     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${flow_count}    ${operation_timeout}
75     ${Mininet_write_end_time}=    DateTime.Get Current Date    result_format=timestamp
76     ${Mininet_write_time}=    DateTime.Subtract Date From Date    ${Mininet_write_end_time}    ${config_datastore_write_start_time}
77     ${Mininet_write_rate}=    BuiltIn.Evaluate    ${flow_count} / ${Mininet_write_time}
78     BuiltIn.Log to console    ${\n}
79     BuiltIn.Log to console    The Mininet_write_time is ${Mininet_write_time}
80     BuiltIn.Log to console    The Mininet_write_rate is ${Mininet_write_rate}
81     BuiltIn.Set Suite Variable    ${Mininet_write_time}
82     BuiltIn.Set Suite Variable    ${Mininet_write_rate}
83
84 Verify Flows In Oper DS
85     [Documentation]    Check Flows in Operational Datastore
86     Wait Until Keyword Succeeds    ${oper_ds_timeout}    2s    ClusterOpenFlow.Check_Flows_Operational_Datastore_On_Member    ${flow_count}    ${Inventory_Leader}
87     ${oper_datastore_write_end_time}=    DateTime.Get Current Date    result_format=timestamp
88     ${oper_datastore_write_time}=    DateTime.Subtract Date From Date    ${oper_datastore_write_end_time}    ${config_datastore_write_start_time}
89     ${oper_datastore_write_rate}=    BuiltIn.Evaluate    ${flow_count} / ${oper_datastore_write_time}
90     BuiltIn.Log to console    ${\n}
91     BuiltIn.Log to console    The oper_datastore_write_time is ${oper_datastore_write_time}
92     BuiltIn.Log to console    The oper_datastore_write_rate is ${oper_datastore_write_rate}
93     BuiltIn.Set Suite Variable    ${oper_datastore_write_time}
94     BuiltIn.Set Suite Variable    ${oper_datastore_write_rate}
95
96 Stop Mininet Connected To Follower Node1 After Reconcilliation
97     [Documentation]    Stop mininet and exit connection.
98     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
99     BuiltIn.Wait Until Keyword Succeeds    ${mininet_timeout}    2s    ClusterOpenFlow.Verify_Switch_Connections_Running_On_Member    0    ${Inventory_Leader}
100
101 Delete All Flows From Follower Node2
102     [Documentation]    100K Flows deleted via Follower Node2 and verify it gets applied in all instances.
103     ${config_datastore_delete_start_time}=    Get Current Date    result_format=timestamp
104     ClusterManagement.Delete From Member    ${CONFIG_NODES_API}    ${Follower_Node_2}
105     ${config_datastore_delete_end_time}=    Get Current Date    result_format=timestamp
106     ${config_datastore_delete_time}=    Subtract Date From Date    ${config_datastore_delete_end_time}    ${config_datastore_delete_start_time}
107     ${config_datastore_delete_rate}=    Evaluate    ${flow_count} / ${config_datastore_delete_time}
108     BuiltIn.Log to console    ${\n}
109     BuiltIn.Log to console    The config_datastore_delete_time is ${config_datastore_delete_time}
110     BuiltIn.Log to console    The config_datastore_delete_rate is ${config_datastore_delete_rate}
111     BuiltIn.Set Suite Variable    ${config_datastore_delete_time}
112     BuiltIn.Set Suite Variable    ${config_datastore_delete_rate}
113
114 Log Results And Determine Status
115     [Documentation]    Log results for plotting.
116     OperatingSystem.Append To File    ${rate_results_file}    Config DS,OVS Switch,Operational DS\n
117     OperatingSystem.Append To File    ${rate_results_file}    ${config_datastore_write_rate},${Mininet_write_rate},${oper_datastore_write_rate}\n
118     OperatingSystem.Append To File    ${time_results_file}    Config DS,OVS Switch,Operational DS\n
119     OperatingSystem.Append To File    ${time_results_file}    ${config_datastore_write_time},${Mininet_write_time},${oper_datastore_write_time}\n