Update Robot Framework format - step 12
[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
4 Library             DateTime
5 Library             OperatingSystem
6 Resource            ../../../libraries/BulkomaticKeywords.robot
7 Resource            ../../../libraries/MininetKeywords.robot
8 Resource            ../../../libraries/ClusterManagement.robot
9 Resource            ../../../libraries/ClusterOpenFlow.robot
10 Variables           ../../../variables/Variables.py
11
12 Suite Setup         ClusterManagement Setup
13 Suite Teardown      Delete All Sessions
14
15
16 *** Variables ***
17 ${operation_timeout}        250s
18 ${oper_ds_timeout}          400s
19 ${mininet_timeout}          120s
20 ${flow_count_per_switch}    1000
21 ${switch_count}             100
22 ${karaf_log_level}          log:set WARN
23 ${orig_json_config_add}     sal_add_bulk_flow_config.json
24 ${orig_json_config_get}     sal_get_bulk_flow_config.json
25 ${orig_json_config_del}     sal_del_bulk_flow_config.json
26 ${rate_results_file}        rate.csv
27 ${time_results_file}        time.csv
28
29
30 *** Test Cases ***
31 Check Shards Status And Initialize Variables
32     [Documentation]    Check Status for all shards in OpenFlow application and set the logs across cluster nodes.
33     ClusterOpenFlow.Check OpenFlow Shards Status
34     Wait Until Keyword Succeeds    3x    3s    ClusterManagement.Run_Karaf_Command_On_List_Or_All    ${karaf_log_level}
35     ${flow_count_after_add}=    BuiltIn.Evaluate    ${flow_count_per_switch} * ${switch_count}
36     BuiltIn.Set Suite Variable    ${flow_count_after_add}
37     ${temp_json_config_add}=    BulkomaticKeywords.Set DPN And Flow Count In Json Add
38     ...    ${orig_json_config_add}
39     ...    ${switch_count}
40     ...    ${flow_count_per_switch}
41     ${temp_json_config_get}=    BulkomaticKeywords.Set DPN And Flow Count In Json Get
42     ...    ${orig_json_config_get}
43     ...    ${switch_count}
44     ...    ${flow_count_after_add}
45     ${temp_json_config_del}=    BulkomaticKeywords.Set DPN And Flow Count In Json Del
46     ...    ${orig_json_config_del}
47     ...    ${switch_count}
48     ...    ${flow_count_per_switch}
49     BuiltIn.Set Suite Variable    ${temp_json_config_add}
50     BuiltIn.Set Suite Variable    ${temp_json_config_get}
51     BuiltIn.Set Suite Variable    ${temp_json_config_del}
52
53 Get Inventory Config Shard Follower And Leader
54     [Documentation]    Find a leader and followers in the inventory config shard
55     ${inventory_leader}    ${inventory_followers}=    ClusterOpenFlow.Get InventoryConfig Shard Status
56     ${Follower_Node_1}=    Get From List    ${Inventory_Followers}    0
57     ${Follower_Node_2}=    Get From List    ${Inventory_Followers}    1
58     BuiltIn.Log to console    ${\n}
59     BuiltIn.Log to console    The follower Node1 is ${Follower_Node_1}
60     BuiltIn.Log to console    The follower Node2 is ${Follower_Node_2}
61     BuiltIn.Log to console    The leader Node is ${Inventory_Leader}
62     BuiltIn.Set Suite Variable    ${Follower_Node_1}
63     BuiltIn.Set Suite Variable    ${Follower_Node_2}
64     BuiltIn.Set Suite Variable    ${Inventory_Leader}
65
66 Start Mininet Connect To Follower Node1
67     [Documentation]    Start mininet with connection to follower node1.
68     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller
69     ...    ${TOOLS_SYSTEM_IP}
70     ...    ${ODL_SYSTEM_${Follower_Node_1}_IP}
71     ...    --topo linear,${switch_count}
72     BuiltIn.Set Suite Variable    ${mininet_conn_id}
73     BuiltIn.Wait Until Keyword Succeeds
74     ...    ${mininet_timeout}
75     ...    2s
76     ...    ClusterOpenFlow.Verify_Switch_Connections_Running_On_Member
77     ...    ${switch_count}
78     ...    ${Inventory_Leader}
79
80 Add Bulk Flow From Follower Node2
81     [Documentation]    100K Flows (1K Flows per DPN) in 100 DPN added via Follower Node2 and verify it gets applied in all instances.
82     ${config_datastore_write_start_time}=    DateTime.Get Current Date    result_format=timestamp
83     BulkomaticKeywords.Add Bulk Flow In Node    ${temp_json_config_add}    ${Follower_Node_2}    ${operation_timeout}
84     ${config_datastore_write_end_time}=    DateTime.Get Current Date    result_format=timestamp
85     ${config_datastore_write_time}=    DateTime.Subtract Date From Date
86     ...    ${config_datastore_write_end_time}
87     ...    ${config_datastore_write_start_time}
88     ${config_datastore_write_rate}=    BuiltIn.Evaluate    ${flow_count_after_add} / ${config_datastore_write_time}
89     BuiltIn.Set Suite Variable    ${config_datastore_write_start_time}
90     BuiltIn.Log to console    ${\n}
91     BuiltIn.Log to console    The config_datastore_write_time is ${config_datastore_write_time}
92     BuiltIn.Log to console    The config_datastore_write_rate is ${config_datastore_write_rate}
93     BuiltIn.Set Suite Variable    ${config_datastore_write_time}
94     BuiltIn.Set Suite Variable    ${config_datastore_write_rate}
95
96 Verify Flows In Switch
97     [Documentation]    Verify 100K flows are installed in 10 switches.
98     ${Mininet_write_start_time}=    DateTime.Get Current Date    result_format=timestamp
99     MininetKeywords.Verify Aggregate Flow From Mininet Session
100     ...    ${mininet_conn_id}
101     ...    ${flow_count_after_add}
102     ...    ${operation_timeout}
103     ${Mininet_write_end_time}=    DateTime.Get Current Date    result_format=timestamp
104     ${Mininet_write_time}=    DateTime.Subtract Date From Date
105     ...    ${Mininet_write_end_time}
106     ...    ${config_datastore_write_start_time}
107     ${Mininet_write_rate}=    BuiltIn.Evaluate    ${flow_count_after_add} / ${Mininet_write_time}
108     BuiltIn.Log to console    ${\n}
109     BuiltIn.Log to console    The Mininet_write_time is ${Mininet_write_time}
110     BuiltIn.Log to console    The Mininet_write_rate is ${Mininet_write_rate}
111     BuiltIn.Set Suite Variable    ${Mininet_write_time}
112     BuiltIn.Set Suite Variable    ${Mininet_write_rate}
113
114 Verify Flows In Oper DS
115     [Documentation]    Check Flows in Operational Datastore
116     Wait Until Keyword Succeeds
117     ...    ${oper_ds_timeout}
118     ...    2s
119     ...    ClusterOpenFlow.Check_Flows_Operational_Datastore_On_Member
120     ...    ${flow_count_after_add}
121     ...    ${Inventory_Leader}
122     ${oper_datastore_write_end_time}=    DateTime.Get Current Date    result_format=timestamp
123     ${oper_datastore_write_time}=    DateTime.Subtract Date From Date
124     ...    ${oper_datastore_write_end_time}
125     ...    ${config_datastore_write_start_time}
126     ${oper_datastore_write_rate}=    BuiltIn.Evaluate    ${flow_count_after_add} / ${oper_datastore_write_time}
127     BuiltIn.Log to console    ${\n}
128     BuiltIn.Log to console    The oper_datastore_write_time is ${oper_datastore_write_time}
129     BuiltIn.Log to console    The oper_datastore_write_rate is ${oper_datastore_write_rate}
130     BuiltIn.Set Suite Variable    ${oper_datastore_write_time}
131     BuiltIn.Set Suite Variable    ${oper_datastore_write_rate}
132
133 Stop Mininet Connected To Follower Node1 After Reconcilliation
134     [Documentation]    Stop mininet and exit connection.
135     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
136     BuiltIn.Wait Until Keyword Succeeds
137     ...    ${mininet_timeout}
138     ...    2s
139     ...    ClusterOpenFlow.Verify_Switch_Connections_Running_On_Member
140     ...    0
141     ...    ${Inventory_Leader}
142
143 Delete All Flows From Follower Node2
144     [Documentation]    100K Flows deleted via Follower Node2 and verify it gets applied in all instances.
145     ${config_datastore_delete_start_time}=    Get Current Date    result_format=timestamp
146     BulkomaticKeywords.Delete Bulk Flow In Node
147     ...    ${temp_json_config_del}
148     ...    ${Follower_Node_2}
149     ...    ${operation_timeout}
150     ${config_datastore_delete_end_time}=    Get Current Date    result_format=timestamp
151     ${config_datastore_delete_time}=    Subtract Date From Date
152     ...    ${config_datastore_delete_end_time}
153     ...    ${config_datastore_delete_start_time}
154     ${config_datastore_delete_rate}=    Evaluate    ${flow_count_after_add} / ${config_datastore_delete_time}
155     BuiltIn.Log to console    ${\n}
156     BuiltIn.Log to console    The config_datastore_delete_time is ${config_datastore_delete_time}
157     BuiltIn.Log to console    The config_datastore_delete_rate is ${config_datastore_delete_rate}
158     BuiltIn.Set Suite Variable    ${config_datastore_delete_time}
159     BuiltIn.Set Suite Variable    ${config_datastore_delete_rate}
160
161 Log Results And Determine Status
162     [Documentation]    Log results for plotting.
163     OperatingSystem.Append To File    ${rate_results_file}    Config DS,OVS Switch,Operational DS\n
164     OperatingSystem.Append To File
165     ...    ${rate_results_file}
166     ...    ${config_datastore_write_rate},${Mininet_write_rate},${oper_datastore_write_rate}\n
167     OperatingSystem.Append To File    ${time_results_file}    Config DS,OVS Switch,Operational DS\n
168     OperatingSystem.Append To File
169     ...    ${time_results_file}
170     ...    ${config_datastore_write_time},${Mininet_write_time},${oper_datastore_write_time}\n