Fix checkstyle whitespace issues - WHITESPACE ONLY
Change-Id: Ic205c1afd639c6008d61d9de95cb764eeb6238ca
diff --git a/src/main/java/net/onrc/onos/core/util/CallerId.java b/src/main/java/net/onrc/onos/core/util/CallerId.java
index bcd9704..f58d69f 100644
--- a/src/main/java/net/onrc/onos/core/util/CallerId.java
+++ b/src/main/java/net/onrc/onos/core/util/CallerId.java
@@ -11,15 +11,17 @@
/**
* Default constructor.
*/
- public CallerId() {}
-
+ public CallerId() {
+ }
+
/**
* Copy constructor
+ *
* @param otherCallerId
*/
public CallerId(CallerId otherCallerId) {
- // Note: make a full copy if we change value to a mutable type
- value = otherCallerId.value;
+ // Note: make a full copy if we change value to a mutable type
+ value = otherCallerId.value;
}
/**
@@ -28,7 +30,7 @@
* @param value the value to use.
*/
public CallerId(String value) {
- this.value = value;
+ this.value = value;
}
/**
@@ -37,7 +39,9 @@
* @return the value of the Caller ID.
*/
@JsonProperty("value")
- public String value() { return value; }
+ public String value() {
+ return value;
+ }
/**
* Set the value of the Caller ID.
@@ -46,7 +50,7 @@
*/
@JsonProperty("value")
public void setValue(String value) {
- this.value = value;
+ this.value = value;
}
/**
@@ -56,22 +60,22 @@
*/
@Override
public String toString() {
- return value;
+ return value;
}
-
+
@Override
public boolean equals(Object other) {
- if (!(other instanceof CallerId)) {
- return false;
+ if (!(other instanceof CallerId)) {
+ return false;
+ }
+
+ CallerId otherCallerId = (CallerId) other;
+
+ return value.equals(otherCallerId.value);
}
-
- CallerId otherCallerId = (CallerId) other;
-
- return value.equals(otherCallerId.value);
- }
-
+
@Override
public int hashCode() {
- return value.hashCode();
+ return value.hashCode();
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/DataPath.java b/src/main/java/net/onrc/onos/core/util/DataPath.java
index 7dd1f51..1aa514c 100644
--- a/src/main/java/net/onrc/onos/core/util/DataPath.java
+++ b/src/main/java/net/onrc/onos/core/util/DataPath.java
@@ -8,17 +8,17 @@
* The data forwarding path state from a source to a destination.
*/
public class DataPath {
- private SwitchPort srcPort; // The source port
- private SwitchPort dstPort; // The destination port
- private ArrayList<FlowEntry> flowEntries; // The Flow Entries
+ private SwitchPort srcPort; // The source port
+ private SwitchPort dstPort; // The destination port
+ private ArrayList<FlowEntry> flowEntries; // The Flow Entries
/**
* Default constructor.
*/
public DataPath() {
- srcPort = new SwitchPort();
- dstPort = new SwitchPort();
- flowEntries = new ArrayList<FlowEntry>();
+ srcPort = new SwitchPort();
+ dstPort = new SwitchPort();
+ flowEntries = new ArrayList<FlowEntry>();
}
/**
@@ -27,7 +27,9 @@
* @return the data path source port.
*/
@JsonProperty("srcPort")
- public SwitchPort srcPort() { return srcPort; }
+ public SwitchPort srcPort() {
+ return srcPort;
+ }
/**
* Set the data path source port.
@@ -36,7 +38,7 @@
*/
@JsonProperty("srcPort")
public void setSrcPort(SwitchPort srcPort) {
- this.srcPort = srcPort;
+ this.srcPort = srcPort;
}
/**
@@ -45,7 +47,9 @@
* @return the data path destination port.
*/
@JsonProperty("dstPort")
- public SwitchPort dstPort() { return dstPort; }
+ public SwitchPort dstPort() {
+ return dstPort;
+ }
/**
* Set the data path destination port.
@@ -54,7 +58,7 @@
*/
@JsonProperty("dstPort")
public void setDstPort(SwitchPort dstPort) {
- this.dstPort = dstPort;
+ this.dstPort = dstPort;
}
/**
@@ -63,7 +67,9 @@
* @return the data path flow entries.
*/
@JsonProperty("flowEntries")
- public ArrayList<FlowEntry> flowEntries() { return flowEntries; }
+ public ArrayList<FlowEntry> flowEntries() {
+ return flowEntries;
+ }
/**
* Set the data path flow entries.
@@ -72,7 +78,7 @@
*/
@JsonProperty("flowEntries")
public void setFlowEntries(ArrayList<FlowEntry> flowEntries) {
- this.flowEntries = flowEntries;
+ this.flowEntries = flowEntries;
}
/**
@@ -81,63 +87,63 @@
* @param flowPathFlags the Flow Path Flags to apply.
*/
public void applyFlowPathFlags(FlowPathFlags flowPathFlags) {
- if (flowPathFlags == null)
- return; // Nothing to do
+ if (flowPathFlags == null)
+ return; // Nothing to do
- // Discard the first Flow Entry
- if (flowPathFlags.isDiscardFirstHopEntry()) {
- if (flowEntries.size() > 0)
- flowEntries.remove(0);
- }
+ // Discard the first Flow Entry
+ if (flowPathFlags.isDiscardFirstHopEntry()) {
+ if (flowEntries.size() > 0)
+ flowEntries.remove(0);
+ }
- // Keep only the first Flow Entry
- if (flowPathFlags.isKeepOnlyFirstHopEntry()) {
- if (flowEntries.size() > 1) {
- FlowEntry flowEntry = flowEntries.get(0);
- flowEntries.clear();
- flowEntries.add(flowEntry);
- }
- }
+ // Keep only the first Flow Entry
+ if (flowPathFlags.isKeepOnlyFirstHopEntry()) {
+ if (flowEntries.size() > 1) {
+ FlowEntry flowEntry = flowEntries.get(0);
+ flowEntries.clear();
+ flowEntries.add(flowEntry);
+ }
+ }
}
/**
* Remove Flow Entries that were deleted.
*/
public void removeDeletedFlowEntries() {
- //
- // NOTE: We create a new ArrayList, and add only the Flow Entries
- // that are NOT FE_USER_DELETE.
- // This is sub-optimal: if it adds notable processing cost,
- // the Flow Entries container should be changed to LinkedList
- // or some other container that has O(1) cost of removing an entry.
- //
+ //
+ // NOTE: We create a new ArrayList, and add only the Flow Entries
+ // that are NOT FE_USER_DELETE.
+ // This is sub-optimal: if it adds notable processing cost,
+ // the Flow Entries container should be changed to LinkedList
+ // or some other container that has O(1) cost of removing an entry.
+ //
- // Test first whether any Flow Entry was deleted
- boolean foundDeletedFlowEntry = false;
- for (FlowEntry flowEntry : this.flowEntries) {
- if (flowEntry.flowEntryUserState() ==
- FlowEntryUserState.FE_USER_DELETE) {
- foundDeletedFlowEntry = true;
- break;
- }
- }
- if (! foundDeletedFlowEntry)
- return; // Nothing to do
+ // Test first whether any Flow Entry was deleted
+ boolean foundDeletedFlowEntry = false;
+ for (FlowEntry flowEntry : this.flowEntries) {
+ if (flowEntry.flowEntryUserState() ==
+ FlowEntryUserState.FE_USER_DELETE) {
+ foundDeletedFlowEntry = true;
+ break;
+ }
+ }
+ if (!foundDeletedFlowEntry)
+ return; // Nothing to do
- // Create a new collection and exclude the deleted flow entries
- ArrayList<FlowEntry> newFlowEntries = new ArrayList<FlowEntry>();
- for (FlowEntry flowEntry : this.flowEntries()) {
- if (flowEntry.flowEntryUserState() !=
- FlowEntryUserState.FE_USER_DELETE) {
- newFlowEntries.add(flowEntry);
- }
- }
- setFlowEntries(newFlowEntries);
+ // Create a new collection and exclude the deleted flow entries
+ ArrayList<FlowEntry> newFlowEntries = new ArrayList<FlowEntry>();
+ for (FlowEntry flowEntry : this.flowEntries()) {
+ if (flowEntry.flowEntryUserState() !=
+ FlowEntryUserState.FE_USER_DELETE) {
+ newFlowEntries.add(flowEntry);
+ }
+ }
+ setFlowEntries(newFlowEntries);
}
/**
* Convert the data path to a string.
- *
+ * <p/>
* The string has the following form:
* [src=01:01:01:01:01:01:01:01/1111 flowEntry=<entry1> flowEntry=<entry2> flowEntry=<entry3> dst=02:02:02:02:02:02:02:02/2222]
*
@@ -145,13 +151,13 @@
*/
@Override
public String toString() {
- String ret = "[src=" + this.srcPort.toString();
+ String ret = "[src=" + this.srcPort.toString();
- for (FlowEntry fe : flowEntries) {
- ret += " flowEntry=" + fe.toString();
- }
- ret += " dst=" + this.dstPort.toString() + "]";
+ for (FlowEntry fe : flowEntries) {
+ ret += " flowEntry=" + fe.toString();
+ }
+ ret += " dst=" + this.dstPort.toString() + "]";
- return ret;
+ return ret;
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/DataPathEndpoints.java b/src/main/java/net/onrc/onos/core/util/DataPathEndpoints.java
index eeb5aaa..70edfee 100644
--- a/src/main/java/net/onrc/onos/core/util/DataPathEndpoints.java
+++ b/src/main/java/net/onrc/onos/core/util/DataPathEndpoints.java
@@ -7,8 +7,8 @@
* The class representing the Data Path Endpoints.
*/
public class DataPathEndpoints {
- private SwitchPort srcPort; // The source port
- private SwitchPort dstPort; // The destination port
+ private SwitchPort srcPort; // The source port
+ private SwitchPort dstPort; // The destination port
/**
* Default constructor.
@@ -23,8 +23,8 @@
* @param dstPort the destination port to use.
*/
public DataPathEndpoints(SwitchPort srcPort, SwitchPort dstPort) {
- this.srcPort = srcPort;
- this.dstPort = dstPort;
+ this.srcPort = srcPort;
+ this.dstPort = dstPort;
}
/**
@@ -33,7 +33,9 @@
* @return the data path source port.
*/
@JsonProperty("srcPort")
- public SwitchPort srcPort() { return srcPort; }
+ public SwitchPort srcPort() {
+ return srcPort;
+ }
/**
* Set the data path source port.
@@ -42,7 +44,7 @@
*/
@JsonProperty("srcPort")
public void setSrcPort(SwitchPort srcPort) {
- this.srcPort = srcPort;
+ this.srcPort = srcPort;
}
/**
@@ -51,7 +53,9 @@
* @return the data path destination port.
*/
@JsonProperty("dstPort")
- public SwitchPort dstPort() { return dstPort; }
+ public SwitchPort dstPort() {
+ return dstPort;
+ }
/**
* Set the data path destination port.
@@ -60,12 +64,12 @@
*/
@JsonProperty("dstPort")
public void setDstPort(SwitchPort dstPort) {
- this.dstPort = dstPort;
+ this.dstPort = dstPort;
}
/**
* Convert the data path endpoints to a string.
- *
+ * <p/>
* The string has the following form:
* [src=01:01:01:01:01:01:01:01/1111 dst=02:02:02:02:02:02:02:02/2222]
*
@@ -73,8 +77,8 @@
*/
@Override
public String toString() {
- String ret = "[src=" + this.srcPort.toString() +
- " dst=" + this.dstPort.toString() + "]";
- return ret;
+ String ret = "[src=" + this.srcPort.toString() +
+ " dst=" + this.dstPort.toString() + "]";
+ return ret;
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/Dpid.java b/src/main/java/net/onrc/onos/core/util/Dpid.java
index dcc3a7c..80ebc15 100644
--- a/src/main/java/net/onrc/onos/core/util/Dpid.java
+++ b/src/main/java/net/onrc/onos/core/util/Dpid.java
@@ -10,8 +10,8 @@
/**
* The class representing a network switch DPID.
*/
-@JsonDeserialize(using=DpidDeserializer.class)
-@JsonSerialize(using=DpidSerializer.class)
+@JsonDeserialize(using = DpidDeserializer.class)
+@JsonSerialize(using = DpidSerializer.class)
public class Dpid {
static public final long UNKNOWN = 0;
@@ -21,7 +21,7 @@
* Default constructor.
*/
public Dpid() {
- this.value = Dpid.UNKNOWN;
+ this.value = Dpid.UNKNOWN;
}
/**
@@ -30,7 +30,7 @@
* @param value the value to use.
*/
public Dpid(long value) {
- this.value = value;
+ this.value = value;
}
/**
@@ -39,7 +39,7 @@
* @param value the value to use.
*/
public Dpid(String value) {
- this.value = HexString.toLong(value);
+ this.value = HexString.toLong(value);
}
/**
@@ -47,7 +47,9 @@
*
* @return the value of the DPID.
*/
- public long value() { return value; }
+ public long value() {
+ return value;
+ }
/**
* Set the value of the DPID.
@@ -55,7 +57,7 @@
* @param value the value to set.
*/
public void setValue(long value) {
- this.value = value;
+ this.value = value;
}
/**
@@ -65,24 +67,24 @@
*/
@Override
public String toString() {
- return HexString.toHexString(this.value);
+ return HexString.toHexString(this.value);
}
@Override
public boolean equals(Object other) {
- if (!(other instanceof Dpid)) {
- return false;
- }
+ if (!(other instanceof Dpid)) {
+ return false;
+ }
- Dpid otherDpid = (Dpid) other;
+ Dpid otherDpid = (Dpid) other;
- return value == otherDpid.value;
+ return value == otherDpid.value;
}
@Override
public int hashCode() {
- int hash = 17;
- hash += 31 * hash + (int)(value ^ value >>> 32);
- return hash;
+ int hash = 17;
+ hash += 31 * hash + (int) (value ^ value >>> 32);
+ return hash;
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/EventEntry.java b/src/main/java/net/onrc/onos/core/util/EventEntry.java
index fe4c3ac..e1abcaf 100644
--- a/src/main/java/net/onrc/onos/core/util/EventEntry.java
+++ b/src/main/java/net/onrc/onos/core/util/EventEntry.java
@@ -8,12 +8,12 @@
* The event types.
*/
public enum Type {
- ENTRY_ADD, // Add or update an entry
- ENTRY_REMOVE // Remove an entry
+ ENTRY_ADD, // Add or update an entry
+ ENTRY_REMOVE // Remove an entry
}
- private Type eventType; // The event type
- private T eventData; // The relevant event data entry
+ private Type eventType; // The event type
+ private T eventData; // The relevant event data entry
/**
* Constructor for a given event type and event-related data entry.
@@ -22,8 +22,8 @@
* @param eventData the event data entry.
*/
public EventEntry(EventEntry.Type eventType, T eventData) {
- this.eventType = eventType;
- this.eventData = eventData;
+ this.eventType = eventType;
+ this.eventData = eventData;
}
/**
@@ -32,7 +32,7 @@
* @return true if the event type is ENTRY_ADD, otherwise false.
*/
public boolean isAdd() {
- return (this.eventType == Type.ENTRY_ADD);
+ return (this.eventType == Type.ENTRY_ADD);
}
/**
@@ -41,7 +41,7 @@
* @return true if the event type is ENTRY_REMOVE, otherwise false.
*/
public boolean isRemove() {
- return (this.eventType == Type.ENTRY_REMOVE);
+ return (this.eventType == Type.ENTRY_REMOVE);
}
/**
@@ -50,7 +50,7 @@
* @return the event type.
*/
public EventEntry.Type eventType() {
- return this.eventType;
+ return this.eventType;
}
/**
@@ -59,6 +59,6 @@
* @return the event-related data entry.
*/
public T eventData() {
- return this.eventData;
+ return this.eventData;
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowEntry.java b/src/main/java/net/onrc/onos/core/util/FlowEntry.java
index fb5e3a3..0204590 100644
--- a/src/main/java/net/onrc/onos/core/util/FlowEntry.java
+++ b/src/main/java/net/onrc/onos/core/util/FlowEntry.java
@@ -6,25 +6,25 @@
/**
* The class representing the Flow Entry.
- *
+ * <p/>
* NOTE: The specification is incomplete. E.g., the entry needs to
* support multiple in-ports and multiple out-ports.
*/
public class FlowEntry {
- private FlowId flowId; // FlowID of the Flow Entry
- private FlowEntryId flowEntryId; // The Flow Entry ID
- private int idleTimeout; // The Flow idle timeout
- private int hardTimeout; // The Flow hard timeout
- private int priority; // The Flow priority
- private FlowEntryMatch flowEntryMatch; // The Flow Entry Match
- private FlowEntryActions flowEntryActions; // The Flow Entry Actions
- private Dpid dpid; // The Switch DPID
- private Port inPort; // The Switch incoming port. Used only
- // when the entry is used to return
- // Shortest Path computation.
- private Port outPort; // The Switch outgoing port. Used only
- // when the entry is used to return
- // Shortest Path computation.
+ private FlowId flowId; // FlowID of the Flow Entry
+ private FlowEntryId flowEntryId; // The Flow Entry ID
+ private int idleTimeout; // The Flow idle timeout
+ private int hardTimeout; // The Flow hard timeout
+ private int priority; // The Flow priority
+ private FlowEntryMatch flowEntryMatch; // The Flow Entry Match
+ private FlowEntryActions flowEntryActions; // The Flow Entry Actions
+ private Dpid dpid; // The Switch DPID
+ private Port inPort; // The Switch incoming port. Used only
+ // when the entry is used to return
+ // Shortest Path computation.
+ private Port outPort; // The Switch outgoing port. Used only
+ // when the entry is used to return
+ // Shortest Path computation.
private FlowEntryUserState flowEntryUserState; // The Flow Entry User state
private FlowEntrySwitchState flowEntrySwitchState; // The Flow Entry Switch state
// The Flow Entry Error state (if FlowEntrySwitchState is FE_SWITCH_FAILED)
@@ -34,88 +34,88 @@
* Default constructor.
*/
public FlowEntry() {
- // TODO: Test code
- /*
- MACAddress mac = MACAddress.valueOf("01:02:03:04:05:06");
- IPv4 ipv4 = new IPv4("1.2.3.4");
- IPv4Net ipv4net = new IPv4Net("5.6.7.0/24");
+ // TODO: Test code
+ /*
+ MACAddress mac = MACAddress.valueOf("01:02:03:04:05:06");
+ IPv4 ipv4 = new IPv4("1.2.3.4");
+ IPv4Net ipv4net = new IPv4Net("5.6.7.0/24");
- flowEntryMatch = new FlowEntryMatch();
- flowEntryMatch.enableInPort(new Port((short)10));
- flowEntryMatch.enableSrcMac(mac);
- flowEntryMatch.enableDstMac(mac);
- flowEntryMatch.enableVlanId((short)20);
- flowEntryMatch.enableVlanPriority((byte)30);
- flowEntryMatch.enableEthernetFrameType((short)40);
- flowEntryMatch.enableIpToS((byte)50);
- flowEntryMatch.enableIpProto((byte)60);
- flowEntryMatch.enableSrcIPv4Net(ipv4net);
- flowEntryMatch.enableDstIPv4Net(ipv4net);
- flowEntryMatch.enableSrcTcpUdpPort((short)70);
- flowEntryMatch.enableDstTcpUdpPort((short)80);
+ flowEntryMatch = new FlowEntryMatch();
+ flowEntryMatch.enableInPort(new Port((short)10));
+ flowEntryMatch.enableSrcMac(mac);
+ flowEntryMatch.enableDstMac(mac);
+ flowEntryMatch.enableVlanId((short)20);
+ flowEntryMatch.enableVlanPriority((byte)30);
+ flowEntryMatch.enableEthernetFrameType((short)40);
+ flowEntryMatch.enableIpToS((byte)50);
+ flowEntryMatch.enableIpProto((byte)60);
+ flowEntryMatch.enableSrcIPv4Net(ipv4net);
+ flowEntryMatch.enableDstIPv4Net(ipv4net);
+ flowEntryMatch.enableSrcTcpUdpPort((short)70);
+ flowEntryMatch.enableDstTcpUdpPort((short)80);
- FlowEntryAction action = null;
- FlowEntryActions actions = new FlowEntryActions();
+ FlowEntryAction action = null;
+ FlowEntryActions actions = new FlowEntryActions();
- action = new FlowEntryAction();
- action.setActionOutput(new Port((short)12));
- actions.addAction(action);
+ action = new FlowEntryAction();
+ action.setActionOutput(new Port((short)12));
+ actions.addAction(action);
- action = new FlowEntryAction();
- action.setActionOutputToController((short)13);
- actions.addAction(action);
+ action = new FlowEntryAction();
+ action.setActionOutputToController((short)13);
+ actions.addAction(action);
- action = new FlowEntryAction();
- action.setActionSetVlanId((short)14);
- actions.addAction(action);
+ action = new FlowEntryAction();
+ action.setActionSetVlanId((short)14);
+ actions.addAction(action);
- action = new FlowEntryAction();
- action.setActionSetVlanPriority((byte)15);
- actions.addAction(action);
+ action = new FlowEntryAction();
+ action.setActionSetVlanPriority((byte)15);
+ actions.addAction(action);
- action = new FlowEntryAction();
- action.setActionStripVlan(true);
- actions.addAction(action);
+ action = new FlowEntryAction();
+ action.setActionStripVlan(true);
+ actions.addAction(action);
- action = new FlowEntryAction();
- action.setActionSetEthernetSrcAddr(mac);
- actions.addAction(action);
+ action = new FlowEntryAction();
+ action.setActionSetEthernetSrcAddr(mac);
+ actions.addAction(action);
- action = new FlowEntryAction();
- action.setActionSetEthernetDstAddr(mac);
- actions.addAction(action);
+ action = new FlowEntryAction();
+ action.setActionSetEthernetDstAddr(mac);
+ actions.addAction(action);
- action = new FlowEntryAction();
- action.setActionSetIPv4SrcAddr(ipv4);
- actions.addAction(action);
+ action = new FlowEntryAction();
+ action.setActionSetIPv4SrcAddr(ipv4);
+ actions.addAction(action);
- action = new FlowEntryAction();
- action.setActionSetIPv4DstAddr(ipv4);
- actions.addAction(action);
+ action = new FlowEntryAction();
+ action.setActionSetIPv4DstAddr(ipv4);
+ actions.addAction(action);
- action = new FlowEntryAction();
- action.setActionSetIpToS((byte)16);
- actions.addAction(action);
+ action = new FlowEntryAction();
+ action.setActionSetIpToS((byte)16);
+ actions.addAction(action);
- action = new FlowEntryAction();
- action.setActionSetTcpUdpSrcPort((short)17);
- actions.addAction(action);
+ action = new FlowEntryAction();
+ action.setActionSetTcpUdpSrcPort((short)17);
+ actions.addAction(action);
- action = new FlowEntryAction();
- action.setActionSetTcpUdpDstPort((short)18);
- actions.addAction(action);
+ action = new FlowEntryAction();
+ action.setActionSetTcpUdpDstPort((short)18);
+ actions.addAction(action);
- action = new FlowEntryAction();
- action.setActionEnqueue(new Port((short)19), 20);
- actions.addAction(action);
+ action = new FlowEntryAction();
+ action.setActionEnqueue(new Port((short)19), 20);
+ actions.addAction(action);
- setFlowEntryActions(actions);
- */
+ setFlowEntryActions(actions);
+ */
- priority = FlowPath.PRIORITY_DEFAULT;
- flowEntryActions = new FlowEntryActions();
- flowEntryUserState = FlowEntryUserState.FE_USER_UNKNOWN;
- flowEntrySwitchState = FlowEntrySwitchState.FE_SWITCH_UNKNOWN;
+ priority = FlowPath.PRIORITY_DEFAULT;
+ flowEntryActions = new FlowEntryActions();
+ flowEntryUserState = FlowEntryUserState.FE_USER_UNKNOWN;
+ flowEntrySwitchState = FlowEntrySwitchState.FE_SWITCH_UNKNOWN;
}
/**
@@ -124,7 +124,9 @@
* @return the Flow ID.
*/
@JsonIgnore
- public FlowId flowId() { return flowId; }
+ public FlowId flowId() {
+ return flowId;
+ }
/**
* Set the Flow ID.
@@ -132,7 +134,7 @@
* @param flowId the Flow ID to set.
*/
public void setFlowId(FlowId flowId) {
- this.flowId = flowId;
+ this.flowId = flowId;
}
/**
@@ -142,9 +144,9 @@
*/
@JsonIgnore
public boolean isValidFlowId() {
- if (this.flowId == null)
- return false;
- return (this.flowId.isValid());
+ if (this.flowId == null)
+ return false;
+ return (this.flowId.isValid());
}
/**
@@ -153,7 +155,9 @@
* @return the Flow Entry ID.
*/
@JsonProperty("flowEntryId")
- public FlowEntryId flowEntryId() { return flowEntryId; }
+ public FlowEntryId flowEntryId() {
+ return flowEntryId;
+ }
/**
* Set the Flow Entry ID.
@@ -162,7 +166,7 @@
*/
@JsonProperty("flowEntryId")
public void setFlowEntryId(FlowEntryId flowEntryId) {
- this.flowEntryId = flowEntryId;
+ this.flowEntryId = flowEntryId;
}
/**
@@ -172,25 +176,27 @@
*/
@JsonIgnore
public boolean isValidFlowEntryId() {
- if (this.flowEntryId == null)
- return false;
- return (this.flowEntryId.isValid());
+ if (this.flowEntryId == null)
+ return false;
+ return (this.flowEntryId.isValid());
}
/**
* Get the flow idle timeout in seconds.
- *
+ * <p/>
* It should be an unsigned integer in the interval [0, 65535].
* If zero, the timeout is not set.
*
* @return the flow idle timeout.
*/
@JsonProperty("idleTimeout")
- public int idleTimeout() { return idleTimeout; }
+ public int idleTimeout() {
+ return idleTimeout;
+ }
/**
* Set the flow idle timeout in seconds.
- *
+ * <p/>
* It should be an unsigned integer in the interval [0, 65535].
* If zero, the timeout is not set.
*
@@ -198,23 +204,25 @@
*/
@JsonProperty("idleTimeout")
public void setIdleTimeout(int idleTimeout) {
- this.idleTimeout = 0xffff & idleTimeout;
+ this.idleTimeout = 0xffff & idleTimeout;
}
/**
* Get the flow hard timeout in seconds.
- *
+ * <p/>
* It should be an unsigned integer in the interval [0, 65535].
* If zero, the timeout is not set.
*
* @return the flow hard timeout.
*/
@JsonProperty("hardTimeout")
- public int hardTimeout() { return hardTimeout; }
+ public int hardTimeout() {
+ return hardTimeout;
+ }
/**
* Set the flow hard timeout in seconds.
- *
+ * <p/>
* It should be an unsigned integer in the interval [0, 65535].
* If zero, the timeout is not set.
*
@@ -222,29 +230,31 @@
*/
@JsonProperty("hardTimeout")
public void setHardTimeout(int hardTimeout) {
- this.hardTimeout = 0xffff & hardTimeout;
+ this.hardTimeout = 0xffff & hardTimeout;
}
/**
* Get the flow priority.
- *
+ * <p/>
* It should be an unsigned integer in the interval [0, 65535].
*
* @return the flow priority.
*/
@JsonProperty("priority")
- public int priority() { return priority; }
+ public int priority() {
+ return priority;
+ }
/**
* Set the flow priority.
- *
+ * <p/>
* It should be an unsigned integer in the interval [0, 65535].
*
* @param priority the flow priority to set.
*/
@JsonProperty("priority")
public void setPriority(int priority) {
- this.priority = 0xffff & priority;
+ this.priority = 0xffff & priority;
}
/**
@@ -253,7 +263,9 @@
* @return the Flow Entry Match.
*/
@JsonProperty("flowEntryMatch")
- public FlowEntryMatch flowEntryMatch() { return flowEntryMatch; }
+ public FlowEntryMatch flowEntryMatch() {
+ return flowEntryMatch;
+ }
/**
* Set the Flow Entry Match.
@@ -262,7 +274,7 @@
*/
@JsonProperty("flowEntryMatch")
public void setFlowEntryMatch(FlowEntryMatch flowEntryMatch) {
- this.flowEntryMatch = flowEntryMatch;
+ this.flowEntryMatch = flowEntryMatch;
}
/**
@@ -272,7 +284,7 @@
*/
@JsonProperty("flowEntryActions")
public FlowEntryActions flowEntryActions() {
- return flowEntryActions;
+ return flowEntryActions;
}
/**
@@ -282,7 +294,7 @@
*/
@JsonProperty("flowEntryActions")
public void setFlowEntryActions(FlowEntryActions flowEntryActions) {
- this.flowEntryActions = flowEntryActions;
+ this.flowEntryActions = flowEntryActions;
}
/**
@@ -291,7 +303,9 @@
* @return the Switch DPID.
*/
@JsonProperty("dpid")
- public Dpid dpid() { return dpid; }
+ public Dpid dpid() {
+ return dpid;
+ }
/**
* Set the Switch DPID.
@@ -300,51 +314,55 @@
*/
@JsonProperty("dpid")
public void setDpid(Dpid dpid) {
- this.dpid = dpid;
+ this.dpid = dpid;
}
/**
* Get the Switch incoming port.
- *
+ * <p/>
* Used only when the entry is used to return Shortest Path computation.
*
* @return the Switch incoming port.
*/
@JsonProperty("inPort")
- public Port inPort() { return inPort; }
+ public Port inPort() {
+ return inPort;
+ }
/**
* Set the Switch incoming port.
- *
+ * <p/>
* Used only when the entry is used to return Shortest Path computation.
*
* @param inPort the Switch incoming port to set.
*/
@JsonProperty("inPort")
public void setInPort(Port inPort) {
- this.inPort = inPort;
+ this.inPort = inPort;
}
/**
* Get the Switch outgoing port.
- *
+ * <p/>
* Used only when the entry is used to return Shortest Path computation.
*
* @return the Switch outgoing port.
*/
@JsonProperty("outPort")
- public Port outPort() { return outPort; }
+ public Port outPort() {
+ return outPort;
+ }
/**
* Set the Switch outgoing port.
- *
+ * <p/>
* Used only when the entry is used to return Shortest Path computation.
*
* @param outPort the Switch outgoing port to set.
*/
@JsonProperty("outPort")
public void setOutPort(Port outPort) {
- this.outPort = outPort;
+ this.outPort = outPort;
}
/**
@@ -354,7 +372,7 @@
*/
@JsonProperty("flowEntryUserState")
public FlowEntryUserState flowEntryUserState() {
- return flowEntryUserState;
+ return flowEntryUserState;
}
/**
@@ -364,12 +382,12 @@
*/
@JsonProperty("flowEntryUserState")
public void setFlowEntryUserState(FlowEntryUserState flowEntryUserState) {
- this.flowEntryUserState = flowEntryUserState;
+ this.flowEntryUserState = flowEntryUserState;
}
/**
* Get the Flow Entry Switch state.
- *
+ * <p/>
* The Flow Entry Error state is used if FlowEntrySwitchState is
* FE_SWITCH_FAILED.
*
@@ -377,12 +395,12 @@
*/
@JsonProperty("flowEntrySwitchState")
public FlowEntrySwitchState flowEntrySwitchState() {
- return flowEntrySwitchState;
+ return flowEntrySwitchState;
}
/**
* Set the Flow Entry Switch state.
- *
+ * <p/>
* The Flow Entry Error state is used if FlowEntrySwitchState is
* FE_SWITCH_FAILED.
*
@@ -390,7 +408,7 @@
*/
@JsonProperty("flowEntrySwitchState")
public void setFlowEntrySwitchState(FlowEntrySwitchState flowEntrySwitchState) {
- this.flowEntrySwitchState = flowEntrySwitchState;
+ this.flowEntrySwitchState = flowEntrySwitchState;
}
/**
@@ -400,7 +418,7 @@
*/
@JsonProperty("flowEntryErrorState")
public FlowEntryErrorState flowEntryErrorState() {
- return flowEntryErrorState;
+ return flowEntryErrorState;
}
/**
@@ -410,53 +428,54 @@
*/
@JsonProperty("flowEntryErrorState")
public void setFlowEntryErrorState(FlowEntryErrorState flowEntryErrorState) {
- this.flowEntryErrorState = flowEntryErrorState;
+ this.flowEntryErrorState = flowEntryErrorState;
}
/**
* Convert the flow entry to a string.
- *
+ * <p/>
* The string has the following form:
- * [flowEntryId=XXX idleTimeout=XXX hardTimeout=XXX priority=XXX
- * flowEntryMatch=XXX flowEntryActions=XXX dpid=XXX
- * inPort=XXX outPort=XXX flowEntryUserState=XXX flowEntrySwitchState=XXX
- * flowEntryErrorState=XXX]
+ * [flowEntryId=XXX idleTimeout=XXX hardTimeout=XXX priority=XXX
+ * flowEntryMatch=XXX flowEntryActions=XXX dpid=XXX
+ * inPort=XXX outPort=XXX flowEntryUserState=XXX flowEntrySwitchState=XXX
+ * flowEntryErrorState=XXX]
+ *
* @return the flow entry as a string.
*/
@Override
public String toString() {
- StringBuilder ret = new StringBuilder();
- if ( flowEntryId != null ) {
- ret.append("[flowEntryId=" + this.flowEntryId.toString());
- } else {
- ret.append("[");
- }
- if ( flowId != null ) {
- ret.append(" flowId=" + this.flowId.toString());
- }
- ret.append(" idleTimeout=" + this.idleTimeout);
- ret.append(" hardTimeout=" + this.hardTimeout);
- ret.append(" priority=" + this.priority);
- if ( flowEntryMatch != null ) {
- ret.append(" flowEntryMatch=" + this.flowEntryMatch.toString());
- }
- ret.append(" flowEntryActions=" + this.flowEntryActions.toString() );
- if ( dpid != null ) {
- ret.append(" dpid=" + this.dpid.toString());
- }
- if ( inPort != null ) {
- ret.append(" inPort=" + this.inPort.toString());
- }
- if ( outPort != null ) {
- ret.append(" outPort=" + this.outPort.toString());
- }
- ret.append(" flowEntryUserState=" + this.flowEntryUserState);
- ret.append(" flowEntrySwitchState=" + this.flowEntrySwitchState);
- if ( flowEntryErrorState != null ) {
- ret.append(" flowEntryErrorState=" + this.flowEntryErrorState.toString());
- }
- ret.append("]");
+ StringBuilder ret = new StringBuilder();
+ if (flowEntryId != null) {
+ ret.append("[flowEntryId=" + this.flowEntryId.toString());
+ } else {
+ ret.append("[");
+ }
+ if (flowId != null) {
+ ret.append(" flowId=" + this.flowId.toString());
+ }
+ ret.append(" idleTimeout=" + this.idleTimeout);
+ ret.append(" hardTimeout=" + this.hardTimeout);
+ ret.append(" priority=" + this.priority);
+ if (flowEntryMatch != null) {
+ ret.append(" flowEntryMatch=" + this.flowEntryMatch.toString());
+ }
+ ret.append(" flowEntryActions=" + this.flowEntryActions.toString());
+ if (dpid != null) {
+ ret.append(" dpid=" + this.dpid.toString());
+ }
+ if (inPort != null) {
+ ret.append(" inPort=" + this.inPort.toString());
+ }
+ if (outPort != null) {
+ ret.append(" outPort=" + this.outPort.toString());
+ }
+ ret.append(" flowEntryUserState=" + this.flowEntryUserState);
+ ret.append(" flowEntrySwitchState=" + this.flowEntrySwitchState);
+ if (flowEntryErrorState != null) {
+ ret.append(" flowEntryErrorState=" + this.flowEntryErrorState.toString());
+ }
+ ret.append("]");
- return ret.toString();
+ return ret.toString();
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowEntryAction.java b/src/main/java/net/onrc/onos/core/util/FlowEntryAction.java
index da86ed3..f619fea 100644
--- a/src/main/java/net/onrc/onos/core/util/FlowEntryAction.java
+++ b/src/main/java/net/onrc/onos/core/util/FlowEntryAction.java
@@ -6,7 +6,7 @@
/**
* The class representing a single Flow Entry action.
- *
+ * <p/>
* A Flow Entry action that needs to be applied to each packet.
* Note that it contains only a single action. Multiple actions are
* listed in a list inside @ref FlowEntryActions.
@@ -14,482 +14,484 @@
public class FlowEntryAction {
/**
* Special action values.
- *
+ * <p/>
* Those values are taken as-is from the OpenFlow-v1.0.0 specification
* (pp 21-22).
*/
public enum ActionValues {
- ACTION_OUTPUT ((short)0x0), // Output to switch port
- ACTION_SET_VLAN_VID ((short)0x1), // Set the 802.1q VLAN id
- ACTION_SET_VLAN_PCP ((short)0x2), // Set the 802.1q priority
- ACTION_STRIP_VLAN ((short)0x3), // Strip the 802.1q header
- ACTION_SET_DL_SRC ((short)0x4), // Ethernet source address
- ACTION_SET_DL_DST ((short)0x5), // Ethernet destination address
- ACTION_SET_NW_SRC ((short)0x6), // IP source address
- ACTION_SET_NW_DST ((short)0x7), // IP destination address
- ACTION_SET_NW_TOS ((short)0x8), // IP ToS (DSCP field, 6 bits)
- ACTION_SET_TP_SRC ((short)0x9), // TCP/UDP source port
- ACTION_SET_TP_DST ((short)0xa), // TCP/UDP destination port
- ACTION_ENQUEUE ((short)0xb), // Output to queue on port
- ACTION_VENDOR ((short)0xffff); // Vendor-specific
+ ACTION_OUTPUT((short) 0x0), // Output to switch port
+ ACTION_SET_VLAN_VID((short) 0x1), // Set the 802.1q VLAN id
+ ACTION_SET_VLAN_PCP((short) 0x2), // Set the 802.1q priority
+ ACTION_STRIP_VLAN((short) 0x3), // Strip the 802.1q header
+ ACTION_SET_DL_SRC((short) 0x4), // Ethernet source address
+ ACTION_SET_DL_DST((short) 0x5), // Ethernet destination address
+ ACTION_SET_NW_SRC((short) 0x6), // IP source address
+ ACTION_SET_NW_DST((short) 0x7), // IP destination address
+ ACTION_SET_NW_TOS((short) 0x8), // IP ToS (DSCP field, 6 bits)
+ ACTION_SET_TP_SRC((short) 0x9), // TCP/UDP source port
+ ACTION_SET_TP_DST((short) 0xa), // TCP/UDP destination port
+ ACTION_ENQUEUE((short) 0xb), // Output to queue on port
+ ACTION_VENDOR((short) 0xffff); // Vendor-specific
- private final short value; // The value
+ private final short value; // The value
- /**
- * Constructor for a given value.
- *
- * @param value the value to use for the initialization.
- */
- private ActionValues(short value) {
- this.value = value;
- }
+ /**
+ * Constructor for a given value.
+ *
+ * @param value the value to use for the initialization.
+ */
+ private ActionValues(short value) {
+ this.value = value;
+ }
- /**
- * Get the value.
- *
- * @return the value.
- */
- public short getValue() { return value; }
+ /**
+ * Get the value.
+ *
+ * @return the value.
+ */
+ public short getValue() {
+ return value;
+ }
}
/**
* Action structure for ACTION_OUTPUT: Output to switch port.
*/
public static class ActionOutput {
- private Port port; // Output port
- private short maxLen; // Max. length (in bytes) to send to controller
- // if the port is set to PORT_CONTROLLER
+ private Port port; // Output port
+ private short maxLen; // Max. length (in bytes) to send to controller
+ // if the port is set to PORT_CONTROLLER
- /**
- * Default constructor.
- */
- public ActionOutput() {
- this.port = null;
- this.maxLen = 0;
- }
+ /**
+ * Default constructor.
+ */
+ public ActionOutput() {
+ this.port = null;
+ this.maxLen = 0;
+ }
- /**
- * Copy constructor.
- *
- * @param other the object to copy from.
- */
- public ActionOutput(ActionOutput other) {
- if (other.port != null)
- this.port = new Port(other.port);
- this.maxLen = other.maxLen;
- }
+ /**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public ActionOutput(ActionOutput other) {
+ if (other.port != null)
+ this.port = new Port(other.port);
+ this.maxLen = other.maxLen;
+ }
- /**
- * Constructor from a string.
- *
- * The string has the following form:
- * [port=XXX maxLen=XXX]
- *
- * @param actionStr the action as a string.
- */
- public ActionOutput(String actionStr) {
- this.fromString(actionStr);
- }
+ /**
+ * Constructor from a string.
+ * <p/>
+ * The string has the following form:
+ * [port=XXX maxLen=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public ActionOutput(String actionStr) {
+ this.fromString(actionStr);
+ }
- /**
- * Constructor for a given output port and maximum length.
- *
- * @param port the output port to set.
- * @param maxLen the maximum length (in bytes) to send to controller
- * if the port is set to PORT_CONTROLLER.
- */
- public ActionOutput(Port port, short maxLen) {
- this.port = port;
- this.maxLen = maxLen;
- }
+ /**
+ * Constructor for a given output port and maximum length.
+ *
+ * @param port the output port to set.
+ * @param maxLen the maximum length (in bytes) to send to controller
+ * if the port is set to PORT_CONTROLLER.
+ */
+ public ActionOutput(Port port, short maxLen) {
+ this.port = port;
+ this.maxLen = maxLen;
+ }
- /**
- * Constructor for a given output port.
- *
- * @param port the output port to set.
- */
- public ActionOutput(Port port) {
- this.port = port;
- this.maxLen = 0;
- }
+ /**
+ * Constructor for a given output port.
+ *
+ * @param port the output port to set.
+ */
+ public ActionOutput(Port port) {
+ this.port = port;
+ this.maxLen = 0;
+ }
- /**
- * Get the output port.
- *
- * @return the output port.
- */
- @JsonProperty("port")
- public Port port() {
- return this.port;
- }
+ /**
+ * Get the output port.
+ *
+ * @return the output port.
+ */
+ @JsonProperty("port")
+ public Port port() {
+ return this.port;
+ }
- /**
- * Get the maximum length (in bytes) to send to controller if the
- * port is set to PORT_CONTROLLER.
- *
- * @return the maximum length (in bytes) to send to controller if the
- * port is set to PORT_CONTROLLER.
- */
- @JsonProperty("maxLen")
- public short maxLen() {
- return this.maxLen;
- }
+ /**
+ * Get the maximum length (in bytes) to send to controller if the
+ * port is set to PORT_CONTROLLER.
+ *
+ * @return the maximum length (in bytes) to send to controller if the
+ * port is set to PORT_CONTROLLER.
+ */
+ @JsonProperty("maxLen")
+ public short maxLen() {
+ return this.maxLen;
+ }
- /**
- * Convert the action to a string.
- *
- * The string has the following form:
- * [port=XXX maxLen=XXX]
- *
- * @return the action as a string.
- */
- @Override
- public String toString() {
- String ret = "[";
- ret += "port=" + port.toString();
- ret += " maxLen=" + maxLen;
- ret += "]";
+ /**
+ * Convert the action to a string.
+ * <p/>
+ * The string has the following form:
+ * [port=XXX maxLen=XXX]
+ *
+ * @return the action as a string.
+ */
+ @Override
+ public String toString() {
+ String ret = "[";
+ ret += "port=" + port.toString();
+ ret += " maxLen=" + maxLen;
+ ret += "]";
- return ret;
- }
+ return ret;
+ }
- /**
- * Convert a string to an action.
- *
- * The string has the following form:
- * [port=XXX maxLen=XXX]
- *
- * @param actionStr the action as a string.
- */
- public void fromString(String actionStr) {
- String[] parts = actionStr.split(" ");
- String decode = null;
+ /**
+ * Convert a string to an action.
+ * <p/>
+ * The string has the following form:
+ * [port=XXX maxLen=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public void fromString(String actionStr) {
+ String[] parts = actionStr.split(" ");
+ String decode = null;
- // Decode the "port=XXX" part
- if (parts.length > 0)
- decode = parts[0];
- if (decode != null) {
- String[] tokens = decode.split("port=");
- if (tokens.length > 1 && tokens[1] != null) {
- try {
- Short valueShort = Short.valueOf(tokens[1]);
- port = new Port(valueShort);
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
+ // Decode the "port=XXX" part
+ if (parts.length > 0)
+ decode = parts[0];
+ if (decode != null) {
+ String[] tokens = decode.split("port=");
+ if (tokens.length > 1 && tokens[1] != null) {
+ try {
+ Short valueShort = Short.valueOf(tokens[1]);
+ port = new Port(valueShort);
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
- // Decode the "maxLen=XXX" part
- decode = null;
- if (parts.length > 1)
- decode = parts[1];
- if (decode != null) {
- decode = decode.replace("]", "");
- String[] tokens = decode.split("maxLen=");
- if (tokens.length > 1 && tokens[1] != null) {
- try {
- maxLen = Short.valueOf(tokens[1]);
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
+ // Decode the "maxLen=XXX" part
+ decode = null;
+ if (parts.length > 1)
+ decode = parts[1];
+ if (decode != null) {
+ decode = decode.replace("]", "");
+ String[] tokens = decode.split("maxLen=");
+ if (tokens.length > 1 && tokens[1] != null) {
+ try {
+ maxLen = Short.valueOf(tokens[1]);
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
}
/**
* Action structure for ACTION_SET_VLAN_VID: Set the 802.1q VLAN id
*/
public static class ActionSetVlanId {
- private short vlanId; // The VLAN ID to set
+ private short vlanId; // The VLAN ID to set
- /**
- * Default constructor.
- */
- public ActionSetVlanId() {
- this.vlanId = 0;
- }
+ /**
+ * Default constructor.
+ */
+ public ActionSetVlanId() {
+ this.vlanId = 0;
+ }
- /**
- * Copy constructor.
- *
- * @param other the object to copy from.
- */
- public ActionSetVlanId(ActionSetVlanId other) {
- this.vlanId = other.vlanId;
- }
+ /**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public ActionSetVlanId(ActionSetVlanId other) {
+ this.vlanId = other.vlanId;
+ }
- /**
- * Constructor from a string.
- *
- * The string has the following form:
- * [vlanId=XXX]
- *
- * @param actionStr the action as a string.
- */
- public ActionSetVlanId(String actionStr) {
- this.fromString(actionStr);
- }
+ /**
+ * Constructor from a string.
+ * <p/>
+ * The string has the following form:
+ * [vlanId=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public ActionSetVlanId(String actionStr) {
+ this.fromString(actionStr);
+ }
- /**
- * Constructor for a given VLAN ID.
- *
- * @param vlanId the VLAN ID to set.
- */
- public ActionSetVlanId(short vlanId) {
- this.vlanId = vlanId;
- }
+ /**
+ * Constructor for a given VLAN ID.
+ *
+ * @param vlanId the VLAN ID to set.
+ */
+ public ActionSetVlanId(short vlanId) {
+ this.vlanId = vlanId;
+ }
- /**
- * Get the VLAN ID.
- *
- * @return the VLAN ID.
- */
- @JsonProperty("vlanId")
- public short vlanId() {
- return this.vlanId;
- }
+ /**
+ * Get the VLAN ID.
+ *
+ * @return the VLAN ID.
+ */
+ @JsonProperty("vlanId")
+ public short vlanId() {
+ return this.vlanId;
+ }
- /**
- * Convert the action to a string.
- *
- * The string has the following form:
- * [vlanId=XXX]
- *
- * @return the action as a string.
- */
- @Override
- public String toString() {
- String ret = "[";
- ret += "vlanId=" + this.vlanId;
- ret += "]";
+ /**
+ * Convert the action to a string.
+ * <p/>
+ * The string has the following form:
+ * [vlanId=XXX]
+ *
+ * @return the action as a string.
+ */
+ @Override
+ public String toString() {
+ String ret = "[";
+ ret += "vlanId=" + this.vlanId;
+ ret += "]";
- return ret;
- }
+ return ret;
+ }
- /**
- * Convert a string to an action.
- *
- * The string has the following form:
- * [vlanId=XXX]
- *
- * @param actionStr the action as a string.
- */
- public void fromString(String actionStr) {
- String[] parts = actionStr.split("vlanId=");
- String decode = null;
+ /**
+ * Convert a string to an action.
+ * <p/>
+ * The string has the following form:
+ * [vlanId=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public void fromString(String actionStr) {
+ String[] parts = actionStr.split("vlanId=");
+ String decode = null;
- // Decode the value
- if (parts.length > 1)
- decode = parts[1];
- if (decode != null) {
- decode = decode.replace("]", "");
- try {
- vlanId = Short.valueOf(decode);
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException("Invalid action string");
- }
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
+ // Decode the value
+ if (parts.length > 1)
+ decode = parts[1];
+ if (decode != null) {
+ decode = decode.replace("]", "");
+ try {
+ vlanId = Short.valueOf(decode);
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
}
/**
* Action structure for ACTION_SET_VLAN_PCP: Set the 802.1q priority
*/
public static class ActionSetVlanPriority {
- private byte vlanPriority; // The VLAN priority to set
+ private byte vlanPriority; // The VLAN priority to set
- /**
- * Default constructor.
- */
- public ActionSetVlanPriority() {
- this.vlanPriority = 0;
- }
+ /**
+ * Default constructor.
+ */
+ public ActionSetVlanPriority() {
+ this.vlanPriority = 0;
+ }
- /**
- * Copy constructor.
- *
- * @param other the object to copy from.
- */
- public ActionSetVlanPriority(ActionSetVlanPriority other) {
- this.vlanPriority = other.vlanPriority;
- }
+ /**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public ActionSetVlanPriority(ActionSetVlanPriority other) {
+ this.vlanPriority = other.vlanPriority;
+ }
- /**
- * Constructor from a string.
- *
- * The string has the following form:
- * [vlanPriority=XXX]
- *
- * @param actionStr the action as a string.
- */
- public ActionSetVlanPriority(String actionStr) {
- this.fromString(actionStr);
- }
+ /**
+ * Constructor from a string.
+ * <p/>
+ * The string has the following form:
+ * [vlanPriority=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public ActionSetVlanPriority(String actionStr) {
+ this.fromString(actionStr);
+ }
- /**
- * Constructor for a given VLAN priority.
- *
- * @param vlanPriority the VLAN priority to set.
- */
- public ActionSetVlanPriority(byte vlanPriority) {
- this.vlanPriority = vlanPriority;
- }
+ /**
+ * Constructor for a given VLAN priority.
+ *
+ * @param vlanPriority the VLAN priority to set.
+ */
+ public ActionSetVlanPriority(byte vlanPriority) {
+ this.vlanPriority = vlanPriority;
+ }
- /**
- * Get the VLAN priority.
- *
- * @return the VLAN priority.
- */
- @JsonProperty("vlanPriority")
- public byte vlanPriority() {
- return this.vlanPriority;
- }
+ /**
+ * Get the VLAN priority.
+ *
+ * @return the VLAN priority.
+ */
+ @JsonProperty("vlanPriority")
+ public byte vlanPriority() {
+ return this.vlanPriority;
+ }
- /**
- * Convert the action to a string.
- *
- * The string has the following form:
- * [vlanPriority=XXX]
- *
- * @return the action as a string.
- */
- @Override
- public String toString() {
- String ret = "[";
- ret += "vlanPriority=" + this.vlanPriority;
- ret += "]";
+ /**
+ * Convert the action to a string.
+ * <p/>
+ * The string has the following form:
+ * [vlanPriority=XXX]
+ *
+ * @return the action as a string.
+ */
+ @Override
+ public String toString() {
+ String ret = "[";
+ ret += "vlanPriority=" + this.vlanPriority;
+ ret += "]";
- return ret;
- }
+ return ret;
+ }
- /**
- * Convert a string to an action.
- *
- * The string has the following form:
- * [vlanPriority=XXX]
- *
- * @param actionStr the action as a string.
- */
- public void fromString(String actionStr) {
- String[] parts = actionStr.split("vlanPriority=");
- String decode = null;
+ /**
+ * Convert a string to an action.
+ * <p/>
+ * The string has the following form:
+ * [vlanPriority=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public void fromString(String actionStr) {
+ String[] parts = actionStr.split("vlanPriority=");
+ String decode = null;
- // Decode the value
- if (parts.length > 1)
- decode = parts[1];
- if (decode != null) {
- decode = decode.replace("]", "");
- try {
- vlanPriority = Byte.valueOf(decode);
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException("Invalid action string");
- }
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
+ // Decode the value
+ if (parts.length > 1)
+ decode = parts[1];
+ if (decode != null) {
+ decode = decode.replace("]", "");
+ try {
+ vlanPriority = Byte.valueOf(decode);
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
}
/**
* Action structure for ACTION_STRIP_VLAN: Strip the 802.1q header
*/
public static class ActionStripVlan {
- private boolean stripVlan; // If true, strip the VLAN header
+ private boolean stripVlan; // If true, strip the VLAN header
- /**
- * Default constructor.
- */
- public ActionStripVlan() {
- this.stripVlan = false;
- }
+ /**
+ * Default constructor.
+ */
+ public ActionStripVlan() {
+ this.stripVlan = false;
+ }
- /**
- * Copy constructor.
- *
- * @param other the object to copy from.
- */
- public ActionStripVlan(ActionStripVlan other) {
- this.stripVlan = other.stripVlan;
- }
+ /**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public ActionStripVlan(ActionStripVlan other) {
+ this.stripVlan = other.stripVlan;
+ }
- /**
- * Constructor from a string.
- *
- * The string has the following form:
- * [stripVlan=XXX]
- *
- * @param actionStr the action as a string.
- */
- public ActionStripVlan(String actionStr) {
- this.fromString(actionStr);
- }
+ /**
+ * Constructor from a string.
+ * <p/>
+ * The string has the following form:
+ * [stripVlan=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public ActionStripVlan(String actionStr) {
+ this.fromString(actionStr);
+ }
- /**
- * Constructor for a given boolean flag.
- *
- * @param stripVlan if true, strip the VLAN header.
- */
- public ActionStripVlan(boolean stripVlan) {
- this.stripVlan = stripVlan;
- }
+ /**
+ * Constructor for a given boolean flag.
+ *
+ * @param stripVlan if true, strip the VLAN header.
+ */
+ public ActionStripVlan(boolean stripVlan) {
+ this.stripVlan = stripVlan;
+ }
- /**
- * Get the boolean flag whether the VLAN header should be stripped.
- *
- * @return the boolean flag whether the VLAN header should be stripped.
- */
- @JsonProperty("stripVlan")
- public boolean stripVlan() {
- return this.stripVlan;
- }
+ /**
+ * Get the boolean flag whether the VLAN header should be stripped.
+ *
+ * @return the boolean flag whether the VLAN header should be stripped.
+ */
+ @JsonProperty("stripVlan")
+ public boolean stripVlan() {
+ return this.stripVlan;
+ }
- /**
- * Convert the action to a string.
- *
- * The string has the following form:
- * [stripVlan=XXX]
- *
- * @return the action as a string.
- */
- @Override
- public String toString() {
- String ret = "[";
- ret += "stripVlan=" + this.stripVlan;
- ret += "]";
+ /**
+ * Convert the action to a string.
+ * <p/>
+ * The string has the following form:
+ * [stripVlan=XXX]
+ *
+ * @return the action as a string.
+ */
+ @Override
+ public String toString() {
+ String ret = "[";
+ ret += "stripVlan=" + this.stripVlan;
+ ret += "]";
- return ret;
- }
+ return ret;
+ }
- /**
- * Convert a string to an action.
- *
- * The string has the following form:
- * [stripVlan=XXX]
- *
- * @param actionStr the action as a string.
- */
- public void fromString(String actionStr) {
- String[] parts = actionStr.split("stripVlan=");
- String decode = null;
+ /**
+ * Convert a string to an action.
+ * <p/>
+ * The string has the following form:
+ * [stripVlan=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public void fromString(String actionStr) {
+ String[] parts = actionStr.split("stripVlan=");
+ String decode = null;
- // Decode the value
- if (parts.length > 1)
- decode = parts[1];
- if (decode != null) {
- decode = decode.replace("]", "");
- stripVlan = Boolean.valueOf(decode);
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
+ // Decode the value
+ if (parts.length > 1)
+ decode = parts[1];
+ if (decode != null) {
+ decode = decode.replace("]", "");
+ stripVlan = Boolean.valueOf(decode);
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
}
/**
@@ -497,99 +499,99 @@
* Set the Ethernet source/destination address.
*/
public static class ActionSetEthernetAddr {
- private MACAddress addr; // The MAC address to set
+ private MACAddress addr; // The MAC address to set
- /**
- * Default constructor.
- */
- public ActionSetEthernetAddr() {
- this.addr = null;
- }
+ /**
+ * Default constructor.
+ */
+ public ActionSetEthernetAddr() {
+ this.addr = null;
+ }
- /**
- * Copy constructor.
- *
- * @param other the object to copy from.
- */
- public ActionSetEthernetAddr(ActionSetEthernetAddr other) {
- if (other.addr != null)
- this.addr = MACAddress.valueOf(other.addr.toLong());
- }
+ /**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public ActionSetEthernetAddr(ActionSetEthernetAddr other) {
+ if (other.addr != null)
+ this.addr = MACAddress.valueOf(other.addr.toLong());
+ }
- /**
- * Constructor from a string.
- *
- * The string has the following form:
- * [addr=XXX]
- *
- * @param actionStr the action as a string.
- */
- public ActionSetEthernetAddr(String actionStr) {
- this.fromString(actionStr);
- }
+ /**
+ * Constructor from a string.
+ * <p/>
+ * The string has the following form:
+ * [addr=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public ActionSetEthernetAddr(String actionStr) {
+ this.fromString(actionStr);
+ }
- /**
- * Constructor for a given MAC address.
- *
- * @param addr the MAC address to set.
- */
- public ActionSetEthernetAddr(MACAddress addr) {
- this.addr = addr;
- }
+ /**
+ * Constructor for a given MAC address.
+ *
+ * @param addr the MAC address to set.
+ */
+ public ActionSetEthernetAddr(MACAddress addr) {
+ this.addr = addr;
+ }
- /**
- * Get the MAC address.
- *
- * @return the MAC address.
- */
- @JsonProperty("addr")
- public MACAddress addr() {
- return this.addr;
- }
+ /**
+ * Get the MAC address.
+ *
+ * @return the MAC address.
+ */
+ @JsonProperty("addr")
+ public MACAddress addr() {
+ return this.addr;
+ }
- /**
- * Convert the action to a string.
- *
- * The string has the following form:
- * [addr=XXX]
- *
- * @return the action as a string.
- */
- @Override
- public String toString() {
- String ret = "[";
- ret += "addr=" + addr.toString();
- ret += "]";
+ /**
+ * Convert the action to a string.
+ * <p/>
+ * The string has the following form:
+ * [addr=XXX]
+ *
+ * @return the action as a string.
+ */
+ @Override
+ public String toString() {
+ String ret = "[";
+ ret += "addr=" + addr.toString();
+ ret += "]";
- return ret;
- }
+ return ret;
+ }
- /**
- * Convert a string to an action.
- *
- * The string has the following form:
- * [addr=XXX]
- *
- * @param actionStr the action as a string.
- */
- public void fromString(String actionStr) {
- String[] parts = actionStr.split("addr=");
- String decode = null;
+ /**
+ * Convert a string to an action.
+ * <p/>
+ * The string has the following form:
+ * [addr=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public void fromString(String actionStr) {
+ String[] parts = actionStr.split("addr=");
+ String decode = null;
- // Decode the value
- if (parts.length > 1)
- decode = parts[1];
- if (decode != null) {
- decode = decode.replace("]", "");
- try {
- addr = MACAddress.valueOf(decode);
- } catch (IllegalArgumentException e) {
- throw new IllegalArgumentException("Invalid action string");
- }
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
+ // Decode the value
+ if (parts.length > 1)
+ decode = parts[1];
+ if (decode != null) {
+ decode = decode.replace("]", "");
+ try {
+ addr = MACAddress.valueOf(decode);
+ } catch (IllegalArgumentException e) {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
}
/**
@@ -597,99 +599,99 @@
* Set the IPv4 source/destination address.
*/
public static class ActionSetIPv4Addr {
- private IPv4 addr; // The IPv4 address to set
+ private IPv4 addr; // The IPv4 address to set
- /**
- * Default constructor.
- */
- public ActionSetIPv4Addr() {
- this.addr = null;
- }
+ /**
+ * Default constructor.
+ */
+ public ActionSetIPv4Addr() {
+ this.addr = null;
+ }
- /**
- * Copy constructor.
- *
- * @param other the object to copy from.
- */
- public ActionSetIPv4Addr(ActionSetIPv4Addr other) {
- if (other.addr != null)
- this.addr = new IPv4(other.addr);
- }
+ /**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public ActionSetIPv4Addr(ActionSetIPv4Addr other) {
+ if (other.addr != null)
+ this.addr = new IPv4(other.addr);
+ }
- /**
- * Constructor from a string.
- *
- * The string has the following form:
- * [addr=XXX]
- *
- * @param actionStr the action as a string.
- */
- public ActionSetIPv4Addr(String actionStr) {
- this.fromString(actionStr);
- }
+ /**
+ * Constructor from a string.
+ * <p/>
+ * The string has the following form:
+ * [addr=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public ActionSetIPv4Addr(String actionStr) {
+ this.fromString(actionStr);
+ }
- /**
- * Constructor for a given IPv4 address.
- *
- * @param addr the IPv4 address to set.
- */
- public ActionSetIPv4Addr(IPv4 addr) {
- this.addr = addr;
- }
+ /**
+ * Constructor for a given IPv4 address.
+ *
+ * @param addr the IPv4 address to set.
+ */
+ public ActionSetIPv4Addr(IPv4 addr) {
+ this.addr = addr;
+ }
- /**
- * Get the IPv4 address.
- *
- * @return the IPv4 address.
- */
- @JsonProperty("addr")
- public IPv4 addr() {
- return this.addr;
- }
+ /**
+ * Get the IPv4 address.
+ *
+ * @return the IPv4 address.
+ */
+ @JsonProperty("addr")
+ public IPv4 addr() {
+ return this.addr;
+ }
- /**
- * Convert the action to a string.
- *
- * The string has the following form:
- * [addr=XXX]
- *
- * @return the action as a string.
- */
- @Override
- public String toString() {
- String ret = "[";
- ret += "addr=" + addr.toString();
- ret += "]";
+ /**
+ * Convert the action to a string.
+ * <p/>
+ * The string has the following form:
+ * [addr=XXX]
+ *
+ * @return the action as a string.
+ */
+ @Override
+ public String toString() {
+ String ret = "[";
+ ret += "addr=" + addr.toString();
+ ret += "]";
- return ret;
- }
+ return ret;
+ }
- /**
- * Convert a string to an action.
- *
- * The string has the following form:
- * [addr=XXX]
- *
- * @param actionStr the action as a string.
- */
- public void fromString(String actionStr) {
- String[] parts = actionStr.split("addr=");
- String decode = null;
+ /**
+ * Convert a string to an action.
+ * <p/>
+ * The string has the following form:
+ * [addr=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public void fromString(String actionStr) {
+ String[] parts = actionStr.split("addr=");
+ String decode = null;
- // Decode the value
- if (parts.length > 1)
- decode = parts[1];
- if (decode != null) {
- decode = decode.replace("]", "");
- try {
- addr = new IPv4(decode);
- } catch (IllegalArgumentException e) {
- throw new IllegalArgumentException("Invalid action string");
- }
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
+ // Decode the value
+ if (parts.length > 1)
+ decode = parts[1];
+ if (decode != null) {
+ decode = decode.replace("]", "");
+ try {
+ addr = new IPv4(decode);
+ } catch (IllegalArgumentException e) {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
}
/**
@@ -697,98 +699,98 @@
* Set the IP ToS (DSCP field, 6 bits).
*/
public static class ActionSetIpToS {
- private byte ipToS; // The IP ToS to set DSCP field, 6 bits)
+ private byte ipToS; // The IP ToS to set DSCP field, 6 bits)
- /**
- * Default constructor.
- */
- public ActionSetIpToS() {
- this.ipToS = 0;
- }
+ /**
+ * Default constructor.
+ */
+ public ActionSetIpToS() {
+ this.ipToS = 0;
+ }
- /**
- * Copy constructor.
- *
- * @param other the object to copy from.
- */
- public ActionSetIpToS(ActionSetIpToS other) {
- this.ipToS = other.ipToS;
- }
+ /**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public ActionSetIpToS(ActionSetIpToS other) {
+ this.ipToS = other.ipToS;
+ }
- /**
- * Constructor from a string.
- *
- * The string has the following form:
- * [ipToS=XXX]
- *
- * @param actionStr the action as a string.
- */
- public ActionSetIpToS(String actionStr) {
- this.fromString(actionStr);
- }
+ /**
+ * Constructor from a string.
+ * <p/>
+ * The string has the following form:
+ * [ipToS=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public ActionSetIpToS(String actionStr) {
+ this.fromString(actionStr);
+ }
- /**
- * Constructor for a given IP ToS (DSCP field, 6 bits).
- *
- * @param ipToS the IP ToS (DSCP field, 6 bits) to set.
- */
- public ActionSetIpToS(byte ipToS) {
- this.ipToS = ipToS;
- }
+ /**
+ * Constructor for a given IP ToS (DSCP field, 6 bits).
+ *
+ * @param ipToS the IP ToS (DSCP field, 6 bits) to set.
+ */
+ public ActionSetIpToS(byte ipToS) {
+ this.ipToS = ipToS;
+ }
- /**
- * Get the IP ToS (DSCP field, 6 bits).
- *
- * @return the IP ToS (DSCP field, 6 bits).
- */
- @JsonProperty("ipToS")
- public byte ipToS() {
- return this.ipToS;
- }
+ /**
+ * Get the IP ToS (DSCP field, 6 bits).
+ *
+ * @return the IP ToS (DSCP field, 6 bits).
+ */
+ @JsonProperty("ipToS")
+ public byte ipToS() {
+ return this.ipToS;
+ }
- /**
- * Convert the action to a string.
- *
- * The string has the following form:
- * [ipToS=XXX]
- *
- * @return the action as a string.
- */
- @Override
- public String toString() {
- String ret = "[";
- ret += "ipToS=" + ipToS;
- ret += "]";
+ /**
+ * Convert the action to a string.
+ * <p/>
+ * The string has the following form:
+ * [ipToS=XXX]
+ *
+ * @return the action as a string.
+ */
+ @Override
+ public String toString() {
+ String ret = "[";
+ ret += "ipToS=" + ipToS;
+ ret += "]";
- return ret;
- }
+ return ret;
+ }
- /**
- * Convert a string to an action.
- *
- * The string has the following form:
- * [ipToS=XXX]
- *
- * @param actionStr the action as a string.
- */
- public void fromString(String actionStr) {
- String[] parts = actionStr.split("ipToS=");
- String decode = null;
+ /**
+ * Convert a string to an action.
+ * <p/>
+ * The string has the following form:
+ * [ipToS=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public void fromString(String actionStr) {
+ String[] parts = actionStr.split("ipToS=");
+ String decode = null;
- // Decode the value
- if (parts.length > 1)
- decode = parts[1];
- if (decode != null) {
- decode = decode.replace("]", "");
- try {
- ipToS = Byte.valueOf(decode);
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException("Invalid action string");
- }
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
+ // Decode the value
+ if (parts.length > 1)
+ decode = parts[1];
+ if (decode != null) {
+ decode = decode.replace("]", "");
+ try {
+ ipToS = Byte.valueOf(decode);
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
}
/**
@@ -796,239 +798,239 @@
* Set the TCP/UDP source/destination port.
*/
public static class ActionSetTcpUdpPort {
- private short port; // The TCP/UDP port to set
+ private short port; // The TCP/UDP port to set
- /**
- * Default constructor.
- */
- public ActionSetTcpUdpPort() {
- this.port = 0;
- }
+ /**
+ * Default constructor.
+ */
+ public ActionSetTcpUdpPort() {
+ this.port = 0;
+ }
- /**
- * Copy constructor.
- *
- * @param other the object to copy from.
- */
- public ActionSetTcpUdpPort(ActionSetTcpUdpPort other) {
- this.port = other.port;
- }
+ /**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public ActionSetTcpUdpPort(ActionSetTcpUdpPort other) {
+ this.port = other.port;
+ }
- /**
- * Constructor from a string.
- *
- * The string has the following form:
- * [port=XXX]
- *
- * @param actionStr the action as a string.
- */
- public ActionSetTcpUdpPort(String actionStr) {
- this.fromString(actionStr);
- }
+ /**
+ * Constructor from a string.
+ * <p/>
+ * The string has the following form:
+ * [port=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public ActionSetTcpUdpPort(String actionStr) {
+ this.fromString(actionStr);
+ }
- /**
- * Constructor for a given TCP/UDP port.
- *
- * @param port the TCP/UDP port to set.
- */
- public ActionSetTcpUdpPort(short port) {
- this.port = port;
- }
+ /**
+ * Constructor for a given TCP/UDP port.
+ *
+ * @param port the TCP/UDP port to set.
+ */
+ public ActionSetTcpUdpPort(short port) {
+ this.port = port;
+ }
- /**
- * Get the TCP/UDP port.
- *
- * @return the TCP/UDP port.
- */
- @JsonProperty("port")
- public short port() {
- return this.port;
- }
+ /**
+ * Get the TCP/UDP port.
+ *
+ * @return the TCP/UDP port.
+ */
+ @JsonProperty("port")
+ public short port() {
+ return this.port;
+ }
- /**
- * Convert the action to a string.
- *
- * The string has the following form:
- * [port=XXX]
- *
- * @return the action as a string.
- */
- @Override
- public String toString() {
- String ret = "[";
- ret += "port=" + port;
- ret += "]";
+ /**
+ * Convert the action to a string.
+ * <p/>
+ * The string has the following form:
+ * [port=XXX]
+ *
+ * @return the action as a string.
+ */
+ @Override
+ public String toString() {
+ String ret = "[";
+ ret += "port=" + port;
+ ret += "]";
- return ret;
- }
+ return ret;
+ }
- /**
- * Convert a string to an action.
- *
- * The string has the following form:
- * [port=XXX]
- *
- * @param actionStr the action as a string.
- */
- public void fromString(String actionStr) {
- String[] parts = actionStr.split("port=");
- String decode = null;
+ /**
+ * Convert a string to an action.
+ * <p/>
+ * The string has the following form:
+ * [port=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public void fromString(String actionStr) {
+ String[] parts = actionStr.split("port=");
+ String decode = null;
- // Decode the value
- if (parts.length > 1)
- decode = parts[1];
- if (decode != null) {
- decode = decode.replace("]", "");
- try {
- port = Short.valueOf(decode);
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException("Invalid action string");
- }
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
+ // Decode the value
+ if (parts.length > 1)
+ decode = parts[1];
+ if (decode != null) {
+ decode = decode.replace("]", "");
+ try {
+ port = Short.valueOf(decode);
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
}
/**
* Action structure for ACTION_ENQUEUE: Output to queue on port.
*/
public static class ActionEnqueue {
- private Port port; // Port that queue belongs. Should
- // refer to a valid physical port
- // (i.e. < PORT_MAX) or PORT_IN_PORT
- private int queueId; // Where to enqueue the packets
+ private Port port; // Port that queue belongs. Should
+ // refer to a valid physical port
+ // (i.e. < PORT_MAX) or PORT_IN_PORT
+ private int queueId; // Where to enqueue the packets
- /**
- * Default constructor.
- */
- public ActionEnqueue() {
- this.port = null;
- this.queueId = 0;
- }
+ /**
+ * Default constructor.
+ */
+ public ActionEnqueue() {
+ this.port = null;
+ this.queueId = 0;
+ }
- /**
- * Copy constructor.
- *
- * @param other the object to copy from.
- */
- public ActionEnqueue(ActionEnqueue other) {
- if (other.port != null)
- this.port = new Port(other.port);
- this.queueId = other.queueId;
- }
+ /**
+ * Copy constructor.
+ *
+ * @param other the object to copy from.
+ */
+ public ActionEnqueue(ActionEnqueue other) {
+ if (other.port != null)
+ this.port = new Port(other.port);
+ this.queueId = other.queueId;
+ }
- /**
- * Constructor from a string.
- *
- * The string has the following form:
- * [port=XXX queueId=XXX]
- *
- * @param actionStr the action as a string.
- */
- public ActionEnqueue(String actionStr) {
- this.fromString(actionStr);
- }
+ /**
+ * Constructor from a string.
+ * <p/>
+ * The string has the following form:
+ * [port=XXX queueId=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public ActionEnqueue(String actionStr) {
+ this.fromString(actionStr);
+ }
- /**
- * Constructor for a given port and queue ID.
- *
- * @param port the port to set.
- * @param queueId the queue ID on the port.
- */
- public ActionEnqueue(Port port, int queueId) {
- this.port = port;
- this.queueId = queueId;
- }
+ /**
+ * Constructor for a given port and queue ID.
+ *
+ * @param port the port to set.
+ * @param queueId the queue ID on the port.
+ */
+ public ActionEnqueue(Port port, int queueId) {
+ this.port = port;
+ this.queueId = queueId;
+ }
- /**
- * Get the port.
- *
- * @return the port.
- */
- @JsonProperty("port")
- public Port port() {
- return this.port;
- }
+ /**
+ * Get the port.
+ *
+ * @return the port.
+ */
+ @JsonProperty("port")
+ public Port port() {
+ return this.port;
+ }
- /**
- * Get the queue ID.
- *
- * @return the queue ID.
- */
- @JsonProperty("queueId")
- public int queueId() {
- return this.queueId;
- }
+ /**
+ * Get the queue ID.
+ *
+ * @return the queue ID.
+ */
+ @JsonProperty("queueId")
+ public int queueId() {
+ return this.queueId;
+ }
- /**
- * Convert the action to a string.
- *
- * The string has the following form:
- * [port=XXX queueId=XXX]
- *
- * @return the action as a string.
- */
- @Override
- public String toString() {
- String ret = "[";
- ret += "port=" + port.toString();
- ret += " queueId=" + queueId;
- ret += "]";
+ /**
+ * Convert the action to a string.
+ * <p/>
+ * The string has the following form:
+ * [port=XXX queueId=XXX]
+ *
+ * @return the action as a string.
+ */
+ @Override
+ public String toString() {
+ String ret = "[";
+ ret += "port=" + port.toString();
+ ret += " queueId=" + queueId;
+ ret += "]";
- return ret;
- }
+ return ret;
+ }
- /**
- * Convert a string to an action.
- *
- * The string has the following form:
- * [port=XXX queueId=XXX]
- *
- * @param actionStr the action as a string.
- */
- public void fromString(String actionStr) {
- String[] parts = actionStr.split(" ");
- String decode = null;
+ /**
+ * Convert a string to an action.
+ * <p/>
+ * The string has the following form:
+ * [port=XXX queueId=XXX]
+ *
+ * @param actionStr the action as a string.
+ */
+ public void fromString(String actionStr) {
+ String[] parts = actionStr.split(" ");
+ String decode = null;
- // Decode the "port=XXX" part
- if (parts.length > 0)
- decode = parts[0];
- if (decode != null) {
- String[] tokens = decode.split("port=");
- if (tokens.length > 1 && tokens[1] != null) {
- try {
- Short valueShort = Short.valueOf(tokens[1]);
- port = new Port(valueShort);
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
+ // Decode the "port=XXX" part
+ if (parts.length > 0)
+ decode = parts[0];
+ if (decode != null) {
+ String[] tokens = decode.split("port=");
+ if (tokens.length > 1 && tokens[1] != null) {
+ try {
+ Short valueShort = Short.valueOf(tokens[1]);
+ port = new Port(valueShort);
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
- // Decode the "queueId=XXX" part
- decode = null;
- if (parts.length > 1)
- decode = parts[1];
- if (decode != null) {
- decode = decode.replace("]", "");
- String[] tokens = decode.split("queueId=");
- if (tokens.length > 1 && tokens[1] != null) {
- try {
- queueId = Short.valueOf(tokens[1]);
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
+ // Decode the "queueId=XXX" part
+ decode = null;
+ if (parts.length > 1)
+ decode = parts[1];
+ if (decode != null) {
+ decode = decode.replace("]", "");
+ String[] tokens = decode.split("queueId=");
+ if (tokens.length > 1 && tokens[1] != null) {
+ try {
+ queueId = Short.valueOf(tokens[1]);
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ }
}
- private ActionValues actionType; // The action type
+ private ActionValues actionType; // The action type
//
// The actions.
@@ -1051,7 +1053,7 @@
* Default constructor.
*/
public FlowEntryAction() {
- actionType = ActionValues.ACTION_VENDOR; // XXX: Initial value
+ actionType = ActionValues.ACTION_VENDOR; // XXX: Initial value
}
/**
@@ -1060,80 +1062,80 @@
* @param other the object to copy from.
*/
public FlowEntryAction(FlowEntryAction other) {
- this.actionType = other.actionType;
+ this.actionType = other.actionType;
- //
- if (other.actionOutput != null)
- this.actionOutput = new ActionOutput(other.actionOutput);
- else
- this.actionOutput = null;
- //
- if (other.actionSetVlanId != null)
- this.actionSetVlanId = new ActionSetVlanId(other.actionSetVlanId);
- else
- this.actionSetVlanId = null;
- //
- if (other.actionSetVlanPriority != null)
- this.actionSetVlanPriority = new ActionSetVlanPriority(other.actionSetVlanPriority);
- else
- this.actionSetVlanPriority = null;
- //
- if (other.actionStripVlan != null)
- this.actionStripVlan = new ActionStripVlan(other.actionStripVlan);
- else
- this.actionStripVlan = null;
- //
- if (other.actionSetEthernetSrcAddr != null)
- this.actionSetEthernetSrcAddr = new ActionSetEthernetAddr(other.actionSetEthernetSrcAddr);
- else
- this.actionSetEthernetSrcAddr = null;
- //
- if (other.actionSetEthernetDstAddr != null)
- this.actionSetEthernetDstAddr = new ActionSetEthernetAddr(other.actionSetEthernetDstAddr);
- else
- this.actionSetEthernetDstAddr = null;
- //
- if (other.actionSetIPv4SrcAddr != null)
- this.actionSetIPv4SrcAddr = new ActionSetIPv4Addr(other.actionSetIPv4SrcAddr);
- else
- this.actionSetIPv4SrcAddr = null;
- //
- if (other.actionSetIPv4DstAddr != null)
- this.actionSetIPv4DstAddr = new ActionSetIPv4Addr(other.actionSetIPv4DstAddr);
- else
- this.actionSetIPv4DstAddr = null;
- //
- if (other.actionSetIpToS != null)
- this.actionSetIpToS = new ActionSetIpToS(other.actionSetIpToS);
- else
- this.actionSetIpToS = null;
- //
- if (other.actionSetTcpUdpSrcPort != null)
- this.actionSetTcpUdpSrcPort = new ActionSetTcpUdpPort(other.actionSetTcpUdpSrcPort);
- else
- this.actionSetTcpUdpSrcPort = null;
- //
- if (other.actionSetTcpUdpDstPort != null)
- this.actionSetTcpUdpDstPort = new ActionSetTcpUdpPort(other.actionSetTcpUdpDstPort);
- else
- this.actionSetTcpUdpDstPort = null;
- //
- if (other.actionEnqueue != null)
- this.actionEnqueue = new ActionEnqueue(other.actionEnqueue);
- else
- this.actionEnqueue = null;
+ //
+ if (other.actionOutput != null)
+ this.actionOutput = new ActionOutput(other.actionOutput);
+ else
+ this.actionOutput = null;
+ //
+ if (other.actionSetVlanId != null)
+ this.actionSetVlanId = new ActionSetVlanId(other.actionSetVlanId);
+ else
+ this.actionSetVlanId = null;
+ //
+ if (other.actionSetVlanPriority != null)
+ this.actionSetVlanPriority = new ActionSetVlanPriority(other.actionSetVlanPriority);
+ else
+ this.actionSetVlanPriority = null;
+ //
+ if (other.actionStripVlan != null)
+ this.actionStripVlan = new ActionStripVlan(other.actionStripVlan);
+ else
+ this.actionStripVlan = null;
+ //
+ if (other.actionSetEthernetSrcAddr != null)
+ this.actionSetEthernetSrcAddr = new ActionSetEthernetAddr(other.actionSetEthernetSrcAddr);
+ else
+ this.actionSetEthernetSrcAddr = null;
+ //
+ if (other.actionSetEthernetDstAddr != null)
+ this.actionSetEthernetDstAddr = new ActionSetEthernetAddr(other.actionSetEthernetDstAddr);
+ else
+ this.actionSetEthernetDstAddr = null;
+ //
+ if (other.actionSetIPv4SrcAddr != null)
+ this.actionSetIPv4SrcAddr = new ActionSetIPv4Addr(other.actionSetIPv4SrcAddr);
+ else
+ this.actionSetIPv4SrcAddr = null;
+ //
+ if (other.actionSetIPv4DstAddr != null)
+ this.actionSetIPv4DstAddr = new ActionSetIPv4Addr(other.actionSetIPv4DstAddr);
+ else
+ this.actionSetIPv4DstAddr = null;
+ //
+ if (other.actionSetIpToS != null)
+ this.actionSetIpToS = new ActionSetIpToS(other.actionSetIpToS);
+ else
+ this.actionSetIpToS = null;
+ //
+ if (other.actionSetTcpUdpSrcPort != null)
+ this.actionSetTcpUdpSrcPort = new ActionSetTcpUdpPort(other.actionSetTcpUdpSrcPort);
+ else
+ this.actionSetTcpUdpSrcPort = null;
+ //
+ if (other.actionSetTcpUdpDstPort != null)
+ this.actionSetTcpUdpDstPort = new ActionSetTcpUdpPort(other.actionSetTcpUdpDstPort);
+ else
+ this.actionSetTcpUdpDstPort = null;
+ //
+ if (other.actionEnqueue != null)
+ this.actionEnqueue = new ActionEnqueue(other.actionEnqueue);
+ else
+ this.actionEnqueue = null;
}
/**
* Constructor from a string.
- *
+ * <p/>
* The string has the following form:
- * [type=XXX action=XXX]
+ * [type=XXX action=XXX]
*
* @param actionStr the action as a string.
*/
public FlowEntryAction(String actionStr) {
- this.fromString(actionStr);
+ this.fromString(actionStr);
}
/**
@@ -1142,7 +1144,9 @@
* @return the action type.
*/
@JsonProperty("actionType")
- public ActionValues actionType() { return actionType; }
+ public ActionValues actionType() {
+ return actionType;
+ }
/**
* Get the output action.
@@ -1150,7 +1154,9 @@
* @return the output action.
*/
@JsonProperty("actionOutput")
- public ActionOutput actionOutput() { return actionOutput; }
+ public ActionOutput actionOutput() {
+ return actionOutput;
+ }
/**
* Set the output action on a port.
@@ -1159,8 +1165,8 @@
*/
@JsonProperty("actionOutput")
public void setActionOutput(ActionOutput action) {
- actionOutput = action;
- actionType = ActionValues.ACTION_OUTPUT;
+ actionOutput = action;
+ actionType = ActionValues.ACTION_OUTPUT;
}
/**
@@ -1169,8 +1175,8 @@
* @param port the output port to set.
*/
public void setActionOutput(Port port) {
- actionOutput = new ActionOutput(port);
- actionType = ActionValues.ACTION_OUTPUT;
+ actionOutput = new ActionOutput(port);
+ actionType = ActionValues.ACTION_OUTPUT;
}
/**
@@ -1179,9 +1185,9 @@
* @param maxLen the maximum length (in bytes) to send to controller.
*/
public void setActionOutputToController(short maxLen) {
- Port port = new Port(Port.PortValues.PORT_CONTROLLER);
- actionOutput = new ActionOutput(port, maxLen);
- actionType = ActionValues.ACTION_OUTPUT;
+ Port port = new Port(Port.PortValues.PORT_CONTROLLER);
+ actionOutput = new ActionOutput(port, maxLen);
+ actionType = ActionValues.ACTION_OUTPUT;
}
/**
@@ -1190,7 +1196,9 @@
* @return the action to set the VLAN ID.
*/
@JsonProperty("actionSetVlanId")
- public ActionSetVlanId actionSetVlanId() { return actionSetVlanId; }
+ public ActionSetVlanId actionSetVlanId() {
+ return actionSetVlanId;
+ }
/**
* Set the action to set the VLAN ID.
@@ -1199,8 +1207,8 @@
*/
@JsonProperty("actionSetVlanId")
public void setActionSetVlanId(ActionSetVlanId action) {
- actionSetVlanId = action;
- actionType = ActionValues.ACTION_SET_VLAN_VID;
+ actionSetVlanId = action;
+ actionType = ActionValues.ACTION_SET_VLAN_VID;
}
/**
@@ -1209,8 +1217,8 @@
* @param vlanId the VLAN ID to set.
*/
public void setActionSetVlanId(short vlanId) {
- actionSetVlanId = new ActionSetVlanId(vlanId);
- actionType = ActionValues.ACTION_SET_VLAN_VID;
+ actionSetVlanId = new ActionSetVlanId(vlanId);
+ actionType = ActionValues.ACTION_SET_VLAN_VID;
}
/**
@@ -1220,7 +1228,7 @@
*/
@JsonProperty("actionSetVlanPriority")
public ActionSetVlanPriority actionSetVlanPriority() {
- return actionSetVlanPriority;
+ return actionSetVlanPriority;
}
/**
@@ -1230,8 +1238,8 @@
*/
@JsonProperty("actionSetVlanPriority")
public void setActionSetVlanPriority(ActionSetVlanPriority action) {
- actionSetVlanPriority = action;
- actionType = ActionValues.ACTION_SET_VLAN_PCP;
+ actionSetVlanPriority = action;
+ actionType = ActionValues.ACTION_SET_VLAN_PCP;
}
/**
@@ -1240,8 +1248,8 @@
* @param vlanPriority the VLAN priority to set.
*/
public void setActionSetVlanPriority(byte vlanPriority) {
- actionSetVlanPriority = new ActionSetVlanPriority(vlanPriority);
- actionType = ActionValues.ACTION_SET_VLAN_PCP;
+ actionSetVlanPriority = new ActionSetVlanPriority(vlanPriority);
+ actionType = ActionValues.ACTION_SET_VLAN_PCP;
}
/**
@@ -1251,7 +1259,7 @@
*/
@JsonProperty("actionStripVlan")
public ActionStripVlan actionStripVlan() {
- return actionStripVlan;
+ return actionStripVlan;
}
/**
@@ -1261,8 +1269,8 @@
*/
@JsonProperty("actionStripVlan")
public void setActionStripVlan(ActionStripVlan action) {
- actionStripVlan = action;
- actionType = ActionValues.ACTION_STRIP_VLAN;
+ actionStripVlan = action;
+ actionType = ActionValues.ACTION_STRIP_VLAN;
}
/**
@@ -1271,8 +1279,8 @@
* @param stripVlan if true, strip the VLAN header.
*/
public void setActionStripVlan(boolean stripVlan) {
- actionStripVlan = new ActionStripVlan(stripVlan);
- actionType = ActionValues.ACTION_STRIP_VLAN;
+ actionStripVlan = new ActionStripVlan(stripVlan);
+ actionType = ActionValues.ACTION_STRIP_VLAN;
}
/**
@@ -1282,7 +1290,7 @@
*/
@JsonProperty("actionSetEthernetSrcAddr")
public ActionSetEthernetAddr actionSetEthernetSrcAddr() {
- return actionSetEthernetSrcAddr;
+ return actionSetEthernetSrcAddr;
}
/**
@@ -1292,8 +1300,8 @@
*/
@JsonProperty("actionSetEthernetSrcAddr")
public void setActionSetEthernetSrcAddr(ActionSetEthernetAddr action) {
- actionSetEthernetSrcAddr = action;
- actionType = ActionValues.ACTION_SET_DL_SRC;
+ actionSetEthernetSrcAddr = action;
+ actionType = ActionValues.ACTION_SET_DL_SRC;
}
/**
@@ -1302,8 +1310,8 @@
* @param addr the MAC address to set as the Ethernet source address.
*/
public void setActionSetEthernetSrcAddr(MACAddress addr) {
- actionSetEthernetSrcAddr = new ActionSetEthernetAddr(addr);
- actionType = ActionValues.ACTION_SET_DL_SRC;
+ actionSetEthernetSrcAddr = new ActionSetEthernetAddr(addr);
+ actionType = ActionValues.ACTION_SET_DL_SRC;
}
/**
@@ -1313,7 +1321,7 @@
*/
@JsonProperty("actionSetEthernetDstAddr")
public ActionSetEthernetAddr actionSetEthernetDstAddr() {
- return actionSetEthernetDstAddr;
+ return actionSetEthernetDstAddr;
}
/**
@@ -1323,8 +1331,8 @@
*/
@JsonProperty("actionSetEthernetDstAddr")
public void setActionSetEthernetDstAddr(ActionSetEthernetAddr action) {
- actionSetEthernetDstAddr = action;
- actionType = ActionValues.ACTION_SET_DL_DST;
+ actionSetEthernetDstAddr = action;
+ actionType = ActionValues.ACTION_SET_DL_DST;
}
/**
@@ -1333,8 +1341,8 @@
* @param addr the MAC address to set as the Ethernet destination address.
*/
public void setActionSetEthernetDstAddr(MACAddress addr) {
- actionSetEthernetDstAddr = new ActionSetEthernetAddr(addr);
- actionType = ActionValues.ACTION_SET_DL_DST;
+ actionSetEthernetDstAddr = new ActionSetEthernetAddr(addr);
+ actionType = ActionValues.ACTION_SET_DL_DST;
}
/**
@@ -1344,7 +1352,7 @@
*/
@JsonProperty("actionSetIPv4SrcAddr")
public ActionSetIPv4Addr actionSetIPv4SrcAddr() {
- return actionSetIPv4SrcAddr;
+ return actionSetIPv4SrcAddr;
}
/**
@@ -1354,8 +1362,8 @@
*/
@JsonProperty("actionSetIPv4SrcAddr")
public void setActionSetIPv4SrcAddr(ActionSetIPv4Addr action) {
- actionSetIPv4SrcAddr = action;
- actionType = ActionValues.ACTION_SET_NW_SRC;
+ actionSetIPv4SrcAddr = action;
+ actionType = ActionValues.ACTION_SET_NW_SRC;
}
/**
@@ -1364,8 +1372,8 @@
* @param addr the IPv4 address to set as the IPv4 source address.
*/
public void setActionSetIPv4SrcAddr(IPv4 addr) {
- actionSetIPv4SrcAddr = new ActionSetIPv4Addr(addr);
- actionType = ActionValues.ACTION_SET_NW_SRC;
+ actionSetIPv4SrcAddr = new ActionSetIPv4Addr(addr);
+ actionType = ActionValues.ACTION_SET_NW_SRC;
}
/**
@@ -1375,7 +1383,7 @@
*/
@JsonProperty("actionSetIPv4DstAddr")
public ActionSetIPv4Addr actionSetIPv4DstAddr() {
- return actionSetIPv4DstAddr;
+ return actionSetIPv4DstAddr;
}
/**
@@ -1385,8 +1393,8 @@
*/
@JsonProperty("actionSetIPv4DstAddr")
public void setActionSetIPv4DstAddr(ActionSetIPv4Addr action) {
- actionSetIPv4DstAddr = action;
- actionType = ActionValues.ACTION_SET_NW_DST;
+ actionSetIPv4DstAddr = action;
+ actionType = ActionValues.ACTION_SET_NW_DST;
}
/**
@@ -1395,8 +1403,8 @@
* @param addr the IPv4 address to set as the IPv4 destination address.
*/
public void setActionSetIPv4DstAddr(IPv4 addr) {
- actionSetIPv4DstAddr = new ActionSetIPv4Addr(addr);
- actionType = ActionValues.ACTION_SET_NW_DST;
+ actionSetIPv4DstAddr = new ActionSetIPv4Addr(addr);
+ actionType = ActionValues.ACTION_SET_NW_DST;
}
/**
@@ -1406,7 +1414,7 @@
*/
@JsonProperty("actionSetIpToS")
public ActionSetIpToS actionSetIpToS() {
- return actionSetIpToS;
+ return actionSetIpToS;
}
/**
@@ -1416,8 +1424,8 @@
*/
@JsonProperty("actionSetIpToS")
public void setActionSetIpToS(ActionSetIpToS action) {
- actionSetIpToS = action;
- actionType = ActionValues.ACTION_SET_NW_TOS;
+ actionSetIpToS = action;
+ actionType = ActionValues.ACTION_SET_NW_TOS;
}
/**
@@ -1426,8 +1434,8 @@
* @param ipToS the IP ToS (DSCP field, 6 bits) to set.
*/
public void setActionSetIpToS(byte ipToS) {
- actionSetIpToS = new ActionSetIpToS(ipToS);
- actionType = ActionValues.ACTION_SET_NW_TOS;
+ actionSetIpToS = new ActionSetIpToS(ipToS);
+ actionType = ActionValues.ACTION_SET_NW_TOS;
}
/**
@@ -1437,7 +1445,7 @@
*/
@JsonProperty("actionSetTcpUdpSrcPort")
public ActionSetTcpUdpPort actionSetTcpUdpSrcPort() {
- return actionSetTcpUdpSrcPort;
+ return actionSetTcpUdpSrcPort;
}
/**
@@ -1447,8 +1455,8 @@
*/
@JsonProperty("actionSetTcpUdpSrcPort")
public void setActionSetTcpUdpSrcPort(ActionSetTcpUdpPort action) {
- actionSetTcpUdpSrcPort = action;
- actionType = ActionValues.ACTION_SET_TP_SRC;
+ actionSetTcpUdpSrcPort = action;
+ actionType = ActionValues.ACTION_SET_TP_SRC;
}
/**
@@ -1457,8 +1465,8 @@
* @param port the TCP/UDP port to set as the TCP/UDP source port.
*/
public void setActionSetTcpUdpSrcPort(short port) {
- actionSetTcpUdpSrcPort = new ActionSetTcpUdpPort(port);
- actionType = ActionValues.ACTION_SET_TP_SRC;
+ actionSetTcpUdpSrcPort = new ActionSetTcpUdpPort(port);
+ actionType = ActionValues.ACTION_SET_TP_SRC;
}
/**
@@ -1468,7 +1476,7 @@
*/
@JsonProperty("actionSetTcpUdpDstPort")
public ActionSetTcpUdpPort actionSetTcpUdpDstPort() {
- return actionSetTcpUdpDstPort;
+ return actionSetTcpUdpDstPort;
}
/**
@@ -1478,8 +1486,8 @@
*/
@JsonProperty("actionSetTcpUdpDstPort")
public void setActionSetTcpUdpDstPort(ActionSetTcpUdpPort action) {
- actionSetTcpUdpDstPort = action;
- actionType = ActionValues.ACTION_SET_TP_DST;
+ actionSetTcpUdpDstPort = action;
+ actionType = ActionValues.ACTION_SET_TP_DST;
}
/**
@@ -1488,8 +1496,8 @@
* @param port the TCP/UDP port to set as the TCP/UDP destination port.
*/
public void setActionSetTcpUdpDstPort(short port) {
- actionSetTcpUdpDstPort = new ActionSetTcpUdpPort(port);
- actionType = ActionValues.ACTION_SET_TP_DST;
+ actionSetTcpUdpDstPort = new ActionSetTcpUdpPort(port);
+ actionType = ActionValues.ACTION_SET_TP_DST;
}
/**
@@ -1498,7 +1506,9 @@
* @return the action to output to queue on a port.
*/
@JsonProperty("actionEnqueue")
- public ActionEnqueue actionEnqueue() { return actionEnqueue; }
+ public ActionEnqueue actionEnqueue() {
+ return actionEnqueue;
+ }
/**
* Set the action to output to queue on a port.
@@ -1507,171 +1517,171 @@
*/
@JsonProperty("actionEnqueue")
public void setActionEnqueue(ActionEnqueue action) {
- actionEnqueue = action;
- actionType = ActionValues.ACTION_ENQUEUE;
+ actionEnqueue = action;
+ actionType = ActionValues.ACTION_ENQUEUE;
}
/**
* Set the action to output to queue on a port.
*
- * @param port the port to set.
+ * @param port the port to set.
* @param queueId the queue ID to set.
*/
public void setActionEnqueue(Port port, int queueId) {
- actionEnqueue = new ActionEnqueue(port, queueId);
- actionType = ActionValues.ACTION_ENQUEUE;
+ actionEnqueue = new ActionEnqueue(port, queueId);
+ actionType = ActionValues.ACTION_ENQUEUE;
}
/**
* Convert the action to a string.
- *
+ * <p/>
* The string has the following form:
- * [type=XXX action=XXX]
+ * [type=XXX action=XXX]
*
* @return the action as a string.
*/
@Override
public String toString() {
- String ret = "[";
- ret += "type=" + actionType;
- switch (actionType) {
- case ACTION_OUTPUT:
- ret += " action=" + actionOutput.toString();
- break;
- case ACTION_SET_VLAN_VID:
- ret += " action=" + actionSetVlanId.toString();
- break;
- case ACTION_SET_VLAN_PCP:
- ret += " action=" + actionSetVlanPriority.toString();
- break;
- case ACTION_STRIP_VLAN:
- ret += " action=" + actionStripVlan.toString();
- break;
- case ACTION_SET_DL_SRC:
- ret += " action=" + actionSetEthernetSrcAddr.toString();
- break;
- case ACTION_SET_DL_DST:
- ret += " action=" + actionSetEthernetDstAddr.toString();
- break;
- case ACTION_SET_NW_SRC:
- ret += " action=" + actionSetIPv4SrcAddr.toString();
- break;
- case ACTION_SET_NW_DST:
- ret += " action=" + actionSetIPv4DstAddr.toString();
- break;
- case ACTION_SET_NW_TOS:
- ret += " action=" + actionSetIpToS.toString();
- break;
- case ACTION_SET_TP_SRC:
- ret += " action=" + actionSetTcpUdpSrcPort.toString();
- break;
- case ACTION_SET_TP_DST:
- ret += " action=" + actionSetTcpUdpDstPort.toString();
- break;
- case ACTION_ENQUEUE:
- ret += " action=" + actionEnqueue.toString();
- break;
- case ACTION_VENDOR:
- ret += " action=VENDOR";
- break;
- }
- ret += "]";
+ String ret = "[";
+ ret += "type=" + actionType;
+ switch (actionType) {
+ case ACTION_OUTPUT:
+ ret += " action=" + actionOutput.toString();
+ break;
+ case ACTION_SET_VLAN_VID:
+ ret += " action=" + actionSetVlanId.toString();
+ break;
+ case ACTION_SET_VLAN_PCP:
+ ret += " action=" + actionSetVlanPriority.toString();
+ break;
+ case ACTION_STRIP_VLAN:
+ ret += " action=" + actionStripVlan.toString();
+ break;
+ case ACTION_SET_DL_SRC:
+ ret += " action=" + actionSetEthernetSrcAddr.toString();
+ break;
+ case ACTION_SET_DL_DST:
+ ret += " action=" + actionSetEthernetDstAddr.toString();
+ break;
+ case ACTION_SET_NW_SRC:
+ ret += " action=" + actionSetIPv4SrcAddr.toString();
+ break;
+ case ACTION_SET_NW_DST:
+ ret += " action=" + actionSetIPv4DstAddr.toString();
+ break;
+ case ACTION_SET_NW_TOS:
+ ret += " action=" + actionSetIpToS.toString();
+ break;
+ case ACTION_SET_TP_SRC:
+ ret += " action=" + actionSetTcpUdpSrcPort.toString();
+ break;
+ case ACTION_SET_TP_DST:
+ ret += " action=" + actionSetTcpUdpDstPort.toString();
+ break;
+ case ACTION_ENQUEUE:
+ ret += " action=" + actionEnqueue.toString();
+ break;
+ case ACTION_VENDOR:
+ ret += " action=VENDOR";
+ break;
+ }
+ ret += "]";
- return ret;
+ return ret;
}
/**
* Convert a string to an action.
- *
+ * <p/>
* The string has the following form:
- * [type=XXX action=XXX]
+ * [type=XXX action=XXX]
*
* @param actionStr the action as a string.
*/
public void fromString(String actionStr) {
- String[] parts = actionStr.split("type=");
- String decode = null;
+ String[] parts = actionStr.split("type=");
+ String decode = null;
- // Extract the string after the "type="
- if (parts.length > 1)
- decode = parts[1];
- if (decode == null)
- throw new IllegalArgumentException("Invalid action string");
+ // Extract the string after the "type="
+ if (parts.length > 1)
+ decode = parts[1];
+ if (decode == null)
+ throw new IllegalArgumentException("Invalid action string");
- // Remove the trailing ']'
- if ((decode.length() > 0) && (decode.charAt(decode.length() - 1) == ']')) {
- decode = decode.substring(0, decode.length() - 1);
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
+ // Remove the trailing ']'
+ if ((decode.length() > 0) && (decode.charAt(decode.length() - 1) == ']')) {
+ decode = decode.substring(0, decode.length() - 1);
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
- // Extract the type value and the action value
- parts = decode.split(" action=");
+ // Extract the type value and the action value
+ parts = decode.split(" action=");
- // Decode the "type=XXX" payload
- if (parts.length > 0)
- decode = parts[0];
- if (decode != null) {
- try {
- actionType = Enum.valueOf(ActionValues.class, decode);
- } catch (IllegalArgumentException e) {
- throw new IllegalArgumentException("Invalid action string");
- }
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
+ // Decode the "type=XXX" payload
+ if (parts.length > 0)
+ decode = parts[0];
+ if (decode != null) {
+ try {
+ actionType = Enum.valueOf(ActionValues.class, decode);
+ } catch (IllegalArgumentException e) {
+ throw new IllegalArgumentException("Invalid action string");
+ }
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
- // Decode the "action=XXX" payload
- decode = null;
- if (parts.length > 1)
- decode = parts[1];
- if (decode == null)
- throw new IllegalArgumentException("Invalid action string");
- //
- try {
- switch (actionType) {
- case ACTION_OUTPUT:
- actionOutput = new ActionOutput(decode);
- break;
- case ACTION_SET_VLAN_VID:
- actionSetVlanId = new ActionSetVlanId(decode);
- break;
- case ACTION_SET_VLAN_PCP:
- actionSetVlanPriority = new ActionSetVlanPriority(decode);
- break;
- case ACTION_STRIP_VLAN:
- actionStripVlan = new ActionStripVlan(decode);
- break;
- case ACTION_SET_DL_SRC:
- actionSetEthernetSrcAddr = new ActionSetEthernetAddr(decode);
- break;
- case ACTION_SET_DL_DST:
- actionSetEthernetDstAddr = new ActionSetEthernetAddr(decode);
- break;
- case ACTION_SET_NW_SRC:
- actionSetIPv4SrcAddr = new ActionSetIPv4Addr(decode);
- break;
- case ACTION_SET_NW_DST:
- actionSetIPv4DstAddr = new ActionSetIPv4Addr(decode);
- break;
- case ACTION_SET_NW_TOS:
- actionSetIpToS = new ActionSetIpToS(decode);
- break;
- case ACTION_SET_TP_SRC:
- actionSetTcpUdpSrcPort = new ActionSetTcpUdpPort(decode);
- break;
- case ACTION_SET_TP_DST:
- actionSetTcpUdpDstPort = new ActionSetTcpUdpPort(decode);
- break;
- case ACTION_ENQUEUE:
- actionEnqueue = new ActionEnqueue(decode);
- break;
- case ACTION_VENDOR:
- // TODO: Handle it as appropriate
- break;
- }
- } catch (IllegalArgumentException e) {
- throw new IllegalArgumentException("Invalid action string");
- }
+ // Decode the "action=XXX" payload
+ decode = null;
+ if (parts.length > 1)
+ decode = parts[1];
+ if (decode == null)
+ throw new IllegalArgumentException("Invalid action string");
+ //
+ try {
+ switch (actionType) {
+ case ACTION_OUTPUT:
+ actionOutput = new ActionOutput(decode);
+ break;
+ case ACTION_SET_VLAN_VID:
+ actionSetVlanId = new ActionSetVlanId(decode);
+ break;
+ case ACTION_SET_VLAN_PCP:
+ actionSetVlanPriority = new ActionSetVlanPriority(decode);
+ break;
+ case ACTION_STRIP_VLAN:
+ actionStripVlan = new ActionStripVlan(decode);
+ break;
+ case ACTION_SET_DL_SRC:
+ actionSetEthernetSrcAddr = new ActionSetEthernetAddr(decode);
+ break;
+ case ACTION_SET_DL_DST:
+ actionSetEthernetDstAddr = new ActionSetEthernetAddr(decode);
+ break;
+ case ACTION_SET_NW_SRC:
+ actionSetIPv4SrcAddr = new ActionSetIPv4Addr(decode);
+ break;
+ case ACTION_SET_NW_DST:
+ actionSetIPv4DstAddr = new ActionSetIPv4Addr(decode);
+ break;
+ case ACTION_SET_NW_TOS:
+ actionSetIpToS = new ActionSetIpToS(decode);
+ break;
+ case ACTION_SET_TP_SRC:
+ actionSetTcpUdpSrcPort = new ActionSetTcpUdpPort(decode);
+ break;
+ case ACTION_SET_TP_DST:
+ actionSetTcpUdpDstPort = new ActionSetTcpUdpPort(decode);
+ break;
+ case ACTION_ENQUEUE:
+ actionEnqueue = new ActionEnqueue(decode);
+ break;
+ case ACTION_VENDOR:
+ // TODO: Handle it as appropriate
+ break;
+ }
+ } catch (IllegalArgumentException e) {
+ throw new IllegalArgumentException("Invalid action string");
+ }
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowEntryActions.java b/src/main/java/net/onrc/onos/core/util/FlowEntryActions.java
index 8839ceb..fc55932 100644
--- a/src/main/java/net/onrc/onos/core/util/FlowEntryActions.java
+++ b/src/main/java/net/onrc/onos/core/util/FlowEntryActions.java
@@ -7,29 +7,29 @@
/**
* The class representing multiple Flow Entry actions.
- *
+ * <p/>
* A set of Flow Entry actions need to be applied to each packet.
*/
public class FlowEntryActions {
- private ArrayList<FlowEntryAction> actions; // The Flow Entry Actions
+ private ArrayList<FlowEntryAction> actions; // The Flow Entry Actions
/**
* Default constructor.
*/
public FlowEntryActions() {
- actions = new ArrayList<FlowEntryAction>();
+ actions = new ArrayList<FlowEntryAction>();
}
/**
* Constructor from a string.
- *
+ * <p/>
* The string has the following form:
- * [[type=XXX action=XXX];[type=XXX action=XXX];...;]
+ * [[type=XXX action=XXX];[type=XXX action=XXX];...;]
*
* @param actionsStr the set of actions as a string.
*/
public FlowEntryActions(String actionsStr) {
- this.fromString(actionsStr);
+ this.fromString(actionsStr);
}
/**
@@ -38,12 +38,12 @@
* @param other the object to copy from.
*/
public FlowEntryActions(FlowEntryActions other) {
- actions = new ArrayList<FlowEntryAction>();
+ actions = new ArrayList<FlowEntryAction>();
- for (FlowEntryAction action : other.actions) {
- FlowEntryAction newAction = new FlowEntryAction(action);
- actions.add(newAction);
- }
+ for (FlowEntryAction action : other.actions) {
+ FlowEntryAction newAction = new FlowEntryAction(action);
+ actions.add(newAction);
+ }
}
/**
@@ -53,7 +53,7 @@
*/
@JsonProperty("actions")
public ArrayList<FlowEntryAction> actions() {
- return actions;
+ return actions;
}
/**
@@ -63,7 +63,7 @@
*/
@JsonProperty("actions")
public void setActions(ArrayList<FlowEntryAction> actions) {
- this.actions = actions;
+ this.actions = actions;
}
/**
@@ -72,7 +72,7 @@
* @param flowEntryAction the Flow Entry Action to add.
*/
public void addAction(FlowEntryAction flowEntryAction) {
- actions.add(flowEntryAction);
+ actions.add(flowEntryAction);
}
/**
@@ -82,67 +82,67 @@
*/
@JsonIgnore
public Boolean isEmpty() {
- return actions.isEmpty();
+ return actions.isEmpty();
}
/**
* Convert the set of actions to a string.
- *
+ * <p/>
* The string has the following form:
- * [[type=XXX action=XXX];[type=XXX action=XXX];...;]
+ * [[type=XXX action=XXX];[type=XXX action=XXX];...;]
*
* @return the set of actions as a string.
*/
@Override
public String toString() {
- String ret = "[";
- for (FlowEntryAction action : actions) {
- ret += action.toString() + ";";
- }
- ret += "]";
+ String ret = "[";
+ for (FlowEntryAction action : actions) {
+ ret += action.toString() + ";";
+ }
+ ret += "]";
- return ret;
+ return ret;
}
/**
* Convert a string to a set of actions.
- *
+ * <p/>
* The string has the following form:
- * [[type=XXX action=XXX];[type=XXX action=XXX];...;]
+ * [[type=XXX action=XXX];[type=XXX action=XXX];...;]
*
* @param actionsStr the set of actions as a string.
*/
public void fromString(String actionsStr) {
- String decode = actionsStr;
+ String decode = actionsStr;
- actions = new ArrayList<FlowEntryAction>();
+ actions = new ArrayList<FlowEntryAction>();
- if (decode.isEmpty())
- return; // Nothing to do
+ if (decode.isEmpty())
+ return; // Nothing to do
- // Remove the '[' and ']' in the beginning and the end of the string
- if ((decode.length() > 1) && (decode.charAt(0) == '[') &&
- (decode.charAt(decode.length() - 1) == ']')) {
- decode = decode.substring(1, decode.length() - 1);
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
+ // Remove the '[' and ']' in the beginning and the end of the string
+ if ((decode.length() > 1) && (decode.charAt(0) == '[') &&
+ (decode.charAt(decode.length() - 1) == ']')) {
+ decode = decode.substring(1, decode.length() - 1);
+ } else {
+ throw new IllegalArgumentException("Invalid action string");
+ }
- // Split the string, and decode each action
- String[] parts = decode.split(";");
- for (int i = 0; i < parts.length; i++) {
- decode = parts[i];
- if ((decode == null) || decode.isEmpty())
- continue;
- FlowEntryAction flowEntryAction = null;
- try {
- flowEntryAction = new FlowEntryAction(decode);
- } catch (IllegalArgumentException e) {
- // TODO: Ignore invalid actions for now
- continue;
- }
- if (flowEntryAction != null)
- actions.add(flowEntryAction);
- }
+ // Split the string, and decode each action
+ String[] parts = decode.split(";");
+ for (int i = 0; i < parts.length; i++) {
+ decode = parts[i];
+ if ((decode == null) || decode.isEmpty())
+ continue;
+ FlowEntryAction flowEntryAction = null;
+ try {
+ flowEntryAction = new FlowEntryAction(decode);
+ } catch (IllegalArgumentException e) {
+ // TODO: Ignore invalid actions for now
+ continue;
+ }
+ if (flowEntryAction != null)
+ actions.add(flowEntryAction);
+ }
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowEntryErrorState.java b/src/main/java/net/onrc/onos/core/util/FlowEntryErrorState.java
index e1c5731..fa12055 100644
--- a/src/main/java/net/onrc/onos/core/util/FlowEntryErrorState.java
+++ b/src/main/java/net/onrc/onos/core/util/FlowEntryErrorState.java
@@ -6,15 +6,15 @@
* The class representing the Flow Entry error state.
*/
public class FlowEntryErrorState {
- private short type; // The error type (e.g., see OF-1.3.1 spec, pp. 95)
- private short code; // The error code (e.g., see OF-1.3.1 spec, pp. 95)
+ private short type; // The error type (e.g., see OF-1.3.1 spec, pp. 95)
+ private short code; // The error code (e.g., see OF-1.3.1 spec, pp. 95)
/**
* Default constructor.
*/
public FlowEntryErrorState() {
- this.type = 0;
- this.code = 0;
+ this.type = 0;
+ this.code = 0;
}
/**
@@ -24,8 +24,8 @@
* @param code the error code to use.
*/
public FlowEntryErrorState(short type, short code) {
- this.type = type;
- this.code = code;
+ this.type = type;
+ this.code = code;
}
/**
@@ -34,7 +34,9 @@
* @return the error type.
*/
@JsonProperty("type")
- public short type() { return type; }
+ public short type() {
+ return type;
+ }
/**
* Set the error type.
@@ -43,7 +45,7 @@
*/
@JsonProperty("type")
public void setType(short type) {
- this.type = type;
+ this.type = type;
}
/**
@@ -52,7 +54,9 @@
* @return the error code.
*/
@JsonProperty("code")
- public short code() { return code; }
+ public short code() {
+ return code;
+ }
/**
* Set the error code.
@@ -61,7 +65,7 @@
*/
@JsonProperty("code")
public void setCode(short code) {
- this.code = code;
+ this.code = code;
}
/**
@@ -71,13 +75,13 @@
* @param code the error code to use.
*/
public void setValue(short type, short code) {
- this.type = type;
- this.code = code;
+ this.type = type;
+ this.code = code;
}
/**
* Convert the error type and code to a string.
- *
+ * <p/>
* The string has the following form:
* [type=1 code=2]
*
@@ -85,7 +89,7 @@
*/
@Override
public String toString() {
- String ret = "[type=" + this.type + " code=" + code + "]";
- return ret;
+ String ret = "[type=" + this.type + " code=" + code + "]";
+ return ret;
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowEntryId.java b/src/main/java/net/onrc/onos/core/util/FlowEntryId.java
index e4dd32c..373962e 100644
--- a/src/main/java/net/onrc/onos/core/util/FlowEntryId.java
+++ b/src/main/java/net/onrc/onos/core/util/FlowEntryId.java
@@ -12,8 +12,8 @@
/**
* The class representing a Flow Entry ID.
*/
-@JsonDeserialize(using=FlowEntryIdDeserializer.class)
-@JsonSerialize(using=FlowEntryIdSerializer.class)
+@JsonDeserialize(using = FlowEntryIdDeserializer.class)
+@JsonSerialize(using = FlowEntryIdSerializer.class)
public class FlowEntryId {
private long value;
@@ -21,7 +21,7 @@
* Default constructor.
*/
public FlowEntryId() {
- this.value = -1;
+ this.value = -1;
}
/**
@@ -30,7 +30,7 @@
* @param value the value to use.
*/
public FlowEntryId(long value) {
- this.value = value;
+ this.value = value;
}
/**
@@ -39,17 +39,17 @@
* @param value the value to use.
*/
public FlowEntryId(String value) {
- //
- // Use the help of BigInteger to parse strings representing
- // large unsigned hex long values.
- //
- char c = 0;
- if (value.length() > 2)
- c = value.charAt(1);
- if ((c == 'x') || (c == 'X'))
- this.value = new BigInteger(value.substring(2), 16).longValue();
- else
- this.value = Long.decode(value);
+ //
+ // Use the help of BigInteger to parse strings representing
+ // large unsigned hex long values.
+ //
+ char c = 0;
+ if (value.length() > 2)
+ c = value.charAt(1);
+ if ((c == 'x') || (c == 'X'))
+ this.value = new BigInteger(value.substring(2), 16).longValue();
+ else
+ this.value = Long.decode(value);
}
/**
@@ -57,7 +57,9 @@
*
* @return the value of the Flow Entry ID.
*/
- public long value() { return value; }
+ public long value() {
+ return value;
+ }
/**
* Set the value of the Flow Entry ID.
@@ -65,7 +67,7 @@
* @param value the value to set.
*/
public void setValue(long value) {
- this.value = value;
+ this.value = value;
}
/**
@@ -75,30 +77,30 @@
*/
@JsonIgnore
public boolean isValid() {
- return (this.value() != -1);
+ return (this.value() != -1);
}
/**
- * Returns true of the object is another Flow Entry ID with
+ * Returns true of the object is another Flow Entry ID with
* the same value; otherwise, returns false.
- *
+ *
* @param Object to compare
*/
@Override
- public boolean equals(Object obj){
- if(obj != null && obj.getClass() == this.getClass()) {
- FlowEntryId entry = (FlowEntryId) obj;
- return this.value() == entry.value();
- }
- return false;
+ public boolean equals(Object obj) {
+ if (obj != null && obj.getClass() == this.getClass()) {
+ FlowEntryId entry = (FlowEntryId) obj;
+ return this.value() == entry.value();
+ }
+ return false;
}
-
+
/**
* Return the hash code of the Flow Entry ID
*/
@Override
public int hashCode() {
- return Long.valueOf(value).hashCode();
+ return Long.valueOf(value).hashCode();
}
/**
@@ -108,6 +110,6 @@
*/
@Override
public String toString() {
- return "0x" + Long.toHexString(this.value);
+ return "0x" + Long.toHexString(this.value);
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowEntryMatch.java b/src/main/java/net/onrc/onos/core/util/FlowEntryMatch.java
index cc18071..ce6a202 100644
--- a/src/main/java/net/onrc/onos/core/util/FlowEntryMatch.java
+++ b/src/main/java/net/onrc/onos/core/util/FlowEntryMatch.java
@@ -6,7 +6,7 @@
/**
* The class representing the Flow Entry Matching filter.
- *
+ * <p/>
* The Flow Entry matching filter that is used to specify
* the network data that would be forwarded on the data path from
* the source to the destination. Examples: source or destination MAC address,
@@ -17,70 +17,74 @@
* A class for storing a value to match.
*/
public static class Field<T> {
- /**
- * Default constructor.
- */
- public Field() {
- this.enabled = false;
- }
+ /**
+ * Default constructor.
+ */
+ public Field() {
+ this.enabled = false;
+ }
- /**
- * Constructor for a given value to match.
- *
- * @param value the value to match.
- */
- public Field(T value) {
- this.value = value;
- this.enabled = true;
- }
+ /**
+ * Constructor for a given value to match.
+ *
+ * @param value the value to match.
+ */
+ public Field(T value) {
+ this.value = value;
+ this.enabled = true;
+ }
- /**
- * Get the value.
- *
- * @return the value.
- */
- public T value() { return this.value; }
+ /**
+ * Get the value.
+ *
+ * @return the value.
+ */
+ public T value() {
+ return this.value;
+ }
- /**
- * Enable the matching for a given value.
- *
- * @param value the value to set.
- */
- public void enableMatch(T value) {
- this.value = value;
- this.enabled = true;
- }
+ /**
+ * Enable the matching for a given value.
+ *
+ * @param value the value to set.
+ */
+ public void enableMatch(T value) {
+ this.value = value;
+ this.enabled = true;
+ }
- /**
- * Disable the matching.
- */
- public void disableMatch() {
- this.enabled = false;
- }
+ /**
+ * Disable the matching.
+ */
+ public void disableMatch() {
+ this.enabled = false;
+ }
- /**
- * Test whether matching is enabled.
- *
- * @return true if matching is enabled, otherwise false.
- */
- public boolean enabled() { return this.enabled; }
+ /**
+ * Test whether matching is enabled.
+ *
+ * @return true if matching is enabled, otherwise false.
+ */
+ public boolean enabled() {
+ return this.enabled;
+ }
- private T value; // The value to match
- private boolean enabled; // Set to true, if matching is enabled
+ private T value; // The value to match
+ private boolean enabled; // Set to true, if matching is enabled
}
- private Field<Port> inPort; // Matching input switch port
- private Field<MACAddress> srcMac; // Matching source MAC address
- private Field<MACAddress> dstMac; // Matching destination MAC address
+ private Field<Port> inPort; // Matching input switch port
+ private Field<MACAddress> srcMac; // Matching source MAC address
+ private Field<MACAddress> dstMac; // Matching destination MAC address
private Field<Short> ethernetFrameType; // Matching Ethernet frame type
- private Field<Short> vlanId; // Matching VLAN ID
- private Field<Byte> vlanPriority; // Matching VLAN priority
- private Field<IPv4Net> srcIPv4Net; // Matching source IPv4 prefix
- private Field<IPv4Net> dstIPv4Net; // Matching destination IPv4 prefix
- private Field<Byte> ipProto; // Matching IP protocol
- private Field<Byte> ipToS; // Matching IP ToS (DSCP field, 6 bits)
- private Field<Short> srcTcpUdpPort; // Matching source TCP/UDP port
- private Field<Short> dstTcpUdpPort; // Matching destination TCP/UDP port
+ private Field<Short> vlanId; // Matching VLAN ID
+ private Field<Byte> vlanPriority; // Matching VLAN priority
+ private Field<IPv4Net> srcIPv4Net; // Matching source IPv4 prefix
+ private Field<IPv4Net> dstIPv4Net; // Matching destination IPv4 prefix
+ private Field<Byte> ipProto; // Matching IP protocol
+ private Field<Byte> ipToS; // Matching IP ToS (DSCP field, 6 bits)
+ private Field<Short> srcTcpUdpPort; // Matching source TCP/UDP port
+ private Field<Short> dstTcpUdpPort; // Matching destination TCP/UDP port
/**
* Default constructor.
@@ -94,30 +98,30 @@
* @param other the object to copy from.
*/
public FlowEntryMatch(FlowEntryMatch other) {
- if ((other.inPort != null) && other.inPort.enabled())
- this.enableInPort(other.inPort.value());
- if ((other.srcMac != null) && other.srcMac.enabled())
- this.enableSrcMac(other.srcMac.value());
- if ((other.dstMac != null) && other.dstMac.enabled())
- this.enableDstMac(other.dstMac.value());
- if ((other.ethernetFrameType != null) && other.ethernetFrameType.enabled())
- this.enableEthernetFrameType(other.ethernetFrameType.value());
- if ((other.vlanId != null) && other.vlanId.enabled())
- this.enableVlanId(other.vlanId.value());
- if ((other.vlanPriority != null) && other.vlanPriority.enabled())
- this.enableVlanPriority(other.vlanPriority.value());
- if ((other.srcIPv4Net != null) && other.srcIPv4Net.enabled())
- this.enableSrcIPv4Net(other.srcIPv4Net.value());
- if ((other.dstIPv4Net != null) && other.dstIPv4Net.enabled())
- this.enableDstIPv4Net(other.dstIPv4Net.value());
- if ((other.ipProto != null) && other.ipProto.enabled())
- this.enableIpProto(other.ipProto.value());
- if ((other.ipToS != null) && other.ipToS.enabled())
- this.enableIpToS(other.ipToS.value());
- if ((other.srcTcpUdpPort != null) && other.srcTcpUdpPort.enabled())
- this.enableSrcTcpUdpPort(other.srcTcpUdpPort.value());
- if ((other.dstTcpUdpPort != null) && other.dstTcpUdpPort.enabled())
- this.enableDstTcpUdpPort(other.dstTcpUdpPort.value());
+ if ((other.inPort != null) && other.inPort.enabled())
+ this.enableInPort(other.inPort.value());
+ if ((other.srcMac != null) && other.srcMac.enabled())
+ this.enableSrcMac(other.srcMac.value());
+ if ((other.dstMac != null) && other.dstMac.enabled())
+ this.enableDstMac(other.dstMac.value());
+ if ((other.ethernetFrameType != null) && other.ethernetFrameType.enabled())
+ this.enableEthernetFrameType(other.ethernetFrameType.value());
+ if ((other.vlanId != null) && other.vlanId.enabled())
+ this.enableVlanId(other.vlanId.value());
+ if ((other.vlanPriority != null) && other.vlanPriority.enabled())
+ this.enableVlanPriority(other.vlanPriority.value());
+ if ((other.srcIPv4Net != null) && other.srcIPv4Net.enabled())
+ this.enableSrcIPv4Net(other.srcIPv4Net.value());
+ if ((other.dstIPv4Net != null) && other.dstIPv4Net.enabled())
+ this.enableDstIPv4Net(other.dstIPv4Net.value());
+ if ((other.ipProto != null) && other.ipProto.enabled())
+ this.enableIpProto(other.ipProto.value());
+ if ((other.ipToS != null) && other.ipToS.enabled())
+ this.enableIpToS(other.ipToS.value());
+ if ((other.srcTcpUdpPort != null) && other.srcTcpUdpPort.enabled())
+ this.enableSrcTcpUdpPort(other.srcTcpUdpPort.value());
+ if ((other.dstTcpUdpPort != null) && other.dstTcpUdpPort.enabled())
+ this.enableDstTcpUdpPort(other.dstTcpUdpPort.value());
}
/**
@@ -127,9 +131,9 @@
*/
@JsonProperty("inPort")
public Port inPort() {
- if (inPort != null)
- return inPort.value();
- return null;
+ if (inPort != null)
+ return inPort.value();
+ return null;
}
/**
@@ -139,14 +143,14 @@
*/
@JsonProperty("inPort")
public void enableInPort(Port inPort) {
- this.inPort = new Field<Port>(inPort);
+ this.inPort = new Field<Port>(inPort);
}
/**
* Disable the matching on input switch port.
*/
public void disableInPort() {
- this.inPort = null;
+ this.inPort = null;
}
/**
@@ -156,9 +160,9 @@
*/
@JsonProperty("matchInPort")
public boolean matchInPort() {
- if (inPort != null)
- return inPort.enabled();
- return false;
+ if (inPort != null)
+ return inPort.enabled();
+ return false;
}
/**
@@ -168,9 +172,9 @@
*/
@JsonProperty("srcMac")
public MACAddress srcMac() {
- if (srcMac != null)
- return srcMac.value();
- return null;
+ if (srcMac != null)
+ return srcMac.value();
+ return null;
}
/**
@@ -180,14 +184,14 @@
*/
@JsonProperty("srcMac")
public void enableSrcMac(MACAddress srcMac) {
- this.srcMac = new Field<MACAddress>(srcMac);
+ this.srcMac = new Field<MACAddress>(srcMac);
}
/**
* Disable the matching on source MAC address.
*/
public void disableSrcMac() {
- this.srcMac = null;
+ this.srcMac = null;
}
/**
@@ -197,9 +201,9 @@
*/
@JsonProperty("matchSrcMac")
public boolean matchSrcMac() {
- if (srcMac != null)
- return srcMac.enabled();
- return false;
+ if (srcMac != null)
+ return srcMac.enabled();
+ return false;
}
/**
@@ -209,9 +213,9 @@
*/
@JsonProperty("dstMac")
public MACAddress dstMac() {
- if (dstMac != null)
- return dstMac.value();
- return null;
+ if (dstMac != null)
+ return dstMac.value();
+ return null;
}
/**
@@ -221,14 +225,14 @@
*/
@JsonProperty("dstMac")
public void enableDstMac(MACAddress dstMac) {
- this.dstMac = new Field<MACAddress>(dstMac);
+ this.dstMac = new Field<MACAddress>(dstMac);
}
/**
* Disable the matching on destination MAC address.
*/
public void disableDstMac() {
- this.dstMac = null;
+ this.dstMac = null;
}
/**
@@ -238,9 +242,9 @@
*/
@JsonProperty("matchDstMac")
public boolean matchDstMac() {
- if (dstMac != null)
- return dstMac.enabled();
- return false;
+ if (dstMac != null)
+ return dstMac.enabled();
+ return false;
}
/**
@@ -250,27 +254,27 @@
*/
@JsonProperty("ethernetFrameType")
public Short ethernetFrameType() {
- if (ethernetFrameType != null)
- return ethernetFrameType.value();
- return null;
+ if (ethernetFrameType != null)
+ return ethernetFrameType.value();
+ return null;
}
/**
* Enable the matching on Ethernet frame type.
*
* @param ethernetFrameType the Ethernet frame type value to enable for
- * matching.
+ * matching.
*/
@JsonProperty("ethernetFrameType")
public void enableEthernetFrameType(Short ethernetFrameType) {
- this.ethernetFrameType = new Field<Short>(ethernetFrameType);
+ this.ethernetFrameType = new Field<Short>(ethernetFrameType);
}
/**
* Disable the matching on Ethernet frame type.
*/
public void disableEthernetFrameType() {
- this.ethernetFrameType = null;
+ this.ethernetFrameType = null;
}
/**
@@ -280,9 +284,9 @@
*/
@JsonProperty("matchEthernetFrameType")
public boolean matchEthernetFrameType() {
- if (ethernetFrameType != null)
- return ethernetFrameType.enabled();
- return false;
+ if (ethernetFrameType != null)
+ return ethernetFrameType.enabled();
+ return false;
}
/**
@@ -292,9 +296,9 @@
*/
@JsonProperty("vlanId")
public Short vlanId() {
- if (vlanId != null)
- return vlanId.value();
- return null;
+ if (vlanId != null)
+ return vlanId.value();
+ return null;
}
/**
@@ -304,14 +308,14 @@
*/
@JsonProperty("vlanId")
public void enableVlanId(Short vlanId) {
- this.vlanId = new Field<Short>(vlanId);
+ this.vlanId = new Field<Short>(vlanId);
}
/**
* Disable the matching on VLAN ID.
*/
public void disableVlanId() {
- this.vlanId = null;
+ this.vlanId = null;
}
/**
@@ -321,9 +325,9 @@
*/
@JsonProperty("matchVlanId")
public boolean matchVlanId() {
- if (vlanId != null)
- return vlanId.enabled();
- return false;
+ if (vlanId != null)
+ return vlanId.enabled();
+ return false;
}
/**
@@ -333,9 +337,9 @@
*/
@JsonProperty("vlanPriority")
public Byte vlanPriority() {
- if (vlanPriority != null)
- return vlanPriority.value();
- return null;
+ if (vlanPriority != null)
+ return vlanPriority.value();
+ return null;
}
/**
@@ -345,14 +349,14 @@
*/
@JsonProperty("vlanPriority")
public void enableVlanPriority(Byte vlanPriority) {
- this.vlanPriority = new Field<Byte>(vlanPriority);
+ this.vlanPriority = new Field<Byte>(vlanPriority);
}
/**
* Disable the matching on VLAN priority.
*/
public void disableVlanPriority() {
- this.vlanPriority = null;
+ this.vlanPriority = null;
}
/**
@@ -362,9 +366,9 @@
*/
@JsonProperty("matchVlanPriority")
public boolean matchVlanPriority() {
- if (vlanPriority != null)
- return vlanPriority.enabled();
- return false;
+ if (vlanPriority != null)
+ return vlanPriority.enabled();
+ return false;
}
/**
@@ -374,9 +378,9 @@
*/
@JsonProperty("srcIPv4Net")
public IPv4Net srcIPv4Net() {
- if (srcIPv4Net != null)
- return srcIPv4Net.value();
- return null;
+ if (srcIPv4Net != null)
+ return srcIPv4Net.value();
+ return null;
}
/**
@@ -386,14 +390,14 @@
*/
@JsonProperty("srcIPv4Net")
public void enableSrcIPv4Net(IPv4Net srcIPv4Net) {
- this.srcIPv4Net = new Field<IPv4Net>(srcIPv4Net);
+ this.srcIPv4Net = new Field<IPv4Net>(srcIPv4Net);
}
/**
* Disable the matching on source IPv4 prefix.
*/
public void disableSrcIPv4Net() {
- this.srcIPv4Net = null;
+ this.srcIPv4Net = null;
}
/**
@@ -403,9 +407,9 @@
*/
@JsonProperty("matchSrcIPv4Net")
public boolean matchSrcIPv4Net() {
- if (srcIPv4Net != null)
- return srcIPv4Net.enabled();
- return false;
+ if (srcIPv4Net != null)
+ return srcIPv4Net.enabled();
+ return false;
}
/**
@@ -415,27 +419,27 @@
*/
@JsonProperty("dstIPv4Net")
public IPv4Net dstIPv4Net() {
- if (dstIPv4Net != null)
- return dstIPv4Net.value();
- return null;
+ if (dstIPv4Net != null)
+ return dstIPv4Net.value();
+ return null;
}
/**
* Enable the matching on destination IPv4 prefix.
*
* @param dstIPv4Net the destination IPv4 prefix value to enable for
- * matching.
+ * matching.
*/
@JsonProperty("dstIPv4Net")
public void enableDstIPv4Net(IPv4Net dstIPv4Net) {
- this.dstIPv4Net = new Field<IPv4Net>(dstIPv4Net);
+ this.dstIPv4Net = new Field<IPv4Net>(dstIPv4Net);
}
/**
* Disable the matching on destination IPv4 prefix.
*/
public void disableDstIPv4Net() {
- this.dstIPv4Net = null;
+ this.dstIPv4Net = null;
}
/**
@@ -445,9 +449,9 @@
*/
@JsonProperty("matchDstIPv4Net")
public boolean matchDstIPv4Net() {
- if (dstIPv4Net != null)
- return dstIPv4Net.enabled();
- return false;
+ if (dstIPv4Net != null)
+ return dstIPv4Net.enabled();
+ return false;
}
/**
@@ -457,9 +461,9 @@
*/
@JsonProperty("ipProto")
public Byte ipProto() {
- if (ipProto != null)
- return ipProto.value();
- return null;
+ if (ipProto != null)
+ return ipProto.value();
+ return null;
}
/**
@@ -469,14 +473,14 @@
*/
@JsonProperty("ipProto")
public void enableIpProto(Byte ipProto) {
- this.ipProto = new Field<Byte>(ipProto);
+ this.ipProto = new Field<Byte>(ipProto);
}
/**
* Disable the matching on IP protocol.
*/
public void disableIpProto() {
- this.ipProto = null;
+ this.ipProto = null;
}
/**
@@ -486,9 +490,9 @@
*/
@JsonProperty("matchIpProto")
public boolean matchIpProto() {
- if (ipProto != null)
- return ipProto.enabled();
- return false;
+ if (ipProto != null)
+ return ipProto.enabled();
+ return false;
}
/**
@@ -498,9 +502,9 @@
*/
@JsonProperty("ipToS")
public Byte ipToS() {
- if (ipToS != null)
- return ipToS.value();
- return null;
+ if (ipToS != null)
+ return ipToS.value();
+ return null;
}
/**
@@ -510,14 +514,14 @@
*/
@JsonProperty("ipToS")
public void enableIpToS(Byte ipToS) {
- this.ipToS = new Field<Byte>(ipToS);
+ this.ipToS = new Field<Byte>(ipToS);
}
/**
* Disable the matching on IP ToS (DSCP field, 6 bits).
*/
public void disableIpToS() {
- this.ipToS = null;
+ this.ipToS = null;
}
/**
@@ -527,9 +531,9 @@
*/
@JsonProperty("matchIpToS")
public boolean matchIpToS() {
- if (ipToS != null)
- return ipToS.enabled();
- return false;
+ if (ipToS != null)
+ return ipToS.enabled();
+ return false;
}
/**
@@ -539,9 +543,9 @@
*/
@JsonProperty("srcTcpUdpPort")
public Short srcTcpUdpPort() {
- if (srcTcpUdpPort != null)
- return srcTcpUdpPort.value();
- return null;
+ if (srcTcpUdpPort != null)
+ return srcTcpUdpPort.value();
+ return null;
}
/**
@@ -551,14 +555,14 @@
*/
@JsonProperty("srcTcpUdpPort")
public void enableSrcTcpUdpPort(Short srcTcpUdpPort) {
- this.srcTcpUdpPort = new Field<Short>(srcTcpUdpPort);
+ this.srcTcpUdpPort = new Field<Short>(srcTcpUdpPort);
}
/**
* Disable the matching on source TCP/UDP port.
*/
public void disableSrcTcpUdpPort() {
- this.srcTcpUdpPort = null;
+ this.srcTcpUdpPort = null;
}
/**
@@ -568,9 +572,9 @@
*/
@JsonProperty("matchSrcTcpUdpPort")
public boolean matchSrcTcpUdpPort() {
- if (srcTcpUdpPort != null)
- return srcTcpUdpPort.enabled();
- return false;
+ if (srcTcpUdpPort != null)
+ return srcTcpUdpPort.enabled();
+ return false;
}
/**
@@ -580,27 +584,27 @@
*/
@JsonProperty("dstTcpUdpPort")
public Short dstTcpUdpPort() {
- if (dstTcpUdpPort != null)
- return dstTcpUdpPort.value();
- return null;
+ if (dstTcpUdpPort != null)
+ return dstTcpUdpPort.value();
+ return null;
}
/**
* Enable the matching on destination TCP/UDP port.
*
* @param dstTcpUdpPort the destination TCP/UDP port to enable for
- * matching.
+ * matching.
*/
@JsonProperty("dstTcpUdpPort")
public void enableDstTcpUdpPort(Short dstTcpUdpPort) {
- this.dstTcpUdpPort = new Field<Short>(dstTcpUdpPort);
+ this.dstTcpUdpPort = new Field<Short>(dstTcpUdpPort);
}
/**
* Disable the matching on destination TCP/UDP port.
*/
public void disableDstTcpUdpPort() {
- this.dstTcpUdpPort = null;
+ this.dstTcpUdpPort = null;
}
/**
@@ -610,102 +614,102 @@
*/
@JsonProperty("matchDstTcpUdpPort")
public boolean matchDstTcpUdpPort() {
- if (dstTcpUdpPort != null)
- return dstTcpUdpPort.enabled();
- return false;
+ if (dstTcpUdpPort != null)
+ return dstTcpUdpPort.enabled();
+ return false;
}
/**
* Convert the matching filter to a string.
- *
+ * <p/>
* The string has the following form:
- * [srcMac=XXX dstMac=XXX srcIPv4Net=XXX dstIPv4Net=XXX]
+ * [srcMac=XXX dstMac=XXX srcIPv4Net=XXX dstIPv4Net=XXX]
*
* @return the matching filter as a string.
*/
@Override
public String toString() {
- String ret = "[";
- boolean addSpace = false;
+ String ret = "[";
+ boolean addSpace = false;
- //
- // Conditionally add only those matching fields that are enabled
- //
- if (matchInPort()) {
- if (addSpace)
- ret += " ";
- addSpace = true;
- ret += "inPort=" + this.inPort().toString();
- }
- if (matchSrcMac()) {
- if (addSpace)
- ret += " ";
- addSpace = true;
- ret += "srcMac=" + this.srcMac().toString();
- }
- if (matchDstMac()) {
- if (addSpace)
- ret += " ";
- addSpace = true;
- ret += "dstMac=" + this.dstMac().toString();
- }
- if (matchEthernetFrameType()) {
- if (addSpace)
- ret += " ";
- addSpace = true;
- ret += "ethernetFrameType=" + this.ethernetFrameType().toString();
- }
- if (matchVlanId()) {
- if (addSpace)
- ret += " ";
- addSpace = true;
- ret += "vlanId=" + this.vlanId().toString();
- }
- if (matchVlanPriority()) {
- if (addSpace)
- ret += " ";
- addSpace = true;
- ret += "vlanPriority=" + this.vlanPriority().toString();
- }
- if (matchSrcIPv4Net()) {
- if (addSpace)
- ret += " ";
- addSpace = true;
- ret += "srcIPv4Net=" + this.srcIPv4Net().toString();
- }
- if (matchDstIPv4Net()) {
- if (addSpace)
- ret += " ";
- addSpace = true;
- ret += "dstIPv4Net=" + this.dstIPv4Net().toString();
- }
- if (matchIpProto()) {
- if (addSpace)
- ret += " ";
- addSpace = true;
- ret += "ipProto=" + this.ipProto().toString();
- }
- if (matchIpToS()) {
- if (addSpace)
- ret += " ";
- addSpace = true;
- ret += "ipToS=" + this.ipToS().toString();
- }
- if (matchSrcTcpUdpPort()) {
- if (addSpace)
- ret += " ";
- addSpace = true;
- ret += "srcTcpUdpPort=" + this.srcTcpUdpPort().toString();
- }
- if (matchDstTcpUdpPort()) {
- if (addSpace)
- ret += " ";
- addSpace = true;
- ret += "dstTcpUdpPort=" + this.dstTcpUdpPort().toString();
- }
+ //
+ // Conditionally add only those matching fields that are enabled
+ //
+ if (matchInPort()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "inPort=" + this.inPort().toString();
+ }
+ if (matchSrcMac()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "srcMac=" + this.srcMac().toString();
+ }
+ if (matchDstMac()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "dstMac=" + this.dstMac().toString();
+ }
+ if (matchEthernetFrameType()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "ethernetFrameType=" + this.ethernetFrameType().toString();
+ }
+ if (matchVlanId()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "vlanId=" + this.vlanId().toString();
+ }
+ if (matchVlanPriority()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "vlanPriority=" + this.vlanPriority().toString();
+ }
+ if (matchSrcIPv4Net()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "srcIPv4Net=" + this.srcIPv4Net().toString();
+ }
+ if (matchDstIPv4Net()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "dstIPv4Net=" + this.dstIPv4Net().toString();
+ }
+ if (matchIpProto()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "ipProto=" + this.ipProto().toString();
+ }
+ if (matchIpToS()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "ipToS=" + this.ipToS().toString();
+ }
+ if (matchSrcTcpUdpPort()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "srcTcpUdpPort=" + this.srcTcpUdpPort().toString();
+ }
+ if (matchDstTcpUdpPort()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "dstTcpUdpPort=" + this.dstTcpUdpPort().toString();
+ }
- ret += "]";
+ ret += "]";
- return ret;
+ return ret;
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowEntrySwitchState.java b/src/main/java/net/onrc/onos/core/util/FlowEntrySwitchState.java
index c5a79de..754755a 100644
--- a/src/main/java/net/onrc/onos/core/util/FlowEntrySwitchState.java
+++ b/src/main/java/net/onrc/onos/core/util/FlowEntrySwitchState.java
@@ -4,9 +4,9 @@
* The Flow Entry state as set by the controller.
*/
public enum FlowEntrySwitchState {
- FE_SWITCH_UNKNOWN, // Initialization value: state unknown
- FE_SWITCH_NOT_UPDATED, // Switch not updated with this entry
- FE_SWITCH_UPDATE_IN_PROGRESS, // Switch update in progress
- FE_SWITCH_UPDATED, // Switch updated with this entry
- FE_SWITCH_UPDATE_FAILED // Error updating the switch with this entry
+ FE_SWITCH_UNKNOWN, // Initialization value: state unknown
+ FE_SWITCH_NOT_UPDATED, // Switch not updated with this entry
+ FE_SWITCH_UPDATE_IN_PROGRESS, // Switch update in progress
+ FE_SWITCH_UPDATED, // Switch updated with this entry
+ FE_SWITCH_UPDATE_FAILED // Error updating the switch with this entry
}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowEntryUserState.java b/src/main/java/net/onrc/onos/core/util/FlowEntryUserState.java
index 64d283a..8cad5d0 100644
--- a/src/main/java/net/onrc/onos/core/util/FlowEntryUserState.java
+++ b/src/main/java/net/onrc/onos/core/util/FlowEntryUserState.java
@@ -4,8 +4,8 @@
* The Flow Entry state as set by the user (via the ONOS API).
*/
public enum FlowEntryUserState {
- FE_USER_UNKNOWN, // Initialization value: state unknown
- FE_USER_ADD, // Flow entry that is added
- FE_USER_MODIFY, // Flow entry that is modified
- FE_USER_DELETE // Flow entry that is deleted
+ FE_USER_UNKNOWN, // Initialization value: state unknown
+ FE_USER_ADD, // Flow entry that is added
+ FE_USER_MODIFY, // Flow entry that is modified
+ FE_USER_DELETE // Flow entry that is deleted
}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowId.java b/src/main/java/net/onrc/onos/core/util/FlowId.java
index a6ceed8..c5ee39d 100644
--- a/src/main/java/net/onrc/onos/core/util/FlowId.java
+++ b/src/main/java/net/onrc/onos/core/util/FlowId.java
@@ -12,8 +12,8 @@
/**
* The class representing a Flow ID.
*/
-@JsonDeserialize(using=FlowIdDeserializer.class)
-@JsonSerialize(using=FlowIdSerializer.class)
+@JsonDeserialize(using = FlowIdDeserializer.class)
+@JsonSerialize(using = FlowIdSerializer.class)
public class FlowId implements Comparable<FlowId> {
private long value;
@@ -21,7 +21,7 @@
* Default constructor.
*/
public FlowId() {
- this.value = -1;
+ this.value = -1;
}
/**
@@ -30,7 +30,7 @@
* @param value the value to use.
*/
public FlowId(long value) {
- this.value = value;
+ this.value = value;
}
/**
@@ -39,17 +39,17 @@
* @param value the value to use.
*/
public FlowId(String value) {
- //
- // Use the help of BigInteger to parse strings representing
- // large unsigned hex long values.
- //
- char c = 0;
- if (value.length() > 2)
- c = value.charAt(1);
- if ((c == 'x') || (c == 'X'))
- this.value = new BigInteger(value.substring(2), 16).longValue();
- else
- this.value = Long.decode(value);
+ //
+ // Use the help of BigInteger to parse strings representing
+ // large unsigned hex long values.
+ //
+ char c = 0;
+ if (value.length() > 2)
+ c = value.charAt(1);
+ if ((c == 'x') || (c == 'X'))
+ this.value = new BigInteger(value.substring(2), 16).longValue();
+ else
+ this.value = Long.decode(value);
}
/**
@@ -57,7 +57,9 @@
*
* @return the value of the Flow ID.
*/
- public long value() { return value; }
+ public long value() {
+ return value;
+ }
/**
* Set the value of the Flow ID.
@@ -65,7 +67,7 @@
* @param value the value to set.
*/
public void setValue(long value) {
- this.value = value;
+ this.value = value;
}
/**
@@ -75,7 +77,7 @@
*/
@JsonIgnore
public boolean isValid() {
- return (this.value() != -1);
+ return (this.value() != -1);
}
/**
@@ -85,18 +87,18 @@
*/
@Override
public String toString() {
- return "0x" + Long.toHexString(this.value);
+ return "0x" + Long.toHexString(this.value);
}
/**
* Compare two FlowId objects numerically using their Flow IDs.
*
* @return the value 0 if the Flow ID is equal to the argument's Flow ID;
- * a value less than 0 if the Flow ID is numerically less than the argument's Flow ID;
- * and a value greater than 0 if the Flow ID is numerically greater than the argument's Flow ID.
+ * a value less than 0 if the Flow ID is numerically less than the argument's Flow ID;
+ * and a value greater than 0 if the Flow ID is numerically greater than the argument's Flow ID.
*/
- @Override
- public int compareTo(FlowId o) {
- return Long.valueOf(this.value).compareTo(o.value());
- }
+ @Override
+ public int compareTo(FlowId o) {
+ return Long.valueOf(this.value).compareTo(o.value());
+ }
}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowPath.java b/src/main/java/net/onrc/onos/core/util/FlowPath.java
index 2bb5ad3..fe51f08 100644
--- a/src/main/java/net/onrc/onos/core/util/FlowPath.java
+++ b/src/main/java/net/onrc/onos/core/util/FlowPath.java
@@ -9,32 +9,32 @@
* The class representing the Flow Path.
*/
public class FlowPath implements Comparable<FlowPath> {
- public static final int PRIORITY_DEFAULT = 32768; // Default Flow Priority
+ public static final int PRIORITY_DEFAULT = 32768; // Default Flow Priority
- private FlowId flowId; // The Flow ID
- private CallerId installerId; // The Caller ID of the path installer
- private FlowPathType flowPathType; // The Flow Path type
+ private FlowId flowId; // The Flow ID
+ private CallerId installerId; // The Caller ID of the path installer
+ private FlowPathType flowPathType; // The Flow Path type
private FlowPathUserState flowPathUserState; // The Flow Path User state
private FlowPathFlags flowPathFlags; // The Flow Path flags
- private int idleTimeout; // The Flow idle timeout
- private int hardTimeout; // The Flow hard timeout
- private int priority; // The Flow priority
- private DataPath dataPath; // The data path
+ private int idleTimeout; // The Flow idle timeout
+ private int hardTimeout; // The Flow hard timeout
+ private int priority; // The Flow priority
+ private DataPath dataPath; // The data path
private FlowEntryMatch flowEntryMatch; // Common Flow Entry Match for all
- // Flow Entries
+ // Flow Entries
private FlowEntryActions flowEntryActions; // The Flow Entry Actions for
- // the first Flow Entry
+ // the first Flow Entry
/**
* Default constructor.
*/
public FlowPath() {
- flowPathType = FlowPathType.FP_TYPE_UNKNOWN;
- flowPathUserState = FlowPathUserState.FP_USER_UNKNOWN;
- flowPathFlags = new FlowPathFlags();
- priority = FlowPath.PRIORITY_DEFAULT;
- dataPath = new DataPath();
- flowEntryActions = new FlowEntryActions();
+ flowPathType = FlowPathType.FP_TYPE_UNKNOWN;
+ flowPathUserState = FlowPathUserState.FP_USER_UNKNOWN;
+ flowPathFlags = new FlowPathFlags();
+ priority = FlowPath.PRIORITY_DEFAULT;
+ dataPath = new DataPath();
+ flowEntryActions = new FlowEntryActions();
}
/**
@@ -43,7 +43,9 @@
* @return the flow path Flow ID.
*/
@JsonProperty("flowId")
- public FlowId flowId() { return flowId; }
+ public FlowId flowId() {
+ return flowId;
+ }
/**
* Set the flow path Flow ID.
@@ -52,7 +54,7 @@
*/
@JsonProperty("flowId")
public void setFlowId(FlowId flowId) {
- this.flowId = flowId;
+ this.flowId = flowId;
}
/**
@@ -62,9 +64,9 @@
*/
@JsonIgnore
public boolean isValidFlowId() {
- if (this.flowId == null)
- return false;
- return (this.flowId.isValid());
+ if (this.flowId == null)
+ return false;
+ return (this.flowId.isValid());
}
/**
@@ -73,7 +75,9 @@
* @return the Caller ID of the flow path installer.
*/
@JsonProperty("installerId")
- public CallerId installerId() { return installerId; }
+ public CallerId installerId() {
+ return installerId;
+ }
/**
* Set the Caller ID of the flow path installer.
@@ -82,7 +86,7 @@
*/
@JsonProperty("installerId")
public void setInstallerId(CallerId installerId) {
- this.installerId = installerId;
+ this.installerId = installerId;
}
/**
@@ -91,7 +95,9 @@
* @return the flow path type.
*/
@JsonProperty("flowPathType")
- public FlowPathType flowPathType() { return flowPathType; }
+ public FlowPathType flowPathType() {
+ return flowPathType;
+ }
/**
* Set the flow path type.
@@ -100,7 +106,7 @@
*/
@JsonProperty("flowPathType")
public void setFlowPathType(FlowPathType flowPathType) {
- this.flowPathType = flowPathType;
+ this.flowPathType = flowPathType;
}
/**
@@ -109,7 +115,9 @@
* @return the flow path user state.
*/
@JsonProperty("flowPathUserState")
- public FlowPathUserState flowPathUserState() { return flowPathUserState; }
+ public FlowPathUserState flowPathUserState() {
+ return flowPathUserState;
+ }
/**
* Set the flow path user state.
@@ -118,7 +126,7 @@
*/
@JsonProperty("flowPathUserState")
public void setFlowPathUserState(FlowPathUserState flowPathUserState) {
- this.flowPathUserState = flowPathUserState;
+ this.flowPathUserState = flowPathUserState;
}
/**
@@ -127,7 +135,9 @@
* @return the flow path flags.
*/
@JsonProperty("flowPathFlags")
- public FlowPathFlags flowPathFlags() { return flowPathFlags; }
+ public FlowPathFlags flowPathFlags() {
+ return flowPathFlags;
+ }
/**
* Set the flow path flags.
@@ -136,23 +146,25 @@
*/
@JsonProperty("flowPathFlags")
public void setFlowPathFlags(FlowPathFlags flowPathFlags) {
- this.flowPathFlags = flowPathFlags;
+ this.flowPathFlags = flowPathFlags;
}
/**
* Get the flow idle timeout in seconds.
- *
+ * <p/>
* It should be an unsigned integer in the interval [0, 65535].
* If zero, the timeout is not set.
*
* @return the flow idle timeout.
*/
@JsonProperty("idleTimeout")
- public int idleTimeout() { return idleTimeout; }
+ public int idleTimeout() {
+ return idleTimeout;
+ }
/**
* Set the flow idle timeout in seconds.
- *
+ * <p/>
* It should be an unsigned integer in the interval [0, 65535].
* If zero, the timeout is not set.
*
@@ -160,23 +172,25 @@
*/
@JsonProperty("idleTimeout")
public void setIdleTimeout(int idleTimeout) {
- this.idleTimeout = 0xffff & idleTimeout;
+ this.idleTimeout = 0xffff & idleTimeout;
}
/**
* Get the flow hard timeout in seconds.
- *
+ * <p/>
* It should be an unsigned integer in the interval [0, 65535].
* If zero, the timeout is not set.
*
* @return the flow hard timeout.
*/
@JsonProperty("hardTimeout")
- public int hardTimeout() { return hardTimeout; }
+ public int hardTimeout() {
+ return hardTimeout;
+ }
/**
* Set the flow hard timeout.
- *
+ * <p/>
* It should be an unsigned integer in the interval [0, 65535].
* If zero, the timeout is not set.
*
@@ -184,29 +198,31 @@
*/
@JsonProperty("hardTimeout")
public void setHardTimeout(int hardTimeout) {
- this.hardTimeout = 0xffff & hardTimeout;
+ this.hardTimeout = 0xffff & hardTimeout;
}
/**
* Get the flow priority.
- *
+ * <p/>
* It should be an unsigned integer in the interval [0, 65535].
*
* @return the flow priority.
*/
@JsonProperty("priority")
- public int priority() { return priority; }
+ public int priority() {
+ return priority;
+ }
/**
* Set the flow priority.
- *
+ * <p/>
* It should be an unsigned integer in the interval [0, 65535].
*
* @param priority the flow priority to set.
*/
@JsonProperty("priority")
public void setPriority(int priority) {
- this.priority = 0xffff & priority;
+ this.priority = 0xffff & priority;
}
/**
@@ -215,7 +231,9 @@
* @return the flow path's data path.
*/
@JsonProperty("dataPath")
- public DataPath dataPath() { return dataPath; }
+ public DataPath dataPath() {
+ return dataPath;
+ }
/**
* Set the flow path's data path.
@@ -224,7 +242,7 @@
*/
@JsonProperty("dataPath")
public void setDataPath(DataPath dataPath) {
- this.dataPath = dataPath;
+ this.dataPath = dataPath;
}
/**
@@ -233,7 +251,7 @@
* @return the data path flow entries.
*/
public ArrayList<FlowEntry> flowEntries() {
- return this.dataPath.flowEntries();
+ return this.dataPath.flowEntries();
}
/**
@@ -242,17 +260,19 @@
* @return the flow path's match conditions common for all Flow Entries.
*/
@JsonProperty("flowEntryMatch")
- public FlowEntryMatch flowEntryMatch() { return flowEntryMatch; }
+ public FlowEntryMatch flowEntryMatch() {
+ return flowEntryMatch;
+ }
/**
* Set the flow path's match conditions common for all Flow Entries.
*
* @param flowEntryMatch the flow path's match conditions common for all
- * Flow Entries.
+ * Flow Entries.
*/
@JsonProperty("flowEntryMatch")
public void setFlowEntryMatch(FlowEntryMatch flowEntryMatch) {
- this.flowEntryMatch = flowEntryMatch;
+ this.flowEntryMatch = flowEntryMatch;
}
/**
@@ -262,55 +282,55 @@
*/
@JsonProperty("flowEntryActions")
public FlowEntryActions flowEntryActions() {
- return flowEntryActions;
+ return flowEntryActions;
}
/**
* Set the flow path's flow entry actions for the first Flow Entry.
*
* @param flowEntryActions the flow path's flow entry actions for the first
- * Flow Entry.
+ * Flow Entry.
*/
@JsonProperty("flowEntryActions")
public void setFlowEntryActions(FlowEntryActions flowEntryActions) {
- this.flowEntryActions = flowEntryActions;
+ this.flowEntryActions = flowEntryActions;
}
/**
* Convert the flow path to a string.
- *
+ * <p/>
* The string has the following form:
- * [flowId=XXX installerId=XXX flowPathType = XXX flowPathUserState = XXX
- * flowPathFlags=XXX idleTimeout=XXX hardTimeout=XXX priority=XXX
- * dataPath=XXX flowEntryMatch=XXX flowEntryActions=XXX]
+ * [flowId=XXX installerId=XXX flowPathType = XXX flowPathUserState = XXX
+ * flowPathFlags=XXX idleTimeout=XXX hardTimeout=XXX priority=XXX
+ * dataPath=XXX flowEntryMatch=XXX flowEntryActions=XXX]
*
* @return the flow path as a string.
*/
@Override
public String toString() {
- String ret = "[flowId=" + this.flowId.toString();
- ret += " installerId=" + this.installerId.toString();
- ret += " flowPathType=" + this.flowPathType;
- ret += " flowPathUserState=" + this.flowPathUserState;
- ret += " flowPathFlags=" + this.flowPathFlags.toString();
- ret += " idleTimeout=" + this.idleTimeout;
- ret += " hardTimeout=" + this.hardTimeout;
- ret += " priority=" + this.priority;
- if (dataPath != null)
- ret += " dataPath=" + this.dataPath.toString();
- if (flowEntryMatch != null)
- ret += " flowEntryMatch=" + this.flowEntryMatch.toString();
- if (flowEntryActions != null)
- ret += " flowEntryActions=" + this.flowEntryActions.toString();
- ret += "]";
- return ret;
+ String ret = "[flowId=" + this.flowId.toString();
+ ret += " installerId=" + this.installerId.toString();
+ ret += " flowPathType=" + this.flowPathType;
+ ret += " flowPathUserState=" + this.flowPathUserState;
+ ret += " flowPathFlags=" + this.flowPathFlags.toString();
+ ret += " idleTimeout=" + this.idleTimeout;
+ ret += " hardTimeout=" + this.hardTimeout;
+ ret += " priority=" + this.priority;
+ if (dataPath != null)
+ ret += " dataPath=" + this.dataPath.toString();
+ if (flowEntryMatch != null)
+ ret += " flowEntryMatch=" + this.flowEntryMatch.toString();
+ if (flowEntryActions != null)
+ ret += " flowEntryActions=" + this.flowEntryActions.toString();
+ ret += "]";
+ return ret;
}
-
+
/**
* CompareTo method to order flowPath by Id
*/
@Override
public int compareTo(FlowPath f) {
- return (int) (this.flowId.value() - f.flowId.value());
+ return (int) (this.flowId.value() - f.flowId.value());
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowPathFlags.java b/src/main/java/net/onrc/onos/core/util/FlowPathFlags.java
index b52d888..e1e67c5 100644
--- a/src/main/java/net/onrc/onos/core/util/FlowPathFlags.java
+++ b/src/main/java/net/onrc/onos/core/util/FlowPathFlags.java
@@ -9,7 +9,7 @@
private long flags;
// Discard the first-hop Flow Entry
- public static final long DISCARD_FIRST_HOP_ENTRY = (1 << 0);
+ public static final long DISCARD_FIRST_HOP_ENTRY = (1 << 0);
// Keep only the first-hop Flow Entry
public static final long KEEP_ONLY_FIRST_HOP_ENTRY = (1 << 1);
@@ -18,7 +18,7 @@
* Default constructor.
*/
public FlowPathFlags() {
- this.flags = 0;
+ this.flags = 0;
}
/**
@@ -27,18 +27,19 @@
* @param flags the flags value to set.
*/
public FlowPathFlags(long flags) {
- this.flags = flags;
+ this.flags = flags;
}
/**
* Constructor for given flags as a string.
- *
+ * <p/>
* The string value should contain the name of each flags to set. E.g.:
- * "DISCARD_FIRST_HOP_ENTRY,KEEP_ONLY_FIRST_HOP_ENTRY"
+ * "DISCARD_FIRST_HOP_ENTRY,KEEP_ONLY_FIRST_HOP_ENTRY"
+ *
* @param flagsStr the string value of the flags to set.
*/
public FlowPathFlags(String flagsStr) {
- this.setFlagsStr(flagsStr);
+ this.setFlagsStr(flagsStr);
}
/**
@@ -47,7 +48,9 @@
* @return the flags.
*/
@JsonProperty("flags")
- public long flags() { return flags; }
+ public long flags() {
+ return flags;
+ }
/**
* Set the flags.
@@ -56,25 +59,26 @@
*/
@JsonProperty("flags")
public void setFlags(long flags) {
- this.flags = flags;
+ this.flags = flags;
}
/**
* Set the flags as a string.
- *
+ * <p/>
* The string value should contain the name of each flags to set. E.g.:
- * "DISCARD_FIRST_HOP_ENTRY,KEEP_ONLY_FIRST_HOP_ENTRY"
+ * "DISCARD_FIRST_HOP_ENTRY,KEEP_ONLY_FIRST_HOP_ENTRY"
+ *
* @param flagsStr the string value of the flags to set.
*/
@JsonProperty("flagsStr")
public void setFlagsStr(String flagsStr) {
- this.flags = 0L;
+ this.flags = 0L;
- // Test all flags
- if (flagsStr.contains("DISCARD_FIRST_HOP_ENTRY"))
- this.flags |= DISCARD_FIRST_HOP_ENTRY;
- if (flagsStr.contains("KEEP_ONLY_FIRST_HOP_ENTRY"))
- this.flags |= KEEP_ONLY_FIRST_HOP_ENTRY;
+ // Test all flags
+ if (flagsStr.contains("DISCARD_FIRST_HOP_ENTRY"))
+ this.flags |= DISCARD_FIRST_HOP_ENTRY;
+ if (flagsStr.contains("KEEP_ONLY_FIRST_HOP_ENTRY"))
+ this.flags |= KEEP_ONLY_FIRST_HOP_ENTRY;
}
/**
@@ -84,7 +88,7 @@
* otherwise false.
*/
public boolean isDiscardFirstHopEntry() {
- return ((flags & DISCARD_FIRST_HOP_ENTRY) != 0);
+ return ((flags & DISCARD_FIRST_HOP_ENTRY) != 0);
}
/**
@@ -94,36 +98,36 @@
* otherwise false.
*/
public boolean isKeepOnlyFirstHopEntry() {
- return ((flags & KEEP_ONLY_FIRST_HOP_ENTRY) != 0);
+ return ((flags & KEEP_ONLY_FIRST_HOP_ENTRY) != 0);
}
/**
* Convert the Flow Path Flags to a string.
- *
+ * <p/>
* The string has the following form:
- * [flags=DISCARD_FIRST_HOP_ENTRY,KEEP_ONLY_FIRST_HOP_ENTRY]
+ * [flags=DISCARD_FIRST_HOP_ENTRY,KEEP_ONLY_FIRST_HOP_ENTRY]
*
* @return the Flow Path flags as a string.
*/
@Override
public String toString() {
- String flagsStr = null;
- String ret = "[flags=";
+ String flagsStr = null;
+ String ret = "[flags=";
- // Test all flags
- if ((this.flags & DISCARD_FIRST_HOP_ENTRY) != 0) {
- flagsStr += "DISCARD_FIRST_HOP_ENTRY";
- }
- if ((this.flags & KEEP_ONLY_FIRST_HOP_ENTRY) != 0) {
- if (flagsStr != null)
- flagsStr += ",";
- flagsStr += "KEEP_ONLY_FIRST_HOP_ENTRY";
- }
- if (flagsStr != null)
- ret += flagsStr;
- ret += "]";
+ // Test all flags
+ if ((this.flags & DISCARD_FIRST_HOP_ENTRY) != 0) {
+ flagsStr += "DISCARD_FIRST_HOP_ENTRY";
+ }
+ if ((this.flags & KEEP_ONLY_FIRST_HOP_ENTRY) != 0) {
+ if (flagsStr != null)
+ flagsStr += ",";
+ flagsStr += "KEEP_ONLY_FIRST_HOP_ENTRY";
+ }
+ if (flagsStr != null)
+ ret += flagsStr;
+ ret += "]";
- return ret;
+ return ret;
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowPathType.java b/src/main/java/net/onrc/onos/core/util/FlowPathType.java
index 4b1214e..f18938d 100644
--- a/src/main/java/net/onrc/onos/core/util/FlowPathType.java
+++ b/src/main/java/net/onrc/onos/core/util/FlowPathType.java
@@ -4,7 +4,7 @@
* The Flow Path types.
*/
public enum FlowPathType {
- FP_TYPE_UNKNOWN, // Initialization value: state unknown
- FP_TYPE_SHORTEST_PATH, // Shortest path flow
- FP_TYPE_EXPLICIT_PATH // Flow path with explicit flow entries
+ FP_TYPE_UNKNOWN, // Initialization value: state unknown
+ FP_TYPE_SHORTEST_PATH, // Shortest path flow
+ FP_TYPE_EXPLICIT_PATH // Flow path with explicit flow entries
}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowPathUserState.java b/src/main/java/net/onrc/onos/core/util/FlowPathUserState.java
index bc91c2a..4b637d1 100644
--- a/src/main/java/net/onrc/onos/core/util/FlowPathUserState.java
+++ b/src/main/java/net/onrc/onos/core/util/FlowPathUserState.java
@@ -4,8 +4,8 @@
* The Flow Path state as set by the user (via the ONOS API).
*/
public enum FlowPathUserState {
- FP_USER_UNKNOWN, // Initialization value: state unknown
- FP_USER_ADD, // Flow path that is added
- FP_USER_MODIFY, // Flow path that is modified
- FP_USER_DELETE // Flow path that is deleted
+ FP_USER_UNKNOWN, // Initialization value: state unknown
+ FP_USER_ADD, // Flow path that is added
+ FP_USER_MODIFY, // Flow path that is modified
+ FP_USER_DELETE // Flow path that is deleted
}
diff --git a/src/main/java/net/onrc/onos/core/util/IPv4.java b/src/main/java/net/onrc/onos/core/util/IPv4.java
index 86795aa..a7f3d24 100644
--- a/src/main/java/net/onrc/onos/core/util/IPv4.java
+++ b/src/main/java/net/onrc/onos/core/util/IPv4.java
@@ -9,8 +9,8 @@
/**
* The class representing an IPv4 address.
*/
-@JsonDeserialize(using=IPv4Deserializer.class)
-@JsonSerialize(using=IPv4Serializer.class)
+@JsonDeserialize(using = IPv4Deserializer.class)
+@JsonSerialize(using = IPv4Serializer.class)
public class IPv4 {
private int value;
@@ -18,7 +18,7 @@
* Default constructor.
*/
public IPv4() {
- this.value = 0;
+ this.value = 0;
}
/**
@@ -27,7 +27,7 @@
* @param other the object to copy from.
*/
public IPv4(IPv4 other) {
- this.value = other.value;
+ this.value = other.value;
}
/**
@@ -36,7 +36,7 @@
* @param value the value to use.
*/
public IPv4(int value) {
- this.value = value;
+ this.value = value;
}
/**
@@ -48,13 +48,13 @@
String[] splits = value.split("\\.");
if (splits.length != 4)
throw new IllegalArgumentException("Specified IPv4 address must contain four " +
- "numerical digits separated by '.'");
+ "numerical digits separated by '.'");
int result = 0;
for (int i = 0; i < 4; ++i) {
- result |= Integer.valueOf(splits[i]) << ((3-i)*8);
+ result |= Integer.valueOf(splits[i]) << ((3 - i) * 8);
}
- this.value = result;
+ this.value = result;
}
/**
@@ -62,7 +62,9 @@
*
* @return the value of the IPv4 address.
*/
- public int value() { return value; }
+ public int value() {
+ return value;
+ }
/**
* Set the value of the IPv4 address.
@@ -70,7 +72,7 @@
* @param value the value to set.
*/
public void setValue(int value) {
- this.value = value;
+ this.value = value;
}
/**
@@ -80,9 +82,9 @@
*/
@Override
public String toString() {
- return ((this.value >> 24) & 0xFF) + "." +
- ((this.value >> 16) & 0xFF) + "." +
- ((this.value >> 8) & 0xFF) + "." +
- (this.value & 0xFF);
+ return ((this.value >> 24) & 0xFF) + "." +
+ ((this.value >> 16) & 0xFF) + "." +
+ ((this.value >> 8) & 0xFF) + "." +
+ (this.value & 0xFF);
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/IPv4Net.java b/src/main/java/net/onrc/onos/core/util/IPv4Net.java
index 82f2fc6..3aa5a8b 100644
--- a/src/main/java/net/onrc/onos/core/util/IPv4Net.java
+++ b/src/main/java/net/onrc/onos/core/util/IPv4Net.java
@@ -9,17 +9,17 @@
/**
* The class representing an IPv4 network address.
*/
-@JsonDeserialize(using=IPv4NetDeserializer.class)
-@JsonSerialize(using=IPv4NetSerializer.class)
+@JsonDeserialize(using = IPv4NetDeserializer.class)
+@JsonSerialize(using = IPv4NetSerializer.class)
public class IPv4Net {
- private IPv4 address; // The IPv4 address
- private short prefixLen; // The prefix length
+ private IPv4 address; // The IPv4 address
+ private short prefixLen; // The prefix length
/**
* Default constructor.
*/
public IPv4Net() {
- this.prefixLen = 0;
+ this.prefixLen = 0;
}
/**
@@ -28,20 +28,20 @@
* @param other the object to copy from.
*/
public IPv4Net(IPv4Net other) {
- if (other.address != null)
- this.address = new IPv4(other.address);
- this.prefixLen = other.prefixLen;
+ if (other.address != null)
+ this.address = new IPv4(other.address);
+ this.prefixLen = other.prefixLen;
}
/**
* Constructor for a given address and prefix length.
*
- * @param address the address to use.
+ * @param address the address to use.
* @param prefixLen the prefix length to use.
*/
public IPv4Net(IPv4 address, short prefixLen) {
- this.address = address;
- this.prefixLen = prefixLen;
+ this.address = address;
+ this.prefixLen = prefixLen;
}
/**
@@ -50,13 +50,13 @@
* @param value the value to use.
*/
public IPv4Net(String value) {
- String[] splits = value.split("/");
- if (splits.length != 2) {
- throw new IllegalArgumentException("Specified IPv4Net address must contain an IPv4 " +
- "address and a prefix length separated by '/'");
- }
- this.address = new IPv4(splits[0]);
- this.prefixLen = Short.decode(splits[1]);
+ String[] splits = value.split("/");
+ if (splits.length != 2) {
+ throw new IllegalArgumentException("Specified IPv4Net address must contain an IPv4 " +
+ "address and a prefix length separated by '/'");
+ }
+ this.address = new IPv4(splits[0]);
+ this.prefixLen = Short.decode(splits[1]);
}
/**
@@ -64,7 +64,9 @@
*
* @return the address value of the IPv4Net address.
*/
- public IPv4 address() { return address; }
+ public IPv4 address() {
+ return address;
+ }
/**
* Set the address value of the IPv4Net address.
@@ -72,7 +74,7 @@
* @param address the address to use.
*/
public void setAddress(IPv4 address) {
- this.address = address;
+ this.address = address;
}
/**
@@ -80,7 +82,9 @@
*
* @return the prefix length value of the IPv4Net address.
*/
- public short prefixLen() { return prefixLen; }
+ public short prefixLen() {
+ return prefixLen;
+ }
/**
* Set the prefix length value of the IPv4Net address.
@@ -88,18 +92,18 @@
* @param prefixLen the prefix length to use.
*/
public void setPrefixLen(short prefixLen) {
- this.prefixLen = prefixLen;
+ this.prefixLen = prefixLen;
}
/**
* Set the value of the IPv4Net address.
*
- * @param address the address to use.
+ * @param address the address to use.
* @param prefixLen the prefix length to use.
*/
public void setValue(IPv4 address, short prefixLen) {
- this.address = address;
- this.prefixLen = prefixLen;
+ this.address = address;
+ this.prefixLen = prefixLen;
}
/**
@@ -109,6 +113,6 @@
*/
@Override
public String toString() {
- return this.address.toString() + "/" + this.prefixLen;
+ return this.address.toString() + "/" + this.prefixLen;
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/IPv6.java b/src/main/java/net/onrc/onos/core/util/IPv6.java
index 1648723..38a86b5 100644
--- a/src/main/java/net/onrc/onos/core/util/IPv6.java
+++ b/src/main/java/net/onrc/onos/core/util/IPv6.java
@@ -10,18 +10,18 @@
/**
* The class representing an IPv6 address.
*/
-@JsonDeserialize(using=IPv6Deserializer.class)
-@JsonSerialize(using=IPv6Serializer.class)
+@JsonDeserialize(using = IPv6Deserializer.class)
+@JsonSerialize(using = IPv6Serializer.class)
public class IPv6 {
- private long valueHigh; // The higher (more significant) 64 bits
- private long valueLow; // The lower (less significant) 64 bits
+ private long valueHigh; // The higher (more significant) 64 bits
+ private long valueLow; // The lower (less significant) 64 bits
/**
* Default constructor.
*/
public IPv6() {
- this.valueHigh = 0;
- this.valueLow = 0;
+ this.valueHigh = 0;
+ this.valueLow = 0;
}
/**
@@ -30,19 +30,19 @@
* @param other the object to copy from.
*/
public IPv6(IPv6 other) {
- this.valueHigh = other.valueHigh;
- this.valueLow = other.valueLow;
+ this.valueHigh = other.valueHigh;
+ this.valueLow = other.valueLow;
}
/**
* Constructor from integer values.
*
* @param valueHigh the higher (more significant) 64 bits of the address.
- * @param valueLow the lower (less significant) 64 bits of the address.
+ * @param valueLow the lower (less significant) 64 bits of the address.
*/
public IPv6(long valueHigh, long valueLow) {
- this.valueHigh = valueHigh;
- this.valueLow = valueLow;
+ this.valueHigh = valueHigh;
+ this.valueLow = valueLow;
}
/**
@@ -51,9 +51,9 @@
* @param value the value to use.
*/
public IPv6(String value) {
- // TODO: Implement it!
- this.valueHigh = 0;
- this.valueLow = 0;
+ // TODO: Implement it!
+ this.valueHigh = 0;
+ this.valueLow = 0;
}
/**
@@ -62,7 +62,9 @@
* @return the value of the higher (more significant) 64 bits of the
* address.
*/
- public long valueHigh() { return valueHigh; }
+ public long valueHigh() {
+ return valueHigh;
+ }
/**
* Set the value of the higher (more significant) 64 bits of the address.
@@ -70,7 +72,7 @@
* @param valueHigh the higher (more significant) 64 bits of the address.
*/
public void setValueHigh(long valueHigh) {
- this.valueHigh = valueHigh;
+ this.valueHigh = valueHigh;
}
/**
@@ -79,7 +81,9 @@
* @return the value of the lower (less significant) 64 bits of the
* address.
*/
- public long valueLow() { return valueLow; }
+ public long valueLow() {
+ return valueLow;
+ }
/**
* Get the value of the lower (less significant) 64 bits of the address.
@@ -87,18 +91,18 @@
* @param valueLow the lower (less significant) 64 bits of the address.
*/
public void setValueLow(long valueLow) {
- this.valueLow = valueLow;
+ this.valueLow = valueLow;
}
/**
* Set the value of the IPv6 address.
*
* @param valueHigh the higher (more significant) 64 bits of the address.
- * @param valueLow the lower (less significant) 64 bits of the address.
+ * @param valueLow the lower (less significant) 64 bits of the address.
*/
public void setValue(long valueHigh, long valueLow) {
- this.valueHigh = valueHigh;
- this.valueLow = valueLow;
+ this.valueHigh = valueHigh;
+ this.valueLow = valueLow;
}
/**
@@ -108,7 +112,7 @@
*/
@Override
public String toString() {
- return HexString.toHexString(this.valueHigh) + ":" +
- HexString.toHexString(this.valueLow);
+ return HexString.toHexString(this.valueHigh) + ":" +
+ HexString.toHexString(this.valueLow);
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/IPv6Net.java b/src/main/java/net/onrc/onos/core/util/IPv6Net.java
index 486f8e8..1faa7c5 100644
--- a/src/main/java/net/onrc/onos/core/util/IPv6Net.java
+++ b/src/main/java/net/onrc/onos/core/util/IPv6Net.java
@@ -9,17 +9,17 @@
/**
* The class representing an IPv6 network address.
*/
-@JsonDeserialize(using=IPv6NetDeserializer.class)
-@JsonSerialize(using=IPv6NetSerializer.class)
+@JsonDeserialize(using = IPv6NetDeserializer.class)
+@JsonSerialize(using = IPv6NetSerializer.class)
public class IPv6Net {
- private IPv6 address; // The IPv6 address
- private short prefixLen; // The prefix length
+ private IPv6 address; // The IPv6 address
+ private short prefixLen; // The prefix length
/**
* Default constructor.
*/
public IPv6Net() {
- this.prefixLen = 0;
+ this.prefixLen = 0;
}
/**
@@ -28,20 +28,20 @@
* @param other the object to copy from.
*/
public IPv6Net(IPv6Net other) {
- if (other.address != null)
- this.address = new IPv6(other.address);
- this.prefixLen = other.prefixLen;
+ if (other.address != null)
+ this.address = new IPv6(other.address);
+ this.prefixLen = other.prefixLen;
}
/**
* Constructor for a given address and prefix length.
*
- * @param address the address to use.
+ * @param address the address to use.
* @param prefixLen the prefix length to use.
*/
public IPv6Net(IPv6 address, short prefixLen) {
- this.address = address;
- this.prefixLen = prefixLen;
+ this.address = address;
+ this.prefixLen = prefixLen;
}
/**
@@ -50,13 +50,13 @@
* @param value the value to use.
*/
public IPv6Net(String value) {
- String[] splits = value.split("/");
- if (splits.length != 2) {
- throw new IllegalArgumentException("Specified IPv6Net address must contain an IPv6 " +
- "address and a prefix length separated by '/'");
- }
- this.address = new IPv6(splits[0]);
- this.prefixLen = Short.decode(splits[1]);
+ String[] splits = value.split("/");
+ if (splits.length != 2) {
+ throw new IllegalArgumentException("Specified IPv6Net address must contain an IPv6 " +
+ "address and a prefix length separated by '/'");
+ }
+ this.address = new IPv6(splits[0]);
+ this.prefixLen = Short.decode(splits[1]);
}
/**
@@ -64,7 +64,9 @@
*
* @return the address value of the IPv6Net address.
*/
- public IPv6 address() { return address; }
+ public IPv6 address() {
+ return address;
+ }
/**
* Set the address value of the IPv6Net address.
@@ -72,7 +74,7 @@
* @param address the address to use.
*/
public void setAddress(IPv6 address) {
- this.address = address;
+ this.address = address;
}
/**
@@ -80,7 +82,9 @@
*
* @return the prefix length value of the IPv6Net address.
*/
- public short prefixLen() { return prefixLen; }
+ public short prefixLen() {
+ return prefixLen;
+ }
/**
* Set the prefix length value of the IPv6Net address.
@@ -88,18 +92,18 @@
* @param prefixLen the prefix length to use.
*/
public void setPrefixLen(short prefixLen) {
- this.prefixLen = prefixLen;
+ this.prefixLen = prefixLen;
}
/**
* Set the value of the IPv6Net address.
*
- * @param address the address to use.
+ * @param address the address to use.
* @param prefixLen the prefix length to use.
*/
public void setValue(IPv6 address, short prefixLen) {
- this.address = address;
- this.prefixLen = prefixLen;
+ this.address = address;
+ this.prefixLen = prefixLen;
}
/**
@@ -109,6 +113,6 @@
*/
@Override
public String toString() {
- return this.address.toString() + "/" + this.prefixLen;
+ return this.address.toString() + "/" + this.prefixLen;
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/Pair.java b/src/main/java/net/onrc/onos/core/util/Pair.java
index 36a76bb..abf9fed 100644
--- a/src/main/java/net/onrc/onos/core/util/Pair.java
+++ b/src/main/java/net/onrc/onos/core/util/Pair.java
@@ -4,22 +4,22 @@
* A generic class representing a pair of two values.
*/
public class Pair<F, S> {
- public F first; // The first value in the pair
- public S second; // The second value in the pair
+ public F first; // The first value in the pair
+ public S second; // The second value in the pair
/**
* Constructor for a pair of two values.
*
- * @param first the first value in the pair.
+ * @param first the first value in the pair.
* @param second the second value in the pair.
*/
public Pair(F first, S second) {
- this.first = first;
- this.second = second;
+ this.first = first;
+ this.second = second;
}
@Override
public String toString() {
- return String.format("<%s, %s>", first, second);
+ return String.format("<%s, %s>", first, second);
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/PerformanceMonitor.java b/src/main/java/net/onrc/onos/core/util/PerformanceMonitor.java
index dd5e36f..b6cdd94 100644
--- a/src/main/java/net/onrc/onos/core/util/PerformanceMonitor.java
+++ b/src/main/java/net/onrc/onos/core/util/PerformanceMonitor.java
@@ -15,17 +15,18 @@
private final static Logger log = LoggerFactory.getLogger(PerformanceMonitor.class);
// experiment name -> PerformanceMonitor
- private static final ConcurrentHashMap<String,PerformanceMonitor> perfMons = new ConcurrentHashMap<>();
+ private static final ConcurrentHashMap<String, PerformanceMonitor> perfMons = new ConcurrentHashMap<>();
+
public static PerformanceMonitor experiment(String name) {
- PerformanceMonitor pm = perfMons.get(name);
- if (pm == null) {
- pm = new PerformanceMonitor();
- PerformanceMonitor existing = perfMons.putIfAbsent(name, pm);
- if (existing != null) {
- pm = existing;
- }
- }
- return pm;
+ PerformanceMonitor pm = perfMons.get(name);
+ if (pm == null) {
+ pm = new PerformanceMonitor();
+ PerformanceMonitor existing = perfMons.putIfAbsent(name, pm);
+ if (existing != null) {
+ pm = existing;
+ }
+ }
+ return pm;
}
// tag -> Measurements
@@ -36,111 +37,111 @@
/**
* Start a performance measurement, identified by a tag
- *
+ * <p/>
* Note: Only a single measurement can use the same tag at a time.
* ..... not true anymore.
*
* @param tag for performance measurement
*/
public Measurement startStep(String tag) {
- long start = System.nanoTime();
- if(start < experimentStart) {
- experimentStart = start;
- }
- Queue<Measurement> list = map.get(tag);
- if(list == null) {
- list = new ConcurrentLinkedQueue<Measurement>();
- Queue<Measurement> existing_list = map.putIfAbsent(tag, list);
- if (existing_list != null) {
- // someone concurrently added, using theirs
- list = existing_list;
- }
- }
- Measurement m = new Measurement();
- list.add(m);
- m.start();
- overhead += System.nanoTime() - start;
- return m;
+ long start = System.nanoTime();
+ if (start < experimentStart) {
+ experimentStart = start;
+ }
+ Queue<Measurement> list = map.get(tag);
+ if (list == null) {
+ list = new ConcurrentLinkedQueue<Measurement>();
+ Queue<Measurement> existing_list = map.putIfAbsent(tag, list);
+ if (existing_list != null) {
+ // someone concurrently added, using theirs
+ list = existing_list;
+ }
+ }
+ Measurement m = new Measurement();
+ list.add(m);
+ m.start();
+ overhead += System.nanoTime() - start;
+ return m;
}
/**
* Stop a performance measurement.
- *
+ * <p/>
* You must have already started a measurement with tag.
*
* @param tag for performance measurement
*/
public void stopStep(String tag) {
- long time = System.nanoTime();
- Queue<Measurement> list = map.get(tag);
- if(list == null || list.size() == 0) {
- log.error("Tag {} does not exist", tag);
- }
- list.peek().stop(time);
- if(list.size() > 1) {
- log.error("Tag {} has multiple measurements", tag);
- }
- overhead += System.nanoTime() - time;
+ long time = System.nanoTime();
+ Queue<Measurement> list = map.get(tag);
+ if (list == null || list.size() == 0) {
+ log.error("Tag {} does not exist", tag);
+ }
+ list.peek().stop(time);
+ if (list.size() > 1) {
+ log.error("Tag {} has multiple measurements", tag);
+ }
+ overhead += System.nanoTime() - time;
}
/**
* Clear all performance measurements.
*/
public void reset() {
- map.clear();
- overhead = 0;
- experimentStart = Long.MAX_VALUE;
+ map.clear();
+ overhead = 0;
+ experimentStart = Long.MAX_VALUE;
}
/**
* Write all performance measurements to the log
*/
public void reportAll() {
- String result = "Performance Results: (avg/start/stop/count)\n";
- if(map.size() == 0) {
- result += "No Measurements";
- log.error(result);
- return;
- }
- long experimentEnd = -1;
- for(Entry<String, Queue<Measurement>> e : map.entrySet()) {
- String key = e.getKey();
- Queue<Measurement> list = e.getValue();
- long total = 0, count = 0;
- long start = Long.MAX_VALUE, stop = -1;
- for(Measurement m : list) {
- if(m.stop < 0) {
- continue; // measurement has not been stopped
- }
- // Collect overall start and end times
- if(m.start < start) {
- start = m.start;
- }
- if(m.stop > stop) {
- stop = m.stop;
- if(stop > experimentEnd) {
- experimentEnd = stop;
- }
- }
- // Collect statistics for average
- total += m.elapsed();
- count++;
- }
- double avg = (double) total / count;
- // Normalize start/stop
- start -= experimentStart;
- stop -= experimentStart;
- result += key + '=' +
- (avg / normalization) + '/' +
- (start / normalization) + '/' +
- (stop / normalization) + '/' +
- count + '\n';
- }
- double overheadMs = overhead / normalization;
- double experimentElapsed = (experimentEnd - experimentStart) / normalization;
- result += "TotalTime:" + experimentElapsed + "/Overhead:" + overheadMs;
- log.error(result);
-// log.error("Performance Results: {} with measurement overhead: {} ms", map, overheadMilli);
+ String result = "Performance Results: (avg/start/stop/count)\n";
+ if (map.size() == 0) {
+ result += "No Measurements";
+ log.error(result);
+ return;
+ }
+ long experimentEnd = -1;
+ for (Entry<String, Queue<Measurement>> e : map.entrySet()) {
+ String key = e.getKey();
+ Queue<Measurement> list = e.getValue();
+ long total = 0, count = 0;
+ long start = Long.MAX_VALUE, stop = -1;
+ for (Measurement m : list) {
+ if (m.stop < 0) {
+ continue; // measurement has not been stopped
+ }
+ // Collect overall start and end times
+ if (m.start < start) {
+ start = m.start;
+ }
+ if (m.stop > stop) {
+ stop = m.stop;
+ if (stop > experimentEnd) {
+ experimentEnd = stop;
+ }
+ }
+ // Collect statistics for average
+ total += m.elapsed();
+ count++;
+ }
+ double avg = (double) total / count;
+ // Normalize start/stop
+ start -= experimentStart;
+ stop -= experimentStart;
+ result += key + '=' +
+ (avg / normalization) + '/' +
+ (start / normalization) + '/' +
+ (stop / normalization) + '/' +
+ count + '\n';
+ }
+ double overheadMs = overhead / normalization;
+ double experimentElapsed = (experimentEnd - experimentStart) / normalization;
+ result += "TotalTime:" + experimentElapsed + "/Overhead:" + overheadMs;
+ log.error(result);
+// log.error("Performance Results: {} with measurement overhead: {} ms", map, overheadMilli);
}
/**
@@ -149,79 +150,79 @@
* @param tag the tag name.
*/
public void reportStep(String tag) {
- Queue<Measurement> list = map.get(tag);
- if(list == null) {
- return; //TODO
- }
- //TODO: fix this;
- Measurement m = list.peek();
- if (m != null) {
- log.error("Performance Result: tag = {} start = {} stop = {} elapsed = {}",
- tag, m.start, m.stop, m.toString());
- } else {
- log.error("Performance Result: unknown tag {}", tag);
- }
+ Queue<Measurement> list = map.get(tag);
+ if (list == null) {
+ return; //TODO
+ }
+ //TODO: fix this;
+ Measurement m = list.peek();
+ if (m != null) {
+ log.error("Performance Result: tag = {} start = {} stop = {} elapsed = {}",
+ tag, m.start, m.stop, m.toString());
+ } else {
+ log.error("Performance Result: unknown tag {}", tag);
+ }
}
/**
* A single performance measurement
*/
public static class Measurement {
- long start;
- long stop = -1;
+ long start;
+ long stop = -1;
- /**
- * Start the measurement
- */
- public void start() {
- if(start <= 0) {
- start = System.nanoTime();
- }
- }
+ /**
+ * Start the measurement
+ */
+ public void start() {
+ if (start <= 0) {
+ start = System.nanoTime();
+ }
+ }
- /**
- * Stop the measurement
- */
- public void stop() {
- long now = System.nanoTime();
- stop(now);
- }
+ /**
+ * Stop the measurement
+ */
+ public void stop() {
+ long now = System.nanoTime();
+ stop(now);
+ }
- /**
- * Stop the measurement at a specific time
- * @param time to stop
- */
- public void stop(long time){
- if(stop <= 0) {
- stop = time;
- }
- }
+ /**
+ * Stop the measurement at a specific time
+ *
+ * @param time to stop
+ */
+ public void stop(long time) {
+ if (stop <= 0) {
+ stop = time;
+ }
+ }
- /**
- * Compute the elapsed time of the measurement in nanoseconds
- *
- * @return the measurement time in nanoseconds, or -1 if the measurement is stil running.
- */
- public long elapsed() {
- if(stop <= 0) {
- return -1;
- }
- else {
- return stop - start;
- }
- }
+ /**
+ * Compute the elapsed time of the measurement in nanoseconds
+ *
+ * @return the measurement time in nanoseconds, or -1 if the measurement is stil running.
+ */
+ public long elapsed() {
+ if (stop <= 0) {
+ return -1;
+ } else {
+ return stop - start;
+ }
+ }
- /**
- * Returns the number of milliseconds for the measurement as a String.
- */
- @Override
- public String toString() {
- double milli = elapsed() / normalization;
- double startMs = start / normalization;
- double stopMs = stop / normalization;
+ /**
+ * Returns the number of milliseconds for the measurement as a String.
+ */
+ @Override
+ public String toString() {
+ double milli = elapsed() / normalization;
+ double startMs = start / normalization;
+ double stopMs = stop / normalization;
- return milli + "ms/" + startMs + '/' + stopMs;
- }
+ return milli + "ms/" + startMs + '/' + stopMs;
+ }
}
@Deprecated
@@ -229,64 +230,87 @@
@Deprecated
public static Measurement start(String tag) {
- return theInstance.startStep(tag);
+ return theInstance.startStep(tag);
}
@Deprecated
public static void stop(String tag) {
- theInstance.stopStep(tag);;
+ theInstance.stopStep(tag);
+ ;
}
@Deprecated
public static void clear() {
- theInstance.reset();;
+ theInstance.reset();
+ ;
}
@Deprecated
public static void report() {
- theInstance.reportAll();;
+ theInstance.reportAll();
+ ;
}
@Deprecated
public static void report(String tag) {
- theInstance.reportStep(tag);
+ theInstance.reportStep(tag);
}
- public static void main(String args[]){
- // test the measurement overhead
- String tag;
- for(int i = 0; i < 2; i++){
- tag = "foo foo foo";
- Measurement m;
- m = start(tag); System.out.println(tag); m.stop();
- m = start(tag); System.out.println(tag); m.stop();
- m = start(tag); System.out.println(tag); m.stop();
- m = start(tag); System.out.println(tag); m.stop();
- tag = "bar";
- start(tag); stop(tag);
- tag = "baz";
- start(tag); stop(tag);
- report();
- clear();
- }
- for(int i = 0; i < 100; i++){
- tag = "a";
- start(tag); stop(tag);
- start(tag); stop(tag);
+ public static void main(String args[]) {
+ // test the measurement overhead
+ String tag;
+ for (int i = 0; i < 2; i++) {
+ tag = "foo foo foo";
+ Measurement m;
+ m = start(tag);
+ System.out.println(tag);
+ m.stop();
+ m = start(tag);
+ System.out.println(tag);
+ m.stop();
+ m = start(tag);
+ System.out.println(tag);
+ m.stop();
+ m = start(tag);
+ System.out.println(tag);
+ m.stop();
+ tag = "bar";
+ start(tag);
+ stop(tag);
+ tag = "baz";
+ start(tag);
+ stop(tag);
+ report();
+ clear();
+ }
+ for (int i = 0; i < 100; i++) {
+ tag = "a";
+ start(tag);
+ stop(tag);
+ start(tag);
+ stop(tag);
- start(tag); stop(tag);
- start(tag); stop(tag);
- start(tag); stop(tag);
- start(tag); stop(tag);
- start(tag); stop(tag);
- start(tag); stop(tag);
+ start(tag);
+ stop(tag);
+ start(tag);
+ stop(tag);
+ start(tag);
+ stop(tag);
+ start(tag);
+ stop(tag);
+ start(tag);
+ stop(tag);
+ start(tag);
+ stop(tag);
- tag = "b";
- start(tag); stop(tag);
- tag = "c";
- start(tag); stop(tag);
- report();
- clear();
- }
+ tag = "b";
+ start(tag);
+ stop(tag);
+ tag = "c";
+ start(tag);
+ stop(tag);
+ report();
+ clear();
+ }
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/Port.java b/src/main/java/net/onrc/onos/core/util/Port.java
index 722c802..77d983b 100644
--- a/src/main/java/net/onrc/onos/core/util/Port.java
+++ b/src/main/java/net/onrc/onos/core/util/Port.java
@@ -9,63 +9,65 @@
public class Port {
/**
* Special port values.
- *
+ * <p/>
* Those values are taken as-is from the OpenFlow-v1.0.0 specification
* (pp 18-19).
*/
public enum PortValues {
- /* Maximum number of physical switch ports. */
- PORT_MAX ((short)0xff00),
+ /* Maximum number of physical switch ports. */
+ PORT_MAX((short) 0xff00),
- /* Fake output "ports". */
+ /* Fake output "ports". */
- /* Send the packet out the input port. This
- virtual port must be explicitly used
- in order to send back out of the input
- port. */
- PORT_IN_PORT ((short)0xfff8),
+ /* Send the packet out the input port. This
+ virtual port must be explicitly used
+ in order to send back out of the input
+ port. */
+ PORT_IN_PORT((short) 0xfff8),
- /* Perform actions in flow table.
- NB: This can only be the destination
- port for packet-out messages. */
- PORT_TABLE ((short)0xfff9),
+ /* Perform actions in flow table.
+ NB: This can only be the destination
+ port for packet-out messages. */
+ PORT_TABLE((short) 0xfff9),
- /* Process with normal L2/L3 switching. */
- PORT_NORMAL ((short)0xfffa),
+ /* Process with normal L2/L3 switching. */
+ PORT_NORMAL((short) 0xfffa),
- /* All physical ports except input port and
- those disabled by STP. */
- PORT_FLOOD ((short)0xfffb),
+ /* All physical ports except input port and
+ those disabled by STP. */
+ PORT_FLOOD((short) 0xfffb),
- /* All physical ports except input port. */
- PORT_ALL ((short)0xfffc),
+ /* All physical ports except input port. */
+ PORT_ALL((short) 0xfffc),
- /* Send to controller. */
- PORT_CONTROLLER ((short)0xfffd),
+ /* Send to controller. */
+ PORT_CONTROLLER((short) 0xfffd),
- /* Local openflow "port". */
- PORT_LOCAL ((short)0xfffe),
+ /* Local openflow "port". */
+ PORT_LOCAL((short) 0xfffe),
- /* Not associated with a physical port. */
- PORT_NONE ((short)0xffff);
+ /* Not associated with a physical port. */
+ PORT_NONE((short) 0xffff);
- private final short value; // The value
+ private final short value; // The value
- /**
- * Constructor for a given value.
- *
- * @param value the value to use for the initialization.
- */
- private PortValues(short value) {
- this.value = value;
- }
+ /**
+ * Constructor for a given value.
+ *
+ * @param value the value to use for the initialization.
+ */
+ private PortValues(short value) {
+ this.value = value;
+ }
- /**
- * Get the value as a short integer.
- *
- * @return the value as a short integer.
- */
- private short value() { return this.value; }
+ /**
+ * Get the value as a short integer.
+ *
+ * @return the value as a short integer.
+ */
+ private short value() {
+ return this.value;
+ }
}
private short value;
@@ -74,7 +76,7 @@
* Default constructor.
*/
public Port() {
- this.value = 0;
+ this.value = 0;
}
/**
@@ -83,7 +85,7 @@
* @param other the object to copy from.
*/
public Port(Port other) {
- this.value = other.value();
+ this.value = other.value();
}
/**
@@ -92,7 +94,7 @@
* @param value the value to use.
*/
public Port(short value) {
- this.value = value;
+ this.value = value;
}
/**
@@ -101,7 +103,7 @@
* @param value the value to use.
*/
public Port(PortValues value) {
- this.value = value.value();
+ this.value = value.value();
}
/**
@@ -110,7 +112,9 @@
* @return the value of the port.
*/
@JsonProperty("value")
- public short value() { return value; }
+ public short value() {
+ return value;
+ }
/**
* Set the value of the port.
@@ -119,7 +123,7 @@
*/
@JsonProperty("value")
public void setValue(short value) {
- this.value = value;
+ this.value = value;
}
/**
@@ -129,25 +133,25 @@
*/
@Override
public String toString() {
- return Short.toString(this.value);
+ return Short.toString(this.value);
}
-
+
@Override
public boolean equals(Object other) {
- if (!(other instanceof Port)) {
- return false;
- }
+ if (!(other instanceof Port)) {
+ return false;
+ }
- Port otherPort = (Port) other;
+ Port otherPort = (Port) other;
- return value == otherPort.value;
+ return value == otherPort.value;
}
@Override
public int hashCode() {
- int hash = 17;
- hash += 31 * hash + (int)value;
- return hash;
+ int hash = 17;
+ hash += 31 * hash + (int) value;
+ return hash;
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/Switch.java b/src/main/java/net/onrc/onos/core/util/Switch.java
index e3c525f..d1a463c 100644
--- a/src/main/java/net/onrc/onos/core/util/Switch.java
+++ b/src/main/java/net/onrc/onos/core/util/Switch.java
@@ -11,44 +11,44 @@
* The Switch state.
*/
public enum SwitchState {
- INACTIVE,
- ACTIVE,
+ INACTIVE,
+ ACTIVE,
}
- private Dpid dpid; // The DPID of the switch
- private SwitchState state; // The state of the switch
+ private Dpid dpid; // The DPID of the switch
+ private SwitchState state; // The state of the switch
/**
* Default constructor.
- *
+ * <p/>
* NOTE: The default state for the switch is INACTIVE.
*/
public Switch() {
- this.dpid = new Dpid();
- this.state = SwitchState.INACTIVE;
+ this.dpid = new Dpid();
+ this.state = SwitchState.INACTIVE;
}
/**
* Constructor for a given DPID.
- *
+ * <p/>
* NOTE: The state for the switch with a given DPID is ACTIVE.
*
* @param dpid the DPID to use.
*/
public Switch(Dpid dpid) {
- this.dpid = dpid;
- this.state = SwitchState.ACTIVE;
+ this.dpid = dpid;
+ this.state = SwitchState.ACTIVE;
}
/**
* Constructor for a given DPID and Switch State.
*
- * @param dpid the DPID to use.
+ * @param dpid the DPID to use.
* @param state the Switch State to use.
*/
public Switch(Dpid dpid, SwitchState state) {
- this.dpid = dpid;
- this.state = state;
+ this.dpid = dpid;
+ this.state = state;
}
/**
@@ -57,7 +57,9 @@
* @return the DPID.
*/
@JsonProperty("dpid")
- public Dpid dpid() { return dpid; }
+ public Dpid dpid() {
+ return dpid;
+ }
/**
* Set the DPID.
@@ -66,7 +68,7 @@
*/
@JsonProperty("dpid")
public void setDpid(Dpid dpid) {
- this.dpid = dpid;
+ this.dpid = dpid;
}
/**
@@ -75,7 +77,9 @@
* @return the state.
*/
@JsonProperty("state")
- public SwitchState state() { return state; }
+ public SwitchState state() {
+ return state;
+ }
/**
* Set the state.
@@ -84,33 +88,33 @@
*/
@JsonProperty("state")
public void setState(SwitchState state) {
- this.state = state;
+ this.state = state;
}
/**
* Set the Switch State to ACTIVE.
*/
public void setStateActive() {
- this.state = SwitchState.ACTIVE;
+ this.state = SwitchState.ACTIVE;
}
/**
* Set the Switch State to INACTIVE.
*/
public void setStateInactive() {
- this.state = SwitchState.INACTIVE;
+ this.state = SwitchState.INACTIVE;
}
/**
* Convert the Switch value to a string.
- *
+ * <p/>
* The string has the following form:
- * dpid/state
+ * dpid/state
*
* @return the Switch value as a string.
*/
@Override
public String toString() {
- return this.dpid.toString() + "/" + this.state.toString();
+ return this.dpid.toString() + "/" + this.state.toString();
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/SwitchPort.java b/src/main/java/net/onrc/onos/core/util/SwitchPort.java
index edc8905..eb72b72 100644
--- a/src/main/java/net/onrc/onos/core/util/SwitchPort.java
+++ b/src/main/java/net/onrc/onos/core/util/SwitchPort.java
@@ -6,8 +6,8 @@
* The class representing a Switch-Port.
*/
public class SwitchPort {
- private Dpid dpid; // The DPID of the switch
- private Port port; // The port of the switch
+ private Dpid dpid; // The DPID of the switch
+ private Port port; // The port of the switch
/**
* Default constructor.
@@ -22,8 +22,8 @@
* @param port the port to use.
*/
public SwitchPort(Dpid dpid, Port port) {
- this.dpid = dpid;
- this.port = port;
+ this.dpid = dpid;
+ this.port = port;
}
/**
@@ -32,7 +32,9 @@
* @return the DPID value of the Switch-Port.
*/
@JsonProperty("dpid")
- public Dpid dpid() { return dpid; }
+ public Dpid dpid() {
+ return dpid;
+ }
/**
* Set the DPID value of the Switch-Port.
@@ -41,7 +43,7 @@
*/
@JsonProperty("dpid")
public void setDpid(Dpid dpid) {
- this.dpid = dpid;
+ this.dpid = dpid;
}
/**
@@ -50,7 +52,9 @@
* @return the port value of the Switch-Port.
*/
@JsonProperty("port")
- public Port port() { return port; }
+ public Port port() {
+ return port;
+ }
/**
* Set the port value of the Switch-Port.
@@ -59,7 +63,7 @@
*/
@JsonProperty("port")
public void setPort(Port port) {
- this.port = port;
+ this.port = port;
}
/**
@@ -69,41 +73,41 @@
* @param port the port to use.
*/
public void setValue(Dpid dpid, Port port) {
- this.dpid = dpid;
- this.port = port;
+ this.dpid = dpid;
+ this.port = port;
}
/**
* Convert the Switch-Port value to a string.
- *
+ * <p/>
* The string has the following form:
- * 01:02:03:04:05:06:07:08/1234
+ * 01:02:03:04:05:06:07:08/1234
*
* @return the Switch-Port value as a string.
*/
@Override
public String toString() {
- return this.dpid.toString() + "/" + this.port;
+ return this.dpid.toString() + "/" + this.port;
}
-
+
@Override
public boolean equals(Object other) {
- if (!(other instanceof SwitchPort)) {
- return false;
- }
+ if (!(other instanceof SwitchPort)) {
+ return false;
+ }
- SwitchPort otherSwitchPort = (SwitchPort) other;
+ SwitchPort otherSwitchPort = (SwitchPort) other;
- return (dpid.equals(otherSwitchPort.dpid) &&
- port.equals(otherSwitchPort.port));
+ return (dpid.equals(otherSwitchPort.dpid) &&
+ port.equals(otherSwitchPort.port));
}
@Override
public int hashCode() {
- int hash = 17;
- hash += 31 * hash + dpid.hashCode();
- hash += 31 * hash + port.hashCode();
- return hash;
+ int hash = 17;
+ hash += 31 * hash + dpid.hashCode();
+ hash += 31 * hash + port.hashCode();
+ return hash;
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/serializers/DpidDeserializer.java b/src/main/java/net/onrc/onos/core/util/serializers/DpidDeserializer.java
index 7a8c570..955f0ff 100644
--- a/src/main/java/net/onrc/onos/core/util/serializers/DpidDeserializer.java
+++ b/src/main/java/net/onrc/onos/core/util/serializers/DpidDeserializer.java
@@ -21,20 +21,20 @@
@Override
public Dpid deserialize(JsonParser jp,
- DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
+ DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
- Dpid dpid = null;
+ Dpid dpid = null;
- jp.nextToken(); // Move to JsonToken.START_OBJECT
- while (jp.nextToken() != JsonToken.END_OBJECT) {
- String fieldname = jp.getCurrentName();
- if ("value".equals(fieldname)) {
- String value = jp.getText();
- log.debug("Fieldname: {} Value: {}", fieldname, value);
- dpid = new Dpid(value);
- }
- }
- return dpid;
+ jp.nextToken(); // Move to JsonToken.START_OBJECT
+ while (jp.nextToken() != JsonToken.END_OBJECT) {
+ String fieldname = jp.getCurrentName();
+ if ("value".equals(fieldname)) {
+ String value = jp.getText();
+ log.debug("Fieldname: {} Value: {}", fieldname, value);
+ dpid = new Dpid(value);
+ }
+ }
+ return dpid;
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/serializers/DpidSerializer.java b/src/main/java/net/onrc/onos/core/util/serializers/DpidSerializer.java
index 4e784f2..68766f9 100644
--- a/src/main/java/net/onrc/onos/core/util/serializers/DpidSerializer.java
+++ b/src/main/java/net/onrc/onos/core/util/serializers/DpidSerializer.java
@@ -16,10 +16,10 @@
@Override
public void serialize(Dpid dpid, JsonGenerator jGen,
- SerializerProvider serializer)
- throws IOException, JsonProcessingException {
- jGen.writeStartObject();
- jGen.writeStringField("value", dpid.toString());
- jGen.writeEndObject();
+ SerializerProvider serializer)
+ throws IOException, JsonProcessingException {
+ jGen.writeStartObject();
+ jGen.writeStringField("value", dpid.toString());
+ jGen.writeEndObject();
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/serializers/FlowEntryIdDeserializer.java b/src/main/java/net/onrc/onos/core/util/serializers/FlowEntryIdDeserializer.java
index 712daa8..de13574 100644
--- a/src/main/java/net/onrc/onos/core/util/serializers/FlowEntryIdDeserializer.java
+++ b/src/main/java/net/onrc/onos/core/util/serializers/FlowEntryIdDeserializer.java
@@ -21,20 +21,20 @@
@Override
public FlowEntryId deserialize(JsonParser jp,
- DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
+ DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
- FlowEntryId flowEntryId = null;
+ FlowEntryId flowEntryId = null;
- jp.nextToken(); // Move to JsonToken.START_OBJECT
- while (jp.nextToken() != JsonToken.END_OBJECT) {
- String fieldname = jp.getCurrentName();
- if ("value".equals(fieldname)) {
- String value = jp.getText();
- log.debug("Fieldname: " + fieldname + " Value: " + value);
- flowEntryId = new FlowEntryId(value);
- }
- }
- return flowEntryId;
+ jp.nextToken(); // Move to JsonToken.START_OBJECT
+ while (jp.nextToken() != JsonToken.END_OBJECT) {
+ String fieldname = jp.getCurrentName();
+ if ("value".equals(fieldname)) {
+ String value = jp.getText();
+ log.debug("Fieldname: " + fieldname + " Value: " + value);
+ flowEntryId = new FlowEntryId(value);
+ }
+ }
+ return flowEntryId;
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/serializers/FlowEntryIdSerializer.java b/src/main/java/net/onrc/onos/core/util/serializers/FlowEntryIdSerializer.java
index 3911a4c..bc91f46 100644
--- a/src/main/java/net/onrc/onos/core/util/serializers/FlowEntryIdSerializer.java
+++ b/src/main/java/net/onrc/onos/core/util/serializers/FlowEntryIdSerializer.java
@@ -16,8 +16,8 @@
@Override
public void serialize(FlowEntryId flowEntryId, JsonGenerator jGen,
- SerializerProvider serializer)
- throws IOException, JsonProcessingException {
- jGen.writeString(flowEntryId.toString());
+ SerializerProvider serializer)
+ throws IOException, JsonProcessingException {
+ jGen.writeString(flowEntryId.toString());
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/serializers/FlowIdDeserializer.java b/src/main/java/net/onrc/onos/core/util/serializers/FlowIdDeserializer.java
index d1b91a8..12c5cbd 100644
--- a/src/main/java/net/onrc/onos/core/util/serializers/FlowIdDeserializer.java
+++ b/src/main/java/net/onrc/onos/core/util/serializers/FlowIdDeserializer.java
@@ -21,20 +21,20 @@
@Override
public FlowId deserialize(JsonParser jp,
- DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
+ DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
- FlowId flowId = null;
+ FlowId flowId = null;
- jp.nextToken(); // Move to JsonToken.START_OBJECT
- while (jp.nextToken() != JsonToken.END_OBJECT) {
- String fieldname = jp.getCurrentName();
- if ("value".equals(fieldname)) {
- String value = jp.getText();
- log.debug("Fieldname: {} Value: {}", fieldname, value);
- flowId = new FlowId(value);
- }
- }
- return flowId;
+ jp.nextToken(); // Move to JsonToken.START_OBJECT
+ while (jp.nextToken() != JsonToken.END_OBJECT) {
+ String fieldname = jp.getCurrentName();
+ if ("value".equals(fieldname)) {
+ String value = jp.getText();
+ log.debug("Fieldname: {} Value: {}", fieldname, value);
+ flowId = new FlowId(value);
+ }
+ }
+ return flowId;
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/serializers/FlowIdSerializer.java b/src/main/java/net/onrc/onos/core/util/serializers/FlowIdSerializer.java
index b0d020e..37a3e45 100644
--- a/src/main/java/net/onrc/onos/core/util/serializers/FlowIdSerializer.java
+++ b/src/main/java/net/onrc/onos/core/util/serializers/FlowIdSerializer.java
@@ -16,10 +16,10 @@
@Override
public void serialize(FlowId flowId, JsonGenerator jGen,
- SerializerProvider serializer)
- throws IOException, JsonProcessingException {
- jGen.writeStartObject();
- jGen.writeStringField("value", flowId.toString());
- jGen.writeEndObject();
+ SerializerProvider serializer)
+ throws IOException, JsonProcessingException {
+ jGen.writeStartObject();
+ jGen.writeStringField("value", flowId.toString());
+ jGen.writeEndObject();
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/serializers/IPv4Deserializer.java b/src/main/java/net/onrc/onos/core/util/serializers/IPv4Deserializer.java
index 2992bfd..f58f746 100644
--- a/src/main/java/net/onrc/onos/core/util/serializers/IPv4Deserializer.java
+++ b/src/main/java/net/onrc/onos/core/util/serializers/IPv4Deserializer.java
@@ -21,20 +21,20 @@
@Override
public IPv4 deserialize(JsonParser jp,
- DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
+ DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
- IPv4 ipv4 = null;
+ IPv4 ipv4 = null;
- jp.nextToken(); // Move to JsonToken.START_OBJECT
- while (jp.nextToken() != JsonToken.END_OBJECT) {
- String fieldname = jp.getCurrentName();
- if ("value".equals(fieldname)) {
- String value = jp.getText();
- log.debug("Fieldname: {} Value: {}", fieldname, value);
- ipv4 = new IPv4(value);
- }
- }
- return ipv4;
+ jp.nextToken(); // Move to JsonToken.START_OBJECT
+ while (jp.nextToken() != JsonToken.END_OBJECT) {
+ String fieldname = jp.getCurrentName();
+ if ("value".equals(fieldname)) {
+ String value = jp.getText();
+ log.debug("Fieldname: {} Value: {}", fieldname, value);
+ ipv4 = new IPv4(value);
+ }
+ }
+ return ipv4;
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/serializers/IPv4NetDeserializer.java b/src/main/java/net/onrc/onos/core/util/serializers/IPv4NetDeserializer.java
index 68f74c4..da68668 100644
--- a/src/main/java/net/onrc/onos/core/util/serializers/IPv4NetDeserializer.java
+++ b/src/main/java/net/onrc/onos/core/util/serializers/IPv4NetDeserializer.java
@@ -21,20 +21,20 @@
@Override
public IPv4Net deserialize(JsonParser jp,
- DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
+ DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
- IPv4Net ipv4Net = null;
+ IPv4Net ipv4Net = null;
- jp.nextToken(); // Move to JsonToken.START_OBJECT
- while (jp.nextToken() != JsonToken.END_OBJECT) {
- String fieldname = jp.getCurrentName();
- if ("value".equals(fieldname)) {
- String value = jp.getText();
- log.debug("Fieldname: {} Value: {}", fieldname, value);
- ipv4Net = new IPv4Net(value);
- }
- }
- return ipv4Net;
+ jp.nextToken(); // Move to JsonToken.START_OBJECT
+ while (jp.nextToken() != JsonToken.END_OBJECT) {
+ String fieldname = jp.getCurrentName();
+ if ("value".equals(fieldname)) {
+ String value = jp.getText();
+ log.debug("Fieldname: {} Value: {}", fieldname, value);
+ ipv4Net = new IPv4Net(value);
+ }
+ }
+ return ipv4Net;
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/serializers/IPv4NetSerializer.java b/src/main/java/net/onrc/onos/core/util/serializers/IPv4NetSerializer.java
index 697f846..f44aeb3 100644
--- a/src/main/java/net/onrc/onos/core/util/serializers/IPv4NetSerializer.java
+++ b/src/main/java/net/onrc/onos/core/util/serializers/IPv4NetSerializer.java
@@ -16,10 +16,10 @@
@Override
public void serialize(IPv4Net ipv4Net, JsonGenerator jGen,
- SerializerProvider serializer)
- throws IOException, JsonProcessingException {
- jGen.writeStartObject();
- jGen.writeStringField("value", ipv4Net.toString());
- jGen.writeEndObject();
+ SerializerProvider serializer)
+ throws IOException, JsonProcessingException {
+ jGen.writeStartObject();
+ jGen.writeStringField("value", ipv4Net.toString());
+ jGen.writeEndObject();
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/serializers/IPv4Serializer.java b/src/main/java/net/onrc/onos/core/util/serializers/IPv4Serializer.java
index 773fd1d..37a5564 100644
--- a/src/main/java/net/onrc/onos/core/util/serializers/IPv4Serializer.java
+++ b/src/main/java/net/onrc/onos/core/util/serializers/IPv4Serializer.java
@@ -16,10 +16,10 @@
@Override
public void serialize(IPv4 ipv4, JsonGenerator jGen,
- SerializerProvider serializer)
- throws IOException, JsonProcessingException {
- jGen.writeStartObject();
- jGen.writeStringField("value", ipv4.toString());
- jGen.writeEndObject();
+ SerializerProvider serializer)
+ throws IOException, JsonProcessingException {
+ jGen.writeStartObject();
+ jGen.writeStringField("value", ipv4.toString());
+ jGen.writeEndObject();
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/serializers/IPv6Deserializer.java b/src/main/java/net/onrc/onos/core/util/serializers/IPv6Deserializer.java
index 6627d2a..3b9673a 100644
--- a/src/main/java/net/onrc/onos/core/util/serializers/IPv6Deserializer.java
+++ b/src/main/java/net/onrc/onos/core/util/serializers/IPv6Deserializer.java
@@ -21,20 +21,20 @@
@Override
public IPv6 deserialize(JsonParser jp,
- DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
+ DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
- IPv6 ipv6 = null;
+ IPv6 ipv6 = null;
- jp.nextToken(); // Move to JsonToken.START_OBJECT
- while (jp.nextToken() != JsonToken.END_OBJECT) {
- String fieldname = jp.getCurrentName();
- if ("value".equals(fieldname)) {
- String value = jp.getText();
- log.debug("Fieldname: {} Value: {}", fieldname, value);
- ipv6 = new IPv6(value);
- }
- }
- return ipv6;
+ jp.nextToken(); // Move to JsonToken.START_OBJECT
+ while (jp.nextToken() != JsonToken.END_OBJECT) {
+ String fieldname = jp.getCurrentName();
+ if ("value".equals(fieldname)) {
+ String value = jp.getText();
+ log.debug("Fieldname: {} Value: {}", fieldname, value);
+ ipv6 = new IPv6(value);
+ }
+ }
+ return ipv6;
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/serializers/IPv6NetDeserializer.java b/src/main/java/net/onrc/onos/core/util/serializers/IPv6NetDeserializer.java
index 08b8018..2b80984 100644
--- a/src/main/java/net/onrc/onos/core/util/serializers/IPv6NetDeserializer.java
+++ b/src/main/java/net/onrc/onos/core/util/serializers/IPv6NetDeserializer.java
@@ -21,20 +21,20 @@
@Override
public IPv6Net deserialize(JsonParser jp,
- DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
+ DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
- IPv6Net ipv6Net = null;
+ IPv6Net ipv6Net = null;
- jp.nextToken(); // Move to JsonToken.START_OBJECT
- while (jp.nextToken() != JsonToken.END_OBJECT) {
- String fieldname = jp.getCurrentName();
- if ("value".equals(fieldname)) {
- String value = jp.getText();
- log.debug("Fieldname: {} Value: {}", fieldname, value);
- ipv6Net = new IPv6Net(value);
- }
- }
- return ipv6Net;
+ jp.nextToken(); // Move to JsonToken.START_OBJECT
+ while (jp.nextToken() != JsonToken.END_OBJECT) {
+ String fieldname = jp.getCurrentName();
+ if ("value".equals(fieldname)) {
+ String value = jp.getText();
+ log.debug("Fieldname: {} Value: {}", fieldname, value);
+ ipv6Net = new IPv6Net(value);
+ }
+ }
+ return ipv6Net;
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/serializers/IPv6NetSerializer.java b/src/main/java/net/onrc/onos/core/util/serializers/IPv6NetSerializer.java
index 99bd654..690b17f 100644
--- a/src/main/java/net/onrc/onos/core/util/serializers/IPv6NetSerializer.java
+++ b/src/main/java/net/onrc/onos/core/util/serializers/IPv6NetSerializer.java
@@ -16,10 +16,10 @@
@Override
public void serialize(IPv6Net ipv6Net, JsonGenerator jGen,
- SerializerProvider serializer)
- throws IOException, JsonProcessingException {
- jGen.writeStartObject();
- jGen.writeStringField("value", ipv6Net.toString());
- jGen.writeEndObject();
+ SerializerProvider serializer)
+ throws IOException, JsonProcessingException {
+ jGen.writeStartObject();
+ jGen.writeStringField("value", ipv6Net.toString());
+ jGen.writeEndObject();
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/serializers/IPv6Serializer.java b/src/main/java/net/onrc/onos/core/util/serializers/IPv6Serializer.java
index b165658..ed39fee 100644
--- a/src/main/java/net/onrc/onos/core/util/serializers/IPv6Serializer.java
+++ b/src/main/java/net/onrc/onos/core/util/serializers/IPv6Serializer.java
@@ -16,10 +16,10 @@
@Override
public void serialize(IPv6 ipv6, JsonGenerator jGen,
- SerializerProvider serializer)
- throws IOException, JsonProcessingException {
- jGen.writeStartObject();
- jGen.writeStringField("value", ipv6.toString());
- jGen.writeEndObject();
+ SerializerProvider serializer)
+ throws IOException, JsonProcessingException {
+ jGen.writeStartObject();
+ jGen.writeStringField("value", ipv6.toString());
+ jGen.writeEndObject();
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/serializers/KryoFactory.java b/src/main/java/net/onrc/onos/core/util/serializers/KryoFactory.java
index 3590f67..e78be58 100644
--- a/src/main/java/net/onrc/onos/core/util/serializers/KryoFactory.java
+++ b/src/main/java/net/onrc/onos/core/util/serializers/KryoFactory.java
@@ -62,7 +62,7 @@
/**
* Default constructor.
- *
+ * <p/>
* Preallocates {@code DEFAULT_PREALLOCATIONS} Kryo instances.
*/
public KryoFactory() {
@@ -89,7 +89,7 @@
* @return the created Kryo object.
*/
public Kryo newKryo() {
- return newDeleteKryo(null);
+ return newDeleteKryo(null);
}
/**
@@ -98,34 +98,34 @@
* @param deleteKryo the object to delete.
*/
public void deleteKryo(Kryo deleteKryo) {
- newDeleteKryo(deleteKryo);
+ newDeleteKryo(deleteKryo);
}
/**
* Create or delete a Kryo object.
*
* @param deleteKryo if null, then allocate and return a new object,
- * otherwise delete the provided object.
+ * otherwise delete the provided object.
* @return a new Kryo object if needed, otherwise null.
*/
synchronized private Kryo newDeleteKryo(Kryo deleteKryo) {
- if (deleteKryo != null) {
- // Delete an entry by moving it back to the buffer
- kryoList.add(deleteKryo);
- return null;
- } else {
- Kryo kryo = null;
- if (kryoList.isEmpty()) {
- // Preallocate
- for (int i = 0; i < 100; i++) {
- kryo = newKryoImpl();
- kryoList.add(kryo);
- }
- }
+ if (deleteKryo != null) {
+ // Delete an entry by moving it back to the buffer
+ kryoList.add(deleteKryo);
+ return null;
+ } else {
+ Kryo kryo = null;
+ if (kryoList.isEmpty()) {
+ // Preallocate
+ for (int i = 0; i < 100; i++) {
+ kryo = newKryoImpl();
+ kryoList.add(kryo);
+ }
+ }
- kryo = kryoList.remove(kryoList.size() - 1);
- return kryo;
- }
+ kryo = kryoList.remove(kryoList.size() - 1);
+ return kryo;
+ }
}
/**
@@ -134,91 +134,91 @@
* @return the created Kryo object.
*/
private Kryo newKryoImpl() {
- Kryo kryo = new Kryo();
- kryo.setRegistrationRequired(true);
- //
- // WARNING: Order of register() calls affects serialized bytes.
- // - Do no insert new entry in the middle, always add to the end.
- // - Do not simply remove existing entry
- //
+ Kryo kryo = new Kryo();
+ kryo.setRegistrationRequired(true);
+ //
+ // WARNING: Order of register() calls affects serialized bytes.
+ // - Do no insert new entry in the middle, always add to the end.
+ // - Do not simply remove existing entry
+ //
- // kryo.setReferences(false);
- //
- kryo.register(ArrayList.class);
+ // kryo.setReferences(false);
+ //
+ kryo.register(ArrayList.class);
- // FlowPath and related classes
- kryo.register(CallerId.class);
- kryo.register(DataPath.class);
- kryo.register(DataPathEndpoints.class);
- kryo.register(Dpid.class);
- kryo.register(FlowEntryAction.class);
- kryo.register(FlowEntryAction.ActionEnqueue.class);
- kryo.register(FlowEntryAction.ActionOutput.class);
- kryo.register(FlowEntryAction.ActionSetEthernetAddr.class);
- kryo.register(FlowEntryAction.ActionSetIpToS.class);
- kryo.register(FlowEntryAction.ActionSetIPv4Addr.class);
- kryo.register(FlowEntryAction.ActionSetTcpUdpPort.class);
- kryo.register(FlowEntryAction.ActionSetVlanId.class);
- kryo.register(FlowEntryAction.ActionSetVlanPriority.class);
- kryo.register(FlowEntryAction.ActionStripVlan.class);
- kryo.register(FlowEntryAction.ActionValues.class);
- kryo.register(FlowEntryActions.class);
- kryo.register(FlowEntryErrorState.class);
- kryo.register(FlowEntryId.class);
- kryo.register(FlowEntry.class);
- kryo.register(FlowEntryMatch.class);
- kryo.register(FlowEntryMatch.Field.class);
- kryo.register(FlowEntrySwitchState.class);
- kryo.register(FlowEntryUserState.class);
- kryo.register(FlowId.class);
- kryo.register(FlowPath.class);
- kryo.register(FlowPathFlags.class);
- kryo.register(FlowPathType.class);
- kryo.register(FlowPathUserState.class);
- kryo.register(IPv4.class);
- kryo.register(IPv4Net.class);
- kryo.register(IPv6.class);
- kryo.register(IPv6Net.class);
- kryo.register(byte[].class);
- kryo.register(MACAddress.class);
- kryo.register(Port.class);
- kryo.register(Switch.class);
- // kryo.register(SwitchPort.class);
+ // FlowPath and related classes
+ kryo.register(CallerId.class);
+ kryo.register(DataPath.class);
+ kryo.register(DataPathEndpoints.class);
+ kryo.register(Dpid.class);
+ kryo.register(FlowEntryAction.class);
+ kryo.register(FlowEntryAction.ActionEnqueue.class);
+ kryo.register(FlowEntryAction.ActionOutput.class);
+ kryo.register(FlowEntryAction.ActionSetEthernetAddr.class);
+ kryo.register(FlowEntryAction.ActionSetIpToS.class);
+ kryo.register(FlowEntryAction.ActionSetIPv4Addr.class);
+ kryo.register(FlowEntryAction.ActionSetTcpUdpPort.class);
+ kryo.register(FlowEntryAction.ActionSetVlanId.class);
+ kryo.register(FlowEntryAction.ActionSetVlanPriority.class);
+ kryo.register(FlowEntryAction.ActionStripVlan.class);
+ kryo.register(FlowEntryAction.ActionValues.class);
+ kryo.register(FlowEntryActions.class);
+ kryo.register(FlowEntryErrorState.class);
+ kryo.register(FlowEntryId.class);
+ kryo.register(FlowEntry.class);
+ kryo.register(FlowEntryMatch.class);
+ kryo.register(FlowEntryMatch.Field.class);
+ kryo.register(FlowEntrySwitchState.class);
+ kryo.register(FlowEntryUserState.class);
+ kryo.register(FlowId.class);
+ kryo.register(FlowPath.class);
+ kryo.register(FlowPathFlags.class);
+ kryo.register(FlowPathType.class);
+ kryo.register(FlowPathUserState.class);
+ kryo.register(IPv4.class);
+ kryo.register(IPv4Net.class);
+ kryo.register(IPv6.class);
+ kryo.register(IPv6Net.class);
+ kryo.register(byte[].class);
+ kryo.register(MACAddress.class);
+ kryo.register(Port.class);
+ kryo.register(Switch.class);
+ // kryo.register(SwitchPort.class);
- // New data model-related classes
- kryo.register(DeviceEvent.class);
- kryo.register(InetAddress.class);
- kryo.register(LinkEvent.class);
- kryo.register(PortEvent.class);
- kryo.register(PortEvent.SwitchPort.class);
- kryo.register(SwitchEvent.class);
- kryo.register(TopologyEvent.class);
+ // New data model-related classes
+ kryo.register(DeviceEvent.class);
+ kryo.register(InetAddress.class);
+ kryo.register(LinkEvent.class);
+ kryo.register(PortEvent.class);
+ kryo.register(PortEvent.SwitchPort.class);
+ kryo.register(SwitchEvent.class);
+ kryo.register(TopologyEvent.class);
- // Intent-related classes
- kryo.register(Path.class);
- kryo.register(Intent.class);
- kryo.register(Intent.IntentState.class);
- kryo.register(PathIntent.class);
- kryo.register(ShortestPathIntent.class);
- kryo.register(ConstrainedShortestPathIntent.class);
- kryo.register(ErrorIntent.class);
- kryo.register(ErrorIntent.ErrorType.class);
- kryo.register(IntentOperation.class);
- kryo.register(IntentOperation.Operator.class);
- kryo.register(IntentOperationList.class);
- kryo.register(IntentStateList.class);
+ // Intent-related classes
+ kryo.register(Path.class);
+ kryo.register(Intent.class);
+ kryo.register(Intent.IntentState.class);
+ kryo.register(PathIntent.class);
+ kryo.register(ShortestPathIntent.class);
+ kryo.register(ConstrainedShortestPathIntent.class);
+ kryo.register(ErrorIntent.class);
+ kryo.register(ErrorIntent.ErrorType.class);
+ kryo.register(IntentOperation.class);
+ kryo.register(IntentOperation.Operator.class);
+ kryo.register(IntentOperationList.class);
+ kryo.register(IntentStateList.class);
- // Device-related classes
- kryo.register(HashSet.class);
- kryo.register(Inet4Address.class);
- kryo.register(OnosDevice.class);
- kryo.register(Date.class);
+ // Device-related classes
+ kryo.register(HashSet.class);
+ kryo.register(Inet4Address.class);
+ kryo.register(OnosDevice.class);
+ kryo.register(Date.class);
- // ProxyArp-related classes
- kryo.register(BroadcastPacketOutNotification.class);
- kryo.register(SinglePacketOutNotification.class);
- kryo.register(ArpReplyNotification.class);
+ // ProxyArp-related classes
+ kryo.register(BroadcastPacketOutNotification.class);
+ kryo.register(SinglePacketOutNotification.class);
+ kryo.register(ArpReplyNotification.class);
- return kryo;
+ return kryo;
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/serializers/MACAddressDeserializer.java b/src/main/java/net/onrc/onos/core/util/serializers/MACAddressDeserializer.java
index 4ed31a5..45bc336 100644
--- a/src/main/java/net/onrc/onos/core/util/serializers/MACAddressDeserializer.java
+++ b/src/main/java/net/onrc/onos/core/util/serializers/MACAddressDeserializer.java
@@ -21,20 +21,20 @@
@Override
public MACAddress deserialize(JsonParser jp,
- DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
+ DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
- MACAddress mac = null;
+ MACAddress mac = null;
- jp.nextToken(); // Move to JsonToken.START_OBJECT
- while (jp.nextToken() != JsonToken.END_OBJECT) {
- String fieldname = jp.getCurrentName();
- if ("value".equals(fieldname)) {
- String value = jp.getText();
- log.debug("Fieldname: {} Value: {}", fieldname, value);
- mac = MACAddress.valueOf(value);
- }
- }
- return mac;
+ jp.nextToken(); // Move to JsonToken.START_OBJECT
+ while (jp.nextToken() != JsonToken.END_OBJECT) {
+ String fieldname = jp.getCurrentName();
+ if ("value".equals(fieldname)) {
+ String value = jp.getText();
+ log.debug("Fieldname: {} Value: {}", fieldname, value);
+ mac = MACAddress.valueOf(value);
+ }
+ }
+ return mac;
}
}
diff --git a/src/main/java/net/onrc/onos/core/util/serializers/MACAddressSerializer.java b/src/main/java/net/onrc/onos/core/util/serializers/MACAddressSerializer.java
index e57a777..f56ac0a 100644
--- a/src/main/java/net/onrc/onos/core/util/serializers/MACAddressSerializer.java
+++ b/src/main/java/net/onrc/onos/core/util/serializers/MACAddressSerializer.java
@@ -16,10 +16,10 @@
@Override
public void serialize(MACAddress mac, JsonGenerator jGen,
- SerializerProvider serializer)
- throws IOException, JsonProcessingException {
- jGen.writeStartObject();
- jGen.writeStringField("value", mac.toString());
- jGen.writeEndObject();
+ SerializerProvider serializer)
+ throws IOException, JsonProcessingException {
+ jGen.writeStartObject();
+ jGen.writeStringField("value", mac.toString());
+ jGen.writeEndObject();
}
}