use of org.onosproject.mapping.MappingEvent in project onos by opennetworkinglab.
the class SimpleMappingStore method addOrUpdateMappingEntry.
@Override
public MappingEvent addOrUpdateMappingEntry(Type type, MappingEntry entry) {
List<StoredMappingEntry> entries = getMappingEntriesInternal(type, entry.deviceId(), entry.id());
synchronized (entries) {
for (StoredMappingEntry stored : entries) {
if (stored.equals(entry)) {
if (stored.state() == PENDING_ADD) {
stored.setState(MappingEntryState.ADDED);
return new MappingEvent(MAPPING_ADDED, entry);
}
return new MappingEvent(MAPPING_UPDATED, entry);
}
}
}
log.error("Mapping was not found in store {} to update", entry);
return null;
}
Aggregations