use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.of.object.of.TlvsBuilder in project bgpcep by opendaylight.
the class AbstractBmpMessageWithTlvParserTest method testParseTlvs.
@Test
public void testParseTlvs() throws BmpDeserializationException {
final ByteBuf buffer = Unpooled.EMPTY_BUFFER;
final TlvsBuilder builder = new TlvsBuilder();
this.parser.parseTlvs(builder, buffer);
assertNull(builder.getDescriptionTlv());
this.parser.parseTlvs(builder, Unpooled.wrappedBuffer(DATA));
assertNotNull(builder.getDescriptionTlv());
assertEquals("test", builder.getDescriptionTlv().getDescription());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.of.object.of.TlvsBuilder in project bgpcep by opendaylight.
the class AbstractBmpMessageWithTlvParserTest method testParseCorruptedTlv.
@Test(expected = BmpDeserializationException.class)
public void testParseCorruptedTlv() throws BmpDeserializationException {
final byte[] wrongData = { 0, 1, 0, 10, 't', 'e', 's', 't' };
this.parser.parseTlvs(new TlvsBuilder(), Unpooled.wrappedBuffer(wrongData));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.of.object.of.TlvsBuilder in project bgpcep by opendaylight.
the class PCCServerPeerProposal method setPeerSpecificProposal.
@Override
public void setPeerSpecificProposal(final InetSocketAddress address, final TlvsBuilder openBuilder) {
requireNonNull(address);
final LspDbVersionBuilder lspDbVersionBuilder = new LspDbVersionBuilder();
if (this.isAfterReconnection) {
lspDbVersionBuilder.setLspDbVersionValue(this.dbVersion);
} else {
this.isAfterReconnection = true;
}
openBuilder.addAugmentation(new Tlvs3Builder().setLspDbVersion(lspDbVersionBuilder.build()).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.of.object.of.TlvsBuilder in project bgpcep by opendaylight.
the class PCEPSegmentRoutingCapabilityTest method testSegmentRoutingCapability.
@Test
public void testSegmentRoutingCapability() {
final PCEPSegmentRoutingCapability sspf = new PCEPSegmentRoutingCapability(true);
Assert.assertTrue(sspf.isSegmentRoutingCapable());
final TlvsBuilder builder = new TlvsBuilder();
sspf.setCapabilityProposal(null, builder);
Assert.assertEquals(EXPECTED_TLVS, builder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.of.object.of.TlvsBuilder in project bgpcep by opendaylight.
the class StatefulLspObjectParser method parseObject.
@Override
public Lsp parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
final LspBuilder builder = new LspBuilder().setIgnore(header.getIgnore()).setProcessingRule(header.getProcessingRule());
final int[] plspIdRaw = new int[] { bytes.readUnsignedByte(), bytes.readUnsignedByte(), bytes.getUnsignedByte(2) };
builder.setPlspId(new PlspId(Uint32.valueOf(plspIdRaw[0] << FLAGS_SIZE | plspIdRaw[1] << FOUR_BITS_SHIFT | plspIdRaw[2] >> FOUR_BITS_SHIFT)));
parseFlags(builder, bytes);
final TlvsBuilder b = new TlvsBuilder();
parseTlvs(b, bytes.slice());
builder.setTlvs(b.build());
return builder.build();
}
Aggregations