use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.close.object.CCloseBuilder in project bgpcep by opendaylight.
the class PCEPCloseObjectParser method parseObject.
@Override
public CClose parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
Preconditions.checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
final CCloseBuilder builder = new CCloseBuilder();
builder.setIgnore(header.isIgnore());
builder.setProcessingRule(header.isProcessingRule());
bytes.skipBytes(FLAGS_F_LENGTH + RESERVED);
builder.setReason(bytes.readUnsignedByte());
final TlvsBuilder tlvsBuilder = new TlvsBuilder();
parseTlvs(tlvsBuilder, bytes.slice());
builder.setTlvs(tlvsBuilder.build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.close.object.CCloseBuilder in project bgpcep by opendaylight.
the class APITest method testUnknownObject.
@Test
public void testUnknownObject() {
UnknownObject un = new UnknownObject(PCEPErrors.CT_AND_SETUP_PRIORITY_DO_NOT_FORM_TE_CLASS);
assertFalse(un.isIgnore());
assertFalse(un.isProcessingRule());
assertEquals(PCEPErrors.CT_AND_SETUP_PRIORITY_DO_NOT_FORM_TE_CLASS, un.getError());
assertEquals(PCEPErrors.CT_AND_SETUP_PRIORITY_DO_NOT_FORM_TE_CLASS.getErrorType(), un.getErrors().get(0).getErrorObject().getType().shortValue());
final Object o = new CCloseBuilder().build();
UnknownObject unknown = new UnknownObject(PCEPErrors.LSP_RSVP_ERROR, o);
assertEquals(Object.class, unknown.getImplementedInterface());
assertEquals(o, unknown.getInvalidObject());
}
Aggregations