use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Community 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.Community 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.Community in project bgpcep by opendaylight.
the class RedirectIpv6EcHandler method serializeExtendedCommunity.
@Override
public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
Preconditions.checkArgument(extendedCommunity instanceof RedirectIpv6ExtendedCommunity, "The extended community %s is not RedirectIpv6ExtendedCommunity type.", extendedCommunity);
final RedirectIpv6 redirectIpv6 = ((RedirectIpv6ExtendedCommunity) extendedCommunity).getRedirectIpv6();
byteAggregator.writeBytes(Ipv6Util.byteBufForAddress(redirectIpv6.getGlobalAdministrator()));
ByteBufWriteUtil.writeUnsignedShort(redirectIpv6.getLocalAdministrator(), byteAggregator);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Community in project bgpcep by opendaylight.
the class TrafficMarkingEcHandler 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.TrafficMarkingExtendedCommunity, "The extended community %s is not TrafficMarkingExtendedCommunity type.", extendedCommunity);
final TrafficMarkingExtendedCommunity trafficMarking = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.TrafficMarkingExtendedCommunity) extendedCommunity).getTrafficMarkingExtendedCommunity();
byteAggregator.writeZero(RESERVED);
ByteBufWriteUtil.writeUnsignedByte(trafficMarking.getGlobalAdministrator().getValue(), byteAggregator);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Community in project bgpcep by opendaylight.
the class TrafficRateEcHandler 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.TrafficRateExtendedCommunity, "The extended community %s is not TrafficRateExtendedCommunity type.", extendedCommunity);
final TrafficRateExtendedCommunity trafficRate = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.TrafficRateExtendedCommunity) extendedCommunity).getTrafficRateExtendedCommunity();
ByteBufWriteUtil.writeShort(trafficRate.getInformativeAs().getValue().shortValue(), byteAggregator);
byteAggregator.writeBytes(trafficRate.getLocalAdministrator().getValue());
}
Aggregations