[VOL-1158] Initial commit of grpc voltha service handler.  Also
add license to all files.

Change-Id: I923a53504c74939c1db8177df6197694f2c2b3cd
diff --git a/rw_core/config/config.go b/rw_core/config/config.go
index 8b2c165..32b7abb 100644
--- a/rw_core/config/config.go
+++ b/rw_core/config/config.go
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2018-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 config
 
 import (
@@ -15,7 +30,7 @@
 	EtcdStoreName            = "etcd"
 	default_InstanceID       = "rwcore001"
 	default_GrpcPort         = 50057
-	default_GrpcHost         = "10.100.198.240"
+	default_GrpcHost         = "127.0.0.1"
 	default_KafkaAdapterHost = "10.100.198.240"
 	default_KafkaAdapterPort = 9092
 	default_KafkaClusterHost = "10.100.198.240"
diff --git a/rw_core/core/requestHandlerProxy.go b/rw_core/core/requestHandlerProxy.go
index 4bfafa5..1582906 100644
--- a/rw_core/core/requestHandlerProxy.go
+++ b/rw_core/core/requestHandlerProxy.go
@@ -1,18 +1,33 @@
+/*
+ * Copyright 2018-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 (
+	"errors"
+	"github.com/golang/protobuf/ptypes"
 	"github.com/opencord/voltha-go/common/log"
 	ca "github.com/opencord/voltha-go/protos/core_adapter"
 	"github.com/opencord/voltha-go/protos/voltha"
-	"github.com/golang/protobuf/ptypes"
-	"errors"
 )
 
 type RequestHandlerProxy struct {
 	TestMode bool
 }
 
-func (rhp *RequestHandlerProxy) GetDevice(args []*ca.Argument)(error, *voltha.Device) {
+func (rhp *RequestHandlerProxy) GetDevice(args []*ca.Argument) (error, *voltha.Device) {
 	if len(args) != 1 {
 		log.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
@@ -32,8 +47,7 @@
 	return nil, nil
 }
 
-
-func (rhp *RequestHandlerProxy) GetChildDevice(args []*ca.Argument)(error, *voltha.Device) {
+func (rhp *RequestHandlerProxy) GetChildDevice(args []*ca.Argument) (error, *voltha.Device) {
 	if len(args) < 1 {
 		log.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
@@ -53,7 +67,7 @@
 	return nil, nil
 }
 
-func (rhp *RequestHandlerProxy) GetPorts(args []*ca.Argument)(error, *voltha.Ports) {
+func (rhp *RequestHandlerProxy) GetPorts(args []*ca.Argument) (error, *voltha.Ports) {
 	if len(args) != 2 {
 		log.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
@@ -75,7 +89,7 @@
 	log.Debugw("GetPorts", log.Fields{"deviceID": pID.Val, "portype": pt.Val})
 
 	if rhp.TestMode { // Execute only for test cases
-		aPort := &voltha.Port{Label:"test_port"}
+		aPort := &voltha.Port{Label: "test_port"}
 		allPorts := &voltha.Ports{}
 		allPorts.Items = append(allPorts.Items, aPort)
 		return nil, allPorts
@@ -84,7 +98,7 @@
 
 }
 
-func (rhp *RequestHandlerProxy) GetChildDevices(args []*ca.Argument)(error, *voltha.Device) {
+func (rhp *RequestHandlerProxy) GetChildDevices(args []*ca.Argument) (error, *voltha.Device) {
 	if len(args) != 1 {
 		log.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
@@ -107,7 +121,7 @@
 // ChildDeviceDetected is invoked when a child device is detected.  The following
 // parameters are expected:
 // {parent_device_id, parent_port_no, child_device_type, proxy_address, admin_state, **kw)
-func (rhp *RequestHandlerProxy) ChildDeviceDetected(args []*ca.Argument) (error) {
+func (rhp *RequestHandlerProxy) ChildDeviceDetected(args []*ca.Argument) error {
 	if len(args) < 5 {
 		log.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
@@ -142,13 +156,11 @@
 
 	// Need to decode the other params - in this case the key will represent the proto type
 	// TODO decompose the other parameteres for matching criteria and process
-	log.Debugw("ChildDeviceDetected", log.Fields{"deviceId": pID.Val, "portNo":portNo.Val,
-	"deviceType": dt.Val, "proxyAddress": pAddr, "adminState": adminState})
+	log.Debugw("ChildDeviceDetected", log.Fields{"deviceId": pID.Val, "portNo": portNo.Val,
+		"deviceType": dt.Val, "proxyAddress": pAddr, "adminState": adminState})
 
 	if rhp.TestMode { // Execute only for test cases
 		return nil
 	}
 	return nil
 }
-
-
diff --git a/rw_core/main.go b/rw_core/main.go
index a0928c5..f495aeb 100644
--- a/rw_core/main.go
+++ b/rw_core/main.go
@@ -1,14 +1,33 @@
+/*
+ * Copyright 2018-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 main
 
 import (
 	"context"
 	"errors"
 	"fmt"
+	grpcserver "github.com/opencord/voltha-go/common/grpc"
 	"github.com/opencord/voltha-go/common/log"
 	"github.com/opencord/voltha-go/db/kvstore"
 	"github.com/opencord/voltha-go/kafka"
 	ca "github.com/opencord/voltha-go/protos/core_adapter"
+	"github.com/opencord/voltha-go/protos/voltha"
 	"github.com/opencord/voltha-go/rw_core/config"
+	grpcapi "github.com/opencord/voltha-go/rw_core/nbi/grpc"
+	"google.golang.org/grpc"
 	"os"
 	"os/signal"
 	"strconv"
@@ -22,6 +41,7 @@
 	halted      bool
 	exitChannel chan int
 	kmp         *kafka.KafkaMessagingProxy
+	grpcServer  *grpcserver.GrpcServer
 	//For test
 	receiverChannels []<-chan *ca.InterContainerMessage
 }
@@ -69,10 +89,32 @@
 	}
 }
 
+func (core *rwCore) startGRPCService(context.Context) {
+	//	create an insecure gserver server
+	core.grpcServer = grpcserver.NewGrpcServer(core.config.GrpcHost, core.config.GrpcPort, nil, false)
+	log.Info("server created")
+	//
+	//	Create a function to register the core GRPC service with the GRPC server
+	f := func(gs *grpc.Server) {
+		voltha.RegisterVolthaServiceServer(
+			gs,
+			grpcapi.NewAPIHandler(),
+		)
+	}
+
+	core.grpcServer.AddService(f)
+	log.Info("service add")
+
+	//	Start the server
+	core.grpcServer.Start(context.Background())
+	log.Info("server started")
+}
+
 
 func (core *rwCore) start(ctx context.Context) {
 	log.Info("Starting RW Core components")
 	// Setup GRPC Server
+	go core.startGRPCService(ctx)
 
 	// Setup KV Client
 
diff --git a/rw_core/nbi/grpc/api_handler.go b/rw_core/nbi/grpc/api_handler.go
new file mode 100644
index 0000000..e4ebf0c
--- /dev/null
+++ b/rw_core/nbi/grpc/api_handler.go
@@ -0,0 +1,215 @@
+/*
+ * Copyright 2018-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 grpc
+
+import (
+	"context"
+	"errors"
+	"github.com/golang/protobuf/ptypes/empty"
+	da "github.com/opencord/voltha-go/common/core/northbound/grpc"
+	"github.com/opencord/voltha-go/common/log"
+	"github.com/opencord/voltha-go/protos/common"
+	"github.com/opencord/voltha-go/protos/openflow_13"
+	"github.com/opencord/voltha-go/protos/voltha"
+	"google.golang.org/grpc/metadata"
+)
+
+type APIHandler struct {
+	da.DefaultAPIHandler
+}
+
+func NewAPIHandler() *APIHandler {
+	handler := &APIHandler{}
+	return handler
+}
+func isTestMode(ctx context.Context) bool {
+	md, _ := metadata.FromIncomingContext(ctx)
+	_, exist := md[common.TestModeKeys_api_test.String()]
+	return exist
+}
+
+func (handler *APIHandler) UpdateLogLevel(ctx context.Context, logging *voltha.Logging) (*empty.Empty, error) {
+	log.Debugw("UpdateLogLevel-request", log.Fields{"newloglevel": logging.Level, "intval": int(logging.Level)})
+	if isTestMode(ctx) {
+		out := new(empty.Empty)
+		log.SetLoglevel(int(logging.Level))
+		return out, nil
+	}
+	return nil, errors.New("Unimplemented")
+
+}
+
+func (handler *APIHandler) EnableLogicalDevicePort(ctx context.Context, id *voltha.LogicalPortId) (*empty.Empty, error) {
+	log.Debugw("EnableLogicalDevicePort-request", log.Fields{"id": id, "test": common.TestModeKeys_api_test.String()})
+	if isTestMode(ctx) {
+		out := new(empty.Empty)
+		return out, nil
+	}
+	return nil, errors.New("Unimplemented")
+}
+
+func (handler *APIHandler) DisableLogicalDevicePort(ctx context.Context, id *voltha.LogicalPortId) (*empty.Empty, error) {
+	log.Debugw("DisableLogicalDevicePort-request", log.Fields{"id": id, "test": common.TestModeKeys_api_test.String()})
+	if isTestMode(ctx) {
+		out := new(empty.Empty)
+		return out, nil
+	}
+	return nil, errors.New("Unimplemented")
+}
+
+func (handler *APIHandler) UpdateLogicalDeviceFlowTable(ctx context.Context, flow *openflow_13.FlowTableUpdate) (*empty.Empty, error) {
+	log.Debugw("UpdateLogicalDeviceFlowTable-request", log.Fields{"flow": flow, "test": common.TestModeKeys_api_test.String()})
+	if isTestMode(ctx) {
+		out := new(empty.Empty)
+		return out, nil
+	}
+	return nil, errors.New("Unimplemented")
+}
+
+func (handler *APIHandler) UpdateLogicalDeviceFlowGroupTable(ctx context.Context, flow *openflow_13.FlowGroupTableUpdate) (*empty.Empty, error) {
+	log.Debugw("UpdateLogicalDeviceFlowGroupTable-request", log.Fields{"flow": flow, "test": common.TestModeKeys_api_test.String()})
+	if isTestMode(ctx) {
+		out := new(empty.Empty)
+		return out, nil
+	}
+	return nil, errors.New("Unimplemented")
+}
+
+func (handler *APIHandler) CreateDevice(ctx context.Context, device *voltha.Device) (*voltha.Device, error) {
+	log.Debugw("createdevice-request", log.Fields{"device": *device})
+	if isTestMode(ctx) {
+		return &voltha.Device{Id: device.Id}, nil
+	}
+	return nil, errors.New("Unimplemented")
+}
+
+func (handler *APIHandler) EnableDevice(ctx context.Context, id *voltha.ID) (*empty.Empty, error) {
+	log.Debugw("enabledevice-request", log.Fields{"id": id})
+	if isTestMode(ctx) {
+		out := new(empty.Empty)
+		return out, nil
+	}
+	return nil, errors.New("Unimplemented")
+}
+
+func (handler *APIHandler) DisableDevice(ctx context.Context, id *voltha.ID) (*empty.Empty, error) {
+	log.Debugw("disabledevice-request", log.Fields{"id": id})
+	if isTestMode(ctx) {
+		out := new(empty.Empty)
+		return out, nil
+	}
+	return nil, errors.New("Unimplemented")
+}
+
+func (handler *APIHandler) RebootDevice(ctx context.Context, id *voltha.ID) (*empty.Empty, error) {
+	log.Debugw("disabledevice-request", log.Fields{"id": id})
+	if isTestMode(ctx) {
+		out := new(empty.Empty)
+		return out, nil
+	}
+	return nil, errors.New("Unimplemented")
+}
+
+func (handler *APIHandler) DeleteDevice(ctx context.Context, id *voltha.ID) (*empty.Empty, error) {
+	log.Debugw("deletedevice-request", log.Fields{"id": id})
+	if isTestMode(ctx) {
+		out := new(empty.Empty)
+		return out, nil
+	}
+	return nil, errors.New("Unimplemented")
+}
+
+func (handler *APIHandler) DownloadImage(ctx context.Context, img *voltha.ImageDownload) (*common.OperationResp, error) {
+	log.Debugw("DownloadImage-request", log.Fields{"img": *img})
+	if isTestMode(ctx) {
+		resp := &common.OperationResp{Code: common.OperationResp_OPERATION_SUCCESS}
+		return resp, nil
+	}
+
+	return nil, errors.New("UnImplemented")
+}
+
+func (handler *APIHandler) CancelImageDownload(ctx context.Context, img *voltha.ImageDownload) (*common.OperationResp, error) {
+	log.Debugw("CancelImageDownload-request", log.Fields{"img": *img})
+	if isTestMode(ctx) {
+		resp := &common.OperationResp{Code: common.OperationResp_OPERATION_SUCCESS}
+		return resp, nil
+	}
+	return nil, errors.New("UnImplemented")
+}
+
+func (handler *APIHandler) ActivateImageUpdate(ctx context.Context, img *voltha.ImageDownload) (*common.OperationResp, error) {
+	log.Debugw("ActivateImageUpdate-request", log.Fields{"img": *img})
+	if isTestMode(ctx) {
+		resp := &common.OperationResp{Code: common.OperationResp_OPERATION_SUCCESS}
+		return resp, nil
+	}
+	return nil, errors.New("UnImplemented")
+}
+
+func (handler *APIHandler) RevertImageUpdate(ctx context.Context, img *voltha.ImageDownload) (*common.OperationResp, error) {
+	log.Debugw("RevertImageUpdate-request", log.Fields{"img": *img})
+	if isTestMode(ctx) {
+		resp := &common.OperationResp{Code: common.OperationResp_OPERATION_SUCCESS}
+		return resp, nil
+	}
+	return nil, errors.New("UnImplemented")
+}
+
+func (handler *APIHandler) UpdateDevicePmConfigs(ctx context.Context, configs *voltha.PmConfigs) (*empty.Empty, error) {
+	log.Debugw("UpdateDevicePmConfigs-request", log.Fields{"configs": *configs})
+	if isTestMode(ctx) {
+		out := new(empty.Empty)
+		return out, nil
+	}
+	return nil, errors.New("UnImplemented")
+}
+
+func (handler *APIHandler) CreateAlarmFilter(ctx context.Context, filter *voltha.AlarmFilter) (*voltha.AlarmFilter, error) {
+	log.Debugw("CreateAlarmFilter-request", log.Fields{"filter": *filter})
+	if isTestMode(ctx) {
+		f := &voltha.AlarmFilter{Id: filter.Id}
+		return f, nil
+	}
+	return nil, errors.New("UnImplemented")
+}
+
+func (handler *APIHandler) UpdateAlarmFilter(ctx context.Context, filter *voltha.AlarmFilter) (*voltha.AlarmFilter, error) {
+	log.Debugw("UpdateAlarmFilter-request", log.Fields{"filter": *filter})
+	if isTestMode(ctx) {
+		f := &voltha.AlarmFilter{Id: filter.Id}
+		return f, nil
+	}
+	return nil, errors.New("UnImplemented")
+}
+
+func (handler *APIHandler) DeleteAlarmFilter(ctx context.Context, id *voltha.ID) (*empty.Empty, error) {
+	log.Debugw("DeleteAlarmFilter-request", log.Fields{"id": *id})
+	if isTestMode(ctx) {
+		out := new(empty.Empty)
+		return out, nil
+	}
+	return nil, errors.New("UnImplemented")
+}
+
+func (handler *APIHandler) SelfTest(ctx context.Context, id *voltha.ID) (*voltha.SelfTestResponse, error) {
+	log.Debugw("SelfTest-request", log.Fields{"id": id})
+	if isTestMode(ctx) {
+		resp := &voltha.SelfTestResponse{Result: voltha.SelfTestResponse_SUCCESS}
+		return resp, nil
+	}
+	return nil, errors.New("UnImplemented")
+}
diff --git a/rw_core/nbi/grpc/api_handler_client_test.go b/rw_core/nbi/grpc/api_handler_client_test.go
new file mode 100644
index 0000000..e2f3188
--- /dev/null
+++ b/rw_core/nbi/grpc/api_handler_client_test.go
@@ -0,0 +1,267 @@
+/*
+ * Copyright 2018-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 grpc
+
+import (
+	"context"
+	"github.com/golang/protobuf/ptypes/empty"
+	"github.com/opencord/voltha-go/common/log"
+	"github.com/opencord/voltha-go/protos/common"
+	"github.com/opencord/voltha-go/protos/openflow_13"
+	"github.com/opencord/voltha-go/protos/voltha"
+	"github.com/stretchr/testify/assert"
+	"google.golang.org/grpc"
+	"google.golang.org/grpc/metadata"
+	"google.golang.org/grpc/status"
+	"os"
+	"testing"
+)
+
+var conn *grpc.ClientConn
+var stub voltha.VolthaServiceClient
+var testMode string
+
+func setup() {
+	var err error
+	if _, err = log.SetLogger(log.JSON, 3, log.Fields{"instanceId": "testing"}); err != nil {
+		log.With(log.Fields{"error": err}).Fatal("Cannot setup logging")
+	}
+	conn, err = grpc.Dial("localhost:50057", grpc.WithInsecure())
+	if err != nil {
+		log.Fatalf("did not connect: %s", err)
+	}
+
+	stub = voltha.NewVolthaServiceClient(conn)
+	testMode = common.TestModeKeys_api_test.String()
+}
+
+func TestGetDevice(t *testing.T) {
+	var id common.ID
+	id.Id = "anyid"
+	ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs(testMode, "true"))
+	response, err := stub.GetDevice(ctx, &id)
+	assert.Nil(t, response)
+	st, _ := status.FromError(err)
+	assert.Equal(t, "UnImplemented", st.Message())
+
+}
+
+func TestUpdateLogLevelError(t *testing.T) {
+	ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs(testMode, "true"))
+	level := voltha.Logging{Level: common.LogLevel_ERROR}
+	response, err := stub.UpdateLogLevel(ctx, &level)
+	log.Infow("response", log.Fields{"res": response, "error": err})
+	assert.Equal(t, &empty.Empty{}, response)
+	assert.Nil(t, err)
+}
+
+func TestGetVoltha(t *testing.T) {
+	ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs(testMode, "true"))
+	response, err := stub.GetVoltha(ctx, &empty.Empty{})
+	assert.Nil(t, response)
+	st, _ := status.FromError(err)
+	assert.Equal(t, "UnImplemented", st.Message())
+}
+
+func TestUpdateLogLevelDebug(t *testing.T) {
+	ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs(testMode, "true"))
+	level := voltha.Logging{Level: common.LogLevel_DEBUG}
+	response, err := stub.UpdateLogLevel(ctx, &level)
+	log.Infow("response", log.Fields{"res": response, "error": err})
+	assert.Equal(t, &empty.Empty{}, response)
+	assert.Nil(t, err)
+}
+
+
+func TestGetCoreInstance(t *testing.T) {
+	id := &voltha.ID{Id: "getCoreInstance"}
+	ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs(testMode, "true"))
+	response, err := stub.GetCoreInstance(ctx, id)
+	assert.Nil(t, response)
+	st, _ := status.FromError(err)
+	assert.Equal(t, "UnImplemented", st.Message())
+}
+
+func TestGetLogicalDevice(t *testing.T) {
+	id := &voltha.ID{Id: "getLogicalDevice"}
+	ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs(testMode, "true"))
+	response, err := stub.GetLogicalDevice(ctx, id)
+	assert.Nil(t, response)
+	st, _ := status.FromError(err)
+	assert.Equal(t, "UnImplemented", st.Message())
+}
+
+func TestGetLogicalDevicePort(t *testing.T) {
+	id := &voltha.LogicalPortId{Id: "GetLogicalDevicePort"}
+	ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs(testMode, "true"))
+	response, err := stub.GetLogicalDevicePort(ctx, id)
+	assert.Nil(t, response)
+	st, _ := status.FromError(err)
+	assert.Equal(t, "UnImplemented", st.Message())
+}
+
+func TestListLogicalDevicePorts(t *testing.T) {
+	id := &voltha.ID{Id: "listLogicalDevicePorts"}
+	ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs(testMode, "true"))
+	response, err := stub.ListLogicalDevicePorts(ctx, id)
+	assert.Nil(t, response)
+	st, _ := status.FromError(err)
+	assert.Equal(t, "UnImplemented", st.Message())
+}
+
+func TestListLogicalDeviceFlows(t *testing.T) {
+	id := &voltha.ID{Id: "ListLogicalDeviceFlows"}
+	ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs(testMode, "true"))
+	response, err := stub.ListLogicalDeviceFlows(ctx, id)
+	assert.Nil(t, response)
+	st, _ := status.FromError(err)
+	assert.Equal(t, "UnImplemented", st.Message())
+}
+
+func TestListLogicalDeviceFlowGroups(t *testing.T) {
+	id := &voltha.ID{Id: "ListLogicalDeviceFlowGroups"}
+	ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs(testMode, "true"))
+	response, err := stub.ListLogicalDeviceFlowGroups(ctx, id)
+	assert.Nil(t, response)
+	st, _ := status.FromError(err)
+	assert.Equal(t, "UnImplemented", st.Message())
+}
+
+func TestListDevices(t *testing.T) {
+	ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs(testMode, "true"))
+	response, err := stub.ListDevices(ctx, &empty.Empty{})
+	assert.Nil(t, response)
+	st, _ := status.FromError(err)
+	assert.Equal(t, "UnImplemented", st.Message())
+}
+
+func TestListAdapters(t *testing.T) {
+	ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs(testMode, "true"))
+	response, err := stub.ListAdapters(ctx, &empty.Empty{})
+	assert.Nil(t, response)
+	st, _ := status.FromError(err)
+	assert.Equal(t, "UnImplemented", st.Message())
+}
+
+func TestListLogicalDevices(t *testing.T) {
+	ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs(testMode, "true"))
+	response, err := stub.ListLogicalDevices(ctx, &empty.Empty{})
+	assert.Nil(t, response)
+	st, _ := status.FromError(err)
+	assert.Equal(t, "UnImplemented", st.Message())
+}
+
+func TestListCoreInstances(t *testing.T) {
+	ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs(testMode, "true"))
+	response, err := stub.ListCoreInstances(ctx, &empty.Empty{})
+	assert.Nil(t, response)
+	st, _ := status.FromError(err)
+	assert.Equal(t, "UnImplemented", st.Message())
+}
+
+func TestCreateDevice(t *testing.T) {
+	ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs(testMode, "true"))
+	device := &voltha.Device{Id: "newdevice"}
+	response, err := stub.CreateDevice(ctx, device)
+	log.Infow("response", log.Fields{"res": response, "error": err})
+	assert.Equal(t, &voltha.Device{Id: "newdevice"}, response)
+	assert.Nil(t, err)
+}
+
+func TestEnableDevice(t *testing.T) {
+	ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs(testMode, "true"))
+	id := &voltha.ID{Id: "enabledevice"}
+	response, err := stub.EnableDevice(ctx, id)
+	log.Infow("response", log.Fields{"res": response, "error": err})
+	assert.Equal(t, &empty.Empty{}, response)
+	assert.Nil(t, err)
+}
+
+func TestDisableDevice(t *testing.T) {
+	ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs(testMode, "true"))
+	id := &voltha.ID{Id: "DisableDevice"}
+	response, err := stub.DisableDevice(ctx, id)
+	log.Infow("response", log.Fields{"res": response, "error": err})
+	assert.Equal(t, &empty.Empty{}, response)
+	assert.Nil(t, err)
+}
+
+func TestRebootDevice(t *testing.T) {
+	ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs(testMode, "true"))
+	id := &voltha.ID{Id: "RebootDevice"}
+	response, err := stub.RebootDevice(ctx, id)
+	log.Infow("response", log.Fields{"res": response, "error": err})
+	assert.Equal(t, &empty.Empty{}, response)
+	assert.Nil(t, err)
+}
+
+func TestDeleteDevice(t *testing.T) {
+	ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs(testMode, "true"))
+	id := &voltha.ID{Id: "DeleteDevice"}
+	response, err := stub.DeleteDevice(ctx, id)
+	log.Infow("response", log.Fields{"res": response, "error": err})
+	assert.Equal(t, &empty.Empty{}, response)
+	assert.Nil(t, err)
+}
+
+func TestEnableLogicalDevicePort(t *testing.T) {
+	ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs(testMode, "true"))
+	id := &voltha.LogicalPortId{Id: "EnableLogicalDevicePort"}
+	response, err := stub.EnableLogicalDevicePort(ctx, id)
+	log.Infow("response", log.Fields{"res": response, "error": err})
+	assert.Equal(t, &empty.Empty{}, response)
+	assert.Nil(t, err)
+}
+
+func TestDisableLogicalDevicePort(t *testing.T) {
+	ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs(testMode, "true"))
+	id := &voltha.LogicalPortId{Id: "DisableLogicalDevicePort"}
+	response, err := stub.DisableLogicalDevicePort(ctx, id)
+	log.Infow("response", log.Fields{"res": response, "error": err})
+	assert.Equal(t, &empty.Empty{}, response)
+	assert.Nil(t, err)
+}
+
+func TestUpdateLogicalDeviceFlowGroupTable(t *testing.T) {
+	ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs(testMode, "true"))
+	flow := &openflow_13.FlowGroupTableUpdate{Id: "UpdateLogicalDeviceFlowGroupTable"}
+	response, err := stub.UpdateLogicalDeviceFlowGroupTable(ctx, flow)
+	log.Infow("response", log.Fields{"res": response, "error": err})
+	assert.Equal(t, &empty.Empty{}, response)
+	assert.Nil(t, err)
+}
+
+func TestGetImageDownloadStatus(t *testing.T) {
+	ctx := metadata.NewOutgoingContext(context.Background(), metadata.Pairs(testMode, "true"))
+	img := &voltha.ImageDownload{Id: "GetImageDownloadStatus"}
+	response, err := stub.GetImageDownloadStatus(ctx, img)
+	assert.Nil(t, response)
+	st, _ := status.FromError(err)
+	assert.Equal(t, "UnImplemented", st.Message())
+}
+
+// TODO: complete the remaining tests
+
+func shutdown() {
+	conn.Close()
+}
+
+func TestMain(m *testing.M) {
+	setup()
+	code := m.Run()
+	shutdown()
+	os.Exit(code)
+}