use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.classtype.object.ClassType in project bgpcep by opendaylight.
the class Stateful07RSVPErrorSpecTlvParser method parseRsvp.
private static RsvpCase parseRsvp(final int classType, final ByteBuf buffer) {
final RsvpErrorBuilder builder = new RsvpErrorBuilder();
if (classType == RSVP_IPV4_ERROR_CLASS_TYPE) {
builder.setNode(new IpAddress(Ipv4Util.addressForByteBuf(buffer)));
} else if (classType == RSVP_IPV6_ERROR_CLASS_TYPE) {
builder.setNode(new IpAddress(Ipv6Util.addressForByteBuf(buffer)));
}
final BitArray flags = BitArray.valueOf(buffer, FLAGS_SIZE);
builder.setFlags(new Flags(flags.get(IN_PLACE), flags.get(NOT_GUILTY)));
final short errorCode = buffer.readUnsignedByte();
builder.setCode(errorCode);
final int errorValue = buffer.readUnsignedShort();
builder.setValue(errorValue);
return new RsvpCaseBuilder().setRsvpError(builder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.classtype.object.ClassType in project bgpcep by opendaylight.
the class PCEPClassTypeObjectParser method serializeObject.
@Override
public void serializeObject(final Object object, final ByteBuf buffer) {
Preconditions.checkArgument(object instanceof ClassType, "Wrong instance of PCEPObject. Passed %s. Needed ClassTypeObject.", object.getClass());
final ByteBuf body = Unpooled.buffer(SIZE);
body.writeZero(SIZE - 1);
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ClassType classType = ((ClassType) object).getClassType();
Preconditions.checkArgument(classType != null, "ClassType is mandatory.");
writeUnsignedByte(classType.getValue(), body);
ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer);
}
Aggregations