More plumbing of grid coordinates vs. geo coordinates.
- Added background reference parameter to layout command
- send correct location data to client for devices, hosts
Change-Id: Ic00bda76f4e4bc8d3e23e07a08f3bc5367ec85a9
diff --git a/core/net/src/main/java/org/onosproject/net/host/impl/BasicHostOperator.java b/core/net/src/main/java/org/onosproject/net/host/impl/BasicHostOperator.java
index a35eecf..97b87f0 100644
--- a/core/net/src/main/java/org/onosproject/net/host/impl/BasicHostOperator.java
+++ b/core/net/src/main/java/org/onosproject/net/host/impl/BasicHostOperator.java
@@ -16,13 +16,12 @@
package org.onosproject.net.host.impl;
import org.onlab.packet.IpAddress;
-import org.onosproject.net.AnnotationKeys;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DefaultAnnotations;
import org.onosproject.net.HostLocation;
import org.onosproject.net.SparseAnnotations;
-import org.onosproject.net.config.ConfigOperator;
import org.onosproject.net.config.basics.BasicHostConfig;
+import org.onosproject.net.device.impl.BasicElementOperator;
import org.onosproject.net.host.DefaultHostDescription;
import org.onosproject.net.host.HostDescription;
@@ -32,7 +31,7 @@
* Implementations of merge policies for various sources of host configuration
* information. This includes applications, providers, and network configurations.
*/
-public final class BasicHostOperator implements ConfigOperator {
+public final class BasicHostOperator extends BasicElementOperator {
private BasicHostOperator() {
}
@@ -65,36 +64,22 @@
SparseAnnotations sa = combine(cfg, descr.annotations());
return new DefaultHostDescription(descr.hwAddress(), descr.vlan(),
- location, ipAddresses,
- descr.configured(), sa);
+ location, ipAddresses,
+ descr.configured(), sa);
}
/**
* Generates an annotation from an existing annotation and HostConfig.
*
- * @param cfg the device config entity from network config
+ * @param cfg the host config entity from network config
* @param an the annotation
* @return annotation combining both sources
*/
- public static SparseAnnotations combine(BasicHostConfig cfg,
- SparseAnnotations an) {
- DefaultAnnotations.Builder newBuilder = DefaultAnnotations.builder();
- if (cfg.name() != null) {
- newBuilder.set(AnnotationKeys.NAME, cfg.name());
- }
- if (cfg.uiType() != null) {
- newBuilder.set(AnnotationKeys.UI_TYPE, cfg.uiType());
- }
- if (cfg.geoCoordsSet()) {
- newBuilder.set(AnnotationKeys.LATITUDE, Double.toString(cfg.latitude()));
- newBuilder.set(AnnotationKeys.LONGITUDE, Double.toString(cfg.longitude()));
- }
- if (cfg.rackAddress() != null) {
- newBuilder.set(AnnotationKeys.RACK_ADDRESS, cfg.rackAddress());
- }
- if (cfg.owner() != null) {
- newBuilder.set(AnnotationKeys.OWNER, cfg.owner());
- }
- return DefaultAnnotations.union(an, newBuilder.build());
+ public static SparseAnnotations combine(BasicHostConfig cfg, SparseAnnotations an) {
+ DefaultAnnotations.Builder builder = DefaultAnnotations.builder();
+
+ combineElementAnnotations(cfg, builder);
+
+ return DefaultAnnotations.union(an, builder.build());
}
}