use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfo in project genius by opendaylight.
the class FlowBasedServicesUtils method getServicesInfoForInterface.
public static ServicesInfo getServicesInfoForInterface(ReadTransaction tx, String interfaceName, Class<? extends ServiceModeBase> serviceMode) throws ReadFailedException {
ServicesInfoKey servicesInfoKey = new ServicesInfoKey(interfaceName, serviceMode);
InstanceIdentifier.InstanceIdentifierBuilder<ServicesInfo> servicesInfoIdentifierBuilder = InstanceIdentifier.builder(ServiceBindings.class).child(ServicesInfo.class, servicesInfoKey);
return tx.read(LogicalDatastoreType.CONFIGURATION, servicesInfoIdentifierBuilder.build()).checkedGet().orNull();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfo in project genius by opendaylight.
the class FlowBasedServicesConfigListener method onBoundServicesChanged.
private synchronized void onBoundServicesChanged(final DataObjectModification<BoundServices> dataObjectModification, final InstanceIdentifier<ServicesInfo> rootIdentifier, final DataObjectModification<ServicesInfo> rootNode) {
final List<BoundServices> boundServices = rootNode.getDataAfter().getBoundServices();
final ServicesInfoKey servicesInfoKey = rootNode.getDataAfter().getKey();
final BoundServices boundServicesBefore = dataObjectModification.getDataBefore();
final BoundServices boundServicesAfter = dataObjectModification.getDataAfter();
switch(dataObjectModification.getModificationType()) {
case DELETE:
remove(servicesInfoKey, boundServicesBefore, boundServices);
break;
case SUBTREE_MODIFIED:
update(servicesInfoKey, getBoundServicesInstanceIdentifier(rootIdentifier, boundServicesBefore.getKey()), boundServicesBefore, boundServicesAfter, boundServices);
break;
case WRITE:
if (boundServicesBefore == null) {
add(servicesInfoKey, boundServicesAfter, boundServices);
} else {
update(servicesInfoKey, getBoundServicesInstanceIdentifier(rootIdentifier, boundServicesBefore.getKey()), boundServicesBefore, boundServicesAfter, boundServices);
}
break;
default:
LOG.error("Unhandled Modificiation Type{} for {}", dataObjectModification.getModificationType(), rootIdentifier);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfo in project genius by opendaylight.
the class InterfaceServiceUtil method buildServiceInfo.
public static ServicesInfo buildServiceInfo(String serviceName, int servicePriority) {
List<BoundServices> boundService = new ArrayList<>();
boundService.add(new BoundServicesBuilder().setServicePriority((short) servicePriority).setServiceName(serviceName).build());
return new ServicesInfoBuilder().setBoundServices(boundService).setKey(new ServicesInfoKey(serviceName, ServiceModeIngress.class)).build();
}
Aggregations