当前位置: 首页>>代码示例>>Java>>正文


Java FlowBuilder.setInstructions方法代码示例

本文整理汇总了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder.setInstructions方法的典型用法代码示例。如果您正苦于以下问题:Java FlowBuilder.setInstructions方法的具体用法?Java FlowBuilder.setInstructions怎么用?Java FlowBuilder.setInstructions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder的用法示例。


在下文中一共展示了FlowBuilder.setInstructions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createFlowBuilder

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; //导入方法依赖的package包/类
public static FlowBuilder createFlowBuilder(final short table, final int priority, final BigInteger cookieValue,
                                            final String flowName, final String flowIdStr, MatchBuilder match,
                                            InstructionsBuilder isb) {
    FlowBuilder flow = new FlowBuilder();
    flow.setId(new FlowId(flowIdStr));
    flow.setKey(new FlowKey(new FlowId(flowIdStr)));
    flow.setTableId(table);
    flow.setFlowName(flowName);
    flow.setCookie(new FlowCookie(cookieValue));
    flow.setCookieMask(new FlowCookie(cookieValue));
    flow.setContainerName(null);
    flow.setStrict(false);
    flow.setMatch(match.build());
    flow.setInstructions(isb.build());
    flow.setPriority(priority);
    flow.setHardTimeout(0);
    flow.setIdleTimeout(0);
    flow.setFlags(new FlowModFlags(false, false, false, false, false));
    if (null == flow.isBarrier()) {
        flow.setBarrier(Boolean.FALSE);
    }

    return flow;
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:25,代码来源:OpenFlow13Utils.java

示例2: createArpReplyToControllerFlow

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; //导入方法依赖的package包/类
protected FlowBuilder createArpReplyToControllerFlow() {
    final FlowBuilder arpFlow = new FlowBuilder()
            .setPriority(OFRendererConstants.ARP_REPLY_TO_CONTROLLER_FLOW_PRIORITY)
            .setIdleTimeout(0)
            .setHardTimeout(0)
            .setCookie(new FlowCookie(BigInteger.valueOf(flowCookie.incrementAndGet())))
            .setFlags(new FlowModFlags(false, false, false, false, false));
    final EthernetMatch ethernetMatch = FlowUtils.createEthernetMatch();
    /** NOTE:
     * Setting layer 3 match seems to be messing with the flow ID
     * check for possible bug on openflow plugin side.
     * Use following code for specific ARP REQUEST or REPLY packet capture
     * ArpMatch arpMatch = FlowUtils.createArpMatch();
     */
    final Match match = new MatchBuilder().setEthernetMatch(ethernetMatch).build();//.setLayer3Match(arpMatch).build();
    arpFlow.setMatch(match);
    final Instructions instructions = createOutputInstructions(OutputPortValues.CONTROLLER, OutputPortValues.NORMAL);
    arpFlow.setInstructions(instructions);
    final String flowName = createFlowName();
    arpFlow.setFlowName(flowName);
    final FlowId flowId = new FlowId(flowName);
    arpFlow.setId(flowId);
    arpFlow.setKey(new FlowKey(flowId));
    return arpFlow;
}
 
开发者ID:opendaylight,项目名称:nic,代码行数:26,代码来源:ArpFlowManager.java

示例3: pushFlowsByMacAddress

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; //导入方法依赖的package包/类
private void pushFlowsByMacAddress(final MacAddress srcMacAddress, final MacAddress dstMacAddress,
                                   final NodeId nodeId, final FlowAction flowAction) {
    final MatchBuilder matchBuilder = MatchUtils.createEthMatch(new MatchBuilder(), srcMacAddress, dstMacAddress);
    final String flowIdStr = srcMacAddress.getValue() + "_" + dstMacAddress.getValue();
    final FlowBuilder flowBuilder = createFlowBuilder(matchBuilder, new FlowId(flowIdStr));

    // TODO: Extend for other actions
    if (action instanceof Allow) {
        // Set allow action
        Instructions buildedInstructions = createOutputInstructions(OutputPortValues.NORMAL);
        flowBuilder.setInstructions(buildedInstructions);

    } else {
        String actionClass = action.getClass().getName();
        LOG.error("Invalid action: {}", actionClass);
    }
        writeDataTransaction(nodeId, flowBuilder, flowAction);
}
 
开发者ID:opendaylight,项目名称:nic,代码行数:19,代码来源:IntentFlowManager.java

示例4: createLldpReplyToControllerFlow

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; //导入方法依赖的package包/类
private FlowBuilder createLldpReplyToControllerFlow() {
    FlowBuilder lldpFlow = new FlowBuilder().setFlowName(createFlowName())
            .setIdleTimeout(0)
            .setHardTimeout(0)
            .setCookie(new FlowCookie(BigInteger.valueOf(flowCookie.incrementAndGet())))
            .setFlags(new FlowModFlags(false, false, false, false, false))
            .setPriority(OFRendererConstants.LLDP_REPLY_TO_CONTROLLER_FLOW_PRIORITY);

    EthernetMatchBuilder ethernetMatchBuilder = new EthernetMatchBuilder()
            .setEthernetType(new EthernetTypeBuilder()
            .setType(new EtherType(Long.valueOf(OFRendererConstants.LLDP_ETHER_TYPE))).build());
    Match match = new MatchBuilder().setEthernetMatch(ethernetMatchBuilder.build()).build();

    lldpFlow.setMatch(match);
    Instructions instructions = createOutputInstructions(OutputPortValues.CONTROLLER);
    lldpFlow.setInstructions(instructions);
    FlowId flowId = new FlowId(createFlowName());
    lldpFlow.setId(flowId);
    lldpFlow.setKey(new FlowKey(flowId));
    return lldpFlow;
}
 
开发者ID:opendaylight,项目名称:nic,代码行数:22,代码来源:LldpFlowManager.java

示例5: addFlowGoto

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; //导入方法依赖的package包/类
private void addFlowGoto(Node node, Short currentId, Short nextId) {
    FlowBuilder flowBuilder = new FlowBuilder();
    flowBuilder.setTableId(currentId);
    flowBuilder.setHardTimeout(0);
    flowBuilder.setPriority(0);
    flowBuilder.setMatch(new MatchBuilder().build());
    flowBuilder.setInstructions(
            new InstructionsBuilder().setInstruction(Collections.singletonList(
                    new InstructionBuilder().setInstruction(
                            new GoToTableCaseBuilder().setGoToTable(
                                    new GoToTableBuilder().setTableId(nextId).build()
                            ).build()
                    ).setOrder(0).build()
            )).build());
    String flowIdStr = "PipelineManager";
    final FlowId flowId = new FlowId(flowIdStr);
    final FlowKey key = new FlowKey(flowId);
    flowBuilder.setKey(key);

    InstanceIdentifier<Flow> flowIID = InstanceIdentifier.builder(Nodes.class)
            .child(Node.class, new NodeKey(node.getId())).augmentation(FlowCapableNode.class)
            .child(Table.class, new TableKey(flowBuilder.getTableId())).child(Flow.class, flowBuilder.getKey())
            .build();

    WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
    transaction.put(LogicalDatastoreType.CONFIGURATION, flowIID, flowBuilder.build(), true);
    transaction.submit();
}
 
开发者ID:opendaylight,项目名称:nic,代码行数:29,代码来源:PipelineManagerProviderImpl.java

示例6: programTrafficBehaviorRule

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; //导入方法依赖的package包/类
public void programTrafficBehaviorRule(Long dpid, TrafficBehavior trafficBehavior, boolean isWriteFlow) {
    MatchBuilder matchBuilder = new MatchBuilder();
    FlowBuilder flowBuilder = new FlowBuilder();

    if (dpid == null) {
        return;
    }
    String nodeName = OPENFLOW + dpid;
    NodeBuilder nodeBuilder = createNodeBuilder(nodeName);

    // Create the OF Actions and Instructions
    InstructionsBuilder isb = new InstructionsBuilder();

    // Instructions List Stores Individual Instructions
    List<Instruction> instructions = Lists.newArrayList();

    // Call the InstructionBuilder Methods Containing Actions
    InstructionBuilder ib = new InstructionBuilder();
    if (trafficBehavior == TrafficBehavior.PolicyDriven) {
        // If Traffic Behavior is NeedAcl, the Default action is drop, need
        // Acl to allow traffic
        ib = OfInstructionUtils.createDropInstructions(ib);
    } else {
        // Default Traffic Behavior is allow traffic goto next table, it has
        // done in Pipeline initialization step
        return;
    }

    ib.setOrder(instructions.size());
    ib.setKey(new InstructionKey(instructions.size()));
    instructions.add(ib.build());

    // Add InstructionBuilder to the Instruction(s)Builder List
    isb.setInstruction(instructions);

    // Add InstructionsBuilder to FlowBuilder
    flowBuilder.setInstructions(isb.build());

    String flowId = "Acl_TrafficBehavior_" + getTable();
    flowBuilder.setId(new FlowId(flowId));
    FlowKey key = new FlowKey(new FlowId(flowId));
    flowBuilder.setMatch(matchBuilder.build());
    flowBuilder.setPriority(TRAFFIC_BEHAVIOR_RULE_PRIORITY);
    flowBuilder.setBarrier(true);
    flowBuilder.setTableId(getTable());
    flowBuilder.setKey(key);
    flowBuilder.setFlowName(flowId);
    flowBuilder.setHardTimeout(0);
    flowBuilder.setIdleTimeout(0);

    if (isWriteFlow) {
        writeFlow(flowBuilder, nodeBuilder);
    } else {
        removeFlow(flowBuilder, nodeBuilder);
    }
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:57,代码来源:PipelineAclHandler.java

示例7: programGpeTunnelInEntry

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; //导入方法依赖的package包/类
public void programGpeTunnelInEntry(Long dpid, Long segmentationId, Long gpeTunnelOfPort, boolean isWriteFlow) {
    String nodeName = OPENFLOW + dpid;

    BigInteger tunnelId = BigInteger.valueOf(segmentationId.longValue());
    MatchBuilder matchBuilder = new MatchBuilder();
    NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
    FlowBuilder flowBuilder = new FlowBuilder();

    // Create Match(es) and Set them in the FlowBuilder Object
    flowBuilder.setMatch(OfMatchUtils.createTunnelIDMatch(matchBuilder, tunnelId).build());
    flowBuilder.setMatch(OfMatchUtils.createInPortMatch(matchBuilder, dpid, gpeTunnelOfPort).build());

    if (isWriteFlow) {
        // Create the OF Actions and Instructions
        InstructionBuilder ib = new InstructionBuilder();
        InstructionsBuilder isb = new InstructionsBuilder();

        // Instructions List Stores Individual Instructions
        List<Instruction> instructions = Lists.newArrayList();

        List<Action> actionList = Lists.newArrayList();
        ActionBuilder ab = new ActionBuilder();

        // pop_nsh
        ab.setAction(OfActionUtils.nxPopNshAction());
        ab.setOrder(actionList.size());
        ab.setKey(new ActionKey(actionList.size()));
        actionList.add(ab.build());

        ApplyActionsBuilder aab = new ApplyActionsBuilder();
        aab.setAction(actionList);
        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
        ib.setOrder(instructions.size());
        ib.setKey(new InstructionKey(instructions.size()));
        instructions.add(ib.build());

        // Append the default pipeline after the first classification
        ib = this.getMutablePipelineInstructionBuilder();
        ib.setOrder(instructions.size());
        ib.setKey(new InstructionKey(instructions.size()));
        instructions.add(ib.build());

        // Add InstructionBuilder to the Instruction(s)Builder List
        isb.setInstruction(instructions);

        // Add InstructionsBuilder to FlowBuilder
        flowBuilder.setInstructions(isb.build());
    }

    String flowId = "GpeTunnelIn_" + segmentationId + "_" + gpeTunnelOfPort;
    // Add Flow Attributes
    flowBuilder.setId(new FlowId(flowId));
    FlowKey key = new FlowKey(new FlowId(flowId));
    flowBuilder.setPriority(GPE_TUNNEL_IN_PRIORITY);
    flowBuilder.setStrict(true);
    flowBuilder.setBarrier(false);
    flowBuilder.setTableId(getTable());
    flowBuilder.setKey(key);
    flowBuilder.setFlowName(flowId);
    flowBuilder.setHardTimeout(0);
    flowBuilder.setIdleTimeout(0);

    if (isWriteFlow) {
        writeFlow(flowBuilder, nodeBuilder);
    } else {
        removeFlow(flowBuilder, nodeBuilder);
    }

}
 
开发者ID:opendaylight,项目名称:faas,代码行数:70,代码来源:PipelineAclHandler.java

示例8: programStaticRoutingInLocalDevice

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; //导入方法依赖的package包/类
public void programStaticRoutingInLocalDevice(Long dpid, String gwMacAddress, Ipv4Prefix destIpv4Prefix,
        Long nexthopSegId, boolean isWriteFlow) {

    String nodeName = Constants.OPENFLOW_NODE_PREFIX + dpid;

    MatchBuilder matchBuilder = new MatchBuilder();
    NodeBuilder nodeBuilder = Openflow13Provider.createNodeBuilder(nodeName);
    FlowBuilder flowBuilder = new FlowBuilder();

    // Instructions List Stores Individual Instructions
    InstructionsBuilder isb = new InstructionsBuilder();
    List<Instruction> instructions = Lists.newArrayList();
    InstructionBuilder ib = new InstructionBuilder();
    ApplyActionsBuilder aab = new ApplyActionsBuilder();
    ActionBuilder ab = new ActionBuilder();
    List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actionList = Lists
            .newArrayList();

    final String prefixString = destIpv4Prefix.getValue();

    OfMatchUtils.createDmacDestIpMatch(matchBuilder, gwMacAddress, destIpv4Prefix);

    String flowId = "StaticRoutingInLocalDevice_" + nexthopSegId + "_" + prefixString;
    flowBuilder.setId(new FlowId(flowId));
    FlowKey key = new FlowKey(new FlowId(flowId));
    flowBuilder.setBarrier(true);
    flowBuilder.setTableId(this.getTable());
    flowBuilder.setKey(key);

    int mask = IpAddressUtils.getMask(destIpv4Prefix);
    flowBuilder.setPriority(BASE_ROUTING_PRIORITY+mask);

    flowBuilder.setFlowName(flowId);
    flowBuilder.setHardTimeout(0);
    flowBuilder.setIdleTimeout(0);
    flowBuilder.setMatch(matchBuilder.build());

    if (isWriteFlow) {
        // Set source Mac address
        ab.setAction(OfActionUtils.setDlSrcAction(gwMacAddress));
        ab.setOrder(actionList.size());
        ab.setKey(new ActionKey(actionList.size()));
        actionList.add(ab.build());

        // DecTTL
        ab.setAction(OfActionUtils.decNwTtlAction());
        ab.setOrder(actionList.size());
        ab.setKey(new ActionKey(actionList.size()));
        actionList.add(ab.build());

        // Set Destination Tunnel ID
        ab.setAction(OfActionUtils.setTunnelIdAction(BigInteger.valueOf(nexthopSegId.longValue())));
        ab.setOrder(actionList.size());
        ab.setKey(new ActionKey(actionList.size()));
        actionList.add(ab.build());

        // Create Apply Actions Instruction
        aab.setAction(actionList);
        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
        ib.setOrder(instructions.size());
        ib.setKey(new InstructionKey(instructions.size()));
        instructions.add(ib.build());

        // Goto Next Table
        ib = getMutablePipelineInstructionBuilder();
        ib.setOrder(instructions.size());
        ib.setKey(new InstructionKey(instructions.size()));
        instructions.add(ib.build());

        flowBuilder.setInstructions(isb.setInstruction(instructions).build());

        writeFlow(flowBuilder, nodeBuilder);
    } else {
        removeFlow(flowBuilder, nodeBuilder);
    }
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:77,代码来源:PipelineL3Routing.java

示例9: programStaticRoutingInRemoteDevice

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; //导入方法依赖的package包/类
public void programStaticRoutingInRemoteDevice(Long dpid, String gwMacAddress, Ipv4Prefix destIpv4Prefix,
        Long nexthopSegId, boolean isWriteFlow) {

    String nodeName = Constants.OPENFLOW_NODE_PREFIX + dpid;

    MatchBuilder matchBuilder = new MatchBuilder();
    NodeBuilder nodeBuilder = Openflow13Provider.createNodeBuilder(nodeName);
    FlowBuilder flowBuilder = new FlowBuilder();

    // Instructions List Stores Individual Instructions
    InstructionsBuilder isb = new InstructionsBuilder();
    List<Instruction> instructions = Lists.newArrayList();
    InstructionBuilder ib = new InstructionBuilder();
    ApplyActionsBuilder aab = new ApplyActionsBuilder();
    ActionBuilder ab = new ActionBuilder();
    List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actionList = Lists
            .newArrayList();

    final String prefixString = destIpv4Prefix.getValue();

    OfMatchUtils.createDmacDestIpMatch(matchBuilder, gwMacAddress, destIpv4Prefix);

    String flowId = "StaticRoutingInRemoteDevice_" + nexthopSegId + "_" + prefixString;
    flowBuilder.setId(new FlowId(flowId));
    FlowKey key = new FlowKey(new FlowId(flowId));
    flowBuilder.setBarrier(true);
    flowBuilder.setTableId(this.getTable());
    flowBuilder.setKey(key);

    int mask = IpAddressUtils.getMask(destIpv4Prefix);
    flowBuilder.setPriority(BASE_ROUTING_PRIORITY+mask);
    flowBuilder.setFlowName(flowId);
    flowBuilder.setHardTimeout(0);
    flowBuilder.setIdleTimeout(0);
    flowBuilder.setMatch(matchBuilder.build());

    if (isWriteFlow) {
        // DecTTL
        ab.setAction(OfActionUtils.decNwTtlAction());
        ab.setOrder(actionList.size());
        ab.setKey(new ActionKey(actionList.size()));
        actionList.add(ab.build());

        ab.setAction(OfActionUtils.nxLoadRegAction(
                new DstNxRegCaseBuilder().setNxReg(PipelineTrafficClassifier.REG_FIELD).build(),
                BigInteger.valueOf(REG_VALUE_IS_STATIC_ROUTING)));
        ab.setOrder(actionList.size());
        ab.setKey(new ActionKey(actionList.size()));
        actionList.add(ab.build());

        // Create Apply Actions Instruction
        aab.setAction(actionList);
        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
        ib.setOrder(instructions.size());
        ib.setKey(new InstructionKey(instructions.size()));
        instructions.add(ib.build());

        // Goto Next Table
        ib = getMutablePipelineInstructionBuilder();
        ib.setOrder(instructions.size());
        ib.setKey(new InstructionKey(instructions.size()));
        instructions.add(ib.build());

        flowBuilder.setInstructions(isb.setInstruction(instructions).build());

        writeFlow(flowBuilder, nodeBuilder);
    } else {
        removeFlow(flowBuilder, nodeBuilder);
    }
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:71,代码来源:PipelineL3Routing.java

示例10: programFloatingIpToFixedIp2

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; //导入方法依赖的package包/类
public void programFloatingIpToFixedIp2(Long dpid, String dstfloatingIp,
        Long floatingSegmentId, String toDstfixedIp, boolean isWriteFlow) {
    String nodeName = OPENFLOW + dpid;

    MatchBuilder matchBuilder = new MatchBuilder();
    NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
    FlowBuilder flowBuilder = new FlowBuilder();

    // Create the OF Match using MatchBuilder
    OfMatchUtils.createDstL3IPv4Match(matchBuilder, OfMatchUtils.iPv4PrefixFromIPv4Address(dstfloatingIp));
    flowBuilder.setMatch(matchBuilder.build());

    String flowId = "InboundNat_"+dstfloatingIp+"_"+toDstfixedIp+"_"+floatingSegmentId;
    // Add Flow Attributes
    flowBuilder.setId(new FlowId(flowId));
    FlowKey key = new FlowKey(new FlowId(flowId));
    flowBuilder.setStrict(true);
    flowBuilder.setBarrier(false);
    flowBuilder.setTableId(getTable());
    flowBuilder.setKey(key);
    flowBuilder.setFlowName(flowId);
    flowBuilder.setHardTimeout(0);
    flowBuilder.setIdleTimeout(0);

    if (isWriteFlow) {
        // Instantiate the Builders for the OF Actions and Instructions
        InstructionBuilder ib = new InstructionBuilder();
        InstructionsBuilder isb = new InstructionsBuilder();

        // Instructions List Stores Individual Instructions
        List<Instruction> instructions = Lists.newArrayList();

        // Set Dst Ip Address to fixed ip
        OfInstructionUtils.createNwDstInstructions(ib,
                OfMatchUtils.iPv4PrefixFromIPv4Address(toDstfixedIp), null);
        ib.setOrder(instructions.size());
        ib.setKey(new InstructionKey(instructions.size()));
        instructions.add(ib.build());

        OfInstructionUtils.createSetTunnelIdInstructions(ib, BigInteger.valueOf(floatingSegmentId.longValue()));
        ib.setOrder(instructions.size());
        ib.setKey(new InstructionKey(instructions.size()));
        instructions.add(ib.build());

        // Next service GOTO Instructions Need to be appended to the List
        ib = this.getMutablePipelineInstructionBuilder();
        ib.setOrder(instructions.size());
        ib.setKey(new InstructionKey(instructions.size()));
        instructions.add(ib.build());

        // Add InstructionBuilder to the Instruction(s)Builder List
        isb.setInstruction(instructions);

        // Add InstructionsBuilder to FlowBuilder
        flowBuilder.setInstructions(isb.build());

        writeFlow(flowBuilder, nodeBuilder);
    } else {
        removeFlow(flowBuilder, nodeBuilder);
    }
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:62,代码来源:PipelineInboundNat.java

示例11: programDropSrcIface

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; //导入方法依赖的package包/类
public void programDropSrcIface(Long dpid, Long inPort, boolean isWriteFlow) {

        String nodeName = OPENFLOW + dpid;

        MatchBuilder matchBuilder = new MatchBuilder();
        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
        FlowBuilder flowBuilder = new FlowBuilder();

        // Create the OF Match using MatchBuilder
        flowBuilder.setMatch(OfMatchUtils.createInPortMatch(matchBuilder, dpid, inPort).build());

        if (isWriteFlow) {
            // Instantiate the Builders for the OF Actions and Instructions
            InstructionBuilder ib = new InstructionBuilder();
            InstructionsBuilder isb = new InstructionsBuilder();

            // Instructions List Stores Individual Instructions
            List<Instruction> instructions = Lists.newArrayList();

            // Call the InstructionBuilder Methods Containing Actions
            OfInstructionUtils.createDropInstructions(ib);
            ib.setOrder(instructions.size());
            ib.setKey(new InstructionKey(instructions.size()));
            instructions.add(ib.build());

            // Add InstructionBuilder to the Instruction(s)Builder List
            isb.setInstruction(instructions);

            // Add InstructionsBuilder to FlowBuilder
            flowBuilder.setInstructions(isb.build());
        }

        String flowId = "DropFilter_" + inPort;
        // Add Flow Attributes
        flowBuilder.setId(new FlowId(flowId));
        FlowKey key = new FlowKey(new FlowId(flowId));
        flowBuilder.setStrict(true);
        flowBuilder.setBarrier(false);
        flowBuilder.setTableId(getTable());
        flowBuilder.setKey(key);
        flowBuilder.setFlowName(flowId);
        flowBuilder.setPriority(8192);
        flowBuilder.setHardTimeout(0);
        flowBuilder.setIdleTimeout(0);
        if (isWriteFlow) {
            writeFlow(flowBuilder, nodeBuilder);
        } else {
            removeFlow(flowBuilder, nodeBuilder);
        }
    }
 
开发者ID:opendaylight,项目名称:faas,代码行数:51,代码来源:PipelineTrafficClassifier.java

示例12: programTunnelIn

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; //导入方法依赖的package包/类
public void programTunnelIn(Long dpid, Long segmentationId, Long ofPort, boolean isWriteFlow) {

        String nodeName = OPENFLOW + dpid;

        BigInteger tunnelId = BigInteger.valueOf(segmentationId.longValue());
        MatchBuilder matchBuilder = new MatchBuilder();
        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
        FlowBuilder flowBuilder = new FlowBuilder();

        // Create Match(es) and Set them in the FlowBuilder Object
        flowBuilder.setMatch(OfMatchUtils.createTunnelIDMatch(matchBuilder, tunnelId).build());
        flowBuilder.setMatch(OfMatchUtils.createInPortMatch(matchBuilder, dpid, ofPort).build());

        if (isWriteFlow) {
            // Create the OF Actions and Instructions
            InstructionBuilder ib = new InstructionBuilder();
            InstructionsBuilder isb = new InstructionsBuilder();

            // Instructions List Stores Individual Instructions
            List<Instruction> instructions = Lists.newArrayList();

            List<Action> actionList = Lists.newArrayList();
            ActionBuilder ab = new ActionBuilder();
            ab.setAction(OfActionUtils.nxLoadRegAction(new DstNxRegCaseBuilder().setNxReg(REG_FIELD).build(),
                    BigInteger.valueOf(REG_VALUE_FROM_REMOTE)));
            ab.setOrder(actionList.size());
            ab.setKey(new ActionKey(actionList.size()));
            actionList.add(ab.build());

            ab.setAction(OfActionUtils.nxLoadRegAction(new DstNxRegCaseBuilder().setNxReg(REG_SRC_TUN_ID).build(),
                    BigInteger.valueOf(REG2_DEFAULT_PERMIT_VNI)));
            ab.setOrder(actionList.size());
            ab.setKey(new ActionKey(actionList.size()));
            actionList.add(ab.build());

            ApplyActionsBuilder aab = new ApplyActionsBuilder();
            aab.setAction(actionList);
            ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());

            // Call the InstructionBuilder Methods Containing Actions
            ib.setOrder(instructions.size());
            ib.setKey(new InstructionKey(instructions.size()));
            instructions.add(ib.build());

            // Append the default pipeline after the first classification
            ib = this.getMutablePipelineInstructionBuilder();
            ib.setOrder(instructions.size());
            ib.setKey(new InstructionKey(instructions.size()));
            instructions.add(ib.build());

            // Add InstructionBuilder to the Instruction(s)Builder List
            isb.setInstruction(instructions);

            // Add InstructionsBuilder to FlowBuilder
            flowBuilder.setInstructions(isb.build());
        }

        String flowId = "TunnelIn_" + segmentationId + "_" + ofPort;
        // Add Flow Attributes
        flowBuilder.setId(new FlowId(flowId));
        FlowKey key = new FlowKey(new FlowId(flowId));
        flowBuilder.setStrict(true);
        flowBuilder.setBarrier(false);
        flowBuilder.setTableId(getTable());
        flowBuilder.setKey(key);
        flowBuilder.setFlowName(flowId);
        flowBuilder.setHardTimeout(0);
        flowBuilder.setIdleTimeout(0);

        if (isWriteFlow) {
            writeFlow(flowBuilder, nodeBuilder);
        } else {
            removeFlow(flowBuilder, nodeBuilder);
        }
    }
 
开发者ID:opendaylight,项目名称:faas,代码行数:76,代码来源:PipelineTrafficClassifier.java

示例13: programVlanInPort

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; //导入方法依赖的package包/类
public void programVlanInPort(Long dpid, Long vlanId, Long segmentationId, Long inPort, boolean isWriteFlow) {
    String nodeName = OPENFLOW + dpid;

    MatchBuilder matchBuilder = new MatchBuilder();
    NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
    FlowBuilder flowBuilder = new FlowBuilder();

    // Create the OF Match using MatchBuilder
    flowBuilder.setMatch(OfMatchUtils.createInPortMatch(matchBuilder, dpid, inPort).build());
    flowBuilder.setMatch(OfMatchUtils.createVlanIdMatch(matchBuilder, new VlanId(vlanId.intValue()), true).build());

    String flowId = "VlanIn_" + vlanId + "_" + inPort + "_" + segmentationId;
    // Add Flow Attributes
    flowBuilder.setId(new FlowId(flowId));
    FlowKey key = new FlowKey(new FlowId(flowId));
    flowBuilder.setStrict(true);
    flowBuilder.setBarrier(false);
    flowBuilder.setTableId(getTable());
    flowBuilder.setKey(key);
    flowBuilder.setPriority(16384);
    flowBuilder.setFlowName(flowId);
    flowBuilder.setHardTimeout(0);
    flowBuilder.setIdleTimeout(0);

    if (isWriteFlow) {
        // Instantiate the Builders for the OF Actions and Instructions
        InstructionBuilder ib = new InstructionBuilder();
        InstructionsBuilder isb = new InstructionsBuilder();

        // Instructions List Stores Individual Instructions
        List<Instruction> instructions = Lists.newArrayList();

        OfInstructionUtils.createSetTunnelIdInstructions(ib, BigInteger.valueOf(segmentationId.longValue()));

        ApplyActionsCase aac = (ApplyActionsCase) ib.getInstruction();
        List<Action> actionList = aac.getApplyActions().getAction();

        ActionBuilder ab = new ActionBuilder();

        ab.setAction(OfActionUtils.nxLoadRegAction(new DstNxRegCaseBuilder().setNxReg(REG_FIELD).build(),
                BigInteger.valueOf(REG_VALUE_FROM_VLAN)));
        ab.setOrder(actionList.size());
        ab.setKey(new ActionKey(actionList.size()));
        actionList.add(ab.build());

        ab.setAction(OfActionUtils.nxLoadRegAction(new DstNxRegCaseBuilder().setNxReg(REG_SRC_TUN_ID).build(),
                BigInteger.valueOf(REG2_DEFAULT_PERMIT_VNI)));
        ab.setOrder(actionList.size());
        ab.setKey(new ActionKey(actionList.size()));
        actionList.add(ab.build());

        ib.setOrder(instructions.size());
        ib.setKey(new InstructionKey(instructions.size()));
        instructions.add(ib.build());

        // Next service GOTO Instructions Need to be appended to the List
        ib = this.getMutablePipelineInstructionBuilder();
        ib.setOrder(instructions.size());
        ib.setKey(new InstructionKey(instructions.size()));
        instructions.add(ib.build());

        // Add InstructionBuilder to the Instruction(s)Builder List
        isb.setInstruction(instructions);

        // Add InstructionsBuilder to FlowBuilder
        flowBuilder.setInstructions(isb.build());

        writeFlow(flowBuilder, nodeBuilder);
    } else {
        removeFlow(flowBuilder, nodeBuilder);
    }
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:73,代码来源:PipelineTrafficClassifier.java

示例14: programDefaultPipelineRule

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; //导入方法依赖的package包/类
/**
 * Program Default Pipeline Flow.
 *
 * @param node on which the default pipeline flow is programmed.
 */
public void programDefaultPipelineRule(Node node) {
    if (!isBridgeInPipeline(node)) {
        //LOG.trace("Bridge is not in pipeline {} ", node);
        return;
    }
    MatchBuilder matchBuilder = new MatchBuilder();
    FlowBuilder flowBuilder = new FlowBuilder();
    Long dpid = getDpid(node);
    if (dpid == null) {
        LOG.info("could not find dpid: {}", node.getNodeId());
        return;
    }
    String nodeName = OPENFLOW + getDpid(node);
    NodeBuilder nodeBuilder = createNodeBuilder(nodeName);

    // Create the OF Actions and Instructions
    InstructionsBuilder isb = new InstructionsBuilder();

    // Instructions List Stores Individual Instructions
    List<Instruction> instructions = Lists.newArrayList();

    // Call the InstructionBuilder Methods Containing Actions
    InstructionBuilder ib = this.getMutablePipelineInstructionBuilder();
    ib.setOrder(instructions.size());
    ib.setKey(new InstructionKey(instructions.size()));
    instructions.add(ib.build());

    // Add InstructionBuilder to the Instruction(s)Builder List
    isb.setInstruction(instructions);

    // Add InstructionsBuilder to FlowBuilder
    flowBuilder.setInstructions(isb.build());

    String flowId = "DEFAULT_PIPELINE_FLOW_"+service.getTable();
    flowBuilder.setId(new FlowId(flowId));
    FlowKey key = new FlowKey(new FlowId(flowId));
    flowBuilder.setMatch(matchBuilder.build());
    flowBuilder.setPriority(0);
    flowBuilder.setBarrier(true);
    flowBuilder.setTableId(service.getTable());
    flowBuilder.setKey(key);
    flowBuilder.setFlowName(flowId);
    flowBuilder.setHardTimeout(0);
    flowBuilder.setIdleTimeout(0);
    writeFlow(flowBuilder, nodeBuilder);
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:52,代码来源:AbstractServiceInstance.java

示例15: programForwardingTableEntry

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; //导入方法依赖的package包/类
public void programForwardingTableEntry(Long dpid, Long segmentationId, Ipv4Prefix ipv4PrefixAddress,
        String macAddress, boolean isWriteFlow) {
    String nodeName = Constants.OPENFLOW_NODE_PREFIX + dpid;

    MatchBuilder matchBuilder = new MatchBuilder();
    NodeBuilder nodeBuilder = Openflow13Provider.createNodeBuilder(nodeName);

    // Instructions List Stores Individual Instructions
    InstructionsBuilder isb = new InstructionsBuilder();
    List<Instruction> instructions = Lists.newArrayList();
    InstructionBuilder ib = new InstructionBuilder();

    OfMatchUtils.createTunnelIDMatch(matchBuilder, BigInteger.valueOf(segmentationId.longValue()));
    OfMatchUtils.createDstL3IPv4Match(matchBuilder, ipv4PrefixAddress);

    // Set Dest Mac address
    OfInstructionUtils.createDlDstInstructions(ib, macAddress);
    ib.setOrder(instructions.size());
    ib.setKey(new InstructionKey(instructions.size()));
    instructions.add(ib.build());

    // Goto Next Table
    ib = getMutablePipelineInstructionBuilder();
    ib.setOrder(instructions.size());
    ib.setKey(new InstructionKey(instructions.size()));
    instructions.add(ib.build());

    FlowBuilder flowBuilder = new FlowBuilder();
    flowBuilder.setMatch(matchBuilder.build());
    flowBuilder.setInstructions(isb.setInstruction(instructions).build());

    String flowId = "L3Forwarding_" + segmentationId + "_" + ipv4PrefixAddress.getValue();
    flowBuilder.setId(new FlowId(flowId));
    FlowKey key = new FlowKey(new FlowId(flowId));
    flowBuilder.setBarrier(true);
    flowBuilder.setTableId(this.getTable());
    flowBuilder.setKey(key);
    flowBuilder.setPriority(1024);
    flowBuilder.setFlowName(flowId);
    flowBuilder.setHardTimeout(0);
    flowBuilder.setIdleTimeout(0);

    if (isWriteFlow) {
        writeFlow(flowBuilder, nodeBuilder);
    } else {
        removeFlow(flowBuilder, nodeBuilder);
    }
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:49,代码来源:PipelineL3Forwarding.java


注:本文中的org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder.setInstructions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。