VGC UT coverage upto 40%

Change-Id: Ifb2886a44ff49128ecddb2100f524b5274d0a063
diff --git a/internal/pkg/controller/changeevent.go b/internal/pkg/controller/changeevent.go
index ae744d6..f221d88 100644
--- a/internal/pkg/controller/changeevent.go
+++ b/internal/pkg/controller/changeevent.go
@@ -89,5 +89,5 @@
 		logger.Debugw(ctx, "Processed Port Change Event", log.Fields{"Port No": portNo, "Port Name": portName, "State": state, "Reason": status.PortStatus.Reason})
 		return nil
 	}
-	return errors.New("Invalid message received")
+	return errors.New("invalid message received")
 }
diff --git a/internal/pkg/controller/controller.go b/internal/pkg/controller/controller.go
index 4e2c4eb..b1939b9 100644
--- a/internal/pkg/controller/controller.go
+++ b/internal/pkg/controller/controller.go
@@ -621,7 +621,7 @@
 		logger.Debugw(ctx, "Inside GetGroupList method", log.Fields{"groupID": id})
 		grps, ok := device.groups.Load(id)
 		if !ok {
-			return nil, errors.New("Group not found")
+			return nil, errors.New("group not found")
 		}
 		groups = grps.(*of.Group)
 		logger.Debugw(ctx, "Groups", log.Fields{"groups": groups})
