Enhancement to switchmanager CLI commands to display all the properties of node and...
[controller.git] / opendaylight / sal / api / src / main / java / org / opendaylight / controller / sal / core / State.java
index ba67e0d8213454e76d3fc8fc9760177745e0bec9..e47542a7bef9f259bfab5ca21bbca82fc528e980 100644 (file)
@@ -20,7 +20,7 @@ import javax.xml.bind.annotation.XmlRootElement;
 @XmlRootElement
 @SuppressWarnings("serial")
 public class State extends Property {
-    @XmlElement
+    @XmlElement(name="value")
     private short stateValue;
 
     public static final short EDGE_DOWN = 0;
@@ -41,6 +41,7 @@ public class State extends Property {
         this.stateValue = state;
     }
 
+    @Override
     public State clone() {
         return new State(this.stateValue);
     }
@@ -75,4 +76,17 @@ public class State extends Property {
     public String toString() {
         return "State[" + stateValue + "]";
     }
+
+    @Override
+    public String getStringValue() {
+        if (stateValue == 0) {
+            return ("EDGE_DOWN");
+        } else if (stateValue == 1) {
+            return ("EDGE_UP");
+        } else if (stateValue == 0x7fff) {
+            return ("EDGE_UNK");
+        } else {
+            return String.valueOf(stateValue);
+        }
+    }
 }