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


Java FlowBuilder.setStrict方法代码示例

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


在下文中一共展示了FlowBuilder.setStrict方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: createFlowBuilder

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; //导入方法依赖的package包/类
private FlowBuilder createFlowBuilder(final MatchBuilder matchBuilder, final FlowId flowId) {
    final Match match = matchBuilder.build();
    final FlowKey key = new FlowKey(flowId);
    final FlowBuilder flowBuilder = new FlowBuilder();
    final BigInteger cookieId = new BigInteger("20", RADIX);

    flowBuilder.setId(flowId);
    flowBuilder.setKey(key);
    flowBuilder.setFlowName(flowName);
    flowBuilder.setCookie(new FlowCookie(cookieId));
    flowBuilder.setCookieMask(new FlowCookie(cookieId));
    flowBuilder.setContainerName(null);
    flowBuilder.setStrict(false);
    flowBuilder.setMatch(match);
    flowBuilder.setFlags(new FlowModFlags(false, false, false, false, false));
    flowBuilder.setBarrier(true);
    flowBuilder.setPriority(OFRendererConstants.DEFAULT_PRIORITY);
    flowBuilder.setHardTimeout(OFRendererConstants.DEFAULT_HARD_TIMEOUT);
    flowBuilder.setIdleTimeout(OFRendererConstants.DEFAULT_IDLE_TIMEOUT);

    return flowBuilder;
}
 
开发者ID:opendaylight,项目名称:nic,代码行数:23,代码来源:IntentFlowManager.java

示例3: 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

示例4: 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

示例5: programFloatingIpToFixedIp

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; //导入方法依赖的package包/类
public void programFloatingIpToFixedIp(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();
        List<Action> actionList = new ArrayList<>();
        ActionBuilder ab = new ActionBuilder();

        // Set Dst Ip Address to fixed ip
        SetNwDstActionBuilder setNwDstActionBuilder = new SetNwDstActionBuilder();
        Ipv4Builder ipdst = new Ipv4Builder();
        ipdst.setIpv4Address(OfMatchUtils.iPv4PrefixFromIPv4Address(toDstfixedIp));
        setNwDstActionBuilder.setAddress(ipdst.build());
        ab.setAction(new SetNwDstActionCaseBuilder().setSetNwDstAction(setNwDstActionBuilder.build()).build());
        ab.setOrder(actionList.size());
        ab.setKey(new ActionKey(actionList.size()));
        actionList.add(ab.build());

        // Build the Set Tunnel Field Action
        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
        TunnelBuilder tunnel = new TunnelBuilder();
        tunnel.setTunnelId(BigInteger.valueOf(floatingSegmentId.longValue()));
        setFieldBuilder.setTunnel(tunnel.build());
        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
        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());

        // 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,代码行数:79,代码来源:PipelineInboundNat.java

示例6: 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

示例7: 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

示例8: 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

