use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.redirect.ip.nh.extended.community.RedirectIpNhExtendedCommunity in project bgpcep by opendaylight.
the class RedirectIpNextHopEcHandler method serializeExtendedCommunity.
@Override
public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
checkArgument(extendedCommunity instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.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.rev200120.RedirectIpNhExtendedCommunity) extendedCommunity).getRedirectIpNhExtendedCommunity();
final IpAddressNoZone nextHopAddress = redirect.getNextHopAddress();
if (nextHopAddress.getIpv4AddressNoZone() != null) {
Ipv4Util.writeIpv4Address(nextHopAddress.getIpv4AddressNoZone(), byteAggregator);
} else {
Ipv6Util.writeIpv6Address(nextHopAddress.getIpv6AddressNoZone(), byteAggregator);
}
byteAggregator.writeShort(Boolean.TRUE.equals(redirect.getCopy()) ? 1 : 0);
}
Aggregations