use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.OnfExperimenterErrorCode in project openflowplugin by opendaylight.
the class OnfExperimenterErrorFactory method deserialize.
@Override
public ErrorMessage deserialize(ByteBuf message) {
ErrorMessageBuilder builder = new ErrorMessageBuilder();
builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
builder.setXid(message.readUnsignedInt());
int type = message.readUnsignedShort();
ErrorType errorType = ErrorType.forValue(type);
if (errorType != null && errorType.equals(ErrorType.EXPERIMENTER)) {
builder.setType(errorType.getIntValue());
builder.setTypeString(errorType.getName());
} else {
LOG.warn("Deserializing other than {} error message with {}", ErrorType.EXPERIMENTER.getName(), this.getClass().getCanonicalName());
builder.setType(type);
builder.setTypeString(UNKNOWN_TYPE);
}
int code = message.readUnsignedShort();
OnfExperimenterErrorCode errorCode = OnfExperimenterErrorCode.forValue(code);
if (errorCode != null) {
builder.setCode(errorCode.getIntValue());
builder.setCodeString(errorCode.getName());
} else {
builder.setCode(code);
builder.setCodeString(UNKNOWN_CODE);
}
builder.addAugmentation(ExperimenterIdError.class, new ExperimenterIdErrorBuilder().setExperimenter(new ExperimenterId(message.readUnsignedInt())).build());
if (message.readableBytes() > 0) {
byte[] data = new byte[message.readableBytes()];
message.readBytes(data);
builder.setData(data);
}
return builder.build();
}
Aggregations