Search in sources :

Example 26 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Identifier in project openflowplugin by opendaylight.

the class FlowForwarder method update.

@Override
public void update(final InstanceIdentifier<Flow> identifier, final Flow original, final Flow update, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
    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));
        builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
        // This method is called only when a given flow object in datastore
        // has been updated. So FRM 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());
        final Future<RpcResult<UpdateFlowOutput>> resultFuture = provider.getSalFlowService().updateFlow(builder.build());
        JdkFutures.addErrorLogging(resultFuture, LOG, "updateFlow");
    }
}
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) Uri(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri) 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 27 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Identifier in project openflowplugin by opendaylight.

the class FlowForwarder method removeWithResult.

// TODO: Pull this into ForwardingRulesCommiter and override it here
@Override
public Future<RpcResult<RemoveFlowOutput>> removeWithResult(final InstanceIdentifier<Flow> identifier, final Flow removeDataObj, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
    Future<RpcResult<RemoveFlowOutput>> resultFuture = SettableFuture.create();
    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);
        resultFuture = provider.getSalFlowService().removeFlow(builder.build());
    }
    return resultFuture;
}
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 28 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Identifier 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) {
    Future<RpcResult<AddFlowOutput>> future;
    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)));
        builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
        future = provider.getSalFlowService().addFlow(builder.build());
    } else {
        future = Futures.<RpcResult<AddFlowOutput>>immediateFuture(null);
    }
    return future;
}
Also used : AddFlowOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutput) 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) Uri(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri)

Example 29 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Identifier in project openflowplugin by opendaylight.

the class FlowForwarder method createStaleMarkEntity.

@Override
public void createStaleMarkEntity(InstanceIdentifier<Flow> identifier, Flow del, InstanceIdentifier<FlowCapableNode> nodeIdent) {
    LOG.debug("Creating Stale-Mark entry for the switch {} for flow {} ", nodeIdent.toString(), del.toString());
    StaleFlow staleFlow = makeStaleFlow(identifier, del, nodeIdent);
    persistStaleFlow(staleFlow, nodeIdent);
}
Also used : StaleFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.StaleFlow)

Example 30 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Identifier in project openflowplugin by opendaylight.

the class MeterForwarder method remove.

@Override
public Future<RpcResult<RemoveMeterOutput>> remove(final InstanceIdentifier<Meter> identifier, final Meter removeDataObj, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
    LOG.trace("Received the Meter REMOVE request [Tbl id, node Id {} {}", identifier, nodeIdent);
    final RemoveMeterInputBuilder builder = new RemoveMeterInputBuilder(removeDataObj);
    builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)));
    builder.setMeterRef(new MeterRef(identifier));
    return salMeterService.removeMeter(builder.build());
}
Also used : NodeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef) RemoveMeterInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInputBuilder) MeterRef(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterRef)

Aggregations

Identifier (org.apache.cxf.ws.rm.v200702.Identifier)72 ArrayList (java.util.ArrayList)71 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)59 Test (org.junit.Test)52 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)50 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)50 ExecutionException (java.util.concurrent.ExecutionException)38 Uint32 (org.opendaylight.yangtools.yang.common.Uint32)37 Logger (org.slf4j.Logger)35 LoggerFactory (org.slf4j.LoggerFactory)35 Inject (javax.inject.Inject)32 Singleton (javax.inject.Singleton)32 DataBroker (org.opendaylight.mdsal.binding.api.DataBroker)32 LogicalDatastoreType (org.opendaylight.mdsal.common.api.LogicalDatastoreType)32 PreDestroy (javax.annotation.PreDestroy)30 ManagedNewTransactionRunner (org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner)30 ManagedNewTransactionRunnerImpl (org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl)30 Executors (org.opendaylight.infrautils.utils.concurrent.Executors)28 CONFIGURATION (org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION)27 AbstractAsyncDataTreeChangeListener (org.opendaylight.serviceutils.tools.listener.AbstractAsyncDataTreeChangeListener)26