Search in sources :

Example 1 with Ipv6PrefixBinaryBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv6PrefixBinaryBuilder in project lispflowmapping by opendaylight.

the class LispAddressUtil method convertToBinary.

private static Ipv6PrefixBinary convertToBinary(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6Prefix prefix) {
    Ipv6PrefixBinaryBuilder pb = new Ipv6PrefixBinaryBuilder();
    byte[] address = InetAddresses.forString(MaskUtil.getAddressStringForIpv6Prefix(prefix)).getAddress();
    pb.setIpv6AddressBinary(new Ipv6AddressBinary(address));
    pb.setIpv6MaskLength(MaskUtil.getMaskForAddress(prefix));
    return pb.build();
}
Also used : Ipv6AddressBinary(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.Ipv6AddressBinary) Ipv6PrefixBinaryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv6PrefixBinaryBuilder)

Example 2 with Ipv6PrefixBinaryBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv6PrefixBinaryBuilder in project lispflowmapping by opendaylight.

the class Ipv6PrefixBinarySerializer method deserializeEidData.

@Override
protected Eid deserializeEidData(ByteBuffer buffer, LispAddressSerializerContext ctx) {
    byte[] ipBuffer = new byte[16];
    buffer.get(ipBuffer);
    Ipv6PrefixBinary prefix = new Ipv6PrefixBinaryBuilder().setIpv6AddressBinary(new Ipv6AddressBinary(ipBuffer)).setIpv6MaskLength(ctx.getMaskLen()).build();
    EidBuilder eb = new EidBuilder();
    eb.setAddressType(Ipv6PrefixBinaryAfi.class);
    eb.setVirtualNetworkId(getVni(ctx));
    eb.setAddress(prefix);
    return eb.build();
}
Also used : Ipv6AddressBinary(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.Ipv6AddressBinary) EidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder) Ipv6PrefixBinaryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv6PrefixBinaryBuilder) Ipv6PrefixBinary(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv6PrefixBinary)

Example 3 with Ipv6PrefixBinaryBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv6PrefixBinaryBuilder in project lispflowmapping by opendaylight.

the class LispAddressUtil method asIpv6PrefixBinaryEid.

public static Eid asIpv6PrefixBinaryEid(InstanceIdType vni, byte[] address, short mask) {
    Preconditions.checkArgument(address.length == 16, "asIpv6PrefixBinaryEid called with incorrect length byte array ({})", address.length);
    EidBuilder builder = new EidBuilder();
    builder.setAddressType(Ipv6PrefixBinaryAfi.class);
    builder.setVirtualNetworkId(vni);
    builder.setAddress(new Ipv6PrefixBinaryBuilder().setIpv6AddressBinary(new Ipv6AddressBinary(address)).setIpv6MaskLength(mask).build());
    return builder.build();
}
Also used : Ipv6AddressBinary(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.Ipv6AddressBinary) EidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder) Ipv6PrefixBinaryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv6PrefixBinaryBuilder)

Aggregations

Ipv6AddressBinary (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.Ipv6AddressBinary)3 Ipv6PrefixBinaryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv6PrefixBinaryBuilder)3 EidBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder)2 Ipv6PrefixBinary (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv6PrefixBinary)1