Search in sources :

Example 6 with CCloseBuilder

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();
}
Also used : TlvsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.close.object.c.close.TlvsBuilder) CCloseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.close.object.CCloseBuilder)

Example 7 with CCloseBuilder

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());
}
Also used : Object(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object) CCloseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.close.object.CCloseBuilder) Test(org.junit.Test)

Aggregations

CCloseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.close.object.CCloseBuilder)7 Test (org.junit.Test)4 ByteBuf (io.netty.buffer.ByteBuf)3 CloseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.CloseBuilder)3 CCloseMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.close.message.CCloseMessageBuilder)3 PCEPCloseObjectParser (org.opendaylight.protocol.pcep.parser.object.PCEPCloseObjectParser)2 ObjectHeaderImpl (org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl)2 TlvsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.close.object.c.close.TlvsBuilder)2 ChannelFuture (io.netty.channel.ChannelFuture)1 ChannelHandler (io.netty.channel.ChannelHandler)1 DefaultChannelPromise (io.netty.channel.DefaultChannelPromise)1 GenericFutureListener (io.netty.util.concurrent.GenericFutureListener)1 InetSocketAddress (java.net.InetSocketAddress)1 TimeUnit (java.util.concurrent.TimeUnit)1 Before (org.junit.Before)1 Mockito.doReturn (org.mockito.Mockito.doReturn)1 MockitoAnnotations (org.mockito.MockitoAnnotations)1 TestEnterpriseSpecificInformation (org.opendaylight.protocol.pcep.impl.TestVendorInformationTlvParser.TestEnterpriseSpecificInformation)1 PCEPCloseMessageParser (org.opendaylight.protocol.pcep.parser.message.PCEPCloseMessageParser)1 EnterpriseNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber)1