VOL-3095: Added olt device_id in ONU Discovery Event

Change-Id: I7d778e3954418dd7a1766a8b7f976ccd3f38e70a
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index 8cf4c50..6db0063 100644
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -1112,7 +1112,7 @@
 				"pon-interface-id": ponintfid,
 				"serial-number":    sn}, err)
 		}
-		dh.eventMgr.OnuDiscoveryIndication(onuDiscInd, onuDevice.Id, onuID, sn, time.Now().UnixNano())
+		dh.eventMgr.OnuDiscoveryIndication(onuDiscInd, dh.device.Id, onuDevice.Id, onuID, sn, time.Now().UnixNano())
 		logger.Infow("onu-child-device-added",
 			log.Fields{"onuDevice": onuDevice,
 				"sn":        sn,
diff --git a/internal/pkg/core/openolt_eventmgr.go b/internal/pkg/core/openolt_eventmgr.go
index a692aef..4b6d12d 100644
--- a/internal/pkg/core/openolt_eventmgr.go
+++ b/internal/pkg/core/openolt_eventmgr.go
@@ -191,16 +191,17 @@
 }
 
 // OnuDiscoveryIndication is an exported method to handle ONU discovery event
-func (em *OpenOltEventMgr) OnuDiscoveryIndication(onuDisc *oop.OnuDiscIndication, deviceID string, OnuID uint32, serialNumber string, raisedTs int64) error {
+func (em *OpenOltEventMgr) OnuDiscoveryIndication(onuDisc *oop.OnuDiscIndication, oltDeviceID string, onuDeviceID string, OnuID uint32, serialNumber string, raisedTs int64) error {
 	var de voltha.DeviceEvent
 	context := make(map[string]string)
 	/* Populating event context */
 	context["onu-id"] = strconv.FormatUint(uint64(OnuID), base10)
 	context["intf-id"] = strconv.FormatUint(uint64(onuDisc.IntfId), base10)
 	context["serial-number"] = serialNumber
+	context["onu-device-id"] = onuDeviceID
 	/* Populating device event body */
 	de.Context = context
-	de.ResourceId = deviceID
+	de.ResourceId = oltDeviceID
 	de.DeviceEventName = fmt.Sprintf("%s_%s", onuDiscoveryEvent, "RAISE_EVENT")
 	/* Send event to KAFKA */
 	if err := em.eventProxy.SendDeviceEvent(&de, equipment, pon, raisedTs); err != nil {
diff --git a/internal/pkg/core/openolt_eventmgr_test.go b/internal/pkg/core/openolt_eventmgr_test.go
index 16f058f..f73e234 100644
--- a/internal/pkg/core/openolt_eventmgr_test.go
+++ b/internal/pkg/core/openolt_eventmgr_test.go
@@ -139,7 +139,8 @@
 	em := mockEventMgr()
 	type args struct {
 		onuDisc      *oop.OnuDiscIndication
-		deviceID     string
+		oltDeviceID  string
+		onuDeviceID  string
 		OnuID        uint32
 		serialNumber string
 		raisedTs     int64
@@ -149,13 +150,13 @@
 		args args
 	}{
 		// TODO: Add test cases.
-		{"OnuDiscoveryIndication", args{onuDisc: &oop.OnuDiscIndication{IntfId: 1, SerialNumber: &oop.SerialNumber{VendorId: []byte("TWSH"), VendorSpecific: []byte("1234")}}, deviceID: "olt", OnuID: 3, serialNumber: "1234", raisedTs: time.Now().Unix()}},
+		{"OnuDiscoveryIndication", args{onuDisc: &oop.OnuDiscIndication{IntfId: 1, SerialNumber: &oop.SerialNumber{VendorId: []byte("TWSH"), VendorSpecific: []byte("1234")}}, oltDeviceID: "olt", onuDeviceID: "onu1", OnuID: 3, serialNumber: "1234", raisedTs: time.Now().Unix()}},
 		{"OnuDiscoveryIndication", args{onuDisc: &oop.OnuDiscIndication{}, raisedTs: time.Now().Unix()}},
 		{"OnuDiscoveryIndication", args{onuDisc: &oop.OnuDiscIndication{}}},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
-			em.OnuDiscoveryIndication(tt.args.onuDisc, tt.args.deviceID, tt.args.OnuID, tt.args.serialNumber, tt.args.raisedTs)
+			em.OnuDiscoveryIndication(tt.args.onuDisc, tt.args.oltDeviceID, tt.args.onuDeviceID, tt.args.OnuID, tt.args.serialNumber, tt.args.raisedTs)
 		})
 	}
 }