VOL-4465 raise ONU/OLT deleted events
Change-Id: I183203218a12083a49dfd65fd3b00ff679e3100a
diff --git a/VERSION b/VERSION
index ef09838..a8a1887 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-7.1.1
\ No newline at end of file
+7.1.2
diff --git a/pkg/events/utils.go b/pkg/events/utils.go
index 4598161..f02c3bc 100644
--- a/pkg/events/utils.go
+++ b/pkg/events/utils.go
@@ -48,12 +48,20 @@
ContextIsRoot ContextType = "is-root"
// ContextParentPort is for the parent interface id of child in the context of the event
ContextParentPort ContextType = "parent-port"
+ //ContextPonID is the PON ID the Child device is connected to
+ ContextPonID ContextType = "pon-id"
+ //ContextOnuID is the Onu ID of the child device
+ ContextOnuID ContextType = "onu-id"
+ //ContextParentSerialNum is the serila number of the parent device
+ ContextParentSerialNum ContextType = "olt-serial-number"
)
type EventName string
const (
DeviceStateChangeEvent EventName = "DEVICE_STATE_CHANGE"
+ OltDeviceStateDeleted EventName = "OLT_DELETED_RAISE_EVENT"
+ OnuDeviceStateDeleted EventName = "ONU_DELETED_RAISE_EVENT"
)
type EventAction string
@@ -89,3 +97,27 @@
DeviceEventName: fmt.Sprintf("%s_%s", string(DeviceStateChangeEvent), string(Raise)),
}
}
+
+//CreateDeviceDeletedEvent forms and returns a new DeviceState Event
+func CreateDeviceDeletedEvent(serialNumber string, deviceID string, parentID string,
+ onuId uint32, parentPonPort uint32, isRoot bool) *voltha.DeviceEvent {
+
+ context := make(map[string]string)
+ eventName := string(OltDeviceStateDeleted)
+ /* Populating event context */
+ context[string(ContextSerialNumber)] = serialNumber
+ context[string(ContextDeviceID)] = deviceID
+ if !isRoot {
+ context[string(ContextPonID)] = strconv.FormatUint(uint64(parentPonPort), 10)
+ context[string(ContextOnuID)] = strconv.FormatUint(uint64(onuId), 10)
+ context[string(ContextParentID)] = parentID
+ eventName = string(OnuDeviceStateDeleted)
+
+ }
+
+ return &voltha.DeviceEvent{
+ Context: context,
+ ResourceId: deviceID,
+ DeviceEventName: eventName,
+ }
+}