Search in sources :

Example 1 with NlriTypeCaseSerializer

use of org.opendaylight.protocol.bgp.linkstate.spi.NlriTypeCaseSerializer in project bgpcep by opendaylight.

the class SimpleNlriTypeRegistry method serializeNlriType.

public void serializeNlriType(final CLinkstateDestination nlri, final ByteBuf byteAggregator) {
    if (nlri == null) {
        return;
    }
    requireNonNull(byteAggregator);
    final ObjectType objectType = nlri.getObjectType();
    final NlriTypeCaseSerializer serializer = this.nlriRegistry.getSerializer((Class<? extends ObjectType>) objectType.getImplementedInterface());
    if (serializer == null) {
        LOG.warn("Linkstate NLRI serializer for Type: {} was not found.", objectType.getImplementedInterface());
        return;
    }
    final ByteBuf nlriType = Unpooled.buffer();
    serializer.serializeTypeNlri(nlri, nlriType);
    TlvUtil.writeTLV(serializer.getNlriType(), nlriType, byteAggregator);
}
Also used : ObjectType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.ObjectType) NlriTypeCaseSerializer(org.opendaylight.protocol.bgp.linkstate.spi.NlriTypeCaseSerializer) ByteBuf(io.netty.buffer.ByteBuf)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)1 NlriTypeCaseSerializer (org.opendaylight.protocol.bgp.linkstate.spi.NlriTypeCaseSerializer)1 ObjectType (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.ObjectType)1