use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.ExcludeRouteSubobjects.Attribute in project bgpcep by opendaylight.
the class OriginatorIdAttributeParser 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 OriginatorId originator = ((Attributes) attribute).getOriginatorId();
if (originator == null) {
return;
}
final ByteBuf originatorIdBuf = Unpooled.buffer();
originatorIdBuf.writeBytes(Ipv4Util.bytesForAddress(originator.getOriginator()));
AttributeUtil.formatAttribute(AttributeUtil.OPTIONAL, TYPE, originatorIdBuf, byteAggregator);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.ExcludeRouteSubobjects.Attribute in project bgpcep by opendaylight.
the class AtomicAggregateAttributeParser 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 Attributes pathAttributes = (Attributes) attribute;
if (pathAttributes.getAtomicAggregate() == null) {
return;
}
AttributeUtil.formatAttribute(AttributeUtil.TRANSITIVE, TYPE, Unpooled.EMPTY_BUFFER, byteAggregator);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.ExcludeRouteSubobjects.Attribute in project bgpcep by opendaylight.
the class ClusterIdAttributeParser 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 ClusterId cid = ((Attributes) attribute).getClusterId();
if (cid == null) {
return;
}
final List<ClusterIdentifier> cluster = cid.getCluster();
if (cluster == null || cluster.isEmpty()) {
return;
}
final ByteBuf clusterIdBuffer = Unpooled.buffer();
for (final ClusterIdentifier clusterIdentifier : cid.getCluster()) {
clusterIdBuffer.writeBytes(Ipv4Util.bytesForAddress(clusterIdentifier));
}
AttributeUtil.formatAttribute(AttributeUtil.OPTIONAL, TYPE, clusterIdBuffer, byteAggregator);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.ExcludeRouteSubobjects.Attribute in project bgpcep by opendaylight.
the class CommunitiesAttributeParser 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 List<Communities> communities = ((Attributes) attribute).getCommunities();
if (communities == null || communities.isEmpty()) {
return;
}
final ByteBuf communitiesBuffer = Unpooled.buffer();
for (final Community community : communities) {
communitiesBuffer.writeShort(community.getAsNumber().getValue().shortValue());
communitiesBuffer.writeShort(community.getSemantics().shortValue());
}
AttributeUtil.formatAttribute(AttributeUtil.OPTIONAL | AttributeUtil.TRANSITIVE, TYPE, communitiesBuffer, byteAggregator);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.ExcludeRouteSubobjects.Attribute in project bgpcep by opendaylight.
the class ExtendedCommunitiesAttributeParser 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 List<ExtendedCommunities> communitiesList = ((Attributes) attribute).getExtendedCommunities();
if (communitiesList == null || communitiesList.isEmpty()) {
return;
}
final ByteBuf extendedCommunitiesBuffer = Unpooled.buffer();
for (final ExtendedCommunities extendedCommunities : communitiesList) {
this.ecReg.serializeExtendedCommunity(extendedCommunities, extendedCommunitiesBuffer);
}
if (extendedCommunitiesBuffer.readableBytes() > 0) {
AttributeUtil.formatAttribute(AttributeUtil.OPTIONAL | AttributeUtil.TRANSITIVE, TYPE, extendedCommunitiesBuffer, byteAggregator);
}
}
Aggregations