Search in sources :

Example 91 with Instructions

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions in project netvirt by opendaylight.

the class DhcpServiceUtils method bindDhcpService.

public static void bindDhcpService(String interfaceName, short tableId, WriteTransaction tx) {
    int instructionKey = 0;
    List<Instruction> instructions = new ArrayList<>();
    instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(tableId, ++instructionKey));
    short serviceIndex = ServiceIndex.getIndex(NwConstants.DHCP_SERVICE_NAME, NwConstants.DHCP_SERVICE_INDEX);
    BoundServices serviceInfo = getBoundServices(String.format("%s.%s", "dhcp", interfaceName), serviceIndex, DhcpMConstants.DEFAULT_FLOW_PRIORITY, DhcpMConstants.COOKIE_VM_INGRESS_TABLE, instructions);
    tx.put(LogicalDatastoreType.CONFIGURATION, buildServiceId(interfaceName, serviceIndex), serviceInfo, WriteTransaction.CREATE_MISSING_PARENTS);
}
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)

Example 92 with Instructions

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions in project netvirt by opendaylight.

the class OpenFlow13Utils method wrapActionsIntoApplyActionsInstruction.

public static InstructionsBuilder wrapActionsIntoApplyActionsInstruction(List<Action> theActions) {
    // Create an Apply Action
    ApplyActionsBuilder aab = new ApplyActionsBuilder();
    aab.setAction(theActions);
    // Wrap our Apply Action in an Instruction
    InstructionBuilder ib = new InstructionBuilder();
    ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
    ib.setOrder(0);
    ib.setKey(new InstructionKey(0));
    // Put our Instruction in a list of Instructions
    List<Instruction> instructions = new ArrayList<>();
    instructions.add(ib.build());
    return new InstructionsBuilder().setInstruction(instructions);
}
Also used : InstructionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder) NxActionRegMoveNodesNodeTableFlowApplyActionsCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegMoveNodesNodeTableFlowApplyActionsCaseBuilder) ApplyActionsCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder) NxActionRegLoadNodesNodeTableFlowApplyActionsCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegLoadNodesNodeTableFlowApplyActionsCaseBuilder) NxActionPushNshNodesNodeTableFlowApplyActionsCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionPushNshNodesNodeTableFlowApplyActionsCaseBuilder) NxActionPopNshNodesNodeTableFlowApplyActionsCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionPopNshNodesNodeTableFlowApplyActionsCaseBuilder) ArrayList(java.util.ArrayList) InstructionKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey) Instruction(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction) ApplyActionsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder) InstructionsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder)

Example 93 with Instructions

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions in project netvirt by opendaylight.

the class IngressCountersServiceImpl method bind.

@Override
public void bind(String interfaceId) {
    int instructionKey = 0;
    List<Instruction> instructions = new ArrayList<>();
    instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.INGRESS_COUNTERS_TABLE, ++instructionKey));
    BoundServices serviceInfo = CountersServiceUtils.getBoundServices(String.format("%s.%s", "counters-ingress", interfaceId), CountersServiceUtils.INGRESS_COUNTERS_SERVICE_INDEX, CountersServiceUtils.INGRESS_COUNTERS_DEFAULT_FLOW_PRIORITY, CountersServiceUtils.COOKIE_COUNTERS_BASE, instructions);
    InstanceIdentifier<BoundServices> serviceId = CountersServiceUtils.buildServiceId(interfaceId, CountersServiceUtils.INGRESS_COUNTERS_SERVICE_INDEX, ServiceModeIngress.class);
    MDSALUtil.syncWrite(db, LogicalDatastoreType.CONFIGURATION, serviceId, 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)

Example 94 with Instructions

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions in project netvirt by opendaylight.

the class VpnToElanFallbackNodeListener method add.

@Override
protected void add(InstanceIdentifier<Node> identifier, Node add) {
    BigInteger dpnId = getDpnIdFromNodeId(add.getNodeId());
    if (dpnId == null) {
        return;
    }
    LOG.debug("Installing L3VPN to ELAN default Fallback flow in LPortDispatcher table on Dpn {}", add.getNodeId());
    List<MatchInfo> matches = Collections.singletonList(new MatchMetadata(MetaDataUtil.getServiceIndexMetaData(ServiceIndex.getIndex(NwConstants.L3VPN_SERVICE_NAME, NwConstants.L3VPN_SERVICE_INDEX)), MetaDataUtil.METADATA_MASK_SERVICE_INDEX));
    BigInteger metadataToWrite = MetaDataUtil.getServiceIndexMetaData(ServiceIndex.getIndex(NwConstants.ELAN_SERVICE_NAME, NwConstants.ELAN_SERVICE_INDEX));
    int instructionKey = 0;
    List<Instruction> instructions = Arrays.asList(MDSALUtil.buildAndGetWriteMetadaInstruction(metadataToWrite, MetaDataUtil.METADATA_MASK_SERVICE_INDEX, ++instructionKey), MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.L3_INTERFACE_TABLE, ++instructionKey));
    Flow flow = MDSALUtil.buildFlowNew(NwConstants.LPORT_DISPATCHER_TABLE, L3_TO_L2_DEFAULT_FLOW_REF, NwConstants.TABLE_MISS_PRIORITY, L3_TO_L2_DEFAULT_FLOW_REF, 0, 0, CloudServiceChainConstants.COOKIE_L3_BASE, matches, instructions);
    mdsalMgr.installFlow(dpnId, flow);
}
Also used : MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) BigInteger(java.math.BigInteger) Instruction(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Example 95 with Instructions

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions in project netvirt by opendaylight.

the class ElanServiceChainUtils method buildSetLportTagAndGotoLportDispInstructions.

/**
 * Builds a List of Instructions that set the ElanPseudoPort Tag in
 * metadata and sends to LPortDispatcher table (via Table 80).
 *
 * @param lportTag Dataplane identifier of the ElanPseudoPort
 *
 * @return the List of Instructions
 */
public static List<Instruction> buildSetLportTagAndGotoLportDispInstructions(int lportTag) {
    int instructionKey = 0;
    BigInteger metadata = MetaDataUtil.getMetaDataForLPortDispatcher(lportTag, ServiceIndex.getIndex(NwConstants.SCF_SERVICE_NAME, NwConstants.SCF_SERVICE_INDEX));
    List<Instruction> result = Arrays.asList(MDSALUtil.buildAndGetWriteMetadaInstruction(metadata, MetaDataUtil.getMetaDataMaskForLPortDispatcher(), ++instructionKey), MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.L3_INTERFACE_TABLE, ++instructionKey));
    return result;
}
Also used : BigInteger(java.math.BigInteger) 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