Search in sources :

Example 1 with LispLcafAddress

use of org.onosproject.lisp.msg.types.lcaf.LispLcafAddress in project onos by opennetworkinglab.

the class LispExtensionMappingAddressInterpreterTest method getLcafMappingAddress.

private LispLcafAddress getLcafMappingAddress(ExtensionMappingAddressType type) {
    LispLcafAddress address = null;
    LispAfiAddress ipv4Addr = new LispIpv4Address(IPV4_ADDRESS);
    LispAfiAddress ipv6Addr = new LispIpv6Address(IPV6_ADDRESS);
    if (type.equals(LIST_ADDRESS.type())) {
        address = new LispListLcafAddress(ImmutableList.of(ipv4Addr, ipv6Addr));
    }
    if (type.equals(SEGMENT_ADDRESS.type())) {
        address = new LispSegmentLcafAddress.SegmentAddressBuilder().withInstanceId(UNIQUE_INT).withAddress(ipv4Addr).build();
    }
    if (type.equals(AS_ADDRESS.type())) {
        address = new LispAsLcafAddress.AsAddressBuilder().withAsNumber(UNIQUE_INT).withAddress(ipv4Addr).build();
    }
    if (type.equals(APPLICATION_DATA_ADDRESS.type())) {
        address = new LispAppDataLcafAddress.AppDataAddressBuilder().withProtocol(UNIQUE_BYTE).withIpTos(UNIQUE_INT).withLocalPortLow(UNIQUE_SHORT).withLocalPortHigh(UNIQUE_SHORT).withRemotePortLow(UNIQUE_SHORT).withRemotePortHigh(UNIQUE_SHORT).withAddress(ipv4Addr).build();
    }
    if (type.equals(GEO_COORDINATE_ADDRESS.type())) {
        address = new LispGeoCoordinateLcafAddress.GeoCoordinateAddressBuilder().withIsNorth(UNIQUE_BOOLEAN).withLatitudeDegree(UNIQUE_SHORT).withLatitudeMinute(UNIQUE_BYTE).withLatitudeSecond(UNIQUE_BYTE).withIsEast(UNIQUE_BOOLEAN).withLongitudeDegree(UNIQUE_SHORT).withLongitudeMinute(UNIQUE_BYTE).withLongitudeSecond(UNIQUE_BYTE).withAltitude(UNIQUE_INT).withAddress(ipv4Addr).build();
    }
    if (type.equals(NAT_ADDRESS.type())) {
        address = new LispNatLcafAddress.NatAddressBuilder().withMsUdpPortNumber(UNIQUE_SHORT).withEtrUdpPortNumber(UNIQUE_SHORT).withGlobalEtrRlocAddress(ipv4Addr).withMsRlocAddress(ipv4Addr).withPrivateEtrRlocAddress(ipv4Addr).withRtrRlocAddresses(ImmutableList.of(ipv4Addr, ipv6Addr)).build();
    }
    if (type.equals(NONCE_ADDRESS.type())) {
        address = new LispNonceLcafAddress.NonceAddressBuilder().withNonce(UNIQUE_INT).withAddress(ipv4Addr).build();
    }
    if (type.equals(MULTICAST_ADDRESS.type())) {
        address = new LispMulticastLcafAddress.MulticastAddressBuilder().withInstanceId(UNIQUE_INT).withSrcMaskLength(UNIQUE_BYTE).withSrcAddress(ipv4Addr).withGrpMaskLength(UNIQUE_BYTE).withGrpAddress(ipv4Addr).build();
    }
    if (type.equals(TRAFFIC_ENGINEERING_ADDRESS.type())) {
        LispTeRecord tr = new LispTeRecord.TeRecordBuilder().withIsLookup(UNIQUE_BOOLEAN).withIsRlocProbe(UNIQUE_BOOLEAN).withIsStrict(UNIQUE_BOOLEAN).withRtrRlocAddress(ipv4Addr).build();
        address = new LispTeLcafAddress.TeAddressBuilder().withTeRecords(ImmutableList.of(tr)).build();
    }
    if (type.equals(SOURCE_DEST_ADDRESS.type())) {
        address = new LispSourceDestLcafAddress.SourceDestAddressBuilder().withSrcMaskLength(UNIQUE_BYTE).withSrcPrefix(ipv4Addr).withDstMaskLength(UNIQUE_BYTE).withDstPrefix(ipv4Addr).build();
    }
    return address;
}
Also used : LispTeRecord(org.onosproject.lisp.msg.types.lcaf.LispTeRecord) LispListLcafAddress(org.onosproject.lisp.msg.types.lcaf.LispListLcafAddress) LispMulticastLcafAddress(org.onosproject.lisp.msg.types.lcaf.LispMulticastLcafAddress) LispAfiAddress(org.onosproject.lisp.msg.types.LispAfiAddress) LispLcafAddress(org.onosproject.lisp.msg.types.lcaf.LispLcafAddress) LispIpv6Address(org.onosproject.lisp.msg.types.LispIpv6Address) LispIpv4Address(org.onosproject.lisp.msg.types.LispIpv4Address) LispAppDataLcafAddress(org.onosproject.lisp.msg.types.lcaf.LispAppDataLcafAddress) LispTeLcafAddress(org.onosproject.lisp.msg.types.lcaf.LispTeLcafAddress)

Aggregations

LispAfiAddress (org.onosproject.lisp.msg.types.LispAfiAddress)1 LispIpv4Address (org.onosproject.lisp.msg.types.LispIpv4Address)1 LispIpv6Address (org.onosproject.lisp.msg.types.LispIpv6Address)1 LispAppDataLcafAddress (org.onosproject.lisp.msg.types.lcaf.LispAppDataLcafAddress)1 LispLcafAddress (org.onosproject.lisp.msg.types.lcaf.LispLcafAddress)1 LispListLcafAddress (org.onosproject.lisp.msg.types.lcaf.LispListLcafAddress)1 LispMulticastLcafAddress (org.onosproject.lisp.msg.types.lcaf.LispMulticastLcafAddress)1 LispTeLcafAddress (org.onosproject.lisp.msg.types.lcaf.LispTeLcafAddress)1 LispTeRecord (org.onosproject.lisp.msg.types.lcaf.LispTeRecord)1