[VOL-2364] InvokeRPC returns an error code in case of a timeout

Change-Id: Ia3725bb4778e1935cf62e5348bfcd0bd15cb9466
diff --git a/pkg/mocks/kafka_inter_container_proxy.go b/pkg/mocks/kafka_inter_container_proxy.go
index 3af728a..c53abb4 100644
--- a/pkg/mocks/kafka_inter_container_proxy.go
+++ b/pkg/mocks/kafka_inter_container_proxy.go
@@ -18,11 +18,11 @@
 
 import (
 	"context"
+	"github.com/gogo/protobuf/proto"
 	"github.com/golang/protobuf/ptypes"
 	"github.com/golang/protobuf/ptypes/any"
 	"github.com/opencord/voltha-lib-go/v3/pkg/kafka"
 	ic "github.com/opencord/voltha-protos/v3/go/inter_container"
-	"github.com/opencord/voltha-protos/v3/go/voltha"
 )
 
 type InvokeRpcArgs struct {
@@ -35,21 +35,11 @@
 	KvArgs          map[int]interface{}
 }
 
-type FailReason int
-
-const (
-	Timeout FailReason = iota + 1
-	UnmarshalError
-)
-
-func (r FailReason) String() string {
-	return [...]string{"Timeout", "UnmarshalError"}[r]
-}
-
 type InvokeRpcSpy struct {
 	CallCount int
 	Calls     map[int]InvokeRpcArgs
-	Fail      FailReason // timeout, error
+	Timeout   bool
+	Response  proto.Message
 }
 
 type MockKafkaICProxy struct {
@@ -81,26 +71,20 @@
 		KvArgs:          args,
 	}
 
-	device := &voltha.Device{
-		Id: "testDevice",
-	}
-	response, _ := ptypes.MarshalAny(device)
-
-	if s.InvokeRpcSpy.Fail == Timeout {
+	var response any.Any
+	if s.InvokeRpcSpy.Timeout {
 
 		success = false
 
-		// TODO once InvokeRPC is fixed to return an error code, add it here
-		err := &ic.Error{Reason: "context deadline exceeded"}
-		response, _ = ptypes.MarshalAny(err)
-	} else if s.InvokeRpcSpy.Fail == UnmarshalError {
-		res := &voltha.LogicalDevice{
-			Id: "testLogicalDevice",
-		}
-		response, _ = ptypes.MarshalAny(res)
+		err := &ic.Error{Reason: "context deadline exceeded", Code: ic.ErrorCode_DEADLINE_EXCEEDED}
+		res, _ := ptypes.MarshalAny(err)
+		response = *res
+	} else {
+		res, _ := ptypes.MarshalAny(s.InvokeRpcSpy.Response)
+		response = *res
 	}
 
-	return success, response
+	return success, &response
 }
 func (s *MockKafkaICProxy) SubscribeWithRequestHandlerInterface(topic kafka.Topic, handler interface{}) error {
 	return nil