public static OFGroupModFailedCode ofWireValue(short val) { switch(val) { case GROUP_EXISTS_VAL: return OFGroupModFailedCode.GROUP_EXISTS; case INVALID_GROUP_VAL: return OFGroupModFailedCode.INVALID_GROUP; case WEIGHT_UNSUPPORTED_VAL: return OFGroupModFailedCode.WEIGHT_UNSUPPORTED; case OUT_OF_GROUPS_VAL: return OFGroupModFailedCode.OUT_OF_GROUPS; case OUT_OF_BUCKETS_VAL: return OFGroupModFailedCode.OUT_OF_BUCKETS; case CHAINING_UNSUPPORTED_VAL: return OFGroupModFailedCode.CHAINING_UNSUPPORTED; case WATCH_UNSUPPORTED_VAL: return OFGroupModFailedCode.WATCH_UNSUPPORTED; case LOOP_VAL: return OFGroupModFailedCode.LOOP; case UNKNOWN_GROUP_VAL: return OFGroupModFailedCode.UNKNOWN_GROUP; default: throw new IllegalArgumentException("Illegal wire value for type OFGroupModFailedCode in version 1.1: " + val); } }
public static short toWireValue(OFGroupModFailedCode e) { switch(e) { case GROUP_EXISTS: return GROUP_EXISTS_VAL; case INVALID_GROUP: return INVALID_GROUP_VAL; case WEIGHT_UNSUPPORTED: return WEIGHT_UNSUPPORTED_VAL; case OUT_OF_GROUPS: return OUT_OF_GROUPS_VAL; case OUT_OF_BUCKETS: return OUT_OF_BUCKETS_VAL; case CHAINING_UNSUPPORTED: return CHAINING_UNSUPPORTED_VAL; case WATCH_UNSUPPORTED: return WATCH_UNSUPPORTED_VAL; case LOOP: return LOOP_VAL; case UNKNOWN_GROUP: return UNKNOWN_GROUP_VAL; default: throw new IllegalArgumentException("Illegal enum value for type OFGroupModFailedCode in version 1.1: " + e); } }
@Test public void groupModFailure() { TestOpenFlowGroupProviderService testProviderService = (TestOpenFlowGroupProviderService) providerService; GroupId groupId = new DefaultGroupId(1); List<GroupBucket> bucketList = Lists.newArrayList(); TrafficTreatment.Builder builder = DefaultTrafficTreatment.builder(); builder.setOutput(PortNumber.portNumber(1)); GroupBucket bucket = DefaultGroupBucket.createSelectGroupBucket(builder.build()); bucketList.add(bucket); GroupBuckets buckets = new GroupBuckets(bucketList); List<GroupOperation> operationList = Lists.newArrayList(); GroupOperation operation = GroupOperation.createAddGroupOperation(groupId, GroupDescription.Type.SELECT, buckets); operationList.add(operation); GroupOperations operations = new GroupOperations(operationList); provider.performGroupOperation(deviceId, operations); OFGroupModFailedErrorMsg.Builder errorBuilder = OFFactories.getFactory(OFVersion.OF_13).errorMsgs().buildGroupModFailedErrorMsg(); OFGroupMod.Builder groupBuilder = OFFactories.getFactory(OFVersion.OF_13).buildGroupModify(); groupBuilder.setGroupType(OFGroupType.ALL); groupBuilder.setGroup(OFGroup.of(1)); errorBuilder.setCode(OFGroupModFailedCode.GROUP_EXISTS); errorBuilder.setXid(provider.getXidAndAdd(0) - 1); controller.processPacket(dpid1, errorBuilder.build()); assertNotNull("Operation failed should not be null", testProviderService.failedOperation); }
public static OFGroupModFailedCode readFrom(ChannelBuffer bb) throws OFParseError { try { return ofWireValue(bb.readShort()); } catch (IllegalArgumentException e) { throw new OFParseError(e); } }
public static OFGroupModFailedCode ofWireValue(short val) { switch(val) { case GROUP_EXISTS_VAL: return OFGroupModFailedCode.GROUP_EXISTS; case INVALID_GROUP_VAL: return OFGroupModFailedCode.INVALID_GROUP; case WEIGHT_UNSUPPORTED_VAL: return OFGroupModFailedCode.WEIGHT_UNSUPPORTED; case OUT_OF_GROUPS_VAL: return OFGroupModFailedCode.OUT_OF_GROUPS; case OUT_OF_BUCKETS_VAL: return OFGroupModFailedCode.OUT_OF_BUCKETS; case CHAINING_UNSUPPORTED_VAL: return OFGroupModFailedCode.CHAINING_UNSUPPORTED; case WATCH_UNSUPPORTED_VAL: return OFGroupModFailedCode.WATCH_UNSUPPORTED; case LOOP_VAL: return OFGroupModFailedCode.LOOP; case UNKNOWN_GROUP_VAL: return OFGroupModFailedCode.UNKNOWN_GROUP; case CHAINED_GROUP_VAL: return OFGroupModFailedCode.CHAINED_GROUP; case BAD_TYPE_VAL: return OFGroupModFailedCode.BAD_TYPE; case BAD_COMMAND_VAL: return OFGroupModFailedCode.BAD_COMMAND; case BAD_BUCKET_VAL: return OFGroupModFailedCode.BAD_BUCKET; case BAD_WATCH_VAL: return OFGroupModFailedCode.BAD_WATCH; case EPERM_VAL: return OFGroupModFailedCode.EPERM; default: throw new IllegalArgumentException("Illegal wire value for type OFGroupModFailedCode in version 1.2: " + val); } }
public static short toWireValue(OFGroupModFailedCode e) { switch(e) { case GROUP_EXISTS: return GROUP_EXISTS_VAL; case INVALID_GROUP: return INVALID_GROUP_VAL; case WEIGHT_UNSUPPORTED: return WEIGHT_UNSUPPORTED_VAL; case OUT_OF_GROUPS: return OUT_OF_GROUPS_VAL; case OUT_OF_BUCKETS: return OUT_OF_BUCKETS_VAL; case CHAINING_UNSUPPORTED: return CHAINING_UNSUPPORTED_VAL; case WATCH_UNSUPPORTED: return WATCH_UNSUPPORTED_VAL; case LOOP: return LOOP_VAL; case UNKNOWN_GROUP: return UNKNOWN_GROUP_VAL; case CHAINED_GROUP: return CHAINED_GROUP_VAL; case BAD_TYPE: return BAD_TYPE_VAL; case BAD_COMMAND: return BAD_COMMAND_VAL; case BAD_BUCKET: return BAD_BUCKET_VAL; case BAD_WATCH: return BAD_WATCH_VAL; case EPERM: return EPERM_VAL; default: throw new IllegalArgumentException("Illegal enum value for type OFGroupModFailedCode in version 1.2: " + e); } }
public static OFGroupModFailedCode ofWireValue(short val) { switch(val) { case GROUP_EXISTS_VAL: return OFGroupModFailedCode.GROUP_EXISTS; case INVALID_GROUP_VAL: return OFGroupModFailedCode.INVALID_GROUP; case WEIGHT_UNSUPPORTED_VAL: return OFGroupModFailedCode.WEIGHT_UNSUPPORTED; case OUT_OF_GROUPS_VAL: return OFGroupModFailedCode.OUT_OF_GROUPS; case OUT_OF_BUCKETS_VAL: return OFGroupModFailedCode.OUT_OF_BUCKETS; case CHAINING_UNSUPPORTED_VAL: return OFGroupModFailedCode.CHAINING_UNSUPPORTED; case WATCH_UNSUPPORTED_VAL: return OFGroupModFailedCode.WATCH_UNSUPPORTED; case LOOP_VAL: return OFGroupModFailedCode.LOOP; case UNKNOWN_GROUP_VAL: return OFGroupModFailedCode.UNKNOWN_GROUP; case CHAINED_GROUP_VAL: return OFGroupModFailedCode.CHAINED_GROUP; case BAD_TYPE_VAL: return OFGroupModFailedCode.BAD_TYPE; case BAD_COMMAND_VAL: return OFGroupModFailedCode.BAD_COMMAND; case BAD_BUCKET_VAL: return OFGroupModFailedCode.BAD_BUCKET; case BAD_WATCH_VAL: return OFGroupModFailedCode.BAD_WATCH; case EPERM_VAL: return OFGroupModFailedCode.EPERM; default: throw new IllegalArgumentException("Illegal wire value for type OFGroupModFailedCode in version 1.3: " + val); } }
public static short toWireValue(OFGroupModFailedCode e) { switch(e) { case GROUP_EXISTS: return GROUP_EXISTS_VAL; case INVALID_GROUP: return INVALID_GROUP_VAL; case WEIGHT_UNSUPPORTED: return WEIGHT_UNSUPPORTED_VAL; case OUT_OF_GROUPS: return OUT_OF_GROUPS_VAL; case OUT_OF_BUCKETS: return OUT_OF_BUCKETS_VAL; case CHAINING_UNSUPPORTED: return CHAINING_UNSUPPORTED_VAL; case WATCH_UNSUPPORTED: return WATCH_UNSUPPORTED_VAL; case LOOP: return LOOP_VAL; case UNKNOWN_GROUP: return UNKNOWN_GROUP_VAL; case CHAINED_GROUP: return CHAINED_GROUP_VAL; case BAD_TYPE: return BAD_TYPE_VAL; case BAD_COMMAND: return BAD_COMMAND_VAL; case BAD_BUCKET: return BAD_BUCKET_VAL; case BAD_WATCH: return BAD_WATCH_VAL; case EPERM: return EPERM_VAL; default: throw new IllegalArgumentException("Illegal enum value for type OFGroupModFailedCode in version 1.3: " + e); } }
public static OFGroupModFailedCode ofWireValue(short val) { switch(val) { case GROUP_EXISTS_VAL: return OFGroupModFailedCode.GROUP_EXISTS; case INVALID_GROUP_VAL: return OFGroupModFailedCode.INVALID_GROUP; case WEIGHT_UNSUPPORTED_VAL: return OFGroupModFailedCode.WEIGHT_UNSUPPORTED; case OUT_OF_GROUPS_VAL: return OFGroupModFailedCode.OUT_OF_GROUPS; case OUT_OF_BUCKETS_VAL: return OFGroupModFailedCode.OUT_OF_BUCKETS; case CHAINING_UNSUPPORTED_VAL: return OFGroupModFailedCode.CHAINING_UNSUPPORTED; case WATCH_UNSUPPORTED_VAL: return OFGroupModFailedCode.WATCH_UNSUPPORTED; case LOOP_VAL: return OFGroupModFailedCode.LOOP; case UNKNOWN_GROUP_VAL: return OFGroupModFailedCode.UNKNOWN_GROUP; case CHAINED_GROUP_VAL: return OFGroupModFailedCode.CHAINED_GROUP; case BAD_TYPE_VAL: return OFGroupModFailedCode.BAD_TYPE; case BAD_COMMAND_VAL: return OFGroupModFailedCode.BAD_COMMAND; case BAD_BUCKET_VAL: return OFGroupModFailedCode.BAD_BUCKET; case BAD_WATCH_VAL: return OFGroupModFailedCode.BAD_WATCH; case EPERM_VAL: return OFGroupModFailedCode.EPERM; default: throw new IllegalArgumentException("Illegal wire value for type OFGroupModFailedCode in version 1.4: " + val); } }
public static short toWireValue(OFGroupModFailedCode e) { switch(e) { case GROUP_EXISTS: return GROUP_EXISTS_VAL; case INVALID_GROUP: return INVALID_GROUP_VAL; case WEIGHT_UNSUPPORTED: return WEIGHT_UNSUPPORTED_VAL; case OUT_OF_GROUPS: return OUT_OF_GROUPS_VAL; case OUT_OF_BUCKETS: return OUT_OF_BUCKETS_VAL; case CHAINING_UNSUPPORTED: return CHAINING_UNSUPPORTED_VAL; case WATCH_UNSUPPORTED: return WATCH_UNSUPPORTED_VAL; case LOOP: return LOOP_VAL; case UNKNOWN_GROUP: return UNKNOWN_GROUP_VAL; case CHAINED_GROUP: return CHAINED_GROUP_VAL; case BAD_TYPE: return BAD_TYPE_VAL; case BAD_COMMAND: return BAD_COMMAND_VAL; case BAD_BUCKET: return BAD_BUCKET_VAL; case BAD_WATCH: return BAD_WATCH_VAL; case EPERM: return EPERM_VAL; default: throw new IllegalArgumentException("Illegal enum value for type OFGroupModFailedCode in version 1.4: " + e); } }
@Test public void groupModFailure() { TestOpenFlowGroupProviderService testProviderService = (TestOpenFlowGroupProviderService) providerService; GroupId groupId = new GroupId(1); List<GroupBucket> bucketList = Lists.newArrayList(); TrafficTreatment.Builder builder = DefaultTrafficTreatment.builder(); builder.setOutput(PortNumber.portNumber(1)); GroupBucket bucket = DefaultGroupBucket.createSelectGroupBucket(builder.build()); bucketList.add(bucket); GroupBuckets buckets = new GroupBuckets(bucketList); List<GroupOperation> operationList = Lists.newArrayList(); GroupOperation operation = GroupOperation.createAddGroupOperation(groupId, GroupDescription.Type.SELECT, buckets); operationList.add(operation); GroupOperations operations = new GroupOperations(operationList); provider.performGroupOperation(deviceId, operations); OFGroupModFailedErrorMsg.Builder errorBuilder = OFFactories.getFactory(OFVersion.OF_13).errorMsgs().buildGroupModFailedErrorMsg(); OFGroupMod.Builder groupBuilder = OFFactories.getFactory(OFVersion.OF_13).buildGroupModify(); groupBuilder.setGroupType(OFGroupType.ALL); groupBuilder.setGroup(OFGroup.of(1)); errorBuilder.setCode(OFGroupModFailedCode.GROUP_EXISTS); errorBuilder.setXid(provider.getXidAndAdd(0) - 1); controller.processPacket(dpid1, errorBuilder.build()); assertNotNull("Operation failed should not be null", testProviderService.failedOperation); }
public static OFGroupModFailedCode readFrom(ByteBuf bb) throws OFParseError { try { return ofWireValue(bb.readShort()); } catch (IllegalArgumentException e) { throw new OFParseError(e); } }
public static OFGroupModFailedCode ofWireValue(short val) { switch(val) { case GROUP_EXISTS_VAL: return OFGroupModFailedCode.GROUP_EXISTS; case INVALID_GROUP_VAL: return OFGroupModFailedCode.INVALID_GROUP; case WEIGHT_UNSUPPORTED_VAL: return OFGroupModFailedCode.WEIGHT_UNSUPPORTED; case OUT_OF_GROUPS_VAL: return OFGroupModFailedCode.OUT_OF_GROUPS; case OUT_OF_BUCKETS_VAL: return OFGroupModFailedCode.OUT_OF_BUCKETS; case CHAINING_UNSUPPORTED_VAL: return OFGroupModFailedCode.CHAINING_UNSUPPORTED; case WATCH_UNSUPPORTED_VAL: return OFGroupModFailedCode.WATCH_UNSUPPORTED; case LOOP_VAL: return OFGroupModFailedCode.LOOP; case UNKNOWN_GROUP_VAL: return OFGroupModFailedCode.UNKNOWN_GROUP; case CHAINED_GROUP_VAL: return OFGroupModFailedCode.CHAINED_GROUP; case BAD_TYPE_VAL: return OFGroupModFailedCode.BAD_TYPE; case BAD_COMMAND_VAL: return OFGroupModFailedCode.BAD_COMMAND; case BAD_BUCKET_VAL: return OFGroupModFailedCode.BAD_BUCKET; case BAD_WATCH_VAL: return OFGroupModFailedCode.BAD_WATCH; case EPERM_VAL: return OFGroupModFailedCode.EPERM; case UNKNOWN_BUCKET_VAL: return OFGroupModFailedCode.UNKNOWN_BUCKET; case BUCKET_EXISTS_VAL: return OFGroupModFailedCode.BUCKET_EXISTS; default: throw new IllegalArgumentException("Illegal wire value for type OFGroupModFailedCode in version 1.5: " + val); } }
public static short toWireValue(OFGroupModFailedCode e) { switch(e) { case GROUP_EXISTS: return GROUP_EXISTS_VAL; case INVALID_GROUP: return INVALID_GROUP_VAL; case WEIGHT_UNSUPPORTED: return WEIGHT_UNSUPPORTED_VAL; case OUT_OF_GROUPS: return OUT_OF_GROUPS_VAL; case OUT_OF_BUCKETS: return OUT_OF_BUCKETS_VAL; case CHAINING_UNSUPPORTED: return CHAINING_UNSUPPORTED_VAL; case WATCH_UNSUPPORTED: return WATCH_UNSUPPORTED_VAL; case LOOP: return LOOP_VAL; case UNKNOWN_GROUP: return UNKNOWN_GROUP_VAL; case CHAINED_GROUP: return CHAINED_GROUP_VAL; case BAD_TYPE: return BAD_TYPE_VAL; case BAD_COMMAND: return BAD_COMMAND_VAL; case BAD_BUCKET: return BAD_BUCKET_VAL; case BAD_WATCH: return BAD_WATCH_VAL; case EPERM: return EPERM_VAL; case UNKNOWN_BUCKET: return UNKNOWN_BUCKET_VAL; case BUCKET_EXISTS: return BUCKET_EXISTS_VAL; default: throw new IllegalArgumentException("Illegal enum value for type OFGroupModFailedCode in version 1.5: " + e); } }
@Override public void handleMessage(Dpid dpid, OFMessage msg) { switch (msg.getType()) { case STATS_REPLY: pushGroupMetrics(dpid, (OFStatsReply) msg); break; case ERROR: OFErrorMsg errorMsg = (OFErrorMsg) msg; if (errorMsg.getErrType() == OFErrorType.GROUP_MOD_FAILED) { GroupId pendingGroupId = null; for (Map.Entry<GroupId, Long> entry: pendingXidMaps.entrySet()) { if (entry.getValue() == errorMsg.getXid()) { pendingGroupId = entry.getKey(); break; } } if (pendingGroupId == null) { log.warn("Error for unknown group operation: {}", errorMsg.getXid()); } else { GroupOperation operation = pendingGroupOperations.get(pendingGroupId); DeviceId deviceId = DeviceId.deviceId(Dpid.uri(dpid)); if (operation != null) { OFGroupModFailedCode code = ((OFGroupModFailedErrorMsg) errorMsg).getCode(); GroupMsgErrorCode failureCode = GroupMsgErrorCode.values()[(code.ordinal())]; GroupOperation failedOperation = GroupOperation .createFailedGroupOperation(operation, failureCode); log.warn("Received a group mod error {}", msg); providerService.groupOperationFailed(deviceId, failedOperation); pendingGroupOperations.remove(pendingGroupId); pendingXidMaps.remove(pendingGroupId); } else { log.error("Cannot find pending group operation with group ID: {}", pendingGroupId); } } break; } default: break; } }
public static void writeTo(ChannelBuffer bb, OFGroupModFailedCode e) { bb.writeShort(toWireValue(e)); }
public static void putTo(OFGroupModFailedCode e, PrimitiveSink sink) { sink.putShort(toWireValue(e)); }