Search in sources :

Example 1 with PmsiTunnelAugmentation

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.bgp.rib.route.PmsiTunnelAugmentation in project bgpcep by opendaylight.

the class PMSITunnelAttributeHandler method serializeAttribute.

@Override
public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
    Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute object.");
    final PmsiTunnelAugmentation pmsiTunnelAugmentation = ((Attributes) attribute).getAugmentation(PmsiTunnelAugmentation.class);
    if (pmsiTunnelAugmentation == null) {
        return;
    }
    final PmsiTunnel pmsiTunnelAttribute = pmsiTunnelAugmentation.getPmsiTunnel();
    final TunnelIdentifier tunnel = pmsiTunnelAttribute.getTunnelIdentifier();
    final ByteBuf tunnelBuffer = Unpooled.buffer();
    final int tunnelType = this.tunnelIdentifierHandler.serialize(tunnel, tunnelBuffer);
    final ByteBuf body = Unpooled.buffer();
    serializeFlag(pmsiTunnelAttribute, body);
    body.writeByte(tunnelType);
    serializeMpls(pmsiTunnelAttribute.getMplsLabel(), body);
    body.writeBytes(tunnelBuffer);
    AttributeUtil.formatAttribute(AttributeUtil.OPTIONAL, getType(), body, byteAggregator);
}
Also used : Attributes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes) TunnelIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.TunnelIdentifier) PmsiTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.PmsiTunnel) ByteBuf(io.netty.buffer.ByteBuf) PmsiTunnelAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.evpn.routes.evpn.routes.evpn.route.PmsiTunnelAugmentation)

Example 2 with PmsiTunnelAugmentation

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.bgp.rib.route.PmsiTunnelAugmentation in project bgpcep by opendaylight.

the class PMSITunnelAttributeHandler method serializeAttribute.

@Override
public void serializeAttribute(final Attributes attribute, final ByteBuf byteAggregator) {
    final PmsiTunnelAugmentation pmsiTunnelAugmentation = attribute.augmentation(PmsiTunnelAugmentation.class);
    if (pmsiTunnelAugmentation == null) {
        return;
    }
    final PmsiTunnel pmsiTunnelAttribute = pmsiTunnelAugmentation.getPmsiTunnel();
    final TunnelIdentifier tunnel = pmsiTunnelAttribute.getTunnelIdentifier();
    final ByteBuf tunnelBuffer = Unpooled.buffer();
    final int tunnelType = this.tunnelIdentifierHandler.serialize(tunnel, tunnelBuffer);
    final ByteBuf body = Unpooled.buffer();
    serializeFlag(pmsiTunnelAttribute, body);
    body.writeByte(tunnelType);
    serializeMpls(pmsiTunnelAttribute.getMplsLabel(), body);
    body.writeBytes(tunnelBuffer);
    AttributeUtil.formatAttribute(AttributeUtil.OPTIONAL | AttributeUtil.TRANSITIVE, getType(), body, byteAggregator);
}
Also used : TunnelIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.pmsi.tunnel.pmsi.tunnel.TunnelIdentifier) PmsiTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.pmsi.tunnel.PmsiTunnel) ByteBuf(io.netty.buffer.ByteBuf) PmsiTunnelAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.bgp.rib.route.PmsiTunnelAugmentation) PeerSpecificParserConstraint(org.opendaylight.protocol.bgp.parser.spi.PeerSpecificParserConstraint)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)2 PeerSpecificParserConstraint (org.opendaylight.protocol.bgp.parser.spi.PeerSpecificParserConstraint)1 PmsiTunnelAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.evpn.routes.evpn.routes.evpn.route.PmsiTunnelAugmentation)1 Attributes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes)1 PmsiTunnel (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.PmsiTunnel)1 TunnelIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.TunnelIdentifier)1 PmsiTunnelAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.bgp.rib.route.PmsiTunnelAugmentation)1 PmsiTunnel (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.pmsi.tunnel.PmsiTunnel)1 TunnelIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.pmsi.tunnel.pmsi.tunnel.TunnelIdentifier)1