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));
}
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));
}
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));
}
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));
}
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);
}
Aggregations