blob: 666eb3d00ebef88ba1481cc2074291e1dda2af36 [file] [log] [blame]
Stephane Barbarieec0919b2018-09-05 14:14:29 -04001/*
2 * Copyright 2018-present Open Networking Foundation
3
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7
8 * http://www.apache.org/licenses/LICENSE-2.0
9
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package model
17
18import (
Stephane Barbarieec0919b2018-09-05 14:14:29 -040019 "encoding/hex"
20 "encoding/json"
khenaidoob9203542018-09-17 22:56:37 -040021 "github.com/google/uuid"
Stephane Barbariea188d942018-10-16 16:43:04 -040022 "github.com/opencord/voltha-go/protos/openflow_13"
Stephane Barbariedc5022d2018-11-19 15:21:44 -050023 "github.com/opencord/voltha-go/protos/voltha"
24 "math/rand"
khenaidoob9203542018-09-17 22:56:37 -040025 "reflect"
26 "strconv"
27 "testing"
Stephane Barbarieec0919b2018-09-05 14:14:29 -040028)
29
Stephane Barbarieec0919b2018-09-05 14:14:29 -040030var (
Stephane Barbariedc5022d2018-11-19 15:21:44 -050031 ldevProxy *Proxy
32 devProxy *Proxy
33 flowProxy *Proxy
Stephane Barbarieec0919b2018-09-05 14:14:29 -040034)
35
Stephane Barbariedc5022d2018-11-19 15:21:44 -050036func init() {
37 ldevProxy = modelTestConfig.Root.node.CreateProxy("/", false)
38 devProxy = modelTestConfig.Root.node.CreateProxy("/", false)
39}
40
41func Test_Proxy_1_1_1_Add_NewDevice(t *testing.T) {
42 devIDBin, _ := uuid.New().MarshalBinary()
43 devID = "0001" + hex.EncodeToString(devIDBin)[:12]
44 device.Id = devID
Stephane Barbarie126101e2018-10-11 16:18:48 -040045
Stephane Barbariea188d942018-10-16 16:43:04 -040046 preAddExecuted := false
47 postAddExecuted := false
48
Stephane Barbariedc5022d2018-11-19 15:21:44 -050049 // Register ADD instructions callbacks
50 devProxy.RegisterCallback(PRE_ADD, commonCallback, "PRE_ADD instructions", &preAddExecuted)
51 devProxy.RegisterCallback(POST_ADD, commonCallback, "POST_ADD instructions", &postAddExecuted)
Stephane Barbarie126101e2018-10-11 16:18:48 -040052
Stephane Barbariedc5022d2018-11-19 15:21:44 -050053 // Add the device
54 if added := devProxy.Add("/devices", device, ""); added == nil {
Stephane Barbarie126101e2018-10-11 16:18:48 -040055 t.Error("Failed to add device")
56 } else {
57 t.Logf("Added device : %+v", added)
58 }
59
Stephane Barbariedc5022d2018-11-19 15:21:44 -050060 // Verify that the added device can now be retrieved
61 if d := devProxy.Get("/devices/"+devID, 0, false, ""); !reflect.ValueOf(d).IsValid() {
Stephane Barbarie126101e2018-10-11 16:18:48 -040062 t.Error("Failed to find added device")
63 } else {
64 djson, _ := json.Marshal(d)
65 t.Logf("Found device: %s", string(djson))
66 }
67
68 if !preAddExecuted {
69 t.Error("PRE_ADD callback was not executed")
70 }
71 if !postAddExecuted {
72 t.Error("POST_ADD callback was not executed")
73 }
74}
75
Stephane Barbariedc5022d2018-11-19 15:21:44 -050076func Test_Proxy_1_1_2_Add_ExistingDevice(t *testing.T) {
77 device.Id = devID
78
79 if added := devProxy.Add("/devices", device, ""); added == nil {
80 t.Logf("Successfully detected that the device already exists: %s", devID)
Stephane Barbarie126101e2018-10-11 16:18:48 -040081 } else {
82 t.Errorf("A new device should not have been created : %+v", added)
83 }
84
85}
86
Stephane Barbariedc5022d2018-11-19 15:21:44 -050087func Test_Proxy_1_2_1_Get_AllDevices(t *testing.T) {
88 devices := devProxy.Get("/devices", 1, false, "")
Stephane Barbarieec0919b2018-09-05 14:14:29 -040089
90 if len(devices.([]interface{})) == 0 {
91 t.Error("there are no available devices to retrieve")
92 } else {
93 // Save the target device id for later tests
Stephane Barbariedc5022d2018-11-19 15:21:44 -050094 targetDevID = devices.([]interface{})[0].(*voltha.Device).Id
Stephane Barbarie126101e2018-10-11 16:18:48 -040095 t.Logf("retrieved all devices: %+v", devices)
Stephane Barbarieec0919b2018-09-05 14:14:29 -040096 }
97}
98
Stephane Barbariedc5022d2018-11-19 15:21:44 -050099func Test_Proxy_1_2_2_Get_SingleDevice(t *testing.T) {
100 if d := devProxy.Get("/devices/"+targetDevID, 0, false, ""); !reflect.ValueOf(d).IsValid() {
101 t.Errorf("Failed to find device : %s", targetDevID)
Stephane Barbarieec0919b2018-09-05 14:14:29 -0400102 } else {
103 djson, _ := json.Marshal(d)
Stephane Barbarie126101e2018-10-11 16:18:48 -0400104 t.Logf("Found device: %s", string(djson))
105 }
Stephane Barbarieec0919b2018-09-05 14:14:29 -0400106
Stephane Barbarie126101e2018-10-11 16:18:48 -0400107}
108
Stephane Barbariedc5022d2018-11-19 15:21:44 -0500109func Test_Proxy_1_3_1_Update_Device(t *testing.T) {
110 var fwVersion int
111 preUpdateExecuted := false
112 postUpdateExecuted := false
113
114 if retrieved := devProxy.Get("/devices/"+targetDevID, 1, false, ""); retrieved == nil {
Stephane Barbarie126101e2018-10-11 16:18:48 -0400115 t.Error("Failed to get device")
116 } else {
Stephane Barbariea188d942018-10-16 16:43:04 -0400117 t.Logf("Found raw device (root proxy): %+v", retrieved)
118
Stephane Barbarie126101e2018-10-11 16:18:48 -0400119 if retrieved.(*voltha.Device).FirmwareVersion == "n/a" {
120 fwVersion = 0
121 } else {
122 fwVersion, _ = strconv.Atoi(retrieved.(*voltha.Device).FirmwareVersion)
Stephane Barbariedc5022d2018-11-19 15:21:44 -0500123 fwVersion++
Stephane Barbarie126101e2018-10-11 16:18:48 -0400124 }
125
Stephane Barbariedc5022d2018-11-19 15:21:44 -0500126 retrieved.(*voltha.Device).FirmwareVersion = strconv.Itoa(fwVersion)
Stephane Barbarie126101e2018-10-11 16:18:48 -0400127
Stephane Barbariedc5022d2018-11-19 15:21:44 -0500128 devProxy.RegisterCallback(
Stephane Barbarie126101e2018-10-11 16:18:48 -0400129 PRE_UPDATE,
130 commonCallback,
131 "PRE_UPDATE instructions (root proxy)", &preUpdateExecuted,
132 )
Stephane Barbariedc5022d2018-11-19 15:21:44 -0500133 devProxy.RegisterCallback(
Stephane Barbarie126101e2018-10-11 16:18:48 -0400134 POST_UPDATE,
135 commonCallback,
136 "POST_UPDATE instructions (root proxy)", &postUpdateExecuted,
137 )
138
Stephane Barbariedc5022d2018-11-19 15:21:44 -0500139 if afterUpdate := devProxy.Update("/devices/"+targetDevID, retrieved, false, ""); afterUpdate == nil {
Stephane Barbarie126101e2018-10-11 16:18:48 -0400140 t.Error("Failed to update device")
141 } else {
Stephane Barbariedc5022d2018-11-19 15:21:44 -0500142 t.Logf("Updated device : %+v", afterUpdate)
Stephane Barbarie126101e2018-10-11 16:18:48 -0400143 }
Stephane Barbariedc5022d2018-11-19 15:21:44 -0500144
145 if d := devProxy.Get("/devices/"+targetDevID, 1, false, ""); !reflect.ValueOf(d).IsValid() {
Stephane Barbarie126101e2018-10-11 16:18:48 -0400146 t.Error("Failed to find updated device (root proxy)")
147 } else {
148 djson, _ := json.Marshal(d)
Stephane Barbariea188d942018-10-16 16:43:04 -0400149 t.Logf("Found device (root proxy): %s raw: %+v", string(djson), d)
Stephane Barbarie126101e2018-10-11 16:18:48 -0400150 }
151
152 if !preUpdateExecuted {
153 t.Error("PRE_UPDATE callback was not executed")
154 }
155 if !postUpdateExecuted {
156 t.Error("POST_UPDATE callback was not executed")
157 }
Stephane Barbarieec0919b2018-09-05 14:14:29 -0400158 }
159}
Stephane Barbarie126101e2018-10-11 16:18:48 -0400160
Stephane Barbariedc5022d2018-11-19 15:21:44 -0500161func Test_Proxy_1_3_2_Update_DeviceFlows(t *testing.T) {
Stephane Barbarie06c4a742018-10-01 11:09:32 -0400162 // Get a device proxy and update a specific port
Stephane Barbariedc5022d2018-11-19 15:21:44 -0500163 flowProxy = modelTestConfig.Root.node.CreateProxy("/devices/"+devID+"/flows", false)
164 flows := flowProxy.Get("/", 0, false, "")
Stephane Barbariea188d942018-10-16 16:43:04 -0400165 flows.(*openflow_13.Flows).Items[0].TableId = 2244
Stephane Barbarie06c4a742018-10-01 11:09:32 -0400166
Stephane Barbariea188d942018-10-16 16:43:04 -0400167 preUpdateExecuted := false
168 postUpdateExecuted := false
Stephane Barbarie06c4a742018-10-01 11:09:32 -0400169
Stephane Barbariedc5022d2018-11-19 15:21:44 -0500170 flowProxy.RegisterCallback(
Stephane Barbarie126101e2018-10-11 16:18:48 -0400171 PRE_UPDATE,
172 commonCallback,
173 "PRE_UPDATE instructions (flows proxy)", &preUpdateExecuted,
174 )
Stephane Barbariedc5022d2018-11-19 15:21:44 -0500175 flowProxy.RegisterCallback(
Stephane Barbarie126101e2018-10-11 16:18:48 -0400176 POST_UPDATE,
177 commonCallback,
178 "POST_UPDATE instructions (flows proxy)", &postUpdateExecuted,
179 )
Stephane Barbarie06c4a742018-10-01 11:09:32 -0400180
Stephane Barbariedc5022d2018-11-19 15:21:44 -0500181 kvFlows := flowProxy.Get("/", 0, false, "")
Stephane Barbarie126101e2018-10-11 16:18:48 -0400182
183 if reflect.DeepEqual(flows, kvFlows) {
184 t.Errorf("Local changes have changed the KV store contents - local:%+v, kv: %+v", flows, kvFlows)
185 }
186
Stephane Barbariedc5022d2018-11-19 15:21:44 -0500187 if updated := flowProxy.Update("/", flows.(*openflow_13.Flows), false, ""); updated == nil {
Stephane Barbarie126101e2018-10-11 16:18:48 -0400188 t.Error("Failed to update flow")
189 } else {
190 t.Logf("Updated flows : %+v", updated)
191 }
192
Stephane Barbariedc5022d2018-11-19 15:21:44 -0500193 if d := flowProxy.Get("/", 0, false, ""); d == nil {
Stephane Barbarie126101e2018-10-11 16:18:48 -0400194 t.Error("Failed to find updated flows (flows proxy)")
195 } else {
196 djson, _ := json.Marshal(d)
197 t.Logf("Found flows (flows proxy): %s", string(djson))
198 }
199
Stephane Barbariedc5022d2018-11-19 15:21:44 -0500200 if d := devProxy.Get("/devices/"+devID+"/flows", 1, false, ""); !reflect.ValueOf(d).IsValid() {
Stephane Barbarie126101e2018-10-11 16:18:48 -0400201 t.Error("Failed to find updated flows (root proxy)")
202 } else {
203 djson, _ := json.Marshal(d)
204 t.Logf("Found flows (root proxy): %s", string(djson))
205 }
206
207 if !preUpdateExecuted {
208 t.Error("PRE_UPDATE callback was not executed")
209 }
210 if !postUpdateExecuted {
211 t.Error("POST_UPDATE callback was not executed")
212 }
Stephane Barbarie06c4a742018-10-01 11:09:32 -0400213}
214
Stephane Barbariedc5022d2018-11-19 15:21:44 -0500215func Test_Proxy_1_4_1_Remove_Device(t *testing.T) {
Stephane Barbariea188d942018-10-16 16:43:04 -0400216 preRemoveExecuted := false
217 postRemoveExecuted := false
Stephane Barbarie06c4a742018-10-01 11:09:32 -0400218
Stephane Barbariea188d942018-10-16 16:43:04 -0400219 modelTestConfig.RootProxy.RegisterCallback(
Stephane Barbarie126101e2018-10-11 16:18:48 -0400220 PRE_REMOVE,
221 commonCallback,
222 "PRE_REMOVE instructions (root proxy)", &preRemoveExecuted,
223 )
Stephane Barbariea188d942018-10-16 16:43:04 -0400224 modelTestConfig.RootProxy.RegisterCallback(
Stephane Barbarie126101e2018-10-11 16:18:48 -0400225 POST_REMOVE,
226 commonCallback,
227 "POST_REMOVE instructions (root proxy)", &postRemoveExecuted,
228 )
Stephane Barbarieec0919b2018-09-05 14:14:29 -0400229
Stephane Barbariedc5022d2018-11-19 15:21:44 -0500230 if removed := modelTestConfig.RootProxy.Remove("/devices/"+devID, ""); removed == nil {
Stephane Barbarieec0919b2018-09-05 14:14:29 -0400231 t.Error("Failed to remove device")
232 } else {
233 t.Logf("Removed device : %+v", removed)
234 }
Stephane Barbariedc5022d2018-11-19 15:21:44 -0500235 if d := modelTestConfig.RootProxy.Get("/devices/"+devID, 0, false, ""); reflect.ValueOf(d).IsValid() {
Stephane Barbarieec0919b2018-09-05 14:14:29 -0400236 djson, _ := json.Marshal(d)
237 t.Errorf("Device was not removed - %s", djson)
238 } else {
Stephane Barbariedc5022d2018-11-19 15:21:44 -0500239 t.Logf("Device was removed: %s", devID)
240 }
241
242 if !preRemoveExecuted {
243 t.Error("PRE_UPDATE callback was not executed")
244 }
245 if !postRemoveExecuted {
246 t.Error("POST_UPDATE callback was not executed")
247 }
248}
249
250func Test_Proxy_2_1_1_Add_NewLogicalDevice(t *testing.T) {
251
252 ldIDBin, _ := uuid.New().MarshalBinary()
253 ldevID = "0001" + hex.EncodeToString(ldIDBin)[:12]
254 logicalDevice.Id = ldevID
255
256 preAddExecuted := false
257 postAddExecuted := false
258
259 // Register
260 ldevProxy.RegisterCallback(PRE_ADD, commonCallback, "PRE_ADD instructions", &preAddExecuted)
261 ldevProxy.RegisterCallback(POST_ADD, commonCallback, "POST_ADD instructions", &postAddExecuted)
262
263 if added := ldevProxy.Add("/logical_devices", logicalDevice, ""); added == nil {
264 t.Error("Failed to add logical device")
265 } else {
266 t.Logf("Added logical device : %+v", added)
267 }
268
269 if ld := ldevProxy.Get("/logical_devices/"+ldevID, 0, false, ""); !reflect.ValueOf(ld).IsValid() {
270 t.Error("Failed to find added logical device")
271 } else {
272 ldJSON, _ := json.Marshal(ld)
273 t.Logf("Found logical device: %s", string(ldJSON))
274 }
275
276 if !preAddExecuted {
277 t.Error("PRE_ADD callback was not executed")
278 }
279 if !postAddExecuted {
280 t.Error("POST_ADD callback was not executed")
281 }
282}
283
284func Test_Proxy_2_1_2_Add_ExistingLogicalDevice(t *testing.T) {
285 logicalDevice.Id = ldevID
286 if added := ldevProxy.Add("/logical_devices", logicalDevice, ""); added == nil {
287 t.Logf("Successfully detected that the logical device already exists: %s", ldevID)
288 } else {
289 t.Errorf("A new logical device should not have been created : %+v", added)
290 }
291
292}
293
294func Test_Proxy_2_2_1_Get_AllLogicalDevices(t *testing.T) {
295 logicalDevices := ldevProxy.Get("/logical_devices", 1, false, "")
296
297 if len(logicalDevices.([]interface{})) == 0 {
298 t.Error("there are no available logical devices to retrieve")
299 } else {
300 // Save the target device id for later tests
301 targetLogDevID = logicalDevices.([]interface{})[0].(*voltha.LogicalDevice).Id
302 t.Logf("retrieved all logical devices: %+v", logicalDevices)
303 }
304}
305
306func Test_Proxy_2_2_2_Get_SingleLogicalDevice(t *testing.T) {
307 if ld := ldevProxy.Get("/logical_devices/"+targetLogDevID, 0, false, ""); !reflect.ValueOf(ld).IsValid() {
308 t.Errorf("Failed to find logical device : %s", targetLogDevID)
309 } else {
310 ldJSON, _ := json.Marshal(ld)
311 t.Logf("Found logical device: %s", string(ldJSON))
312 }
313
314}
315
316func Test_Proxy_2_3_1_Update_LogicalDevice(t *testing.T) {
317 var fwVersion int
318 preUpdateExecuted := false
319 postUpdateExecuted := false
320
321 if retrieved := ldevProxy.Get("/logical_devices/"+targetLogDevID, 1, false, ""); retrieved == nil {
322 t.Error("Failed to get logical device")
323 } else {
324 t.Logf("Found raw logical device (root proxy): %+v", retrieved)
325
326 if retrieved.(*voltha.LogicalDevice).RootDeviceId == "" {
327 fwVersion = 0
328 } else {
329 fwVersion, _ = strconv.Atoi(retrieved.(*voltha.LogicalDevice).RootDeviceId)
330 fwVersion++
331 }
332
333 ldevProxy.RegisterCallback(
334 PRE_UPDATE,
335 commonCallback,
336 "PRE_UPDATE instructions (root proxy)", &preUpdateExecuted,
337 )
338 ldevProxy.RegisterCallback(
339 POST_UPDATE,
340 commonCallback,
341 "POST_UPDATE instructions (root proxy)", &postUpdateExecuted,
342 )
343
344 retrieved.(*voltha.LogicalDevice).RootDeviceId = strconv.Itoa(fwVersion)
345
346 if afterUpdate := ldevProxy.Update("/logical_devices/"+targetLogDevID, retrieved, false,
347 ""); afterUpdate == nil {
348 t.Error("Failed to update logical device")
349 } else {
350 t.Logf("Updated logical device : %+v", afterUpdate)
351 }
352 if d := ldevProxy.Get("/logical_devices/"+targetLogDevID, 1, false, ""); !reflect.ValueOf(d).IsValid() {
353 t.Error("Failed to find updated logical device (root proxy)")
354 } else {
355 djson, _ := json.Marshal(d)
356
357 t.Logf("Found logical device (root proxy): %s raw: %+v", string(djson), d)
358 }
359
360 if !preUpdateExecuted {
361 t.Error("PRE_UPDATE callback was not executed")
362 }
363 if !postUpdateExecuted {
364 t.Error("POST_UPDATE callback was not executed")
365 }
366 }
367}
368
369func Test_Proxy_2_3_2_Update_LogicalDeviceFlows(t *testing.T) {
370 // Get a device proxy and update a specific port
371 ldFlowsProxy := modelTestConfig.Root.node.CreateProxy("/logical_devices/"+ldevID+"/flows", false)
372 flows := ldFlowsProxy.Get("/", 0, false, "")
373 flows.(*openflow_13.Flows).Items[0].TableId = rand.Uint32()
374 t.Logf("before updated flows: %+v", flows)
375
376 ldFlowsProxy.RegisterCallback(
377 PRE_UPDATE,
378 commonCallback2,
379 )
380 ldFlowsProxy.RegisterCallback(
381 POST_UPDATE,
382 commonCallback2,
383 )
384
385 kvFlows := ldFlowsProxy.Get("/", 0, false, "")
386
387 if reflect.DeepEqual(flows, kvFlows) {
388 t.Errorf("Local changes have changed the KV store contents - local:%+v, kv: %+v", flows, kvFlows)
389 }
390
391 if updated := ldFlowsProxy.Update("/", flows.(*openflow_13.Flows), false, ""); updated == nil {
392 t.Error("Failed to update logical device flows")
393 } else {
394 t.Logf("Updated logical device flows : %+v", updated)
395 }
396
397 if d := ldFlowsProxy.Get("/", 0, false, ""); d == nil {
398 t.Error("Failed to find updated logical device flows (flows proxy)")
399 } else {
400 djson, _ := json.Marshal(d)
401 t.Logf("Found flows (flows proxy): %s", string(djson))
402 }
403
404 if d := modelTestConfig.RootProxy.Get("/logical_devices/"+ldevID+"/flows", 0, false,
405 ""); !reflect.ValueOf(d).IsValid() {
406 t.Error("Failed to find updated logical device flows (root proxy)")
407 } else {
408 djson, _ := json.Marshal(d)
409 t.Logf("Found logical device flows (root proxy): %s", string(djson))
410 }
411}
412
413func Test_Proxy_2_4_1_Remove_Device(t *testing.T) {
414 preRemoveExecuted := false
415 postRemoveExecuted := false
416
417 ldevProxy.RegisterCallback(
418 PRE_REMOVE,
419 commonCallback,
420 "PRE_REMOVE instructions (root proxy)", &preRemoveExecuted,
421 )
422 ldevProxy.RegisterCallback(
423 POST_REMOVE,
424 commonCallback,
425 "POST_REMOVE instructions (root proxy)", &postRemoveExecuted,
426 )
427
428 if removed := ldevProxy.Remove("/logical_devices/"+ldevID, ""); removed == nil {
429 t.Error("Failed to remove logical device")
430 } else {
431 t.Logf("Removed device : %+v", removed)
432 }
433 if d := ldevProxy.Get("/logical_devices/"+ldevID, 0, false, ""); reflect.ValueOf(d).IsValid() {
434 djson, _ := json.Marshal(d)
435 t.Errorf("Device was not removed - %s", djson)
436 } else {
437 t.Logf("Device was removed: %s", ldevID)
Stephane Barbarieec0919b2018-09-05 14:14:29 -0400438 }
Stephane Barbarie126101e2018-10-11 16:18:48 -0400439
440 if !preRemoveExecuted {
441 t.Error("PRE_UPDATE callback was not executed")
442 }
443 if !postRemoveExecuted {
444 t.Error("POST_UPDATE callback was not executed")
445 }
Stephane Barbarieec0919b2018-09-05 14:14:29 -0400446}
Stephane Barbarie694e2b92018-09-07 12:17:36 -0400447
448// -----------------------------
449// Callback tests
450// -----------------------------
451
Stephane Barbarie694e2b92018-09-07 12:17:36 -0400452func Test_Proxy_Callbacks_1_Register(t *testing.T) {
Stephane Barbariea188d942018-10-16 16:43:04 -0400453 modelTestConfig.RootProxy.RegisterCallback(PRE_ADD, firstCallback, "abcde", "12345")
Stephane Barbarie694e2b92018-09-07 12:17:36 -0400454
455 m := make(map[string]string)
456 m["name"] = "fghij"
Stephane Barbariea188d942018-10-16 16:43:04 -0400457 modelTestConfig.RootProxy.RegisterCallback(PRE_ADD, secondCallback, m, 1.2345)
Stephane Barbarie694e2b92018-09-07 12:17:36 -0400458
459 d := &voltha.Device{Id: "12345"}
Stephane Barbariea188d942018-10-16 16:43:04 -0400460 modelTestConfig.RootProxy.RegisterCallback(PRE_ADD, thirdCallback, "klmno", d)
Stephane Barbarie694e2b92018-09-07 12:17:36 -0400461}
462
463func Test_Proxy_Callbacks_2_Invoke_WithNoInterruption(t *testing.T) {
Stephane Barbariea188d942018-10-16 16:43:04 -0400464 modelTestConfig.RootProxy.InvokeCallbacks(PRE_ADD, false, nil)
Stephane Barbarie694e2b92018-09-07 12:17:36 -0400465}
Stephane Barbarie126101e2018-10-11 16:18:48 -0400466
Stephane Barbarie694e2b92018-09-07 12:17:36 -0400467func Test_Proxy_Callbacks_3_Invoke_WithInterruption(t *testing.T) {
Stephane Barbariea188d942018-10-16 16:43:04 -0400468 modelTestConfig.RootProxy.InvokeCallbacks(PRE_ADD, true, nil)
Stephane Barbarie694e2b92018-09-07 12:17:36 -0400469}
470
471func Test_Proxy_Callbacks_4_Unregister(t *testing.T) {
Stephane Barbariea188d942018-10-16 16:43:04 -0400472 modelTestConfig.RootProxy.UnregisterCallback(PRE_ADD, firstCallback)
473 modelTestConfig.RootProxy.UnregisterCallback(PRE_ADD, secondCallback)
474 modelTestConfig.RootProxy.UnregisterCallback(PRE_ADD, thirdCallback)
Stephane Barbarie694e2b92018-09-07 12:17:36 -0400475}
Stephane Barbarie126101e2018-10-11 16:18:48 -0400476
477//func Test_Proxy_Callbacks_5_Add(t *testing.T) {
Stephane Barbariea188d942018-10-16 16:43:04 -0400478// modelTestConfig.RootProxy.Root.AddCallback(modelTestConfig.RootProxy.InvokeCallbacks, POST_UPDATE, false, "some data", "some new data")
Stephane Barbarie126101e2018-10-11 16:18:48 -0400479//}
480//
481//func Test_Proxy_Callbacks_6_Execute(t *testing.T) {
Stephane Barbariea188d942018-10-16 16:43:04 -0400482// modelTestConfig.RootProxy.Root.ExecuteCallbacks()
Stephane Barbarie126101e2018-10-11 16:18:48 -0400483//}