Search in sources :

Example 36 with FlowBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder in project netvirt by opendaylight.

the class ElanDmacUtils method removeTheDropFlow.

private ListenableFuture<Void> removeTheDropFlow(long elanTag, BigInteger dpId, String extDeviceNodeId, String macToRemove) {
    String flowId = ElanUtils.getKnownDynamicmacFlowRef(NwConstants.ELAN_DMAC_TABLE, dpId, extDeviceNodeId, macToRemove, elanTag, true);
    Flow flowToRemove = new FlowBuilder().setId(new FlowId(flowId)).setTableId(NwConstants.ELAN_DMAC_TABLE).build();
    return ResourceBatchingManager.getInstance().delete(ResourceBatchingManager.ShardResource.CONFIG_TOPOLOGY, ElanUtils.getFlowIid(flowToRemove, dpId));
}
Also used : FlowId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId) FlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Example 37 with FlowBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder in project netvirt by opendaylight.

the class InterVpnLinkListener method removeVpnLinkEndpointFlows.

// We're catching Exception here to continue deleting as much as possible
// TODO Rework this so it's done in one transaction
@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);
}
Also used : FlowId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId) FlowKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey) FlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder) BigInteger(java.math.BigInteger) ExecutionException(java.util.concurrent.ExecutionException) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Example 38 with FlowBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder in project netvirt by opendaylight.

the class ElanInterfaceManager method removeUnknownDmacFlow.

private void removeUnknownDmacFlow(BigInteger dpId, ElanInstance elanInfo, WriteTransaction deleteFlowGroupTx, long elanTag) {
    Flow flow = new FlowBuilder().setId(new FlowId(getUnknownDmacFlowRef(NwConstants.ELAN_UNKNOWN_DMAC_TABLE, elanTag, SH_FLAG_UNSET))).setTableId(NwConstants.ELAN_UNKNOWN_DMAC_TABLE).build();
    mdsalManager.removeFlowToTx(dpId, flow, deleteFlowGroupTx);
    if (isVxlanNetworkOrVxlanSegment(elanInfo)) {
        Flow flow2 = new FlowBuilder().setId(new FlowId(getUnknownDmacFlowRef(NwConstants.ELAN_UNKNOWN_DMAC_TABLE, elanTag, SH_FLAG_SET))).setTableId(NwConstants.ELAN_UNKNOWN_DMAC_TABLE).build();
        mdsalManager.removeFlowToTx(dpId, flow2, deleteFlowGroupTx);
    }
}
Also used : FlowId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId) FlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Example 39 with FlowBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder in project netvirt by opendaylight.

the class OpenFlow13Utils method createFlowBuilder.

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;
}
Also used : FlowId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId) FlowKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey) FlowCookie(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie) NxAugMatchNodesNodeTableFlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNodesNodeTableFlowBuilder) FlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder) GeneralAugMatchNodesNodeTableFlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.GeneralAugMatchNodesNodeTableFlowBuilder) FlowModFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags)

Example 40 with FlowBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder in project netvirt by opendaylight.

the class CountersServiceUtils method createFlowOnTable.

public static Flow createFlowOnTable(Match match, int priority, short tableId, BigInteger cookie, Integer timeout) {
    FlowBuilder fb = new FlowBuilder();
    if (match != null) {
        fb.setMatch(match);
    }
    FlowId flowId = createFlowId();
    fb.setTableId(tableId);
    fb.setIdleTimeout(0).setHardTimeout(0);
    fb.setId(flowId);
    if (timeout != null) {
        fb.setHardTimeout(timeout);
    }
    if (cookie != null) {
        fb.setCookie(new FlowCookie(cookie));
    }
    fb.setPriority(priority);
    Flow flow = fb.build();
    return flow;
}
Also used : FlowId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId) FlowCookie(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie) FlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Aggregations

FlowBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder)62 FlowId (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId)39 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)37 FlowKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey)26 BigInteger (java.math.BigInteger)22 Test (org.junit.Test)19 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)15 FlowCookie (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie)15 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)13 Table (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table)12 FlowModFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags)10 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)10 ArrayList (java.util.ArrayList)9 TableKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey)9 Instruction (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction)8 NodeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder)8 TableBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableBuilder)7 ReadWriteTransaction (org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction)6 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)6 InstructionsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder)6