public ExampleTopologyManagerCallback(final ActorSystem actorSystem, final DataBroker dataBroker, final String topologyId, final NodeManagerCallbackFactory nodeHandlerFactory, final NodeWriter naSalNodeWriter) { this(actorSystem, dataBroker, topologyId, nodeHandlerFactory, naSalNodeWriter, false); }
@Override public void onSuccess(final Void result) { naSalNodeWriter.delete(nodeId); }
private NodeManager createNodeManager(NodeId nodeId) { return new BaseNodeManagerBuilder().setNodeId(nodeId.getValue()) .setActorContext(TypedActor.context()) .setDelegateFactory(nodeHandlerFactory) .setRoleChangeStrategy(new NoopRoleChangeStrategy()) .setTopologyId(topologyId) .build(); }
@Override public void update(@Nonnull final NodeId id, @Nonnull final Node operationalDataNode) { // merge final WriteTransaction wTx = transactionChain.newWriteOnlyTransaction(); wTx.put(LogicalDatastoreType.OPERATIONAL, TopologyUtil.createTopologyNodeListPath(new NodeKey(id), topologyId), operationalDataNode); commitTransaction(wTx, id, "update"); }
@Override public void onSuccess(final Node result) { LOG.debug("Futures aggregated succesfully"); naSalNodeWriter.init(nodeId, result); }
public static InstanceIdentifier<Node> createTopologyNodePath(final String topologyId) { return createTopologyListPath(topologyId).child(Node.class); } }
@Override public BaseTopologyManager create() throws Exception { return new BaseTopologyManager(actorSystem, codecRegistry, dataBroker, topologyId, new TopologyCallbackFactory(ClusteredNetconfTopology.this, entityOwnershipService, writer), new NetconfNodeOperationalDataAggregator(), new LoggingSalNodeWriter(writer), new TopologyRoleChangeStrategy(dataBroker, entityOwnershipService, "topology-netconf", "topology-manager")); } }), topologyId);
@Override public void onSuccess(final Node result) { LOG.debug("Futures aggregated succesfully"); naSalNodeWriter.update(nodeId, result); }
@Override public NodeManagerCallback create(final String nodeId, final String topologyId, final ActorSystem actorSystem) { return new NetconfNodeManagerCallback(nodeId, topologyId, actorSystem, netconfTopology, new NodeRoleChangeStrategy(entityOwnershipService, "netconf-node", nodeId)); } }
@Override public BaseNodeManager create() throws Exception { return new BaseNodeManager(nodeId, topologyId, actorContext.system(), delegateFactory, roleChangeStrategy); } }), nodeId);
@Override public void ownershipChanged(final EntityOwnershipChange ownershipChange) { onRoleChanged(new RoleChangeDTO(ownershipChange.wasOwner(), ownershipChange.isOwner(), ownershipChange.hasOwner())); }
private NodeManager createNodeManager(NodeId nodeId) { return new BaseNodeManagerBuilder().setNodeId(nodeId.getValue()) .setActorContext(TypedActor.context()) .setDelegateFactory(nodeHandlerFactory) .setRoleChangeStrategy(new NoopRoleChangeStrategy()) .setTopologyId(topologyId) .build(); }
@Override public void init(@Nonnull final NodeId id, @Nonnull final Node operationalDataNode) { // put into Datastore final WriteTransaction wTx = transactionChain.newWriteOnlyTransaction(); wTx.put(LogicalDatastoreType.OPERATIONAL, TopologyUtil.createTopologyNodeListPath(new NodeKey(id), topologyId), operationalDataNode); commitTransaction(wTx, id, "init"); }
@Override public ListenableFuture<Node> onNodeUpdated(final NodeId nodeId, final Node node) { // only master should put initial state into datastore if (isMaster) { naSalNodeWriter.init(nodeId, nodes.get(nodeId).getInitialState(nodeId, node)); } // Trigger onNodeUpdated only on this node return nodes.get(nodeId).onNodeUpdated(nodeId, node); }
public NetconfTopologyManagerCallback(final ActorSystem actorSystem, final String topologyId, final NodeManagerCallbackFactory nodeHandlerFactory, final NodeWriter naSalNodeWriter) { this(actorSystem, topologyId, nodeHandlerFactory, naSalNodeWriter, false); }
public static InstanceIdentifier<Node> createTopologyNodeListPath(final NodeKey key, final String topologyId) { return createTopologyListPath(topologyId).child(Node.class, new NodeKey(new NodeId(key.getNodeId().getValue()))); }
@Override public void onFailure(final Throwable t) { // If the combined connection attempt failed, set the node to connection failed LOG.debug("Futures aggregation failed"); naSalNodeWriter.update(nodeId, delegateTopologyHandler.getFailedState(nodeId, node)); } }, TypedActor.context().dispatcher());
@Override public void delete(@Nonnull final NodeId id) { // delete final WriteTransaction wTx = transactionChain.newWriteOnlyTransaction(); wTx.delete(LogicalDatastoreType.OPERATIONAL, TopologyUtil.createTopologyNodeListPath(new NodeKey(id), topologyId)); commitTransaction(wTx, id, "delete"); }
@Override public ListenableFuture<Node> onNodeUpdated(final NodeId nodeId, final Node node) { // Set initial state naSalNodeWriter.init(nodeId, nodes.get(nodeId).getInitialState(nodeId, node)); // Trigger onNodeUpdated only on this node return nodes.get(nodeId).onNodeUpdated(nodeId, node); }
@Override public void onFailure(final Throwable t) { // If the combined connection attempt failed, set the node to connection failed LOG.debug("Futures aggregation failed"); naSalNodeWriter.update(nodeId, delegateTopologyHandler.getFailedState(nodeId, null)); } });