use of org.opendaylight.lispflowmapping.lisp.type.MappingData in project lispflowmapping by opendaylight.
the class MappingMergeUtilTest method computeNbSbIntersectionTest_withMaskableIpv4PrefixEIDs_.
/**
* Tests {@link MappingMergeUtil#computeNbSbIntersection} method, Nb mask greater than SB mask.
*/
@Test
public void computeNbSbIntersectionTest_withMaskableIpv4PrefixEIDs_() {
MappingRecord nbMappingRecord = getDefaultMappingRecordBuilder().setEid(IPV4_PREFIX_EID_1).build();
MappingRecord sbMappingRecord = getDefaultMappingRecordBuilder().setEid(IPV4_PREFIX_EID_2).build();
MappingData nbMappingData = getDefaultMappingData(nbMappingRecord);
MappingData sbMappingData = getDefaultMappingData(sbMappingRecord);
// result
MappingData result = MappingMergeUtil.computeNbSbIntersection(nbMappingData, sbMappingData);
assertEquals(IPV4_PREFIX_EID_1, result.getRecord().getEid());
}
use of org.opendaylight.lispflowmapping.lisp.type.MappingData in project lispflowmapping by opendaylight.
the class MappingMergeUtilTest method computeNbSbIntersectionTest_withMaskableSourceDestKeyEIDs_Ipv6SB.
/**
* Tests {@link MappingMergeUtil#computeNbSbIntersection} method with SourceDestKey Eid address type, Ipv6Prefix
* SB Eid, Nb mask less than SB mask.
*/
@Test
public void computeNbSbIntersectionTest_withMaskableSourceDestKeyEIDs_Ipv6SB() {
MappingRecord nbMappingRecord = getDefaultMappingRecordBuilder().setEid(SOURCE_DEST_KEY_EID_1).build();
MappingRecord sbMappingRecord = getDefaultMappingRecordBuilder().setEid(IPV6_PREFIX_EID).build();
MappingData nbMappingData = getDefaultMappingData(nbMappingRecord);
MappingData sbMappingData = getDefaultMappingData(sbMappingRecord);
// result
final MappingData result = MappingMergeUtil.computeNbSbIntersection(nbMappingData, sbMappingData);
final Eid eid = LispAddressUtil.asSrcDstEid(IPV4_STRING_3, IPV6_STRING, 24, 96, 1);
assertEquals(eid, result.getRecord().getEid());
}
use of org.opendaylight.lispflowmapping.lisp.type.MappingData in project lispflowmapping by opendaylight.
the class MappingMergeUtilTest method getCommonLocatorRecords_withNullLocatorRecords.
/**
* Tests {@link MappingMergeUtil#getCommonLocatorRecords} method with list of locator records == null.
*/
@Test
public void getCommonLocatorRecords_withNullLocatorRecords() {
MappingRecord nbMappingRecord = getDefaultMappingRecordBuilder().setLocatorRecord(null).build();
MappingRecord sbMappingRecord = getDefaultMappingRecordBuilder().setLocatorRecord(null).build();
MappingData nbMappingData = getDefaultMappingData(nbMappingRecord);
MappingData sbMappingData = getDefaultMappingData(sbMappingRecord);
// result
MappingData result = MappingMergeUtil.computeNbSbIntersection(nbMappingData, sbMappingData);
assertNull(result.getRecord().getLocatorRecord());
}
use of org.opendaylight.lispflowmapping.lisp.type.MappingData in project lispflowmapping by opendaylight.
the class MappingService method getMappingWithXtrId.
@Override
public Future<RpcResult<GetMappingWithXtrIdOutput>> getMappingWithXtrId(GetMappingWithXtrIdInput input) {
Preconditions.checkNotNull(input, "get-mapping RPC input must be not null!");
LOG.trace("RPC received to get the following mapping: " + input.toString());
RpcResultBuilder<GetMappingWithXtrIdOutput> rpcResultBuilder;
MappingData reply = mappingSystem.getMapping(null, convertToBinaryIfNecessary(input.getEid()), input.getXtrId());
if (reply == null) {
String message = "No mapping was found in the mapping database";
rpcResultBuilder = RpcResultBuilder.<GetMappingWithXtrIdOutput>failed().withError(RpcError.ErrorType.APPLICATION, NOT_FOUND_TAG, message);
} else {
final MappingRecord convertedReply = convertFromBinaryIfNecessary(reply.getRecord());
rpcResultBuilder = RpcResultBuilder.success(new GetMappingWithXtrIdOutputBuilder().setMappingRecord(convertedReply));
}
return Futures.immediateFuture(rpcResultBuilder.build());
}
Aggregations