blob: a2ac77bfab07600ed0012708c37de0530aaf432a [file] [log] [blame]
cbabua9e04cc2019-10-03 12:35:45 +05301/*
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 */
16
cbabubef89432019-10-18 11:47:27 +020017/*
18This file contains unit test cases for functions in the file openolt.go.
19This file also implements the fields struct to mock the Openolt and few utility functions.
20*/
21
Scott Bakerdbd960e2020-02-28 08:57:51 -080022//Package core provides the utility for olt devices, flows and statistics
23package core
cbabua9e04cc2019-10-03 12:35:45 +053024
25import (
26 "context"
27 "errors"
Kent Hagermanf1db18b2020-07-08 13:38:15 -040028 "reflect"
29 "sync"
30 "testing"
31
Esin Karamanccb714b2019-11-29 15:02:06 +000032 com "github.com/opencord/voltha-lib-go/v3/pkg/adapters/common"
33 fu "github.com/opencord/voltha-lib-go/v3/pkg/flows"
34 "github.com/opencord/voltha-lib-go/v3/pkg/kafka"
David K. Bainbridge794735f2020-02-11 21:01:37 -080035 "github.com/opencord/voltha-lib-go/v3/pkg/log"
Scott Bakerdbd960e2020-02-28 08:57:51 -080036 "github.com/opencord/voltha-openolt-adapter/internal/pkg/config"
Thomas Lee S94109f12020-03-03 16:39:29 +053037 "github.com/opencord/voltha-openolt-adapter/internal/pkg/olterrors"
Esin Karamanccb714b2019-11-29 15:02:06 +000038 ic "github.com/opencord/voltha-protos/v3/go/inter_container"
39 "github.com/opencord/voltha-protos/v3/go/openflow_13"
40 ofp "github.com/opencord/voltha-protos/v3/go/openflow_13"
41 "github.com/opencord/voltha-protos/v3/go/voltha"
cbabua9e04cc2019-10-03 12:35:45 +053042)
43
cbabubef89432019-10-18 11:47:27 +020044// mocks the OpenOLT struct.
cbabua9e04cc2019-10-03 12:35:45 +053045type fields struct {
46 deviceHandlers map[string]*DeviceHandler
47 coreProxy *com.CoreProxy
48 adapterProxy *com.AdapterProxy
49 eventProxy *com.EventProxy
npujarec5762e2020-01-01 14:08:48 +053050 kafkaICProxy kafka.InterContainerProxy
cbabua9e04cc2019-10-03 12:35:45 +053051 numOnus int
Neha Sharma3f221ae2020-04-29 19:02:12 +000052 KVStoreAddress string
cbabua9e04cc2019-10-03 12:35:45 +053053 KVStoreType string
54 exitChannel chan int
55 lockDeviceHandlersMap sync.RWMutex
56 ctx context.Context
57}
58
cbabubef89432019-10-18 11:47:27 +020059// mockOlt mocks OpenOLT struct.
cbabua9e04cc2019-10-03 12:35:45 +053060func mockOlt() *fields {
cbabua9e04cc2019-10-03 12:35:45 +053061 dh := newMockDeviceHandler()
62 newOlt := &fields{}
63 newOlt.deviceHandlers = map[string]*DeviceHandler{}
64 newOlt.deviceHandlers[dh.device.Id] = dh
65 return newOlt
66}
67
cbabubef89432019-10-18 11:47:27 +020068// testOltObject maps fields type to OpenOLt type.
cbabua9e04cc2019-10-03 12:35:45 +053069func testOltObject(testOlt *fields) *OpenOLT {
70 return &OpenOLT{
71 deviceHandlers: testOlt.deviceHandlers,
72 coreProxy: testOlt.coreProxy,
73 adapterProxy: testOlt.adapterProxy,
74 eventProxy: testOlt.eventProxy,
75 kafkaICProxy: testOlt.kafkaICProxy,
76 numOnus: testOlt.numOnus,
Neha Sharma3f221ae2020-04-29 19:02:12 +000077 KVStoreAddress: testOlt.KVStoreAddress,
cbabua9e04cc2019-10-03 12:35:45 +053078 KVStoreType: testOlt.KVStoreType,
79 exitChannel: testOlt.exitChannel,
80 }
81}
82
cbabubef89432019-10-18 11:47:27 +020083// mockDevice mocks Device.
cbabua9e04cc2019-10-03 12:35:45 +053084func mockDevice() *voltha.Device {
Kent Hagermanf1db18b2020-07-08 13:38:15 -040085 return &voltha.Device{
cbabua9e04cc2019-10-03 12:35:45 +053086 Id: "olt",
87 Root: true,
88 ParentId: "logical_device",
cbabua9e04cc2019-10-03 12:35:45 +053089 ProxyAddress: &voltha.Device_ProxyAddress{
90 DeviceId: "olt",
91 DeviceType: "onu",
92 ChannelId: 1,
93 ChannelGroupId: 1,
94 },
95 ConnectStatus: 1,
96 }
cbabua9e04cc2019-10-03 12:35:45 +053097}
98
99func TestNewOpenOLT(t *testing.T) {
100 tests := []struct {
Abhilash Laxmeshwarf9942e92020-01-07 15:32:44 +0530101 name string
102 fields *fields
103 configFlags *config.AdapterFlags
104 want *OpenOLT
cbabua9e04cc2019-10-03 12:35:45 +0530105 }{
Neha Sharma3f221ae2020-04-29 19:02:12 +0000106 {"newopenolt-1", &fields{}, &config.AdapterFlags{OnuNumber: 1, KVStoreAddress: "1.1.1.1:1", KVStoreType: "consul"},
107 &OpenOLT{numOnus: 1, KVStoreAddress: "1.1.1.1:1", KVStoreType: "consul"}},
108 {"newopenolt-2", &fields{}, &config.AdapterFlags{OnuNumber: 2, KVStoreAddress: "2.2.2.2:2", KVStoreType: "etcd"},
109 &OpenOLT{numOnus: 2, KVStoreAddress: "2.2.2.2:2", KVStoreType: "etcd"}},
110 {"newopenolt-3", &fields{}, &config.AdapterFlags{OnuNumber: 3, KVStoreAddress: "3.3.3.3:3", KVStoreType: "consul"},
111 &OpenOLT{numOnus: 3, KVStoreAddress: "3.3.3.3:3", KVStoreType: "consul"}},
cbabua9e04cc2019-10-03 12:35:45 +0530112 }
113 for _, tt := range tests {
114 t.Run(tt.name, func(t *testing.T) {
115 if got := NewOpenOLT(tt.fields.ctx, tt.fields.kafkaICProxy, tt.fields.coreProxy, tt.fields.adapterProxy,
Abhilash Laxmeshwarf9942e92020-01-07 15:32:44 +0530116 tt.fields.eventProxy, tt.configFlags); reflect.TypeOf(got) != reflect.TypeOf(tt.want) && got != nil {
cbabua9e04cc2019-10-03 12:35:45 +0530117 t.Errorf("NewOpenOLT() error = %v, wantErr %v", got, tt.want)
118 }
119 })
120 }
121}
122
123func TestOpenOLT_Abandon_device(t *testing.T) {
124 type args struct {
125 device *voltha.Device
126 }
127 tests := []struct {
128 name string
129 fields *fields
130 args args
131 wantErr error
132 }{
Thomas Lee S94109f12020-03-03 16:39:29 +0530133 {"abandon_device-1", &fields{}, args{}, olterrors.ErrNotImplemented},
134 {"abandon_device-2", &fields{}, args{}, olterrors.ErrNotImplemented},
135 {"abandon_device-3", &fields{}, args{}, olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530136 }
137 for _, tt := range tests {
138 t.Run(tt.name, func(t *testing.T) {
139 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000140 if err := oo.Abandon_device(context.Background(), tt.args.device); err != tt.wantErr {
cbabua9e04cc2019-10-03 12:35:45 +0530141 t.Errorf("Abandon_device() error = %v, wantErr %v", err, tt.wantErr)
142 }
143 })
144 }
145}
146
147func TestOpenOLT_Activate_image_update(t *testing.T) {
148 type args struct {
149 device *voltha.Device
150 request *voltha.ImageDownload
151 }
152 tests := []struct {
153 name string
154 fields *fields
155 args args
156 want *voltha.ImageDownload
157 wantErr error
158 }{
159 {"activate_image_upate-1", &fields{}, args{}, &voltha.ImageDownload{Id: "Image1-ABC123XYZ"},
Thomas Lee S94109f12020-03-03 16:39:29 +0530160 olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530161 {"activate_image_upate-2", &fields{}, args{}, &voltha.ImageDownload{Id: "Image2-ABC123CDE"},
Thomas Lee S94109f12020-03-03 16:39:29 +0530162 olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530163 {"activate_image_upate-3", &fields{}, args{}, &voltha.ImageDownload{Id: "Image3-ABC123EFG"},
Thomas Lee S94109f12020-03-03 16:39:29 +0530164 olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530165 }
166 for _, tt := range tests {
167 t.Run(tt.name, func(t *testing.T) {
168 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000169 got, err := oo.Activate_image_update(context.Background(), tt.args.device, tt.args.request)
David K. Bainbridge794735f2020-02-11 21:01:37 -0800170 if err != tt.wantErr && got == nil {
cbabua9e04cc2019-10-03 12:35:45 +0530171 t.Errorf("Activate_image_update() error = %v, wantErr %v", err, tt.wantErr)
172 }
173 })
174 }
175}
176
177func TestOpenOLT_Adapter_descriptor(t *testing.T) {
178 tests := []struct {
179 name string
180 fields *fields
181 wantErr error
182 }{
Thomas Lee S94109f12020-03-03 16:39:29 +0530183 {"adapter_descriptor-1", &fields{}, olterrors.ErrNotImplemented},
184 {"adapter_descriptor-2", &fields{}, olterrors.ErrNotImplemented},
185 {"adapter_descriptor-3", &fields{}, olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530186 }
187 for _, tt := range tests {
188 t.Run(tt.name, func(t *testing.T) {
189 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000190 if err := oo.Adapter_descriptor(context.Background()); err != tt.wantErr {
cbabua9e04cc2019-10-03 12:35:45 +0530191 t.Errorf("Adapter_descriptor() error = %v, wantErr %v", err, tt.wantErr)
192 }
193 })
194 }
195}
196
197func TestOpenOLT_Adopt_device(t *testing.T) {
198 type args struct {
199 device *voltha.Device
200 }
201 var device = mockDevice()
kesavand39e0aa32020-01-28 20:58:50 -0500202 device.Id = "olt"
Thomas Lee S94109f12020-03-03 16:39:29 +0530203 nilDevice := olterrors.NewErrInvalidValue(log.Fields{"device": nil}, nil)
cbabua9e04cc2019-10-03 12:35:45 +0530204 tests := []struct {
205 name string
206 fields *fields
207 args args
208 wantErr error
209 }{
David K. Bainbridge794735f2020-02-11 21:01:37 -0800210 {"adopt_device-1", mockOlt(), args{}, nilDevice},
211 {"adopt_device-2", mockOlt(), args{device}, nilDevice},
212 {"adopt_device-3", mockOlt(), args{mockDevice()}, nil},
cbabua9e04cc2019-10-03 12:35:45 +0530213 }
214 for _, tt := range tests {
215 t.Run(tt.name, func(t *testing.T) {
216 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000217 err := oo.Adopt_device(context.Background(), tt.args.device)
cbabua9e04cc2019-10-03 12:35:45 +0530218 if (err != nil) && (reflect.TypeOf(err) !=
219 reflect.TypeOf(tt.wantErr)) && (tt.args.device == nil) {
220 t.Errorf("Adopt_device() error = %v, wantErr %v", err, tt.wantErr)
221 }
222 if err == nil {
223 t.Log("return'd nil")
224 }
225 })
226 }
227}
228
229func TestOpenOLT_Cancel_image_download(t *testing.T) {
230 type args struct {
231 device *voltha.Device
232 request *voltha.ImageDownload
233 }
234 tests := []struct {
235 name string
236 fields *fields
237 args args
238 want *voltha.ImageDownload
239 wantErr error
240 }{
241 {"cancel_image_download-1", &fields{}, args{}, &voltha.ImageDownload{Id: "Image1-ABC123XYZ"},
Thomas Lee S94109f12020-03-03 16:39:29 +0530242 olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530243 {"cancel_image_download-2", &fields{}, args{}, &voltha.ImageDownload{Id: "Image2-ABC123IJK"},
Thomas Lee S94109f12020-03-03 16:39:29 +0530244 olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530245 {"cancel_image_download-3", &fields{}, args{}, &voltha.ImageDownload{Id: "Image3-ABC123KLM"},
Thomas Lee S94109f12020-03-03 16:39:29 +0530246 olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530247 }
248 for _, tt := range tests {
249 t.Run(tt.name, func(t *testing.T) {
250 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000251 got, err := oo.Cancel_image_download(context.Background(), tt.args.device, tt.args.request)
David K. Bainbridge794735f2020-02-11 21:01:37 -0800252 if err != tt.wantErr && got == nil {
cbabua9e04cc2019-10-03 12:35:45 +0530253 t.Errorf("Cancel_image_download() error = %v, wantErr %v", err, tt.wantErr)
254 }
255 })
256 }
257}
258
259func TestOpenOLT_Delete_device(t *testing.T) {
260 type args struct {
261 device *voltha.Device
262 }
263 tests := []struct {
264 name string
265 fields *fields
266 args args
267 wantErr error
268 }{
David K. Bainbridge794735f2020-02-11 21:01:37 -0800269 {"delete_device-1", &fields{}, args{mockDevice()},
Thomas Lee S94109f12020-03-03 16:39:29 +0530270 olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": "olt"}, nil)},
cbabua9e04cc2019-10-03 12:35:45 +0530271 }
272 for _, tt := range tests {
273 t.Run(tt.name, func(t *testing.T) {
274 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000275 if err := oo.Delete_device(context.Background(), tt.args.device); !reflect.DeepEqual(err, tt.wantErr) {
cbabua9e04cc2019-10-03 12:35:45 +0530276 t.Errorf("Delete_device() error = %v, wantErr %v", err, tt.wantErr)
277 }
278 })
279 }
280}
281
282func TestOpenOLT_Device_types(t *testing.T) {
283 tests := []struct {
284 name string
285 fields *fields
286 want *voltha.DeviceTypes
287 wantErr error
288 }{
289 {"device_types-1", &fields{}, &voltha.DeviceTypes{},
Thomas Lee S94109f12020-03-03 16:39:29 +0530290 olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530291 {"device_types-2", &fields{}, &voltha.DeviceTypes{},
Thomas Lee S94109f12020-03-03 16:39:29 +0530292 olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530293 {"device_types-3", &fields{}, &voltha.DeviceTypes{},
Thomas Lee S94109f12020-03-03 16:39:29 +0530294 olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530295 }
296 for _, tt := range tests {
297 t.Run(tt.name, func(t *testing.T) {
298 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000299 got, err := oo.Device_types(context.Background())
David K. Bainbridge794735f2020-02-11 21:01:37 -0800300 if err != tt.wantErr && got == nil {
cbabua9e04cc2019-10-03 12:35:45 +0530301 t.Errorf("Device_types() error = %v, wantErr %v", err, tt.wantErr)
302 }
303 })
304 }
305}
306
307func TestOpenOLT_Disable_device(t *testing.T) {
308 type args struct {
309 device *voltha.Device
310 }
311 tests := []struct {
312 name string
313 fields *fields
314 args args
315 wantErr error
316 }{
David K. Bainbridge794735f2020-02-11 21:01:37 -0800317 {"disable_device-1", mockOlt(), args{mockDevice()}, nil},
318 {"disable_device-2", &fields{}, args{mockDevice()},
Thomas Lee S94109f12020-03-03 16:39:29 +0530319 olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": "olt"}, nil)},
cbabua9e04cc2019-10-03 12:35:45 +0530320 }
321 for _, tt := range tests {
322 t.Run(tt.name, func(t *testing.T) {
323 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000324 if err := oo.Disable_device(context.Background(), tt.args.device); !reflect.DeepEqual(err, tt.wantErr) {
cbabua9e04cc2019-10-03 12:35:45 +0530325 t.Errorf("Disable_device() error = %v, wantErr %v", err, tt.wantErr)
326 }
327 })
328 }
329}
330
331func TestOpenOLT_Download_image(t *testing.T) {
332 type args struct {
333 device *voltha.Device
334 request *voltha.ImageDownload
335 }
336 tests := []struct {
337 name string
338 fields *fields
339 args args
340 want *voltha.ImageDownload
341 wantErr error
342 }{
343 {"download_image-1", &fields{}, args{}, &voltha.ImageDownload{Id: "Image1-ABC123XYZ"},
Thomas Lee S94109f12020-03-03 16:39:29 +0530344 olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530345 {"download_image-2", &fields{}, args{}, &voltha.ImageDownload{Id: "Image2-ABC123LKJ"},
Thomas Lee S94109f12020-03-03 16:39:29 +0530346 olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530347 {"download_image-3", &fields{}, args{}, &voltha.ImageDownload{Id: "Image1-ABC123RTY"},
Thomas Lee S94109f12020-03-03 16:39:29 +0530348 olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530349 }
350 for _, tt := range tests {
351 t.Run(tt.name, func(t *testing.T) {
352 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000353 got, err := oo.Download_image(context.Background(), tt.args.device, tt.args.request)
David K. Bainbridge794735f2020-02-11 21:01:37 -0800354 if err != tt.wantErr && got == nil {
cbabua9e04cc2019-10-03 12:35:45 +0530355 t.Errorf("Download_image() error = %v, wantErr %v", err, tt.wantErr)
356 }
357 })
358 }
359}
360
361func TestOpenOLT_Get_device_details(t *testing.T) {
362 type args struct {
363 device *voltha.Device
364 }
365 tests := []struct {
366 name string
367 fields *fields
368 args args
369 wantErr error
370 }{
Thomas Lee S94109f12020-03-03 16:39:29 +0530371 {"get_device_details-1", &fields{}, args{}, olterrors.ErrNotImplemented},
372 {"get_device_details-2", &fields{}, args{}, olterrors.ErrNotImplemented},
373 {"get_device_details-3", &fields{}, args{}, olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530374 }
375 for _, tt := range tests {
376 t.Run(tt.name, func(t *testing.T) {
377 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000378 if err := oo.Get_device_details(context.Background(), tt.args.device); err != tt.wantErr {
cbabua9e04cc2019-10-03 12:35:45 +0530379 t.Errorf("Get_device_details() error = %v, wantErr %v", err, tt.wantErr)
380 }
381 })
382 }
383}
384
385func TestOpenOLT_Get_image_download_status(t *testing.T) {
386 type args struct {
387 device *voltha.Device
388 request *voltha.ImageDownload
389 }
390 tests := []struct {
391 name string
392 fields *fields
393 args args
394 want *voltha.ImageDownload
395 wantErr error
396 }{
397 {"get_image_download_status-1", &fields{}, args{}, &voltha.ImageDownload{Id: "Image1-ABC123XYZ"},
Thomas Lee S94109f12020-03-03 16:39:29 +0530398 olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530399 {"get_image_download_status-2", &fields{}, args{}, &voltha.ImageDownload{Id: "Image2-ABC123LKJ"},
Thomas Lee S94109f12020-03-03 16:39:29 +0530400 olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530401 {"get_image_download_status-3", &fields{}, args{}, &voltha.ImageDownload{Id: "Image1-ABC123DFG"},
Thomas Lee S94109f12020-03-03 16:39:29 +0530402 olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530403 }
404 for _, tt := range tests {
405 t.Run(tt.name, func(t *testing.T) {
406 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000407 got, err := oo.Get_image_download_status(context.Background(), tt.args.device, tt.args.request)
David K. Bainbridge794735f2020-02-11 21:01:37 -0800408 if err != tt.wantErr && got == nil {
409 t.Errorf("Get_image_download_status() got = %v want = %v error = %v, wantErr %v",
410 got, tt.want, err, tt.wantErr)
cbabua9e04cc2019-10-03 12:35:45 +0530411 }
412 })
413 }
414}
415
416func TestOpenOLT_Get_ofp_device_info(t *testing.T) {
417 type args struct {
418 device *voltha.Device
419 }
420 tests := []struct {
421 name string
422 fields *fields
423 args args
424 want *ic.SwitchCapability
425 wantErr error
426 }{
David K. Bainbridge794735f2020-02-11 21:01:37 -0800427 {"get_ofp_device_info-1", mockOlt(), args{mockDevice()}, &ic.SwitchCapability{
428 Desc: &openflow_13.OfpDesc{
429 MfrDesc: "VOLTHA Project",
430 HwDesc: "open_pon",
431 SwDesc: "open_pon",
432 },
433 SwitchFeatures: &openflow_13.OfpSwitchFeatures{
434 NBuffers: uint32(256),
435 NTables: uint32(2),
436 Capabilities: uint32(15),
437 },
438 }, nil},
439 {"get_ofp_device_info-2", &fields{}, args{mockDevice()}, nil,
Thomas Lee S94109f12020-03-03 16:39:29 +0530440 olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": "olt"}, nil)},
cbabua9e04cc2019-10-03 12:35:45 +0530441 }
442 for _, tt := range tests {
443 t.Run(tt.name, func(t *testing.T) {
444 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000445 got, err := oo.Get_ofp_device_info(context.Background(), tt.args.device)
David K. Bainbridge794735f2020-02-11 21:01:37 -0800446 if !reflect.DeepEqual(err, tt.wantErr) || !reflect.DeepEqual(got, tt.want) {
447 t.Errorf("Get_ofp_device_info() got = %v want = %v error = %v, wantErr = %v",
448 got, tt.want, err, tt.wantErr)
cbabua9e04cc2019-10-03 12:35:45 +0530449 }
450 })
451 }
452}
453
cbabua9e04cc2019-10-03 12:35:45 +0530454func TestOpenOLT_Health(t *testing.T) {
455 tests := []struct {
456 name string
457 fields *fields
458 want *voltha.HealthStatus
459 wantErr error
460 }{
Thomas Lee S94109f12020-03-03 16:39:29 +0530461 {"health-1", &fields{}, &voltha.HealthStatus{}, olterrors.ErrNotImplemented},
462 {"health-2", &fields{}, &voltha.HealthStatus{}, olterrors.ErrNotImplemented},
463 {"health-3", &fields{}, &voltha.HealthStatus{}, olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530464 }
465 for _, tt := range tests {
466 t.Run(tt.name, func(t *testing.T) {
467 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000468 got, err := oo.Health(context.Background())
David K. Bainbridge794735f2020-02-11 21:01:37 -0800469 if err != tt.wantErr && got == nil {
cbabua9e04cc2019-10-03 12:35:45 +0530470 t.Errorf("Get_ofp_port_info() error = %v, wantErr %v", err, tt.wantErr)
471 }
472 })
473 }
474}
475
476func TestOpenOLT_Process_inter_adapter_message(t *testing.T) {
477 type args struct {
478 msg *ic.InterAdapterMessage
479 }
480 var message1 = args{
481 msg: &ic.InterAdapterMessage{
482 Header: &ic.InterAdapterHeader{
483 Id: "olt",
484 ProxyDeviceId: "",
485 ToDeviceId: "onu1",
486 },
487 },
488 }
489 var message2 = args{
490 msg: &ic.InterAdapterMessage{
491 Header: &ic.InterAdapterHeader{
492 Id: "olt",
493 ProxyDeviceId: "olt",
494 ToDeviceId: "olt",
David K. Bainbridge794735f2020-02-11 21:01:37 -0800495 Type: ic.InterAdapterMessageType_OMCI_REQUEST,
496 },
497 },
498 }
499 var message3 = args{
500 msg: &ic.InterAdapterMessage{
501 Header: &ic.InterAdapterHeader{
502 Id: "olt",
503 ProxyDeviceId: "olt",
504 ToDeviceId: "olt",
505 Type: ic.InterAdapterMessageType_FLOW_REQUEST,
cbabua9e04cc2019-10-03 12:35:45 +0530506 },
507 },
508 }
509 tests := []struct {
David K. Bainbridge794735f2020-02-11 21:01:37 -0800510 name string
511 fields *fields
512 args args
513 wantErrType reflect.Type
cbabua9e04cc2019-10-03 12:35:45 +0530514 }{
David K. Bainbridge794735f2020-02-11 21:01:37 -0800515 {"process_inter_adaptor_messgae-1", mockOlt(), message1,
Thomas Lee S94109f12020-03-03 16:39:29 +0530516 reflect.TypeOf(&olterrors.ErrNotFound{})},
David K. Bainbridge794735f2020-02-11 21:01:37 -0800517 {"process_inter_adaptor_messgae-2", mockOlt(), message2,
Girish Kumarf26e4882020-03-05 06:49:10 +0000518 reflect.TypeOf(&olterrors.ErrAdapter{})},
David K. Bainbridge794735f2020-02-11 21:01:37 -0800519 {"process_inter_adaptor_messgae-3", mockOlt(), message3,
Thomas Lee S94109f12020-03-03 16:39:29 +0530520 reflect.TypeOf(&olterrors.ErrInvalidValue{})},
cbabua9e04cc2019-10-03 12:35:45 +0530521 }
522 for _, tt := range tests {
523 t.Run(tt.name, func(t *testing.T) {
524 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000525 if err := oo.Process_inter_adapter_message(context.Background(), tt.args.msg); reflect.TypeOf(err) != tt.wantErrType {
David K. Bainbridge794735f2020-02-11 21:01:37 -0800526 t.Errorf("Process_inter_adapter_message() error = %v, wantErr %v",
527 reflect.TypeOf(err), tt.wantErrType)
cbabua9e04cc2019-10-03 12:35:45 +0530528 }
529 })
530 }
531}
532
533func TestOpenOLT_Reboot_device(t *testing.T) {
534 type args struct {
535 device *voltha.Device
536 }
537 tests := []struct {
538 name string
539 fields *fields
540 args args
541 wantErr error
542 }{
David K. Bainbridge794735f2020-02-11 21:01:37 -0800543 {"reboot_device-1", mockOlt(), args{mockDevice()}, nil},
544 {"reboot_device-2", &fields{}, args{mockDevice()},
Thomas Lee S94109f12020-03-03 16:39:29 +0530545 olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": "olt"}, nil)},
cbabua9e04cc2019-10-03 12:35:45 +0530546 }
547 for _, tt := range tests {
548 t.Run(tt.name, func(t *testing.T) {
549 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000550 if err := oo.Reboot_device(context.Background(), tt.args.device); !reflect.DeepEqual(err, tt.wantErr) {
cbabua9e04cc2019-10-03 12:35:45 +0530551 t.Errorf("Reboot_device() error = %v, wantErr %v", err, tt.wantErr)
552 }
553 })
554 }
555}
556
557func TestOpenOLT_Receive_packet_out(t *testing.T) {
558 acts := []*ofp.OfpAction{
559 fu.SetField(fu.Metadata_ofp(uint64(ofp.OfpInstructionType_OFPIT_WRITE_METADATA))),
560 fu.SetField(fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT) | 101)),
561 fu.Output(1),
562 }
563 type args struct {
564 deviceID string
565 egressPortNo int
566 packet *openflow_13.OfpPacketOut
567 }
568 pktout := &ofp.OfpPacketOut{BufferId: 0, InPort: 1, Actions: acts, Data: []byte("AYDCAAAOAODsSE5TiMwCBwQA4OxITlIEBQUwLzUx" +
569 "BgIAFAgEMC81MQoJbG9jYWxob3N0EBwFAawbqqACAAAAoRAxLjMuNi4xLjQuMS40NDEz/gYAgMILAgD+GQCAwgkDAAAAAGQAAAAAAAAAAgICAgICAgL+" +
570 "GQCAwgoDAAAAAGQAAAAAAAAAAgICAgICAgIAAA==")}
571 tests := []struct {
572 name string
573 fields *fields
574 args args
575 wantErr error
576 }{
David K. Bainbridge794735f2020-02-11 21:01:37 -0800577 {"receive_packet_out-1", mockOlt(), args{mockDevice().Id, 1, pktout}, nil},
cbabua9e04cc2019-10-03 12:35:45 +0530578 {"receive_packet_out-2", mockOlt(), args{"1234", 1, pktout},
Thomas Lee S94109f12020-03-03 16:39:29 +0530579 olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": "1234"}, nil)},
cbabua9e04cc2019-10-03 12:35:45 +0530580 }
581 for _, tt := range tests {
582 t.Run(tt.name, func(t *testing.T) {
583 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000584 if err := oo.Receive_packet_out(context.Background(), tt.args.deviceID, tt.args.egressPortNo, tt.args.packet); !reflect.DeepEqual(err, tt.wantErr) {
cbabua9e04cc2019-10-03 12:35:45 +0530585 t.Errorf("Receive_packet_out() error = %v, wantErr %v", err, tt.wantErr)
586 }
587 })
588 }
589}
590
591func TestOpenOLT_Reconcile_device(t *testing.T) {
592 type args struct {
593 device *voltha.Device
594 }
Thomas Lee S94109f12020-03-03 16:39:29 +0530595 expectedError := olterrors.NewErrInvalidValue(log.Fields{"device": nil}, nil)
cbabua9e04cc2019-10-03 12:35:45 +0530596 tests := []struct {
597 name string
598 fields *fields
599 args args
600 wantErr error
601 }{
David K. Bainbridge794735f2020-02-11 21:01:37 -0800602 {"reconcile_device-1", &fields{}, args{}, expectedError},
603 {"reconcile_device-2", &fields{}, args{}, expectedError},
604 {"reconcile_device-3", &fields{}, args{}, expectedError},
cbabua9e04cc2019-10-03 12:35:45 +0530605 }
606 for _, tt := range tests {
607 t.Run(tt.name, func(t *testing.T) {
608 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000609 if err := oo.Reconcile_device(context.Background(), tt.args.device); !reflect.DeepEqual(err, tt.wantErr) {
cbabua9e04cc2019-10-03 12:35:45 +0530610 t.Errorf("Reconcile_device() error = %v, wantErr %v", err, tt.wantErr)
611 }
612 })
613 }
614}
615
616func TestOpenOLT_Reenable_device(t *testing.T) {
617 type args struct {
618 device *voltha.Device
619 }
620 tests := []struct {
621 name string
622 fields *fields
623 args args
624 wantErr error
625 }{
David K. Bainbridge794735f2020-02-11 21:01:37 -0800626 {"reenable_device-1", mockOlt(), args{mockDevice()}, nil},
627 {"reenable_device-2", &fields{}, args{mockDevice()},
Thomas Lee S94109f12020-03-03 16:39:29 +0530628 olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": "olt"}, nil)},
cbabua9e04cc2019-10-03 12:35:45 +0530629 }
630 for _, tt := range tests {
631 t.Run(tt.name, func(t *testing.T) {
632 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000633 if err := oo.Reenable_device(context.Background(), tt.args.device); !reflect.DeepEqual(err, tt.wantErr) {
cbabua9e04cc2019-10-03 12:35:45 +0530634 t.Errorf("Reenable_device() error = %v, wantErr %v", err, tt.wantErr)
635 }
636 })
637 }
638}
639
640func TestOpenOLT_Revert_image_update(t *testing.T) {
641 type args struct {
642 device *voltha.Device
643 request *voltha.ImageDownload
644 }
645 tests := []struct {
646 name string
647 fields *fields
648 args args
649 want *voltha.ImageDownload
650 wantErr error
651 }{
652 {"revert_image_update-1", &fields{}, args{}, &voltha.ImageDownload{Id: "Image1-ABC123XYZ"},
Thomas Lee S94109f12020-03-03 16:39:29 +0530653 olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530654 {"revert_image_update-2", &fields{}, args{}, &voltha.ImageDownload{Id: "Image2-ABC123TYU"},
Thomas Lee S94109f12020-03-03 16:39:29 +0530655 olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530656 {"revert_image_update-3", &fields{}, args{}, &voltha.ImageDownload{Id: "Image3-ABC123GTH"},
Thomas Lee S94109f12020-03-03 16:39:29 +0530657 olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530658 }
659 for _, tt := range tests {
660 t.Run(tt.name, func(t *testing.T) {
661 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000662 got, err := oo.Revert_image_update(context.Background(), tt.args.device, tt.args.request)
David K. Bainbridge794735f2020-02-11 21:01:37 -0800663 if err != tt.wantErr && got == nil {
cbabua9e04cc2019-10-03 12:35:45 +0530664 t.Log("error :", err)
665 }
666 })
667 }
668}
669
670func TestOpenOLT_Self_test_device(t *testing.T) {
671 type args struct {
672 device *voltha.Device
673 }
674 tests := []struct {
675 name string
676 fields *fields
677 args args
678 wantErr error
679 }{
Thomas Lee S94109f12020-03-03 16:39:29 +0530680 {"self_test_device-1", &fields{}, args{}, olterrors.ErrNotImplemented},
681 {"self_test_device-2", &fields{}, args{}, olterrors.ErrNotImplemented},
682 {"self_test_device-3", &fields{}, args{}, olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530683 }
684 for _, tt := range tests {
685 t.Run(tt.name, func(t *testing.T) {
686 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000687 if err := oo.Self_test_device(context.Background(), tt.args.device); err != tt.wantErr {
cbabua9e04cc2019-10-03 12:35:45 +0530688 t.Errorf("Self_test_device() error = %v, wantErr %v", err, tt.wantErr)
689 }
690 })
691 }
692}
693
694func TestOpenOLT_Start(t *testing.T) {
695 type args struct {
696 ctx context.Context
697 }
698 tests := []struct {
699 name string
700 fields *fields
701 args args
702 wantErr error
703 }{
704 {"start-1", &fields{}, args{}, errors.New("start error")},
705 }
706 for _, tt := range tests {
707 t.Run(tt.name, func(t *testing.T) {
708 oo := testOltObject(tt.fields)
709 if err := oo.Start(tt.args.ctx); err != nil {
710 t.Errorf("Start() error = %v, wantErr %v", err, tt.wantErr)
711 }
712 })
713 }
714}
715
716func TestOpenOLT_Stop(t *testing.T) {
717 type args struct {
718 ctx context.Context
719 }
720 tests := []struct {
721 name string
722 fields *fields
723 args args
724 wantErr error
725 }{
726 {"stop-1", &fields{exitChannel: make(chan int, 1)}, args{}, errors.New("stop error")},
727 }
728 for _, tt := range tests {
729 t.Run(tt.name, func(t *testing.T) {
730 oo := testOltObject(tt.fields)
731 oo.Start(tt.args.ctx)
732 if err := oo.Stop(tt.args.ctx); err != nil {
733 t.Errorf("Stop() error = %v, wantErr %v", err, tt.wantErr)
734 }
735 })
736 }
737}
738
Devmalya Pauldd23a992019-11-14 07:06:31 +0000739func TestOpenOLT_Suppress_event(t *testing.T) {
cbabua9e04cc2019-10-03 12:35:45 +0530740 type args struct {
Devmalya Pauldd23a992019-11-14 07:06:31 +0000741 filter *voltha.EventFilter
cbabua9e04cc2019-10-03 12:35:45 +0530742 }
743 tests := []struct {
744 name string
745 fields *fields
746 args args
747 wantErr error
748 }{
Thomas Lee S94109f12020-03-03 16:39:29 +0530749 {"suppress_event-1", &fields{}, args{}, olterrors.ErrNotImplemented},
750 {"suppress_event-2", &fields{}, args{}, olterrors.ErrNotImplemented},
751 {"suppress_event-3", &fields{}, args{}, olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530752 }
753 for _, tt := range tests {
754 t.Run(tt.name, func(t *testing.T) {
755 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000756 if err := oo.Suppress_event(context.Background(), tt.args.filter); err != tt.wantErr {
Devmalya Pauldd23a992019-11-14 07:06:31 +0000757 t.Errorf("Suppress_event() error = %v, wantErr %v", err, tt.wantErr)
cbabua9e04cc2019-10-03 12:35:45 +0530758 }
759 })
760 }
761}
762
Devmalya Pauldd23a992019-11-14 07:06:31 +0000763func TestOpenOLT_Unsuppress_event(t *testing.T) {
cbabua9e04cc2019-10-03 12:35:45 +0530764 type args struct {
Devmalya Pauldd23a992019-11-14 07:06:31 +0000765 filter *voltha.EventFilter
cbabua9e04cc2019-10-03 12:35:45 +0530766 }
767 tests := []struct {
768 name string
769 fields *fields
770 args args
771 wantErr error
772 }{
Thomas Lee S94109f12020-03-03 16:39:29 +0530773 {"unsupress_event-1", &fields{}, args{}, olterrors.ErrNotImplemented},
774 {"unsupress_event-2", &fields{}, args{}, olterrors.ErrNotImplemented},
775 {"unsupress_event-3", &fields{}, args{}, olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530776 }
777 for _, tt := range tests {
778 t.Run(tt.name, func(t *testing.T) {
779 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000780 if err := oo.Unsuppress_event(context.Background(), tt.args.filter); err != tt.wantErr {
Devmalya Pauldd23a992019-11-14 07:06:31 +0000781 t.Errorf("Unsuppress_event() error = %v, wantErr %v", err, tt.wantErr)
cbabua9e04cc2019-10-03 12:35:45 +0530782 }
783 })
784 }
785}
786
787func TestOpenOLT_Update_flows_bulk(t *testing.T) {
788 type args struct {
789 device *voltha.Device
790 flows *voltha.Flows
791 groups *voltha.FlowGroups
792 flowMetadata *voltha.FlowMetadata
793 }
794 tests := []struct {
795 name string
796 fields *fields
797 args args
798 wantErr error
799 }{
Thomas Lee S94109f12020-03-03 16:39:29 +0530800 {"update_flows_bulk-1", &fields{}, args{}, olterrors.ErrNotImplemented},
801 {"update_flows_bulk-2", &fields{}, args{}, olterrors.ErrNotImplemented},
802 {"update_flows_bulk-3", &fields{}, args{}, olterrors.ErrNotImplemented},
cbabua9e04cc2019-10-03 12:35:45 +0530803 }
804 for _, tt := range tests {
805 t.Run(tt.name, func(t *testing.T) {
806 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000807 if err := oo.Update_flows_bulk(context.Background(), tt.args.device, tt.args.flows, tt.args.groups, tt.args.flowMetadata); err != tt.wantErr {
cbabua9e04cc2019-10-03 12:35:45 +0530808 t.Errorf("Update_flows_bulk() error = %v, wantErr %v", err, tt.wantErr)
809 }
810 })
811 }
812}
813
814func TestOpenOLT_Update_flows_incrementally(t *testing.T) {
815 type args struct {
816 device *voltha.Device
817 flows *openflow_13.FlowChanges
818 groups *openflow_13.FlowGroupChanges
819 flowMetadata *voltha.FlowMetadata
820 }
821
822 tests := []struct {
823 name string
824 fields *fields
825 args args
826 wantErr error
827 }{
828 {"update_flows_incrementally-1", &fields{}, args{device: mockDevice()},
Thomas Lee S94109f12020-03-03 16:39:29 +0530829 olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": "olt"}, nil)},
David K. Bainbridge794735f2020-02-11 21:01:37 -0800830 {"update_flows_incrementally-2", mockOlt(), args{device: mockDevice()}, nil},
cbabua9e04cc2019-10-03 12:35:45 +0530831 }
832 for _, tt := range tests {
833 t.Run(tt.name, func(t *testing.T) {
834 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000835 if err := oo.Update_flows_incrementally(context.Background(), tt.args.device, tt.args.flows, tt.args.groups, tt.args.flowMetadata); !reflect.DeepEqual(err, tt.wantErr) {
cbabua9e04cc2019-10-03 12:35:45 +0530836 t.Errorf("Update_flows_incrementally() error = %v, wantErr %v", err, tt.wantErr)
837 }
838 })
839 }
840}
841
842func TestOpenOLT_Update_pm_config(t *testing.T) {
843 type args struct {
844 device *voltha.Device
845 pmConfigs *voltha.PmConfigs
846 }
847 tests := []struct {
848 name string
849 fields *fields
850 args args
851 wantErr error
852 }{
Rohan Agrawalda5e0b22020-05-20 11:10:26 +0000853 {"update_pm_config-1", mockOlt(), args{device: mockDevice(), pmConfigs: &voltha.PmConfigs{DefaultFreq: 150, Grouped: false, FreqOverride: false}}, nil},
854 {"update_pm_config-2", &fields{}, args{device: mockDevice(), pmConfigs: &voltha.PmConfigs{DefaultFreq: 150, Grouped: false, FreqOverride: false}}, olterrors.NewErrNotFound("device-handler", log.Fields{"device-id": "olt"}, nil)},
cbabua9e04cc2019-10-03 12:35:45 +0530855 }
856 for _, tt := range tests {
857 t.Run(tt.name, func(t *testing.T) {
858 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000859
860 if err := oo.Update_pm_config(context.Background(), tt.args.device, tt.args.pmConfigs); !reflect.DeepEqual(err, tt.wantErr) {
cbabua9e04cc2019-10-03 12:35:45 +0530861 t.Errorf("Update_pm_config() error = %v, wantErr %v", err, tt.wantErr)
862 }
863
864 })
865 }
866}
867
868func TestOpenOLT_deleteDeviceHandlerToMap(t *testing.T) {
869 type args struct {
870 agent *DeviceHandler
871 }
872 tests := []struct {
873 name string
874 fields *fields
875 args args
876 }{
877 {"delete_device_handler_map-1", mockOlt(), args{newMockDeviceHandler()}},
878 }
879 for _, tt := range tests {
880 t.Run(tt.name, func(t *testing.T) {
881 oo := testOltObject(tt.fields)
882 oo.deleteDeviceHandlerToMap(tt.args.agent)
883 if len(oo.deviceHandlers) > 0 {
884 t.Errorf("delete device manager failed")
885 }
886 })
887 }
888}
kesavand39e0aa32020-01-28 20:58:50 -0500889
890func TestOpenOLT_Enable_port(t *testing.T) {
891 type args struct {
892 deviceID string
893 port *voltha.Port
894 }
895 tests := []struct {
896 name string
897 fields *fields
898 args args
899 wantErr bool
900 }{
901 // TODO: Add test cases.
902 {"Enable_port-1", mockOlt(), args{deviceID: "olt", port: &voltha.Port{Type: voltha.Port_PON_OLT, PortNo: 1}}, false},
903 {"Enable_port-2", mockOlt(), args{deviceID: "olt", port: &voltha.Port{Type: voltha.Port_ETHERNET_NNI, PortNo: 1}}, true},
904 }
905 for _, tt := range tests {
906 t.Run(tt.name, func(t *testing.T) {
907 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000908 if err := oo.Enable_port(context.Background(), tt.args.deviceID, tt.args.port); (err != nil) != tt.wantErr {
kesavand39e0aa32020-01-28 20:58:50 -0500909 t.Errorf("OpenOLT.Enable_port() error = %v, wantErr %v", err, tt.wantErr)
910 }
911 })
912 }
913}
914
915func TestOpenOLT_Disable_port(t *testing.T) {
916 type args struct {
917 deviceID string
918 port *voltha.Port
919 }
920 tests := []struct {
921 name string
922 fields *fields
923 args args
924 wantErr bool
925 }{
926 // TODO: Add test cases.
927 {"Disable_port-1", mockOlt(), args{deviceID: "olt", port: &voltha.Port{Type: voltha.Port_PON_OLT, PortNo: 1}}, false},
928 {"Disable_port-2", mockOlt(), args{deviceID: "olt", port: &voltha.Port{Type: voltha.Port_ETHERNET_NNI, PortNo: 1}}, true},
929 }
930 for _, tt := range tests {
931 t.Run(tt.name, func(t *testing.T) {
932 oo := testOltObject(tt.fields)
Neha Sharma96b7bf22020-06-15 10:37:32 +0000933 if err := oo.Disable_port(context.Background(), tt.args.deviceID, tt.args.port); (err != nil) != tt.wantErr {
kesavand39e0aa32020-01-28 20:58:50 -0500934 t.Errorf("OpenOLT.Disable_port() error = %v, wantErr %v", err, tt.wantErr)
935 }
936 })
937 }
938}