d5f6bb20b39786080925db7e075130210ddd6934
[integration/test.git] / csit / suites / openflowplugin / Performance_Bulkomatic / 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 Resource          ../../../libraries/BulkomaticKeywords.robot
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_per_switch}    1000
18 ${switch_count}    100
19 ${karaf_log_level}    log:set WARN
20 ${orig_json_config_add}    sal_add_bulk_flow_config.json
21 ${orig_json_config_get}    sal_get_bulk_flow_config.json
22 ${orig_json_config_del}    sal_del_bulk_flow_config.json
23 ${rate_results_file}    rate.csv
24 ${time_results_file}    time.csv
25
26 *** Test Cases ***
27 Check Shards Status And Initialize Variables
28     [Documentation]    Check Status for all shards in OpenFlow application and set the logs across cluster nodes.
29     ClusterOpenFlow.Check OpenFlow Shards Status
30     Wait Until Keyword Succeeds    3x    3s    ClusterManagement.Run_Karaf_Command_On_List_Or_All    ${karaf_log_level}
31     ${flow_count_after_add}=    BuiltIn.Evaluate    ${flow_count_per_switch} * ${switch_count}
32     BuiltIn.Set Suite Variable    ${flow_count_after_add}
33     ${temp_json_config_add}    BulkomaticKeywords.Set DPN And Flow Count In Json Add    ${orig_json_config_add}    ${switch_count}    ${flow_count_per_switch}
34     ${temp_json_config_get}    BulkomaticKeywords.Set DPN And Flow Count In Json Get    ${orig_json_config_get}    ${switch_count}    ${flow_count_after_add}
35     ${temp_json_config_del}    BulkomaticKeywords.Set DPN And Flow Count In Json Del    ${orig_json_config_del}    ${switch_count}    ${flow_count_per_switch}
36     BuiltIn.Set Suite Variable    ${temp_json_config_add}
37     BuiltIn.Set Suite Variable    ${temp_json_config_get}
38     BuiltIn.Set Suite Variable    ${temp_json_config_del}
39
40 Get Inventory Config Shard Follower And Leader
41     [Documentation]    Find a leader and followers in the inventory config shard
42     ${inventory_leader}    ${inventory_followers}    ClusterOpenFlow.Get InventoryConfig Shard Status
43     ${Follower_Node_1}=    Get From List    ${Inventory_Followers}    0
44     ${Follower_Node_2}=    Get From List    ${Inventory_Followers}    1
45     BuiltIn.Log to console    ${\n}
46     BuiltIn.Log to console    The follower Node1 is ${Follower_Node_1}
47     BuiltIn.Log to console    The follower Node2 is ${Follower_Node_2}
48     BuiltIn.Log to console    The leader Node is ${Inventory_Leader}
49     BuiltIn.Set Suite Variable    ${Follower_Node_1}
50     BuiltIn.Set Suite Variable    ${Follower_Node_2}
51     BuiltIn.Set Suite Variable    ${Inventory_Leader}
52
53 Start Mininet Connect To Follower Node1
54     [Documentation]    Start mininet with connection to follower node1.
55     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${Follower_Node_1}_IP}    --topo linear,${switch_count}
56     BuiltIn.Set Suite Variable    ${mininet_conn_id}
57     BuiltIn.Wait Until Keyword Succeeds    ${mininet_timeout}    2s    ClusterOpenFlow.Verify_Switch_Connections_Running_On_Member    ${switch_count}    ${Inventory_Leader}
58
59 Add Bulk Flow From Follower Node2
60     [Documentation]    100K Flows (1K Flows per DPN) in 100 DPN added via Follower Node2 and verify it gets applied in all instances.
61     ${config_datastore_write_start_time}=    DateTime.Get Current Date    result_format=timestamp
62     BulkomaticKeywords.Add Bulk Flow In Node    ${temp_json_config_add}    ${Follower_Node_2}    ${operation_timeout}
63     ${config_datastore_write_end_time}=    DateTime.Get Current Date    result_format=timestamp
64     ${config_datastore_write_time}=    DateTime.Subtract Date From Date    ${config_datastore_write_end_time}    ${config_datastore_write_start_time}
65     ${config_datastore_write_rate}=    BuiltIn.Evaluate    ${flow_count_after_add} / ${config_datastore_write_time}
66     BuiltIn.Set Suite Variable    ${config_datastore_write_start_time}
67     BuiltIn.Log to console    ${\n}
68     BuiltIn.Log to console    The config_datastore_write_time is ${config_datastore_write_time}
69     BuiltIn.Log to console    The config_datastore_write_rate is ${config_datastore_write_rate}
70     BuiltIn.Set Suite Variable    ${config_datastore_write_time}
71     BuiltIn.Set Suite Variable    ${config_datastore_write_rate}
72
73 Verify Flows In Switch
74     [Documentation]    Verify 100K flows are installed in 10 switches.
75     ${Mininet_write_start_time}=    DateTime.Get Current Date    result_format=timestamp
76     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${flow_count_after_add}    ${operation_timeout}
77     ${Mininet_write_end_time}=    DateTime.Get Current Date    result_format=timestamp
78     ${Mininet_write_time}=    DateTime.Subtract Date From Date    ${Mininet_write_end_time}    ${config_datastore_write_start_time}
79     ${Mininet_write_rate}=    BuiltIn.Evaluate    ${flow_count_after_add} / ${Mininet_write_time}
80     BuiltIn.Log to console    ${\n}
81     BuiltIn.Log to console    The Mininet_write_time is ${Mininet_write_time}
82     BuiltIn.Log to console    The Mininet_write_rate is ${Mininet_write_rate}
83     BuiltIn.Set Suite Variable    ${Mininet_write_time}
84     BuiltIn.Set Suite Variable    ${Mininet_write_rate}
85
86 Verify Flows In Oper DS
87     [Documentation]    Check Flows in Operational Datastore
88     Wait Until Keyword Succeeds    ${oper_ds_timeout}    2s    ClusterOpenFlow.Check_Flows_Operational_Datastore_On_Member    ${flow_count_after_add}    ${Inventory_Leader}
89     ${oper_datastore_write_end_time}=    DateTime.Get Current Date    result_format=timestamp
90     ${oper_datastore_write_time}=    DateTime.Subtract Date From Date    ${oper_datastore_write_end_time}    ${config_datastore_write_start_time}
91     ${oper_datastore_write_rate}=    BuiltIn.Evaluate    ${flow_count_after_add} / ${oper_datastore_write_time}
92     BuiltIn.Log to console    ${\n}
93     BuiltIn.Log to console    The oper_datastore_write_time is ${oper_datastore_write_time}
94     BuiltIn.Log to console    The oper_datastore_write_rate is ${oper_datastore_write_rate}
95     BuiltIn.Set Suite Variable    ${oper_datastore_write_time}
96     BuiltIn.Set Suite Variable    ${oper_datastore_write_rate}
97
98 Stop Mininet Connected To Follower Node1 After Reconcilliation
99     [Documentation]    Stop mininet and exit connection.
100     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
101     BuiltIn.Wait Until Keyword Succeeds    ${mininet_timeout}    2s    ClusterOpenFlow.Verify_Switch_Connections_Running_On_Member    0    ${Inventory_Leader}
102
103 Delete All Flows From Follower Node2
104     [Documentation]    100K Flows deleted via Follower Node2 and verify it gets applied in all instances.
105     ${config_datastore_delete_start_time}=    Get Current Date    result_format=timestamp
106     BulkomaticKeywords.Delete Bulk Flow In Node    ${temp_json_config_del}    ${Follower_Node_2}    ${operation_timeout}
107     ${config_datastore_delete_end_time}=    Get Current Date    result_format=timestamp
108     ${config_datastore_delete_time}=    Subtract Date From Date    ${config_datastore_delete_end_time}    ${config_datastore_delete_start_time}
109     ${config_datastore_delete_rate}=    Evaluate    ${flow_count_after_add} / ${config_datastore_delete_time}
110     BuiltIn.Log to console    ${\n}
111     BuiltIn.Log to console    The config_datastore_delete_time is ${config_datastore_delete_time}
112     BuiltIn.Log to console    The config_datastore_delete_rate is ${config_datastore_delete_rate}
113     BuiltIn.Set Suite Variable    ${config_datastore_delete_time}
114     BuiltIn.Set Suite Variable    ${config_datastore_delete_rate}
115
116 Log Results And Determine Status
117     [Documentation]    Log results for plotting.
118     OperatingSystem.Append To File    ${rate_results_file}    Config DS,OVS Switch,Operational DS\n
119     OperatingSystem.Append To File    ${rate_results_file}    ${config_datastore_write_rate},${Mininet_write_rate},${oper_datastore_write_rate}\n
120     OperatingSystem.Append To File    ${time_results_file}    Config DS,OVS Switch,Operational DS\n
121     OperatingSystem.Append To File    ${time_results_file}    ${config_datastore_write_time},${Mininet_write_time},${oper_datastore_write_time}\n