VOL-1845 : Support for delete device in openolt adapter
This commit is for the handling of delete device.
The changes are done to handle the request for delete
device. This includes the clearing of all data related
to the device in KV store and reboot of device to reset
the device.
This commit has dependency in voltha-go so that needs to
be merged first. Please refer this review link
https://gerrit.opencord.org/#/c/15084/
Updated to dep ensure above voltha-go patch set. Also typo
and make lint/sca fixes.
Change-Id: I53f16022c6902d498dad30e9b7d0ff50bf156347
diff --git a/vendor/github.com/opencord/voltha-go/adapters/common/events_proxy.go b/vendor/github.com/opencord/voltha-go/adapters/common/events_proxy.go
index 1f14b3a..34fcde7 100644
--- a/vendor/github.com/opencord/voltha-go/adapters/common/events_proxy.go
+++ b/vendor/github.com/opencord/voltha-go/adapters/common/events_proxy.go
@@ -19,22 +19,14 @@
import (
"errors"
"fmt"
- "github.com/opencord/voltha-go/common/log"
- "github.com/opencord/voltha-go/kafka"
- "github.com/opencord/voltha-protos/go/voltha"
"strconv"
"strings"
"time"
-)
-const (
- EventTypeVersion = "0.1"
-)
-
-type (
- EventType = voltha.EventType_EventType
- EventCategory = voltha.EventCategory_EventCategory
- EventSubCategory = voltha.EventSubCategory_EventSubCategory
+ "github.com/opencord/voltha-go/adapters/adapterif"
+ "github.com/opencord/voltha-go/common/log"
+ "github.com/opencord/voltha-go/kafka"
+ "github.com/opencord/voltha-protos/go/voltha"
)
type EventProxy struct {
@@ -68,7 +60,7 @@
return fmt.Sprintf("Voltha.openolt.%s.%s", eventName, strconv.FormatInt(time.Now().UnixNano(), 10))
}
-func (ep *EventProxy) getEventHeader(eventName string, category EventCategory, subCategory EventSubCategory, eventType EventType, raisedTs int64) *voltha.EventHeader {
+func (ep *EventProxy) getEventHeader(eventName string, category adapterif.EventCategory, subCategory adapterif.EventSubCategory, eventType adapterif.EventType, raisedTs int64) *voltha.EventHeader {
var header voltha.EventHeader
if strings.Contains(eventName, "_") {
eventName = strings.Join(strings.Split(eventName, "_")[:len(strings.Split(eventName, "_"))-2], "_")
@@ -80,14 +72,14 @@
header.Category = category
header.SubCategory = subCategory
header.Type = eventType
- header.TypeVersion = EventTypeVersion
+ header.TypeVersion = adapterif.EventTypeVersion
header.RaisedTs = float32(raisedTs)
header.ReportedTs = float32(time.Now().UnixNano())
return &header
}
/* Send out device events*/
-func (ep *EventProxy) SendDeviceEvent(deviceEvent *voltha.DeviceEvent, category EventCategory, subCategory EventSubCategory, raisedTs int64) error {
+func (ep *EventProxy) SendDeviceEvent(deviceEvent *voltha.DeviceEvent, category adapterif.EventCategory, subCategory adapterif.EventSubCategory, raisedTs int64) error {
if deviceEvent == nil {
log.Error("Recieved empty device event")
return errors.New("Device event nil")