Search in sources :

Example 1 with ServicesInfo

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();
}
Also used : ServicesInfoKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfoKey) ServiceBindings(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceBindings) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) ServicesInfo(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfo)

Example 2 with ServicesInfo

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);
    }
}
Also used : BoundServices(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices) ServicesInfoKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfoKey)

Example 3 with ServicesInfo

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();
}
Also used : BoundServices(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices) ServicesInfoKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfoKey) ServicesInfoBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfoBuilder) ArrayList(java.util.ArrayList) BoundServicesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServicesBuilder)

Aggregations

ServicesInfoKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfoKey)3 BoundServices (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices)2 ArrayList (java.util.ArrayList)1 ServiceBindings (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceBindings)1 ServicesInfo (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfo)1 ServicesInfoBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfoBuilder)1 BoundServicesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServicesBuilder)1 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)1