Search in sources :

Example 21 with Instructions

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.Instructions in project netvirt by opendaylight.

the class ArpResponderUtil method installFlow.

/**
 * Install ARP Responder FLOW.
 *
 * @param mdSalManager
 *            Reference of MDSAL API RPC that provides API for installing
 *            flow
 * @param dpnId
 *            DPN on which flow to be installed
 * @param flowId
 *            Uniquely Identifiable Arp Responder Table flow Id
 * @param flowName
 *            Readable flow name
 * @param priority
 *            Flow Priority
 * @param cookie
 *            Flow Cookie
 * @param matches
 *            List of Match Criteria for the flow
 * @param instructions
 *            List of Instructions for the flow
 */
public static void installFlow(IMdsalApiManager mdSalManager, BigInteger dpnId, String flowId, String flowName, int priority, BigInteger cookie, List<MatchInfo> matches, List<Instruction> instructions) {
    Flow flowEntity = MDSALUtil.buildFlowNew(NwConstants.ARP_RESPONDER_TABLE, flowId, priority, flowName, 0, 0, cookie, matches, instructions);
    mdSalManager.installFlow(dpnId, flowEntity);
}
Also used : Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Example 22 with Instructions

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.Instructions in project netvirt by opendaylight.

the class ArpResponderUtil method getExtInterfaceInstructions.

/**
 * Get instruction list for ARP responder flows originated from ext-net e.g.
 * router-gw/fip.<br>
 * The split-horizon bit should be reset in order to allow traffic from
 * provider network to be routed back to flat/VLAN network and override the
 * egress table drop flow.<br>
 * In order to allow write-metadata in the ARP responder table the resubmit
 * action needs to be replaced with goto instruction.
 */
public static List<Instruction> getExtInterfaceInstructions(IInterfaceManager ifaceMgrRpcService, String extInterfaceName, String ipAddress, String macAddress) {
    AtomicInteger tableId = new AtomicInteger(-1);
    List<Instruction> instructions = new ArrayList<>();
    List<Action> actions = getActions(ifaceMgrRpcService, extInterfaceName, ipAddress, macAddress);
    actions.removeIf(v -> {
        org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionClass = v.getAction();
        if (actionClass instanceof NxActionResubmitRpcAddGroupCase) {
            tableId.set(((NxActionResubmitRpcAddGroupCase) actionClass).getNxResubmit().getTable());
            return true;
        } else {
            return false;
        }
    });
    instructions.add(MDSALUtil.buildApplyActionsInstruction(actions, 0));
    if (tableId.get() != -1) {
        // write-metadata
        if ((short) tableId.get() > NwConstants.ARP_RESPONDER_TABLE) {
            instructions.add(new InstructionGotoTable((short) tableId.get()).buildInstruction(2));
        } else {
            LOG.warn("Failed to insall responder flow for interface {}. Resubmit to {} can't be replaced with goto", extInterfaceName, tableId);
        }
    }
    return instructions;
}
Also used : NxActionResubmitRpcAddGroupCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.group.input.buckets.bucket.action.action.NxActionResubmitRpcAddGroupCase) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) ArrayList(java.util.ArrayList) Instruction(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction) AtomicInteger(java.util.concurrent.atomic.AtomicInteger)

Example 23 with Instructions

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.Instructions in project netvirt by opendaylight.

the class VPNServiceChainHandler method bindScfOnVpnInterface.

public void bindScfOnVpnInterface(String ifName, int scfTag) {
    LOG.debug("bind SCF tag {} on iface {}", scfTag, ifName);
    if (isServiceBoundOnInterface(NwConstants.SCF_SERVICE_INDEX, ifName)) {
        LOG.info("SCF is already bound on Interface {} for Ingress. Binding aborted", ifName);
        return;
    }
    Action loadReg2Action = new ActionRegLoad(1, NxmNxReg2.class, 0, 31, scfTag).buildAction();
    List<Instruction> instructions = Arrays.asList(MDSALUtil.buildApplyActionsInstruction(Collections.singletonList(loadReg2Action)), MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.SCF_DOWN_SUB_FILTER_TCP_BASED_TABLE, 1));
    BoundServices boundServices = InterfaceServiceUtil.getBoundServices(ifName, NwConstants.SCF_SERVICE_INDEX, CloudServiceChainConstants.DEFAULT_SCF_FLOW_PRIORITY, CloudServiceChainConstants.COOKIE_SCF_BASE, instructions);
    interfaceManager.bindService(ifName, ServiceModeIngress.class, boundServices);
}
Also used : BoundServices(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) NxmNxReg2(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg2) ActionRegLoad(org.opendaylight.genius.mdsalutil.actions.ActionRegLoad) Instruction(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction)

Example 24 with Instructions

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.Instructions in project netvirt by opendaylight.

the class QosNeutronUtils method bindservice.

public void bindservice(String ifName) {
    int priority = QosConstants.QOS_DEFAULT_FLOW_PRIORITY;
    int instructionKey = 0;
    List<Instruction> instructions = new ArrayList<>();
    instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.QOS_DSCP_TABLE, ++instructionKey));
    short qosServiceIndex = ServiceIndex.getIndex(NwConstants.QOS_SERVICE_NAME, NwConstants.QOS_SERVICE_INDEX);
    BoundServices serviceInfo = getBoundServices(String.format("%s.%s", "qos", ifName), qosServiceIndex, priority, NwConstants.COOKIE_QOS_TABLE, instructions);
    MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, buildServiceId(ifName, qosServiceIndex), serviceInfo);
}
Also used : BoundServices(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices) ArrayList(java.util.ArrayList) Instruction(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint)

Example 25 with Instructions

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.Instructions 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)

Aggregations

ArrayList (java.util.ArrayList)161 Instruction (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction)138 InstructionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder)107 InstructionsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder)104 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)96 ApplyActionsCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder)95 ApplyActionsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder)94 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder)88 DropActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropActionBuilder)82 GroupActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder)82 ControllerActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.controller.action._case.ControllerActionBuilder)81 DropAction (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropAction)81 PushMplsActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.mpls.action._case.PushMplsActionBuilder)81 PushPbbActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.pbb.action._case.PushPbbActionBuilder)81 SetVlanIdActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder)81 OutputActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder)77 InstructionKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey)76 FloodAllActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.all.action._case.FloodAllActionBuilder)74 SetDlSrcActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.src.action._case.SetDlSrcActionBuilder)74 SetNwDstActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.dst.action._case.SetNwDstActionBuilder)74