use of org.opendaylight.lispflowmapping.neutron.mappingmanager.mappers.PortUuidToPortDataMapper in project lispflowmapping by opendaylight.
the class PortUuidToPortDataMapperTest method transferAllProcessedPortDataToUnprocessedTest.
@Test
public void transferAllProcessedPortDataToUnprocessedTest() {
PortUuidToPortDataMapper portUuidToPortDataMapper = new PortUuidToPortDataMapper();
portUuidToPortDataMapper.addUnprocessedUuidToPortDataMapping(PORT_DATA_3.getPortUuid(), PORT_DATA_3);
portUuidToPortDataMapper.addUnprocessedUuidToPortDataMapping(PORT_DATA_4.getPortUuid(), PORT_DATA_4);
portUuidToPortDataMapper.addPortDataToProcessed(PORT_DATA_1);
portUuidToPortDataMapper.addPortDataToProcessed(PORT_DATA_2);
portUuidToPortDataMapper.transferAllProcessedPortDataToUnprocessed();
processedAndUnprocessedDataAmountVerify(portUuidToPortDataMapper, 0, 4);
HashMap<String, PortData> unprocessedPortData = extractUnprocessedDataMap(portUuidToPortDataMapper);
Assert.assertEquals(PORT_DATA_1, unprocessedPortData.get(PORT_DATA_1.getPortUuid()));
Assert.assertEquals(PORT_DATA_2, unprocessedPortData.get(PORT_DATA_2.getPortUuid()));
Assert.assertEquals(PORT_DATA_3, unprocessedPortData.get(PORT_DATA_3.getPortUuid()));
Assert.assertEquals(PORT_DATA_4, unprocessedPortData.get(PORT_DATA_4.getPortUuid()));
}
use of org.opendaylight.lispflowmapping.neutron.mappingmanager.mappers.PortUuidToPortDataMapper in project lispflowmapping by opendaylight.
the class PortUuidToPortDataMapperTest method unprocessedPortDataAddTest.
@Test
public void unprocessedPortDataAddTest() {
PortUuidToPortDataMapper portUuidToPortDataMapper = new PortUuidToPortDataMapper();
portUuidToPortDataMapper.addUnprocessedUuidToPortDataMapping(PORT_DATA_1.getPortUuid(), PORT_DATA_1);
portUuidToPortDataMapper.addUnprocessedUuidToPortDataMapping(PORT_DATA_2.getPortUuid(), PORT_DATA_2);
processedAndUnprocessedDataAmountVerify(portUuidToPortDataMapper, 0, 2);
}
use of org.opendaylight.lispflowmapping.neutron.mappingmanager.mappers.PortUuidToPortDataMapper 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.lispflowmapping.neutron.mappingmanager.mappers.PortUuidToPortDataMapper in project lispflowmapping by opendaylight.
the class HostInformationManager method attemptToDeleteMappingRecord.
private synchronized void attemptToDeleteMappingRecord(String hostId, String portUuid) {
PortUuidToPortDataMapper uuidToEidMapper = hostIdToPortDataMapper.getAllPortData(hostId);
if (uuidToEidMapper == null) {
return;
}
PortData oldPortData = uuidToEidMapper.getProcessedPortData(portUuid);
if (oldPortData == null) {
return;
}
RemoveMappingInput removeMappingInput = LispUtil.buildRemoveMappingInput(oldPortData.getPortEid());
lfmDbService.removeMapping(removeMappingInput);
uuidToEidMapper.deleteProcessedPortData(portUuid);
}
use of org.opendaylight.lispflowmapping.neutron.mappingmanager.mappers.PortUuidToPortDataMapper in project lispflowmapping by opendaylight.
the class PortUuidToPortDataMapperTest method addPortDataToProcessedTest.
@Test
public void addPortDataToProcessedTest() {
PortUuidToPortDataMapper portUuidToPortDataMapper = new PortUuidToPortDataMapper();
portUuidToPortDataMapper.addPortDataToProcessed(PORT_DATA_1);
portUuidToPortDataMapper.addPortDataToProcessed(PORT_DATA_2);
processedAndUnprocessedDataAmountVerify(portUuidToPortDataMapper, 2, 0);
}
Aggregations