use of org.onosproject.drivers.p4runtime.P4RuntimeDriverProperties.DEFAULT_SUPPORT_DEFAULT_TABLE_ENTRY in project onos by opennetworkinglab.
the class AbstractP4RuntimePipelineProgrammable method getDefaultEntries.
/**
* Once the pipeconf is set successfully, we should store all the default entries
* before notify other service to prevent overwriting the default entries.
* Default entries may be used in P4RuntimeFlowRuleProgrammable.
* <p>
* This method returns a completable future with the result of the pipeconf set
* operation (which might not be true).
*
* @param pipeconfSet completable future for setting pipeconf
* @param pipeconf pipeconf
* @return completable future eventually true if the pipeconf set successfully
*/
private CompletableFuture<Boolean> getDefaultEntries(CompletableFuture<Boolean> pipeconfSet, PiPipeconf pipeconf) {
if (!driverBoolProperty(SUPPORT_DEFAULT_TABLE_ENTRY, DEFAULT_SUPPORT_DEFAULT_TABLE_ENTRY)) {
return pipeconfSet;
}
return pipeconfSet.thenApply(setSuccess -> {
if (!setSuccess) {
return setSuccess;
}
final P4RuntimeDefaultEntryMirror mirror = handler().get(P4RuntimeDefaultEntryMirror.class);
final PiPipelineModel pipelineModel = pipeconf.pipelineModel();
final P4RuntimeReadClient.ReadRequest request = client.read(p4DeviceId, pipeconf);
// Read default entries from all non-constant tables.
// Ignore constant default entries.
pipelineModel.tables().stream().filter(t -> !t.isConstantTable()).forEach(t -> {
if (!t.constDefaultAction().isPresent()) {
request.defaultTableEntry(t.id());
}
});
final P4RuntimeReadClient.ReadResponse response = request.submitSync();
mirror.sync(deviceId, response.all(PiTableEntry.class));
return true;
});
}
Aggregations