Search in sources :

Example 96 with Address

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address in project lispflowmapping by opendaylight.

the class Ipv6PrefixSerializer method deserializeData.

private static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix deserializeData(ByteBuffer buffer, LispAddressSerializerContext ctx) {
    byte[] ipBuffer = new byte[16];
    InetAddress address = null;
    buffer.get(ipBuffer);
    try {
        address = InetAddress.getByAddress(ipBuffer);
    } catch (UnknownHostException e) {
        LOG.debug("Unknown host {}", ipBuffer, e);
    }
    return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix(address.getHostAddress() + "/" + ctx.getMaskLen());
}
Also used : UnknownHostException(java.net.UnknownHostException) InetAddress(java.net.InetAddress) Ipv6Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6Prefix)

Example 97 with Address

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address in project lispflowmapping by opendaylight.

the class LispAddressStringifier method getAddrString.

private static String getAddrString(Destination dst, LispAddress lispAddress) {
    if (lispAddress == null) {
        return "null";
    }
    Address addr = lispAddress.getAddress();
    Long vni = null;
    if (lispAddress.getVirtualNetworkId() != null) {
        vni = lispAddress.getVirtualNetworkId().getValue();
    }
    return getAddrString(dst, addr, vni);
}
Also used : NoAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.NoAddress) Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address) LispAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddress) Inet4Address(java.net.Inet4Address) Inet6Address(java.net.Inet6Address) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress) KeyValueAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddress)

Example 98 with Address

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address in project lispflowmapping by opendaylight.

the class LispAddressStringifier method getStringFromAfiList.

protected static String getStringFromAfiList(Destination dst, AfiList addr) {
    // AFI 16387, LCAF Type 1; Address List
    // Example rendering:
    // {192.0.2.1,192.0.2.2,2001:db8::1}
    List<SimpleAddress> addresses = addr.getAfiList().getAddressList();
    StringBuilder sb = new StringBuilder("{");
    boolean needComma = false;
    for (SimpleAddress a : addresses) {
        if (needComma) {
            sb.append(",");
        }
        sb.append(a.getValue());
        needComma = true;
    }
    sb.append("}");
    return sb.toString();
}
Also used : SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)

Example 99 with Address

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address in project lispflowmapping by opendaylight.

the class LispAddressUtil method toEid.

public static Eid toEid(Ipv4Prefix prefix, InstanceIdType vni) {
    EidBuilder builder = new EidBuilder();
    builder.setAddressType(Ipv4PrefixAfi.class);
    builder.setVirtualNetworkId(vni);
    builder.setAddress((Address) new Ipv4PrefixBuilder().setIpv4Prefix(prefix).build());
    return builder.build();
}
Also used : Ipv4PrefixBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder) EidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder)

Example 100 with Address

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address in project lispflowmapping by opendaylight.

the class LispAddressUtil method asIpv4PrefixEid.

public static Eid asIpv4PrefixEid(Eid eid, Inet4Address address, short mask) {
    EidBuilder builder = new EidBuilder();
    builder.setAddressType(Ipv4PrefixAfi.class);
    builder.setVirtualNetworkId(eid.getVirtualNetworkId());
    builder.setAddress(new Ipv4PrefixBuilder().setIpv4Prefix(IetfInetUtil.INSTANCE.ipv4PrefixFor(address, mask)).build());
    return builder.build();
}
Also used : Ipv4PrefixBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder) EidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder)

Aggregations

Test (org.junit.Test)209 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)90 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)79 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)77 ArrayList (java.util.ArrayList)67 Ipv6Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)66 ByteBuf (io.netty.buffer.ByteBuf)57 InetAddress (java.net.InetAddress)57 SimpleAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)55 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)52 BigInteger (java.math.BigInteger)41 Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address)41 Inet6Address (java.net.Inet6Address)39 KeyValueAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddress)39 Inet4Address (java.net.Inet4Address)36 NoAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.NoAddress)29 Ipv4Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix)28 LispAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddress)27 EidBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder)26 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)25