use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.rsvp.error.spec.tlv.rsvp.error.spec.error.type.UserCase in project bgpcep by opendaylight.
the class Stateful07RSVPErrorSpecTlvParser method serializeTlv.
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
Preconditions.checkArgument(tlv instanceof RsvpErrorSpec, "RSVPErrorSpecTlv is mandatory.");
final RsvpErrorSpec rsvp = (RsvpErrorSpec) tlv;
final ByteBuf body = Unpooled.buffer();
if (rsvp.getErrorType().getImplementedInterface().equals(RsvpCase.class)) {
final RsvpCase r = (RsvpCase) rsvp.getErrorType();
serializeRsvp(r.getRsvpError(), body);
TlvUtil.formatTlv(TYPE, body, buffer);
} else {
final UserCase u = (UserCase) rsvp.getErrorType();
serializerUserError(u.getUserError(), body);
TlvUtil.formatTlv(TYPE, body, buffer);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.rsvp.error.spec.tlv.rsvp.error.spec.error.type.UserCase in project bgpcep by opendaylight.
the class StatefulRSVPErrorSpecTlvParser method parseUserError.
private static UserCase parseUserError(final ByteBuf buffer) {
final UserErrorBuilder error = new UserErrorBuilder().setEnterprise(new EnterpriseNumber(ByteBufUtils.readUint32(buffer)));
error.setSubOrg(ByteBufUtils.readUint8(buffer));
final int errDescrLength = buffer.readUnsignedByte();
error.setValue(ByteBufUtils.readUint16(buffer));
error.setDescription(ByteArray.bytesToHRString(ByteArray.readBytes(buffer, errDescrLength)));
// if we have any subobjects, place the implementation here
return new UserCaseBuilder().setUserError(error.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.rsvp.error.spec.tlv.rsvp.error.spec.error.type.UserCase in project bgpcep by opendaylight.
the class StatefulRSVPErrorSpecTlvParser method serializeTlv.
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
checkArgument(tlv instanceof RsvpErrorSpec, "RSVPErrorSpecTlv is mandatory.");
final RsvpErrorSpec rsvp = (RsvpErrorSpec) tlv;
final ByteBuf body = Unpooled.buffer();
if (rsvp.getErrorType().implementedInterface().equals(RsvpCase.class)) {
final RsvpCase r = (RsvpCase) rsvp.getErrorType();
serializeRsvp(r.getRsvpError(), body);
TlvUtil.formatTlv(TYPE, body, buffer);
} else {
final UserCase u = (UserCase) rsvp.getErrorType();
serializerUserError(u.getUserError(), body);
TlvUtil.formatTlv(TYPE, body, buffer);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.rsvp.error.spec.tlv.rsvp.error.spec.error.type.UserCase in project bgpcep by opendaylight.
the class Stateful07RSVPErrorSpecTlvParser method parseUserError.
private static UserCase parseUserError(final ByteBuf buffer) {
final UserErrorBuilder error = new UserErrorBuilder();
error.setEnterprise(new EnterpriseNumber(buffer.readUnsignedInt()));
error.setSubOrg(buffer.readUnsignedByte());
final int errDescrLength = buffer.readUnsignedByte();
error.setValue(buffer.readUnsignedShort());
error.setDescription(ByteArray.bytesToHRString(ByteArray.readBytes(buffer, errDescrLength)));
// if we have any subobjects, place the implementation here
return new UserCaseBuilder().setUserError(error.build()).build();
}
Aggregations