[VOL-2081][VOL-2082] UTs for RO-Core logical_device_manager and model_proxy_manager

Change-Id: I8f5a61e4ec0eff12cabc043383bb47055811cd56
diff --git a/go.mod b/go.mod
index b146eae..55e0ceb 100644
--- a/go.mod
+++ b/go.mod
@@ -8,11 +8,10 @@
 	github.com/golang/protobuf v1.3.2
 	github.com/google/uuid v1.1.1
 	github.com/gyuho/goraph v0.0.0-20160328020532-d460590d53a9
-	github.com/opencord/voltha-lib-go/v2 v2.2.13
 	github.com/mdlayher/ethernet v0.0.0-20190606142754-0394541c37b7 // indirect
+	github.com/opencord/voltha-lib-go/v2 v2.2.13
 	github.com/opencord/voltha-protos/v2 v2.0.1
 	github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
 	github.com/stretchr/testify v1.4.0
-	google.golang.org/appengine v1.4.0 // indirect
 	google.golang.org/grpc v1.24.0
 )
diff --git a/ro_core/core/logical_device_manager_test.go b/ro_core/core/logical_device_manager_test.go
new file mode 100644
index 0000000..b9fb2a1
--- /dev/null
+++ b/ro_core/core/logical_device_manager_test.go
@@ -0,0 +1,449 @@
+/*
+ * Copyright 2019-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 core
+
+import (
+	"context"
+	"github.com/opencord/voltha-go/db/model"
+	"github.com/opencord/voltha-go/ro_core/config"
+	"github.com/opencord/voltha-protos/v2/go/openflow_13"
+	"github.com/opencord/voltha-protos/v2/go/voltha"
+	"github.com/stretchr/testify/assert"
+	"reflect"
+	"testing"
+)
+
+func MakeTestNewCoreConfig() *Core {
+	var core Core
+	core.instanceId = "ro_core"
+	core.config = config.NewROCoreFlags()
+	core.clusterDataRoot = model.NewRoot(&voltha.Voltha{}, nil)
+	core.clusterDataProxy = core.clusterDataRoot.CreateProxy(context.Background(), "/", false)
+	core.genericMgr = newModelProxyManager(core.clusterDataProxy)
+	core.deviceMgr = newDeviceManager(core.clusterDataProxy, core.instanceId)
+
+	return &core
+}
+
+func TestNewLogicalDeviceManager(t *testing.T) {
+	core := MakeTestNewCoreConfig()
+
+	logicalDevMgr := newLogicalDeviceManager(core.deviceMgr, core.clusterDataProxy)
+	assert.NotNil(t, logicalDevMgr)
+}
+
+func TestAddLogicalDeviceAgentToMap(t *testing.T) {
+	core := MakeTestNewCoreConfig()
+	ldMgr := newLogicalDeviceManager(core.deviceMgr, core.clusterDataProxy)
+	assert.NotNil(t, ldMgr)
+
+	// Before ADD
+	ldAgentNil := ldMgr.getLogicalDeviceAgent("id")
+	assert.Nil(t, ldAgentNil)
+
+	/*** Case: addLogicalDeviceAgentToMap() is Success ***/
+	ldAgent := newLogicalDeviceAgent("id", "", ldMgr, core.deviceMgr, core.clusterDataProxy)
+	assert.NotNil(t, ldAgent)
+	ldMgr.addLogicalDeviceAgentToMap(ldAgent)
+
+	// Verify ADD is successful
+	ldAgentNotNil := ldMgr.getLogicalDeviceAgent("id")
+	assert.NotNil(t, ldAgentNotNil)
+	assert.Equal(t, "id", ldAgentNotNil.logicalDeviceId)
+}
+
+func TestGetLogicalDeviceAgent(t *testing.T) {
+	core := MakeTestNewCoreConfig()
+	ldMgr := newLogicalDeviceManager(core.deviceMgr, core.clusterDataProxy)
+	assert.NotNil(t, ldMgr)
+
+	/*** Case: getLogicalDeviceAgent() is NIL ***/
+	ldAgentNil := ldMgr.getLogicalDeviceAgent("id")
+	assert.Nil(t, ldAgentNil)
+
+	/*** Case: getLogicalDeviceAgent() is Success ***/
+	ldAgent := newLogicalDeviceAgent("id", "", ldMgr, core.deviceMgr, core.clusterDataProxy)
+	assert.NotNil(t, ldAgent)
+	ldMgr.addLogicalDeviceAgentToMap(ldAgent)
+	ldAgentNotNil := ldMgr.getLogicalDeviceAgent("id")
+	assert.NotNil(t, ldAgentNotNil)
+	assert.Equal(t, "id", ldAgentNotNil.logicalDeviceId)
+}
+
+func TestDeleteLogicalDeviceAgent(t *testing.T) {
+	core := MakeTestNewCoreConfig()
+	ldMgr := newLogicalDeviceManager(core.deviceMgr, core.clusterDataProxy)
+	assert.NotNil(t, ldMgr)
+
+	/*** Case: deleteLogicalDeviceAgent() with Invalid Value ***/
+	ldAgentNilChk := ldMgr.getLogicalDeviceAgent("invalid_id")
+	assert.Nil(t, ldAgentNilChk)
+	ldMgr.deleteLogicalDeviceAgent("invalid_id")
+
+	/*** Case: deleteLogicalDeviceAgent() is Success ***/
+	// Initialize and Add Logical Device Agent
+	ldAgent := newLogicalDeviceAgent("id", "", ldMgr, core.deviceMgr, core.clusterDataProxy)
+	assert.NotNil(t, ldAgent)
+	ldMgr.addLogicalDeviceAgentToMap(ldAgent)
+
+	// Verify ADD is successful
+	ldAgentNotNil := ldMgr.getLogicalDeviceAgent("id")
+	assert.NotNil(t, ldAgentNotNil)
+	assert.Equal(t, "id", ldAgentNotNil.logicalDeviceId)
+
+	// Method under Test
+	ldMgr.deleteLogicalDeviceAgent("id")
+
+	// Verify DEL is successful
+	ldAgentNil := ldMgr.getLogicalDeviceAgent("id")
+	assert.Nil(t, ldAgentNil)
+}
+
+func TestLdMgrGetLogicalDevice(t *testing.T) {
+	wantResult := &voltha.LogicalDevice{}
+
+	core := MakeTestNewCoreConfig()
+	ldMgr := newLogicalDeviceManager(core.deviceMgr, core.clusterDataProxy)
+	assert.NotNil(t, ldMgr)
+
+	/*** Case: getLogicalDevice() is NIL ***/
+	logicalDevNil, errNotNil := ldMgr.getLogicalDevice("id")
+	assert.Nil(t, logicalDevNil)
+	assert.NotNil(t, errNotNil)
+
+	/*** Case: getLogicalDevice() is Success ***/
+	// Add Data
+	if added := core.clusterDataProxy.Add(
+		context.Background(),
+		"/logical_devices",
+		&voltha.LogicalDevice{
+			Id: "id",
+		},
+		""); added == nil {
+		t.Error("Failed to add logical device")
+	}
+	ldAgent := newLogicalDeviceAgent("id", "device_id", ldMgr, core.deviceMgr, core.clusterDataProxy)
+	assert.NotNil(t, ldAgent)
+	ldMgr.addLogicalDeviceAgentToMap(ldAgent)
+
+	// Verify Add is successful
+	ldAgentNotNil := ldMgr.getLogicalDeviceAgent("id")
+	assert.NotNil(t, ldAgentNotNil)
+	assert.Equal(t, "id", ldAgentNotNil.logicalDeviceId)
+
+	// Verify getLogicalDevice() is NOT NIL
+	logicalDevNotNil, errNil := ldMgr.getLogicalDevice("id")
+	assert.NotNil(t, logicalDevNotNil)
+	assert.Nil(t, errNil)
+	if reflect.TypeOf(logicalDevNotNil) != reflect.TypeOf(wantResult) {
+		t.Errorf("GetLogicalDevice() = %v, want %v", logicalDevNotNil, wantResult)
+	}
+	assert.Equal(t, "id", logicalDevNotNil.Id)
+}
+
+func TestListLogicalDevices(t *testing.T) {
+	wantResult := &voltha.LogicalDevices{}
+
+	core := MakeTestNewCoreConfig()
+	ldMgr := newLogicalDeviceManager(core.deviceMgr, core.clusterDataProxy)
+	assert.NotNil(t, ldMgr)
+
+	/*** Case: listLogicalDevices() is Empty ***/
+	result, error := ldMgr.listLogicalDevices()
+	assert.NotNil(t, result)
+	assert.Nil(t, error)
+	if reflect.TypeOf(result) != reflect.TypeOf(wantResult) {
+		t.Errorf("ListLogicalDevices() = %v, want %v", result, wantResult)
+	}
+	assert.Empty(t, result)
+}
+
+func TestLoad(t *testing.T) {
+	core := MakeTestNewCoreConfig()
+	ldMgr := newLogicalDeviceManager(core.deviceMgr, core.clusterDataProxy)
+	assert.NotNil(t, ldMgr)
+
+	/*** Case: Error Scenario ***/
+	error := ldMgr.load("id")
+	assert.NotNil(t, error)
+}
+
+func TestGetLogicalDeviceId(t *testing.T) {
+	core := MakeTestNewCoreConfig()
+	ldMgr := newLogicalDeviceManager(core.deviceMgr, core.clusterDataProxy)
+	assert.NotNil(t, ldMgr)
+
+	/*** Case: Logical Device Id Found ***/
+	result0, error0 := ldMgr.getLogicalDeviceId(&voltha.Device{Id: "id", Root: true, ParentId: "parent_id"})
+	assert.NotNil(t, result0)
+	assert.Nil(t, error0)
+
+	/*** Case: Logical Device Id Not Found ***/
+	result1, error1 := ldMgr.getLogicalDeviceId(&voltha.Device{Id: "id", ParentId: "parent_id"})
+	assert.Nil(t, result1)
+	assert.NotNil(t, error1)
+}
+
+func TestGetLogicalPortId(t *testing.T) {
+	wantResult := &voltha.LogicalPortId{}
+
+	core := MakeTestNewCoreConfig()
+	ldMgr := newLogicalDeviceManager(core.deviceMgr, core.clusterDataProxy)
+	assert.NotNil(t, ldMgr)
+
+	/*** Case: Logical Port Id Not Found: getLogicalDeviceId() Error ***/
+	result0, error0 := ldMgr.getLogicalPortId(&voltha.Device{Id: "id", ParentId: "parent_id"})
+	assert.Nil(t, result0)
+	assert.NotNil(t, error0)
+
+	/*** Case: Logical Port Id Not Found: getLogicalDevice() Error ***/
+	result1, error1 := ldMgr.getLogicalPortId(&voltha.Device{Id: "id", Root: true, ParentId: "parent_id"})
+	assert.Nil(t, result1)
+	assert.NotNil(t, error1)
+
+	/*** Case: Logical Port Id Found ***/
+	device := &voltha.Device{Id: "id", Root: true, ParentId: "parent_id"}
+
+	// Add Data
+	if added := core.clusterDataProxy.Add(
+		context.Background(),
+		"/logical_devices",
+		&voltha.LogicalDevice{
+			Id: "parent_id",
+			Ports: []*voltha.LogicalPort{
+				{
+					Id:       "123",
+					DeviceId: "id",
+				},
+			},
+		},
+		""); added == nil {
+		t.Error("Failed to add logical device")
+	}
+	ldAgent := newLogicalDeviceAgent("parent_id", "device_id", ldMgr, core.deviceMgr, core.clusterDataProxy)
+	assert.NotNil(t, ldAgent)
+	ldMgr.addLogicalDeviceAgentToMap(ldAgent)
+
+	// Verify Add is successful
+	ldAgentNotNil := ldMgr.getLogicalDeviceAgent("parent_id")
+	assert.NotNil(t, ldAgentNotNil)
+	assert.Equal(t, "parent_id", ldAgentNotNil.logicalDeviceId)
+
+	// Verify getLogicalPortId() is Success
+	result2, error2 := ldMgr.getLogicalPortId(device)
+	assert.NotNil(t, result2)
+	assert.Nil(t, error2)
+	if reflect.TypeOf(result2) != reflect.TypeOf(wantResult) {
+		t.Errorf("GetLogicalPortId() = %v, want %v", result2, wantResult)
+	}
+	assert.Equal(t, "parent_id", result2.Id)
+}
+
+func TestListLogicalDevicePorts(t *testing.T) {
+	core := MakeTestNewCoreConfig()
+	ldMgr := newLogicalDeviceManager(core.deviceMgr, core.clusterDataProxy)
+	assert.NotNil(t, ldMgr)
+
+	/*** Case: Logical Device Ports Not Found ***/
+	result0, error0 := ldMgr.ListLogicalDevicePorts(context.Background(), "id")
+	assert.Nil(t, result0)
+	assert.NotNil(t, error0)
+
+	/*** Case: Logical Device Ports Found ***/
+	wantResult := &voltha.LogicalPorts{
+		Items: []*voltha.LogicalPort{
+			{
+				Id: "123",
+			},
+		},
+	}
+
+	// Add Data
+	if added := core.clusterDataProxy.Add(
+		context.Background(),
+		"/logical_devices",
+		&voltha.LogicalDevice{
+			Id: "id",
+			Ports: []*voltha.LogicalPort{
+				{
+					Id: "123",
+				},
+			},
+		},
+		""); added == nil {
+		t.Error("Failed to add logical device")
+	}
+	ldAgent := newLogicalDeviceAgent("id", "", ldMgr, core.deviceMgr, core.clusterDataProxy)
+	ldMgr.addLogicalDeviceAgentToMap(ldAgent)
+
+	// Verify Add is successful
+	ldAgentNotNil := ldMgr.getLogicalDeviceAgent("id")
+	assert.NotNil(t, ldAgentNotNil)
+	assert.Equal(t, "id", ldAgentNotNil.logicalDeviceId)
+
+	// Verify ListLogicalDevicePorts() is Success
+	result1, error1 := ldMgr.ListLogicalDevicePorts(context.Background(), "id")
+	assert.NotNil(t, result1)
+	assert.Nil(t, error1)
+	if reflect.TypeOf(result1) != reflect.TypeOf(wantResult) {
+		t.Errorf("ListLogicalDevicePorts() = %v, want %v", result1, wantResult)
+	}
+	assert.Equal(t, wantResult, result1)
+}
+
+func TestListLogicalDeviceFlows(t *testing.T) {
+	core := MakeTestNewCoreConfig()
+	ldMgr := newLogicalDeviceManager(core.deviceMgr, core.clusterDataProxy)
+	assert.NotNil(t, ldMgr)
+
+	/*** Case: Logical Device Flows Not Found ***/
+	result0, error0 := ldMgr.ListLogicalDeviceFlows(context.Background(), "id")
+	assert.Nil(t, result0)
+	assert.NotNil(t, error0)
+
+	/*** Case: Logical Device Flows Found ***/
+	wantResult := &voltha.Flows{}
+
+	// Add Data
+	if added := core.clusterDataProxy.Add(
+		context.Background(),
+		"/logical_devices",
+		&voltha.LogicalDevice{
+			Id: "id",
+			Flows: &openflow_13.Flows{
+				Items: []*openflow_13.OfpFlowStats{
+					&openflow_13.OfpFlowStats{
+						Id: 1111,
+					},
+				},
+			},
+		},
+		""); added == nil {
+		t.Error("Failed to add logical device")
+	}
+	ldAgent := newLogicalDeviceAgent("id", "", ldMgr, core.deviceMgr, core.clusterDataProxy)
+	ldMgr.addLogicalDeviceAgentToMap(ldAgent)
+
+	// Verify Add is successful
+	ldAgentNotNil := ldMgr.getLogicalDeviceAgent("id")
+	assert.NotNil(t, ldAgentNotNil)
+	assert.Equal(t, "id", ldAgentNotNil.logicalDeviceId)
+
+	// Verify ListLogicalDeviceFlows() is Success
+	result1, error1 := ldMgr.ListLogicalDeviceFlows(context.Background(), "id")
+	assert.NotNil(t, result1)
+	assert.Nil(t, error1)
+	if reflect.TypeOf(result1) != reflect.TypeOf(wantResult) {
+		t.Errorf("ListLogicalDeviceFlows() = %v, want %v", result1, wantResult)
+	}
+	assert.NotEmpty(t, result1)
+}
+
+func TestListLogicalDeviceFlowGroups(t *testing.T) {
+	core := MakeTestNewCoreConfig()
+	ldMgr := newLogicalDeviceManager(core.deviceMgr, core.clusterDataProxy)
+	assert.NotNil(t, ldMgr)
+
+	/*** Case: Logical Device Flow Groups Not Found ***/
+	result0, error0 := ldMgr.ListLogicalDeviceFlowGroups(context.Background(), "id")
+	assert.Nil(t, result0)
+	assert.NotNil(t, error0)
+
+	/*** Case: Logical Device Flow Groups Found ***/
+	wantResult := &voltha.FlowGroups{}
+
+	// Add Data
+	if added := core.clusterDataProxy.Add(
+		context.Background(),
+		"/logical_devices",
+		&voltha.LogicalDevice{
+			Id: "id",
+			FlowGroups: &openflow_13.FlowGroups{
+				Items: []*openflow_13.OfpGroupEntry{
+					{
+						Stats: &openflow_13.OfpGroupStats{
+							GroupId: 1,
+						},
+					},
+				},
+			},
+		},
+		""); added == nil {
+		t.Error("Failed to add logical device")
+	}
+	ldAgent := newLogicalDeviceAgent("id", "", ldMgr, core.deviceMgr, core.clusterDataProxy)
+	ldMgr.addLogicalDeviceAgentToMap(ldAgent)
+
+	// Verify Add is successful
+	ldAgentNotNil := ldMgr.getLogicalDeviceAgent("id")
+	assert.NotNil(t, ldAgentNotNil)
+	assert.Equal(t, "id", ldAgentNotNil.logicalDeviceId)
+
+	// Verify ListLogicalDeviceFlowGroups() is Success
+	result1, error1 := ldMgr.ListLogicalDeviceFlowGroups(context.Background(), "id")
+	assert.NotNil(t, result1)
+	assert.Nil(t, error1)
+	if reflect.TypeOf(result1) != reflect.TypeOf(wantResult) {
+		t.Errorf("ListLogicalDeviceFlowGroups() = %v, want %v", result1, wantResult)
+	}
+	assert.NotEmpty(t, result1)
+}
+
+func TestGetLogicalPort(t *testing.T) {
+	core := MakeTestNewCoreConfig()
+	ldMgr := newLogicalDeviceManager(core.deviceMgr, core.clusterDataProxy)
+	assert.NotNil(t, ldMgr)
+
+	/*** Case: Logical Port Not Found: getLogicalDevice() Error ***/
+	result0, error0 := ldMgr.getLogicalPort(&voltha.LogicalPortId{Id: "id", PortId: "123"})
+	assert.Nil(t, result0)
+	assert.NotNil(t, error0)
+
+	/*** Case: Logical Port Found ***/
+	wantResult := &voltha.LogicalPort{Id: "123"}
+
+	// Add Data
+	if added := core.clusterDataProxy.Add(
+		context.Background(),
+		"/logical_devices",
+		&voltha.LogicalDevice{
+			Id: "id",
+			Ports: []*voltha.LogicalPort{
+				{
+					Id: "123",
+				},
+			},
+		},
+		""); added == nil {
+		t.Error("Failed to add logical device")
+	}
+	ldAgent := newLogicalDeviceAgent("id", "", ldMgr, core.deviceMgr, core.clusterDataProxy)
+	ldMgr.addLogicalDeviceAgentToMap(ldAgent)
+
+	// Verify Add is successful
+	ldAgentNotNil := ldMgr.getLogicalDeviceAgent("id")
+	assert.NotNil(t, ldAgentNotNil)
+	assert.Equal(t, "id", ldAgentNotNil.logicalDeviceId)
+
+	// Verify getLogicalPort() is Success
+	result1, error1 := ldMgr.getLogicalPort(&voltha.LogicalPortId{Id: "id", PortId: "123"})
+	assert.NotNil(t, result1)
+	assert.Nil(t, error1)
+	if reflect.TypeOf(result1) != reflect.TypeOf(wantResult) {
+		t.Errorf("getLogicalPort() = %v, want %v", result1, wantResult)
+	}
+	assert.Equal(t, wantResult, result1)
+}
diff --git a/ro_core/core/model_proxy_manager_test.go b/ro_core/core/model_proxy_manager_test.go
new file mode 100644
index 0000000..4437afa
--- /dev/null
+++ b/ro_core/core/model_proxy_manager_test.go
@@ -0,0 +1,287 @@
+/*
+ * Copyright 2019-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 core
+
+import (
+	"context"
+	"github.com/opencord/voltha-go/db/model"
+	"github.com/opencord/voltha-protos/v2/go/voltha"
+	"github.com/stretchr/testify/assert"
+	"reflect"
+	"testing"
+)
+
+func makeModelProxyManagerObj() *ModelProxyManager {
+	cdRoot := model.NewRoot(&voltha.Voltha{}, nil)
+	cdProxy := cdRoot.CreateProxy(context.Background(), "/", false)
+	mpMgr := newModelProxyManager(cdProxy)
+	return mpMgr
+}
+
+func TestNewModelProxyManager(t *testing.T) {
+	type args struct {
+		clusterDataProxy *model.Proxy
+	}
+	tests := []struct {
+		name string
+		args args
+		want *ModelProxyManager
+	}{
+		{"NewModelProxyManager", args{&model.Proxy{}}, &ModelProxyManager{}},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := newModelProxyManager(tt.args.clusterDataProxy); reflect.TypeOf(got) != reflect.TypeOf(tt.want) {
+				t.Errorf("newModelProxy() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestGetVoltha(t *testing.T) {
+	wantResult := &voltha.Voltha{}
+	mpMgr := makeModelProxyManagerObj()
+	result, err := mpMgr.GetVoltha(context.Background())
+	if reflect.TypeOf(result) != reflect.TypeOf(wantResult) {
+		t.Errorf("GetVoltha() = %v, want %v", result, wantResult)
+	}
+	assert.NotNil(t, result)
+	assert.Nil(t, err)
+}
+
+func TestListCoreInstances(t *testing.T) {
+	wantResult := &voltha.CoreInstances{}
+	mpMgr := makeModelProxyManagerObj()
+	result, err := mpMgr.ListCoreInstances(context.Background())
+	if reflect.TypeOf(result) != reflect.TypeOf(wantResult) {
+		t.Errorf("ListCoreInstances() = %v, want %v", result, wantResult)
+	}
+	assert.Nil(t, result.Items)
+	assert.NotNil(t, err)
+}
+
+func TestGetCoreInstance(t *testing.T) {
+	wantResult := &voltha.CoreInstance{}
+	mpMgr := makeModelProxyManagerObj()
+	result, err := mpMgr.GetCoreInstance(context.Background(), "id")
+	if reflect.TypeOf(result) != reflect.TypeOf(wantResult) {
+		t.Errorf("GetCoreInstance() = %v, want %v", result, wantResult)
+	}
+	assert.NotNil(t, err)
+}
+
+func TestListAdapters(t *testing.T) {
+	wantResult := &voltha.Adapters{
+		Items: []*voltha.Adapter{
+			{
+				Id: "id",
+			},
+		},
+	}
+
+	mpMgr := makeModelProxyManagerObj()
+
+	// Case 1: Not Found
+	result0, err0 := mpMgr.ListAdapters(context.Background())
+	if reflect.TypeOf(result0) != reflect.TypeOf(wantResult) {
+		t.Errorf("ListAdapters() = %v, want %v", result0, wantResult)
+	}
+	assert.Nil(t, result0.Items)
+	assert.Nil(t, err0)
+
+	// Case 2: Found
+	if added := mpMgr.clusterDataProxy.Add(context.Background(), "/adapters", &voltha.Adapter{Id: "id"}, ""); added == nil {
+		t.Error("Failed to add adapter")
+	}
+	result1, err1 := mpMgr.ListAdapters(context.Background())
+	if reflect.TypeOf(result1) != reflect.TypeOf(wantResult) {
+		t.Errorf("ListAdapters() = %v, want %v", result1, wantResult)
+	}
+	assert.NotNil(t, result1.Items)
+	assert.Nil(t, err1)
+	assert.Equal(t, wantResult, result1)
+}
+
+func TestListDeviceTypes(t *testing.T) {
+	wantResult := &voltha.DeviceTypes{
+		Items: []*voltha.DeviceType{
+			{
+				Id: "id",
+			},
+		},
+	}
+
+	mpMgr := makeModelProxyManagerObj()
+
+	// Case 1: Not Found
+	result0, err0 := mpMgr.ListDeviceTypes(context.Background())
+	if reflect.TypeOf(result0) != reflect.TypeOf(wantResult) {
+		t.Errorf("ListDeviceTypes() = %v, want %v", result0, wantResult)
+	}
+	assert.Nil(t, result0.Items)
+	assert.Nil(t, err0)
+
+	// Case 2: Found
+	if added := mpMgr.clusterDataProxy.Add(context.Background(), "/device_types", &voltha.DeviceType{Id: "id"}, ""); added == nil {
+		t.Error("Failed to add device type")
+	}
+	result1, err1 := mpMgr.ListDeviceTypes(context.Background())
+	if reflect.TypeOf(result1) != reflect.TypeOf(wantResult) {
+		t.Errorf("ListDeviceTypes() = %v, want %v", result1, wantResult)
+	}
+	assert.NotNil(t, result1.Items)
+	assert.Nil(t, err1)
+	assert.Equal(t, wantResult, result1)
+}
+
+func TestGetDeviceType(t *testing.T) {
+	wantResult := &voltha.DeviceType{}
+	mpMgr := makeModelProxyManagerObj()
+
+	// Case 1: Not Found
+	result0, err0 := mpMgr.GetDeviceType(context.Background(), "id")
+	if reflect.TypeOf(result0) != reflect.TypeOf(wantResult) {
+		t.Errorf("GetDeviceType() = %v, want %v", result0, wantResult)
+	}
+	assert.Nil(t, result0)
+	assert.NotNil(t, err0)
+
+	// Case 2: Found
+	if added := mpMgr.clusterDataProxy.Add(context.Background(), "/device_types", &voltha.DeviceType{Id: "id"}, ""); added == nil {
+		t.Error("Failed to add device type")
+	}
+	result1, err1 := mpMgr.GetDeviceType(context.Background(), "id")
+	if reflect.TypeOf(result1) != reflect.TypeOf(wantResult) {
+		t.Errorf("GetDeviceType() = %v, want %v", result1, wantResult)
+	}
+	assert.NotNil(t, result1)
+	assert.Nil(t, err1)
+	assert.Equal(t, "id", result1.Id)
+}
+
+func TestListDeviceGroups(t *testing.T) {
+	wantResult := &voltha.DeviceGroups{
+		Items: []*voltha.DeviceGroup{
+			{
+				Id: "id",
+			},
+		},
+	}
+
+	mpMgr := makeModelProxyManagerObj()
+
+	// Case 1: Not Found
+	result0, err0 := mpMgr.ListDeviceGroups(context.Background())
+	if reflect.TypeOf(result0) != reflect.TypeOf(wantResult) {
+		t.Errorf("ListDeviceGroups() = %v, want %v", result0, wantResult)
+	}
+	assert.Nil(t, result0.Items)
+	assert.Nil(t, err0)
+
+	// Case 2: Found
+	if added := mpMgr.clusterDataProxy.Add(context.Background(), "/device_groups", &voltha.DeviceGroup{Id: "id"}, ""); added == nil {
+		t.Error("Failed to add device group")
+	}
+	result1, err1 := mpMgr.ListDeviceGroups(context.Background())
+	if reflect.TypeOf(result1) != reflect.TypeOf(wantResult) {
+		t.Errorf("ListDeviceGroups() = %v, want %v", result1, wantResult)
+	}
+	assert.NotNil(t, result1.Items)
+	assert.Nil(t, err1)
+	assert.Equal(t, wantResult, result1)
+}
+
+func TestGetDeviceGroup(t *testing.T) {
+	wantResult := &voltha.DeviceGroup{}
+	mpMgr := makeModelProxyManagerObj()
+
+	// Case 1: Not Found
+	result0, err0 := mpMgr.GetDeviceGroup(context.Background(), "id")
+	if reflect.TypeOf(result0) != reflect.TypeOf(wantResult) {
+		t.Errorf("GetDeviceGroup() = %v, want %v", result0, wantResult)
+	}
+	assert.Nil(t, result0)
+	assert.NotNil(t, err0)
+
+	// Case 2: Found
+	if added := mpMgr.clusterDataProxy.Add(context.Background(), "/device_groups", &voltha.DeviceGroup{Id: "id"}, ""); added == nil {
+		t.Error("Failed to add device group")
+	}
+	result1, err1 := mpMgr.GetDeviceGroup(context.Background(), "id")
+	if reflect.TypeOf(result1) != reflect.TypeOf(wantResult) {
+		t.Errorf("GetDeviceGroup() = %v, want %v", result1, wantResult)
+	}
+	assert.NotNil(t, result1)
+	assert.Nil(t, err1)
+	assert.Equal(t, "id", result1.Id)
+}
+
+func TestListAlarmFilters(t *testing.T) {
+	wantResult := &voltha.AlarmFilters{
+		Filters: []*voltha.AlarmFilter{
+			{
+				Id: "id",
+			},
+		},
+	}
+
+	mpMgr := makeModelProxyManagerObj()
+
+	// Case 1: Not Found
+	result0, err0 := mpMgr.ListAlarmFilters(context.Background())
+	if reflect.TypeOf(result0) != reflect.TypeOf(wantResult) {
+		t.Errorf("ListAlarmFilters() = %v, want %v", result0, wantResult)
+	}
+	assert.Nil(t, result0.Filters)
+	assert.Nil(t, err0)
+
+	// Case 2: Found
+	if added := mpMgr.clusterDataProxy.Add(context.Background(), "/alarm_filters", &voltha.AlarmFilter{Id: "id"}, ""); added == nil {
+		t.Error("Failed to add alarm filter")
+	}
+	result1, err1 := mpMgr.ListAlarmFilters(context.Background())
+	if reflect.TypeOf(result1) != reflect.TypeOf(wantResult) {
+		t.Errorf("ListAlarmFilters() = %v, want %v", result1, wantResult)
+	}
+	assert.NotNil(t, result1.Filters)
+	assert.Nil(t, err1)
+	assert.Equal(t, wantResult, result1)
+}
+
+func TestGetAlarmFilter(t *testing.T) {
+	wantResult := &voltha.AlarmFilter{}
+	mpMgr := makeModelProxyManagerObj()
+
+	// Case 1: Not Found
+	result0, err0 := mpMgr.GetAlarmFilter(context.Background(), "id")
+	if reflect.TypeOf(result0) != reflect.TypeOf(wantResult) {
+		t.Errorf("GetAlarmFilter() = %v, want %v", result0, wantResult)
+	}
+	assert.Nil(t, result0)
+	assert.NotNil(t, err0)
+
+	// Case 2: Found
+	if added := mpMgr.clusterDataProxy.Add(context.Background(), "/alarm_filters", &voltha.AlarmFilter{Id: "id"}, ""); added == nil {
+		t.Error("Failed to add alarm filter")
+	}
+	result1, err1 := mpMgr.GetAlarmFilter(context.Background(), "id")
+	if reflect.TypeOf(result1) != reflect.TypeOf(wantResult) {
+		t.Errorf("GetAlarmFilter() = %v, want %v", result1, wantResult)
+	}
+	assert.NotNil(t, result1)
+	assert.Nil(t, err1)
+	assert.Equal(t, "id", result1.Id)
+}