• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java FlowKey类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



FlowKey类属于org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table包,在下文中一共展示了FlowKey类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: removeTunnelTableEntry

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey; //导入依赖的package包/类
private void removeTunnelTableEntry(BigInteger dpId, long label, WriteTransaction tx) {
    FlowEntity flowEntity;
    LOG.debug("remove terminatingServiceActions called with DpnId = {} and label = {}", dpId, label);
    List<MatchInfo> mkMatches = new ArrayList<>();
    // Matching metadata
    mkMatches.add(new MatchTunnelId(BigInteger.valueOf(label)));
    flowEntity = MDSALUtil.buildFlowEntity(dpId,
        NwConstants.INTERNAL_TUNNEL_TABLE,
        getTableMissFlowRef(dpId, NwConstants.INTERNAL_TUNNEL_TABLE, (int) label),
        5, String.format("%s:%d", "TST Flow Entry ", label), 0, 0,
        COOKIE_TUNNEL.add(BigInteger.valueOf(label)), mkMatches, null);
    Node nodeDpn = FibUtil.buildDpnNode(flowEntity.getDpnId());
    FlowKey flowKey = new FlowKey(new FlowId(flowEntity.getFlowId()));
    InstanceIdentifier<Flow> flowInstanceId = InstanceIdentifier.builder(Nodes.class)
        .child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class)
        .child(Table.class, new TableKey(flowEntity.getTableId())).child(Flow.class, flowKey).build();

    tx.delete(LogicalDatastoreType.CONFIGURATION, flowInstanceId);
    LOG.debug("Terminating service Entry for dpID {} : label : {} removed successfully", dpId, label);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:21,代码来源:VrfEntryListener.java


示例2: createFlowBuilder

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey; //导入依赖的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


示例3: createArpReplyToControllerFlow

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey; //导入依赖的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


