[VOL-3999] Correctly handling context during OLT Reconcile
Change-Id: I22b8cca74eba3574adee4ed9dae48808ca9af889
diff --git a/internal/bbr/devices/olt.go b/internal/bbr/devices/olt.go
index b65a174..b40bf58 100644
--- a/internal/bbr/devices/olt.go
+++ b/internal/bbr/devices/olt.go
@@ -48,6 +48,18 @@
CompletedOnus int // Number of ONUs that have received a DHCPAck
}
+type MockStream struct {
+ grpc.ServerStream
+}
+
+func (*MockStream) Send(ind *openolt.Indication) error {
+ return nil
+}
+
+func (*MockStream) Context() context.Context {
+ return context.Background()
+}
+
// trigger an enable call and start the same listeners on the gRPC stream that VOLTHA would create
// this method is blocking
func (o *OltMock) Start() {
@@ -211,7 +223,11 @@
}
ctx, cancel := context.WithCancel(context.TODO())
- go onu.ProcessOnuMessages(ctx, nil, client)
+ // NOTE we need to create a fake stream for ProcessOnuMessages
+ // as it listen on the context to cancel the loop
+ // In the BBR case it's not used for anything else
+ mockStream := MockStream{}
+ go onu.ProcessOnuMessages(ctx, &mockStream, client)
go func() {