Search in sources :

Example 1 with EsiSerializer

use of org.opendaylight.protocol.bgp.evpn.spi.EsiSerializer in project bgpcep by opendaylight.

the class SimpleEsiTypeRegistry method parseEsiModel.

@Override
public Esi parseEsiModel(final ChoiceNode esiChoice) {
    Preconditions.checkArgument(esiChoice != null && !esiChoice.getValue().isEmpty(), "ESI is mandatory. Can't be null or empty.");
    final ContainerNode cont = (ContainerNode) Iterables.getOnlyElement(esiChoice.getValue());
    final EsiSerializer serializer = this.modelHandlers.get(cont.getIdentifier());
    if (serializer != null) {
        return serializer.serializeEsi(cont);
    }
    LOG.warn("Unrecognized ESI {}", esiChoice);
    return null;
}
Also used : EsiSerializer(org.opendaylight.protocol.bgp.evpn.spi.EsiSerializer) ContainerNode(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode)

Example 2 with EsiSerializer

use of org.opendaylight.protocol.bgp.evpn.spi.EsiSerializer in project bgpcep by opendaylight.

the class SimpleEsiTypeRegistry method serializeEsi.

@Override
public void serializeEsi(final Esi esi, final ByteBuf buffer) {
    final EsiSerializer serializer = this.handlers.getSerializer(esi.getImplementedInterface());
    if (serializer == null) {
        return;
    }
    serializer.serializeEsi(esi, buffer);
}
Also used : EsiSerializer(org.opendaylight.protocol.bgp.evpn.spi.EsiSerializer)

Aggregations

EsiSerializer (org.opendaylight.protocol.bgp.evpn.spi.EsiSerializer)2 ContainerNode (org.opendaylight.yangtools.yang.data.api.schema.ContainerNode)1