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;
}
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();
}
}
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;
}
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");
}
}
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();
}
Aggregations