[ONOS-6564] Adding PiPeconf behaviours to driver for device.
Initial implementation of PiPipeconfService.
Tests for Initial implementation.
Change-Id: I9dea6fb3015788b8b61060c7f88395c3d45e6ed7
diff --git a/core/api/src/main/java/org/onosproject/net/pi/model/PiPipeconf.java b/core/api/src/main/java/org/onosproject/net/pi/model/PiPipeconf.java
index 385c490..99754a8 100644
--- a/core/api/src/main/java/org/onosproject/net/pi/model/PiPipeconf.java
+++ b/core/api/src/main/java/org/onosproject/net/pi/model/PiPipeconf.java
@@ -45,7 +45,7 @@
PiPipelineModel pipelineModel();
/**
- * Returns all pipeline-specific behaviours defined by this configuration.
+ * Returns all pipeline-specific behaviour interfaces defined by this configuration.
*
* @return a collection of behaviours
*/
diff --git a/core/api/src/main/java/org/onosproject/net/pi/runtime/PiPipeconfConfig.java b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiPipeconfConfig.java
new file mode 100644
index 0000000..c476740
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiPipeconfConfig.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.pi.runtime;
+
+import com.google.common.annotations.Beta;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.config.Config;
+import org.onosproject.net.pi.model.PiPipeconfId;
+
+/**
+ * Configuration fot the PiPipeconf susbystem.
+ */
+@Beta
+public class PiPipeconfConfig extends Config<DeviceId> {
+
+ public static final String PIPIPECONFID = "piPipeconfId";
+
+ @Override
+ public boolean isValid() {
+ return hasOnlyFields(PIPIPECONFID);
+ //TODO will reinstate after synchonization of events
+ //&& !piPipeconfId().id().equals("");
+ }
+
+ public PiPipeconfId piPipeconfId() {
+ return new PiPipeconfId(get(PIPIPECONFID, ""));
+ }
+}
diff --git a/core/api/src/main/java/org/onosproject/net/pi/runtime/PiPipeconfService.java b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiPipeconfService.java
index c037eb6..34b5174 100644
--- a/core/api/src/main/java/org/onosproject/net/pi/runtime/PiPipeconfService.java
+++ b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiPipeconfService.java
@@ -22,6 +22,7 @@
import org.onosproject.net.pi.model.PiPipeconfId;
import java.util.Optional;
+import java.util.concurrent.CompletableFuture;
/**
* A service to manage the configurations of protocol-independent pipelines.
@@ -58,14 +59,16 @@
/**
* Binds the given pipeconf to the given infrastructure device. As a result of this method call,
* if the given pipeconf exposes any pipeline-specific behaviours, those will be merged to the
- * device's driver.
+ * device's driver. Returns a completable future to provide async methods with a boolean if the merge
+ * of the drivers succeeded.
*
* @param deviceId a device identifier
- * @param pipeconf a pipeconf identifier
+ * @param pipeconfId a pipeconf identifier
+ * @return a CompletableFuture with a boolean, true if operation succeeded
*/
// TODO: This service doesn't make any effort in deploying the configuration to the device.
// Someone else should do that.
- void bindToDevice(PiPipeconfId pipeconf, DeviceId deviceId);
+ CompletableFuture<Boolean> bindToDevice(PiPipeconfId pipeconfId, DeviceId deviceId);
/**
* Returns the pipeconf identifier currently associated with the given device identifier, if