示例4: createFlow

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey; //导入依赖的package包/类
public FlowBuilder createFlow(final Dataflow dataFlow) throws DataflowCreationException {
    FlowBuilder flowBuilder = new FlowBuilder();
    try {
        final FlowModFlags flowModFlags = new FlowModFlags(false, false, false, false, false);
        final FlowId flowId = new FlowId(dataFlow.getId().toString());
        final FlowKey flowKey = new FlowKey(flowId);
        final MeterId meterId = new MeterId(dataFlow.getMeterId().longValue());

        flowBuilder.setFlowName("NIC_METER" + meterId.getValue());
        flowBuilder.setId(new FlowId(Long.toString(flowBuilder.hashCode())));
        flowBuilder.setMatch(createMatch(dataFlow.getSourceIpAddress()));
        flowBuilder.setInstructions(createInstruction(meterId));
        flowBuilder.setPriority(OFRendererConstants.DEFAULT_PRIORITY);
        flowBuilder.setCookie(new FlowCookie(BigInteger.valueOf(flowCookieInc.getAndIncrement())));
        flowBuilder.setBufferId(OFP_NO_BUFFER);
        flowBuilder.setHardTimeout((int) dataFlow.getTimeout());
        flowBuilder.setIdleTimeout((int) dataFlow.getTimeout());
        flowBuilder.setFlags(flowModFlags);
        flowBuilder.setKey(flowKey);
    } catch (Exception e) {
        throw new DataflowCreationException(e.getMessage());
    }

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


示例5: createFlowBuilder

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey; //导入依赖的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


示例6: createLldpReplyToControllerFlow

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey; //导入依赖的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


示例7: removeTap

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey; //导入依赖的package包/类
private void removeTap(Tap tap) {
    NodeId nodeId = tap.getNode();
    String tapId = tap.getId();
    String flowIdStr = "Tap_" + tapId + "SrcPort_"; // TODO: Concat srcNodeConnector to each flow;
    FlowId flowId = new FlowId(flowIdStr);
    FlowBuilder flowBuilder = new FlowBuilder()
            .setKey(new FlowKey(flowId))
            .setId(flowId)
            .setTableId((short)0);
    InstanceIdentifier<Flow> flowIID = InstanceIdentifier.builder(Nodes.class)
            .child(Node.class, new NodeKey(nodeId))
            .augmentation(FlowCapableNode.class)
            .child(Table.class, new TableKey(flowBuilder.getTableId()))
            .child(Flow.class, flowBuilder.getKey())
            .build();
    GenericTransactionUtils.writeData(dataBroker, LogicalDatastoreType.CONFIGURATION, flowIID, flowBuilder.build(), false);
}
 
开发者ID:sdnhub,项目名称:SDNHub_Opendaylight_Tutorial,代码行数:18,代码来源:TutorialTapProvider.java


示例8: getFlowRef

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey; //导入依赖的package包/类
public static FlowRef getFlowRef(BigInteger dpId, Flow flow) {
    FlowKey flowKey = new FlowKey(new FlowId(flow.getId()));
    Node nodeDpn = buildInventoryDpnNode(dpId);
    InstanceIdentifier<Flow> flowInstanceId =
            InstanceIdentifier.builder(Nodes.class)
            .child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class)
            .child(Table.class, new TableKey(flow.getTableId()))
            .child(Flow.class, flowKey)
            .build();
    return new FlowRef(flowInstanceId);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:12,代码来源:NaptEventHandler.java


示例9: createTerminatingServiceActions

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey; //导入依赖的package包/类
public void createTerminatingServiceActions(BigInteger destDpId, int label, List<ActionInfo> actionsInfos,
                                            WriteTransaction tx) {
    List<MatchInfo> mkMatches = new ArrayList<>();

    LOG.debug("create terminatingServiceAction on DpnId = {} and serviceId = {} and actions = {}",
        destDpId, label, actionsInfos);

    // Matching metadata
    // FIXME vxlan vni bit set is not working properly with OVS.need to revisit
    mkMatches.add(new MatchTunnelId(BigInteger.valueOf(label)));

    List<InstructionInfo> mkInstructions = new ArrayList<>();
    mkInstructions.add(new InstructionApplyActions(actionsInfos));

    FlowEntity terminatingServiceTableFlowEntity =
        MDSALUtil.buildFlowEntity(destDpId, NwConstants.INTERNAL_TUNNEL_TABLE,
        getTableMissFlowRef(destDpId, NwConstants.INTERNAL_TUNNEL_TABLE, label), 5,
            String.format("%s:%d", "TST Flow Entry ", label),
        0, 0, COOKIE_TUNNEL.add(BigInteger.valueOf(label)), mkMatches, mkInstructions);

    FlowKey flowKey = new FlowKey(new FlowId(terminatingServiceTableFlowEntity.getFlowId()));

    FlowBuilder flowbld = terminatingServiceTableFlowEntity.getFlowBuilder();

    Node nodeDpn = FibUtil.buildDpnNode(terminatingServiceTableFlowEntity.getDpnId());
    InstanceIdentifier<Flow> flowInstanceId = InstanceIdentifier.builder(Nodes.class)
        .child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class)
        .child(Table.class, new TableKey(terminatingServiceTableFlowEntity.getTableId()))
        .child(Flow.class, flowKey).build();
    tx.put(LogicalDatastoreType.CONFIGURATION, flowInstanceId, flowbld.build(),
            WriteTransaction.CREATE_MISSING_PARENTS);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:33,代码来源:VrfEntryListener.java


示例10: makeLFibTableEntry

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey; //导入依赖的package包/类
private void makeLFibTableEntry(BigInteger dpId, long label, List<InstructionInfo> instructions, int priority,
                                int addOrRemove, WriteTransaction tx) {
    Boolean wrTxPresent = true;
    if (tx == null) {
        wrTxPresent = false;
        tx = dataBroker.newWriteOnlyTransaction();
    }

    List<MatchInfo> matches = new ArrayList<>();
    matches.add(MatchEthernetType.MPLS_UNICAST);
    matches.add(new MatchMplsLabel(label));

    // Install the flow entry in L3_LFIB_TABLE
    String flowRef = FibUtil.getFlowRef(dpId, NwConstants.L3_LFIB_TABLE, label, priority);

    FlowEntity flowEntity;
    flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.L3_LFIB_TABLE, flowRef, priority, flowRef, 0, 0,
        NwConstants.COOKIE_VM_LFIB_TABLE, matches, instructions);
    Flow flow = flowEntity.getFlowBuilder().build();
    String flowId = flowEntity.getFlowId();
    FlowKey flowKey = new FlowKey(new FlowId(flowId));
    Node nodeDpn = FibUtil.buildDpnNode(dpId);
    InstanceIdentifier<Flow> flowInstanceId = InstanceIdentifier.builder(Nodes.class)
        .child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class)
        .child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flowKey).build();

    if (addOrRemove == NwConstants.ADD_FLOW) {
        tx.put(LogicalDatastoreType.CONFIGURATION, flowInstanceId, flow, WriteTransaction.CREATE_MISSING_PARENTS);
    } else {
        tx.delete(LogicalDatastoreType.CONFIGURATION, flowInstanceId);
    }
    if (!wrTxPresent) {
        tx.submit();
    }

    LOG.debug("LFIB Entry for dpID {} : label : {} instructions {} : key {} {} successfully",
        dpId, label, instructions, flowKey, NwConstants.ADD_FLOW == addOrRemove ? "ADDED" : "REMOVED");
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:39,代码来源:VrfEntryListener.java


