Пример #1
0
 @Override
 public void onDataTreeChanged(@Nonnull final Collection<DataTreeModification<Node>> changes) {
   for (final DataTreeModification<Node> change : changes) {
     final DataObjectModification<Node> rootNode = change.getRootNode();
     final NodeId nodeId = NetconfTopologyUtils.getNodeId(rootNode.getIdentifier());
     switch (rootNode.getModificationType()) {
       case SUBTREE_MODIFIED:
         LOG.debug(
             "{}: Operational for node {} updated. Trying to register slave mount point",
             id,
             nodeId);
         handleSlaveMountPoint(rootNode);
         break;
       case WRITE:
         if (rootNode.getDataBefore() != null) {
           LOG.debug(
               "{}: Operational for node {} rewrited. Trying to register slave mount point",
               id,
               nodeId);
         } else {
           LOG.debug(
               "{}: Operational for node {} created. Trying to register slave mount point",
               id,
               nodeId);
         }
         handleSlaveMountPoint(rootNode);
         break;
       case DELETE:
         LOG.debug(
             "{}: Operational for node {} deleted. Trying to remove slave mount point",
             id,
             nodeId);
         closeActor();
         break;
       default:
         LOG.debug("{}: Uknown operation for node: {}", id, nodeId);
     }
   }
 }
Пример #2
0
  private void handleSlaveMountPoint(final DataObjectModification<Node> rootNode) {
    @SuppressWarnings("ConstantConditions")
    final NetconfNode netconfNodeAfter = rootNode.getDataAfter().getAugmentation(NetconfNode.class);

    if (NetconfNodeConnectionStatus.ConnectionStatus.Connected.equals(
        netconfNodeAfter.getConnectionStatus())) {
      createActorRef();
      final String masterAddress =
          netconfNodeAfter.getClusteredConnectionStatus().getNetconfMasterNode();
      final String path =
          NetconfTopologyUtils.createActorPath(
              masterAddress,
              NetconfTopologyUtils.createMasterActorName(
                  id.getName(),
                  netconfNodeAfter.getClusteredConnectionStatus().getNetconfMasterNode()));
      setup.getActorSystem().actorSelection(path).tell(new AskForMasterMountPoint(), slaveActorRef);
    } else {;
      closeActor();
    }
  }