@Override
    public LispLcafAddress mapMappingAddress(ExtensionMappingAddress mappingAddress) {
        ExtensionMappingAddressType type = mappingAddress.type();

        if (type.equals(LIST_ADDRESS.type())) {

            LispListAddress listAddress = (LispListAddress) mappingAddress;
            LispAfiAddress ipv4 = mapping2afi(listAddress.getIpv4());
            LispAfiAddress ipv6 = mapping2afi(listAddress.getIpv6());

            if (ipv4 != null && ipv6 != null) {
                return new LispListLcafAddress(ImmutableList.of(ipv4, ipv6));
            } else {
                return new LispListLcafAddress(ImmutableList.of());
            }
        }

        if (type.equals(SEGMENT_ADDRESS.type())) {

            LispSegmentAddress segmentAddress = (LispSegmentAddress) mappingAddress;

            return new LispSegmentLcafAddress.SegmentAddressBuilder()
                    .withInstanceId(segmentAddress.getInstanceId())
                    .withAddress(getAfiAddress(segmentAddress.getAddress()))
                    .build();
        }

        if (type.equals(AS_ADDRESS.type())) {

            LispAsAddress asAddress = (LispAsAddress) mappingAddress;

            return new LispAsLcafAddress.AsAddressBuilder()
                            .withAsNumber(asAddress.getAsNumber())
                            .withAddress(getAfiAddress(asAddress.getAddress()))
                            .build();
        }

        if (type.equals(APPLICATION_DATA_ADDRESS.type())) {

            LispAppDataAddress appDataAddress = (LispAppDataAddress) mappingAddress;

            return new LispAppDataLcafAddress.AppDataAddressBuilder()
                            .withProtocol(appDataAddress.getProtocol())
                            .withIpTos(appDataAddress.getIpTos())
                            .withLocalPortLow(appDataAddress.getLocalPortLow())
                            .withLocalPortHigh(appDataAddress.getLocalPortHigh())
                            .withRemotePortLow(appDataAddress.getRemotePortLow())
                            .withRemotePortHigh(appDataAddress.getRemotePortHigh())
                            .withAddress(getAfiAddress(appDataAddress.getAddress()))
                            .build();
        }

        if (type.equals(GEO_COORDINATE_ADDRESS.type())) {

            LispGcAddress gcAddress = (LispGcAddress) mappingAddress;

            return new LispGeoCoordinateLcafAddress.GeoCoordinateAddressBuilder()
                            .withIsNorth(gcAddress.isNorth())
                            .withLatitudeDegree(gcAddress.getLatitudeDegree())
                            .withLatitudeMinute(gcAddress.getLatitudeMinute())
                            .withLatitudeSecond(gcAddress.getLatitudeSecond())
                            .withIsEast(gcAddress.isEast())
                            .withLongitudeDegree(gcAddress.getLongitudeDegree())
                            .withLongitudeMinute(gcAddress.getLongitudeMinute())
                            .withLongitudeSecond(gcAddress.getLongitudeSecond())
                            .withAltitude(gcAddress.getAltitude())
                            .withAddress(getAfiAddress(gcAddress.getAddress()))
                            .build();
        }

        if (type.equals(NAT_ADDRESS.type())) {

            LispNatAddress natAddress = (LispNatAddress) mappingAddress;

            List<LispAfiAddress> aas = Lists.newArrayList();

            natAddress.getRtrRlocAddresses()
                    .forEach(rtr -> aas.add(getAfiAddress(rtr)));

            return new LispNatLcafAddress.NatAddressBuilder()
                            .withMsUdpPortNumber(natAddress.getMsUdpPortNumber())
                            .withEtrUdpPortNumber(natAddress.getEtrUdpPortNumber())
                            .withMsRlocAddress(getAfiAddress(natAddress.getMsRlocAddress()))
                            .withGlobalEtrRlocAddress(
                                    getAfiAddress(natAddress.getGlobalEtrRlocAddress()))
                            .withPrivateEtrRlocAddress(
                                    getAfiAddress(natAddress.getPrivateEtrRlocAddress()))
                            .withRtrRlocAddresses(aas)
                            .build();
        }

        if (type.equals(NONCE_ADDRESS.type())) {

            LispNonceAddress nonceAddress = (LispNonceAddress) mappingAddress;

            return new LispNonceLcafAddress.NonceAddressBuilder()
                            .withNonce(nonceAddress.getNonce())
                            .withAddress(getAfiAddress(nonceAddress.getAddress()))
                            .build();
        }

        if (type.equals(MULTICAST_ADDRESS.type())) {

            LispMulticastAddress multicastAddress = (LispMulticastAddress) mappingAddress;

            return new LispMulticastLcafAddress.MulticastAddressBuilder()
                            .withInstanceId(multicastAddress.getInstanceId())
                            .withSrcAddress(getAfiAddress(multicastAddress.getSrcAddress()))
                            .withSrcMaskLength(multicastAddress.getSrcMaskLength())
                            .withGrpAddress(getAfiAddress(multicastAddress.getGrpAddress()))
                            .withGrpMaskLength(multicastAddress.getGrpMaskLength())
                            .build();
        }

        if (type.equals(TRAFFIC_ENGINEERING_ADDRESS.type())) {

            LispTeAddress teAddress = (LispTeAddress) mappingAddress;

            List<LispTeRecord> records = Lists.newArrayList();

            teAddress.getTeRecords().forEach(record -> {
                LispTeRecord teRecord =
                        new LispTeRecord.TeRecordBuilder()
                                .withIsLookup(record.isLookup())
                                .withIsRlocProbe(record.isRlocProbe())
                                .withIsStrict(record.isStrict())
                                .withRtrRlocAddress(getAfiAddress(
                                        record.getAddress()))
                                .build();
                records.add(teRecord);
            });

            return new LispTeLcafAddress.TeAddressBuilder()
                            .withTeRecords(records)
                            .build();
        }

        if (type.equals(SOURCE_DEST_ADDRESS.type())) {

            LispSrcDstAddress srcDstAddress = (LispSrcDstAddress) mappingAddress;

            return new LispSourceDestLcafAddress.SourceDestAddressBuilder()
                            .withSrcPrefix(getAfiAddress(srcDstAddress.getSrcPrefix()))
                            .withSrcMaskLength(srcDstAddress.getSrcMaskLength())
                            .withDstPrefix(getAfiAddress(srcDstAddress.getDstPrefix()))
                            .withDstMaskLength(srcDstAddress.getDstMaskLength())
                            .build();
        }

        log.error("Unsupported extension mapping address type {}", mappingAddress.type());

        return null;
    }
@Test
    public void testMapMappingAddress() {

        new EqualsTester()
                .addEqualityGroup(listLcafAddress, interpreter.mapMappingAddress(listExtAddress))
                .addEqualityGroup(segmentLcafAddress, interpreter.mapMappingAddress(segmentExtAddress))
                .addEqualityGroup(asLcafAddress, interpreter.mapMappingAddress(asExtAddress))
                .addEqualityGroup(appDataLcafAddress, interpreter.mapMappingAddress(appDataExtAddress))
                .addEqualityGroup(gcLcafAddress, interpreter.mapMappingAddress(gcExtAddress))
                .addEqualityGroup(natLcafAddress, interpreter.mapMappingAddress(natExtAddress))
                .addEqualityGroup(nonceLcafAddress, interpreter.mapMappingAddress(nonceExtAddress))
                .addEqualityGroup(multicastLcafAddress, interpreter.mapMappingAddress(multicastExtAddress))
                .addEqualityGroup(teLcafAddress, interpreter.mapMappingAddress(teExtAddress))
                .addEqualityGroup(srcDstLcafAddress, interpreter.mapMappingAddress(srcDstExtAddress))
                .testEquals();
    }