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