use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ExtendedCommunity in project bgpcep by opendaylight.
the class ESILabelExtCom method serializeExtendedCommunity.
@Override
public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
Preconditions.checkArgument(extendedCommunity instanceof EsiLabelExtendedCommunityCase, "The extended community %s is not EsiLabelExtendedCommunityCaseCase type.", extendedCommunity);
final EsiLabelExtendedCommunity extCom = ((EsiLabelExtendedCommunityCase) extendedCommunity).getEsiLabelExtendedCommunity();
byteAggregator.writeBoolean(extCom.isSingleActiveMode());
byteAggregator.writeZero(RESERVED);
byteAggregator.writeBytes(byteBufForMplsLabel(extCom.getEsiLabel()));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ExtendedCommunity in project bgpcep by opendaylight.
the class RedirectAsFourOctetEcHandler method parseExtendedCommunity.
@Override
public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
final RedirectAs4Builder builder = new RedirectAs4Builder();
builder.setGlobalAdministrator(new AsNumber(buffer.readUnsignedInt()));
builder.setLocalAdministrator(buffer.readUnsignedShort());
return new RedirectAs4ExtendedCommunityCaseBuilder().setRedirectAs4(builder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ExtendedCommunity in project bgpcep by opendaylight.
the class RedirectIpNextHopEcHandler method serializeExtendedCommunity.
@Override
public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
Preconditions.checkArgument(extendedCommunity instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.RedirectIpNhExtendedCommunity, "The extended community %s is not RedirectIpNhExtendedCommunityCase type.", extendedCommunity);
final RedirectIpNhExtendedCommunity redirect = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.RedirectIpNhExtendedCommunity) extendedCommunity).getRedirectIpNhExtendedCommunity();
final IpAddress nextHopAddress = redirect.getNextHopAddress();
if (nextHopAddress.getIpv4Address() != null) {
ByteBufWriteUtil.writeIpv4Address(nextHopAddress.getIpv4Address(), byteAggregator);
} else {
ByteBufWriteUtil.writeIpv6Address(nextHopAddress.getIpv6Address(), byteAggregator);
}
ByteBufWriteUtil.writeUnsignedShort((redirect.isCopy() == null || !redirect.isCopy()) ? 0 : 1, byteAggregator);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ExtendedCommunity in project bgpcep by opendaylight.
the class RedirectIpNextHopEcHandler method parseExtendedCommunity.
@Override
public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
final RedirectIpNhExtendedCommunityBuilder builder = new RedirectIpNhExtendedCommunityBuilder();
if (buffer.readableBytes() > Ipv6Util.IPV6_LENGTH) {
builder.setNextHopAddress(new IpAddress(Ipv6Util.addressForByteBuf(buffer)));
} else {
builder.setNextHopAddress(new IpAddress(Ipv4Util.addressForByteBuf(buffer)));
}
builder.setCopy((buffer.readUnsignedShort() & COPY) == 1);
return new RedirectIpNhExtendedCommunityCaseBuilder().setRedirectIpNhExtendedCommunity(builder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ExtendedCommunity in project bgpcep by opendaylight.
the class RedirectIpv4EcHandler method parseExtendedCommunity.
@Override
public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
final RedirectIpv4Builder builder = new RedirectIpv4Builder();
builder.setGlobalAdministrator(Ipv4Util.addressForByteBuf(buffer));
builder.setLocalAdministrator(buffer.readUnsignedShort());
return new RedirectIpv4ExtendedCommunityCaseBuilder().setRedirectIpv4(builder.build()).build();
}
Aggregations