Search in sources :

Example 1 with PathSetupTypeBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.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 InitiatedSrpObjectParser parser = new InitiatedSrpObjectParser(this.tlvRegistry, this.viTlvRegistry);
    final SrpBuilder builder = new SrpBuilder().setProcessingRule(false).setIgnore(false).setOperationId(new SrpIdNumber(Uint32.ONE)).addAugmentation(new Srp1Builder().setRemove(true).build()).setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.srp.object.srp.TlvsBuilder().setPathSetupType(new PathSetupTypeBuilder().setPst(Uint8.ZERO).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.rev200720.srp.object.SrpBuilder) ObjectHeaderImpl(org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl) TlvsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.srp.object.srp.TlvsBuilder) InitiatedSrpObjectParser(org.opendaylight.protocol.pcep.ietf.initiated.InitiatedSrpObjectParser) ByteBuf(io.netty.buffer.ByteBuf) PathSetupTypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.path.setup.type.tlv.PathSetupTypeBuilder) SrpIdNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.SrpIdNumber) Srp1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Srp1Builder) Test(org.junit.Test)

Example 2 with PathSetupTypeBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.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(Uint8.ONE).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.rev181109.path.setup.type.tlv.PathSetupTypeBuilder) PathSetupType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.path.setup.type.tlv.PathSetupType) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 3 with PathSetupTypeBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.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().setProcessingRule(false).setIgnore(false).setReoptimization(true).setBiDirectional(false).setLoose(true).setMakeBeforeBreak(true).setOrder(false).setPathKey(false).setSupplyOf(false).setFragmentation(false).setP2mp(false).setEroCompression(false).setPriority(Uint8.valueOf(5)).setRequestId(new RequestId(Uint32.valueOf(0xdeadbeefL))).setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.rp.object.rp.TlvsBuilder().setPathSetupType(new PathSetupTypeBuilder().setPst(Uint8.ZERO).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.rev181109.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.rev181109.path.setup.type.tlv.PathSetupTypeBuilder) RpBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.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.rev181109.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(Uint8.ZERO).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.rev181109.path.setup.type.tlv.PathSetupTypeBuilder) PathSetupType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.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.rev181109.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(Uint8.ONE).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.rev181109.path.setup.type.tlv.PathSetupTypeBuilder) PathSetupType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.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.rev181109.path.setup.type.tlv.PathSetupTypeBuilder)5 PathSetupType (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.path.setup.type.tlv.PathSetupType)3 PathSetupTypeTlvParser (org.opendaylight.protocol.pcep.parser.tlv.PathSetupTypeTlvParser)2 ObjectHeaderImpl (org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl)2 InitiatedSrpObjectParser (org.opendaylight.protocol.pcep.ietf.initiated.InitiatedSrpObjectParser)1 PCEPRequestParameterObjectParser (org.opendaylight.protocol.pcep.parser.object.PCEPRequestParameterObjectParser)1 Srp1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Srp1Builder)1 SrpIdNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.SrpIdNumber)1 SrpBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.srp.object.SrpBuilder)1 TlvsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.srp.object.srp.TlvsBuilder)1 RequestId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.RequestId)1 RpBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.rp.object.RpBuilder)1