use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode in project openflowplugin by opendaylight.
the class LLDPPacketPuntEnforcer method start.
@SuppressWarnings("IllegalCatch")
public void start() {
final InstanceIdentifier<FlowCapableNode> path = InstanceIdentifier.create(Nodes.class).child(Node.class).augmentation(FlowCapableNode.class);
final DataTreeIdentifier<FlowCapableNode> identifier = new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, path);
SimpleTaskRetryLooper looper = new SimpleTaskRetryLooper(STARTUP_LOOP_TICK, STARTUP_LOOP_MAX_RETRIES);
try {
listenerRegistration = looper.loopUntilNoException(() -> dataBroker.registerDataTreeChangeListener(identifier, LLDPPacketPuntEnforcer.this));
} catch (Exception e) {
throw new IllegalStateException("registerDataTreeChangeListener failed", e);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode in project openflowplugin by opendaylight.
the class LLDPPacketPuntEnforcer method onDataTreeChanged.
@Override
public void onDataTreeChanged(@Nonnull final Collection<DataTreeModification<FlowCapableNode>> modifications) {
for (DataTreeModification<FlowCapableNode> modification : modifications) {
if (modification.getRootNode().getModificationType() == ModificationType.WRITE) {
AddFlowInputBuilder addFlowInput = new AddFlowInputBuilder(createFlow());
addFlowInput.setNode(new NodeRef(modification.getRootPath().getRootIdentifier().firstIdentifierOf(Node.class)));
final Future<RpcResult<AddFlowOutput>> resultFuture = this.flowService.addFlow(addFlowInput.build());
JdkFutures.addErrorLogging(resultFuture, LOG, "addFlow");
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode in project openflowplugin by opendaylight.
the class NodeChangeListenerImpl method processRemovedNode.
private void processRemovedNode(final DataTreeModification<FlowCapableNode> modification) {
final InstanceIdentifier<FlowCapableNode> iiToNodeInInventory = modification.getRootPath().getRootIdentifier();
final NodeId nodeId = provideTopologyNodeId(iiToNodeInInventory);
final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node> iiToTopologyRemovedNode = provideIIToTopologyNode(nodeId);
if (iiToTopologyRemovedNode != null) {
operationProcessor.enqueueOperation(manager -> {
manager.addDeleteOperationToTxChain(LogicalDatastoreType.OPERATIONAL, iiToTopologyRemovedNode);
TopologyManagerUtil.removeAffectedLinks(nodeId, manager, II_TO_TOPOLOGY);
});
} else {
LOG.debug("Instance identifier to inventory wasn't translated to topology while deleting node.");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode 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.inventory.rev130819.FlowCapableNode 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();
}
}
Aggregations