[VOL-4595] Get image status of all ONUs if no deviceId is provided
Change-Id: I0ea0793e5703a8ebb27dcbdfc570522f50d2018c
diff --git a/rw_core/core/device/manager_nbi.go b/rw_core/core/device/manager_nbi.go
index edefc54..8b3848d 100644
--- a/rw_core/core/device/manager_nbi.go
+++ b/rw_core/core/device/manager_nbi.go
@@ -345,6 +345,18 @@
ctx = utils.WithRPCMetadataContext(ctx, "GetImageStatus")
respCh := make(chan []*voltha.DeviceImageState, len(request.GetDeviceId()))
+
+ if request.DeviceId == nil {
+ //Reply for every ONU
+ dMgr.deviceAgents.Range(func(key, value interface{}) bool {
+ device := value.(*Agent).device
+ if !device.Root {
+ request.DeviceId = append(request.DeviceId, &common.ID{Id: value.(*Agent).device.Id})
+ }
+ return true
+ })
+ }
+
for index, deviceID := range request.DeviceId {
// Create status request per device
imageStatusReq := &voltha.DeviceImageRequest{