示例11: removeVpnLinkEndpointFlows

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey; //导入依赖的package包/类
@SuppressWarnings("checkstyle:IllegalCatch")
private void removeVpnLinkEndpointFlows(InterVpnLink del, String vpnUuid, String rd, List<BigInteger> dpns,
                                        int otherEndpointLportTag, String otherEndpointIpAddr,
                                        List<VrfEntry> vrfEntries, final boolean isVpnFirstEndPoint) {

    String interVpnLinkName = del.getName();
    LOG.debug("Removing endpoint flows for vpn {}.  InterVpnLink={}.  OtherEndpointLportTag={}",
        vpnUuid, interVpnLinkName, otherEndpointLportTag);
    if (dpns == null) {
        LOG.debug("VPN {} endpoint is not instantiated in any DPN for InterVpnLink {}",
            vpnUuid, interVpnLinkName);
        return;
    }

    for (BigInteger dpnId : dpns) {
        try {
            // Removing flow from LportDispatcher table
            String flowRef = InterVpnLinkUtil.getLportDispatcherFlowRef(interVpnLinkName, otherEndpointLportTag);
            FlowKey flowKey = new FlowKey(new FlowId(flowRef));
            Flow flow = new FlowBuilder().setKey(flowKey).setId(new FlowId(flowRef))
                .setTableId(NwConstants.LPORT_DISPATCHER_TABLE).setFlowName(flowRef)
                .build();
            mdsalManager.removeFlow(dpnId, flow);

            // Also remove the 'fake' iface from the VpnToDpn map
            InterVpnLinkUtil.removeIVpnLinkIfaceFromVpnFootprint(vpnFootprintService, vpnUuid, rd, dpnId);

        } catch (Exception e) {
            // Whatever happens it should not stop it from trying to remove as much as possible
            LOG.warn("Error while removing InterVpnLink {} Endpoint flows on dpn {}. Reason: ",
                interVpnLinkName, dpnId, e);
        }
    }
    // Removing flow from FIB and LFIB tables
    LOG.trace("Removing flow in FIB and LFIB tables for vpn {} interVpnLink {} otherEndpointIpAddr {}",
        vpnUuid, interVpnLinkName, otherEndpointIpAddr);
    cleanUpInterVPNRoutes(interVpnLinkName, vrfEntries, isVpnFirstEndPoint);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:39,代码来源:InterVpnLinkListener.java


示例12: getFlowIid

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey; //导入依赖的package包/类
public static InstanceIdentifier<Flow> getFlowIid(Flow flow, BigInteger dpnId) {
    FlowKey flowKey = new FlowKey(new FlowId(flow.getId()));
    org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId nodeId =
            new org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId("openflow:" + dpnId);
    org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node nodeDpn =
            new NodeBuilder().setId(nodeId).setKey(new NodeKey(nodeId)).build();
    return InstanceIdentifier.builder(Nodes.class)
            .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class,
                    nodeDpn.getKey()).augmentation(FlowCapableNode.class)
            .child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flowKey).build();
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:12,代码来源:ElanUtils.java


