Refactoring BasicDeviceOperator:
It's no longer a subclass of BasicDeviceConfig.
Change-Id: Icb7cc7e133428a19ddd739e4135c59854b082488
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 e306954..4949bc4 100644
--- a/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java
+++ b/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java
@@ -115,6 +115,16 @@
public static final String STATIC_PORT = "staticPort";
/**
+ * Annotation key for device location.
+ */
+ public static final String RACK_ADDRESS = "rackAddress";
+
+ /**
+ * Annotation key for device owner.
+ */
+ public static final String OWNER = "owner";
+
+ /**
* Returns the value annotated object for the specified annotation key.
* The annotated value is expected to be String that can be parsed as double.
* If parsing fails, the returned value will be 1.0.
diff --git a/core/net/src/main/java/org/onosproject/net/device/impl/BasicDeviceOperator.java b/core/net/src/main/java/org/onosproject/net/device/impl/BasicDeviceOperator.java
index 6c7a065..4af8000 100644
--- a/core/net/src/main/java/org/onosproject/net/device/impl/BasicDeviceOperator.java
+++ b/core/net/src/main/java/org/onosproject/net/device/impl/BasicDeviceOperator.java
@@ -30,8 +30,9 @@
* Implementations of merge policies for various sources of device configuration
* information. This includes applications, provides, and network configurations.
*/
-public final class BasicDeviceOperator extends BasicDeviceConfig {
+public final class BasicDeviceOperator {
+ protected static final double DEFAULT_COORD = -1.0;
private static final Logger log = getLogger(BasicDeviceOperator.class);
private BasicDeviceOperator() {
@@ -70,7 +71,7 @@
*/
public static SparseAnnotations combine(BasicDeviceConfig bdc, SparseAnnotations an) {
DefaultAnnotations.Builder newBuilder = DefaultAnnotations.builder();
- if (bdc.driver() != an.value(DRIVER)) {
+ if (bdc.driver() != an.value(AnnotationKeys.DRIVER)) {
newBuilder.set(AnnotationKeys.DRIVER, bdc.driver());
}
if (bdc.name() != null) {
@@ -83,10 +84,10 @@
newBuilder.set(AnnotationKeys.LONGITUDE, Double.toString(bdc.longitude()));
}
if (bdc.rackAddress() != null) {
- newBuilder.set(RACK_ADDRESS, bdc.rackAddress());
+ newBuilder.set(AnnotationKeys.RACK_ADDRESS, bdc.rackAddress());
}
if (bdc.owner() != null) {
- newBuilder.set(OWNER, bdc.owner());
+ newBuilder.set(AnnotationKeys.OWNER, bdc.owner());
}
DefaultAnnotations newAnnotations = newBuilder.build();
return DefaultAnnotations.union(an, newAnnotations);