import org.openflow.codec.io.IDataBuffer;
import org.openflow.codec.protocol.action.OFPBucket;
+import org.openflow.codec.protocol.factory.OFPActionFactory;
+import org.openflow.codec.protocol.factory.OFPActionFactoryAware;
import org.openflow.codec.util.U16;
/**
* @author Yugandhar Sarraju (ysarraju@in.ibm.com)
*
*/
-public class OFPGroupMod extends OFPMessage implements Cloneable {
+public class OFPGroupMod extends OFPMessage implements OFPActionFactoryAware, Cloneable {
public static int MINIMUM_LENGTH = 16;
public static final short OFPGC_ADD = 0; /* New group. */
public static final short OFPGC_MODIFY = 1; /* Modify all matching groups. */
public static final short OFPGC_DELETE = 2; /* Delete all matching groups. */
- public static final short OFPGT_ALL = 0; /* All (multicast/broadcast) group. */
- public static final short OFPGT_SELECT = 1; /* Select group. */
- public static final short OFPGT_INDIRECT = 2; /* Indirect group. */
- public static final short OFPGT_FF = 3; /* Fast failover group. */
+ public static final byte OFPGT_ALL = 0; /* All (multicast/broadcast) group. */
+ public static final byte OFPGT_SELECT = 1; /* Select group. */
+ public static final byte OFPGT_INDIRECT = 2; /* Indirect group. */
+ public static final byte OFPGT_FF = 3; /* Fast failover group. */
+ public static final int OFPG_MAX = (int) 0xffffff00;
+ public static final int OFPG_ALL = (int) 0xfffffffc;
+ public static final int OFPG_ANY = (int) 0xffffffff;
+
+ protected OFPActionFactory actionFactory;
protected short groupCommand;
protected byte groupType;
protected int group_id;
} else {
this.buckets.clear();
}
- int bucketCount = (super.getLengthU() - 16) / OFPBucket.MINIMUM_LENGTH;
OFPBucket bucket;
- for (int i = 0; i < bucketCount; ++i) {
+ while (data.remaining() > 0) {
bucket = new OFPBucket();
+ bucket.setActionFactory(actionFactory);
bucket.readFrom(data);
this.buckets.add(bucket);
}
return "OFPGroupMod [ buckets=" + buckets + ", groupCommand=" + groupCommand + ", groupType=" + groupType
+ ", group_id=" + group_id + "]";
}
+
+ @Override
+ public void setActionFactory(OFPActionFactory actionFactory) {
+ this.actionFactory = actionFactory;
+
+ }
}