use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord in project lispflowmapping by opendaylight.
the class MappingServiceTest method updateMappingTest.
/**
* Tests {@link MappingService#updateMapping} method.
*/
@Test
public void updateMappingTest() throws ExecutionException, InterruptedException {
final MappingRecord mappingRecord = getDefaultMappingRecordBuilder().build();
final UpdateMappingInput updateMappingInput = new UpdateMappingInputBuilder().setMappingRecord(mappingRecord).build();
final Future<RpcResult<Void>> result = mappingService.updateMapping(updateMappingInput);
Mockito.verify(dsbe).updateMapping(RPCInputConvertorUtil.toMapping(updateMappingInput));
assertEquals(RPC_RESULT_SUCCESS.getErrors(), result.get().getErrors());
assertEquals(RPC_RESULT_SUCCESS.getResult(), result.get().getResult());
assertEquals(RPC_RESULT_SUCCESS.isSuccessful(), result.get().isSuccessful());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord in project lispflowmapping by opendaylight.
the class MappingMergeUtilTest method getCommonLocatorRecords_withEmptyLocatorRecords.
/**
* Tests {@link MappingMergeUtil#getCommonLocatorRecords} method with empty list of locator records.
*/
@Test
public void getCommonLocatorRecords_withEmptyLocatorRecords() {
MappingRecord nbMappingRecord = getDefaultMappingRecordBuilder().setEid(IPV4_EID_2).build();
MappingRecord sbMappingRecord = getDefaultMappingRecordBuilder().setEid(IPV4_EID_1).build();
MappingData nbMappingData = getDefaultMappingData(nbMappingRecord);
MappingData sbMappingData = getDefaultMappingData(sbMappingRecord);
// result
MappingData result = MappingMergeUtil.computeNbSbIntersection(nbMappingData, sbMappingData);
assertEquals(0, result.getRecord().getLocatorRecord().size());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord in project lispflowmapping by opendaylight.
the class MappingMergeUtilTest method computeNbSbIntersectionTest_withMaskableIpv4PrefixEIDs.
/**
* Tests {@link MappingMergeUtil#computeNbSbIntersection} method, Nb mask less than SB mask.
*/
@Test
public void computeNbSbIntersectionTest_withMaskableIpv4PrefixEIDs() {
MappingRecord nbMappingRecord = getDefaultMappingRecordBuilder().setEid(IPV4_PREFIX_EID_2).build();
MappingRecord sbMappingRecord = getDefaultMappingRecordBuilder().setEid(IPV4_PREFIX_EID_1).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.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord in project lispflowmapping by opendaylight.
the class MappingMergeUtilTest method computeNbSbIntersectionTest_withMaskableSourceDestKeyEIDs_Ipv4SB.
/**
* Tests {@link MappingMergeUtil#computeNbSbIntersection} method with SourceDestKey Eid address type, Ipv4Prefix
* SB Eid, Nb mask less than SB mask.
*/
@Test
public void computeNbSbIntersectionTest_withMaskableSourceDestKeyEIDs_Ipv4SB() {
MappingRecord nbMappingRecord = getDefaultMappingRecordBuilder().setEid(SOURCE_DEST_KEY_EID_1).build();
MappingRecord sbMappingRecord = getDefaultMappingRecordBuilder().setEid(IPV4_PREFIX_EID_1).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, IPV4_STRING_1, 24, 24, 1);
assertEquals(eid, result.getRecord().getEid());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord in project lispflowmapping by opendaylight.
the class MappingService method convertFromBinaryIfNecessary.
private static MappingRecord convertFromBinaryIfNecessary(MappingRecord originalRecord) {
List<LocatorRecord> originalLocators = originalRecord.getLocatorRecord();
List<LocatorRecord> convertedLocators = null;
if (originalLocators != null) {
// If convertedLocators is non-null, while originalLocators is also non-null, conversion has been made
convertedLocators = convertFromBinaryIfNecessary(originalLocators);
}
if (LispAddressUtil.addressNeedsConversionFromBinary(originalRecord.getEid().getAddress()) || (originalLocators != null && convertedLocators != null)) {
MappingRecordBuilder mrb = new MappingRecordBuilder(originalRecord);
mrb.setEid(LispAddressUtil.convertFromBinary(originalRecord.getEid()));
if (convertedLocators != null) {
mrb.setLocatorRecord(convertedLocators);
}
return mrb.build();
}
return originalRecord;
}
Aggregations