Search in sources :

Example 6 with BoundServices

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices in project netvirt by opendaylight.

the class GeniusProvider method getBindServiceId.

public InstanceIdentifier<BoundServices> getBindServiceId(short serviceId, String interfaceName, boolean isIngress) {
    ServicesInfoKey servicesInfoKey = isIngress ? new ServicesInfoKey(interfaceName, ServiceModeIngress.class) : new ServicesInfoKey(interfaceName, ServiceModeEgress.class);
    InstanceIdentifier<BoundServices> id = InstanceIdentifier.builder(ServiceBindings.class).child(ServicesInfo.class, servicesInfoKey).child(BoundServices.class, new BoundServicesKey(serviceId)).build();
    return id;
}
Also used : BoundServicesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServicesKey) 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) ServiceModeEgress(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeEgress) ServiceBindings(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceBindings) ServiceModeIngress(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeIngress)

Example 7 with BoundServices

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices in project netvirt by opendaylight.

the class TunnelStateChangeListener method unbindService.

private void unbindService(String tunnelInterfaceName) {
    coordinator.enqueueJob(tunnelInterfaceName, () -> {
        LOG.info("Unbind egress policy service on tunnel {}", tunnelInterfaceName);
        BoundServices boundServices = getBoundServices(tunnelInterfaceName, Collections.emptyList());
        interfaceManager.unbindService(tunnelInterfaceName, ServiceModeEgress.class, boundServices);
        return null;
    });
}
Also used : BoundServices(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices)

Example 8 with BoundServices

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices in project netvirt by opendaylight.

the class TunnelStateChangeListener method bindService.

private void bindService(String tunnelInterfaceName) {
    coordinator.enqueueJob(tunnelInterfaceName, () -> {
        LOG.info("Bind egress policy service on tunnel {}", tunnelInterfaceName);
        List<Instruction> instructions = Collections.singletonList(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.EGRESS_POLICY_CLASSIFIER_TABLE, 0));
        BoundServices boundServices = getBoundServices(tunnelInterfaceName, instructions);
        interfaceManager.bindService(tunnelInterfaceName, ServiceModeEgress.class, boundServices);
        return null;
    });
}
Also used : BoundServices(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices) Instruction(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction)

Example 9 with BoundServices

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices in project genius by opendaylight.

the class FlowBasedEgressServicesStateBindHelper method bindServicesOnInterface.

@Override
public void bindServicesOnInterface(WriteTransaction tx, List<BoundServices> allServices, Interface ifState) {
    LOG.info("bind all egress services for interface: {}", ifState.getName());
    NodeConnectorId nodeConnectorId = FlowBasedServicesUtils.getNodeConnectorIdFromInterface(ifState);
    BigInteger dpId = IfmUtil.getDpnFromNodeConnectorId(nodeConnectorId);
    allServices.sort(Comparator.comparing(BoundServices::getServicePriority));
    BoundServices highestPriority = allServices.remove(0);
    short nextServiceIndex = (short) (allServices.size() > 0 ? allServices.get(0).getServicePriority() : highestPriority.getServicePriority() + 1);
    org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface iface = interfaceManagerCommonUtils.getInterfaceFromConfigDS(ifState.getName());
    FlowBasedServicesUtils.installEgressDispatcherFlows(dpId, highestPriority, ifState.getName(), tx, ifState.getIfIndex(), NwConstants.DEFAULT_SERVICE_INDEX, nextServiceIndex, iface);
    BoundServices prev = null;
    for (BoundServices boundService : allServices) {
        if (prev != null) {
            FlowBasedServicesUtils.installEgressDispatcherFlows(dpId, prev, ifState.getName(), tx, ifState.getIfIndex(), prev.getServicePriority(), boundService.getServicePriority(), iface);
        }
        prev = boundService;
    }
    if (prev != null) {
        FlowBasedServicesUtils.installEgressDispatcherFlows(dpId, prev, ifState.getName(), tx, ifState.getIfIndex(), prev.getServicePriority(), (short) (prev.getServicePriority() + 1), iface);
    }
}
Also used : BoundServices(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) BigInteger(java.math.BigInteger)

Example 10 with BoundServices

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices in project genius by opendaylight.

the class FlowBasedServicesUtils method bindDefaultEgressDispatcherService.

public static ListenableFuture<Void> bindDefaultEgressDispatcherService(ManagedNewTransactionRunner txRunner, String interfaceName, List<Instruction> instructions) {
    return txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
        int priority = ServiceIndex.getIndex(NwConstants.DEFAULT_EGRESS_SERVICE_NAME, NwConstants.DEFAULT_EGRESS_SERVICE_INDEX);
        BoundServices serviceInfo = getBoundServices(String.format("%s.%s", "default", interfaceName), ServiceIndex.getIndex(NwConstants.DEFAULT_EGRESS_SERVICE_NAME, NwConstants.DEFAULT_EGRESS_SERVICE_INDEX), priority, NwConstants.EGRESS_DISPATCHER_TABLE_COOKIE, instructions);
        IfmUtil.bindService(tx, interfaceName, serviceInfo, ServiceModeEgress.class);
    });
}
Also used : BoundServices(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices)

Aggregations

BoundServices (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices)32 ArrayList (java.util.ArrayList)18 Instruction (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction)16 BigInteger (java.math.BigInteger)14 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)8 List (java.util.List)6 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)5 NwConstants (org.opendaylight.genius.mdsalutil.NwConstants)5 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)5 Logger (org.slf4j.Logger)5 LoggerFactory (org.slf4j.LoggerFactory)5 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)4 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)4 FlowId (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId)4 TableKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey)4 FlowKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey)4 StypeOpenflow (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.StypeOpenflow)4 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)3 InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)3 MatchInfoBase (org.opendaylight.genius.mdsalutil.MatchInfoBase)3