Search in sources :

Example 41 with FlowKey

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

the class DropTestCommiter method processPacket.

@Override
protected void processPacket(final InstanceIdentifier<Node> node, final Match match, final Instructions instructions) {
    // Finally build our flow
    final FlowBuilder fb = BUILDER.get();
    fb.setMatch(match);
    fb.setInstructions(instructions);
    fb.setId(new FlowId(String.valueOf(fb.hashCode()) + "." + ID_COUNTER.getAndIncrement()));
    // Construct the flow instance id
    final InstanceIdentifier<Flow> flowInstanceId = node.builder().augmentation(FlowCapableNode.class).child(Table.class, ZERO_TABLE).child(Flow.class, new FlowKey(fb.getId())).build();
    final Flow flow = fb.build();
    final ReadWriteTransaction transaction = dataService.newReadWriteTransaction();
    if (LOG.isDebugEnabled()) {
        LOG.debug("onPacketReceived - About to write flow {}", flow);
    }
    transaction.put(LogicalDatastoreType.CONFIGURATION, flowInstanceId, flow, true);
    transaction.submit();
    LOG.debug("onPacketReceived - About to write flow commited");
}
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) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) ReadWriteTransaction(org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Example 42 with FlowKey

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

the class FlowEntity method getFlowBuilder.

public FlowBuilder getFlowBuilder() {
    FlowBuilder flowBuilder = new FlowBuilder();
    flowBuilder.setKey(new FlowKey(new FlowId(getFlowId())));
    flowBuilder.setTableId(getTableId());
    flowBuilder.setPriority(getPriority());
    flowBuilder.setFlowName(getFlowName());
    flowBuilder.setIdleTimeout(getIdleTimeOut());
    flowBuilder.setHardTimeout(getHardTimeOut());
    flowBuilder.setCookie(new FlowCookie(getCookie()));
    flowBuilder.setMatch(MDSALUtil.buildMatches(getMatchInfoList()));
    flowBuilder.setInstructions(MDSALUtil.buildInstructions(getInstructionInfoList()));
    flowBuilder.setStrict(getStrictFlag());
    // TODO flowBuilder.setResyncFlag(getResyncFlag());
    if (getSendFlowRemFlag()) {
        flowBuilder.setFlags(new FlowModFlags(false, false, false, false, true));
    }
    flowBuilder.setBarrier(false);
    flowBuilder.setInstallHw(true);
    return flowBuilder;
}
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) FlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder) FlowModFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags)

Example 43 with FlowKey

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

the class MDSALManager method batchedAddFlowInternal.

public void batchedAddFlowInternal(BigInteger dpId, Flow flow) {
    FlowKey flowKey = new FlowKey(new FlowId(flow.getId()));
    InstanceIdentifier<Flow> flowInstanceId = buildFlowInstanceIdentifier(dpId, flow.getTableId(), flowKey);
    flowBatchingUtils.write(flowInstanceId, 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) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Example 44 with FlowKey

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

the class MDSALManager method deleteFlowInternal.

public void deleteFlowInternal(BigInteger dpId, Flow flow, WriteTransaction tx) {
    FlowKey flowKey = new FlowKey(flow.getId());
    short tableId = flow.getTableId();
    deleteFlow(dpId, tableId, flowKey, tx);
}
Also used : FlowKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey)

Example 45 with FlowKey

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

the class MDSALManager method syncSetUpFlowInternal.

public void syncSetUpFlowInternal(FlowEntity flowEntity, boolean isRemove) {
    if (LOG.isTraceEnabled()) {
        LOG.trace("syncSetUpFlow for flowEntity {} ", flowEntity);
    }
    Flow flow = flowEntity.getFlowBuilder().build();
    String flowId = flowEntity.getFlowId();
    short tableId = flowEntity.getTableId();
    BigInteger dpId = flowEntity.getDpnId();
    FlowKey flowKey = new FlowKey(new FlowId(flowId));
    InstanceIdentifier<Flow> flowInstanceId = buildFlowInstanceIdentifier(dpId, tableId, flowKey);
    if (isRemove) {
        synchronized (getFlowKey(dpId, tableId, flowKey)) {
            if (flowExists(dpId, tableId, flowKey)) {
                MDSALUtil.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, flowInstanceId);
            } else {
                LOG.debug("Flow {} does not exist for dpn {}", flowKey, dpId);
            }
        }
    } else {
        MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, flowInstanceId, 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) BigInteger(java.math.BigInteger) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Aggregations

FlowKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey)52 FlowId (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId)45 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)38 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)26 FlowBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder)26 TableKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey)23 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)23 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)22 BigInteger (java.math.BigInteger)15 Table (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table)12 FlowCookie (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie)11 ArrayList (java.util.ArrayList)9 FlowModFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags)9 Test (org.junit.Test)8 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)8 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)7 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)6 TableBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableBuilder)6 StaleFlow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.StaleFlow)6 StaleFlowKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.StaleFlowKey)6