示例9: programFixedIpToFloatingIp2

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; //导入方法依赖的package包/类
public void programFixedIpToFloatingIp2(Long dpid, Long floatingSegmentId, String srcFixedIp,
        String fixedGwMac, String toSrcFloatingIp, 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.createTunnelIDMatch(matchBuilder, BigInteger.valueOf(floatingSegmentId.longValue()));
    OfMatchUtils.createSrcL3IPv4Match(matchBuilder, OfMatchUtils.iPv4PrefixFromIPv4Address(srcFixedIp));
    flowBuilder.setMatch(matchBuilder.build());

    String flowId = "OutboundNat_"+floatingSegmentId+"_"+srcFixedIp+"_"+toSrcFloatingIp;
    // 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 Src Mac address
        OfInstructionUtils.createDlSrcInstructions(ib, fixedGwMac);
        ib.setOrder(instructions.size());
        ib.setKey(new InstructionKey(instructions.size()));
        instructions.add(ib.build());

        // Set Src Ip Address to floating ip
        OfInstructionUtils.createNwSrcInstructions(ib,
                OfMatchUtils.iPv4PrefixFromIPv4Address(toSrcFloatingIp));
        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,代码行数:64,代码来源:PipelineOutboundNat.java

示例10: programFixedIpToFloatingIp

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; //导入方法依赖的package包/类
public void programFixedIpToFloatingIp(Long dpid, Long floatingSegmentId, String srcFixedIp,
        String fixedGwMac, String toSrcFloatingIp, 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.createTunnelIDMatch(matchBuilder, BigInteger.valueOf(floatingSegmentId.longValue()));
    OfMatchUtils.createSrcL3IPv4Match(matchBuilder, OfMatchUtils.iPv4PrefixFromIPv4Address(srcFixedIp));
    flowBuilder.setMatch(matchBuilder.build());

    String flowId = "OutboundNat_"+floatingSegmentId+"_"+srcFixedIp+"_"+toSrcFloatingIp;
    // 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();

        List<Action> actionList = new ArrayList<>();
        ActionBuilder ab = new ActionBuilder();

        // Set Src Mac address
        SetDlSrcActionBuilder dlSrcActionBuilder= new SetDlSrcActionBuilder();
        dlSrcActionBuilder.setAddress(new MacAddress(fixedGwMac));
        ab.setAction(new SetDlSrcActionCaseBuilder().setSetDlSrcAction(dlSrcActionBuilder.build()).build());
        ab.setOrder(actionList.size());
        ab.setKey(new ActionKey(actionList.size()));
        actionList.add(ab.build());

        // Set Src Ip Address to floating ip
        SetNwSrcActionBuilder setNwsrcActionBuilder = new SetNwSrcActionBuilder();
        Ipv4Builder ipsrc = new Ipv4Builder();
        ipsrc.setIpv4Address(OfMatchUtils.iPv4PrefixFromIPv4Address(toSrcFloatingIp));
        setNwsrcActionBuilder.setAddress(ipsrc.build());
        ab.setAction(new SetNwSrcActionCaseBuilder().setSetNwSrcAction(setNwsrcActionBuilder.build()).build());
        ab.setOrder(actionList.size());
        ab.setKey(new ActionKey(actionList.size()));
        actionList.add(ab.build());

        // Create an Apply Action
        ApplyActionsBuilder aab = new ApplyActionsBuilder();
        aab.setAction(actionList);

        // Wrap our Apply Action in an Instruction
        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).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,代码行数:82,代码来源:PipelineOutboundNat.java

示例11: programLocalTableMiss

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

        String nodeName = OPENFLOW + dpid;

        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, BigInteger.valueOf(segmentationId.longValue())).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();

            // 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 = "LocalTableMiss_" + 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(8192);
        flowBuilder.setFlowName(flowId);
        flowBuilder.setHardTimeout(0);
        flowBuilder.setIdleTimeout(0);
        if (isWriteFlow) {
            writeFlow(flowBuilder, nodeBuilder);
        } else {
            removeFlow(flowBuilder, nodeBuilder);
        }
    }
 
开发者ID:opendaylight,项目名称:faas,代码行数:52,代码来源:PipelineL2Forwarding.java

示例12: programTunnelOut

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; //导入方法依赖的package包/类
public void programTunnelOut(Long dpid, Long segmentationId, Long OFPortOut, String attachedMac,
        IpAddress dstTunIpAddress, 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.createTunnelIDMatch(matchBuilder, BigInteger.valueOf(segmentationId.longValue())).build());
    flowBuilder.setMatch(OfMatchUtils.createDestEthMatch(matchBuilder, attachedMac, "").build());

    String flowId = "TunnelOut_" + segmentationId + "_" + OFPortOut + "_" + attachedMac + "_"
            + dstTunIpAddress.getIpv4Address().getValue();
    // 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(32768);
    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();
        List<Action> actionList = new ArrayList<>();
        List<Instruction> instructions = Lists.newArrayList();

        ActionBuilder ab = new ActionBuilder();

        // add Load Tunnel Ip Action
        ab.setAction(OfActionUtils.nxLoadTunIPv4Action(dstTunIpAddress.getIpv4Address().getValue(), false));
        ab.setOrder(actionList.size());
        ab.setKey(new ActionKey(actionList.size()));
        actionList.add(ab.build());

        // add Output Action
        NodeConnectorId ncid = new NodeConnectorId("openflow:" + dpid + ":" + OFPortOut);
        ab.setAction(OfActionUtils.outputAction(ncid));
        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());
        isb.setInstruction(instructions);

        flowBuilder.setInstructions(isb.build());

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

