use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.Tlv in project bgpcep by opendaylight.
the class PCEPTlvParserTest method testRSVPError6SpecTlv.
@Test
public void testRSVPError6SpecTlv() throws PCEPDeserializerException {
final StatefulRSVPErrorSpecTlvParser parser = new StatefulRSVPErrorSpecTlvParser();
final RsvpErrorBuilder builder = new RsvpErrorBuilder().setNode(new IpAddressNoZone(Ipv6Util.addressForByteBuf(Unpooled.wrappedBuffer(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9a, (byte) 0xbc, (byte) 0xde, (byte) 0xf0, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9a, (byte) 0xbc, (byte) 0xde, (byte) 0xf0 })))).setFlags(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.ErrorSpec.Flags(false, true)).setCode(Uint8.valueOf(213)).setValue(Uint16.valueOf(50649));
final RsvpErrorSpec tlv = new RsvpErrorSpecBuilder().setErrorType(new RsvpCaseBuilder().setRsvpError(builder.build()).build()).build();
assertEquals(tlv, parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(RSVP_ERROR6_BYTES, 4))));
final ByteBuf buff = Unpooled.buffer();
parser.serializeTlv(tlv, buff);
assertArrayEquals(RSVP_ERROR6_BYTES, ByteArray.getAllBytes(buff));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.Tlv in project bgpcep by opendaylight.
the class LspDbVersionTlvParser method serializeTlv.
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
checkArgument(tlv instanceof LspDbVersion, "Tlv object is not instance of LspDbVersion.");
final ByteBuf body = Unpooled.buffer();
writeOrZero(body, ((LspDbVersion) tlv).getLspDbVersionValue());
TlvUtil.formatTlv(TYPE, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.Tlv in project bgpcep by opendaylight.
the class SyncOptimizationsLspObjectParser method addTlv.
@Override
public void addTlv(final TlvsBuilder tbuilder, final Tlv tlv) {
super.addTlv(tbuilder, tlv);
final Tlvs1Builder syncOptTlvsBuilder = new Tlvs1Builder();
if (tbuilder.augmentation(Tlvs1.class) != null) {
final Tlvs1 t = tbuilder.augmentation(Tlvs1.class);
if (t.getLspDbVersion() != null) {
syncOptTlvsBuilder.setLspDbVersion(t.getLspDbVersion());
}
}
if (tlv instanceof LspDbVersion) {
syncOptTlvsBuilder.setLspDbVersion((LspDbVersion) tlv);
}
tbuilder.addAugmentation(syncOptTlvsBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.Tlv in project bgpcep by opendaylight.
the class PathBindingTlvParser method parseTlv.
@Override
public Tlv parseTlv(final ByteBuf buffer) throws PCEPDeserializerException {
if (buffer == null) {
return null;
}
final Uint16 type = ByteBufUtils.readUint16(buffer);
final PathBindingTlvCodec codec = BT_PARSERS.get(type);
if (codec == null) {
throw new PCEPDeserializerException("Unsupported Path Binding Type: " + type);
}
return new PathBindingBuilder().setBindingTypeValue(codec.readEntry(buffer)).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.Tlv in project bgpcep by opendaylight.
the class StatefulOpenObjectParser method addTlv.
@Override
public void addTlv(final TlvsBuilder tbuilder, final Tlv tlv) {
super.addTlv(tbuilder, tlv);
final Tlvs1Builder statefulBuilder = new Tlvs1Builder();
if (tbuilder.augmentation(Tlvs1.class) != null) {
final Tlvs1 t = tbuilder.augmentation(Tlvs1.class);
if (t.getStateful() != null) {
statefulBuilder.setStateful(t.getStateful());
}
}
if (tlv instanceof Stateful) {
statefulBuilder.setStateful((Stateful) tlv);
}
tbuilder.addAugmentation(statefulBuilder.build());
}
Aggregations