VOL-1437 : Fix display of devices in CLI
Renamed state field in image download proto which caused
json marshalling to fail.
other updates
- unmarshal data properly when pulling data from kv in watch
- do not update unecessarily if watch data matches data in memory
- added ofagent target to python Makefile
- fixed grpc path to update log level which interfered with getdevice
Change-Id: I4fceeb539c3325b6754efe2b68251d83b7367211
diff --git a/rw_core/core/device_agent.go b/rw_core/core/device_agent.go
index b50ca94..31720c1 100644
--- a/rw_core/core/device_agent.go
+++ b/rw_core/core/device_agent.go
@@ -316,7 +316,7 @@
}
// Save the image
clonedImg := proto.Clone(img).(*voltha.ImageDownload)
- clonedImg.State = voltha.ImageDownload_DOWNLOAD_REQUESTED
+ clonedImg.DownloadState = voltha.ImageDownload_DOWNLOAD_REQUESTED
cloned := proto.Clone(device).(*voltha.Device)
if cloned.ImageDownloads == nil {
cloned.ImageDownloads = []*voltha.ImageDownload{clonedImg}
@@ -363,7 +363,7 @@
cloned := proto.Clone(device).(*voltha.Device)
for _, image := range cloned.ImageDownloads {
if image.Id == img.Id && image.Name == img.Name {
- image.State = voltha.ImageDownload_DOWNLOAD_CANCELLED
+ image.DownloadState = voltha.ImageDownload_DOWNLOAD_CANCELLED
}
}
@@ -488,15 +488,15 @@
clonedImages := make([]*voltha.ImageDownload, len(cloned.ImageDownloads))
for _, image := range cloned.ImageDownloads {
if image.Id == img.Id && image.Name == img.Name {
- if image.State != voltha.ImageDownload_DOWNLOAD_CANCELLED {
+ if image.DownloadState != voltha.ImageDownload_DOWNLOAD_CANCELLED {
clonedImages = append(clonedImages, img)
}
}
}
cloned.ImageDownloads = clonedImages
// Set the Admin state to enabled if required
- if (img.State != voltha.ImageDownload_DOWNLOAD_REQUESTED &&
- img.State != voltha.ImageDownload_DOWNLOAD_STARTED) ||
+ if (img.DownloadState != voltha.ImageDownload_DOWNLOAD_REQUESTED &&
+ img.DownloadState != voltha.ImageDownload_DOWNLOAD_STARTED) ||
(img.ImageState != voltha.ImageDownload_IMAGE_ACTIVATING){
cloned.AdminState = voltha.AdminState_ENABLED
}