示例13: getFlowIid

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey; //导入依赖的package包/类
protected InstanceIdentifier<Flow> getFlowIid(short tableId, FlowId flowid, BigInteger dpnId) {

        FlowKey flowKey = new FlowKey(new FlowId(flowid));
        NodeId nodeId =
                new NodeId("openflow:" + dpnId);
        Node nodeDpn =
                new NodeBuilder().setId(nodeId).setKey(new NodeKey(nodeId)).build();
        return InstanceIdentifier.builder(Nodes.class)
                .child(Node.class,
                        nodeDpn.getKey()).augmentation(FlowCapableNode.class)
                .child(Table.class, new TableKey(tableId)).child(Flow.class, flowKey).build();
    }
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:13,代码来源:ElanServiceTestBase.java


示例14: writeDataTransaction

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey; //导入依赖的package包/类
/**
 * Writes a Flow with a flow action on the Configuration
 * data store so that it can be applied to an OF switch.
 * @param nodeId The {@link NodeId} of the OF Switch
 * @param flowBuilder The {@link FlowBuilder} that is built and submitted
 * @param flowAction The {@link FlowAction} the flow action (ADD or REMOVE)
 * @return A boolean representing the transaction result
 */
protected boolean writeDataTransaction(NodeId nodeId, FlowBuilder flowBuilder, FlowAction flowAction) {
    boolean result = false;
    final NodeBuilder nodeBuilder = new NodeBuilder();
    final FlowKey flowKey = new FlowKey(flowBuilder.getKey());
    nodeBuilder.setId(nodeId);
    nodeBuilder.setKey(new NodeKey(nodeBuilder.getId()));

    MdsalUtils mdsal = new MdsalUtils(dataBroker);
    if (!pipelineManager.setTableId(nodeId, flowBuilder)) {
        flowBuilder.setTableId(OFRendererConstants.FALLBACK_TABLE_ID);
    }
    final TableKey tableKey = new TableKey(flowBuilder.getTableId());

    InstanceIdentifier<Flow> flowIID = InstanceIdentifier.builder(Nodes.class)
            .child(Node.class, nodeBuilder.getKey())
            .augmentation(FlowCapableNode.class)
            .child(Table.class, tableKey)
            .child(Flow.class, flowKey)
            .build();

    if (flowAction == FlowAction.ADD_FLOW) {
        result = mdsal.put(LogicalDatastoreType.CONFIGURATION, flowIID, flowBuilder.build());
    }
    else if(flowAction == FlowAction.REMOVE_FLOW) {
        result = mdsal.delete(LogicalDatastoreType.CONFIGURATION, flowIID);
    }

    return result;
}
 
开发者ID:opendaylight,项目名称:nic,代码行数:38,代码来源:AbstractFlowManager.java


示例15: addFlowGoto

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey; //导入依赖的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


