Search in sources :

Example 1 with PathSetupTypeBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupTypeBuilder in project bgpcep by opendaylight.

the class SrTlvParserTest method testPathSetupTypeTlvParser.

@Test
public void testPathSetupTypeTlvParser() throws PCEPDeserializerException {
    final SrPathSetupTypeTlvParser parser = new SrPathSetupTypeTlvParser();
    final PathSetupType pstTlv = new PathSetupTypeBuilder().setPst((short) 1).build();
    assertEquals(pstTlv, parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(SR_TE_PST_BYTES, 4))));
    final ByteBuf buff = Unpooled.buffer();
    parser.serializeTlv(pstTlv, buff);
    assertArrayEquals(SR_TE_PST_BYTES, ByteArray.getAllBytes(buff));
}
Also used : PathSetupTypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupTypeBuilder) PathSetupType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupType) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 2 with PathSetupTypeBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupTypeBuilder in project bgpcep by opendaylight.

the class PCEPObjectParserTest method testSRPObjectWithPSTTlv.

@Test
public void testSRPObjectWithPSTTlv() throws PCEPDeserializerException {
    final byte[] srpObjectWithPstTlvBytes = { 0x21, 0x10, 0x00, 0x14, 0x0, 0x0, 0x0, 0x01, 0x0, 0x0, 0x0, 0x01, /* pst-tlv */
    0x0, 0x1C, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0 };
    final CInitiated00SrpObjectParser parser = new CInitiated00SrpObjectParser(this.tlvRegistry, this.viTlvRegistry);
    final SrpBuilder builder = new SrpBuilder();
    builder.setProcessingRule(false);
    builder.setIgnore(false);
    builder.setOperationId(new SrpIdNumber(1L));
    builder.addAugmentation(Srp1.class, new Srp1Builder().setRemove(true).build());
    builder.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.srp.TlvsBuilder().setPathSetupType(new PathSetupTypeBuilder().setPst((short) 0).build()).build());
    final ByteBuf result = Unpooled.wrappedBuffer(srpObjectWithPstTlvBytes);
    assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
    final ByteBuf buf = Unpooled.buffer();
    parser.serializeObject(builder.build(), buf);
    assertArrayEquals(srpObjectWithPstTlvBytes, ByteArray.getAllBytes(buf));
}
Also used : SrpBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.SrpBuilder) ObjectHeaderImpl(org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl) ByteBuf(io.netty.buffer.ByteBuf) PathSetupTypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupTypeBuilder) CInitiated00SrpObjectParser(org.opendaylight.protocol.pcep.ietf.initiated00.CInitiated00SrpObjectParser) SrpIdNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.SrpIdNumber) Srp1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Srp1Builder) TlvsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.srp.TlvsBuilder) Test(org.junit.Test)

Example 3 with PathSetupTypeBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupTypeBuilder in project bgpcep by opendaylight.

the class PCEPObjectParserTest method testRpObjectWithPstTlvParser.

@Test
public void testRpObjectWithPstTlvParser() throws PCEPDeserializerException {
    final byte[] rpObjectWithPstTlvBytes = { 0x2, 0x10, 0x0, 0x14, 0x0, 0x0, 0x4, 0x2d, (byte) 0xde, (byte) 0xad, (byte) 0xbe, (byte) 0xef, /* pst-tlv */
    0x0, 0x1C, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0 };
    final PCEPRequestParameterObjectParser parser = new PCEPRequestParameterObjectParser(this.tlvRegistry, this.viTlvRegistry);
    final RpBuilder builder = new RpBuilder();
    builder.setProcessingRule(false);
    builder.setIgnore(false);
    builder.setReoptimization(true);
    builder.setBiDirectional(false);
    builder.setLoose(true);
    builder.setMakeBeforeBreak(true);
    builder.setOrder(false);
    builder.setPathKey(false);
    builder.setSupplyOf(false);
    builder.setFragmentation(false);
    builder.setP2mp(false);
    builder.setEroCompression(false);
    builder.setPriority((short) 5);
    builder.setRequestId(new RequestId(0xdeadbeefL));
    builder.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rp.object.rp.TlvsBuilder().setPathSetupType(new PathSetupTypeBuilder().setPst((short) 0).build()).build());
    final ByteBuf result = Unpooled.wrappedBuffer(rpObjectWithPstTlvBytes);
    assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
    final ByteBuf buf = Unpooled.buffer();
    parser.serializeObject(builder.build(), buf);
    assertArrayEquals(rpObjectWithPstTlvBytes, ByteArray.getAllBytes(buf));
}
Also used : RequestId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.RequestId) ObjectHeaderImpl(org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl) ByteBuf(io.netty.buffer.ByteBuf) PCEPRequestParameterObjectParser(org.opendaylight.protocol.pcep.parser.object.PCEPRequestParameterObjectParser) PathSetupTypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupTypeBuilder) RpBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rp.object.RpBuilder) Test(org.junit.Test)

Example 4 with PathSetupTypeBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupTypeBuilder in project bgpcep by opendaylight.

the class PCEPTlvParserTest method testUnsupportedPSTSerializer.

@Test(expected = IllegalArgumentException.class)
public void testUnsupportedPSTSerializer() {
    final PathSetupTypeTlvParser parser = new PathSetupTypeTlvParser();
    final PathSetupType pstTlv = new PathSetupTypeBuilder().setPst((short) 1).build();
    final ByteBuf buff = Unpooled.buffer();
    parser.serializeTlv(pstTlv, buff);
}
Also used : PathSetupTypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupTypeBuilder) PathSetupType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupType) ByteBuf(io.netty.buffer.ByteBuf) PathSetupTypeTlvParser(org.opendaylight.protocol.pcep.parser.tlv.PathSetupTypeTlvParser) Test(org.junit.Test)

Example 5 with PathSetupTypeBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupTypeBuilder in project bgpcep by opendaylight.

the class PCEPTlvParserTest method testPathSetupTypeTlvParser.

@Test
public void testPathSetupTypeTlvParser() throws PCEPDeserializerException {
    final PathSetupTypeTlvParser parser = new PathSetupTypeTlvParser();
    final PathSetupType pstTlv = new PathSetupTypeBuilder().setPst((short) 0).build();
    assertEquals(pstTlv, parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(PST_TLV_BYTES, 4))));
    final ByteBuf buff = Unpooled.buffer();
    parser.serializeTlv(pstTlv, buff);
    assertArrayEquals(PST_TLV_BYTES, ByteArray.getAllBytes(buff));
}
Also used : PathSetupTypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupTypeBuilder) PathSetupType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupType) ByteBuf(io.netty.buffer.ByteBuf) PathSetupTypeTlvParser(org.opendaylight.protocol.pcep.parser.tlv.PathSetupTypeTlvParser) Test(org.junit.Test)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)5 Test (org.junit.Test)5 PathSetupTypeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupTypeBuilder)5 PathSetupType (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupType)3 PathSetupTypeTlvParser (org.opendaylight.protocol.pcep.parser.tlv.PathSetupTypeTlvParser)2 ObjectHeaderImpl (org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl)2 CInitiated00SrpObjectParser (org.opendaylight.protocol.pcep.ietf.initiated00.CInitiated00SrpObjectParser)1 PCEPRequestParameterObjectParser (org.opendaylight.protocol.pcep.parser.object.PCEPRequestParameterObjectParser)1 Srp1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Srp1Builder)1 SrpIdNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.SrpIdNumber)1 SrpBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.SrpBuilder)1 TlvsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.srp.TlvsBuilder)1 RequestId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.RequestId)1 RpBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rp.object.RpBuilder)1