Skip to content
Snippets Groups Projects
Commit a2fc0b76 authored by Munish Mehta's avatar Munish Mehta
Browse files

BSC-2475: Handle rest output for port numbers larger than 32K

parent 5d2c766e
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
package net.floodlightcontroller.routing; package net.floodlightcontroller.routing;
import net.floodlightcontroller.core.web.serializers.DPIDSerializer; import net.floodlightcontroller.core.web.serializers.DPIDSerializer;
import net.floodlightcontroller.core.web.serializers.UShortSerializer;
import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonSerialize; import org.codehaus.jackson.map.annotate.JsonSerialize;
...@@ -52,6 +53,7 @@ public class Link { ...@@ -52,6 +53,7 @@ public class Link {
} }
@JsonProperty("src-port") @JsonProperty("src-port")
@JsonSerialize(using=UShortSerializer.class)
public short getSrcPort() { public short getSrcPort() {
return srcPort; return srcPort;
} }
...@@ -62,6 +64,7 @@ public class Link { ...@@ -62,6 +64,7 @@ public class Link {
return dst; return dst;
} }
@JsonProperty("dst-port") @JsonProperty("dst-port")
@JsonSerialize(using=UShortSerializer.class)
public short getDstPort() { public short getDstPort() {
return dstPort; return dstPort;
} }
...@@ -102,11 +105,18 @@ public class Link { ...@@ -102,11 +105,18 @@ public class Link {
public String toString() { public String toString() {
return "Link [src=" + HexString.toHexString(this.src) return "Link [src=" + HexString.toHexString(this.src)
+ " outPort=" + " outPort="
+ srcPort + (srcPort & 0xffff)
+ ", dst=" + HexString.toHexString(this.dst) + ", dst=" + HexString.toHexString(this.dst)
+ ", inPort=" + ", inPort="
+ dstPort + (dstPort & 0xffff)
+ "]"; + "]";
} }
public String toKeyString() {
return (HexString.toHexString(this.src) + "|" +
(this.srcPort & 0xffff) + "|" +
HexString.toHexString(this.dst) + "|" +
(this.dstPort & 0xffff) );
}
} }
package net.floodlightcontroller.topology; package net.floodlightcontroller.topology;
import net.floodlightcontroller.core.web.serializers.DPIDSerializer; import net.floodlightcontroller.core.web.serializers.DPIDSerializer;
import net.floodlightcontroller.core.web.serializers.UShortSerializer;
import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonSerialize; import org.codehaus.jackson.map.annotate.JsonSerialize;
...@@ -40,6 +41,7 @@ public class NodePortTuple { ...@@ -40,6 +41,7 @@ public class NodePortTuple {
this.nodeId = nodeId; this.nodeId = nodeId;
} }
@JsonProperty("port") @JsonProperty("port")
@JsonSerialize(using=UShortSerializer.class)
public short getPortId() { public short getPortId() {
return portId; return portId;
} }
...@@ -76,7 +78,13 @@ public class NodePortTuple { ...@@ -76,7 +78,13 @@ public class NodePortTuple {
return true; return true;
} }
/**
* API to return a String value formed wtih NodeID and PortID
* The portID is a 16-bit field, so mask it as an integer to get full
* positive value
* @return
*/
public String toKeyString() { public String toKeyString() {
return (HexString.toHexString(nodeId)+ "|" + portId); return (HexString.toHexString(nodeId)+ "|" + (portId & 0xffff));
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment