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 @@
package net.floodlightcontroller.routing;
import net.floodlightcontroller.core.web.serializers.DPIDSerializer;
import net.floodlightcontroller.core.web.serializers.UShortSerializer;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonSerialize;
......@@ -52,6 +53,7 @@ public class Link {
}
@JsonProperty("src-port")
@JsonSerialize(using=UShortSerializer.class)
public short getSrcPort() {
return srcPort;
}
......@@ -62,6 +64,7 @@ public class Link {
return dst;
}
@JsonProperty("dst-port")
@JsonSerialize(using=UShortSerializer.class)
public short getDstPort() {
return dstPort;
}
......@@ -102,11 +105,18 @@ public class Link {
public String toString() {
return "Link [src=" + HexString.toHexString(this.src)
+ " outPort="
+ srcPort
+ (srcPort & 0xffff)
+ ", dst=" + HexString.toHexString(this.dst)
+ ", 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;
import net.floodlightcontroller.core.web.serializers.DPIDSerializer;
import net.floodlightcontroller.core.web.serializers.UShortSerializer;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonSerialize;
......@@ -40,6 +41,7 @@ public class NodePortTuple {
this.nodeId = nodeId;
}
@JsonProperty("port")
@JsonSerialize(using=UShortSerializer.class)
public short getPortId() {
return portId;
}
......@@ -76,7 +78,13 @@ public class NodePortTuple {
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() {
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