Search in sources :

Example 1 with MappingEvent

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;
}
Also used : MappingEvent(org.onosproject.mapping.MappingEvent) StoredMappingEntry(org.onosproject.mapping.StoredMappingEntry)

Aggregations

MappingEvent (org.onosproject.mapping.MappingEvent)1 StoredMappingEntry (org.onosproject.mapping.StoredMappingEntry)1