Few core changes in preparation of P4Runtime subsystem refactoring
Refactoring aims at providing a more robust connection procedure of
P4Runtime-based devices.
Refactoring requires devices to be registered to the core with
available=false (i.e. offline), and marked online only when the P4
pipeline has been deployed to the device. Also, it leaves the duty of
handling pipeconf-specific drivers to the driver subsystem, instead of
having the GeneralDeviceProvider take care of it, which resulted to be
brittle.
Changes include:
- Choose not to mark device online when re-asserting mastership role by
declaring special device annotation.
- Lookup drivers in device projectable model unsing driver service
device-based method, which is consistent with the way other subsystems
look for device drivers.
- In DriverManager, when looking for device drivers, consider the case
of pipeconf-programmable devices, in which case a special "merged"
driver needs to instantiated at runtime.
- In PacketManager, push flow objectives only if device is available
(i.e. after pipeline has been deployed).
Change-Id: I80f78a4f40730a06cb82fa55fefab08a91a89268
diff --git a/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java b/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java
index 31e489e..5af7f7a 100644
--- a/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java
+++ b/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java
@@ -89,6 +89,16 @@
public static final String DRIVER = "driver";
/**
+ * Annotation key for the device availability behavior. The value of this key
+ * is expected to be a boolean ({@code true} or {@code false}) and it is
+ * used to determine if the device can be marked online by the core when
+ * deemed appropriate (value is {@code false}, default behaviour if key is
+ * not present), or if marking online should be left to providers ({@code
+ * true}).
+ */
+ public static final String PROVIDER_MARK_ONLINE = "providerMarkOnline";
+
+ /**
* Annotation key for durable links.
*/
public static final String DURABLE = "durable";
diff --git a/core/api/src/main/java/org/onosproject/net/DefaultDevice.java b/core/api/src/main/java/org/onosproject/net/DefaultDevice.java
index 9d9cc1b..ea25ed5 100644
--- a/core/api/src/main/java/org/onosproject/net/DefaultDevice.java
+++ b/core/api/src/main/java/org/onosproject/net/DefaultDevice.java
@@ -16,6 +16,7 @@
package org.onosproject.net;
import org.onlab.packet.ChassisId;
+import org.onlab.util.ItemNotFoundException;
import org.onosproject.net.driver.Behaviour;
import org.onosproject.net.driver.DefaultDriverHandler;
import org.onosproject.net.driver.Driver;
@@ -152,9 +153,11 @@
@Override
protected Driver locateDriver() {
- Driver driver = super.locateDriver();
- return driver != null ? driver :
- driverService().getDriver(manufacturer, hwVersion, swVersion);
+ try {
+ return driverService().getDriver(id());
+ } catch (ItemNotFoundException e) {
+ return null;
+ }
}
/**
diff --git a/core/api/src/main/java/org/onosproject/net/pi/service/PiPipeconfService.java b/core/api/src/main/java/org/onosproject/net/pi/service/PiPipeconfService.java
index b574b5b..e9539a5 100644
--- a/core/api/src/main/java/org/onosproject/net/pi/service/PiPipeconfService.java
+++ b/core/api/src/main/java/org/onosproject/net/pi/service/PiPipeconfService.java
@@ -98,7 +98,7 @@
* @param pipeconfId a pipeconf identifier
* @return driver name or null.
*/
- String mergeDriver(DeviceId deviceId, PiPipeconfId pipeconfId);
+ String getMergedDriver(DeviceId deviceId, PiPipeconfId pipeconfId);
/**
* Returns the pipeconf identifier currently associated with the given