import java.util.List;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker;
import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.ServiceFunctions;
import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.functions.ServiceFunction;
import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.functions.ServiceFunctionKey;
public ServiceFunction readServiceFunction(ServiceFunctionKey sfKey) {
InstanceIdentifier<ServiceFunction> sfIid = getSFPath(sfKey);
LOG.info("Read Service Function {} from config data store at {}",sfKey, sfIid);
- return mdsalUtils.read(LogicalDatastoreType.CONFIGURATION, sfIid);
+ return SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker,
+ LogicalDatastoreType.CONFIGURATION, sfIid).orNull();
}
public void addServiceFunction(ServiceFunction sf) {
public ServiceFunctionForwarder readServiceFunctionForwarder(ServiceFunctionForwarderKey sffKey) {
InstanceIdentifier<ServiceFunctionForwarder> sffIid = getSFFPath(sffKey);
LOG.info("Read Service Function Forwarder from config data store at {}", sffIid);
- return mdsalUtils.read(LogicalDatastoreType.CONFIGURATION, sffIid);
+ return SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker,
+ LogicalDatastoreType.CONFIGURATION, sffIid).orNull();
}
public void addServiceFunctionForwarder(ServiceFunctionForwarder sff) {
}
public ServiceFunctionForwarder getExistingSFF(String ipAddress) {
- ServiceFunctionForwarders existingSffs = mdsalUtils.read(LogicalDatastoreType.CONFIGURATION, sffIid);
+ ServiceFunctionForwarders existingSffs =
+ SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker,
+ LogicalDatastoreType.CONFIGURATION, sffIid).orNull();
if (existingSffs != null
&& existingSffs.getServiceFunctionForwarder() != null
&& !existingSffs.getServiceFunctionForwarder().isEmpty()) {