use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.p2mp.ipv6._case.P2mpIpv6 in project bgpcep by opendaylight.
the class PCEPP2MPEndPointsIpv6ObjectParser method serializeObject.
public static void serializeObject(final Boolean processing, final Boolean ignore, final P2mpIpv6 p2mpIpv6, final ByteBuf buffer) {
final List<Ipv6AddressNoZone> dest = p2mpIpv6.getDestinationIpv6Address();
checkArgument(dest != null, "DestinationIpv6Address is mandatory.");
final ByteBuf body = Unpooled.buffer(LEAF_TYPE_SIZE + Ipv6Util.IPV6_LENGTH + Ipv6Util.IPV6_LENGTH * dest.size());
checkArgument(p2mpIpv6.getSourceIpv6Address() != null, "SourceIpv6Address is mandatory.");
body.writeInt(p2mpIpv6.getP2mpLeaves().getIntValue());
Ipv6Util.writeIpv6Address(p2mpIpv6.getSourceIpv6Address(), body);
dest.forEach(ipv6 -> Ipv6Util.writeIpv6Address(ipv6, body));
ObjectUtil.formatSubobject(TYPE, CLASS, processing, ignore, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.p2mp.ipv6._case.P2mpIpv6 in project bgpcep by opendaylight.
the class PCEPEndPointsObjectSerializer method serializeObject.
@Override
public void serializeObject(final Object object, final ByteBuf buffer) {
Preconditions.checkArgument(object instanceof EndpointsObj, "Wrong instance of PCEPObject. Passed %s. Needed EndpointsObject.", object.getClass());
final EndpointsObj ePObj = (EndpointsObj) object;
final AddressFamily afi = ePObj.getAddressFamily();
final Boolean processing = object.getProcessingRule();
final Boolean ignore = object.getIgnore();
if (afi instanceof Ipv6Case) {
final Ipv6 ipv6 = ((Ipv6Case) afi).getIpv6();
PCEPEndPointsIpv6ObjectParser.serializeObject(processing, ignore, ipv6, buffer);
} else if (afi instanceof Ipv4Case) {
final Ipv4 ipv4 = ((Ipv4Case) afi).getIpv4();
PCEPEndPointsIpv4ObjectParser.serializeObject(processing, ignore, ipv4, buffer);
} else if (afi instanceof P2mpIpv4Case) {
final P2mpIpv4 ipv4 = ((P2mpIpv4Case) afi).getP2mpIpv4();
PCEPP2MPEndPointsIpv4ObjectParser.serializeObject(processing, ignore, ipv4, buffer);
} else if (afi instanceof P2mpIpv6Case) {
final P2mpIpv6 ipv6 = ((P2mpIpv6Case) afi).getP2mpIpv6();
PCEPP2MPEndPointsIpv6ObjectParser.serializeObject(processing, ignore, ipv6, buffer);
}
}
Aggregations