blob: b9c458b0751c87c2969db8b20028d92e134c5540 [file] [log] [blame]
vinokumaf7605fc2023-06-02 18:08:01 +05301/*
2* Copyright 2022-present Open Networking Foundation
3* Licensed under the Apache License, Version 2.0 (the "License");
4* you may not use this file except in compliance with the License.
5* You may obtain a copy of the License at
6*
7* http://www.apache.org/licenses/LICENSE-2.0
8*
9* Unless required by applicable law or agreed to in writing, software
10* distributed under the License is distributed on an "AS IS" BASIS,
11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12* See the License for the specific language governing permissions and
13* limitations under the License.
14 */
15
16package application
17
18import (
19 "context"
20 "encoding/json"
21 "errors"
22 "sync"
23 "testing"
24 "voltha-go-controller/internal/pkg/controller"
25 cntlr "voltha-go-controller/internal/pkg/controller"
26 "voltha-go-controller/internal/pkg/of"
27 "voltha-go-controller/internal/pkg/util"
28 "voltha-go-controller/internal/test/mocks"
29
30 "github.com/golang/mock/gomock"
31 "github.com/google/gopacket/layers"
32 "github.com/opencord/voltha-lib-go/v7/pkg/db/kvstore"
33 "github.com/stretchr/testify/assert"
34 "go.uber.org/atomic"
35)
36
37var test_device = "test_device"
38var voltPort = &VoltPort{
39 Name: "test_name",
40 Device: test_device,
41}
42var voltDevice = &VoltDevice{
43 Name: "test_name",
44 State: controller.DeviceStateUP,
45 FlowAddEventMap: util.NewConcurrentMap(),
46 FlowDelEventMap: util.NewConcurrentMap(),
47 SerialNum: "test_serial_number",
48}
49
50var voltMeter = &VoltMeter{
51 Name: "test_volt_meter",
52 Version: "test_version",
53}
54
55var voltVnet = &VoltVnet{
56 Version: "test_version",
57 VnetConfig: VnetConfig{
58 Name: "test_name",
59 },
60}
61
62var voltPortVnet1 = []*VoltPortVnet{
63 {
64 Device: "4096-4096-4096",
65 SVlan: of.VlanAny,
66 CVlan: of.VlanAny,
67 UniVlan: of.VlanAny,
68 IgmpEnabled: true,
69 servicesCount: &atomic.Uint64{},
70 },
71}
72
73var voltDevice1 = &VoltDevice{
74 State: cntlr.DeviceStateDOWN,
75}
76
77var GetDeviceFromPort_error = "GetDeviceFromPort_error"
78
79func TestVoltApplication_RestoreSvcsFromDb(t *testing.T) {
80 type args struct {
81 cntx context.Context
82 }
83 tests := []struct {
84 name string
85 args args
86 }{
87 {
88 name: "VoltApplication_RestoreSvcsFromDb",
89 args: args{
90 cntx: context.Background(),
91 },
92 },
93 {
94 name: "invalid_value_type",
95 args: args{
96 cntx: context.Background(),
97 },
98 },
99 {
100 name: "unmarshal_error",
101 args: args{
102 cntx: context.Background(),
103 },
104 },
105 }
106 for _, tt := range tests {
107 t.Run(tt.name, func(t *testing.T) {
108 voltService := &VoltService{
109 VoltServiceOper: VoltServiceOper{
110 Device: "SDX6320031",
111 ForceDelete: true,
112 DeleteInProgress: true,
113 },
114 VoltServiceCfg: VoltServiceCfg{
115 Name: "test_service_name",
116 },
117 }
118 serviceToDelete := map[string]bool{}
119 serviceToDelete[voltService.VoltServiceCfg.Name] = true
120 va := &VoltApplication{
121 ServicesToDelete: serviceToDelete,
122 }
123 dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
124 db = dbintf
125 switch tt.name {
126 case "VoltApplication_RestoreSvcsFromDb":
127
128 b, err := json.Marshal(voltService)
129 if err != nil {
130 panic(err)
131 }
132 kvPair := map[string]*kvstore.KVPair{}
133 kvPair["key"] = &kvstore.KVPair{
134 Key: "test_key",
135 Value: b,
136 Version: 1,
137 }
138 dbintf.EXPECT().GetServices(tt.args.cntx).Return(kvPair, nil).Times(1)
139 va.RestoreSvcsFromDb(tt.args.cntx)
140 case "invalid_value_type":
141 kvPair := map[string]*kvstore.KVPair{}
142 kvPair["key"] = &kvstore.KVPair{
143 Key: "test_key",
144 Value: "invalid_value",
145 Version: 1,
146 }
147 dbintf.EXPECT().GetServices(tt.args.cntx).Return(kvPair, nil).Times(1)
148 va.RestoreSvcsFromDb(tt.args.cntx)
149 case "unmarshal_error":
150 b, err := json.Marshal("test")
151 if err != nil {
152 panic(err)
153 }
154 kvPair := map[string]*kvstore.KVPair{}
155 kvPair["key"] = &kvstore.KVPair{
156 Key: "test_key",
157 Value: b,
158 Version: 1,
159 }
160 dbintf.EXPECT().GetServices(tt.args.cntx).Return(kvPair, nil).Times(1)
161 va.RestoreSvcsFromDb(tt.args.cntx)
162 }
163 })
164 }
165}
166
167func TestVoltService_FlowRemoveFailure(t *testing.T) {
168 type args struct {
169 cntx context.Context
170 cookie string
171 errorCode uint32
172 errReason string
173 }
174 tests := []struct {
175 name string
176 args args
177 }{
178 {
179 name: "VoltService_FlowRemoveFailure",
180 args: args{
181 cntx: context.Background(),
182 cookie: "test_cookie",
183 errorCode: 200,
184 errReason: "test_reason",
185 },
186 },
187 {
188 name: "cookie_not_found",
189 args: args{
190 cntx: context.Background(),
191 cookie: "test_cookie",
192 errorCode: 200,
193 errReason: "test_reason",
194 },
195 },
196 }
197 for _, tt := range tests {
198 t.Run(tt.name, func(t *testing.T) {
199 switch tt.name {
200 case "VoltService_FlowRemoveFailure":
201 associatedFlows := map[string]bool{}
202 associatedFlows["test_cookie"] = true
203 vs := &VoltService{
204 VoltServiceOper: VoltServiceOper{
205 AssociatedFlows: associatedFlows,
206 },
207 }
208 vs.FlowRemoveFailure(tt.args.cntx, tt.args.cookie, tt.args.errorCode, tt.args.errReason)
209 case "cookie_not_found":
210 associatedFlows := map[string]bool{}
211 associatedFlows["cookie"] = true
212 vs := &VoltService{
213 VoltServiceOper: VoltServiceOper{
214 AssociatedFlows: associatedFlows,
215 },
216 }
217 vs.FlowRemoveFailure(tt.args.cntx, tt.args.cookie, tt.args.errorCode, tt.args.errReason)
218 }
219 })
220 }
221}
222
223func TestVoltApplication_GetServiceNameFromCookie(t *testing.T) {
224 type args struct {
225 cookie uint64
226 portName string
227 pbit uint8
228 device string
229 tableMetadata uint64
230 }
231 tests := []struct {
232 name string
233 args args
234 }{
235 {
236 name: "VoltApplication_GetServiceNameFromCookie",
237 args: args{
238 cookie: uint64(1),
239 portName: "test_port_name",
240 device: "SDX6320031",
241 pbit: 2,
242 tableMetadata: uint64(2),
243 },
244 },
245 }
246 voltDev := &VoltDevice{
247 Name: "SDX6320031",
248 SerialNum: "SDX6320031",
249 NniDhcpTrapVid: 123,
250 }
251 for _, tt := range tests {
252 t.Run(tt.name, func(t *testing.T) {
253 ga := GetApplication()
254 ga.DevicesDisc.Store("SDX6320031", voltDev)
255 voltPortVnets := make([]*VoltPortVnet, 0)
256 voltPortVnet := &VoltPortVnet{
257 Device: test_device,
258 VlanControl: ONUCVlanOLTSVlan,
259 }
260 voltPortVnets = append(voltPortVnets, voltPortVnet)
261 ga.VnetsByPort.Store("test_port_name", voltPortVnets)
262 got := ga.GetServiceNameFromCookie(tt.args.cookie, tt.args.portName, tt.args.pbit, tt.args.device, tt.args.tableMetadata)
263 assert.Nil(t, got)
264 })
265 }
266}
267
268func TestVoltService_SvcUpInd(t *testing.T) {
269 type args struct {
270 cntx context.Context
271 }
272 tests := []struct {
273 name string
274 args args
275 }{
276 {
277 name: "VoltService_SvcUpInd",
278 args: args{
279 cntx: context.Background(),
280 },
281 },
282 }
283 for _, tt := range tests {
284 t.Run(tt.name, func(t *testing.T) {
285 vs := &VoltService{
286 VoltServiceOper: VoltServiceOper{
287 PendingFlows: make(map[string]bool),
288 },
289 VoltServiceCfg: VoltServiceCfg{
290 SVlanTpid: layers.EthernetTypeDot1Q,
291 MacAddr: layers.EthernetBroadcast,
292 },
293 }
294 vs.Port = test_device
295 vs.Device = "device"
296 ga := GetApplication()
297 _ = cntlr.NewController(context.Background(), mocks.NewMockApp(gomock.NewController(t)))
298 dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
299 db = dbintf
300 dbintf.EXPECT().PutService(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
301 ga.PortsDisc.Store(test_device, voltPort)
302 ga.DevicesDisc.Store(test_device, voltDevice)
303 vs.SvcUpInd(tt.args.cntx)
304 })
305 }
306}
307
308func TestVoltService_SvcDownInd(t *testing.T) {
309 type args struct {
310 cntx context.Context
311 }
312 tests := []struct {
313 name string
314 args args
315 }{
316 {
317 name: "VoltService_SvcDownInd",
318 args: args{
319 cntx: context.Background(),
320 },
321 },
322 }
323 for _, tt := range tests {
324 t.Run(tt.name, func(t *testing.T) {
325 vs := &VoltService{
326 VoltServiceOper: VoltServiceOper{
327 UsHSIAFlowsApplied: true,
328 DsHSIAFlowsApplied: true,
329 },
330 VoltServiceCfg: VoltServiceCfg{
331 SVlanTpid: layers.EthernetTypeQinQ,
332 MacAddr: layers.EthernetBroadcast,
333 },
334 }
335 vs.Port = test_device
336 vs.Device = "device"
337 ga := GetApplication()
338 _ = cntlr.NewController(context.Background(), mocks.NewMockApp(gomock.NewController(t)))
339 dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
340 db = dbintf
341 dbintf.EXPECT().PutService(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
342 ga.PortsDisc.Store(test_device, voltPort)
343 ga.DevicesDisc.Store(test_device, voltDevice)
344 vs.SvcDownInd(tt.args.cntx)
345 })
346 }
347}
348
349func TestVoltApplication_AddService(t *testing.T) {
350 type args struct {
351 cntx context.Context
352 cfg VoltServiceCfg
353 oper *VoltServiceOper
354 }
355 tests := []struct {
356 name string
357 args args
358 }{
359 {
360 name: "VoltApplication_AddService",
361 args: args{
362 cntx: context.Background(),
363 cfg: VoltServiceCfg{
364 Name: "test_name",
365 Port: "test_port",
366 DsMeterProfile: "4096-4096-4096",
367 UsMeterProfile: "4096-4096-4096",
368 SVlan: of.VlanAny,
369 CVlan: of.VlanAny,
370 UniVlan: of.VlanAny,
371 MacLearning: Learn,
372 IsActivated: true,
373 },
374 oper: &VoltServiceOper{
375 Device: "4096-4096-4096",
376 },
377 },
378 },
379 }
380 for _, tt := range tests {
381 t.Run(tt.name, func(t *testing.T) {
382 va := &VoltApplication{
383 MeterMgr: MeterMgr{
384 Meters: sync.Map{},
385 },
386 VnetsByPort: sync.Map{},
387 VnetsByTag: sync.Map{},
388 }
389 va.MeterMgr.Meters.Store("4096-4096-4096", voltMeter)
390 va.VnetsByTag.Store("4096-4096-4096", voltVnet)
391 voltPortVnet1[0].SVlan = of.VlanAny
392 voltPortVnet1[0].CVlan = of.VlanAny
393 voltPortVnet1[0].UniVlan = of.VlanAny
394 voltPortVnet1[0].servicesCount = atomic.NewUint64(uint64(56))
395 voltPortVnet1[0].MacAddr = layers.EthernetBroadcast
396 voltPortVnet1[0].Port = "test_port"
397 va.VnetsByPort.Store("test_port", voltPortVnet1)
398 ga := GetApplication()
399 voltPort1 := &VoltPort{
400 Name: "test_name",
401 Device: test_device,
402 }
403 deviceConfig := &DeviceConfig{
404 SerialNumber: "test_serial_number",
405 }
406 ga.PortsDisc.Store("test_port", voltPort1)
407 ga.DevicesDisc.Store(test_device, voltDevice)
408 ga.DevicesConfig.Store("test_serial_number", deviceConfig)
409 dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
410 db = dbintf
411 dbintf.EXPECT().PutService(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
412 dbintf.EXPECT().PutVpv(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(1)
413 err := va.AddService(tt.args.cntx, tt.args.cfg, tt.args.oper)
414 assert.Nil(t, err)
415 })
416 }
417}
418
419func TestVoltApplication_DelService(t *testing.T) {
420 type args struct {
421 cntx context.Context
422 name string
423 forceDelete bool
424 newSvc *VoltServiceCfg
425 serviceMigration bool
426 }
427 tests := []struct {
428 name string
429 args args
430 }{
431 {
432 name: "VoltApplication_DelService",
433 args: args{
434 cntx: context.Background(),
435 name: "test_name",
436 forceDelete: true,
437 newSvc: &VoltServiceCfg{
438 Name: "vs_cfg_name",
439 Port: "test_port",
440 },
441 serviceMigration: true,
442 },
443 },
444 }
445 for _, tt := range tests {
446 t.Run(tt.name, func(t *testing.T) {
447 va := &VoltApplication{
448 ServiceByName: sync.Map{},
449 VnetsByPort: sync.Map{},
450 }
451 voltService := &VoltService{
452 Version: "test_version",
453 VoltServiceCfg: VoltServiceCfg{
454 Port: "4096-4096-4096",
455 SVlan: of.VlanAny,
456 CVlan: of.VlanAny,
457 UniVlan: of.VlanAny,
458 },
459 }
460 va.ServiceByName.Store(tt.args.name, voltService)
461 va.VnetsByPort.Store("4096-4096-4096", voltPortVnet1)
462 dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
463 db = dbintf
464 dbintf.EXPECT().DelService(gomock.Any(), gomock.Any()).AnyTimes()
465 dbintf.EXPECT().PutService(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
466 va.DelService(tt.args.cntx, tt.args.name, tt.args.forceDelete, tt.args.newSvc, tt.args.serviceMigration)
467 })
468 }
469}
470
471func TestVoltService_FlowInstallSuccess(t *testing.T) {
472 type args struct {
473 cntx context.Context
474 cookie string
475 bwAvailInfo of.BwAvailDetails
476 }
477 tests := []struct {
478 name string
479 args args
480 }{
481 {
482 name: "VoltService_FlowInstallSuccess",
483 args: args{
484 cntx: context.Background(),
485 cookie: "test_cookie",
486 bwAvailInfo: of.BwAvailDetails{
487 PrevBw: "test_prev_BW",
488 PresentBw: "test_present_BW",
489 },
490 },
491 },
492 }
493 for _, tt := range tests {
494 t.Run(tt.name, func(t *testing.T) {
495 pendingFlows := map[string]bool{}
496 pendingFlows["test_cookie"] = true
497 associatedFlows := map[string]bool{}
498 associatedFlows["test_cookie"] = true
499 vs := &VoltService{
500 VoltServiceOper: VoltServiceOper{
501 PendingFlows: pendingFlows,
502 AssociatedFlows: associatedFlows,
503 DsHSIAFlowsApplied: true,
504 },
505 VoltServiceCfg: VoltServiceCfg{
506 Port: "test_port",
507 },
508 }
509 ga := GetApplication()
510 ga.PortsDisc.Store("test_port", voltPort)
511 ga.DevicesDisc.Store(test_device, voltDevice)
512 vs.FlowInstallSuccess(tt.args.cntx, tt.args.cookie, tt.args.bwAvailInfo)
513 })
514 }
515}
516
517func TestVoltService_AddMeterToDevice(t *testing.T) {
518 type args struct {
519 cntx context.Context
520 }
521 tests := []struct {
522 name string
523 args args
524 wantErr bool
525 }{
526 {
527 name: "VoltService_AddMeterToDevice",
528 args: args{
529 cntx: context.Background(),
530 },
531 },
532 {
533 name: GetDeviceFromPort_error,
534 args: args{
535 cntx: context.Background(),
536 },
537 },
538 {
539 name: "DeviceState_down",
540 args: args{
541 cntx: context.Background(),
542 },
543 },
544 }
545 for _, tt := range tests {
546 t.Run(tt.name, func(t *testing.T) {
547 switch tt.name {
548 case "VoltService_AddMeterToDevice":
549 vs := &VoltService{
550 VoltServiceOper: VoltServiceOper{
551 DeleteInProgress: true,
552 },
553 VoltServiceCfg: VoltServiceCfg{
554 Port: "test_port",
555 },
556 }
557 ga := GetApplication()
558 ga.PortsDisc.Store("test_port", voltPort)
559 ga.DevicesDisc.Store(test_device, voltDevice)
560 err := vs.AddMeterToDevice(tt.args.cntx)
561 assert.Nil(t, err)
562 case GetDeviceFromPort_error:
563 vs := &VoltService{
564 VoltServiceOper: VoltServiceOper{
565 DeleteInProgress: true,
566 },
567 VoltServiceCfg: VoltServiceCfg{
568 Port: "",
569 },
570 }
571 err := vs.AddMeterToDevice(tt.args.cntx)
572 assert.NotNil(t, err)
573 case "DeviceState_down":
574 vs := &VoltService{
575 VoltServiceOper: VoltServiceOper{
576 DeleteInProgress: true,
577 },
578 VoltServiceCfg: VoltServiceCfg{
579 Port: "test_port",
580 },
581 }
582 ga := GetApplication()
583 ga.PortsDisc.Store("test_port", voltPort)
584 ga.DevicesDisc.Store(test_device, voltDevice1)
585 err := vs.AddMeterToDevice(tt.args.cntx)
586 assert.Nil(t, err)
587 }
588 })
589 }
590}
591
592func TestVoltService_AddUsHsiaFlows(t *testing.T) {
593 type args struct {
594 cntx context.Context
595 }
596 tests := []struct {
597 name string
598 args args
599 wantErr bool
600 }{
601 {
602 name: "DeleteInProgress_true",
603 args: args{
604 cntx: context.Background(),
605 },
606 },
607 {
608 name: "GetDeviceFromPort_error",
609 args: args{
610 cntx: context.Background(),
611 },
612 },
613 {
614 name: "DeviceState_down",
615 args: args{
616 cntx: context.Background(),
617 },
618 },
619 }
620 for _, tt := range tests {
621 t.Run(tt.name, func(t *testing.T) {
622 switch tt.name {
623 case "DeleteInProgress_true":
624 vs := &VoltService{
625 VoltServiceOper: VoltServiceOper{
626 DeleteInProgress: true,
627 },
628 }
629 err := vs.AddUsHsiaFlows(tt.args.cntx)
630 assert.Nil(t, err)
631 case "GetDeviceFromPort_error":
632 vs := &VoltService{
633 VoltServiceOper: VoltServiceOper{
634 DeleteInProgress: false,
635 },
636 }
637 err := vs.AddUsHsiaFlows(tt.args.cntx)
638 assert.NotNil(t, err)
639 case "DeviceState_down":
640 vs := &VoltService{
641 VoltServiceOper: VoltServiceOper{
642 DeleteInProgress: false,
643 },
644 VoltServiceCfg: VoltServiceCfg{
645 Port: "test_port",
646 },
647 }
648 ga := GetApplication()
649 ga.PortsDisc.Store("test_port", voltPort)
650 ga.DevicesDisc.Store(test_device, voltDevice1)
651 err := vs.AddUsHsiaFlows(tt.args.cntx)
652 assert.Nil(t, err)
653 }
654 })
655 }
656}
657
658func TestVoltService_AddHsiaFlows(t *testing.T) {
659 type args struct {
660 cntx context.Context
661 }
662 tests := []struct {
663 name string
664 args args
665 }{
666 {
667 name: "AddUsHsiaFlows_error",
668 args: args{
669 cntx: context.Background(),
670 },
671 },
672 }
673 for _, tt := range tests {
674 t.Run(tt.name, func(t *testing.T) {
675 vs := &VoltService{
676 VoltServiceCfg: VoltServiceCfg{
677 Port: "test_port",
678 VlanControl: 5,
679 },
680 }
681 ga := GetApplication()
682 ga.PortsDisc.Store("test_port", voltPort)
683 ga.DevicesDisc.Store(test_device, voltDevice)
684 vs.AddHsiaFlows(tt.args.cntx)
685 })
686 }
687}
688
689func TestVoltService_ForceWriteToDb(t *testing.T) {
690 type args struct {
691 cntx context.Context
692 }
693 tests := []struct {
694 name string
695 args args
696 }{
697 {
698 name: "PutService_error",
699 args: args{
700 cntx: context.Background(),
701 },
702 },
703 }
704 for _, tt := range tests {
705 t.Run(tt.name, func(t *testing.T) {
706 switch tt.name {
707 case "PutService_error":
708 vs := &VoltService{}
709 dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
710 db = dbintf
711 dbintf.EXPECT().PutService(gomock.Any(), gomock.Any(), gomock.Any()).Return(errors.New("error")).AnyTimes()
712 vs.ForceWriteToDb(tt.args.cntx)
713 }
714 })
715 }
716}
717
718func TestVoltService_isDataRateAttrPresent(t *testing.T) {
719 tests := []struct {
720 name string
721 want bool
722 }{
723 {
724 name: "VoltService_isDataRateAttrPresent",
725 },
726 }
727 for _, tt := range tests {
728 t.Run(tt.name, func(t *testing.T) {
729 vs := &VoltService{}
730 if got := vs.isDataRateAttrPresent(); got != tt.want {
731 t.Errorf("VoltService.isDataRateAttrPresent() = %v, want %v", got, tt.want)
732 }
733 })
734 }
735}
736
737func TestVoltService_GetServicePbit(t *testing.T) {
738 tests := []struct {
739 name string
740 want int
741 }{
742 {
743 name: "VoltService_GetServicePbit",
744 want: -1,
745 },
746 {
747 name: "!IsPbitExist",
748 want: 8,
749 },
750 }
751 for _, tt := range tests {
752 t.Run(tt.name, func(t *testing.T) {
753 switch tt.name {
754 case "VoltService_GetServicePbit":
755 vs := &VoltService{
756 VoltServiceCfg: VoltServiceCfg{
757 Pbits: []of.PbitType{of.PbitMatchAll},
758 },
759 }
760 if got := vs.GetServicePbit(); got != tt.want {
761 t.Errorf("VoltService.GetServicePbit() = %v, want %v", got, tt.want)
762 }
763 case "!IsPbitExist":
764 vs := &VoltService{}
765 if got := vs.GetServicePbit(); got != tt.want {
766 t.Errorf("VoltService.GetServicePbit() = %v, want %v", got, tt.want)
767 }
768 }
769 })
770 }
771}
772
773func TestVoltApplication_DeactivateService(t *testing.T) {
774 type args struct {
775 cntx context.Context
776 deviceID string
777 portNo string
778 sVlan of.VlanType
779 cVlan of.VlanType
780 tpID uint16
781 }
782 tests := []struct {
783 name string
784 args args
785 wantErr bool
786 }{
787 {
788 name: "VoltApplication_DeactivateService",
789 args: args{
790 cntx: context.Background(),
791 deviceID: "test_device_id",
792 portNo: "test_port",
793 sVlan: of.VlanNone,
794 cVlan: of.VlanAny,
795 tpID: AnyVlan,
796 },
797 },
798 {
799 name: "VoltPortVnet_nil",
800 args: args{
801 cntx: context.Background(),
802 deviceID: "test_device_id",
803 portNo: "test_port",
804 sVlan: of.VlanNone,
805 cVlan: of.VlanAny,
806 tpID: AnyVlan,
807 },
808 },
809 {
810 name: "sVlan != of.VlanNone",
811 args: args{
812 cntx: context.Background(),
813 deviceID: "test_device_id",
814 portNo: "test_port",
815 sVlan: of.VlanAny,
816 cVlan: of.VlanAny,
817 tpID: AnyVlan,
818 },
819 },
820 {
821 name: GetDeviceFromPort_error,
822 args: args{
823 cntx: context.Background(),
824 deviceID: "test_device_id",
825 portNo: "test_port",
826 sVlan: of.VlanNone,
827 cVlan: of.VlanAny,
828 tpID: AnyVlan,
829 },
830 },
831 }
832 for _, tt := range tests {
833 t.Run(tt.name, func(t *testing.T) {
834 va := &VoltApplication{
835 ServiceByName: sync.Map{},
836 VnetsByPort: sync.Map{},
837 DevicesDisc: sync.Map{},
838 PortsDisc: sync.Map{},
839 }
840 voltServiceTest := &VoltService{
841 VoltServiceOper: VoltServiceOper{
842 Device: test_device,
843 },
844 Version: "test_version",
845 VoltServiceCfg: VoltServiceCfg{
846 Port: "test_port",
847 Name: "test_name",
848 IsActivated: true,
849 CVlan: of.VlanAny,
850 SVlan: of.VlanAny,
851 UniVlan: of.VlanAny,
852 },
853 }
854 switch tt.name {
855 case "VoltApplication_DeactivateService":
856 va.ServiceByName.Store("test_name", voltServiceTest)
857 va.PortsDisc.Store("test_port", voltPort)
858 dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
859 db = dbintf
860 dbintf.EXPECT().PutService(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
861 va.DevicesDisc.Store(test_device, voltDevice)
862 voltDevice.Ports.Store("test_port", voltPort)
863 va.VnetsByPort.Store("test_port", voltPortVnet1)
864 voltPortVnet1[0].servicesCount.Store(uint64(1))
865 dbintf.EXPECT().PutVpv(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
866 if err := va.DeactivateService(tt.args.cntx, tt.args.deviceID, tt.args.portNo, tt.args.sVlan, tt.args.cVlan, tt.args.tpID); (err != nil) != tt.wantErr {
867 t.Errorf("VoltApplication.DeactivateService() error = %v, wantErr %v", err, tt.wantErr)
868 }
869 case "VoltPortVnet_nil":
870 va.ServiceByName.Store("test_name", voltServiceTest)
871 va.PortsDisc.Store("test_port", voltPort)
872 dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
873 db = dbintf
874 dbintf.EXPECT().PutService(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
875 va.DevicesDisc.Store(test_device, voltDevice)
876 voltDevice.Ports.Store("test_port", voltPort)
877 if err := va.DeactivateService(tt.args.cntx, tt.args.deviceID, tt.args.portNo, tt.args.sVlan, tt.args.cVlan, tt.args.tpID); (err != nil) != tt.wantErr {
878 t.Errorf("VoltApplication.DeactivateService() error = %v, wantErr %v", err, tt.wantErr)
879 }
880 case "sVlan != of.VlanNone":
881 va.ServiceByName.Store("test_name", voltServiceTest)
882 if err := va.DeactivateService(tt.args.cntx, tt.args.deviceID, tt.args.portNo, tt.args.sVlan, tt.args.cVlan, tt.args.tpID); (err != nil) != tt.wantErr {
883 t.Errorf("VoltApplication.DeactivateService() error = %v, wantErr %v", err, tt.wantErr)
884 }
885 case GetDeviceFromPort_error:
886 va.ServiceByName.Store("test_name", voltServiceTest)
887 if err := va.DeactivateService(tt.args.cntx, tt.args.deviceID, tt.args.portNo, tt.args.sVlan, tt.args.cVlan, tt.args.tpID); (err != nil) != tt.wantErr {
888 t.Errorf("VoltApplication.DeactivateService() error = %v, wantErr %v", err, tt.wantErr)
889 }
890 }
891 })
892 }
893}
894
895func TestVoltApplication_ActivateService(t *testing.T) {
896 type args struct {
897 cntx context.Context
898 deviceID string
899 portNo string
900 sVlan of.VlanType
901 cVlan of.VlanType
902 tpID uint16
903 }
904 tests := []struct {
905 name string
906 args args
907 wantErr bool
908 }{
909 {
910 name: "VoltApplication_ActivateService",
911 args: args{
912 cntx: context.Background(),
913 deviceID: "test_name",
914 portNo: "test_port",
915 sVlan: of.VlanNone,
916 cVlan: of.VlanAny,
917 tpID: AnyVlan,
918 },
919 },
920 {
921 name: "VoltPortVnet_nil",
922 args: args{
923 cntx: context.Background(),
924 deviceID: "test_name",
925 portNo: "test_port",
926 sVlan: of.VlanNone,
927 cVlan: of.VlanAny,
928 tpID: AnyVlan,
929 },
930 },
931 {
932 name: GetDeviceFromPort_error,
933 args: args{
934 cntx: context.Background(),
935 deviceID: "test_name",
936 portNo: "test_port",
937 sVlan: of.VlanNone,
938 cVlan: of.VlanAny,
939 tpID: AnyVlan,
940 },
941 },
942 }
943 for _, tt := range tests {
944 t.Run(tt.name, func(t *testing.T) {
945 va := &VoltApplication{
946 DevicesDisc: sync.Map{},
947 }
948 var voltPortTest = &VoltPort{
949 Name: "test_name",
950 State: PortStateUp,
951 }
952 voltServiceTest := &VoltService{
953 VoltServiceOper: VoltServiceOper{
954 Device: test_device,
955 },
956 Version: "test_version",
957 VoltServiceCfg: VoltServiceCfg{
958 Port: "test_port",
959 Name: "test_name",
960 IsActivated: false,
961 CVlan: of.VlanAny,
962 SVlan: of.VlanAny,
963 UniVlan: of.VlanAny,
964 },
965 }
966 switch tt.name {
967 case "VoltApplication_ActivateService":
968 voltPortTest.Device = test_device
969 va.PortsDisc.Store("test_port", voltPortTest)
970 va.DevicesDisc.Store(test_device, voltDevice)
971 va.ServiceByName.Store("test_name", voltServiceTest)
972 va.VnetsByPort.Store("test_port", voltPortVnet1)
973 voltDevice.Ports.Store("test_port", voltPortTest)
974 dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
975 db = dbintf
976 dbintf.EXPECT().PutService(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
977 if err := va.ActivateService(tt.args.cntx, tt.args.deviceID, tt.args.portNo, tt.args.sVlan, tt.args.cVlan, tt.args.tpID); (err != nil) != tt.wantErr {
978 t.Errorf("VoltApplication.ActivateService() error = %v, wantErr %v", err, tt.wantErr)
979 }
980 case "VoltPortVnet_nil":
981 voltPortTest.Device = test_device
982 va.ServiceByName.Store("test_name", voltServiceTest)
983 va.PortsDisc.Store("test_port", voltPortTest)
984 dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
985 db = dbintf
986 dbintf.EXPECT().PutService(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
987 va.DevicesDisc.Store(test_device, voltDevice)
988 voltDevice.Ports.Store("test_port", voltPortTest)
989 if err := va.ActivateService(tt.args.cntx, tt.args.deviceID, tt.args.portNo, tt.args.sVlan, tt.args.cVlan, tt.args.tpID); (err != nil) != tt.wantErr {
990 t.Errorf("VoltApplication.ActivateService() error = %v, wantErr %v", err, tt.wantErr)
991 }
992 case GetDeviceFromPort_error:
993 err := va.ActivateService(tt.args.cntx, tt.args.deviceID, tt.args.portNo, tt.args.sVlan, tt.args.cVlan, tt.args.tpID)
994 assert.NotNil(t, err)
995 }
996 })
997 }
998}
999
1000func TestVoltApplication_GetProgrammedSubscribers(t *testing.T) {
1001 type args struct {
1002 cntx context.Context
1003 deviceID string
1004 portNo string
1005 }
1006 tests := []struct {
1007 name string
1008 args args
1009 want []*VoltService
1010 wantErr bool
1011 }{
1012 {
1013 name: "VoltApplication_GetProgrammedSubscribers",
1014 args: args{
1015 cntx: context.Background(),
1016 deviceID: test_device,
1017 portNo: "test_port",
1018 },
1019 },
1020 {
1021 name: "portNo_nil",
1022 args: args{
1023 cntx: context.Background(),
1024 deviceID: test_device,
1025 },
1026 },
1027 {
1028 name: "deviceID_nil",
1029 args: args{
1030 cntx: context.Background(),
1031 },
1032 },
1033 }
1034 for _, tt := range tests {
1035 t.Run(tt.name, func(t *testing.T) {
1036 va := &VoltApplication{
1037 vendorID: "test_vendor",
1038 }
1039 voltServiceTest := &VoltService{
1040 VoltServiceOper: VoltServiceOper{
1041 Device: test_device,
1042 },
1043 Version: "test_version",
1044 VoltServiceCfg: VoltServiceCfg{
1045 Port: "test_port",
1046 Name: "test_name",
1047 IsActivated: false,
1048 CVlan: of.VlanAny,
1049 SVlan: of.VlanAny,
1050 UniVlan: of.VlanAny,
1051 },
1052 }
1053 switch tt.name {
1054 case "VoltApplication_GetProgrammedSubscribers":
1055 va.ServiceByName.Store("test_name", voltServiceTest)
1056 got, err := va.GetProgrammedSubscribers(tt.args.cntx, tt.args.deviceID, tt.args.portNo)
1057 assert.NotNil(t, got)
1058 assert.Nil(t, err)
1059 case "portNo_nil":
1060 va.ServiceByName.Store("test_name", voltServiceTest)
1061 got, err := va.GetProgrammedSubscribers(tt.args.cntx, tt.args.deviceID, tt.args.portNo)
1062 assert.NotNil(t, got)
1063 assert.Nil(t, err)
1064 case "deviceID_nil":
1065 va.ServiceByName.Store("test_name", voltServiceTest)
1066 got, err := va.GetProgrammedSubscribers(tt.args.cntx, tt.args.deviceID, tt.args.portNo)
1067 assert.NotNil(t, got)
1068 assert.Nil(t, err)
1069 }
1070 })
1071 }
1072}
1073
1074func TestVoltService_JSONMarshal(t *testing.T) {
1075 tests := []struct {
1076 name string
1077 }{
1078 {
1079 name: "VoltService_JSONMarshal",
1080 },
1081 }
1082 for _, tt := range tests {
1083 t.Run(tt.name, func(t *testing.T) {
1084 vs := &VoltService{
1085 VoltServiceOper: VoltServiceOper{
1086 Device: test_device,
1087 },
1088 Version: "test_version",
1089 VoltServiceCfg: VoltServiceCfg{
1090 Name: "test_name",
1091 },
1092 }
1093 got, err := vs.JSONMarshal()
1094 assert.NotNil(t, got)
1095 assert.Nil(t, err)
1096 })
1097 }
1098}
1099
1100func TestVoltService_triggerServiceInProgressInd(t *testing.T) {
1101 tests := []struct {
1102 name string
1103 }{
1104 {
1105 name: "VoltService_triggerServiceInProgressInd",
1106 },
1107 }
1108 for _, tt := range tests {
1109 t.Run(tt.name, func(t *testing.T) {
1110 vs := &VoltService{
1111 Version: "test_version",
1112 }
1113 vs.triggerServiceInProgressInd()
1114 })
1115 }
1116}
1117
1118func TestVoltService_TriggerAssociatedFlowDelete(t *testing.T) {
1119 type args struct {
1120 cntx context.Context
1121 }
1122 tests := []struct {
1123 name string
1124 args args
1125 want bool
1126 }{
1127 {
1128 name: "VoltService_TriggerAssociatedFlowDelete",
1129 args: args{
1130 cntx: context.Background(),
1131 },
1132 want: true,
1133 },
1134 {
1135 name: "cookieList_nil",
1136 args: args{
1137 cntx: context.Background(),
1138 },
1139 want: false,
1140 },
1141 }
1142 associatedFlows := map[string]bool{}
1143 associatedFlows["5765317"] = true
1144 for _, tt := range tests {
1145 t.Run(tt.name, func(t *testing.T) {
1146 switch tt.name {
1147 case "VoltService_TriggerAssociatedFlowDelete":
1148 vs := &VoltService{
1149 VoltServiceOper: VoltServiceOper{
1150 UsHSIAFlowsApplied: true,
1151 DsHSIAFlowsApplied: true,
1152 AssociatedFlows: associatedFlows,
1153 Device: test_device,
1154 },
1155 }
1156 ga := GetApplication()
1157 ga.DevicesDisc.Store(test_device, voltDevice)
1158 if got := vs.TriggerAssociatedFlowDelete(tt.args.cntx); got != tt.want {
1159 t.Errorf("VoltService.TriggerAssociatedFlowDelete() = %v, want %v", got, tt.want)
1160 }
1161 case "cookieList_nil":
1162 vs := &VoltService{
1163 VoltServiceOper: VoltServiceOper{
1164 UsHSIAFlowsApplied: true,
1165 DsHSIAFlowsApplied: true,
1166 Device: test_device,
1167 },
1168 }
1169 ga := GetApplication()
1170 ga.DevicesDisc.Store(test_device, voltDevice)
1171 if got := vs.TriggerAssociatedFlowDelete(tt.args.cntx); got != tt.want {
1172 t.Errorf("VoltService.TriggerAssociatedFlowDelete() = %v, want %v", got, tt.want)
1173 }
1174 }
1175 })
1176 }
1177}
1178
1179func TestVoltApplication_DeepEqualServicecfg(t *testing.T) {
1180 type args struct {
1181 evs *VoltServiceCfg
1182 nvs *VoltServiceCfg
1183 }
1184 a := map[int]int{}
1185 a[0] = 0
1186 tests := []struct {
1187 name string
1188 args args
1189 want bool
1190 }{
1191 {
1192 name: "VoltApplication_DeepEqualServicecfg",
1193 args: args{
1194 evs: &VoltServiceCfg{
1195 Port: "test_port",
1196 },
1197 nvs: &VoltServiceCfg{
1198 Port: "test_port",
1199 },
1200 },
1201 want: true,
1202 },
1203 {
1204 name: "nvs.Name != evs.Name",
1205 args: args{
1206 evs: &VoltServiceCfg{
1207 Name: "test_name",
1208 },
1209 nvs: &VoltServiceCfg{
1210 Port: "test_port",
1211 },
1212 },
1213 want: false,
1214 },
1215 {
1216 name: "nvs.UniVlan != evs.UniVlan",
1217 args: args{
1218 evs: &VoltServiceCfg{
1219 UniVlan: of.VlanAny,
1220 },
1221 nvs: &VoltServiceCfg{
1222 Port: "test_port",
1223 },
1224 },
1225 want: false,
1226 },
1227 {
1228 name: "nvs.CVlan != evs.CVlan",
1229 args: args{
1230 evs: &VoltServiceCfg{
1231 CVlan: of.VlanAny,
1232 },
1233 nvs: &VoltServiceCfg{
1234 Port: "test_port",
1235 },
1236 },
1237 want: false,
1238 },
1239 {
1240 name: "nvs.SVlan != evs.SVlan",
1241 args: args{
1242 evs: &VoltServiceCfg{
1243 SVlan: of.VlanAny,
1244 },
1245 nvs: &VoltServiceCfg{
1246 Port: "test_port",
1247 },
1248 },
1249 want: false,
1250 },
1251 {
1252 name: "nvs.SVlanTpid != 0",
1253 args: args{
1254 evs: &VoltServiceCfg{
1255 SVlanTpid: layers.EthernetTypeARP,
1256 },
1257 nvs: &VoltServiceCfg{
1258 SVlanTpid: layers.EthernetTypeCiscoDiscovery,
1259 },
1260 },
1261 want: false,
1262 },
1263 {
1264 name: "nvs.Pbits != evs.Pbits",
1265 args: args{
1266 evs: &VoltServiceCfg{
1267 Pbits: []of.PbitType{
1268 PbitMatchAll,
1269 },
1270 },
1271 nvs: &VoltServiceCfg{
1272 Port: "test_port",
1273 },
1274 },
1275 want: false,
1276 },
1277 {
1278 name: "nvs.DsRemarkPbitsMap != evs.DsRemarkPbitsMap",
1279 args: args{
1280 evs: &VoltServiceCfg{
1281 DsRemarkPbitsMap: a,
1282 },
1283 nvs: &VoltServiceCfg{
1284 Port: "test_port",
1285 },
1286 },
1287 want: false,
1288 },
1289 {
1290 name: "nvs.TechProfileID != evs.TechProfileID",
1291 args: args{
1292 evs: &VoltServiceCfg{
1293 TechProfileID: uint16(1),
1294 },
1295 nvs: &VoltServiceCfg{
1296 Port: "test_port",
1297 },
1298 },
1299 want: false,
1300 },
1301 {
1302 name: "nvs.CircuitID != evs.CircuitID",
1303 args: args{
1304 evs: &VoltServiceCfg{
1305 CircuitID: "test_circuit_id",
1306 },
1307 nvs: &VoltServiceCfg{
1308 Port: "test_port",
1309 },
1310 },
1311 want: false,
1312 },
1313 {
1314 name: "nvs.RemoteID != evs.RemoteID",
1315 args: args{
1316 evs: &VoltServiceCfg{
1317 RemoteID: []byte{1},
1318 },
1319 nvs: &VoltServiceCfg{
1320 Port: "test_port",
1321 },
1322 },
1323 want: false,
1324 },
1325 {
1326 name: "nvs.Port != evs.Port",
1327 args: args{
1328 evs: &VoltServiceCfg{},
1329 nvs: &VoltServiceCfg{
1330 Port: "test_port",
1331 },
1332 },
1333 want: false,
1334 },
1335 {
1336 name: "nvs.PonPort != evs.PonPort",
1337 args: args{
1338 evs: &VoltServiceCfg{},
1339 nvs: &VoltServiceCfg{
1340 PonPort: uint32(1),
1341 },
1342 },
1343 want: false,
1344 },
1345 {
1346 name: "evs.MacLearning == MacLearningNone",
1347 args: args{
1348 evs: &VoltServiceCfg{
1349 MacAddr: layers.EthernetBroadcast,
1350 },
1351 nvs: &VoltServiceCfg{},
1352 },
1353 want: false,
1354 },
1355 {
1356 name: "nvs.IgmpEnabled != evs.IgmpEnabled",
1357 args: args{
1358 evs: &VoltServiceCfg{
1359 IgmpEnabled: true,
1360 },
1361 nvs: &VoltServiceCfg{},
1362 },
1363 want: false,
1364 },
1365 {
1366 name: "nvs.McastService != evs.McastService",
1367 args: args{
1368 evs: &VoltServiceCfg{
1369 McastService: true,
1370 },
1371 nvs: &VoltServiceCfg{},
1372 },
1373 want: false,
1374 },
1375 {
1376 name: "nvs.ONTEtherTypeClassification != evs.ONTEtherTypeClassification",
1377 args: args{
1378 evs: &VoltServiceCfg{
1379 ONTEtherTypeClassification: 1,
1380 },
1381 nvs: &VoltServiceCfg{},
1382 },
1383 want: false,
1384 },
1385 {
1386 name: "nvs.UsMeterProfile != evs.UsMeterProfile",
1387 args: args{
1388 evs: &VoltServiceCfg{
1389 UsMeterProfile: "UsMeterProfile",
1390 },
1391 nvs: &VoltServiceCfg{},
1392 },
1393 want: false,
1394 },
1395 {
1396 name: "nvs.DsMeterProfile != evs.DsMeterProfile",
1397 args: args{
1398 evs: &VoltServiceCfg{
1399 DsMeterProfile: "DsMeterProfile",
1400 },
1401 nvs: &VoltServiceCfg{},
1402 },
1403 want: false,
1404 },
1405 {
1406 name: "nvs.AggDsMeterProfile != evs.AggDsMeterProfile",
1407 args: args{
1408 evs: &VoltServiceCfg{
1409 AggDsMeterProfile: "AggDsMeterProfile",
1410 },
1411 nvs: &VoltServiceCfg{},
1412 },
1413 want: false,
1414 },
1415 {
1416 name: "nvs.VnetID != evs.VnetID",
1417 args: args{
1418 evs: &VoltServiceCfg{
1419 VnetID: "VnetID",
1420 },
1421 nvs: &VoltServiceCfg{},
1422 },
1423 want: false,
1424 },
1425 {
1426 name: "nvs.MvlanProfileName != evs.MvlanProfileName",
1427 args: args{
1428 evs: &VoltServiceCfg{
1429 MvlanProfileName: "MvlanProfileName",
1430 },
1431 nvs: &VoltServiceCfg{},
1432 },
1433 want: false,
1434 },
1435 {
1436 name: "nvs.RemoteIDType != evs.RemoteIDType",
1437 args: args{
1438 evs: &VoltServiceCfg{
1439 RemoteIDType: "RemoteIDType",
1440 },
1441 nvs: &VoltServiceCfg{},
1442 },
1443 want: false,
1444 },
1445 {
1446 name: "nvs.SchedID != evs.SchedID",
1447 args: args{
1448 evs: &VoltServiceCfg{
1449 SchedID: 1,
1450 },
1451 nvs: &VoltServiceCfg{},
1452 },
1453 want: false,
1454 },
1455 {
1456 name: "nvs.AllowTransparent != evs.AllowTransparent",
1457 args: args{
1458 evs: &VoltServiceCfg{
1459 AllowTransparent: true,
1460 },
1461 nvs: &VoltServiceCfg{},
1462 },
1463 want: false,
1464 },
1465 {
1466 name: "nvs.EnableMulticastKPI != evs.EnableMulticastKPI",
1467 args: args{
1468 evs: &VoltServiceCfg{
1469 EnableMulticastKPI: true,
1470 },
1471 nvs: &VoltServiceCfg{},
1472 },
1473 want: false,
1474 },
1475 {
1476 name: "nvs.DataRateAttr != evs.DataRateAttr",
1477 args: args{
1478 evs: &VoltServiceCfg{
1479 DataRateAttr: "DataRateAttr",
1480 },
1481 nvs: &VoltServiceCfg{},
1482 },
1483 want: false,
1484 },
1485 {
1486 name: "nvs.MinDataRateUs != evs.MinDataRateUs",
1487 args: args{
1488 evs: &VoltServiceCfg{
1489 MinDataRateUs: uint32(1),
1490 },
1491 nvs: &VoltServiceCfg{},
1492 },
1493 want: false,
1494 },
1495 {
1496 name: "nvs.MinDataRateDs != evs.MinDataRateDs",
1497 args: args{
1498 evs: &VoltServiceCfg{
1499 MinDataRateDs: uint32(1),
1500 },
1501 nvs: &VoltServiceCfg{},
1502 },
1503 want: false,
1504 },
1505 {
1506 name: "nvs.MaxDataRateUs != evs.MaxDataRateUs",
1507 args: args{
1508 evs: &VoltServiceCfg{
1509 MaxDataRateUs: uint32(1),
1510 },
1511 nvs: &VoltServiceCfg{},
1512 },
1513 want: false,
1514 },
1515 {
1516 name: "nvs.MaxDataRateDs != evs.MaxDataRateDs",
1517 args: args{
1518 evs: &VoltServiceCfg{
1519 MaxDataRateDs: uint32(1),
1520 },
1521 nvs: &VoltServiceCfg{},
1522 },
1523 want: false,
1524 },
1525 }
1526 for _, tt := range tests {
1527 t.Run(tt.name, func(t *testing.T) {
1528 va := &VoltApplication{
1529 vendorID: "test_vendor_id",
1530 }
1531 switch tt.name {
1532 case "VoltApplication_DeepEqualServicecfg", "nvs.Name != evs.Name", "nvs.UniVlan != evs.UniVlan",
1533 "nvs.CVlan != evs.CVlan", "nvs.SVlan != evs.SVlan", "nvs.SVlanTpid != 0", "nvs.Pbits != evs.Pbits",
1534 "nvs.DsRemarkPbitsMap != evs.DsRemarkPbitsMap", "nvs.TechProfileID != evs.TechProfileID",
1535 "nvs.CircuitID != evs.CircuitID", "nvs.RemoteID != evs.RemoteID", "nvs.Port != evs.Port",
1536 "evs.MacLearning == MacLearningNone", "nvs.PonPort != evs.PonPort", "nvs.IgmpEnabled != evs.IgmpEnabled",
1537 "nvs.McastService != evs.McastService", "nvs.ONTEtherTypeClassification != evs.ONTEtherTypeClassification",
1538 "nvs.UsMeterProfile != evs.UsMeterProfile",
1539 "nvs.DsMeterProfile != evs.DsMeterProfile", "nvs.AggDsMeterProfile != evs.AggDsMeterProfile",
1540 "nvs.VnetID != evs.VnetID", "nvs.MvlanProfileName != evs.MvlanProfileName",
1541 "nvs.RemoteIDType != evs.RemoteIDType", "nvs.SchedID != evs.SchedID",
1542 "nvs.AllowTransparent != evs.AllowTransparent",
1543 "nvs.EnableMulticastKPI != evs.EnableMulticastKPI", "nvs.DataRateAttr != evs.DataRateAttr",
1544 "nvs.MinDataRateUs != evs.MinDataRateUs", "nvs.MinDataRateDs != evs.MinDataRateDs",
1545 "nvs.MaxDataRateUs != evs.MaxDataRateUs", "nvs.MaxDataRateDs != evs.MaxDataRateDs":
1546 if got := va.DeepEqualServicecfg(tt.args.evs, tt.args.nvs); got != tt.want {
1547 t.Errorf("VoltApplication.DeepEqualServicecfg() = %v, want %v", got, tt.want)
1548 }
1549 }
1550 })
1551 }
1552}