示例16: makeConnectedRoute

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey; //导入依赖的package包/类
protected void makeConnectedRoute(BigInteger dpId, long vpnId, VrfEntry vrfEntry, String rd,
                        List<InstructionInfo> instructions, int addOrRemove, WriteTransaction tx,
                        List<SubTransaction> subTxns) {
    Boolean wrTxPresent = true;
    if (tx == null) {
        wrTxPresent = false;
        tx = dataBroker.newWriteOnlyTransaction();
    }

    LOG.trace("makeConnectedRoute: vrfEntry {}", vrfEntry);
    String[] values = vrfEntry.getDestPrefix().split("/");
    String ipAddress = values[0];
    int prefixLength = values.length == 1 ? 0 : Integer.parseInt(values[1]);
    if (addOrRemove == NwConstants.ADD_FLOW) {
        LOG.debug("Adding route to DPN {} for rd {} prefix {} ", dpId, rd, vrfEntry.getDestPrefix());
    } else {
        LOG.debug("Removing route from DPN {} for rd {} prefix {}", dpId, rd, vrfEntry.getDestPrefix());
    }
    InetAddress destPrefix;
    try {
        destPrefix = InetAddress.getByName(ipAddress);
    } catch (UnknownHostException e) {
        LOG.error("Failed to get destPrefix for prefix {} rd {} VpnId {} DPN {}",
                vrfEntry.getDestPrefix(), rd, vpnId, dpId, e);
        return;
    }

    List<MatchInfo> matches = new ArrayList<>();

    matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID));

    if (destPrefix instanceof Inet4Address) {
        matches.add(MatchEthernetType.IPV4);
        if (prefixLength != 0) {
            matches.add(new MatchIpv4Destination(destPrefix.getHostAddress(), Integer.toString(prefixLength)));
        }
    } else {
        matches.add(MatchEthernetType.IPV6);
        if (prefixLength != 0) {
            matches.add(new MatchIpv6Destination(destPrefix.getHostAddress() + "/" + prefixLength));
        }
    }

    int priority = DEFAULT_FIB_FLOW_PRIORITY + prefixLength;
    String flowRef = FibUtil.getFlowRef(dpId, NwConstants.L3_FIB_TABLE, rd, priority, destPrefix);
    FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.L3_FIB_TABLE, flowRef, priority,
            flowRef, 0, 0,
            COOKIE_VM_FIB_TABLE, matches, instructions);
    Flow flow = flowEntity.getFlowBuilder().build();
    String flowId = flowEntity.getFlowId();
    FlowKey flowKey = new FlowKey(new FlowId(flowId));
    Node nodeDpn = FibUtil.buildDpnNode(dpId);

    InstanceIdentifier<Flow> flowInstanceId = InstanceIdentifier.builder(Nodes.class)
            .child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class)
            .child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flowKey).build();

    if (RouteOrigin.value(vrfEntry.getOrigin()) == RouteOrigin.BGP) {
        SubTransaction subTransaction = new SubTransactionImpl();
        if (addOrRemove == NwConstants.ADD_FLOW) {
            subTransaction.setInstanceIdentifier(flowInstanceId);
            subTransaction.setInstance(flow);
            subTransaction.setAction(SubTransaction.CREATE);
        } else {
            subTransaction.setInstanceIdentifier(flowInstanceId);
            subTransaction.setAction(SubTransaction.DELETE);
        }
        subTxns.add(subTransaction);
    }

    if (addOrRemove == NwConstants.ADD_FLOW) {
        tx.put(LogicalDatastoreType.CONFIGURATION, flowInstanceId, flow, true);
    } else {
        tx.delete(LogicalDatastoreType.CONFIGURATION, flowInstanceId);
    }

    if (!wrTxPresent) {
        tx.submit();
    }
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:81,代码来源:BaseVrfEntryHandler.java


