Added test suites for Scaleup test in 3 node
[integration/test.git] / csit / suites / openflowplugin / Clustering_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 ERROR
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     ${Inventory_Leader_List}=    Create List    ${inventory_leader}
46     ${Inventory_Follower_Node1_List}=    Create List    ${Follower_Node_1}
47     BuiltIn.Log to console    ${\n}
48     BuiltIn.Log to console    The follower Node1 is ${Follower_Node_1}
49     BuiltIn.Log to console    The follower Node2 is ${Follower_Node_2}
50     BuiltIn.Log to console    The leader Node is ${Inventory_Leader}
51     BuiltIn.Set Suite Variable    ${Follower_Node_1}
52     BuiltIn.Set Suite Variable    ${Follower_Node_2}
53     BuiltIn.Set Suite Variable    ${Inventory_Leader}
54     BuiltIn.Set Suite Variable    ${Inventory_Leader_List}
55     BuiltIn.Set Suite Variable    ${Inventory_Follower_Node1_List}
56
57 Start Mininet Connect To Follower Node1
58     [Documentation]    Start mininet with connection to follower node1.
59     ${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
60     BuiltIn.Set Suite Variable    ${mininet_conn_id}
61     BuiltIn.Wait Until Keyword Succeeds    ${mininet_timeout}    2s    ClusterOpenFlow.Verify_Switch_Connections_Running_On_Member    ${switch_count}    ${Inventory_Leader}
62
63 Add Bulk Flow From Follower Node2
64     [Documentation]    100K Flows (1K Flows per DPN) in 100 DPN added via Follower Node2 and verify it gets applied in all instances.
65     ${config_datastore_write_start_time}=    DateTime.Get Current Date    result_format=timestamp
66     BulkomaticKeywords.Add Bulk Flow In Node    ${temp_json_config_add}    ${Follower_Node_2}    ${operation_timeout}
67     ${config_datastore_write_end_time}=    DateTime.Get Current Date    result_format=timestamp
68     ${config_datastore_write_time}=    DateTime.Subtract Date From Date    ${config_datastore_write_end_time}    ${config_datastore_write_start_time}
69     ${config_datastore_write_rate}=    BuiltIn.Evaluate    ${flow_count_after_add} / ${config_datastore_write_time}
70     BuiltIn.Set Suite Variable    ${config_datastore_write_start_time}
71     BuiltIn.Log to console    ${\n}
72     BuiltIn.Log to console    The config_datastore_write_time is ${config_datastore_write_time}
73     BuiltIn.Log to console    The config_datastore_write_rate is ${config_datastore_write_rate}
74     BuiltIn.Set Suite Variable    ${config_datastore_write_time}
75     BuiltIn.Set Suite Variable    ${config_datastore_write_rate}
76
77 Verify Flows In Switch
78     [Documentation]    Verify 100K flows are installed in 10 switches.
79     ${Mininet_write_start_time}=    DateTime.Get Current Date    result_format=timestamp
80     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${switch_count}    ${flow_count_per_switch}    ${operation_timeout}
81     ${Mininet_write_end_time}=    DateTime.Get Current Date    result_format=timestamp
82     ${Mininet_write_time}=    DateTime.Subtract Date From Date    ${Mininet_write_end_time}    ${config_datastore_write_start_time}
83     ${Mininet_write_rate}=    BuiltIn.Evaluate    ${flow_count_after_add} / ${Mininet_write_time}
84     BuiltIn.Log to console    ${\n}
85     BuiltIn.Log to console    The Mininet_write_time is ${Mininet_write_time}
86     BuiltIn.Log to console    The Mininet_write_rate is ${Mininet_write_rate}
87     BuiltIn.Set Suite Variable    ${Mininet_write_time}
88     BuiltIn.Set Suite Variable    ${Mininet_write_rate}
89
90 Verify Flows In Oper DS
91     [Documentation]    Check Flows in Operational Datastore
92     Wait Until Keyword Succeeds    ${oper_ds_timeout}    2s    ClusterOpenFlow.Check_Flows_Operational_Datastore_On_Member    ${flow_count_after_add}    ${Inventory_Leader}
93     ${oper_datastore_write_end_time}=    DateTime.Get Current Date    result_format=timestamp
94     ${oper_datastore_write_time}=    DateTime.Subtract Date From Date    ${oper_datastore_write_end_time}    ${config_datastore_write_start_time}
95     ${oper_datastore_write_rate}=    BuiltIn.Evaluate    ${flow_count_after_add} / ${oper_datastore_write_time}
96     BuiltIn.Log to console    ${\n}
97     BuiltIn.Log to console    The oper_datastore_write_time is ${oper_datastore_write_time}
98     BuiltIn.Log to console    The oper_datastore_write_rate is ${oper_datastore_write_rate}
99     BuiltIn.Set Suite Variable    ${oper_datastore_write_time}
100     BuiltIn.Set Suite Variable    ${oper_datastore_write_rate}
101
102 Stop Mininet Connected To Follower Node1 After Reconcilliation
103     [Documentation]    Stop mininet and exit connection.
104     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
105     BuiltIn.Wait Until Keyword Succeeds    ${mininet_timeout}    2s    ClusterOpenFlow.Verify_Switch_Connections_Running_On_Member    0    ${Inventory_Leader}
106
107 Delete All Flows From Follower Node2
108     [Documentation]    100K Flows deleted via Follower Node2 and verify it gets applied in all instances.
109     ${config_datastore_delete_start_time}=    Get Current Date    result_format=timestamp
110     BulkomaticKeywords.Delete Bulk Flow In Node    ${temp_json_config_del}    ${Follower_Node_2}    ${operation_timeout}
111     ${config_datastore_delete_end_time}=    Get Current Date    result_format=timestamp
112     ${config_datastore_delete_time}=    Subtract Date From Date    ${config_datastore_delete_end_time}    ${config_datastore_delete_start_time}
113     ${config_datastore_delete_rate}=    Evaluate    ${flow_count_after_add} / ${config_datastore_delete_time}
114     BuiltIn.Log to console    ${\n}
115     BuiltIn.Log to console    The config_datastore_delete_time is ${config_datastore_delete_time}
116     BuiltIn.Log to console    The config_datastore_delete_rate is ${config_datastore_delete_rate}
117     BuiltIn.Set Suite Variable    ${config_datastore_delete_time}
118     BuiltIn.Set Suite Variable    ${config_datastore_delete_rate}
119
120 Log Results And Determine Status
121     [Documentation]    Log results for plotting.
122     OperatingSystem.Append To File    ${rate_results_file}    Config DS,OVS Switch,Operational DS\n
123     OperatingSystem.Append To File    ${rate_results_file}    ${config_datastore_write_rate},${Mininet_write_rate},${oper_datastore_write_rate}\n
124     OperatingSystem.Append To File    ${time_results_file}    Config DS,OVS Switch,Operational DS\n
125     OperatingSystem.Append To File    ${time_results_file}    ${config_datastore_write_time},${Mininet_write_time},${oper_datastore_write_time}\n