2 Documentation Bulkomatic Keyword library contains keywords for performing bulkomatic operations
3 ... with a single bulkomatic API we can trigger bulk flows in config datastore which eventually populates switches and operational datastore
4 ... So far this library is only to be used by MD-SAL clustering and OpenFlowplugin clustering test as it is very specific for these tests
6 Variables ../variables/Variables.py
9 ${ADD_BULK_CONFIG_NODES_API} /restconf/operations/sal-bulk-flow:flow-test
10 ${GET_BULK_CONFIG_NODES_API} /restconf/operations/sal-bulk-flow:read-flow-test
11 ${jolokia_write_op_status} /jolokia/read/org.opendaylight.openflowplugin.applications.bulk.o.matic:type=FlowCounter/WriteOpStatus
12 ${jolokia_read_op_status} /jolokia/read/org.opendaylight.openflowplugin.applications.bulk.o.matic:type=FlowCounter/ReadOpStatus
13 ${jolokia_flow_count_status} /jolokia/read/org.opendaylight.openflowplugin.applications.bulk.o.matic:type=FlowCounter/FlowCount
16 Operation Status Check
17 [Arguments] ${op_status_uri} ${controller_index}
18 [Documentation] Checks to see if read or write operation is successfull in controller node.
19 ${data}= ClusterManagement.Get From Member ${op_status_uri} ${controller_index}
20 ${json}= To Json ${data}
21 ${value}= Get From Dictionary ${json} value
22 ${value}= Convert to String ${value}
23 ${two}= Convert to String 2
24 Should Start With ${value} ${two}
26 Wait Until Write Finishes
27 [Arguments] ${controller_index} ${timeout}
28 [Documentation] Wait Until Write operation status is OK in member ${controller_index}.
29 Wait Until Keyword Succeeds ${timeout} 1s BulkomaticKeywords.Operation Status Check ${jolokia_write_op_status} ${controller_index}
31 Wait Until Read Finishes
32 [Arguments] ${controller_index} ${timeout}
33 [Documentation] Wait Until Read operation status is OK in member ${controller_index}.
34 Wait Until Keyword Succeeds ${timeout} 1s BulkomaticKeywords.Operation Status Check ${jolokia_read_op_status} ${controller_index}
37 [Arguments] ${json_body_add} ${controller_index}
38 [Documentation] Add Bulk Flow in member ${controller_index} according to \${json_body_add}.
39 ${resp} ClusterManagement.Post As Json To Member ${ADD_BULK_CONFIG_NODES_API} ${json_body_add} ${controller_index}
42 [Arguments] ${json_body_del} ${controller_index}
43 [Documentation] Delete Bulk Flow in member ${controller_index} according to \${json_body_del}.
44 ${resp} ClusterManagement.Post As Json To Member ${ADD_BULK_CONFIG_NODES_API} ${json_body_del} ${controller_index}
47 [Arguments] ${json_body_get} ${controller_index}
48 [Documentation] Get Bulk Flow in member ${controller_index} according to \${json_body_get}.
49 ${resp} ClusterManagement.Post As Json To Member ${GET_BULK_CONFIG_NODES_API} ${json_body_get} ${controller_index}
52 [Arguments] ${controller_index}
53 [Documentation] Get Flow count in member ${controller_index}. New Flow Count is available after Get Bulk Flow operation.
54 ${data}= ClusterManagement.Get From Member ${jolokia_flow_count_status} ${controller_index}
58 [Arguments] ${flow_count} ${controller_index}
59 [Documentation] Verify Flow Count in member ${controller_index} matches ${flow_count}.
60 ${data}= Get Bulk Flow Count ${controller_index}
61 ${json}= To Json ${data}
62 ${value}= Get From Dictionary ${json} value
63 Should Be Equal As Strings ${value} ${flow_count}
66 [Arguments] ${json_body_add} ${controller_index} ${timeout}
67 [Documentation] Add Bulk Flow in member ${controller_index} and wait until operation is completed.
68 Add Bulk Flow ${json_body_add} ${controller_index}
69 Wait Until Write Finishes ${controller_index} ${timeout}
71 Delete Bulk Flow In Node
72 [Arguments] ${json_body_del} ${controller_index} ${timeout}
73 [Documentation] Delete Bulk Flow in member ${controller_index} and wait until operation is completed.
74 Delete Bulk Flow ${json_body_del} ${controller_index}
75 Wait Until Write Finishes ${controller_index} ${timeout}
77 Get Bulk Flow And Verify Count In Cluster
78 [Arguments] ${json_body_get} ${timeout} ${flow_count} ${controller_index_list}=${EMPTY}
79 [Documentation] Get Bulk Flow and Verify Flow Count in ${controller_index_list} matches ${flow_count}.
80 ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${controller_index_list}
81 : FOR ${index} IN @{index_list}
82 \ Get Bulk Flow ${json_body_get} ${index}
83 : FOR ${index} IN @{index_list}
84 \ Wait Until Read Finishes ${index} ${timeout}
85 : FOR ${index} IN @{index_list}
86 \ Verify Flow Count ${flow_count} ${index}
88 Set DPN And Flow Count In Json Add
89 [Arguments] ${json_config} ${dpn_count} ${flows_count}
90 [Documentation] Set new DPN count and flows count per DPN in the Bulkomatic Add json file.
91 ${body}= OperatingSystem.Get File ${CURDIR}/../variables/openflowplugin/${json_config}
92 ${get_string}= Set Variable "sal-bulk-flow:dpn-count" : "1"
93 ${put_string}= Set Variable "sal-bulk-flow:dpn-count" : "${dpn_count}"
94 ${str} Replace String Using Regexp ${body} ${get_string} ${put_string}
95 ${get_string}= Set Variable "sal-bulk-flow:flows-per-dpn" : "1000"
96 ${put_string}= Set Variable "sal-bulk-flow:flows-per-dpn" : "${flows_count}"
97 ${json_body_add} Replace String Using Regexp ${str} ${get_string} ${put_string}
98 ${get_string}= Set Variable "sal-bulk-flow:batch-size" : "1"
99 ${put_string}= Set Variable "sal-bulk-flow:batch-size" : "${flows_count}"
100 ${json_body_add} Replace String Using Regexp ${json_body_add} ${get_string} ${put_string}
102 [Return] ${json_body_add}
104 Set DPN And Flow Count In Json Get
105 [Arguments] ${json_config} ${dpn_count} ${flows_count}
106 [Documentation] Set new DPN count and flows count per DPN in the Bulkomatic Get json file.
107 ${body}= OperatingSystem.Get File ${CURDIR}/../variables/openflowplugin/${json_config}
108 ${get_string}= Set Variable "sal-bulk-flow:dpn-count" : "1"
109 ${put_string}= Set Variable "sal-bulk-flow:dpn-count" : "${dpn_count}"
110 ${str} Replace String Using Regexp ${body} ${get_string} ${put_string}
111 ${get_string}= Set Variable "sal-bulk-flow:flows-per-dpn" : "1000"
112 ${put_string}= Set Variable "sal-bulk-flow:flows-per-dpn" : "${flows_count}"
113 ${json_body_get} Replace String Using Regexp ${str} ${get_string} ${put_string}
115 [Return] ${json_body_get}
117 Set DPN And Flow Count In Json Del
118 [Arguments] ${json_config} ${dpn_count} ${flows_count}
119 [Documentation] Set new DPN count and flows count per DPN in the Bulkomatic Del json file.
120 ${body}= OperatingSystem.Get File ${CURDIR}/../variables/openflowplugin/${json_config}
121 ${get_string}= Set Variable "sal-bulk-flow:dpn-count" : "1"
122 ${put_string}= Set Variable "sal-bulk-flow:dpn-count" : "${dpn_count}"
123 ${str} Replace String Using Regexp ${body} ${get_string} ${put_string}
124 ${get_string}= Set Variable "sal-bulk-flow:flows-per-dpn" : "1000"
125 ${put_string}= Set Variable "sal-bulk-flow:flows-per-dpn" : "${flows_count}"
126 ${json_body_del} Replace String Using Regexp ${str} ${get_string} ${put_string}
127 ${get_string}= Set Variable "sal-bulk-flow:batch-size" : "1"
128 ${put_string}= Set Variable "sal-bulk-flow:batch-size" : "${flows_count}"
129 ${json_body_del} Replace String Using Regexp ${json_body_del} ${get_string} ${put_string}
131 [Return] ${json_body_del}