示例17: installSubnetBroadcastAddrDropRule

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey; //导入依赖的package包/类
private void installSubnetBroadcastAddrDropRule(final BigInteger dpnId, final String rd, final long vpnId,
                                                final VrfEntry vrfEntry, int addOrRemove, WriteTransaction tx) {
    List<MatchInfo> matches = new ArrayList<>();

    LOG.debug("SUBNETROUTE: installSubnetBroadcastAddrDropRule: destPrefix {} rd {} vpnId {} dpnId {}",
            vrfEntry.getDestPrefix(), rd, vpnId, dpnId);
    String[] ipAddress = vrfEntry.getDestPrefix().split("/");
    String subnetBroadcastAddr = FibUtil.getBroadcastAddressFromCidr(vrfEntry.getDestPrefix());
    final int prefixLength = ipAddress.length == 1 ? 0 : Integer.parseInt(ipAddress[1]);

    InetAddress destPrefix;
    try {
        destPrefix = InetAddress.getByName(subnetBroadcastAddr);
    } catch (UnknownHostException e) {
        LOG.error("Failed to get destPrefix for prefix {} rd {} VpnId {} DPN {}",
                vrfEntry.getDestPrefix(), rd, vpnId, dpnId, e);
        return;
    }

    // Match on VpnId and SubnetBroadCast IP address
    matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID));
    matches.add(MatchEthernetType.IPV4);

    if (prefixLength != 0) {
        matches.add(new MatchIpv4Destination(subnetBroadcastAddr, Integer.toString(IPV4_ADDR_PREFIX_LENGTH)));
    }

    //Action is to drop the packet
    List<InstructionInfo> dropInstructions = new ArrayList<>();
    List<ActionInfo> actionsInfos = new ArrayList<>();
    actionsInfos.add(new ActionDrop());
    dropInstructions.add(new InstructionApplyActions(actionsInfos));

    int priority = DEFAULT_FIB_FLOW_PRIORITY + IPV4_ADDR_PREFIX_LENGTH;
    String flowRef = FibUtil.getFlowRef(dpnId, NwConstants.L3_SUBNET_ROUTE_TABLE, rd, priority, destPrefix);
    FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpnId, NwConstants.L3_SUBNET_ROUTE_TABLE, flowRef, priority,
            flowRef, 0, 0, COOKIE_TABLE_MISS, matches, dropInstructions);

    Flow flow = flowEntity.getFlowBuilder().build();
    String flowId = flowEntity.getFlowId();
    FlowKey flowKey = new FlowKey(new FlowId(flowId));
    Node nodeDpn = FibUtil.buildDpnNode(dpnId);

    InstanceIdentifier<Flow> flowInstanceId = InstanceIdentifier.builder(Nodes.class)
            .child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class)
            .child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flowKey).build();

    if (addOrRemove == NwConstants.ADD_FLOW) {
        tx.put(LogicalDatastoreType.CONFIGURATION, flowInstanceId,flow, true);
    } else {
        tx.delete(LogicalDatastoreType.CONFIGURATION, flowInstanceId);
    }
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:54,代码来源:VrfEntryListener.java


示例18: programTrafficBehaviorRule

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey; //导入依赖的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


示例19: programDefaultPermitVni

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey; //导入依赖的package包/类
public void programDefaultPermitVni(Long dpid, 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();

        OfMatchUtils.addNxRegMatch(matchBuilder, new OfMatchUtils.RegMatch(PipelineTrafficClassifier.REG_SRC_TUN_ID,
                PipelineTrafficClassifier.REG2_DEFAULT_PERMIT_VNI));

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

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

        String flowId = "Acl_DefaultPermitVni_" + getTable();
        flowBuilder.setId(new FlowId(flowId));
        FlowKey key = new FlowKey(new FlowId(flowId));
        flowBuilder.setBarrier(true);
        flowBuilder.setTableId(this.getTable());
        flowBuilder.setKey(key);
        flowBuilder.setPriority(DEFAULT_PERMIT_VNI_PRIORITY);
        flowBuilder.setFlowName(flowId);
        flowBuilder.setHardTimeout(0);
        flowBuilder.setIdleTimeout(0);

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

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


示例20: programArpPacketAllow

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

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

    flowBuilder.setMatch(
            OfMatchUtils.createEtherTypeMatch(matchBuilder, new EtherType(Constants.ARP_ETHERTYPE)).build());

    String flowId = "Acl_ArpPacketAllow_" + getTable();

    flowBuilder.setId(new FlowId(flowId));
    FlowKey key = new FlowKey(new FlowId(flowId));
    flowBuilder.setBarrier(true);
    flowBuilder.setTableId(this.getTable());
    flowBuilder.setKey(key);
    flowBuilder.setPriority(ACL_MATCH_PRIORITY);
    flowBuilder.setFlowName(flowId);
    flowBuilder.setHardTimeout(0);
    flowBuilder.setIdleTimeout(0);

    if (isWriteFlow) {
        InstructionBuilder ib = new InstructionBuilder();
        InstructionsBuilder isb = new InstructionsBuilder();
        List<Instruction> instructions = Lists.newArrayList();

        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,代码行数:43,代码来源:PipelineAclHandler.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java XmlRegistryWriter类代码示例发布时间:2022-05-23
下一篇:
Java FinderException类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap