Added UI_TYPE annotation key, and augmented BasicDeviceConfig and BasicHostConfig to support defining a custom "uiType" value to override the glyph used in rendering on the Topology View.
Change-Id: I615540419bce6e89e3761ef6ed3b9906be64b266
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 3c60240..a35eecf 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
@@ -45,7 +45,8 @@
* @param descr a HostDescription
* @return HostDescription based on both sources
*/
- public static HostDescription combine(BasicHostConfig cfg, HostDescription descr) {
+ public static HostDescription combine(BasicHostConfig cfg,
+ HostDescription descr) {
if (cfg == null) {
return descr;
}
@@ -64,7 +65,8 @@
SparseAnnotations sa = combine(cfg, descr.annotations());
return new DefaultHostDescription(descr.hwAddress(), descr.vlan(),
- location, ipAddresses, descr.configured(), sa);
+ location, ipAddresses,
+ descr.configured(), sa);
}
/**
@@ -74,11 +76,15 @@
* @param an the annotation
* @return annotation combining both sources
*/
- public static SparseAnnotations combine(BasicHostConfig cfg, SparseAnnotations an) {
+ 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()));