diff --git a/internal/pkg/controller/controller_test.go b/internal/pkg/controller/controller_test.go
new file mode 100644
index 0000000..ff45c50
--- /dev/null
+++ b/internal/pkg/controller/controller_test.go
@@ -0,0 +1,1032 @@
+/*
+* 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 controller
+
+import (
+	"context"
+	"reflect"
+	"sync"
+	"testing"
+	"voltha-go-controller/internal/pkg/intf"
+	"voltha-go-controller/internal/pkg/of"
+	"voltha-go-controller/internal/pkg/tasks"
+	"voltha-go-controller/internal/pkg/vpagent"
+	"voltha-go-controller/internal/test/mocks"
+
+	"github.com/golang/mock/gomock"
+	"github.com/stretchr/testify/assert"
+)
+
+func TestNewController(t *testing.T) {
+	type args struct {
+		ctx context.Context
+		app intf.App
+	}
+	appMock := mocks.NewMockApp(gomock.NewController(t))
+	app := NewController(ctx, appMock)
+	tests := []struct {
+		name string
+		args args
+		want intf.IVPClientAgent
+	}{
+		{
+			name: "TestNewController",
+			args: args{
+				ctx: context.Background(),
+				app: GetController().app,
+			},
+			want: app,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := NewController(tt.args.ctx, tt.args.app); !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("NewController() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func Cancel() {}
+func TestVoltController_DelDevice(t *testing.T) {
+	type args struct {
+		cntx context.Context
+		id   string
+	}
+
+	device := &Device{
+		ID:     "SDX6320031",
+		cancel: Cancel,
+	}
+	dev := map[string]*Device{}
+	dev["SDX6320031"] = device
+	appMock := mocks.NewMockApp(gomock.NewController(t))
+	NewController(ctx, appMock)
+	appMock.EXPECT().DelDevice(gomock.Any(), gomock.Any()).AnyTimes()
+	tests := []struct {
+		name string
+		args args
+	}{
+		{
+			name: "DelDevice",
+			args: args{
+				cntx: context.Background(),
+				id:   "SDX6320031",
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			v := &VoltController{
+				devices: dev,
+				app:     GetController().app,
+			}
+			v.DelDevice(tt.args.cntx, tt.args.id)
+		})
+	}
+}
+
+func TestVoltController_AddFlows(t *testing.T) {
+	type args struct {
+		cntx   context.Context
+		port   string
+		device string
+		flow   *of.VoltFlow
+	}
+	subFlows := map[uint64]*of.VoltSubFlow{}
+	vltSubFlow := &of.VoltSubFlow{
+		Priority: 100,
+		Cookie:   103112802816,
+		State:    of.FlowAddSuccess,
+		Match: of.Match{
+			InPort:     1573376,
+			MatchVlan:  4096,
+			L4Protocol: 255,
+		},
+		Action: of.Action{
+			Metadata:    279189651712,
+			GoToTableID: 1,
+			MeterID:     1,
+			SetVlan:     4097,
+			Pcp:         8,
+			Output:      4,
+		},
+	}
+	subFlows[0] = vltSubFlow
+	portsByName := map[string]*DevicePort{}
+	portsByName["SDX6320031-1"] = &DevicePort{
+		Name: "SDX6320031-1",
+		ID:   256,
+	}
+	device := &Device{
+		ctx:         context.Background(),
+		ID:          "SDX6320031",
+		flows:       subFlows,
+		PortsByName: portsByName,
+	}
+	dev := map[string]*Device{}
+	dev["SDX6320031"] = device
+	flow := &of.VoltFlow{
+		PortName:      "SDX6320031-1",
+		PortID:        256,
+		Command:       0,
+		MigrateCookie: true,
+	}
+	tests := []struct {
+		name    string
+		args    args
+		wantErr bool
+	}{
+		{
+			name: "AddFlows",
+			args: args{
+				cntx:   context.Background(),
+				port:   "SDX6320031-1",
+				device: "SDX6320031",
+				flow:   flow,
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			v := &VoltController{
+				devices: dev,
+			}
+			if err := v.AddFlows(tt.args.cntx, tt.args.port, tt.args.device, tt.args.flow); (err != nil) != tt.wantErr {
+				t.Errorf("VoltController.AddFlows() error = %v, wantErr %v", err, tt.wantErr)
+			}
+		})
+	}
+}
+
+func TestVoltController_DelFlows(t *testing.T) {
+	type args struct {
+		cntx   context.Context
+		port   string
+		device string
+		flow   *of.VoltFlow
+	}
+	subFlows := map[uint64]*of.VoltSubFlow{}
+	vltSubFlow := &of.VoltSubFlow{
+		Priority: 100,
+		Cookie:   103112802816,
+		State:    of.FlowAddSuccess,
+		Match: of.Match{
+			InPort:     1573376,
+			MatchVlan:  4096,
+			L4Protocol: 255,
+		},
+		Action: of.Action{
+			Metadata:    279189651712,
+			GoToTableID: 1,
+			MeterID:     1,
+			SetVlan:     4097,
+			Pcp:         8,
+			Output:      4,
+		},
+	}
+	subFlows[0] = vltSubFlow
+	portsByName := map[string]*DevicePort{}
+	portsByName["SDX6320031-1"] = &DevicePort{
+		Name: "SDX6320031-1",
+		ID:   256,
+	}
+	device := &Device{
+		ctx:         context.Background(),
+		ID:          "SDX6320031",
+		flows:       subFlows,
+		PortsByName: portsByName,
+	}
+	dev := map[string]*Device{}
+	dev["SDX6320031"] = device
+	flow := &of.VoltFlow{
+		PortName:      "SDX6320031-1",
+		PortID:        256,
+		Command:       0,
+		MigrateCookie: true,
+	}
+	tests := []struct {
+		name    string
+		args    args
+		wantErr bool
+	}{
+		{
+			name: "DelFlows",
+			args: args{
+				cntx:   context.Background(),
+				port:   "SDX6320031-1",
+				device: "SDX6320031",
+				flow:   flow,
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			v := &VoltController{
+				devices: dev,
+			}
+			if err := v.DelFlows(tt.args.cntx, tt.args.port, tt.args.device, tt.args.flow); (err != nil) != tt.wantErr {
+				t.Errorf("VoltController.DelFlows() error = %v, wantErr %v", err, tt.wantErr)
+			}
+		})
+	}
+}
+
+func TestVoltController_GetGroups(t *testing.T) {
+	type args struct {
+		cntx context.Context
+		id   uint32
+	}
+	device := &Device{
+		ctx:    context.Background(),
+		ID:     "SDX6320031",
+		groups: sync.Map{},
+	}
+	grp := &of.Group{
+		Device:  "SDX6320031",
+		GroupID: uint32(256),
+		State:   1,
+		SetVlan: of.VlanAny,
+	}
+	dev := map[string]*Device{}
+	dev["SDX6320031"] = device
+	tests := []struct {
+		name    string
+		args    args
+		want    *of.Group
+		wantErr bool
+	}{
+		{
+			name: "VoltController_GetGroups",
+			args: args{
+				cntx: context.Background(),
+				id:   uint32(256),
+			},
+			want:    grp,
+			wantErr: false,
+		},
+		{
+			name: "GetGroups_Not-Found",
+			args: args{
+				cntx: context.Background(),
+				id:   1,
+			},
+			want:    nil,
+			wantErr: true,
+		},
+	}
+
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			v := &VoltController{
+				devices: dev,
+			}
+			switch tt.name {
+			case "VoltController_GetGroups":
+				device.groups.Store(uint32(256), grp)
+				got, err := v.GetGroups(tt.args.cntx, tt.args.id)
+				if (err != nil) != tt.wantErr {
+					t.Errorf("VoltController.GetGroups() error = %v, wantErr %v", err, tt.wantErr)
+					return
+				}
+				if !reflect.DeepEqual(got, tt.want) {
+					t.Errorf("VoltController.GetGroups() = %v, want %v", got, tt.want)
+				}
+			case "GetGroups_Not-Found":
+				got, err := v.GetGroups(tt.args.cntx, tt.args.id)
+				if (err != nil) != tt.wantErr {
+					t.Errorf("VoltController.GetGroups() error = %v, wantErr %v", err, tt.wantErr)
+					return
+				}
+				if !reflect.DeepEqual(got, tt.want) {
+					t.Errorf("VoltController.GetGroups() = %v, want %v", got, tt.want)
+				}
+			}
+		})
+	}
+}
+
+func TestVoltController_GetGroupList(t *testing.T) {
+	device := &Device{
+		ctx:    context.Background(),
+		ID:     "SDX6320031",
+		groups: sync.Map{},
+	}
+	grpList := []*of.Group{}
+	grp := &of.Group{
+		Device:  "SDX6320031",
+		GroupID: uint32(256),
+		State:   1,
+		SetVlan: of.VlanAny,
+	}
+	grpList = append(grpList, grp)
+	dev := map[string]*Device{}
+	dev["SDX6320031"] = device
+	tests := []struct {
+		name    string
+		want    []*of.Group
+		wantErr bool
+	}{
+		{
+			name:    "VoltController_GetGroups",
+			want:    grpList,
+			wantErr: false,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			v := &VoltController{
+				devices: dev,
+			}
+			device.groups.Store(uint32(256), grp)
+			got, err := v.GetGroupList()
+			if (err != nil) != tt.wantErr {
+				t.Errorf("VoltController.GetGroupList() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			if !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("VoltController.GetGroupList() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestVoltController_GetMeterInfo(t *testing.T) {
+	type args struct {
+		cntx context.Context
+		id   uint32
+	}
+	mtrs := &of.Meter{
+		ID:    uint32(256),
+		State: 1,
+	}
+	mtr := map[string]*of.Meter{}
+	mtr["SDX6320031"] = mtrs
+	devMtr := map[uint32]*of.Meter{}
+	devMtr[uint32(256)] = mtrs
+	device := &Device{
+		ctx:    context.Background(),
+		ID:     "SDX6320031",
+		meters: devMtr,
+	}
+	dev := map[string]*Device{}
+	dev["SDX6320031"] = device
+	tests := []struct {
+		name    string
+		args    args
+		want    map[string]*of.Meter
+		wantErr bool
+	}{
+		{
+			name: "VoltController_GetMeterInfo",
+			args: args{
+				cntx: context.Background(),
+				id:   uint32(256),
+			},
+			want:    mtr,
+			wantErr: false,
+		},
+		{
+			name: "Not_Found_Error",
+			args: args{
+				cntx: context.Background(),
+				id:   1,
+			},
+			want:    nil,
+			wantErr: true,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			v := &VoltController{
+				devices: dev,
+			}
+			switch tt.name {
+			case "VoltController_GetMeterInfo":
+				got, err := v.GetMeterInfo(tt.args.cntx, tt.args.id)
+				if (err != nil) != tt.wantErr {
+					t.Errorf("VoltController.GetMeterInfo() error = %v, wantErr %v", err, tt.wantErr)
+					return
+				}
+				if !reflect.DeepEqual(got, tt.want) {
+					t.Errorf("VoltController.GetMeterInfo() = %v, want %v", got, tt.want)
+				}
+			case "Not_Found_Error":
+				got, err := v.GetMeterInfo(tt.args.cntx, tt.args.id)
+				if (err != nil) != tt.wantErr {
+					t.Errorf("VoltController.GetMeterInfo() error = %v, wantErr %v", err, tt.wantErr)
+					return
+				}
+				if !reflect.DeepEqual(got, tt.want) {
+					t.Errorf("VoltController.GetMeterInfo() = %v, want %v", got, tt.want)
+				}
+			}
+		})
+	}
+}
+
+func TestVoltController_GetAllMeterInfo(t *testing.T) {
+	vltMtr := map[string][]*of.Meter{}
+	mtr := &of.Meter{
+		ID:    uint32(256),
+		State: 1,
+	}
+	mtrs := []*of.Meter{}
+	mtrs = append(mtrs, mtr)
+	vltMtr["SDX6320031"] = mtrs
+	devMtr := map[uint32]*of.Meter{}
+	devMtr[uint32(256)] = mtr
+	device := &Device{
+		ctx:    context.Background(),
+		ID:     "SDX6320031",
+		meters: devMtr,
+	}
+	dev := map[string]*Device{}
+	dev["SDX6320031"] = device
+	tests := []struct {
+		name    string
+		want    map[string][]*of.Meter
+		wantErr bool
+	}{
+		{
+			name:    "VoltController_GetMeterInfo",
+			want:    vltMtr,
+			wantErr: false,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			v := &VoltController{
+				devices: dev,
+			}
+			got, err := v.GetAllMeterInfo()
+			if (err != nil) != tt.wantErr {
+				t.Errorf("VoltController.GetAllMeterInfo() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			if !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("VoltController.GetAllMeterInfo() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestVoltController_GetAllPendingFlows(t *testing.T) {
+	subFlowList := []*of.VoltSubFlow{}
+	vltSubFlow := &of.VoltSubFlow{
+		Priority: 100,
+		Cookie:   103112802816,
+		State:    of.FlowAddSuccess,
+		Match: of.Match{
+			InPort:     1573376,
+			MatchVlan:  4096,
+			L4Protocol: 255,
+		},
+		Action: of.Action{
+			Metadata:    279189651712,
+			GoToTableID: 1,
+			MeterID:     1,
+			SetVlan:     4097,
+			Pcp:         8,
+			Output:      4,
+		},
+	}
+	subFlowList = append(subFlowList, vltSubFlow)
+	subFlows := map[uint64]*of.VoltSubFlow{}
+	subFlows[0] = vltSubFlow
+	device := &Device{
+		ctx:   context.Background(),
+		ID:    "SDX6320031",
+		flows: subFlows,
+	}
+	dev := map[string]*Device{}
+	dev["SDX6320031"] = device
+	tests := []struct {
+		name    string
+		want    []*of.VoltSubFlow
+		wantErr bool
+	}{
+		{
+			name:    "GetAllPendingFlows",
+			want:    subFlowList,
+			wantErr: false,
+		},
+	}
+	type args1 struct {
+		deviceId string
+	}
+	tests1 := []struct {
+		name    string
+		args    args1
+		want    []*of.VoltSubFlow
+		wantErr bool
+	}{
+		{
+			name: "GetFlows_with_DeviceID",
+			args: args1{
+				deviceId: "SDX6320031",
+			},
+			want:    subFlowList,
+			wantErr: false,
+		},
+		{
+			name: "GetFlows_with_DeviceID_NOT_FOUND",
+			args: args1{
+				deviceId: "",
+			},
+			want:    subFlowList,
+			wantErr: false,
+		},
+	}
+	type args2 struct {
+		deviceId string
+		cookie   uint64
+	}
+	tests2 := []struct {
+		name    string
+		args    args2
+		want    []*of.VoltSubFlow
+		wantErr bool
+	}{
+		{
+			name: "GetFlow_with_DeviceID_and_cookie",
+			args: args2{
+				deviceId: "SDX6320031",
+				cookie:   103112802816,
+			},
+			want:    subFlowList,
+			wantErr: false,
+		},
+		{
+			name: "GetFlow_with_DeviceID_and_cookie_NOT_FOUND",
+			args: args2{
+				deviceId: "",
+			},
+			want:    subFlowList,
+			wantErr: true,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			v := &VoltController{
+				devices: dev,
+			}
+			got, err := v.GetAllPendingFlows()
+			if (err != nil) != tt.wantErr {
+				t.Errorf("VoltController.GetAllPendingFlows() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			assert.Nil(t, got)
+			got1, err1 := v.GetAllFlows()
+			if (err1 != nil) != tt.wantErr {
+				t.Errorf("VoltController.GetAllPendingFlows() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			assert.NotNil(t, got1)
+		})
+	}
+	for _, tt := range tests1 {
+		t.Run(tt.name, func(t *testing.T) {
+			v := &VoltController{
+				devices: dev,
+			}
+			switch tt.name {
+			case "GetFlows_with_DeviceID":
+				got, err := v.GetFlows(tt.args.deviceId)
+				if (err != nil) != tt.wantErr {
+					t.Errorf("VoltController.GetAllPendingFlows() error = %v, wantErr %v", err, tt.wantErr)
+					return
+				}
+				assert.NotNil(t, got)
+			case "GetFlows_with_DeviceID_NOT_FOUND":
+				got, err := v.GetFlows(tt.args.deviceId)
+				if (err != nil) != tt.wantErr {
+					t.Errorf("VoltController.GetAllPendingFlows() error = %v, wantErr %v", err, tt.wantErr)
+					return
+				}
+				assert.Nil(t, got)
+			}
+		})
+	}
+	for _, tt := range tests2 {
+		t.Run(tt.name, func(t *testing.T) {
+			v := &VoltController{
+				devices: dev,
+			}
+			switch tt.name {
+			case "GetFlow_with_DeviceID_and_cookie":
+				got, err := v.GetFlow(tt.args.deviceId, tt.args.cookie)
+				if (err != nil) != tt.wantErr {
+					t.Errorf("VoltController.GetAllPendingFlows() error = %v, wantErr %v", err, tt.wantErr)
+					return
+				}
+				assert.Nil(t, got)
+			case "GetFlow_with_DeviceID_and_cookie_NOT_FOUND":
+				got, err := v.GetFlow(tt.args.deviceId, tt.args.cookie)
+				if (err != nil) != tt.wantErr {
+					t.Errorf("VoltController.GetAllPendingFlows() error = %v, wantErr %v", err, tt.wantErr)
+					return
+				}
+				assert.Nil(t, got)
+			}
+		})
+	}
+}
+
+func TestVoltController_GetTaskList(t *testing.T) {
+	type args struct {
+		device string
+	}
+	device := &Device{
+		ctx: context.Background(),
+		ID:  "SDX6320031",
+	}
+	dev := map[string]*Device{}
+	dev["SDX6320031"] = device
+	tests := []struct {
+		name string
+		args args
+		want []tasks.Task
+	}{
+		{
+			name: "GetTaskList",
+			args: args{
+				device: "SDX6320031",
+			},
+			want: []tasks.Task{},
+		},
+		{
+			name: "GetTaskList_Device_Not_found",
+			args: args{
+				device: "SDX632003",
+			},
+			want: []tasks.Task{},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			v := &VoltController{
+				devices: dev,
+			}
+			switch tt.name {
+			case "GetTaskList":
+				if got := v.GetTaskList(tt.args.device); !reflect.DeepEqual(got, tt.want) {
+					t.Errorf("VoltController.GetTaskList() = %v, want %v", got, tt.want)
+				}
+			case "GetTaskList_Device_Not_found":
+				if got := v.GetTaskList(tt.args.device); !reflect.DeepEqual(got, tt.want) {
+					t.Errorf("VoltController.GetTaskList() = %v, want %v", got, tt.want)
+				}
+			}
+		})
+	}
+}
+
+func TestVoltController_GetPortState(t *testing.T) {
+	type args struct {
+		device string
+		name   string
+	}
+	portsByName := map[string]*DevicePort{}
+	portsByName["SDX6320031-1"] = &DevicePort{
+		Name: "SDX6320031-1",
+		ID:   256,
+	}
+	device := &Device{
+		ctx:         context.Background(),
+		ID:          "SDX6320031",
+		PortsByName: portsByName,
+	}
+	dev := map[string]*Device{}
+	dev["SDX6320031"] = device
+	tests := []struct {
+		name    string
+		args    args
+		want    PortState
+		wantErr bool
+	}{
+		{
+			name: "GetPortState",
+			args: args{
+				device: "SDX6320031",
+				name:   "SDX6320031-1",
+			},
+			want: PortStateUp,
+		},
+		{
+			name: "GetPortState_Device_Not_found",
+			args: args{
+				device: "SDX6320031-1",
+				name:   "SDX6320031",
+			},
+			want:    PortStateDown,
+			wantErr: true,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			v := &VoltController{
+				devices: dev,
+			}
+			switch tt.name {
+			case "GetPortState":
+				got, err := v.GetPortState(tt.args.device, tt.args.name)
+				if (err != nil) != tt.wantErr {
+					t.Errorf("VoltController.GetPortState() error = %v, wantErr %v", err, tt.wantErr)
+					return
+				}
+				assert.NotNil(t, got)
+			case "GetPortState_Device_Not_found":
+				got, err := v.GetPortState(tt.args.device, tt.args.name)
+				if (err != nil) != tt.wantErr {
+					t.Errorf("VoltController.GetPortState() error = %v, wantErr %v", err, tt.wantErr)
+					return
+				}
+				if got != tt.want {
+					t.Errorf("VoltController.GetPortState() = %v, want %v", got, tt.want)
+				}
+			}
+		})
+	}
+}
+
+func TestVoltController_ModMeter(t *testing.T) {
+	type args struct {
+		port    string
+		device  string
+		command of.MeterCommand
+		meter   *of.Meter
+	}
+	portsByName := map[string]*DevicePort{}
+	portsByName["SDX6320031-1"] = &DevicePort{
+		Name: "SDX6320031-1",
+		ID:   256,
+	}
+	mtrs := &of.Meter{
+		ID:    uint32(256),
+		State: 1,
+	}
+	devMtr := map[uint32]*of.Meter{}
+	devMtr[uint32(256)] = mtrs
+	device := &Device{
+		ctx:         context.Background(),
+		ID:          "SDX6320031",
+		PortsByName: portsByName,
+		meters:      devMtr,
+	}
+	dev := map[string]*Device{}
+	dev["SDX6320031"] = device
+	tests := []struct {
+		name    string
+		args    args
+		wantErr bool
+	}{
+		{
+			name: "ModMeter",
+			args: args{
+				device:  "SDX6320031",
+				port:    "SDX6320031-1",
+				command: of.MeterCommandAdd,
+				meter:   mtrs,
+			},
+			wantErr: false,
+		},
+		{
+			name: "ModMeter_device_not_found",
+			args: args{
+				command: of.MeterCommandAdd,
+				meter:   mtrs,
+			},
+			wantErr: true,
+		},
+		{
+			name: "ModMeter_port_not_found",
+			args: args{
+				device:  "SDX6320031",
+				command: of.MeterCommandAdd,
+				meter:   mtrs,
+			},
+			wantErr: true,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			v := &VoltController{
+				devices: dev,
+			}
+			switch tt.name {
+			case "ModMeter":
+				if err := v.ModMeter(tt.args.port, tt.args.device, tt.args.command, tt.args.meter); (err != nil) != tt.wantErr {
+					t.Errorf("VoltController.ModMeter() error = %v, wantErr %v", err, tt.wantErr)
+				}
+			case "ModMeter_device_not_found":
+				if err := v.ModMeter(tt.args.port, tt.args.device, tt.args.command, tt.args.meter); (err != nil) != tt.wantErr {
+					t.Errorf("VoltController.ModMeter() error = %v, wantErr %v", err, tt.wantErr)
+				}
+			case "ModMeter_port_not_found":
+				if err := v.ModMeter(tt.args.port, tt.args.device, tt.args.command, tt.args.meter); (err != nil) != tt.wantErr {
+					t.Errorf("VoltController.ModMeter() error = %v, wantErr %v", err, tt.wantErr)
+				}
+			}
+		})
+	}
+}
+
+func TestVoltController_VPAgent(t *testing.T) {
+	type args struct {
+		vep string
+	}
+	vagent := map[string]*vpagent.VPAgent{}
+	vpa := &vpagent.VPAgent{}
+	vagent[""] = vpa
+	tests := []struct {
+		name    string
+		args    args
+		want    *vpagent.VPAgent
+		wantErr bool
+	}{
+		{
+			name:    "VPAgent",
+			args:    args{},
+			want:    vpa,
+			wantErr: false,
+		},
+		{
+			name: "VPAgent_Error",
+			args: args{
+				vep: "ab",
+			},
+			want:    nil,
+			wantErr: true,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			v := &VoltController{
+				vagent: vagent,
+			}
+			switch tt.name {
+			case "VPAgent":
+				got, err := v.VPAgent(tt.args.vep)
+				if (err != nil) != tt.wantErr {
+					t.Errorf("VoltController.VPAgent() error = %v, wantErr %v", err, tt.wantErr)
+					return
+				}
+				if !reflect.DeepEqual(got, tt.want) {
+					t.Errorf("VoltController.VPAgent() = %v, want %v", got, tt.want)
+				}
+			case "VPAgent_Error":
+				got, err := v.VPAgent(tt.args.vep)
+				if (err != nil) != tt.wantErr {
+					t.Errorf("VoltController.VPAgent() error = %v, wantErr %v", err, tt.wantErr)
+					return
+				}
+				if !reflect.DeepEqual(got, tt.want) {
+					t.Errorf("VoltController.VPAgent() = %v, want %v", got, tt.want)
+				}
+			}
+		})
+	}
+}
+
+func TestVoltController_DeviceRebootInd(t *testing.T) {
+	type args struct {
+		cntx context.Context
+		dID  string
+		srNo string
+		sbID string
+	}
+	appMock := mocks.NewMockApp(gomock.NewController(t))
+	NewController(ctx, appMock)
+	appMock.EXPECT().DeviceRebootInd(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes()
+	dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+	db = dbintf
+	dbintf.EXPECT().DelAllRoutesForDevice(gomock.Any(), gomock.Any()).AnyTimes()
+	dbintf.EXPECT().DelAllGroup(gomock.Any(), gomock.Any()).AnyTimes()
+	dbintf.EXPECT().DelAllMeter(gomock.Any(), gomock.Any()).AnyTimes()
+	dbintf.EXPECT().DelAllPONCounters(gomock.Any(), gomock.Any()).AnyTimes()
+	tests := []struct {
+		name string
+		args args
+	}{
+		{
+			name: "VPAgent",
+			args: args{
+				dID:  "1234",
+				srNo: "SDX6320031",
+				cntx: context.Background(),
+				sbID: "4321",
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			v := &VoltController{
+				app: GetController().app,
+			}
+			v.DeviceRebootInd(tt.args.cntx, tt.args.dID, tt.args.srNo, tt.args.sbID)
+		})
+	}
+}
+
+func TestVoltController_SetRebootInProgressForDevice(t *testing.T) {
+	type args struct {
+		device string
+	}
+	rebootInProgressDevices := map[string]string{}
+	device := &Device{
+		ctx: context.Background(),
+		ID:  "SDX6320031",
+	}
+	dev := map[string]*Device{}
+	dev["SDX6320031"] = device
+	tests := []struct {
+		name string
+		args args
+		want bool
+	}{
+		{
+			name: "SetRebootInProgressForDevice",
+			args: args{
+				device: "SDX6320031",
+			},
+			want: true,
+		},
+		{
+			name: "SetRebootInProgressForDevice_Error",
+			args: args{
+				device: "SDX6320031-1",
+			},
+			want: true,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			v := &VoltController{
+				rebootInProgressDevices: rebootInProgressDevices,
+				devices:                 dev,
+			}
+			switch tt.name {
+			case "SetRebootInProgressForDevice":
+				if got := v.SetRebootInProgressForDevice(tt.args.device); got != tt.want {
+					t.Errorf("VoltController.SetRebootInProgressForDevice() = %v, want %v", got, tt.want)
+				}
+			case "SetRebootInProgressForDevice_Error":
+				if got := v.SetRebootInProgressForDevice(tt.args.device); got != tt.want {
+					t.Errorf("VoltController.SetRebootInProgressForDevice() = %v, want %v", got, tt.want)
+				}
+			}
+		})
+	}
+}
+
+func TestVoltController_ReSetRebootInProgressForDevice(t *testing.T) {
+	type args struct {
+		device string
+	}
+	rebootInProgressDevices := map[string]string{}
+	device := &Device{
+		ctx: context.Background(),
+		ID:  "SDX6320031",
+	}
+	rebootInProgressDevices["SDX6320031"] = "done"
+	dev := map[string]*Device{}
+	dev["SDX6320031"] = device
+	tests := []struct {
+		name string
+		args args
+		want bool
+	}{
+		{
+			name: "ReSetRebootInProgressForDevice",
+			args: args{
+				device: "SDX6320031",
+			},
+			want: true,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			v := &VoltController{
+				rebootInProgressDevices: rebootInProgressDevices,
+				devices:                 dev,
+			}
+			if got := v.ReSetRebootInProgressForDevice(tt.args.device); got != tt.want {
+				t.Errorf("VoltController.ReSetRebootInProgressForDevice() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
diff --git a/internal/pkg/controller/device.go b/internal/pkg/controller/device.go
index 0bafca7..57474a0 100644
--- a/internal/pkg/controller/device.go
+++ b/internal/pkg/controller/device.go
@@ -51,7 +51,11 @@
 	// DefaultMaxFlowQueues constant
 	DefaultMaxFlowQueues = 67
 	//ErrDuplicateFlow - indicates flow already exists in DB
-	ErrDuplicateFlow string = "Duplicate Flow"
+	ErrDuplicateFlow string = "duplicate flow"
+	//Unknown_Port_ID - indicates that the port id is unknown
+	Unknown_Port_ID = "unknown port id"
+	//Duplicate_Port - indicates the port is already exist in controller
+	Duplicate_Port = "duplicate port"
 )
 
 // DevicePort structure
@@ -253,7 +257,7 @@
 		d.DelFlowFromDb(cntx, flow.Cookie)
 		return nil
 	}
-	return errors.New("Flow does not Exist")
+	return errors.New("flow does not exist")
 }
 
 // DelFlowFromDb is utility to delete the flow from the device
@@ -287,7 +291,7 @@
 		d.DelFlowFromDb(cntx, flow.OldCookie)
 		return nil
 	}
-	return errors.New("Flow does not Exist")
+	return errors.New("flow does not exist")
 }
 
 // RestoreFlowsFromDb to restore flows from database
@@ -386,7 +390,7 @@
 	d.meterLock.Lock()
 	defer d.meterLock.Unlock()
 	if _, ok := d.meters[meter.ID]; ok {
-		return errors.New("Duplicate Meter")
+		return errors.New("duplicate meter")
 	}
 	d.meters[meter.ID] = meter
 	go d.AddMeterToDb(cntx, meter)
@@ -401,7 +405,7 @@
 		d.meters[meter.ID] = meter
 		d.AddMeterToDb(cntx, meter)
 	} else {
-		return errors.New("Meter not found for updation")
+		return errors.New("meter not found for updation")
 	}
 	return nil
 }
@@ -413,7 +417,7 @@
 	if m, ok := d.meters[id]; ok {
 		return m, nil
 	}
-	return nil, errors.New("Meter Not Found")
+	return nil, errors.New("meter not found")
 }
 
 // DelMeter to delete meter
@@ -483,10 +487,10 @@
 	id := mp.PortNo
 	name := mp.Name
 	if _, ok := d.PortsByID[id]; ok {
-		return errors.New("Duplicate port")
+		return errors.New(Duplicate_Port)
 	}
 	if _, ok := d.PortsByName[name]; ok {
-		return errors.New("Duplicate port")
+		return errors.New(Duplicate_Port)
 	}
 
 	p := NewDevicePort(mp)
@@ -503,7 +507,7 @@
 func (d *Device) DelPort(cntx context.Context, id uint32) error {
 	p := d.GetPortByID(id)
 	if p == nil {
-		return errors.New("Unknown Port")
+		return errors.New("unknown port")
 	}
 	if p.State == PortStateUp {
 		GetController().PortDownInd(cntx, d.ID, p.Name)
@@ -546,7 +550,7 @@
 		return p.Name, nil
 	}
 	logger.Errorw(ctx, "Port not found", log.Fields{"port": id})
-	return "", errors.New("Unknown Port ID")
+	return "", errors.New(Unknown_Port_ID)
 }
 
 // GetPortByID is utility to retrieve the port by ID
@@ -581,7 +585,7 @@
 	if p, ok := d.PortsByName[name]; ok {
 		return p.State, nil
 	}
-	return PortStateDown, errors.New("Unknown Port ID")
+	return PortStateDown, errors.New(Unknown_Port_ID)
 }
 
 // GetPortID to get the port-id by the port name
@@ -592,7 +596,7 @@
 	if p, ok := d.PortsByName[name]; ok {
 		return p.ID, nil
 	}
-	return 0, errors.New("Unknown Port ID")
+	return 0, errors.New(Unknown_Port_ID)
 }
 
 // WritePortToDb to add the port to the database
@@ -633,7 +637,7 @@
 			d.PortsByName[port.Name] = &port
 			GetController().PortAddInd(cntx, d.ID, port.ID, port.Name)
 		} else {
-			logger.Warnw(ctx, "Duplicate Port", log.Fields{"ID": port.ID})
+			logger.Warnw(ctx, Duplicate_Port, log.Fields{"ID": port.ID})
 		}
 	} else {
 		logger.Warnw(ctx, "Unmarshal failed", log.Fields{"port": string(b)})
@@ -907,11 +911,11 @@
 func (d *Device) PacketOutReq(outport string, inport string, data []byte, isCustomPkt bool) error {
 	inp, err := d.GetPortID(inport)
 	if err != nil {
-		return errors.New("Unknown inport")
+		return errors.New("unknown inport")
 	}
 	outp, err1 := d.GetPortID(outport)
 	if err1 != nil {
-		return errors.New("Unknown outport")
+		return errors.New("unknown outport")
 	}
 	logger.Debugw(ctx, "Sending packet out", log.Fields{"Device": d.ID, "Inport": inport, "Outport": outport})
 	return d.SendPacketOut(outp, inp, data, isCustomPkt)
diff --git a/internal/pkg/controller/device_test.go b/internal/pkg/controller/device_test.go
new file mode 100644
index 0000000..11084fd
--- /dev/null
+++ b/internal/pkg/controller/device_test.go
@@ -0,0 +1,211 @@
+/*
+* 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 controller
+
+import (
+	"context"
+	"reflect"
+	"testing"
+	"voltha-go-controller/internal/pkg/holder"
+	"voltha-go-controller/internal/pkg/of"
+	"voltha-go-controller/internal/test/mocks"
+
+	"github.com/golang/mock/gomock"
+	ofp "github.com/opencord/voltha-protos/v5/go/openflow_13"
+	"github.com/stretchr/testify/assert"
+)
+
+func TestNewDevicePort(t *testing.T) {
+	type args struct {
+		mp *ofp.OfpPort
+	}
+	tests := []struct {
+		name string
+		args args
+		want *DevicePort
+	}{
+		{
+			name: "NewDevicePort",
+			args: args{
+				mp: &ofp.OfpPort{
+					PortNo: uint32(1),
+				},
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			got := NewDevicePort(tt.args.mp)
+			assert.NotNil(t, got)
+		})
+	}
+}
+
+func TestDevice_UpdateFlows(t *testing.T) {
+	type args struct {
+		flow    *of.VoltFlow
+		devPort *DevicePort
+	}
+	tests := []struct {
+		name string
+		args args
+	}{
+		{
+			name: "Device_UpdateFlows",
+			args: args{
+				flow: &of.VoltFlow{
+					PortName: "test_port_name",
+				},
+				devPort: &DevicePort{
+					Name: "test_name",
+				},
+			},
+		},
+	}
+	for _, tt := range tests {
+		flushQueue := make(map[uint32]*UniIDFlowQueue)
+		flushQueue[uint32(1)] = &UniIDFlowQueue{
+			ID: uint32(1),
+		}
+		t.Run(tt.name, func(t *testing.T) {
+			d := &Device{
+				flowQueue: flushQueue,
+				flowHash:  uint32(1),
+			}
+			d.UpdateFlows(tt.args.flow, tt.args.devPort)
+		})
+	}
+}
+
+func TestNewDevice(t *testing.T) {
+	type args struct {
+		cntx         context.Context
+		id           string
+		slno         string
+		vclientHldr  *holder.VolthaServiceClientHolder
+		southBoundID string
+		mfr          string
+		hwDesc       string
+		swDesc       string
+	}
+	tests := []struct {
+		name string
+		args args
+		want *Device
+	}{
+		{
+			name: "TestNewDevice",
+			args: args{
+				cntx: context.Background(),
+				id:   "test_id",
+				slno: "test_sl_no",
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+			db = dbintf
+			dbintf.EXPECT().GetFlowHash(gomock.Any(), gomock.Any()).Return("1", nil).Times(1)
+			got := NewDevice(tt.args.cntx, tt.args.id, tt.args.slno, tt.args.vclientHldr, tt.args.southBoundID, tt.args.mfr, tt.args.hwDesc, tt.args.swDesc)
+			assert.NotNil(t, got)
+		})
+	}
+}
+
+func TestDevice_triggerFlowResultNotification(t *testing.T) {
+	type args struct {
+		cntx      context.Context
+		cookie    uint64
+		flow      *of.VoltSubFlow
+		oper      of.Command
+		bwDetails of.BwAvailDetails
+		err       error
+	}
+	tests := []struct {
+		name string
+		args args
+	}{
+		{
+			name: "Device_triggerFlowResultNotification",
+			args: args{
+				cntx:   context.Background(),
+				cookie: uint64(1),
+				flow: &of.VoltSubFlow{
+					Cookie: uint64(1),
+				},
+				oper: of.CommandAdd,
+				bwDetails: of.BwAvailDetails{
+					PrevBw: "test_prev_bw",
+				},
+				err: nil,
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			flows := make(map[uint64]*of.VoltSubFlow)
+			flows[uint64(1)] = &of.VoltSubFlow{
+				Cookie: uint64(1),
+			}
+			d := &Device{
+				flows: flows,
+			}
+			appMock := mocks.NewMockApp(gomock.NewController(t))
+			_ = NewController(context.Background(), appMock)
+			dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+			db = dbintf
+			dbintf.EXPECT().PutFlow(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(1)
+			appMock.EXPECT().ProcessFlowModResultIndication(gomock.Any(), gomock.Any()).Times(1)
+			d.triggerFlowResultNotification(tt.args.cntx, tt.args.cookie, tt.args.flow, tt.args.oper, tt.args.bwDetails, tt.args.err)
+		})
+	}
+}
+
+func TestDevice_ResetCache(t *testing.T) {
+	tests := []struct {
+		name string
+	}{
+		{
+			name: "Device_ResetCache",
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			d := &Device{}
+			d.ResetCache()
+		})
+	}
+}
+
+func TestDevice_GetAllFlows(t *testing.T) {
+	tests := []struct {
+		name string
+		want []*of.VoltSubFlow
+	}{
+		{
+			name: "Device_GetAllFlows",
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			d := &Device{}
+			if got := d.GetAllFlows(); !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("Device.GetAllFlows() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
diff --git a/internal/pkg/controller/modmeter_test.go b/internal/pkg/controller/modmeter_test.go
new file mode 100644
index 0000000..fb7df0f
--- /dev/null
+++ b/internal/pkg/controller/modmeter_test.go
@@ -0,0 +1,182 @@
+/*
+* 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 controller
+
+import (
+	"context"
+	"sync"
+	"testing"
+	"voltha-go-controller/internal/pkg/holder"
+	"voltha-go-controller/internal/pkg/of"
+	"voltha-go-controller/internal/test/mocks"
+
+	"github.com/golang/mock/gomock"
+	"github.com/stretchr/testify/assert"
+)
+
+func TestModMeterTask_Start(t *testing.T) {
+	type args struct {
+		ctx    context.Context
+		taskID uint8
+	}
+	tests := []struct {
+		name    string
+		args    args
+		wantErr bool
+	}{
+		{
+			name: "mmt.command == of.MeterCommandAdd",
+			args: args{
+				ctx:    context.Background(),
+				taskID: uint8(1),
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			meters := make(map[uint32]*of.Meter)
+			meters[uint32(1)] = &of.Meter{
+				ID: uint32(1),
+			}
+			volthaClientMock := mocks.NewMockVolthaServiceClient(gomock.NewController(t))
+			mmt := &ModMeterTask{
+				meter: &of.Meter{
+					ID: uint32(1),
+				},
+				device: &Device{
+					meterLock: sync.RWMutex{},
+					meters:    meters,
+					State:     DeviceStateUP,
+					vclientHolder: &holder.VolthaServiceClientHolder{
+						VolthaSvcClient: volthaClientMock,
+					},
+				},
+			}
+			mmt.meter.ID = uint32(2)
+			dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+			db = dbintf
+			dbintf.EXPECT().DelDeviceMeter(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
+			volthaClientMock.EXPECT().UpdateLogicalDeviceMeterTable(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
+			err := mmt.Start(tt.args.ctx, tt.args.taskID)
+			assert.Nil(t, err)
+		})
+	}
+}
+
+func TestNewModMeterTask(t *testing.T) {
+	type args struct {
+		ctx     context.Context
+		command of.MeterCommand
+		meter   *of.Meter
+		device  *Device
+	}
+	tests := []struct {
+		name string
+		args args
+		want *ModMeterTask
+	}{
+		{
+			name: "NewModMeterTask",
+			args: args{
+				ctx:     context.Background(),
+				command: of.MeterCommandAdd,
+				meter: &of.Meter{
+					ID: uint32(1),
+				},
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			got := NewModMeterTask(tt.args.ctx, tt.args.command, tt.args.meter, tt.args.device)
+			assert.NotNil(t, got)
+		})
+	}
+}
+
+func TestModMeterTask_Name(t *testing.T) {
+	tests := []struct {
+		name string
+		want string
+	}{
+		{
+			name: "ModMeterTask_Name",
+			want: "Add Flows Task",
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			mmt := &ModMeterTask{}
+			if got := mmt.Name(); got != tt.want {
+				t.Errorf("ModMeterTask.Name() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestModMeterTask_TaskID(t *testing.T) {
+	tests := []struct {
+		name string
+		want uint8
+	}{
+		{
+			name: "ModMeterTask_TaskID",
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			mmt := &ModMeterTask{}
+			if got := mmt.TaskID(); got != tt.want {
+				t.Errorf("ModMeterTask.TaskID() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestModMeterTask_Timestamp(t *testing.T) {
+	tests := []struct {
+		name string
+		want string
+	}{
+		{
+			name: "ModMeterTask_Timestamp",
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			mmt := &ModMeterTask{}
+			if got := mmt.Timestamp(); got != tt.want {
+				t.Errorf("ModMeterTask.Timestamp() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestModMeterTask_Stop(t *testing.T) {
+	tests := []struct {
+		name string
+	}{
+		{
+			name: "ModMeterTask_Stop",
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			mmt := &ModMeterTask{}
+			mmt.Stop()
+		})
+	}
+}
diff --git a/internal/pkg/controller/pendingprofiles_test.go b/internal/pkg/controller/pendingprofiles_test.go
index fe0639c..dfb17f6 100644
--- a/internal/pkg/controller/pendingprofiles_test.go
+++ b/internal/pkg/controller/pendingprofiles_test.go
@@ -21,6 +21,7 @@
 	"voltha-go-controller/internal/test/mocks"
 
 	"github.com/golang/mock/gomock"
+	"github.com/stretchr/testify/assert"
 )
 
 func TestPendingProfilesTask_Start(t *testing.T) {
@@ -60,3 +61,103 @@
 		})
 	}
 }
+
+func TestNewPendingProfilesTask(t *testing.T) {
+	type args struct {
+		device *Device
+	}
+	tests := []struct {
+		name string
+		args args
+		want *PendingProfilesTask
+	}{
+		{
+			name: "NewPendingProfilesTask",
+			args: args{
+				device: &Device{
+					ctx: context.Background(),
+				},
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			got := NewPendingProfilesTask(tt.args.device)
+			assert.NotNil(t, got)
+		})
+	}
+}
+
+func TestPendingProfilesTask_Name(t *testing.T) {
+	tests := []struct {
+		name string
+		want string
+	}{
+		{
+			name: "PendingProfilesTask_Name",
+			want: "Pending Profiles Task",
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			ppt := &PendingProfilesTask{}
+			if got := ppt.Name(); got != tt.want {
+				t.Errorf("PendingProfilesTask.Name() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestPendingProfilesTask_TaskID(t *testing.T) {
+	tests := []struct {
+		name string
+		want uint8
+	}{
+		{
+			name: "PendingProfilesTask_TaskID",
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			ppt := &PendingProfilesTask{}
+			if got := ppt.TaskID(); got != tt.want {
+				t.Errorf("PendingProfilesTask.TaskID() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestPendingProfilesTask_Timestamp(t *testing.T) {
+	tests := []struct {
+		name string
+		want string
+	}{
+		{
+			name: "PendingProfilesTask_Timestamp",
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			ppt := &PendingProfilesTask{}
+			if got := ppt.Timestamp(); got != tt.want {
+				t.Errorf("PendingProfilesTask.Timestamp() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestPendingProfilesTask_Stop(t *testing.T) {
+	tests := []struct {
+		name string
+	}{
+		{
+			name: "PendingProfilesTask_Stop",
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			ppt := &PendingProfilesTask{}
+			ppt.Stop()
+		})
+	}
+}
diff --git a/internal/pkg/controller/utils_test.go b/internal/pkg/controller/utils_test.go
new file mode 100644
index 0000000..323b388
--- /dev/null
+++ b/internal/pkg/controller/utils_test.go
@@ -0,0 +1,66 @@
+/*
+* 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 controller
+
+import (
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+)
+
+func TestPadString(t *testing.T) {
+	type args struct {
+		value   string
+		padSize int
+	}
+	tests := []struct {
+		name string
+		args args
+	}{
+		{
+			name: "PadString",
+			args: args{
+				value:   "test_value",
+				padSize: 20,
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			got := PadString(tt.args.value, tt.args.padSize)
+			assert.NotNil(t, got)
+		})
+	}
+}
+
+func TestGetXid(t *testing.T) {
+	tests := []struct {
+		name string
+		want uint32
+	}{
+		{
+			name: "GetXid",
+			want: uint32(2),
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := GetXid(); got != tt.want {
+				t.Errorf("GetXid() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}