示例13: programNexthopTunnelOut

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; //导入方法依赖的package包/类
public void programNexthopTunnelOut(Long dpid, Long OFPortOut, IpAddress dstTunIpAddress, 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.addNxRegMatch(matchBuilder, new OfMatchUtils.RegMatch(PipelineTrafficClassifier.REG_FIELD,
                PipelineL3Routing.REG_VALUE_IS_STATIC_ROUTING));
        flowBuilder.setMatch(matchBuilder.build());

        String flowId = "NexthopTunnelOut_" + OFPortOut + "_" + dstTunIpAddress.getIpv4Address().getValue();
        // 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(32769);
        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();
            List<Action> actionList = new ArrayList<>();
            List<Instruction> instructions = Lists.newArrayList();

            ActionBuilder ab = new ActionBuilder();

            // add Load Tunnel Ip Action
            ab.setAction(OfActionUtils.nxLoadTunIPv4Action(dstTunIpAddress.getIpv4Address().getValue(), false));
            ab.setOrder(actionList.size());
            ab.setKey(new ActionKey(actionList.size()));
            actionList.add(ab.build());

            // add Output Action
            NodeConnectorId ncid = new NodeConnectorId("openflow:" + dpid + ":" + OFPortOut);
            ab.setAction(OfActionUtils.outputAction(ncid));
            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());
            isb.setInstruction(instructions);

            flowBuilder.setInstructions(isb.build());

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

示例14: programRemoteBcastOutToLocalPort

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; //导入方法依赖的package包/类
public void programRemoteBcastOutToLocalPort(Long dpid, Long segmentationId, Long localPort, 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.addNxRegMatch(matchBuilder, new OfMatchUtils.RegMatch(PipelineTrafficClassifier.REG_FIELD,
                PipelineTrafficClassifier.REG_VALUE_FROM_REMOTE));
        flowBuilder.setMatch(
                OfMatchUtils.createTunnelIDMatch(matchBuilder, BigInteger.valueOf(segmentationId.longValue())).build());
        flowBuilder.setMatch(
                OfMatchUtils.createDestEthMatch(matchBuilder, "01:00:00:00:00:00", "01:00:00:00:00:00").build());

        String flowId = "BcastOut_" + 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);
        Flow flow = this.getFlow(flowBuilder, nodeBuilder);
        // Instantiate the Builders for the OF Actions and Instructions
        InstructionBuilder ib = new InstructionBuilder();
        InstructionsBuilder isb = new InstructionsBuilder();
        List<Instruction> instructions = Lists.newArrayList();
        List<Instruction> existingInstructions = null;
        if (flow != null) {
            Instructions ins = flow.getInstructions();
            if (ins != null) {
                existingInstructions = ins.getInstruction();
            }
        }

        if (isWriteFlow) {
            // Create output port list
            createOutputPortInstructions(ib, dpid, localPort, existingInstructions);
            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 {
            boolean flowRemove = OfInstructionUtils.removeOutputPortFromInstructions(ib, dpid, localPort,
                    existingInstructions);
            if (flowRemove) {
                /* if all ports are removed, remove flow */
                removeFlow(flowBuilder, nodeBuilder);
            } else {
                /* Install instruction with new output port list */
                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);
            }
        }
    }
 
开发者ID:opendaylight,项目名称:faas,代码行数:77,代码来源:PipelineL2Forwarding.java


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