[VOL-2982] Send ONUIndication on OLT PON port disable
Change-Id: I76db9bb3970a87fa837c34a4a566ea1176a854d8
diff --git a/VERSION b/VERSION
index 0ea3a94..a5fea60 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.2.0
+0.2.1-dev
diff --git a/internal/bbsim/devices/olt.go b/internal/bbsim/devices/olt.go
index 28ac5a1..4caf5b6 100644
--- a/internal/bbsim/devices/olt.go
+++ b/internal/bbsim/devices/olt.go
@@ -918,8 +918,42 @@
return new(openolt.Empty), nil
}
-func (o OltDevice) DisablePonIf(context.Context, *openolt.Interface) (*openolt.Empty, error) {
- oltLogger.Error("DisablePonIf not implemented")
+func (o OltDevice) DisablePonIf(_ context.Context, intf *openolt.Interface) (*openolt.Empty, error) {
+ oltLogger.Errorf("DisablePonIf request received for PON %d", intf.IntfId)
+ ponID := intf.GetIntfId()
+ pon, _ := o.GetPonById(intf.IntfId)
+ errInternalState := pon.InternalState.Event("disable")
+ oltLogger.WithFields(log.Fields{
+ "IntfId": ponID,
+ "err": errInternalState,
+ }).Error("Can't disable Internal state for PonPort")
+ errOperState := pon.OperState.Event("disable")
+ oltLogger.WithFields(log.Fields{
+ "IntfId": ponID,
+ "err": errOperState,
+ }).Error("Can't disable Oper state for PonPort")
+
+ msg := Message{
+ Type: PonIndication,
+ Data: PonIndicationMessage{
+ OperState: DOWN,
+ PonPortID: ponID,
+ },
+ }
+ o.channel <- msg
+
+ for _, onu := range pon.Onus {
+
+ onuIndication := OnuIndicationMessage{
+ OperState: DOWN,
+ PonPortID: ponID,
+ OnuID: onu.ID,
+ OnuSN: onu.SerialNumber,
+ }
+ onu.sendOnuIndication(onuIndication, *o.OpenoltStream)
+
+ }
+
return new(openolt.Empty), nil
}
@@ -933,6 +967,18 @@
func (o OltDevice) EnablePonIf(_ context.Context, intf *openolt.Interface) (*openolt.Empty, error) {
oltLogger.Errorf("EnablePonIf request received for PON %d", intf.IntfId)
ponID := intf.GetIntfId()
+ pon, _ := o.GetPonById(intf.IntfId)
+ errInternalState := pon.InternalState.Event("enable")
+ oltLogger.WithFields(log.Fields{
+ "IntfId": ponID,
+ "err": errInternalState,
+ }).Error("Can't enable Internal state for PonPort")
+ errOperState := pon.OperState.Event("enable")
+ oltLogger.WithFields(log.Fields{
+ "IntfId": ponID,
+ "err": errOperState,
+ }).Error("Can't enable Oper state for PonPort")
+
msg := Message{
Type: PonIndication,
Data: PonIndicationMessage{
@@ -942,6 +988,18 @@
}
o.channel <- msg
+ for _, onu := range pon.Onus {
+
+ onuIndication := OnuIndicationMessage{
+ OperState: UP,
+ PonPortID: ponID,
+ OnuID: onu.ID,
+ OnuSN: onu.SerialNumber,
+ }
+ onu.sendOnuIndication(onuIndication, *o.OpenoltStream)
+
+ }
+
return new(openolt.Empty), nil
}