use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.tables.Attributes 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.bgp.rib.rev171207.rib.tables.Attributes 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.bgp.rib.rev171207.rib.tables.Attributes 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.bgp.rib.rev171207.rib.tables.Attributes 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);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.tables.Attributes in project bgpcep by opendaylight.
the class LocalPreferenceAttributeParser 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 LocalPref lp = ((Attributes) attribute).getLocalPref();
if (lp == null) {
return;
}
AttributeUtil.formatAttribute(AttributeUtil.TRANSITIVE, TYPE, Unpooled.copyInt(lp.getPref().intValue()), byteAggregator);
}
Aggregations