Introduced SetPackage and SwitchControlProcessor RPC to gNOI implementation.
Change-Id: Ib8df537459b50bb83fadfe217e6ea5cd2bf6da5f
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/SoftwareUpgrade.java b/core/api/src/main/java/org/onosproject/net/behaviour/SoftwareUpgrade.java
index c6cdb44..24bb597 100644
--- a/core/api/src/main/java/org/onosproject/net/behaviour/SoftwareUpgrade.java
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/SoftwareUpgrade.java
@@ -20,7 +20,6 @@
import org.onosproject.net.driver.HandlerBehaviour;
-import java.net.URI;
import java.util.concurrent.CompletableFuture;
/**
@@ -31,32 +30,55 @@
public interface SoftwareUpgrade extends HandlerBehaviour {
/**
- * Completion status of upgrade.
+ * Upload a package to device. If no destination path is specified
+ * the package will be stored in the /tmp folder with a randomized name.
+ *
+ * @param sourcePath path to local package.
+ * @param destinationPath (optional) path where the package will be saved.
+ * @return path where the package was saved on device or null in case of an error.
*/
- public enum Status {
- /**
- * Indicates a successfully completed upgrade.
- */
- SUCCESS,
+ public CompletableFuture<String> uploadPackage(String sourcePath, String destinationPath);
- /**
- * Indicates an aborted upgrade.
- */
- FAILURE
+ /**
+ * Causes the device to switch from the current software agent
+ * to the provided agent.
+ *
+ * @param packagePath path to package on device.
+ * @return success - if no exceptions occured; device uptime; device version.
+ */
+ public CompletableFuture<Response> swapAgent(String packagePath);
+
+ /**
+ * Response of SwapAgent.
+ */
+ public final class Response {
+ private final Long uptime;
+ private final String version;
+ private final boolean success;
+
+ public Response(Long a, String b) {
+ uptime = a;
+ version = b;
+ success = true;
+ }
+
+ public Response() {
+ uptime = 0L;
+ version = "";
+ success = false;
+ }
+
+ public Long getUptime() {
+ return uptime;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
}
- /**
- * Configures the uri from where the upgrade will be pulled.
- *
- * @param uri uri of the software upgrade location
- * @return boolean true if the uri was properly configured
- */
- boolean configureUri(URI uri);
-
- /**
- * Performs an upgrade.
- *
- * @return A future that will be completed when the upgrade completes
- */
- CompletableFuture<Status> upgrade();
}