[VOL-4286] Update ONU_DISCOVERY event to include the technology of the PON port
Change-Id: Id4f0b1b00321b22462c638c4b16fb9ef99343202
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index 9c45250..10bdd09 100644
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -216,6 +216,17 @@
logger.Debug(ctx, "device-agent-stopped")
}
+func (dh *DeviceHandler) getPonTechnology(intfID uint32) string {
+ for _, resourceRanges := range dh.deviceInfo.GetRanges() {
+ for _, pooledIntfID := range resourceRanges.GetIntfIds() {
+ if pooledIntfID == intfID {
+ return resourceRanges.GetTechnology()
+ }
+ }
+ }
+ return ""
+}
+
func macifyIP(ip net.IP) string {
if len(ip) > 0 {
oct1 := strconv.FormatInt(int64(ip[12]), 16)
diff --git a/internal/pkg/core/openolt_eventmgr.go b/internal/pkg/core/openolt_eventmgr.go
index 6ba684d..e72668e 100644
--- a/internal/pkg/core/openolt_eventmgr.go
+++ b/internal/pkg/core/openolt_eventmgr.go
@@ -123,6 +123,10 @@
ContextOnuDelineationErrors = "delineation-errors"
// ContextOnuDifferentialDistance is for the differential distance in an ONU event context
ContextOnuDifferentialDistance = "differential-distance"
+ // ContextOltPonTechnology is to indicate the pon-technology type, ie, 'GPON' or 'XGS-PON' (TODO check for combo?)
+ ContextOltPonTechnology = "pon-technology"
+ // ContextOltPortLabel is to indicate the string label of the pon-port, example: pon-0
+ ContextOltPortLabel = "port-label"
)
// OpenOltEventMgr struct contains
@@ -269,6 +273,8 @@
context[ContextOnuPonIntfID] = strconv.FormatUint(uint64(onuDisc.IntfId), base10)
context[ContextOnuSerialNumber] = serialNumber
context[ContextOnuDeviceID] = onuDeviceID
+ context[ContextOltPonTechnology] = em.handler.getPonTechnology(onuDisc.IntfId)
+ context[ContextOltPortLabel], _ = GetportLabel(onuDisc.GetIntfId(), voltha.Port_PON_OLT)
/* Populating device event body */
de.Context = context
de.ResourceId = oltDeviceID
@@ -339,6 +345,7 @@
onuDeviceID = onu.(*OnuDevice).deviceID
}
+ context[ContextOltPortLabel], _ = GetportLabel(intfID, voltha.Port_PON_OLT)
context[ContextOnuSerialNumber] = serialNumber
context[ContextOnuDeviceID] = onuDeviceID
}