Search in sources :

Example 76 with Ipv6

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6 in project bgpcep by opendaylight.

the class PCEPUnreachDestinationSerializer method serializeObject.

@Override
public void serializeObject(final Object object, final ByteBuf buffer) {
    Preconditions.checkArgument(object instanceof UnreachDestinationObj, "Wrong instance of PCEPObject. Passed %s. Needed UnreachDestinationObj.", object.getClass());
    final UnreachDestinationObj uPObj = (UnreachDestinationObj) object;
    final Destination destination = uPObj.getDestination();
    final Boolean processing = object.getProcessingRule();
    final Boolean ignore = object.getIgnore();
    if (destination instanceof Ipv6DestinationCase) {
        final Ipv6DestinationCase ipv6 = (Ipv6DestinationCase) destination;
        PCEPIpv6UnreachDestinationParser.serializeObject(processing, ignore, ipv6, buffer);
    } else if (destination instanceof Ipv4DestinationCase) {
        final Ipv4DestinationCase ipv4 = (Ipv4DestinationCase) destination;
        PCEPIpv4UnreachDestinationParser.serializeObject(processing, ignore, ipv4, buffer);
    }
}
Also used : Destination(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.unreach.destination.object.unreach.destination.obj.Destination) Ipv6DestinationCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.unreach.destination.object.unreach.destination.obj.destination.Ipv6DestinationCase) Ipv4DestinationCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.unreach.destination.object.unreach.destination.obj.destination.Ipv4DestinationCase) UnreachDestinationObj(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.unreach.destination.object.UnreachDestinationObj)

Example 77 with Ipv6

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6 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 78 with Ipv6

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6 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);
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) Ipv6AddressNoZone(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone)

Example 79 with Ipv6

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6 in project bgpcep by opendaylight.

the class PCEPIpv6UnreachDestinationParser method serializeObject.

public static void serializeObject(final Boolean processing, final Boolean ignore, final Ipv6DestinationCase ipv6Case, final ByteBuf buffer) {
    final List<Ipv6AddressNoZone> dest = ipv6Case.getDestinationIpv6Address();
    checkArgument(dest != null, "Destinationipv6Address is mandatory.");
    final ByteBuf body = Unpooled.buffer(Ipv6Util.IPV6_LENGTH * dest.size());
    dest.forEach(ipv6 -> Ipv6Util.writeIpv6Address(ipv6, body));
    ObjectUtil.formatSubobject(TYPE, CLASS, processing, ignore, body, buffer);
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) Ipv6AddressNoZone(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone)

Example 80 with Ipv6

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6 in project bgpcep by opendaylight.

the class PCEPObjectParserTest method testPceIdIPv6Object.

@Test
public void testPceIdIPv6Object() throws PCEPDeserializerException {
    final byte[] pccIdReqBytes = { /* object header */
    0x19, 0x20, 0x00, 0x14, /* ipv6 header */
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 };
    final PCEPPceIdIPv6ObjectParser parser = new PCEPPceIdIPv6ObjectParser();
    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pce.id.object.PceId pccIdReq = new PceIdBuilder().setIpAddress(new IpAddressNoZone(new Ipv6AddressNoZone("::1"))).build();
    final ByteBuf result = Unpooled.wrappedBuffer(pccIdReqBytes);
    assertEquals(pccIdReq, parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
    final ByteBuf buf = Unpooled.buffer(pccIdReqBytes.length);
    parser.serializeObject(pccIdReq, buf);
    assertArrayEquals(pccIdReqBytes, buf.array());
}
Also used : ObjectHeaderImpl(org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl) PCEPPceIdIPv6ObjectParser(org.opendaylight.protocol.pcep.parser.object.PCEPPceIdIPv6ObjectParser) PceIdBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pce.id.object.PceIdBuilder) ByteBuf(io.netty.buffer.ByteBuf) Ipv6AddressNoZone(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone) IpAddressNoZone(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone) Subobject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.exclude.route.object.xro.Subobject) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)71 ArrayList (java.util.ArrayList)44 Ipv6Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)38 ByteBuf (io.netty.buffer.ByteBuf)27 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)24 Ipv6Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix)21 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)20 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)19 InetAddress (java.net.InetAddress)17 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)17 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)16 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)13 List (java.util.List)12 Inet6Address (java.net.Inet6Address)10 UnknownHostException (java.net.UnknownHostException)10 IpPrefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix)10 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)10 Subnetmap (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap)10 SimpleAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)9 Ipv6AddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone)8