use of org.opendaylight.controller.md.sal.binding.api.ReadTransaction in project openflowplugin by opendaylight.
the class OFPluginFlowTest method readFlow.
// TODO move to separate test util class
private static final Flow readFlow(InstanceIdentifier<Flow> flow) {
Flow searchedFlow = null;
ReadTransaction rt = dataBroker.newReadOnlyTransaction();
CheckedFuture<Optional<Flow>, ReadFailedException> flowFuture = rt.read(LogicalDatastoreType.CONFIGURATION, flow);
try {
Optional<Flow> maybeFlow = flowFuture.checkedGet(500, TimeUnit.SECONDS);
if (maybeFlow.isPresent()) {
searchedFlow = maybeFlow.get();
}
} catch (TimeoutException e) {
LOG.error("Future timed out. Getting FLOW from DataStore failed.", e);
} catch (ReadFailedException e) {
LOG.error("Something wrong happened in DataStore. Getting FLOW for userId {} failed.", e);
}
return searchedFlow;
}
Aggregations