VOL-2192 Update the OnuId to the one received from voltha during discovery
Change-Id: I3fb759fc4422a58428ec3a8cb7e35dd5ac26fca0
diff --git a/internal/bbsim/devices/olt.go b/internal/bbsim/devices/olt.go
index c374d4a..6b15de4 100644
--- a/internal/bbsim/devices/olt.go
+++ b/internal/bbsim/devices/olt.go
@@ -490,6 +490,7 @@
pon, _ := o.GetPonById(onu.IntfId)
_onu, _ := pon.GetOnuBySn(onu.SerialNumber)
+ _onu.SetID(onu.OnuId)
if err := _onu.OperState.Event("enable"); err != nil {
oltLogger.WithFields(log.Fields{
diff --git a/internal/bbsim/devices/onu.go b/internal/bbsim/devices/onu.go
index 564c21e..9fa224d 100644
--- a/internal/bbsim/devices/onu.go
+++ b/internal/bbsim/devices/onu.go
@@ -215,7 +215,7 @@
return &o
}
-func (o Onu) logStateChange(src string, dst string) {
+func (o *Onu) logStateChange(src string, dst string) {
onuLogger.WithFields(log.Fields{
"OnuId": o.ID,
"IntfId": o.PonPortID,
@@ -306,7 +306,7 @@
}
}
-func (o Onu) processOmciMessage(message omcisim.OmciChMessage) {
+func (o *Onu) processOmciMessage(message omcisim.OmciChMessage) {
switch message.Type {
case omcisim.GemPortAdded:
log.WithFields(log.Fields{
@@ -328,7 +328,7 @@
}
}
-func (o Onu) NewSN(oltid int, intfid uint32, onuid uint32) *openolt.SerialNumber {
+func (o *Onu) NewSN(oltid int, intfid uint32, onuid uint32) *openolt.SerialNumber {
sn := new(openolt.SerialNumber)
@@ -342,7 +342,7 @@
// NOTE handle_/process methods can change the ONU internal state as they are receiving messages
// send method should not change the ONU state
-func (o Onu) sendDyingGaspInd(msg DyingGaspIndicationMessage, stream openolt.Openolt_EnableIndicationServer) error {
+func (o *Onu) sendDyingGaspInd(msg DyingGaspIndicationMessage, stream openolt.Openolt_EnableIndicationServer) error {
alarmData := &openolt.AlarmIndication_DyingGaspInd{
DyingGaspInd: &openolt.DyingGaspIndication{
IntfId: msg.PonPortID,
@@ -364,7 +364,7 @@
return nil
}
-func (o Onu) sendOnuDiscIndication(msg OnuDiscIndicationMessage, stream openolt.Openolt_EnableIndicationServer) {
+func (o *Onu) sendOnuDiscIndication(msg OnuDiscIndicationMessage, stream openolt.Openolt_EnableIndicationServer) {
discoverData := &openolt.Indication_OnuDiscInd{OnuDiscInd: &openolt.OnuDiscIndication{
IntfId: msg.Onu.PonPortID,
SerialNumber: msg.Onu.SerialNumber,
@@ -390,7 +390,7 @@
}).Debug("Sent Indication_OnuDiscInd")
}
-func (o Onu) sendOnuIndication(msg OnuIndicationMessage, stream openolt.Openolt_EnableIndicationServer) {
+func (o *Onu) sendOnuIndication(msg OnuIndicationMessage, stream openolt.Openolt_EnableIndicationServer) {
// NOTE voltha returns an ID, but if we use that ID then it complains:
// expected_onu_id: 1, received_onu_id: 1024, event: ONU-id-mismatch, can happen if both voltha and the olt rebooted
// so we're using the internal ID that is 1
@@ -417,7 +417,7 @@
}
-func (o Onu) handleOmciMessage(msg OmciMessage, stream openolt.Openolt_EnableIndicationServer) {
+func (o *Onu) handleOmciMessage(msg OmciMessage, stream openolt.Openolt_EnableIndicationServer) {
onuLogger.WithFields(log.Fields{
"IntfId": o.PonPortID,
@@ -477,6 +477,10 @@
}
}
+func (o *Onu) SetID(id uint32) {
+ o.ID = id
+}
+
func (o *Onu) handleFlowUpdate(msg OnuFlowUpdateMessage) {
onuLogger.WithFields(log.Fields{
"DstPort": msg.Flow.Classifier.DstPort,