use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv in project bgpcep by opendaylight.
the class LspDbVersionTlvParser method serializeTlv.
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
Preconditions.checkArgument(tlv instanceof LspDbVersion, "Tlv object is not instance of LspDbVersion.");
final ByteBuf body = Unpooled.buffer();
writeUnsignedLong(((LspDbVersion) tlv).getLspDbVersionValue(), body);
TlvUtil.formatTlv(TYPE, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv in project bgpcep by opendaylight.
the class SpeakerEntityIdTlvParser method serializeTlv.
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
Preconditions.checkArgument(tlv instanceof SpeakerEntityId, "Tlv object is not instance of SpeakerEntityId.");
final ByteBuf body = Unpooled.buffer();
body.writeBytes(((SpeakerEntityId) tlv).getSpeakerEntityIdValue());
TlvUtil.formatTlv(TYPE, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv in project bgpcep by opendaylight.
the class OverloadedDurationTlvParser method serializeTlv.
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
Preconditions.checkArgument(tlv instanceof OverloadDuration, "OverloadedTlv is mandatory.");
final ByteBuf body = Unpooled.buffer();
writeUnsignedInt(((OverloadDuration) tlv).getDuration(), body);
TlvUtil.formatTlv(TYPE, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv in project bgpcep by opendaylight.
the class PathAttributeParserTest method testParsingAigpAttributeWithCorrectTLV.
@Test
public void testParsingAigpAttributeWithCorrectTLV() throws BGPDocumentedException, BGPParsingException {
final byte[] value = new byte[] { 1, 0, 11, 0, 0, 0, 0, 0, 0, 0, 8 };
final ByteBuf buffer = Unpooled.buffer();
AttributeUtil.formatAttribute(AttributeUtil.OPTIONAL, AigpAttributeParser.TYPE, Unpooled.copiedBuffer(value), buffer);
final BGPExtensionProviderContext providerContext = ServiceLoaderBGPExtensionProviderContext.getSingletonInstance();
final Attributes pathAttributes = providerContext.getAttributeRegistry().parseAttributes(buffer, null);
final Aigp aigp = pathAttributes.getAigp();
final AigpTlv tlv = aigp.getAigpTlv();
assertNotNull("Tlv should not be null.", tlv);
assertEquals("Aigp tlv should have metric with value 8.", 8, tlv.getMetric().getValue().intValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv in project bgpcep by opendaylight.
the class Ipv6BgpPrefixSidParserTest method testHandling.
@Test
public void testHandling() {
final Ipv6SidTlvBuilder tlv = new Ipv6SidTlvBuilder();
tlv.setProcessIpv6HeadAbility(Boolean.TRUE);
final ByteBuf serialized = Unpooled.buffer(3);
this.handler.serializeBgpPrefixSidTlv(tlv.build(), serialized);
assertArrayEquals(this.expected, serialized.array());
assertTrue(this.handler.parseBgpPrefixSidTlv(serialized).isProcessIpv6HeadAbility());
}
Aggregations