VOL-3734 adding rpc events to the queue and sending to kafka from queue

Change-Id: I7a220fd3c7af0312ad20d4a15c0162b5c77f2044
diff --git a/VERSION b/VERSION
index f77856a..cc2fbe8 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.3.1
+4.3.2
diff --git a/go.mod b/go.mod
index 6373b4d..ad914c3 100644
--- a/go.mod
+++ b/go.mod
@@ -21,7 +21,7 @@
 	github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4
 	github.com/jcmturner/gofork v1.0.0 // indirect
 	github.com/onsi/gomega v1.4.2 // indirect
-	github.com/opencord/voltha-protos/v4 v4.1.1
+	github.com/opencord/voltha-protos/v4 v4.1.2
 	github.com/opentracing/opentracing-go v1.1.0
 	github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
 	github.com/pierrec/lz4 v2.3.0+incompatible // indirect
diff --git a/go.sum b/go.sum
index acbe659..5d18c72 100644
--- a/go.sum
+++ b/go.sum
@@ -136,8 +136,8 @@
 github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
 github.com/onsi/gomega v1.4.2 h1:3mYCb7aPxS/RU7TI1y4rkEn1oKmPRjNJLNEXgw7MH2I=
 github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
-github.com/opencord/voltha-protos/v4 v4.1.1 h1:yovQHC+JQSrw5zxj0UeQqmyFUBQ+487JdG5w5ttrRyc=
-github.com/opencord/voltha-protos/v4 v4.1.1/go.mod h1:W/OIFIyvFh/C0vchRUuarIsMylEhzCRM9pNxLvkPtKc=
+github.com/opencord/voltha-protos/v4 v4.1.2 h1:iK7rhQXBtd6H2UWqdCPLQchcoGn8XV8XcVI3CBzGDfg=
+github.com/opencord/voltha-protos/v4 v4.1.2/go.mod h1:W/OIFIyvFh/C0vchRUuarIsMylEhzCRM9pNxLvkPtKc=
 github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU=
 github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
 github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 h1:JhzVVoYvbOACxoUmOs6V/G4D5nPVUW73rKvXxP4XUJc=
diff --git a/pkg/events/events_proxy.go b/pkg/events/events_proxy.go
index ebd48ab..910fec3 100644
--- a/pkg/events/events_proxy.go
+++ b/pkg/events/events_proxy.go
@@ -17,11 +17,13 @@
 package events
 
 import (
+	"container/ring"
 	"context"
 	"errors"
 	"fmt"
 	"strconv"
 	"strings"
+	"sync"
 	"time"
 
 	"github.com/golang/protobuf/ptypes"
@@ -31,9 +33,17 @@
 	"github.com/opencord/voltha-protos/v4/go/voltha"
 )
 
+// TODO: Make configurable through helm chart
+const EVENT_THRESHOLD = 1000
+
+type lastEvent struct{}
+
 type EventProxy struct {
-	kafkaClient kafka.Client
-	eventTopic  kafka.Topic
+	kafkaClient    kafka.Client
+	eventTopic     kafka.Topic
+	eventQueue     *EventQueue
+	queueCtx       context.Context
+	queueCancelCtx context.CancelFunc
 }
 
 func NewEventProxy(opts ...EventProxyOption) *EventProxy {
@@ -41,6 +51,8 @@
 	for _, option := range opts {
 		option(&proxy)
 	}
+	proxy.eventQueue = newEventQueue()
+	proxy.queueCtx, proxy.queueCancelCtx = context.WithCancel(context.Background())
 	return &proxy
 }
 
@@ -112,15 +124,7 @@
 		return err
 	}
 	event.EventType = &voltha.Event_RpcEvent{RpcEvent: rpcEvent}
-	if err := ep.sendEvent(ctx, &event); err != nil {
-		logger.Errorw(ctx, "Failed to send rpc event to KAFKA bus", log.Fields{"rpc-event": rpcEvent})
-		return err
-	}
-	logger.Debugw(ctx, "Successfully sent RPC event to KAFKA bus", log.Fields{"Id": event.Header.Id, "Category": event.Header.Category,
-		"SubCategory": event.Header.SubCategory, "Type": event.Header.Type, "TypeVersion": event.Header.TypeVersion,
-		"ReportedTs": event.Header.ReportedTs, "ResourceId": rpcEvent.ResourceId, "Context": rpcEvent.Context,
-		"RPCEventName": id})
-
+	ep.eventQueue.push(&event)
 	return nil
 
 }
