Hierarchical error messages plus some more tweaks
- hierarchical error messages for different error types
- renamed ofp_stats_types to ofp_stats_type
- renamed OFP_VENDOR to OFP_EXPERIMENTER in OF 1.0 input file
- use ofp_capabilities enum in of_features_reply
- use boolean type for l2_table_enable field in of_bsn_set_l2_table_(request|reply)
- return Set<OFActionType> for actions field in of_features_reply
- added DatapathId class that's returned for datapath_id field of of_features_reply
- removed unused read/write routines from OFBufferId
- added getOFVersioon method to factory classes/interfaces
- renamed OFPT_MULTIPART_(REQUEST|REPLY) to OFPT_STATS_(REQUEST|REPLY) in OF 1.3 input file
- renamed ofp_multipart_types to ofp_stats_type in OF 1.3 input file
- tweaked python backend to work with consistent use of of_stats_xyz vs. of_multipart_xyz in 1.3
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/ver10/ChannelUtilsVer10.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/ver10/ChannelUtilsVer10.java
index 7a42d20..3f2f23f 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/ver10/ChannelUtilsVer10.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/ver10/ChannelUtilsVer10.java
@@ -1,9 +1,13 @@
package org.projectfloodlight.openflow.protocol.ver10;
+import java.util.EnumSet;
+import java.util.Set;
+
import org.jboss.netty.buffer.ChannelBuffer;
import org.projectfloodlight.openflow.exceptions.OFParseError;
import org.projectfloodlight.openflow.protocol.match.Match;
import org.projectfloodlight.openflow.protocol.ver10.OFMatchV1Ver10;
+import org.projectfloodlight.openflow.protocol.OFActionType;
import org.projectfloodlight.openflow.protocol.OFBsnVportQInQ;
/**
@@ -28,4 +32,63 @@
}
+ public static Set<OFActionType> readSupportedActions(ChannelBuffer bb) {
+ int actions = bb.readInt();
+ EnumSet<OFActionType> supportedActions = EnumSet.noneOf(OFActionType.class);
+ if ((actions & (1 << OFActionTypeSerializerVer10.OUTPUT_VAL)) != 0)
+ supportedActions.add(OFActionType.OUTPUT);
+ if ((actions & (1 << OFActionTypeSerializerVer10.SET_VLAN_VID_VAL)) != 0)
+ supportedActions.add(OFActionType.SET_VLAN_VID);
+ if ((actions & (1 << OFActionTypeSerializerVer10.SET_VLAN_PCP_VAL)) != 0)
+ supportedActions.add(OFActionType.SET_VLAN_PCP);
+ if ((actions & (1 << OFActionTypeSerializerVer10.STRIP_VLAN_VAL)) != 0)
+ supportedActions.add(OFActionType.STRIP_VLAN);
+ if ((actions & (1 << OFActionTypeSerializerVer10.SET_DL_SRC_VAL)) != 0)
+ supportedActions.add(OFActionType.SET_DL_SRC);
+ if ((actions & (1 << OFActionTypeSerializerVer10.SET_DL_DST_VAL)) != 0)
+ supportedActions.add(OFActionType.SET_DL_DST);
+ if ((actions & (1 << OFActionTypeSerializerVer10.SET_NW_SRC_VAL)) != 0)
+ supportedActions.add(OFActionType.SET_NW_SRC);
+ if ((actions & (1 << OFActionTypeSerializerVer10.SET_NW_DST_VAL)) != 0)
+ supportedActions.add(OFActionType.SET_NW_DST);
+ if ((actions & (1 << OFActionTypeSerializerVer10.SET_NW_TOS_VAL)) != 0)
+ supportedActions.add(OFActionType.SET_NW_TOS);
+ if ((actions & (1 << OFActionTypeSerializerVer10.SET_TP_SRC_VAL)) != 0)
+ supportedActions.add(OFActionType.SET_TP_SRC);
+ if ((actions & (1 << OFActionTypeSerializerVer10.SET_TP_DST_VAL)) != 0)
+ supportedActions.add(OFActionType.SET_TP_DST);
+ if ((actions & (1 << OFActionTypeSerializerVer10.ENQUEUE_VAL)) != 0)
+ supportedActions.add(OFActionType.ENQUEUE);
+ return supportedActions;
+ }
+
+ public static void writeSupportedActions(ChannelBuffer bb,
+ Set<OFActionType> supportedActions) {
+ int supportedActionsVal = 0;
+ if (supportedActions.contains(OFActionType.OUTPUT))
+ supportedActionsVal |= (1 << OFActionTypeSerializerVer10.OUTPUT_VAL);
+ if (supportedActions.contains(OFActionType.SET_VLAN_VID))
+ supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_VLAN_VID_VAL);
+ if (supportedActions.contains(OFActionType.SET_VLAN_PCP))
+ supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_VLAN_PCP_VAL);
+ if (supportedActions.contains(OFActionType.STRIP_VLAN))
+ supportedActionsVal |= (1 << OFActionTypeSerializerVer10.STRIP_VLAN_VAL);
+ if (supportedActions.contains(OFActionType.SET_DL_SRC))
+ supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_DL_SRC_VAL);
+ if (supportedActions.contains(OFActionType.SET_DL_DST))
+ supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_DL_DST_VAL);
+ if (supportedActions.contains(OFActionType.SET_NW_SRC))
+ supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_NW_SRC_VAL);
+ if (supportedActions.contains(OFActionType.SET_NW_DST))
+ supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_NW_DST_VAL);
+ if (supportedActions.contains(OFActionType.SET_NW_TOS))
+ supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_NW_TOS_VAL);
+ if (supportedActions.contains(OFActionType.SET_TP_SRC))
+ supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_TP_SRC_VAL);
+ if (supportedActions.contains(OFActionType.SET_TP_DST))
+ supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_TP_DST_VAL);
+ if (supportedActions.contains(OFActionType.ENQUEUE))
+ supportedActionsVal |= (1 << OFActionTypeSerializerVer10.ENQUEUE_VAL);
+ bb.writeInt(supportedActionsVal);
+ }
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/DatapathId.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/DatapathId.java
new file mode 100644
index 0000000..aa7191a
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/DatapathId.java
@@ -0,0 +1,63 @@
+package org.projectfloodlight.openflow.types;
+
+import org.projectfloodlight.openflow.util.HexString;
+
+/**
+ * Abstraction of a datapath ID that can be set and/or accessed as either a
+ * long value or a colon-separated string.
+ *
+ * @author Rob Vaterlaus <rob.vaterlaus@bigswitch.com>
+ */
+public class DatapathId {
+
+ public static final DatapathId NONE = new DatapathId(0);
+
+ private final long rawValue;
+
+ private DatapathId(long rawValue) {
+ this.rawValue = rawValue;
+ }
+
+ public static DatapathId of(long rawValue) {
+ return new DatapathId(rawValue);
+ }
+
+ public static DatapathId of(String s) {
+ return new DatapathId(HexString.toLong(s));
+ }
+
+ public long getLong() {
+ return rawValue;
+ }
+
+ public U64 getUnsignedLong() {
+ return U64.of(rawValue);
+ }
+
+ @Override
+ public String toString() {
+ return HexString.toHexString(rawValue);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (rawValue ^ (rawValue >>> 32));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ DatapathId other = (DatapathId) obj;
+ if (rawValue != other.rawValue)
+ return false;
+ return true;
+ }
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFBufferId.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFBufferId.java
index 99f3e7f..1db309f 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFBufferId.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFBufferId.java
@@ -35,14 +35,6 @@
return Long.toString(U32.f(rawValue));
}
- public void write4Bytes(ChannelBuffer c) {
- c.writeInt(this.rawValue);
- }
-
- public static OFBufferId read4Bytes(ChannelBuffer c) throws OFParseError {
- return OFBufferId.of(c.readInt());
- }
-
@Override
public int hashCode() {
final int prime = 31;