use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord in project lispflowmapping by opendaylight.
the class LispSouthboundHandlerTest method mapRegister__TwoRlocs.
@Test
public void mapRegister__TwoRlocs() throws Exception {
// P Bit & M Bit set
// EID prefix: 172.1.1.2/32, TTL: 10, Authoritative, No-Action
// Local RLOC: 10.1.0.110, Reachable, Priority/Weight: 1/100, Multicast
// Priority/Weight: 255/0
// Local RLOC: 192.168.136.51, Reachable, Priority/Weight: 6/100,
// Multicast Priority/Weight: 255/0
mapRegisterPacket = extractWSUdpByteArray("0000 00 0c 29 7a ce 8d 00 0c 29 e4 ef 70 08 00 45 00 " + "0010 00 68 00 00 40 00 40 11 26 15 0a 01 00 6e 0a 01 " + "0020 00 01 10 f6 10 f6 00 54 03 3b 38 00 01 01 00 00 " + "0030 00 00 00 00 00 00 00 01 00 14 ae d8 7b d4 9c 59 " + "0040 e9 35 75 6e f1 29 27 a3 45 20 96 06 c2 e1 00 00 " + "0050 00 0a 02 20 10 00 00 00 00 01 ac 01 01 02 01 64 " + "0060 ff 00 00 05 00 01 0a 01 00 6e 06 64 ff 00 00 05 " + "0070 00 01 c0 a8 88 33");
ArgumentCaptor<AddMapping> captor = ArgumentCaptor.forClass(AddMapping.class);
handleMapRegisterPacket(mapRegisterPacket);
Mockito.verify(mockLispSouthboundPlugin).sendNotificationIfPossible(captor.capture());
List<MappingRecordItem> eidRecords = captor.getValue().getMapRegister().getMappingRecordItem();
assertEquals(1, eidRecords.size());
MappingRecord eidRecord = eidRecords.get(0).getMappingRecord();
assertEquals(2, eidRecord.getLocatorRecord().size());
assertEquals(LispAddressUtil.asIpv4Rloc("10.1.0.110"), eidRecord.getLocatorRecord().get(0).getRloc());
assertEquals(LispAddressUtil.asIpv4Rloc("192.168.136.51"), eidRecord.getLocatorRecord().get(1).getRloc());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord in project lispflowmapping by opendaylight.
the class LispUtilTest method buildAddMappingInputTest.
/**
* Tests {@link LispUtil#buildAddMappingInput} method.
*/
@Test
public void buildAddMappingInputTest() {
final MappingRecord mappingRecord = new MappingRecordBuilder().setAction(MappingRecord.Action.NoAction).setAuthoritative(true).setEid(EID).setLocatorRecord(Lists.newArrayList(getDefaultLocatorRecord())).setMapVersion((short) 0).setRecordTtl(RECORD_TTL).build();
final AddMappingInput expectedResult = new AddMappingInputBuilder().setMappingRecord(mappingRecord).build();
final AddMappingInput result = LispUtil.buildAddMappingInput(EID, Lists.newArrayList(LOCATOR_RECORD));
assertEquals(expectedResult, result);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method test14SBpositiveToSBmoreSpecific.
/*
* Mapping change: adding a more specific southbound mapping overlapping a less specific one
* Support status: SUPPORTED
* Description: When a more specific SB mapping is added, the subscribers of the overlapping less specific existing
* SB mapping are notified.
*/
private void test14SBpositiveToSBmoreSpecific() {
cleanUP();
allowNullAuthenticationForAllIPv4(1L);
insertSBMappings(false, 1L, "192.168.0.0/16");
MapReply mapReply = lms.handleMapRequest(newMapRequest(1L, "192.168.0.1/32"));
Eid expectedPositivePrefix = LispAddressUtil.asIpv4PrefixBinaryEid(1L, "192.168.0.0/16");
MappingRecord mr = mapReply.getMappingRecordItem().get(0).getMappingRecord();
assertEquals(expectedPositivePrefix, mr.getEid());
assertTrue(MappingRecordUtil.isPositiveMapping(mr));
registerSBMapping(1L, "192.168.254.0/24", "10.10.10.10");
MappingServiceIntegrationTestUtil.checkSmr(socket, lms, mapService, 1L, "192.168.0.0");
mapReply = lms.handleMapRequest(newMapRequest(1L, "192.168.0.1/32"));
expectedPositivePrefix = LispAddressUtil.asIpv4PrefixBinaryEid(1L, "192.168.0.0/16");
mr = mapReply.getMappingRecordItem().get(0).getMappingRecord();
assertEquals(expectedPositivePrefix, mr.getEid());
assertTrue(MappingRecordUtil.isPositiveMapping(mr));
mapReply = lms.handleMapRequest(newMapRequest(1L, "192.168.254.1/32"));
expectedPositivePrefix = LispAddressUtil.asIpv4PrefixBinaryEid(1L, "192.168.254.0/24");
mr = mapReply.getMappingRecordItem().get(0).getMappingRecord();
assertEquals(expectedPositivePrefix, mr.getEid());
assertTrue(MappingRecordUtil.isPositiveMapping(mr));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method timedOutMappingRecord.
private void timedOutMappingRecord() {
cleanUP();
mapService.setMappingMerge(true);
// mapping expires after 1 second
ConfigIni.getInstance().setRegistrationValiditySb(1000L);
final Eid eid = LispAddressUtil.asIpv4PrefixBinaryEid("1.2.3.4/32", new InstanceIdType(10L));
final MappingRecord mappingRecord = MappingServiceIntegrationTestUtil.getDefaultMappingRecordBuilder(eid).setRecordTtl(1000).build();
mapService.addAuthenticationKey(eid, NULL_AUTH_KEY);
mapService.addMapping(MappingOrigin.Southbound, eid, MappingServiceIntegrationTestUtil.DEFAULT_SITE_ID, new MappingData(mappingRecord, System.currentTimeMillis()));
sleepForSeconds(2);
MappingRecord resultRecord = (MappingRecord) mapService.getMapping(MappingOrigin.Southbound, eid);
assertNull(resultRecord);
ConfigIni.getInstance().setRegistrationValiditySb(ConfigIni.getInstance().getDefaultRegistrationValiditySb());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method insertSBMappings.
private void insertSBMappings(boolean negative, long iid, String... prefixes) {
LOG.debug("Adding Southbound mappings in VNI {} for prefixes: {}", iid, prefixes);
final InstanceIdType iiType = new InstanceIdType(iid);
for (String prefix : prefixes) {
MappingRecord record;
if (negative) {
record = newMappingRecordNegative(prefix, iiType);
} else {
record = newMappingRecord(prefix, iiType);
}
mapService.addMapping(MappingOrigin.Southbound, record.getEid(), null, new MappingData(record, System.currentTimeMillis()));
}
MappingServiceIntegrationTestUtil.printMapCacheState(mapService);
}
Aggregations