Search in sources :

Example 41 with FlowRef

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef in project openflowplugin by opendaylight.

the class FlowForwarder method update.

@Override
public Future<RpcResult<UpdateFlowOutput>> update(final InstanceIdentifier<Flow> identifier, final Flow original, final Flow update, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
    LOG.trace("Forwarding Flow UPDATE request [Tbl id, node Id {} {} {}", identifier, nodeIdent, update);
    final Future<RpcResult<UpdateFlowOutput>> output;
    final TableKey tableKey = identifier.firstKeyOf(Table.class, TableKey.class);
    if (tableIdValidationPrecondition(tableKey, update)) {
        final UpdateFlowInputBuilder builder = new UpdateFlowInputBuilder();
        builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)));
        builder.setFlowRef(new FlowRef(identifier));
        // always needs to set strict flag into update-flow input so that
        // only a flow entry associated with a given flow object is updated.
        builder.setUpdatedFlow(new UpdatedFlowBuilder(update).setStrict(Boolean.TRUE).build());
        builder.setOriginalFlow(new OriginalFlowBuilder(original).setStrict(Boolean.TRUE).build());
        output = salFlowService.updateFlow(builder.build());
    } else {
        output = RpcResultBuilder.<UpdateFlowOutput>failed().withError(RpcError.ErrorType.APPLICATION, TABLE_ID_MISMATCH).buildFuture();
    }
    return output;
}
Also used : UpdateFlowInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInputBuilder) NodeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef) FlowRef(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) TableKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey) OriginalFlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow.update.OriginalFlowBuilder) UpdatedFlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow.update.UpdatedFlowBuilder)

Example 42 with FlowRef

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef in project openflowplugin by opendaylight.

the class FlowForwarder method remove.

@Override
public Future<RpcResult<RemoveFlowOutput>> remove(final InstanceIdentifier<Flow> identifier, final Flow removeDataObj, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
    LOG.trace("Forwarding Flow REMOVE request Tbl id, node Id {} {}", identifier, nodeIdent);
    final TableKey tableKey = identifier.firstKeyOf(Table.class, TableKey.class);
    if (tableIdValidationPrecondition(tableKey, removeDataObj)) {
        final RemoveFlowInputBuilder builder = new RemoveFlowInputBuilder(removeDataObj);
        builder.setFlowRef(new FlowRef(identifier));
        builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)));
        builder.setFlowTable(new FlowTableRef(nodeIdent.child(Table.class, tableKey)));
        // always needs to set strict flag into remove-flow input so that
        // only a flow entry associated with a given flow object will be removed.
        builder.setStrict(Boolean.TRUE);
        return salFlowService.removeFlow(builder.build());
    } else {
        return RpcResultBuilder.<RemoveFlowOutput>failed().withError(RpcError.ErrorType.APPLICATION, TABLE_ID_MISMATCH).buildFuture();
    }
}
Also used : NodeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef) FlowTableRef(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowTableRef) RemoveFlowOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowOutput) FlowRef(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef) RemoveFlowInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInputBuilder) TableKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey)

Example 43 with FlowRef

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef in project openflowplugin by opendaylight.

the class FlowForwarder method add.

@Override
public Future<RpcResult<AddFlowOutput>> add(final InstanceIdentifier<Flow> identifier, final Flow addDataObj, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
    LOG.trace("Forwarding the Flow ADD request [Tbl id, node Id {} {} {}", identifier, nodeIdent, addDataObj);
    final Future<RpcResult<AddFlowOutput>> output;
    final TableKey tableKey = identifier.firstKeyOf(Table.class, TableKey.class);
    if (tableIdValidationPrecondition(tableKey, addDataObj)) {
        final AddFlowInputBuilder builder = new AddFlowInputBuilder(addDataObj);
        builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)));
        builder.setFlowRef(new FlowRef(identifier));
        builder.setFlowTable(new FlowTableRef(nodeIdent.child(Table.class, tableKey)));
        output = salFlowService.addFlow(builder.build());
    } else {
        output = RpcResultBuilder.<AddFlowOutput>failed().withError(RpcError.ErrorType.APPLICATION, TABLE_ID_MISMATCH).buildFuture();
    }
    return output;
}
Also used : NodeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef) FlowTableRef(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowTableRef) FlowRef(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) AddFlowInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder) TableKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey)

Example 44 with FlowRef

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef in project openflowplugin by opendaylight.

the class FlowForwarder method remove.

@Override
public void remove(final InstanceIdentifier<Flow> identifier, final Flow removeDataObj, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
    final TableKey tableKey = identifier.firstKeyOf(Table.class, TableKey.class);
    if (tableIdValidationPrecondition(tableKey, removeDataObj)) {
        final RemoveFlowInputBuilder builder = new RemoveFlowInputBuilder(removeDataObj);
        builder.setFlowRef(new FlowRef(identifier));
        builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)));
        builder.setFlowTable(new FlowTableRef(nodeIdent.child(Table.class, tableKey)));
        // This method is called only when a given flow object has been
        // removed from datastore. So FRM always needs to set strict flag
        // into remove-flow input so that only a flow entry associated with
        // a given flow object is removed.
        builder.setTransactionUri(new Uri(provider.getNewTransactionId())).setStrict(Boolean.TRUE);
        final Future<RpcResult<RemoveFlowOutput>> resultFuture = provider.getSalFlowService().removeFlow(builder.build());
        JdkFutures.addErrorLogging(resultFuture, LOG, "removeFlow");
    }
}
Also used : NodeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef) FlowTableRef(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowTableRef) FlowRef(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) RemoveFlowInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInputBuilder) TableKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey) Uri(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri)

Example 45 with FlowRef

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef in project openflowplugin by opendaylight.

the class FlowNotificationSupplierImpl method deleteNotification.

@Override
public FlowRemoved deleteNotification(final InstanceIdentifier<Flow> path) {
    Preconditions.checkArgument(path != null);
    final FlowRemovedBuilder builder = new FlowRemovedBuilder();
    builder.setFlowRef(new FlowRef(path));
    builder.setNode(createNodeRef(path));
    return builder.build();
}
Also used : FlowRef(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef) FlowRemovedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemovedBuilder)

Aggregations

Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)31 ArrayList (java.util.ArrayList)28 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)24 MatchMetadata (org.opendaylight.genius.mdsalutil.matches.MatchMetadata)16 TableKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey)15 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)14 FlowId (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId)14 FlowRef (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef)14 InstructionApplyActions (org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)13 InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)12 Instruction (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction)12 FlowEntity (org.opendaylight.genius.mdsalutil.FlowEntity)11 FlowKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey)11 BigInteger (java.math.BigInteger)10 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)10 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)9 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)8 NodeRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef)8 InstructionGotoTable (org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable)7 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)7