[VOL-4595] Get image status of all ONUs if no deviceId is provided
Change-Id: I0ea0793e5703a8ebb27dcbdfc570522f50d2018c
diff --git a/rw_core/core/device/manager.go b/rw_core/core/device/manager.go
index c8322a2..7d6e9da 100755
--- a/rw_core/core/device/manager.go
+++ b/rw_core/core/device/manager.go
@@ -774,7 +774,7 @@
}
func (dMgr *Manager) validateImageRequest(request *voltha.DeviceImageRequest) error {
- if request == nil || len(request.DeviceId) == 0 || request.DeviceId[0] == nil {
+ if request == nil {
return status.Errorf(codes.InvalidArgument, "invalid argument")
}
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{