use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc in project lispflowmapping by opendaylight.
the class HostInformationManager method attemptToCreateMappingRecord.
private synchronized void attemptToCreateMappingRecord(String hostId) {
List<Rloc> rlocForMappingRecord = hostIdToRlocMapper.getRlocs(hostId);
PortUuidToPortDataMapper uuidToEidMapper = hostIdToPortDataMapper.getAllPortData(hostId);
if (rlocForMappingRecord == null || rlocForMappingRecord.isEmpty() || uuidToEidMapper == null) {
return;
}
Collection<PortData> allUnprocessedPorts = uuidToEidMapper.getAllUnprocessedPorts();
List<LocatorRecord> locators = LispAddressUtil.asLocatorRecords(rlocForMappingRecord);
allUnprocessedPorts.forEach(portData -> {
lfmDbService.addMapping(LispUtil.buildAddMappingInput(portData.getPortEid(), locators));
uuidToEidMapper.addPortDataToProcessed(portData);
});
uuidToEidMapper.clearAllUnprocessedData();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method testRecievingNonProxyOnXtrPort.
public void testRecievingNonProxyOnXtrPort() throws SocketTimeoutException, SocketException, Throwable {
cleanUP();
configLispPlugin.shouldListenOnXtrPort(true);
notificationCalled = false;
final String eid = "10.10.10.10/32";
String rloc = "127.0.0.3";
int port = LispMessage.XTR_PORT_NUM;
RlocBuilder rb = new RlocBuilder();
rb.setAddressType(ApplicationDataLcaf.class);
rb.setVirtualNetworkId(null);
rb.setAddress(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ApplicationDataBuilder().setApplicationData(new ApplicationDataBuilder().setAddress(new SimpleAddress(new IpAddress(new Ipv4Address(rloc)))).setLocalPortLow(new PortNumber(port)).build()).build());
Rloc adLcaf = rb.build();
final MapRequest mapRequest = createNonProxyMapRequest(eid, adLcaf);
((LispMappingService) lms).getNotificationService().registerNotificationListener(new XtrRequestMappingListener() {
@Override
public void onXtrRequestMapping(XtrRequestMapping notification) {
assertEquals(((Ipv4Prefix) mapRequest.getEidItem().get(0).getEid().getAddress()).getIpv4Prefix().getValue(), eid);
notificationCalled = true;
LOG.warn("notification arrived");
}
});
sendMapRequest(mapRequest, port);
for (int i = 0; i < MAX_NOTIFICATION_RETRYS; i++) {
if (notificationCalled) {
return;
} else {
LOG.warn("notification hasn't arrived, sleeping...");
Thread.sleep(500);
}
}
fail("Notification hasn't arrived");
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method sendMapRegisterTwiceWithDiffrentValues.
private MapReply sendMapRegisterTwiceWithDiffrentValues(Eid eid, Rloc rloc1, Rloc rloc2) throws SocketTimeoutException {
mapService.addAuthenticationKey(eid, NULL_AUTH_KEY);
sleepForSeconds(1);
MapRegister mb = createMapRegister(eid, rloc1);
MapNotify mapNotify = lms.handleMapRegister(mb).getLeft();
MapRequest mr = createMapRequest(eid);
MapReply mapReply = lms.handleMapRequest(mr);
assertEquals(mb.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getRloc(), mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getRloc());
mb = createMapRegister(eid, rloc2);
mapNotify = lms.handleMapRegister(mb).getLeft();
assertEquals(8, mapNotify.getNonce().longValue());
mr = createMapRequest(eid);
sendMapRequest(mr);
mapReply = lms.handleMapRequest(mr);
return mapReply;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method testMapRegisterDosntOverwritesOtherSubKeys.
public void testMapRegisterDosntOverwritesOtherSubKeys() throws SocketTimeoutException {
cleanUP();
Eid eid = LispAddressUtil.asIpv4PrefixBinaryEid("1.2.3.4/32");
SimpleAddress rloc1Value = new SimpleAddress(new IpAddress(new Ipv4Address("4.3.2.1")));
Rloc rloc1 = LispAddressUtil.asKeyValueAddress("subkey1", rloc1Value);
SimpleAddress rloc2Value = new SimpleAddress(new IpAddress(new Ipv4Address("4.3.2.2")));
Rloc rloc2 = LispAddressUtil.asKeyValueAddress("subkey2", rloc2Value);
MapReply mapReply = sendMapRegisterTwiceWithDiffrentValues(eid, rloc1, rloc2);
assertEquals(2, mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().size());
assertEquals(rloc2, mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(0).getRloc());
assertEquals(rloc1, mapReply.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().get(1).getRloc());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method insertNBMapping.
private void insertNBMapping(Eid eid, List<Rloc> rlocs) {
MappingRecord record = MappingServiceIntegrationTestUtil.getDefaultMappingRecordBuilder(eid, rlocs).build();
mapService.addMapping(MappingOrigin.Northbound, record.getEid(), null, new MappingData(record));
sleepForMilliseconds(100);
MappingServiceIntegrationTestUtil.printMapCacheState(mapService);
}
Aggregations