use of org.onosproject.net.pi.runtime.PiPreEntryHandle in project onos by opennetworkinglab.
the class P4RuntimeReplicationGroupProgrammable method processGroupOp.
private void processGroupOp(Group pdGroup, GroupOperation.Type opType) {
final PiPreEntry preEntry;
try {
preEntry = translator.translate(pdGroup, pipeconf);
} catch (PiTranslationException e) {
log.warn("Unable to translate replication group, aborting {} operation: {} [{}]", opType, e.getMessage(), pdGroup);
return;
}
final PiPreEntryHandle handle = (PiPreEntryHandle) preEntry.handle(deviceId);
final PiPreEntry entryOnDevice = mirror.get(handle) == null ? null : mirror.get(handle).entry();
final Lock lock = STRIPED_LOCKS.get(handle);
lock.lock();
try {
processPreEntry(handle, preEntry, entryOnDevice, pdGroup, opType);
} finally {
lock.unlock();
}
}
use of org.onosproject.net.pi.runtime.PiPreEntryHandle in project onos by opennetworkinglab.
the class P4RuntimeReplicationGroupProgrammable method forgeGroupEntry.
private Group forgeGroupEntry(PiPreEntry preEntry) {
final PiPreEntryHandle handle = (PiPreEntryHandle) preEntry.handle(deviceId);
final Optional<PiTranslatedEntity<Group, PiPreEntry>> translatedEntity = translator.lookup(handle);
final TimedEntry<PiPreEntry> timedEntry = mirror.get(handle);
// Is entry consistent with our state?
if (!translatedEntity.isPresent()) {
log.warn("PRE entry handle not found in translation store: {}", handle);
return null;
}
if (timedEntry == null) {
log.warn("PRE entry handle not found in device mirror: {}", handle);
return null;
}
return addedGroup(translatedEntity.get().original(), timedEntry.lifeSec());
}
Aggregations