vgc unit tests part 3

Change-Id: Id87302102ea05fc99083842e3fc9ebab4304e2ca
diff --git a/internal/pkg/application/application_test.go b/internal/pkg/application/application_test.go
index 7670e3b..15071e3 100644
--- a/internal/pkg/application/application_test.go
+++ b/internal/pkg/application/application_test.go
@@ -100,7 +100,7 @@
 				test := map[string]*kvstore.KVPair{}
 				test["test_device_id"] = &kvstore.KVPair{
 					Key:   "test_device_id",
-					Value: "invalid_value",
+					Value: invalid_value,
 				}
 				dbintf.EXPECT().GetAllNbPorts(gomock.Any(), gomock.Any()).Return(test, nil).Times(1)
 				got := va.RestoreNbDeviceFromDb(tt.args.cntx, tt.args.deviceID)
diff --git a/internal/pkg/application/meters_test.go b/internal/pkg/application/meters_test.go
new file mode 100644
index 0000000..325dd9c
--- /dev/null
+++ b/internal/pkg/application/meters_test.go
@@ -0,0 +1,422 @@
+/*
+* Copyright 2022-present Open Networking Foundation
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+ */
+
+package application
+
+import (
+	"context"
+	"encoding/json"
+	"errors"
+	"testing"
+	cntlr "voltha-go-controller/internal/pkg/controller"
+	"voltha-go-controller/internal/test/mocks"
+
+	"github.com/golang/mock/gomock"
+	"github.com/opencord/voltha-lib-go/v7/pkg/db/kvstore"
+	"github.com/stretchr/testify/assert"
+)
+
+var vm = &VoltMeter{
+	Name:    "test_name",
+	Version: "test_version",
+}
+var write_to_db_error = "WriteToDb_error"
+var invalid_value = "invalid_value"
+
+func TestVoltApplication_DelMeterProf(t *testing.T) {
+	type args struct {
+		cntx context.Context
+		name string
+	}
+	tests := []struct {
+		name    string
+		args    args
+		wantErr bool
+	}{
+		{
+			name: "VoltApplication_DelMeterProf",
+			args: args{
+				cntx: context.Background(),
+				name: "test_name",
+			},
+		},
+		{
+			name: "GetMeterByName_!ok",
+			args: args{
+				cntx: context.Background(),
+				name: "test_name",
+			},
+		},
+		{
+			name: "cfg.AssociatedServices != 0",
+			args: args{
+				cntx: context.Background(),
+				name: "test_name",
+			},
+		},
+		{
+			name: "delmeterFromDevice",
+			args: args{
+				cntx: context.Background(),
+				name: "test_name",
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			va := &VoltApplication{}
+			switch tt.name {
+			case "VoltApplication_DelMeterProf":
+				vm1 := &VoltMeter{
+					Name:    "test_name",
+					Version: "test_version",
+				}
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().DelMeter(tt.args.cntx, tt.args.name).Return(nil).Times(1)
+				va.MeterMgr.Meters.Store("test_name", vm1)
+				if err := va.DelMeterProf(tt.args.cntx, tt.args.name); (err != nil) != tt.wantErr {
+					t.Errorf("VoltApplication.DelMeterProf() error = %v, wantErr %v", err, tt.wantErr)
+				}
+			case "GetMeterByName_!ok":
+				vm2 := &VoltMeter{
+					Name:    "test_name",
+					Version: "test_version",
+				}
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				va.MeterMgr.Meters.Store("test_name1", vm2)
+				err := va.DelMeterProf(tt.args.cntx, tt.args.name)
+				assert.NotNil(t, err)
+			case "cfg.AssociatedServices != 0":
+				vm3 := &VoltMeter{
+					Name:               "test_name",
+					Version:            "test_version",
+					AssociatedServices: 1,
+				}
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				va.MeterMgr.Meters.Store("test_name", vm3)
+				err := va.DelMeterProf(tt.args.cntx, tt.args.name)
+				assert.NotNil(t, err)
+			case "delmeterFromDevice":
+				vd := &VoltDevice{
+					Name: test_device,
+				}
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				_ = cntlr.NewController(context.Background(), mocks.NewMockApp(gomock.NewController(t)))
+				dbintf.EXPECT().DelMeter(tt.args.cntx, tt.args.name).Return(nil).Times(1)
+				va.MeterMgr.Meters.Store("test_name", vm)
+				va.DevicesDisc.Store(test_device, vd)
+				if err := va.DelMeterProf(tt.args.cntx, tt.args.name); (err != nil) != tt.wantErr {
+					t.Errorf("VoltApplication.DelMeterProf() error = %v, wantErr %v", err, tt.wantErr)
+				}
+			}
+		})
+	}
+}
+
+func TestMeterMgr_GetMeterByProfID(t *testing.T) {
+	type args struct {
+		id uint32
+	}
+	tests := []struct {
+		name    string
+		args    args
+		want    *VoltMeter
+		wantErr bool
+	}{
+		{
+			name: "MeterMgr_GetMeterByProfID",
+			args: args{
+				id: uint32(1),
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			m := &MeterMgr{}
+			vm4 := &VoltMeter{
+				Name: "test_name",
+			}
+			m.MetersByID.Store(tt.args.id, vm4)
+			got, err := m.GetMeterByProfID(tt.args.id)
+			if (err != nil) != tt.wantErr {
+				t.Errorf("MeterMgr.GetMeterByProfID() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			assert.NotNil(t, got)
+		})
+	}
+}
+
+func TestVoltApplication_UpdateMeterProf(t *testing.T) {
+	type args struct {
+		cntx context.Context
+		cfg  VoltMeter
+	}
+	tests := []struct {
+		name string
+		args args
+	}{
+		{
+			name: "VoltApplication_UpdateMeterProf",
+			args: args{
+				cntx: context.Background(),
+				cfg: VoltMeter{
+					Name: "test_name",
+				},
+			},
+		},
+		{
+			name: write_to_db_error,
+			args: args{
+				cntx: context.Background(),
+				cfg: VoltMeter{
+					Name: "test_name",
+				},
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			va := &VoltApplication{}
+			switch tt.name {
+			case "VoltApplication_UpdateMeterProf":
+				va.MeterMgr.Meters.Store("test_name", vm)
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().PutMeter(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(1)
+				va.UpdateMeterProf(tt.args.cntx, tt.args.cfg)
+			case write_to_db_error:
+				va.MeterMgr.Meters.Store("test_name", vm)
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().PutMeter(gomock.Any(), gomock.Any(), gomock.Any()).Return(errors.New("error")).Times(1)
+				va.UpdateMeterProf(tt.args.cntx, tt.args.cfg)
+			}
+		})
+	}
+}
+
+func TestVoltApplication_AddMeterProf(t *testing.T) {
+	type args struct {
+		cntx context.Context
+		cfg  VoltMeter
+	}
+	tests := []struct {
+		name string
+		args args
+	}{
+		{
+			name: "VoltApplication_AddMeterProf",
+			args: args{
+				cntx: context.Background(),
+				cfg:  VoltMeter{Name: "test_name"},
+			},
+		},
+		{
+			name: "GetMeterByName_ok",
+			args: args{
+				cntx: context.Background(),
+				cfg:  VoltMeter{Name: "test_name"},
+			},
+		},
+		{
+			name: write_to_db_error,
+			args: args{
+				cntx: context.Background(),
+				cfg:  VoltMeter{Name: "test_name"},
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			va := &VoltApplication{}
+			switch tt.name {
+			case "VoltApplication_AddMeterProf":
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().PutMeter(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(1)
+				va.AddMeterProf(tt.args.cntx, tt.args.cfg)
+			case "GetMeterByName_ok":
+				mm := &va.MeterMgr
+				mm.Meters.Store(tt.args.cfg.Name, vm)
+				va.AddMeterProf(tt.args.cntx, tt.args.cfg)
+			case write_to_db_error:
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().PutMeter(gomock.Any(), gomock.Any(), gomock.Any()).Return(errors.New("error")).Times(1)
+				va.AddMeterProf(tt.args.cntx, tt.args.cfg)
+			}
+		})
+	}
+}
+
+func TestMeterMgr_RestoreMetersFromDb(t *testing.T) {
+	type args struct {
+		cntx context.Context
+	}
+	tests := []struct {
+		name string
+		args args
+	}{
+		{
+			name: "MeterMgr_RestoreMetersFromDb",
+			args: args{
+				cntx: context.Background(),
+			},
+		},
+		{
+			name: invalid_value,
+			args: args{
+				cntx: context.Background(),
+			},
+		},
+		{
+			name: "unmarshal_error",
+			args: args{
+				cntx: context.Background(),
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			m := &MeterMgr{}
+			switch tt.name {
+			case "MeterMgr_RestoreMetersFromDb":
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				vm.ID = uint32(3)
+				m.LastMeterID = uint32(2)
+				b, err := json.Marshal(vm)
+				if err != nil {
+					panic(err)
+				}
+				test := map[string]*kvstore.KVPair{}
+				test["test_device_id"] = &kvstore.KVPair{
+					Key:   "test_device_id",
+					Value: b,
+				}
+				dbintf.EXPECT().GetMeters(gomock.Any()).Return(test, nil).Times(1)
+				m.RestoreMetersFromDb(tt.args.cntx)
+			case invalid_value:
+				test := map[string]*kvstore.KVPair{}
+				test["test_device_id"] = &kvstore.KVPair{
+					Key:   "test_device_id",
+					Value: "test",
+				}
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().GetMeters(gomock.Any()).Return(test, nil).Times(1)
+				m.RestoreMetersFromDb(tt.args.cntx)
+			case "unmarshal_error":
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				vm.ID = uint32(3)
+				m.LastMeterID = uint32(2)
+				b, err := json.Marshal("test")
+				if err != nil {
+					panic(err)
+				}
+				test := map[string]*kvstore.KVPair{}
+				test["test_device_id"] = &kvstore.KVPair{
+					Key:   "test_device_id",
+					Value: b,
+				}
+				dbintf.EXPECT().GetMeters(gomock.Any()).Return(test, nil).Times(1)
+				m.RestoreMetersFromDb(tt.args.cntx)
+			}
+		})
+	}
+}
+
+func TestMeterMgr_AddMeterToDevice(t *testing.T) {
+	type args struct {
+		port       string
+		device     string
+		meterID    uint32
+		aggMeterID uint32
+	}
+	tests := []struct {
+		name string
+		args args
+	}{
+		{
+			name: "MeterMgr_AddMeterToDevice",
+			args: args{
+				port:       "test_port",
+				device:     test_device,
+				meterID:    uint32(3),
+				aggMeterID: uint32(2),
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			m := &MeterMgr{}
+			m.MetersByID.Store(tt.args.meterID, vm)
+			m.AddMeterToDevice(tt.args.port, tt.args.device, tt.args.meterID, tt.args.aggMeterID)
+		})
+	}
+}
+
+func TestVoltMeter_AddToDevice(t *testing.T) {
+	type args struct {
+		port   string
+		device string
+		aggVM  *VoltMeter
+	}
+	tests := []struct {
+		name string
+		args args
+	}{
+		{
+			name: "VoltMeter_AddToDevice",
+			args: args{
+				port:   "test_port",
+				device: test_device,
+			},
+		},
+		{
+			name: "Gir == 0",
+			args: args{
+				port:   "test_port",
+				device: test_device,
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			vm1 := &VoltMeter{}
+			switch tt.name {
+			case "VoltMeter_AddToDevice":
+				vm1.Cir = uint32(1)
+				vm1.Air = uint32(1)
+				vm1.Pir = uint32(1)
+				vm1.Gir = uint32(1)
+				vm1.Pbs = uint32(1)
+				vm1.AddToDevice(tt.args.port, tt.args.device, tt.args.aggVM)
+			case "Gir == 0":
+				vm1.Cir = uint32(1)
+				vm1.Air = uint32(1)
+				vm1.Pir = uint32(1)
+				vm1.Pbs = uint32(1)
+				vm1.AddToDevice(tt.args.port, tt.args.device, tt.args.aggVM)
+			}
+		})
+	}
+}
diff --git a/internal/pkg/application/minor_upgrade_test.go b/internal/pkg/application/minor_upgrade_test.go
new file mode 100644
index 0000000..503fb00
--- /dev/null
+++ b/internal/pkg/application/minor_upgrade_test.go
@@ -0,0 +1,677 @@
+/*
+* Copyright 2022-present Open Networking Foundation
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+ */
+
+package application
+
+import (
+	"context"
+	"encoding/json"
+	"errors"
+	"testing"
+	"voltha-go-controller/internal/test/mocks"
+
+	"github.com/golang/mock/gomock"
+	"github.com/opencord/voltha-lib-go/v7/pkg/db/kvstore"
+)
+
+var Del_error = "Del_error"
+
+func TestUpdateDbData(t *testing.T) {
+	type args struct {
+		cntx   context.Context
+		dbPath string
+		hash   string
+		value  interface{}
+	}
+	val := &VoltVnet{
+		Version: "test_version",
+		VnetConfig: VnetConfig{
+			Name:     "test_name",
+			VnetType: "test_vnet_type",
+		},
+		VnetOper: VnetOper{
+			PendingDeviceToDelete: "test_PendingDeviceToDelete",
+		},
+	}
+	tests := []struct {
+		name    string
+		args    args
+		wantErr bool
+	}{
+		{
+			name: "Update_Db_Data",
+			args: args{
+				cntx:   context.Background(),
+				dbPath: "vnets/",
+				hash:   "test_hash",
+				value:  val,
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+			db = dbintf
+			dbintf.EXPECT().DelVnet(tt.args.cntx, tt.args.hash).Return(nil).Times(1)
+			if err := UpdateDbData(tt.args.cntx, tt.args.dbPath, tt.args.hash, tt.args.value); (err != nil) != tt.wantErr {
+				t.Errorf("UpdateDbData() error = %v, wantErr %v", err, tt.wantErr)
+			}
+		})
+	}
+}
+
+func Test_updateServices(t *testing.T) {
+	type args struct {
+		cntx  context.Context
+		hash  string
+		value interface{}
+	}
+	val := &VoltService{
+		VoltServiceOper: VoltServiceOper{
+			Device: test_device,
+		},
+		Version: "test_version",
+		VoltServiceCfg: VoltServiceCfg{
+			Name: "test_name",
+		},
+	}
+	tests := []struct {
+		name    string
+		args    args
+		wantErr bool
+	}{
+		{
+			name: "updateServices",
+			args: args{
+				cntx:  context.Background(),
+				hash:  "test_hash",
+				value: val,
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if err := updateServices(tt.args.cntx, tt.args.hash, tt.args.value); (err != nil) != tt.wantErr {
+				t.Errorf("updateServices() error = %v, wantErr %v", err, tt.wantErr)
+			}
+		})
+	}
+}
+
+func Test_updateVpvs(t *testing.T) {
+	type args struct {
+		cntx  context.Context
+		hash  string
+		value interface{}
+	}
+	val := &VoltPortVnet{
+		Device: test_device,
+	}
+	tests := []struct {
+		name    string
+		args    args
+		wantErr bool
+	}{
+		{
+			name: "updateVpvs",
+			args: args{
+				cntx:  context.Background(),
+				hash:  "test_hash",
+				value: val,
+			},
+		},
+		{
+			name: "Del error",
+			args: args{
+				cntx:  context.Background(),
+				hash:  "hash-hash1",
+				value: val,
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			switch tt.name {
+			case "updateVpvs":
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().PutVpv(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(1)
+				dbintf.EXPECT().Del(tt.args.cntx, gomock.Any()).Return(nil).Times(1)
+				if err := updateVpvs(tt.args.cntx, tt.args.hash, tt.args.value); (err != nil) != tt.wantErr {
+					t.Errorf("updateVpvs() error = %v, wantErr %v", err, tt.wantErr)
+				}
+			case "Del error":
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().PutVpv(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(1)
+				dbintf.EXPECT().Del(tt.args.cntx, gomock.Any()).Return(errors.New("error")).Times(1)
+				if err := updateVpvs(tt.args.cntx, tt.args.hash, tt.args.value); (err != nil) != tt.wantErr {
+					t.Errorf("updateVpvs() error = %v, wantErr %v", err, tt.wantErr)
+				}
+			}
+		})
+	}
+}
+
+func Test_updateMvlans(t *testing.T) {
+	type args struct {
+		cntx  context.Context
+		hash  string
+		value interface{}
+	}
+	grp := make(map[string]*MvlanGroup)
+	grp["static"] = &MvlanGroup{
+		Name: "test_name",
+	}
+	val := &MvlanProfile{
+		Version: "test_version",
+		Name:    "test_name",
+		Groups:  grp,
+	}
+	tests := []struct {
+		name    string
+		args    args
+		wantErr bool
+	}{
+		{
+			name: "updateMvlans",
+			args: args{
+				cntx:  context.Background(),
+				hash:  "test_hash",
+				value: val,
+			},
+		},
+		{
+			name: write_to_db_error,
+			args: args{
+				cntx:  context.Background(),
+				hash:  "test_hash",
+				value: val,
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			switch tt.name {
+			case "updateMvlans":
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().PutMvlan(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(1)
+				if err := updateMvlans(tt.args.cntx, tt.args.hash, tt.args.value); (err != nil) != tt.wantErr {
+					t.Errorf("updateMvlans() error = %v, wantErr %v", err, tt.wantErr)
+				}
+			case write_to_db_error:
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().PutMvlan(gomock.Any(), gomock.Any(), gomock.Any()).Return(errors.New("error")).Times(1)
+				if err := updateMvlans(tt.args.cntx, tt.args.hash, tt.args.value); (err != nil) != tt.wantErr {
+					t.Errorf("updateMvlans() error = %v, wantErr %v", err, tt.wantErr)
+				}
+			}
+		})
+	}
+}
+
+func Test_updateIgmpGroups(t *testing.T) {
+	type args struct {
+		cntx  context.Context
+		hash  string
+		value interface{}
+	}
+	val := &IgmpGroup{
+		Version: "test_version",
+	}
+	tests := []struct {
+		name    string
+		args    args
+		wantErr bool
+	}{
+		{
+			name: "updateIgmpGroups",
+			args: args{
+				cntx:  context.Background(),
+				hash:  "test_hash",
+				value: val,
+			},
+		},
+		{
+			name: "PutIgmpGroup_error",
+			args: args{
+				cntx:  context.Background(),
+				hash:  "test_hash",
+				value: val,
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			switch tt.name {
+			case "updateIgmpGroups":
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().PutIgmpGroup(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(1)
+				if err := updateIgmpGroups(tt.args.cntx, tt.args.hash, tt.args.value); (err != nil) != tt.wantErr {
+					t.Errorf("updateIgmpGroups() error = %v, wantErr %v", err, tt.wantErr)
+				}
+			case "PutIgmpGroup_error":
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().PutIgmpGroup(gomock.Any(), gomock.Any(), gomock.Any()).Return(errors.New("error")).Times(1)
+				if err := updateIgmpGroups(tt.args.cntx, tt.args.hash, tt.args.value); (err != nil) != tt.wantErr {
+					t.Errorf("updateIgmpGroups() error = %v, wantErr %v", err, tt.wantErr)
+				}
+			}
+		})
+	}
+}
+
+func Test_updateIgmpDevices(t *testing.T) {
+	type args struct {
+		cntx  context.Context
+		hash  string
+		value interface{}
+	}
+	val := &IgmpGroupDevice{
+		Device: test_device,
+	}
+	tests := []struct {
+		name    string
+		args    args
+		wantErr bool
+	}{
+		{
+			name: "updateIgmpDevices",
+			args: args{
+				cntx:  context.Background(),
+				hash:  "test_hash",
+				value: val,
+			},
+		},
+		{
+			name: "PutIgmpDevice_error",
+			args: args{
+				cntx:  context.Background(),
+				hash:  "test_hash",
+				value: val,
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			switch tt.name {
+			case "updateIgmpDevices":
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().PutIgmpDevice(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(1)
+				if err := updateIgmpDevices(tt.args.cntx, tt.args.hash, tt.args.value); (err != nil) != tt.wantErr {
+					t.Errorf("updateIgmpDevices() error = %v, wantErr %v", err, tt.wantErr)
+				}
+			case "PutIgmpDevice_error":
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().PutIgmpDevice(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(errors.New("error")).Times(1)
+				if err := updateIgmpDevices(tt.args.cntx, tt.args.hash, tt.args.value); (err != nil) != tt.wantErr {
+					t.Errorf("updateIgmpDevices() error = %v, wantErr %v", err, tt.wantErr)
+				}
+			}
+		})
+	}
+}
+
+func Test_updateIgmpProfiles(t *testing.T) {
+	type args struct {
+		cntx  context.Context
+		hash  string
+		value interface{}
+	}
+	val := &IgmpProfile{
+		ProfileID: "test_profile_id",
+	}
+	tests := []struct {
+		name    string
+		args    args
+		wantErr bool
+	}{
+		{
+			name: "updateIgmpProfiles",
+			args: args{
+				cntx:  context.Background(),
+				hash:  "test_hash",
+				value: val,
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if err := updateIgmpProfiles(tt.args.cntx, tt.args.hash, tt.args.value); (err != nil) != tt.wantErr {
+				t.Errorf("updateIgmpProfiles() error = %v, wantErr %v", err, tt.wantErr)
+			}
+		})
+	}
+}
+
+func TestIgmpGroup_migrateIgmpDevices(t *testing.T) {
+	type args struct {
+		cntx context.Context
+	}
+	tests := []struct {
+		name string
+		args args
+	}{
+		{
+			name: "IgmpGroup_migrateIgmpDevices",
+			args: args{
+				cntx: context.Background(),
+			},
+		},
+		{
+			name: invalid_value,
+			args: args{
+				cntx: context.Background(),
+			},
+		},
+		{
+			name: Del_error,
+			args: args{
+				cntx: context.Background(),
+			},
+		},
+		{
+			name: "NewIgmpGroupDeviceFromBytes_error",
+			args: args{
+				cntx: context.Background(),
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			ig := &IgmpGroup{}
+			switch tt.name {
+			case "IgmpGroup_migrateIgmpDevices":
+				val := &IgmpGroupDevice{
+					Device: test_device,
+				}
+				b, err := json.Marshal(val)
+				if err != nil {
+					panic(err)
+				}
+				test := map[string]*kvstore.KVPair{}
+				test["test_device_id"] = &kvstore.KVPair{
+					Key:   "test_device_id",
+					Value: b,
+				}
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().GetPrevIgmpDevices(gomock.Any(), gomock.Any(), gomock.Any()).Return(test, nil).Times(1)
+				dbintf.EXPECT().Del(tt.args.cntx, gomock.Any()).Return(nil).Times(1)
+				dbintf.EXPECT().PutIgmpDevice(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(1)
+				ig.migrateIgmpDevices(tt.args.cntx)
+			case invalid_value:
+				test := map[string]*kvstore.KVPair{}
+				test["test_device_id"] = &kvstore.KVPair{
+					Key:   "test_device_id",
+					Value: "invalid",
+				}
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().GetPrevIgmpDevices(gomock.Any(), gomock.Any(), gomock.Any()).Return(test, nil).Times(1)
+				ig.migrateIgmpDevices(tt.args.cntx)
+			case Del_error:
+				val := &IgmpGroupDevice{
+					Device: test_device,
+				}
+				b, err := json.Marshal(val)
+				if err != nil {
+					panic(err)
+				}
+				test := map[string]*kvstore.KVPair{}
+				test["test_device_id"] = &kvstore.KVPair{
+					Key:   "test_device_id",
+					Value: b,
+				}
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().GetPrevIgmpDevices(gomock.Any(), gomock.Any(), gomock.Any()).Return(test, nil).Times(1)
+				dbintf.EXPECT().Del(tt.args.cntx, gomock.Any()).Return(errors.New("error")).Times(1)
+				dbintf.EXPECT().PutIgmpDevice(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(1)
+				ig.migrateIgmpDevices(tt.args.cntx)
+			case "NewIgmpGroupDeviceFromBytes_error":
+				b, err := json.Marshal("test")
+				if err != nil {
+					panic(err)
+				}
+				test := map[string]*kvstore.KVPair{}
+				test["test_device_id"] = &kvstore.KVPair{
+					Key:   "test_device_id",
+					Value: b,
+				}
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().GetPrevIgmpDevices(gomock.Any(), gomock.Any(), gomock.Any()).Return(test, nil).Times(1)
+				ig.migrateIgmpDevices(tt.args.cntx)
+			}
+		})
+	}
+}
+
+func TestIgmpGroupDevice_migrateIgmpChannels(t *testing.T) {
+	type args struct {
+		cntx context.Context
+	}
+	tests := []struct {
+		name string
+		args args
+	}{
+		{
+			name: "IgmpGroupDevice_migrateIgmpChannels",
+			args: args{
+				cntx: context.Background(),
+			},
+		},
+		{
+			name: invalid_value,
+			args: args{
+				cntx: context.Background(),
+			},
+		},
+		{
+			name: Del_error,
+			args: args{
+				cntx: context.Background(),
+			},
+		},
+		{
+			name: "NewIgmpGroupChannelFromBytes_error",
+			args: args{
+				cntx: context.Background(),
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			igd := &IgmpGroupDevice{}
+			switch tt.name {
+			case "IgmpGroupDevice_migrateIgmpChannels":
+				val := IgmpGroupChannel{
+					Device: test_device,
+				}
+				b, err := json.Marshal(val)
+				if err != nil {
+					panic(err)
+				}
+				test := map[string]*kvstore.KVPair{}
+				test["test_device_id"] = &kvstore.KVPair{
+					Key:   "test_device_id",
+					Value: b,
+				}
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().GetPrevIgmpChannels(gomock.Any(), gomock.Any(), gomock.Any()).Return(test, nil).Times(1)
+				dbintf.EXPECT().Del(tt.args.cntx, gomock.Any()).Return(nil).Times(1)
+				dbintf.EXPECT().PutIgmpChannel(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(1)
+				igd.migrateIgmpChannels(tt.args.cntx)
+			case invalid_value:
+				test := map[string]*kvstore.KVPair{}
+				test["test_device_id"] = &kvstore.KVPair{
+					Key:   "test_device_id",
+					Value: "invalid",
+				}
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().GetPrevIgmpChannels(gomock.Any(), gomock.Any(), gomock.Any()).Return(test, nil).Times(1)
+				igd.migrateIgmpChannels(tt.args.cntx)
+			case Del_error:
+				val := IgmpGroupChannel{
+					Device: test_device,
+				}
+				b, err := json.Marshal(val)
+				if err != nil {
+					panic(err)
+				}
+				test := map[string]*kvstore.KVPair{}
+				test["test_device_id"] = &kvstore.KVPair{
+					Key:   "test_device_id",
+					Value: b,
+				}
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().GetPrevIgmpChannels(gomock.Any(), gomock.Any(), gomock.Any()).Return(test, nil).Times(1)
+				dbintf.EXPECT().Del(tt.args.cntx, gomock.Any()).Return(errors.New("error")).Times(1)
+				dbintf.EXPECT().PutIgmpChannel(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(errors.New("error")).Times(1)
+				igd.migrateIgmpChannels(tt.args.cntx)
+			case "NewIgmpGroupChannelFromBytes_error":
+				b, err := json.Marshal("test")
+				if err != nil {
+					panic(err)
+				}
+				test := map[string]*kvstore.KVPair{}
+				test["test_device_id"] = &kvstore.KVPair{
+					Key:   "test_device_id",
+					Value: b,
+				}
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().GetPrevIgmpChannels(gomock.Any(), gomock.Any(), gomock.Any()).Return(test, nil).Times(1)
+				igd.migrateIgmpChannels(tt.args.cntx)
+			}
+		})
+	}
+}
+
+func TestIgmpGroupChannel_migrateIgmpPorts(t *testing.T) {
+	type args struct {
+		cntx context.Context
+	}
+	tests := []struct {
+		name string
+		args args
+	}{
+		{
+			name: "IgmpGroupChannel_migrateIgmpPorts",
+			args: args{
+				cntx: context.Background(),
+			},
+		},
+		{
+			name: invalid_value,
+			args: args{
+				cntx: context.Background(),
+			},
+		},
+		{
+			name: Del_error,
+			args: args{
+				cntx: context.Background(),
+			},
+		},
+		{
+			name: "NewIgmpGroupPortFromBytes_error",
+			args: args{
+				cntx: context.Background(),
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			igc := &IgmpGroupChannel{}
+			switch tt.name {
+			case "IgmpGroupChannel_migrateIgmpPorts":
+				val := IgmpGroupPort{
+					Port: "test_port",
+				}
+				b, err := json.Marshal(val)
+				if err != nil {
+					panic(err)
+				}
+				test := map[string]*kvstore.KVPair{}
+				test["test_device_id"] = &kvstore.KVPair{
+					Key:   "test_device_id",
+					Value: b,
+				}
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().GetPrevIgmpRcvrs(gomock.Any(), gomock.Any(), gomock.Any()).Return(test, nil).Times(1)
+				dbintf.EXPECT().Del(tt.args.cntx, gomock.Any()).Return(nil).Times(1)
+				dbintf.EXPECT().PutIgmpRcvr(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(1)
+				igc.migrateIgmpPorts(tt.args.cntx)
+			case invalid_value:
+				test := map[string]*kvstore.KVPair{}
+				test["test_device_id"] = &kvstore.KVPair{
+					Key:   "test_device_id",
+					Value: "invalid",
+				}
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().GetPrevIgmpRcvrs(gomock.Any(), gomock.Any(), gomock.Any()).Return(test, nil).Times(1)
+				igc.migrateIgmpPorts(tt.args.cntx)
+			case Del_error:
+				val := IgmpGroupPort{
+					Port: "test_port",
+				}
+				b, err := json.Marshal(val)
+				if err != nil {
+					panic(err)
+				}
+				test := map[string]*kvstore.KVPair{}
+				test["test_device_id"] = &kvstore.KVPair{
+					Key:   "test_device_id",
+					Value: b,
+				}
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().GetPrevIgmpRcvrs(gomock.Any(), gomock.Any(), gomock.Any()).Return(test, nil).Times(1)
+				dbintf.EXPECT().Del(tt.args.cntx, gomock.Any()).Return(errors.New("error")).Times(1)
+				dbintf.EXPECT().PutIgmpRcvr(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(errors.New("error")).Times(1)
+				igc.migrateIgmpPorts(tt.args.cntx)
+			case "NewIgmpGroupPortFromBytes_error":
+				b, err := json.Marshal("invalid")
+				if err != nil {
+					panic(err)
+				}
+				test := map[string]*kvstore.KVPair{}
+				test["test_device_id"] = &kvstore.KVPair{
+					Key:   "test_device_id",
+					Value: b,
+				}
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().GetPrevIgmpRcvrs(gomock.Any(), gomock.Any(), gomock.Any()).Return(test, nil).Times(1)
+				// dbintf.EXPECT().Del(tt.args.cntx, gomock.Any()).Return(nil).Times(1)
+				// dbintf.EXPECT().PutIgmpRcvr(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(1)
+				igc.migrateIgmpPorts(tt.args.cntx)
+			}
+		})
+	}
+}
diff --git a/internal/pkg/application/service_test.go b/internal/pkg/application/service_test.go
index 1c66cb6..21bc49d 100644
--- a/internal/pkg/application/service_test.go
+++ b/internal/pkg/application/service_test.go
@@ -164,7 +164,7 @@
 				kvPair := map[string]*kvstore.KVPair{}
 				kvPair["key"] = &kvstore.KVPair{
 					Key:     "test_key",
-					Value:   "invalid_value",
+					Value:   invalid_value,
 					Version: 1,
 				}
 				dbintf.EXPECT().GetServices(tt.args.cntx).Return(kvPair, nil).Times(1)
@@ -1862,7 +1862,7 @@
 			kvpair := map[string]*kvstore.KVPair{}
 			kvpair["test_device_id"] = &kvstore.KVPair{
 				Key:   "test_device_id",
-				Value: "invalid_value",
+				Value: invalid_value,
 			}
 			dbintf.EXPECT().GetAllMigrateServicesReq(gomock.Any(), gomock.Any()).Return(kvpair, nil).AnyTimes()
 			va.FetchAndProcessAllMigrateServicesReq(tt.args.cntx, tt.args.device, tt.args.msrAction)
diff --git a/internal/pkg/application/util_test.go b/internal/pkg/application/util_test.go
new file mode 100644
index 0000000..74774d9
--- /dev/null
+++ b/internal/pkg/application/util_test.go
@@ -0,0 +1,89 @@
+/*
+* Copyright 2022-present Open Networking Foundation
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+ */
+
+package application
+
+import (
+	"testing"
+
+	"github.com/google/gopacket/layers"
+)
+
+func TestGetMetadataForL2Protocol(t *testing.T) {
+	type args struct {
+		etherType layers.EthernetType
+	}
+	tests := []struct {
+		name    string
+		args    args
+		want    uint8
+		wantErr bool
+	}{
+		{
+			name: "EthernetTypeDot1QDoubleTag",
+			args: args{
+				etherType: layers.EthernetTypeDot1QDoubleTag,
+			},
+			want: 2,
+		},
+		{
+			name: "EthernetTypeQinQDoubleTag",
+			args: args{
+				etherType: layers.EthernetTypeQinQDoubleTag,
+			},
+			want: 3,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			switch tt.name {
+			case "EthernetTypeDot1QDoubleTag", "EthernetTypeQinQDoubleTag":
+				got, err := GetMetadataForL2Protocol(tt.args.etherType)
+				if (err != nil) != tt.wantErr {
+					t.Errorf("GetMetadataForL2Protocol() error = %v, wantErr %v", err, tt.wantErr)
+					return
+				}
+				if got != tt.want {
+					t.Errorf("GetMetadataForL2Protocol() = %v, want %v", got, tt.want)
+				}
+			}
+		})
+	}
+}
+
+func Test_convertToUInt64(t *testing.T) {
+	type args struct {
+		data string
+	}
+	tests := []struct {
+		name string
+		args args
+		want uint64
+	}{
+		{
+			name: "ParseUint_error",
+			args: args{
+				data: "test",
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := convertToUInt64(tt.args.data); got != tt.want {
+				t.Errorf("convertToUInt64() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
diff --git a/internal/pkg/application/vnets_test.go b/internal/pkg/application/vnets_test.go
new file mode 100644
index 0000000..8942dbb
--- /dev/null
+++ b/internal/pkg/application/vnets_test.go
@@ -0,0 +1,647 @@
+/*
+* Copyright 2022-present Open Networking Foundation
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+ */
+
+package application
+
+import (
+	"context"
+	"reflect"
+	"testing"
+	cntlr "voltha-go-controller/internal/pkg/controller"
+	"voltha-go-controller/internal/pkg/of"
+	"voltha-go-controller/internal/pkg/util"
+	"voltha-go-controller/internal/test/mocks"
+
+	"github.com/golang/mock/gomock"
+	"github.com/stretchr/testify/assert"
+)
+
+func TestVoltPortVnet_JSONMarshal(t *testing.T) {
+	tests := []struct {
+		name    string
+		want    []byte
+		wantErr bool
+	}{
+		{
+			name: "VoltPortVnet_JSONMarshal",
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			vpv := &VoltPortVnet{}
+			_, err := vpv.JSONMarshal()
+			if (err != nil) != tt.wantErr {
+				t.Errorf("VoltPortVnet.JSONMarshal() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+		})
+	}
+}
+
+func TestVoltPortVnet_IsServiceActivated(t *testing.T) {
+	type args struct {
+		cntx context.Context
+	}
+	tests := []struct {
+		name string
+		args args
+		want bool
+	}{
+		{
+			name: "VoltPortVnet_IsServiceActivated",
+			args: args{
+				cntx: context.Background(),
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			vpv := &VoltPortVnet{}
+			voltServ := &VoltService{
+				VoltServiceOper: VoltServiceOper{
+					Device:      test_device,
+					ForceDelete: true,
+				},
+			}
+			vpv.services.Store(test_device, voltServ)
+			if got := vpv.IsServiceActivated(tt.args.cntx); got != tt.want {
+				t.Errorf("VoltPortVnet.IsServiceActivated() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestVoltVnet_JSONMarshal(t *testing.T) {
+	tests := []struct {
+		name    string
+		want    []byte
+		wantErr bool
+	}{
+		{
+			name: "VoltVnet_JSONMarshal",
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			vv := &VoltVnet{}
+			_, err := vv.JSONMarshal()
+			if (err != nil) != tt.wantErr {
+				t.Errorf("VoltVnet.JSONMarshal() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+		})
+	}
+}
+
+func TestVoltVnet_TriggerAssociatedFlowDelete(t *testing.T) {
+	type args struct {
+		cntx   context.Context
+		device string
+	}
+	tests := []struct {
+		name string
+		args args
+		want bool
+	}{
+		{
+			name: "VoltVnet_TriggerAssociatedFlowDelete",
+			args: args{
+				cntx:   context.Background(),
+				device: test_device,
+			},
+			want: true,
+		},
+		{
+			name: "cookieList_empty",
+			args: args{
+				cntx:   context.Background(),
+				device: test_device,
+			},
+			want: false,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			vv := &VoltVnet{}
+			switch tt.name {
+			case "VoltVnet_TriggerAssociatedFlowDelete":
+				cookie := map[string]bool{}
+				cookie["1234"] = true
+				pendingDeleteFlow := map[string]map[string]bool{}
+				pendingDeleteFlow[test_device] = cookie
+				vv.PendingDeleteFlow = pendingDeleteFlow
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().PutVnet(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(1)
+				if got := vv.TriggerAssociatedFlowDelete(tt.args.cntx, tt.args.device); got != tt.want {
+					t.Errorf("VoltVnet.TriggerAssociatedFlowDelete() = %v, want %v", got, tt.want)
+				}
+			case "cookieList_empty":
+				if got := vv.TriggerAssociatedFlowDelete(tt.args.cntx, tt.args.device); got != tt.want {
+					t.Errorf("VoltVnet.TriggerAssociatedFlowDelete() = %v, want %v", got, tt.want)
+				}
+			}
+		})
+	}
+}
+
+func TestVoltApplication_GetMatchingMcastService(t *testing.T) {
+	type args struct {
+		port   string
+		device string
+		cvlan  of.VlanType
+	}
+	tests := []struct {
+		name string
+		args args
+		want *VoltService
+	}{
+		{
+			name: "VoltApplication_GetMatchingMcastService",
+			args: args{
+				port:   "test_port",
+				device: test_device,
+				cvlan:  of.VlanAny,
+			},
+		},
+		{
+			name: "dIntf_error",
+			args: args{
+				port:   "test_port",
+				device: test_device,
+				cvlan:  of.VlanAny,
+			},
+		},
+		{
+			name: "port == d.NniPort",
+			args: args{
+				port:   "test_port",
+				device: test_device,
+				cvlan:  of.VlanAny,
+			},
+		},
+		{
+			name: "vnets_error",
+			args: args{
+				port:   "",
+				device: test_device,
+				cvlan:  of.VlanAny,
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			va := &VoltApplication{}
+			switch tt.name {
+			case "VoltApplication_GetMatchingMcastService":
+				va.DevicesDisc.Store(test_device, voltDevice)
+				va.VnetsByPort.Store("test_port", voltPortVnet1)
+				if got := va.GetMatchingMcastService(tt.args.port, tt.args.device, tt.args.cvlan); !reflect.DeepEqual(got, tt.want) {
+					t.Errorf("VoltApplication.GetMatchingMcastService() = %v, want %v", got, tt.want)
+				}
+			case "dIntf_error":
+				if got := va.GetMatchingMcastService(tt.args.port, tt.args.device, tt.args.cvlan); !reflect.DeepEqual(got, tt.want) {
+					t.Errorf("VoltApplication.GetMatchingMcastService() = %v, want %v", got, tt.want)
+				}
+			case "port == d.NniPort":
+				va.DevicesDisc.Store(test_device, voltDevice)
+				voltDevice.NniPort = "test_port"
+				if got := va.GetMatchingMcastService(tt.args.port, tt.args.device, tt.args.cvlan); !reflect.DeepEqual(got, tt.want) {
+					t.Errorf("VoltApplication.GetMatchingMcastService() = %v, want %v", got, tt.want)
+				}
+			case "vnets_error":
+				va.DevicesDisc.Store(test_device, voltDevice)
+				va.VnetsByPort.Store("test_port1", voltPortVnet1)
+				if got := va.GetMatchingMcastService(tt.args.port, tt.args.device, tt.args.cvlan); !reflect.DeepEqual(got, tt.want) {
+					t.Errorf("VoltApplication.GetMatchingMcastService() = %v, want %v", got, tt.want)
+				}
+			}
+		})
+	}
+}
+
+func TestVoltPortVnet_IgmpFlowInstallFailure(t *testing.T) {
+	type args struct {
+		cookie    string
+		errorCode uint32
+		errReason string
+	}
+	tests := []struct {
+		name string
+		args args
+	}{
+		{
+			name: "VoltPortVnet_IgmpFlowInstallFailure",
+			args: args{
+				cookie:    "test_cookie",
+				errorCode: uint32(1),
+				errReason: "errReason",
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			vpv := &VoltPortVnet{}
+			switch tt.name {
+			case "VoltPortVnet_IgmpFlowInstallFailure":
+				voltService.IgmpEnabled = true
+				vpv.services.Store("test_cookie", voltService)
+				vpv.IgmpFlowInstallFailure(tt.args.cookie, tt.args.errorCode, tt.args.errReason)
+			}
+		})
+	}
+}
+
+func TestVoltVnet_FlowRemoveFailure(t *testing.T) {
+	type args struct {
+		cntx      context.Context
+		cookie    string
+		device    string
+		errorCode uint32
+		errReason string
+	}
+	tests := []struct {
+		name string
+		args args
+	}{
+		{
+			name: "VoltVnet_FlowRemoveFailure",
+			args: args{
+				cntx:   context.Background(),
+				cookie: "1234",
+				device: test_device,
+			},
+		},
+		{
+			name: "mismatch_cookie",
+			args: args{
+				cntx:   context.Background(),
+				cookie: "1234",
+				device: test_device,
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			vv := &VoltVnet{}
+			switch tt.name {
+			case "VoltVnet_FlowRemoveFailure":
+				cookie := map[string]bool{}
+				cookie["1234"] = true
+				pendingDeleteFlow := map[string]map[string]bool{}
+				pendingDeleteFlow[test_device] = cookie
+				vv.PendingDeleteFlow = pendingDeleteFlow
+				vv.DeleteInProgress = true
+				vv.Name = "test_name"
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().DelVnet(tt.args.cntx, "test_name").Return(nil).Times(1)
+				vv.FlowRemoveFailure(tt.args.cntx, tt.args.cookie, tt.args.device, tt.args.errorCode, tt.args.errReason)
+			case "mismatch_cookie":
+				cookie := map[string]bool{}
+				cookie["12345"] = true
+				pendingDeleteFlow := map[string]map[string]bool{}
+				pendingDeleteFlow[test_device] = cookie
+				vv.PendingDeleteFlow = pendingDeleteFlow
+				vv.DeleteInProgress = true
+				vv.Name = "test_name"
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().DelVnet(tt.args.cntx, "test_name").Return(nil).Times(1)
+				vv.FlowRemoveFailure(tt.args.cntx, tt.args.cookie, tt.args.device, tt.args.errorCode, tt.args.errReason)
+			}
+		})
+	}
+}
+
+func TestVoltVnet_FlowRemoveSuccess(t *testing.T) {
+	type args struct {
+		cntx   context.Context
+		cookie string
+		device string
+	}
+	tests := []struct {
+		name string
+		args args
+	}{
+		{
+			name: "VoltVnet_FlowRemoveSuccess",
+			args: args{
+				cntx:   context.Background(),
+				cookie: "1234",
+				device: test_device,
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			vv := &VoltVnet{}
+			cookie := map[string]bool{}
+			cookie["1234"] = true
+			pendingDeleteFlow := map[string]map[string]bool{}
+			pendingDeleteFlow[test_device] = cookie
+			vv.PendingDeleteFlow = pendingDeleteFlow
+			ga := GetApplication()
+			voltDevice.ConfiguredVlanForDeviceFlows = util.NewConcurrentMap()
+			ga.DevicesDisc.Store(test_device, voltDevice)
+			dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+			db = dbintf
+			dbintf.EXPECT().PutVnet(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(1)
+			vv.FlowRemoveSuccess(tt.args.cntx, tt.args.cookie, tt.args.device)
+		})
+	}
+}
+
+func TestVoltPortVnet_FlowRemoveFailure(t *testing.T) {
+	type args struct {
+		cntx      context.Context
+		cookie    string
+		device    string
+		errorCode uint32
+		errReason string
+	}
+	tests := []struct {
+		name string
+		args args
+	}{
+		{
+			name: "VoltPortVnet_FlowRemoveFailure",
+			args: args{
+				cntx:   context.Background(),
+				cookie: "1234",
+				device: test_device,
+			},
+		},
+		{
+			name: "DeleteInProgress_false",
+			args: args{
+				cntx:   context.Background(),
+				cookie: "1234",
+				device: test_device,
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			vpv := &VoltPortVnet{}
+			switch tt.name {
+			case "VoltPortVnet_FlowRemoveFailure":
+				vpv.services.Store("1234", voltService)
+				vpv.DeleteInProgress = true
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().DelVpv(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(1)
+				vpv.FlowRemoveFailure(tt.args.cntx, tt.args.cookie, tt.args.device, tt.args.errorCode, tt.args.errReason)
+			case "DeleteInProgress_false":
+				dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+				db = dbintf
+				dbintf.EXPECT().PutVpv(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(1)
+				vpv.FlowRemoveFailure(tt.args.cntx, tt.args.cookie, tt.args.device, tt.args.errorCode, tt.args.errReason)
+			}
+		})
+	}
+}
+
+func TestVoltPortVnet_PushFlows(t *testing.T) {
+	type args struct {
+		cntx   context.Context
+		device *VoltDevice
+		flow   *of.VoltFlow
+	}
+	vsf := make(map[uint64]*of.VoltSubFlow)
+	vsf[uint64(1)] = &of.VoltSubFlow{
+		Cookie: uint64(1234),
+	}
+	tests := []struct {
+		name    string
+		args    args
+		wantErr bool
+	}{
+		{
+			name: "VoltPortVnet_PushFlows",
+			args: args{
+				cntx:   context.Background(),
+				device: voltDevice,
+				flow: &of.VoltFlow{
+					PortName: "test_port",
+					SubFlows: vsf,
+				},
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			vpv := &VoltPortVnet{}
+			_ = cntlr.NewController(context.Background(), mocks.NewMockApp(gomock.NewController(t)))
+			err := vpv.PushFlows(tt.args.cntx, tt.args.device, tt.args.flow)
+			assert.NotNil(t, err)
+		})
+	}
+}
+
+func TestVoltPortVnet_isVlanMatching(t *testing.T) {
+	type args struct {
+		cvlan of.VlanType
+		svlan of.VlanType
+	}
+	tests := []struct {
+		name string
+		args args
+		want bool
+	}{
+		{
+			name: "VoltPortVnet_isVlanMatching",
+			args: args{
+				cvlan: of.VlanAny,
+				svlan: of.VlanAny,
+			},
+			want: true,
+		},
+		{
+			name: "vpv.VlanControl_nil",
+			args: args{
+				cvlan: of.VlanAny,
+				svlan: of.VlanAny,
+			},
+			want: true,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			vpv := &VoltPortVnet{}
+			switch tt.name {
+			case "VoltPortVnet_isVlanMatching":
+				vpv.VlanControl = ONUCVlanOLTSVlan
+				vpv.SVlan = of.VlanAny
+				vpv.CVlan = of.VlanAny
+				if got := vpv.isVlanMatching(tt.args.cvlan, tt.args.svlan); got != tt.want {
+					t.Errorf("VoltPortVnet.isVlanMatching() = %v, want %v", got, tt.want)
+				}
+			}
+		})
+	}
+}
+
+func TestProcessIcmpv6McGroup(t *testing.T) {
+	type args struct {
+		device string
+		delete bool
+	}
+	tests := []struct {
+		name    string
+		args    args
+		wantErr bool
+	}{
+		{
+			name: "TestProcessIcmpv6McGroup",
+			args: args{
+				device: test_device,
+				delete: false,
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			err := ProcessIcmpv6McGroup(tt.args.device, tt.args.delete)
+			assert.NotNil(t, err)
+		})
+	}
+}
+
+func TestVoltVnet_setPbitRemarking(t *testing.T) {
+	tests := []struct {
+		name string
+		want uint32
+	}{
+		{
+			name: "VoltVnet_setPbitRemarking",
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			vv := &VoltVnet{}
+			a := make(map[of.PbitType]of.PbitType)
+			a[of.PbitMatchAll] = of.PbitMatchAll
+			vv.CtrlPktPbitRemark = a
+			if got := vv.setPbitRemarking(); got != tt.want {
+				t.Errorf("VoltVnet.setPbitRemarking() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestBuildDSArpFlow(t *testing.T) {
+	type args struct {
+		inport uint32
+		vnet   *VoltVnet
+	}
+	tests := []struct {
+		name string
+		args args
+		want *of.VoltFlow
+	}{
+		{
+			name: "BuildDSArpFlow",
+			args: args{
+				inport: uint32(1),
+				vnet: &VoltVnet{
+					Version: "test_version",
+				},
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			switch tt.name {
+			case "BuildDSArpFlow":
+				got := BuildDSArpFlow(tt.args.inport, tt.args.vnet)
+				assert.NotNil(t, got)
+			}
+		})
+	}
+}
+
+func TestBuildICMPv6Flow(t *testing.T) {
+	type args struct {
+		inport uint32
+		vnet   *VoltVnet
+	}
+	tests := []struct {
+		name string
+		args args
+		want *of.VoltFlow
+	}{
+		{
+			name: "BuildICMPv6Flow",
+			args: args{
+				inport: uint32(1),
+				vnet: &VoltVnet{
+					Version: "test_version",
+				},
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			got := BuildICMPv6Flow(tt.args.inport, tt.args.vnet)
+			assert.NotNil(t, got)
+		})
+	}
+}
+
+func TestVoltApplication_DeleteDevFlowForVlanFromDevice(t *testing.T) {
+	type args struct {
+		cntx            context.Context
+		vnet            *VoltVnet
+		deviceSerialNum string
+	}
+	tests := []struct {
+		name string
+		args args
+	}{
+		{
+			name: "device.SerialNum != deviceSerialNum",
+			args: args{
+				cntx: context.Background(),
+				vnet: &VoltVnet{
+					Version: "test_version",
+				},
+			},
+		},
+		{
+			name: "VoltApplication_DeleteDevFlowForVlanFromDevice",
+			args: args{
+				cntx: context.Background(),
+				vnet: &VoltVnet{
+					Version: "test_version",
+				},
+				deviceSerialNum: "test_serial_number",
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			va := &VoltApplication{}
+			switch tt.name {
+			case "device.SerialNum != deviceSerialNum":
+				va.DevicesDisc.Store(test_device, voltDevice)
+				va.DeleteDevFlowForVlanFromDevice(tt.args.cntx, tt.args.vnet, tt.args.deviceSerialNum)
+			case "VoltApplication_DeleteDevFlowForVlanFromDevice":
+				va.DevicesDisc.Store(test_device, voltDevice)
+				va.DeleteDevFlowForVlanFromDevice(tt.args.cntx, tt.args.vnet, tt.args.deviceSerialNum)
+			}
+		})
+	}
+}