Add state/status to Topology Element
Updated discovery to populate the status and config type
Changed status to admin status
Added to Kryo Serializer list
ONOS-1428
Change-Id: I38e5ecf2b45b95c148339d127d86592c0e9678ba
diff --git a/src/main/java/net/onrc/onos/core/topology/TopologyElement.java b/src/main/java/net/onrc/onos/core/topology/TopologyElement.java
index 685bc98..a9cfbf8 100644
--- a/src/main/java/net/onrc/onos/core/topology/TopologyElement.java
+++ b/src/main/java/net/onrc/onos/core/topology/TopologyElement.java
@@ -34,6 +34,9 @@
*/
public static final String TYPE_OPTICAL_LAYER = "optical";
+ public static final String ELEMENT_CONFIG_STATE = "ConfigState";
+
+ public static final String ELEMENT_ADMIN_STATUS = "AdminStatus";
private boolean isFrozen = false;
@@ -59,6 +62,7 @@
public TopologyElement(TopologyElement<T> original) {
this.isFrozen = false;
this.stringAttributes = new ConcurrentHashMap<>(original.stringAttributes);
+
}
@@ -171,4 +175,25 @@
public String getType() {
return getStringAttribute(TYPE, TYPE_PACKET_LAYER);
}
+
+ /**
+ * Returns the config state of topology element.
+ *
+ * @return ConfigState
+ */
+ @Override
+ public ConfigState getConfigState() {
+ return ConfigState.valueOf(getStringAttribute(ELEMENT_CONFIG_STATE));
+ }
+
+ /**
+ * Returns the status of topology element.
+ *
+ * @return AdminStatus
+ */
+ @Override
+ public AdminStatus getStatus() {
+ return AdminStatus.valueOf(getStringAttribute(ELEMENT_ADMIN_STATUS));
+ }
+
}