Search in sources :

Example 1 with P2mpIpv4

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.p2mp.ipv4._case.P2mpIpv4 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);
    }
}
Also used : Ipv6Case(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.Ipv6Case) P2mpIpv6Case(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.P2mpIpv6Case) P2mpIpv6Case(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.P2mpIpv6Case) P2mpIpv6(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.p2mp.ipv6._case.P2mpIpv6) Ipv6(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.ipv6._case.Ipv6) P2mpIpv4Case(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.P2mpIpv4Case) Ipv4(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.ipv4._case.Ipv4) P2mpIpv4(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.p2mp.ipv4._case.P2mpIpv4) P2mpIpv4(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.p2mp.ipv4._case.P2mpIpv4) EndpointsObj(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.object.EndpointsObj) AddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.AddressFamily) P2mpIpv4Case(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.P2mpIpv4Case) Ipv4Case(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.Ipv4Case) P2mpIpv6(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.p2mp.ipv6._case.P2mpIpv6)

Example 2 with P2mpIpv4

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.p2mp.ipv4._case.P2mpIpv4 in project bgpcep by opendaylight.

the class PCEPP2MPEndPointsIpv4ObjectParser method serializeObject.

public static void serializeObject(final Boolean processing, final Boolean ignore, final P2mpIpv4 p2mpIpv4, final ByteBuf buffer) {
    final List<Ipv4AddressNoZone> dest = p2mpIpv4.getDestinationIpv4Address();
    checkArgument(dest != null, "DestinationIpv4Address is mandatory.");
    final ByteBuf body = Unpooled.buffer(LEAF_TYPE_SIZE + Ipv4Util.IP4_LENGTH + Ipv4Util.IP4_LENGTH * dest.size());
    checkArgument(p2mpIpv4.getSourceIpv4Address() != null, "SourceIpv4Address is mandatory.");
    body.writeInt(p2mpIpv4.getP2mpLeaves().getIntValue());
    Ipv4Util.writeIpv4Address(p2mpIpv4.getSourceIpv4Address(), body);
    dest.forEach(ipv4 -> Ipv4Util.writeIpv4Address(ipv4, body));
    ObjectUtil.formatSubobject(TYPE, CLASS, processing, ignore, body, buffer);
}
Also used : Ipv4AddressNoZone(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone) ByteBuf(io.netty.buffer.ByteBuf)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)1 Ipv4AddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone)1 AddressFamily (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.AddressFamily)1 Ipv4Case (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.Ipv4Case)1 Ipv6Case (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.Ipv6Case)1 P2mpIpv4Case (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.P2mpIpv4Case)1 P2mpIpv6Case (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.P2mpIpv6Case)1 Ipv4 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.ipv4._case.Ipv4)1 Ipv6 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.ipv6._case.Ipv6)1 P2mpIpv4 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.p2mp.ipv4._case.P2mpIpv4)1 P2mpIpv6 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.p2mp.ipv6._case.P2mpIpv6)1 EndpointsObj (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.object.EndpointsObj)1