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] ${controller_index} ${op_status_uri}
18 [Documentation] Checks to see if read or write operation is successfull in controller node.
19 ${data}= Utils.Get Data From URI controller${controller_index} ${op_status_uri}
21 ${json}= To Json ${data}
22 ${value}= Get From Dictionary ${json} value
23 ${value}= Convert to String ${value}
24 ${two}= Convert to String 2
25 Should Start With ${value} ${two}
27 Wait Until Write Finishes
28 [Arguments] ${controller_index} ${timeout}
29 [Documentation] Wait Until Write operation status is OK in ${controller_index}.
30 Wait Until Keyword Succeeds ${timeout} 1s BulkomaticKeywords.Operation Status Check ${controller_index} ${jolokia_write_op_status}
32 Wait Until Read Finishes
33 [Arguments] ${controller_index} ${timeout}
34 [Documentation] Wait Until Read operation status is OK in ${controller_index}.
35 Wait Until Keyword Succeeds ${timeout} 1s BulkomaticKeywords.Operation Status Check ${controller_index} ${jolokia_read_op_status}
38 [Arguments] ${controller_index} ${json_body_add}
39 [Documentation] Add Bulk Flow in ${controller_index} according to ${json_body_add}.
40 ${resp} Utils.Post Elements To URI ${ADD_BULK_CONFIG_NODES_API} ${json_body_add} headers=${HEADERS_YANG_JSON} session=controller${controller_index}
43 [Arguments] ${controller_index} ${json_body_del}
44 [Documentation] Delete Bulk Flow in ${controller_index} according to ${json_body_del}.
45 ${resp} Utils.Post Elements To URI ${ADD_BULK_CONFIG_NODES_API} ${json_body_del} headers=${HEADERS_YANG_JSON} session=controller${controller_index}
48 [Arguments] ${controller_index} ${json_body_get}
49 [Documentation] Get Bulk Flow in ${controller_index} according to ${json_body_get}.
50 ${resp} Utils.Post Elements To URI ${GET_BULK_CONFIG_NODES_API} ${json_body_get} headers=${HEADERS_YANG_JSON} session=controller${controller_index}
53 [Arguments] ${controller_index}
54 [Documentation] Get Flow count in ${controller_index}. New Flow Count is available after Get Bulk Flow operation.
55 ${data}= Utils.Get Data From URI controller${controller_index} ${jolokia_flow_count_status}
60 [Arguments] ${controller_index} ${flow_count}
61 [Documentation] Verify Flow Count in ${controller_index} matches ${flow_count}.
62 ${data}= Get Bulk Flow Count ${controller_index}
64 ${json}= To Json ${data}
65 ${value}= Get From Dictionary ${json} value
66 Should Be Equal As Strings ${value} ${flow_count}
69 [Arguments] ${controller_index} ${json_body_add} ${timeout}
70 [Documentation] Add Bulk Flow in ${controller_index} and wait until operation is completed.
71 Add Bulk Flow ${controller_index} ${json_body_add}
72 Wait Until Write Finishes ${controller_index} ${timeout}
74 Delete Bulk Flow In Node
75 [Arguments] ${controller_index} ${json_body_del} ${timeout}
76 [Documentation] Delete Bulk Flow in ${controller_index} and wait until operation is completed.
77 Delete Bulk Flow ${controller_index} ${json_body_del}
78 Wait Until Write Finishes ${controller_index} ${timeout}
80 Get Bulk Flow And Verify Count In Cluster
81 [Arguments] ${controller_index_list} ${json_body_get} ${timeout} ${flow_count}
82 [Documentation] Get Bulk Flow and Verify Flow Count in ${controller_index_list} matches ${flow_count}.
83 : FOR ${index} IN @{controller_index_list}
84 \ Get Bulk Flow ${index} ${json_body_get}
85 : FOR ${index} IN @{controller_index_list}
86 \ Wait Until Read Finishes ${index} ${timeout}
87 : FOR ${index} IN @{controller_index_list}
88 \ Verify Flow Count ${index} ${flow_count}
90 Set DPN And Flow Count In Json Add
91 [Arguments] ${json_config} ${dpn_count} ${flows_count}
92 [Documentation] Set new DPN count and flows count per DPN in the Bulkomatic Add json file.
93 ${body}= OperatingSystem.Get File ${CURDIR}/../variables/openflowplugin/${json_config}
94 ${get_string}= Set Variable "sal-bulk-flow:dpn-count" : "1"
95 ${put_string}= Set Variable "sal-bulk-flow:dpn-count" : "${dpn_count}"
96 ${str} Replace String Using Regexp ${body} ${get_string} ${put_string}
97 ${get_string}= Set Variable "sal-bulk-flow:flows-per-dpn" : "1000"
98 ${put_string}= Set Variable "sal-bulk-flow:flows-per-dpn" : "${flows_count}"
99 ${json_body_add} Replace String Using Regexp ${str} ${get_string} ${put_string}
101 [Return] ${json_body_add}
103 Set DPN And Flow Count In Json Get
104 [Arguments] ${json_config} ${dpn_count} ${flows_count}
105 [Documentation] Set new DPN count and flows count per DPN in the Bulkomatic Get json file.
106 ${body}= OperatingSystem.Get File ${CURDIR}/../variables/openflowplugin/${json_config}
107 ${get_string}= Set Variable "sal-bulk-flow:dpn-count" : "1"
108 ${put_string}= Set Variable "sal-bulk-flow:dpn-count" : "${dpn_count}"
109 ${str} Replace String Using Regexp ${body} ${get_string} ${put_string}
110 ${get_string}= Set Variable "sal-bulk-flow:flows-per-dpn" : "1000"
111 ${put_string}= Set Variable "sal-bulk-flow:flows-per-dpn" : "${flows_count}"
112 ${json_body_get} Replace String Using Regexp ${str} ${get_string} ${put_string}
114 [Return] ${json_body_get}
116 Set DPN And Flow Count In Json Del
117 [Arguments] ${json_config} ${dpn_count} ${flows_count}
118 [Documentation] Set new DPN count and flows count per DPN in the Bulkomatic Del json file.
119 ${body}= OperatingSystem.Get File ${CURDIR}/../variables/openflowplugin/${json_config}
120 ${get_string}= Set Variable "sal-bulk-flow:dpn-count" : "1"
121 ${put_string}= Set Variable "sal-bulk-flow:dpn-count" : "${dpn_count}"
122 ${str} Replace String Using Regexp ${body} ${get_string} ${put_string}
123 ${get_string}= Set Variable "sal-bulk-flow:flows-per-dpn" : "1000"
124 ${put_string}= Set Variable "sal-bulk-flow:flows-per-dpn" : "${flows_count}"
125 ${json_body_del} Replace String Using Regexp ${str} ${get_string} ${put_string}
127 [Return] ${json_body_del}