@@ -195,3 +199,155 @@
 func (ep *EventProxy) SendLiveness(ctx context.Context) error {
 	return ep.kafkaClient.SendLiveness(ctx)
 }
+
+// Start the event proxy
+func (ep *EventProxy) Start() {
+	eq := ep.eventQueue
+	go eq.start(ep.queueCtx)
+	logger.Debugw(context.Background(), "event-proxy-starting...", log.Fields{"events-threashold": EVENT_THRESHOLD})
+	for {
+		// Notify the queue I am ready
+		eq.readyToSendToKafkaCh <- struct{}{}
+		// Wait for an event
+		elem, ok := <-eq.eventChannel
+		if !ok {
+			logger.Debug(context.Background(), "event-channel-closed-exiting")
+			break
+		}
+		// Check for last event
+		if _, ok := elem.(*lastEvent); ok {
+			// close the queuing loop
+			logger.Info(context.Background(), "received-last-event")
+			ep.queueCancelCtx()
+			break
+		}
+		ctx := context.Background()
+		event, ok := elem.(*voltha.Event)
+		if !ok {
+			logger.Warnw(ctx, "invalid-event", log.Fields{"element": elem})
+			continue
+		}
+		if err := ep.sendEvent(ctx, event); err != nil {
+			logger.Errorw(ctx, "failed-to-send-event-to-kafka-bus", log.Fields{"event": event})
+		} else {
+			logger.Debugw(ctx, "successfully-sent-rpc-event-to-kafka-bus", log.Fields{"id": event.Header.Id, "category": event.Header.Category,
+				"sub-category": event.Header.SubCategory, "type": event.Header.Type, "type-version": event.Header.TypeVersion,
+				"reported-ts": event.Header.ReportedTs, "event-type": event.EventType})
+		}
+	}
+}
+
+func (ep *EventProxy) Stop() {
+	ep.eventQueue.stop()
+}
+
+type EventQueue struct {
+	mutex                sync.RWMutex
+	eventChannel         chan interface{}
+	insertPosition       *ring.Ring
+	popPosition          *ring.Ring
+	dataToSendAvailable  chan struct{}
+	readyToSendToKafkaCh chan struct{}
+	eventQueueStopped    chan struct{}
+}
+
+func newEventQueue() *EventQueue {
+	ev := &EventQueue{
+		eventChannel:         make(chan interface{}),
+		insertPosition:       ring.New(EVENT_THRESHOLD),
+		dataToSendAvailable:  make(chan struct{}),
+		readyToSendToKafkaCh: make(chan struct{}),
+		eventQueueStopped:    make(chan struct{}),
+	}
+	ev.popPosition = ev.insertPosition
+	return ev
+}
+
+// push is invoked to push an event at the back of a queue
+func (eq *EventQueue) push(event interface{}) {
+	eq.mutex.Lock()
+
+	if eq.insertPosition != nil {
+		// Handle Queue is full.
+		// TODO: Current default is to overwrite old data if queue is full. Is there a need to
+		// block caller if max threshold is reached?
+		if eq.insertPosition.Value != nil && eq.insertPosition == eq.popPosition {
+			eq.popPosition = eq.popPosition.Next()
+		}
+
+		// Insert data and move pointer to next empty position
+		eq.insertPosition.Value = event
+		eq.insertPosition = eq.insertPosition.Next()
+
+		// Check for last event
+		if _, ok := event.(*lastEvent); ok {
+			eq.insertPosition = nil
+		}
+		eq.mutex.Unlock()
+		// Notify waiting thread of data availability
+		eq.dataToSendAvailable <- struct{}{}
+
+	} else {
+		logger.Debug(context.Background(), "event-queue-is-closed-as-insert-position-is-cleared")
+		eq.mutex.Unlock()
+	}
+}
+
+// start starts the routine that extracts an element from the event queue and
+// send it to the kafka sending routine to process.
+func (eq *EventQueue) start(ctx context.Context) {
+	logger.Info(ctx, "starting-event-queue")
+loop:
+	for {
+		select {
+		case <-eq.dataToSendAvailable:
+		//	Do nothing - use to prevent caller pushing data to block
+		case <-eq.readyToSendToKafkaCh:
+			{
+				// Kafka sending routine is ready to process an event
+				eq.mutex.Lock()
+				element := eq.popPosition.Value
+				if element == nil {
+					// No events to send. Wait
+					eq.mutex.Unlock()
+					select {
+					case _, ok := <-eq.dataToSendAvailable:
+						if !ok {
+							// channel closed
+							eq.eventQueueStopped <- struct{}{}
+							return
+						}
+					case <-ctx.Done():
+						logger.Info(ctx, "event-queue-context-done")
+						eq.eventQueueStopped <- struct{}{}
+						return
+					}
+					eq.mutex.Lock()
+					element = eq.popPosition.Value
+				}
+				eq.popPosition.Value = nil
+				eq.popPosition = eq.popPosition.Next()
+				eq.mutex.Unlock()
+				eq.eventChannel <- element
+			}
+		case <-ctx.Done():
+			logger.Info(ctx, "event-queue-context-done")
+			eq.eventQueueStopped <- struct{}{}
+			break loop
+		}
+	}
+	logger.Info(ctx, "event-queue-stopped")
+
+}
+
+func (eq *EventQueue) stop() {
+	// Flush all
+	eq.push(&lastEvent{})
+	<-eq.eventQueueStopped
+	eq.mutex.Lock()
+	close(eq.readyToSendToKafkaCh)
+	close(eq.dataToSendAvailable)
+	close(eq.eventChannel)
+	eq.mutex.Unlock()
+
+}
diff --git a/pkg/events/events_proxy_test.go b/pkg/events/events_proxy_test.go
new file mode 100644
index 0000000..119df28
--- /dev/null
+++ b/pkg/events/events_proxy_test.go
@@ -0,0 +1,180 @@
+/*
+ * Copyright 2020-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 events
+
+import (
+	"context"
+	"github.com/golang/protobuf/ptypes"
+	"github.com/opencord/voltha-lib-go/v4/pkg/kafka"
+	"github.com/opencord/voltha-lib-go/v4/pkg/log"
+	mock_kafka "github.com/opencord/voltha-lib-go/v4/pkg/mocks/kafka"
+	"github.com/opencord/voltha-protos/v4/go/common"
+	"github.com/opencord/voltha-protos/v4/go/voltha"
+	"github.com/stretchr/testify/assert"
+	"strconv"
+	"testing"
+	"time"
+)
+
+const waitForKafkaEventsTimeout = 20 * time.Second
+const waitForEventProxyTimeout = 10 * time.Second
+
+func waitForEventProxyToStop(ep *EventProxy, resp chan string) {
+	timer := time.NewTimer(waitForEventProxyTimeout)
+	defer timer.Stop()
+	for {
+		select {
+		case <-time.After(2 * time.Millisecond):
+			if ep.eventQueue.insertPosition == nil {
+				resp <- "ok"
+				return
+			}
+		case <-timer.C:
+			resp <- "timer expired"
+			return
+		}
+
+	}
+}
+func waitForKafkaEvents(kc kafka.Client, topic *kafka.Topic, numEvents int, resp chan string) {
+	kafkaChnl, err := kc.Subscribe(context.Background(), topic)
+	if err != nil {
+		resp <- err.Error()
+		return
+	}
+	defer func() {
+		if kafkaChnl != nil {
+			if err = kc.UnSubscribe(context.Background(), topic, kafkaChnl); err != nil {
+				logger.Errorw(context.Background(), "unsubscribe-failed", log.Fields{"error": err})
+			}
+		}
+	}()
+	timer := time.NewTimer(waitForKafkaEventsTimeout)
+	defer timer.Stop()
+	count := 0
+loop:
+	for {
+		select {
+		case msg := <-kafkaChnl:
+			if msg.Body != nil {
+				event := voltha.Event{}
+				if err := ptypes.UnmarshalAny(msg.Body, &event); err == nil {
+					count += 1
+					if count == numEvents {
+						resp <- "ok"
+						break loop
+					}
+				}
+			}
+		case <-timer.C:
+			resp <- "timer expired"
+			break loop
+		}
+	}
+}
+
+func createAndSendEvent(proxy *EventProxy, ID string) error {
+	eventMsg := &voltha.RPCEvent{
+		Rpc:         "dummy",
+		OperationId: ID,
+		ResourceId:  "dummy",
+		Service:     "dummy",
+		StackId:     "dummy",
+		Status: &common.OperationResp{
+			Code: common.OperationResp_OPERATION_FAILURE,
+		},
+		Description: "dummy",
+		Context:     nil,
+	}
+	var event voltha.Event
+	raisedTS := time.Now().Unix()
+	event.Header, _ = proxy.getEventHeader("RPC_ERROR_RAISE_EVENT", voltha.EventCategory_COMMUNICATION, nil, voltha.EventType_RPC_EVENT, raisedTS)
+	event.EventType = &voltha.Event_RpcEvent{RpcEvent: eventMsg}
+	err := proxy.SendRPCEvent(context.Background(), "RPC_ERROR_RAISE_EVENT", eventMsg, voltha.EventCategory_COMMUNICATION,
+		nil, time.Now().Unix())
+	return err
+}
+
+func TestEventProxyReceiveAndSendMessage(t *testing.T) {
+	// Init Kafka client
+	log.SetAllLogLevel(log.FatalLevel)
+	cTkc := mock_kafka.NewKafkaClient()
+	topic := kafka.Topic{Name: "myTopic"}
+
+	numEvents := 10
+	resp := make(chan string)
+	go waitForKafkaEvents(cTkc, &topic, numEvents, resp)
+
+	// Init Event Proxy
+	ep := NewEventProxy(MsgClient(cTkc), MsgTopic(topic))
+	go ep.Start()
+	time.Sleep(1 * time.Millisecond)
+	for i := 0; i < numEvents; i++ {
+		go func(ID int) {
+			err := createAndSendEvent(ep, strconv.Itoa(ID))
+			assert.Nil(t, err)
+		}(i)
+	}
+	val := <-resp
+	assert.Equal(t, val, "ok")
+	go ep.Stop()
+	go waitForEventProxyToStop(ep, resp)
+	val = <-resp
+	assert.Equal(t, val, "ok")
+}
+
+func TestEventProxyStopWhileSendingEvents(t *testing.T) {
+	// Init Kafka client
+	log.SetAllLogLevel(log.FatalLevel)
+	cTkc := mock_kafka.NewKafkaClient()
+	topic := kafka.Topic{Name: "myTopic"}
+
+	numEvents := 10
+	resp := make(chan string)
+	// Init Event Proxy
+	ep := NewEventProxy(MsgClient(cTkc), MsgTopic(topic))
+	go ep.Start()
+	time.Sleep(1 * time.Millisecond)
+	for i := 0; i < numEvents; i++ {
+		go func(ID int) {
+			err := createAndSendEvent(ep, strconv.Itoa(ID))
+			assert.Nil(t, err)
+		}(i)
+	}
+	// In this case we cannot guarantee how many events are send before
+	// sending the last event(stopping event proxy), any event send before Stop would be received.
+	go ep.Stop()
+	go waitForEventProxyToStop(ep, resp)
+	val := <-resp
+	assert.Equal(t, val, "ok")
+}
+
+func TestEventProxyStopWhenNoEventsSend(t *testing.T) {
+	// Init Kafka client
+	log.SetAllLogLevel(log.FatalLevel)
+	cTkc := mock_kafka.NewKafkaClient()
+	topic := kafka.Topic{Name: "myTopic"}
+	resp := make(chan string)
+	// Init Event Proxy
+	ep := NewEventProxy(MsgClient(cTkc), MsgTopic(topic))
+	go ep.Start()
+	time.Sleep(1 * time.Millisecond)
+	go ep.Stop()
+	go waitForEventProxyToStop(ep, resp)
+	val := <-resp
+	assert.Equal(t, val, "ok")
+}
diff --git a/pkg/mocks/kafka/kafka_client.go b/pkg/mocks/kafka/kafka_client.go
index 268c571..97bb135 100644
--- a/pkg/mocks/kafka/kafka_client.go
+++ b/pkg/mocks/kafka/kafka_client.go
@@ -18,12 +18,15 @@
 import (
 	"context"
 	"fmt"
+	"github.com/golang/protobuf/ptypes"
 	"sync"
 	"time"
 
+	"github.com/golang/protobuf/proto"
 	"github.com/opencord/voltha-lib-go/v4/pkg/kafka"
 	"github.com/opencord/voltha-lib-go/v4/pkg/log"
 	ic "github.com/opencord/voltha-protos/v4/go/inter_container"
+	"github.com/opencord/voltha-protos/v4/go/voltha"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
 )
@@ -117,10 +120,35 @@
 	logger.Debug(ctx, "SubscribeForMetadata - unimplemented")
 }
 
+func toIntercontainerMessage(event *voltha.Event) *ic.InterContainerMessage {
+	msg := &ic.InterContainerMessage{
+		Header: &ic.Header{
+			Id:        event.Header.Id,
+			Type:      ic.MessageType_REQUEST,
+			Timestamp: event.Header.RaisedTs,
+		},
+	}
+	// Marshal event
+	if eventBody, err := ptypes.MarshalAny(event); err == nil {
+		msg.Body = eventBody
+	}
+	return msg
+}
+
 func (kc *KafkaClient) Send(ctx context.Context, msg interface{}, topic *kafka.Topic, keys ...string) error {
+	// Assert message is a proto message
+	// ascertain the value interface type is a proto.Message
+	if _, ok := msg.(proto.Message); !ok {
+		logger.Warnw(ctx, "message-not-a-proto-message", log.Fields{"msg": msg})
+		return status.Error(codes.InvalidArgument, "msg-not-a-proto-msg")
+	}
 	req, ok := msg.(*ic.InterContainerMessage)
 	if !ok {
-		return status.Error(codes.InvalidArgument, "msg-not-InterContainerMessage-type")
+		event, ok := msg.(*voltha.Event) //This is required as event message will be of type voltha.Event
+		if !ok {
+			return status.Error(codes.InvalidArgument, "unexpected-message-type")
+		}
+		req = toIntercontainerMessage(event)
 	}
 	if req == nil {
 		return status.Error(codes.InvalidArgument, "msg-nil")
diff --git a/vendor/github.com/opencord/voltha-protos/v4/go/voltha/core.pb.go b/vendor/github.com/opencord/voltha-protos/v4/go/voltha/core.pb.go
index 4c92095..64d42d0 100644
--- a/vendor/github.com/opencord/voltha-protos/v4/go/voltha/core.pb.go
+++ b/vendor/github.com/opencord/voltha-protos/v4/go/voltha/core.pb.go
@@ -37,6 +37,8 @@
 	DeviceTransientState_DELETING_POST_ADAPTER_RESPONSE DeviceTransientState_Types = 4
 	// State to represent that the device deletion is failed
 	DeviceTransientState_DELETE_FAILED DeviceTransientState_Types = 5
+	// State to represent that reconcile is in progress
+	DeviceTransientState_RECONCILE_IN_PROGRESS DeviceTransientState_Types = 6
 )
 
 var DeviceTransientState_Types_name = map[int32]string{
@@ -46,6 +48,7 @@
 	3: "DELETING_FROM_ADAPTER",
 	4: "DELETING_POST_ADAPTER_RESPONSE",
 	5: "DELETE_FAILED",
+	6: "RECONCILE_IN_PROGRESS",
 }
 
 var DeviceTransientState_Types_value = map[string]int32{
@@ -55,6 +58,7 @@
 	"DELETING_FROM_ADAPTER":          3,
 	"DELETING_POST_ADAPTER_RESPONSE": 4,
 	"DELETE_FAILED":                  5,
+	"RECONCILE_IN_PROGRESS":          6,
 }
 
 func (x DeviceTransientState_Types) String() string {
@@ -112,22 +116,23 @@
 func init() { proto.RegisterFile("voltha_protos/core.proto", fileDescriptor_39634f15fb8a505e) }
 
 var fileDescriptor_39634f15fb8a505e = []byte{
-	// 264 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0x4d, 0x4b, 0xc4, 0x30,
-	0x10, 0x86, 0xad, 0xfb, 0xa1, 0x0c, 0x58, 0x63, 0x54, 0x58, 0x2f, 0x22, 0x3d, 0x79, 0x31, 0x05,
-	0xf5, 0x0f, 0x54, 0x3b, 0x95, 0xc5, 0xb5, 0x2d, 0x6d, 0x2e, 0x7a, 0x09, 0xdd, 0x1a, 0xba, 0x05,
-	0x6d, 0x4a, 0x1a, 0x0b, 0xde, 0xfc, 0xb5, 0xfe, 0x0e, 0xb1, 0x1f, 0x82, 0xb0, 0xb7, 0x99, 0xe7,
-	0x99, 0xf7, 0x30, 0x2f, 0x2c, 0x5a, 0xf5, 0x66, 0x36, 0x99, 0xa8, 0xb5, 0x32, 0xaa, 0x71, 0x73,
-	0xa5, 0x25, 0xeb, 0x66, 0x3a, 0xef, 0x8d, 0xf3, 0x6d, 0xc1, 0x89, 0x2f, 0xdb, 0x32, 0x97, 0x5c,
-	0x67, 0x55, 0x53, 0xca, 0xca, 0xa4, 0x26, 0x33, 0x92, 0x3e, 0xc2, 0xa1, 0x19, 0x89, 0x68, 0x7e,
-	0xd1, 0xc2, 0xba, 0xb0, 0x2e, 0xed, 0x6b, 0x87, 0xf5, 0x51, 0xb6, 0x2d, 0xc6, 0xf8, 0x67, 0x2d,
-	0x9b, 0xc4, 0x36, 0xff, 0xa8, 0xf3, 0x65, 0xc1, 0xac, 0x33, 0x74, 0x1f, 0xa6, 0x61, 0x14, 0x22,
-	0xd9, 0xa1, 0x7b, 0x30, 0xf1, 0xc2, 0x67, 0x62, 0x51, 0x0a, 0x76, 0x10, 0x25, 0xf7, 0x28, 0x7c,
-	0x5c, 0x21, 0x5f, 0x86, 0x0f, 0x64, 0x97, 0x9e, 0xc1, 0xe9, 0xb8, 0x89, 0x20, 0x89, 0x9e, 0x84,
-	0xe7, 0x7b, 0x31, 0xc7, 0x84, 0x4c, 0xa8, 0x03, 0xe7, 0x7f, 0x2a, 0x8e, 0x52, 0x3e, 0x2a, 0x91,
-	0x60, 0x1a, 0x47, 0x61, 0x8a, 0x64, 0x4a, 0x8f, 0xe0, 0xa0, 0xbb, 0x41, 0x11, 0x78, 0xcb, 0x15,
-	0xfa, 0x64, 0x76, 0x87, 0x70, 0xac, 0x74, 0xc1, 0x54, 0x2d, 0xab, 0x5c, 0xe9, 0xd7, 0xe1, 0x89,
-	0x17, 0x56, 0x94, 0x66, 0xf3, 0xb1, 0x66, 0xb9, 0x7a, 0x77, 0x47, 0xe7, 0xf6, 0xee, 0x6a, 0x68,
-	0xad, 0xbd, 0x75, 0x0b, 0x35, 0xb0, 0xf5, 0xbc, 0x83, 0x37, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff,
-	0xe3, 0x06, 0xbc, 0xa1, 0x5a, 0x01, 0x00, 0x00,
+	// 284 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0x4d, 0x4b, 0xf4, 0x30,
+	0x10, 0xc7, 0x9f, 0xee, 0xdb, 0x23, 0x01, 0xd7, 0x18, 0x15, 0xd6, 0x8b, 0x48, 0x4f, 0x5e, 0x4c,
+	0x41, 0xfd, 0x02, 0x75, 0x3b, 0xbb, 0x14, 0xd7, 0xa4, 0x24, 0xbd, 0xe8, 0x25, 0x74, 0x6b, 0xe8,
+	0x16, 0xb4, 0x29, 0x6d, 0x2c, 0x78, 0xf4, 0x73, 0xf8, 0x65, 0x65, 0xfb, 0x22, 0x08, 0xde, 0x66,
+	0x7e, 0xbf, 0xf9, 0x0f, 0xcc, 0xa0, 0x45, 0x63, 0x5e, 0xed, 0x2e, 0x51, 0x65, 0x65, 0xac, 0xa9,
+	0xbd, 0xd4, 0x54, 0x9a, 0xb6, 0x35, 0x99, 0x75, 0xc6, 0xfd, 0x1c, 0xa1, 0xd3, 0x40, 0x37, 0x79,
+	0xaa, 0xe3, 0x2a, 0x29, 0xea, 0x5c, 0x17, 0x56, 0xda, 0xc4, 0x6a, 0xf2, 0x80, 0x8e, 0xec, 0x40,
+	0x54, 0xbd, 0x47, 0x0b, 0xe7, 0xd2, 0xb9, 0x9a, 0xdf, 0xb8, 0xb4, 0x8b, 0xd2, 0xbf, 0x62, 0x34,
+	0xfe, 0x28, 0x75, 0x2d, 0xe6, 0xf6, 0x17, 0x75, 0xbf, 0x1c, 0x34, 0x6d, 0x0d, 0x39, 0x40, 0x13,
+	0xc6, 0x19, 0xe0, 0x7f, 0xe4, 0x3f, 0x1a, 0xfb, 0xec, 0x09, 0x3b, 0x84, 0xa0, 0xf9, 0x8a, 0x8b,
+	0x25, 0xa8, 0x00, 0x36, 0x10, 0x87, 0x6c, 0x8d, 0x47, 0xe4, 0x1c, 0x9d, 0x0d, 0x9d, 0x5a, 0x09,
+	0xfe, 0xa8, 0xfc, 0xc0, 0x8f, 0x62, 0x10, 0x78, 0x4c, 0x5c, 0x74, 0xf1, 0xa3, 0x22, 0x2e, 0xe3,
+	0x41, 0x29, 0x01, 0x32, 0xe2, 0x4c, 0x02, 0x9e, 0x90, 0x63, 0x74, 0xd8, 0xce, 0x80, 0x5a, 0xf9,
+	0xe1, 0x06, 0x02, 0x3c, 0xdd, 0x6f, 0x14, 0xb0, 0xe4, 0x6c, 0x19, 0x6e, 0x40, 0x85, 0x4c, 0x45,
+	0x82, 0xaf, 0x05, 0x48, 0x89, 0x67, 0xf7, 0x80, 0x4e, 0x4c, 0x95, 0x51, 0x53, 0xea, 0x22, 0x35,
+	0xd5, 0x4b, 0x7f, 0xdf, 0x33, 0xcd, 0x72, 0xbb, 0x7b, 0xdf, 0xd2, 0xd4, 0xbc, 0x79, 0x83, 0xf3,
+	0x3a, 0x77, 0xdd, 0x3f, 0xb4, 0xb9, 0xf3, 0x32, 0xd3, 0xb3, 0xed, 0xac, 0x85, 0xb7, 0xdf, 0x01,
+	0x00, 0x00, 0xff, 0xff, 0x1a, 0x0c, 0x99, 0x87, 0x75, 0x01, 0x00, 0x00,
 }
diff --git a/vendor/modules.txt b/vendor/modules.txt
index caf36a8..4e410d6 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -86,7 +86,7 @@
 github.com/modern-go/concurrent
 # github.com/modern-go/reflect2 v1.0.1
 github.com/modern-go/reflect2
-# github.com/opencord/voltha-protos/v4 v4.1.1
+# github.com/opencord/voltha-protos/v4 v4.1.2
 github.com/opencord/voltha-protos/v4/go/common
 github.com/opencord/voltha-protos/v4/go/ext/config
 github.com/opencord/voltha-protos/v4/go/extension