[VOL-3996] Updating Image Protos

Change-Id: Id293cca9ea9b68ec337e73e9d4a9e3ad444e335c
diff --git a/protos/voltha_protos/voltha.proto b/protos/voltha_protos/voltha.proto
index c2d5459..56bcf18 100644
--- a/protos/voltha_protos/voltha.proto
+++ b/protos/voltha_protos/voltha.proto
@@ -162,6 +162,42 @@
     string id = 2;
 }
 
+message DeviceImageDownloadRequest {
+
+    // Device Id
+    // allows for operations on multiple devices.
+    repeated common.ID device_id = 1;
+
+    //The image for the device containing all the information
+    Image image = 2;
+
+    //Activate the image if the download to the device is successful
+    bool activateOnSuccess = 3;
+
+    //Automatically commit the image if the activation on the device is successful
+    bool commitOnSuccess = 4;
+}
+
+message DeviceImageRequest {
+
+    //Device Id
+    //allows for operations on multiple adapters.
+    repeated common.ID device_id = 1;
+
+    // Image Version, this is the sole identifier of the image. it's the vendor specified OMCI version
+    // must be known at the time of initiating a download, activate, commit image on an onu.
+    string version = 2;
+
+    //Automatically commit the image if the activation on the device is successful
+    bool commitOnSuccess = 3;
+}
+
+message DeviceImageResponse {
+
+    //Image state for the different devices
+    repeated DeviceImageState device_image_states = 1;
+}
+
 // Additional information required to process flow at device adapters
 message FlowMetadata {
     // Meters associated with flow-update to adapter
@@ -369,18 +405,19 @@
     }
 
     // Delete a device
-    rpc DeleteDevice(common.ID) returns(google.protobuf.Empty) {
+    rpc DeleteDevice (common.ID) returns (google.protobuf.Empty) {
         option (google.api.http) = {
             delete: "/api/v1/devices/{id}/delete"
         };
     }
 
     // Forcefully delete a device
-    rpc ForceDeleteDevice(common.ID) returns(google.protobuf.Empty) {
+    rpc ForceDeleteDevice (common.ID) returns (google.protobuf.Empty) {
         option (google.api.http) = {
             delete: "/api/v1/devices/{id}/force_delete"
         };
     }
+
     // Request an image download to the standby partition
     // of a device.
     // Note that the call is expected to be non-blocking.
@@ -393,6 +430,7 @@
 
     // Get image download status on a device
     // The request retrieves progress on device and updates db record
+    // Deprecated in voltha 2.8, will be removed
     rpc GetImageDownloadStatus(ImageDownload) returns(ImageDownload) {
         option (google.api.http) = {
             get: "/api/v1/devices/{id}/image_downloads/{name}/status"
@@ -400,6 +438,7 @@
     }
 
     // Get image download db record
+    // Deprecated in voltha 2.8, will be removed
     rpc GetImageDownload(ImageDownload) returns(ImageDownload) {
         option (google.api.http) = {
             get: "/api/v1/devices/{id}/image_downloads/{name}"
@@ -407,6 +446,7 @@
     }
 
     // List image download db records for a given device
+    // Deprecated in voltha 2.8, will be removed
     rpc ListImageDownloads(common.ID) returns(ImageDownloads) {
         option (google.api.http) = {
             get: "/api/v1/devices/{id}/image_downloads"
@@ -414,6 +454,7 @@
     }
 
     // Cancel an existing image download process on a device
+    // Deprecated in voltha 2.8, will be removed
     rpc CancelImageDownload(ImageDownload) returns(common.OperationResp) {
         option (google.api.http) = {
             delete: "/api/v1/devices/{id}/image_downloads/{name}"
@@ -427,6 +468,7 @@
     // If no reboot, then a reboot is required to make the
     // activated image running on device
     // Note that the call is expected to be non-blocking.
+    // Deprecated in voltha 2.8, will be removed
     rpc ActivateImageUpdate(ImageDownload) returns(common.OperationResp) {
         option (google.api.http) = {
             post: "/api/v1/devices/{id}/image_downloads/{name}/image_update"
@@ -441,6 +483,7 @@
     // If no reboot, then a reboot is required to make the
     // previous image running on device
     // Note that the call is expected to be non-blocking.
+    // Deprecated in voltha 2.8, will be removed
     rpc RevertImageUpdate(ImageDownload) returns(common.OperationResp) {
         option (google.api.http) = {
             post: "/api/v1/devices/{id}/image_downloads/{name}/image_revert"
@@ -448,15 +491,75 @@
         };
     }
 
+    // Downloads a certain image to the standby partition of the devices
+    // Note that the call is expected to be non-blocking.
+    rpc DownloadImageToDevice (DeviceImageDownloadRequest) returns (DeviceImageResponse) {
+        option (google.api.http) = {
+            get: "/api/v1/devices/images/download_images"
+        };
+    }
+
+    // Get image status on a number of devices devices
+    // Polled from northbound systems to get state of download/activate/commit
+    rpc GetImageStatus (DeviceImageRequest) returns (DeviceImageResponse) {
+        option (google.api.http) = {
+            get: "/api/v1/devices/images/images_status"
+        };
+    }
+
+    // Aborts the upgrade of an image on a device
+    // To be used carefully, stops any further operations for the Image on the given devices
+    // Might also stop if possible existing work, but no guarantees are given,
+    // depends on implementation and procedure status.
+    rpc AbortImageUpgradeToDevice (DeviceImageRequest) returns (DeviceImageResponse) {
+        option (google.api.http) = {
+            get: "/api/v1/devices/images/abort_upgrade_images"
+        };
+    }
+
+    // Get Both Active and Standby image for a given device
+    rpc GetOnuImages (common.ID) returns (OnuImages) {
+        option (google.api.http) = {
+            get: "/api/v1/devices/{id}/onu_images"
+        };
+    }
+
+    // Activate the specified image from a standby partition
+    // to active partition.
+    // Depending on the device implementation, this call
+    // may or may not cause device reboot.
+    // If no reboot, then a reboot is required to make the
+    // activated image running on device
+    // Note that the call is expected to be non-blocking.
+    rpc ActivateImage (DeviceImageRequest) returns (DeviceImageResponse) {
+        option (google.api.http) = {
+            post: "/api/v1/devices/images/activate_images"
+            body: "*"
+        };
+    }
+
+    // Commit the specified image to be default.
+    // Depending on the device implementation, this call
+    // may or may not cause device reboot.
+    // If no reboot, then a reboot is required to make the
+    // activated image running on device upon next reboot
+    // Note that the call is expected to be non-blocking.
+    rpc CommitImage (DeviceImageRequest) returns (DeviceImageResponse) {
+        option (google.api.http) = {
+            post: "/api/v1/devices/images/commit_images"
+            body: "*"
+        };
+    }
+
     // List ports of a device
-    rpc ListDevicePorts(common.ID) returns(Ports) {
+    rpc ListDevicePorts (common.ID) returns (Ports) {
         option (google.api.http) = {
             get: "/api/v1/devices/{id}/ports"
         };
     }
 
     // List pm config of a device
-    rpc ListDevicePmConfigs(common.ID) returns(PmConfigs) {
+    rpc ListDevicePmConfigs (common.ID) returns (PmConfigs) {
         option (google.api.http) = {
             get: "/api/v1/devices/{id}/pm_configs"
         };