summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/netconfnode-state-service/provider
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/netconfnode-state-service/provider')
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/GenericTransactionUtils.java13
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/NetconfAccessorImpl.java20
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/NetconfNodeStateServiceImpl.java176
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlAkka/AkkaConfig.java9
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlAkka/ClusterConfig.java46
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlAkka/ClusterNodeInfo.java19
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlGeo/ClusterRoleInfo.java14
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlGeo/ClusterRoleInfoCollection.java4
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlGeo/GeoConfig.java4
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/rpc/NetconfnodeStateServiceRpcApiImpl.java10
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/rpc/RpcApigetStateCallback.java6
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestAkkaConfig.java8
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestGeoConfig.java4
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestNetconfNodeStateService.java27
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/ClusterSingletonServiceProviderMock.java18
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/DataBrokerMountpointMock.java4
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/DataBrokerNetconfMock.java9
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/MountPointMock.java11
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/MountPointServiceMock.java4
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/NotificationPublishServiceMock.java9
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/RpcConsumerRegistryMock.java4
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/RpcProviderRegistryMock.java4
22 files changed, 225 insertions, 198 deletions
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/GenericTransactionUtils.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/GenericTransactionUtils.java
index 6a811ea59..755224027 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/GenericTransactionUtils.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/GenericTransactionUtils.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,7 +14,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
* ============LICENSE_END==========================================================================
- ******************************************************************************/
+ */
package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl;
import com.google.common.base.Preconditions;
@@ -58,7 +58,8 @@ public final class GenericTransactionUtils implements TransactionUtils {
AtomicBoolean noErrorIndication = new AtomicBoolean();
AtomicReference<String> statusText = new AtomicReference<>();
- @Nullable T obj = readDataOptionalWithStatus(dataBroker, dataStoreType, iid, noErrorIndication, statusText);
+ @Nullable
+ T obj = readDataOptionalWithStatus(dataBroker, dataStoreType, iid, noErrorIndication, statusText);
if (!noErrorIndication.get()) {
LOG.warn("Read transaction for identifier " + iid + " failed with status " + statusText.get());
@@ -84,7 +85,8 @@ public final class GenericTransactionUtils implements TransactionUtils {
LogicalDatastoreType dataStoreType, InstanceIdentifier<T> iid, AtomicBoolean noErrorIndication,
AtomicReference<String> statusIndicator) {
- @Nullable T data = null;
+ @Nullable
+ T data = null;
noErrorIndication.set(false);
statusIndicator.set("Preconditions");
@@ -109,7 +111,8 @@ public final class GenericTransactionUtils implements TransactionUtils {
statusIndicator.set("Create Read Transaction");
ReadTransaction readTransaction = dataBroker.newReadOnlyTransaction();
try {
- @NonNull FluentFuture<Optional<T>> od = readTransaction.read(dataStoreType, iid);
+ @NonNull
+ FluentFuture<Optional<T>> od = readTransaction.read(dataStoreType, iid);
statusIndicator.set("Read done");
if (od != null) {
statusIndicator.set("Unwrap checkFuture done");
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/NetconfAccessorImpl.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/NetconfAccessorImpl.java
index 654b9d7d9..433b34e49 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/NetconfAccessorImpl.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/NetconfAccessorImpl.java
@@ -58,7 +58,8 @@ public class NetconfAccessorImpl implements NetconfAccessor {
/**
* Contains all data to access and manage netconf device
- * @param nodeId of managed netconf node
+ *
+ * @param nodeId of managed netconf node
* @param netconfNode information
* @param dataBroker to access node
* @param mountpoint of netconfNode
@@ -78,7 +79,7 @@ public class NetconfAccessorImpl implements NetconfAccessor {
}
/**
- * @param nodeId with uuid of managed netconf node
+ * @param nodeId with uuid of managed netconf node
* @param dataBroker to access node
*/
public NetconfAccessorImpl(String nodeId, NetconfNode netconfNode, DataBroker dataBroker, MountPoint mountpoint,
@@ -95,31 +96,36 @@ public class NetconfAccessorImpl implements NetconfAccessor {
public DataBroker getDataBroker() {
return dataBroker;
}
+
@Override
public MountPoint getMountpoint() {
return mountpoint;
}
+
@Override
public TransactionUtils getTransactionUtils() {
return transactionUtils;
}
+
@Override
public NetconfNode getNetconfNode() {
return netconfNode;
}
+
@Override
public Capabilities getCapabilites() {
return capabilities;
}
@Override
- public @NonNull <T extends NotificationListener> ListenerRegistration<NotificationListener> doRegisterNotificationListener(@NonNull T listener) {
+ public @NonNull <T extends NotificationListener> ListenerRegistration<NotificationListener> doRegisterNotificationListener(
+ @NonNull T listener) {
log.info("Begin register listener for Mountpoint {}", mountpoint.getIdentifier().toString());
- final Optional<NotificationService> optionalNotificationService = mountpoint
- .getService(NotificationService.class);
+ final Optional<NotificationService> optionalNotificationService =
+ mountpoint.getService(NotificationService.class);
final NotificationService notificationService = optionalNotificationService.get();
- final ListenerRegistration<NotificationListener> ranListenerRegistration = notificationService
- .registerNotificationListener(listener);
+ final ListenerRegistration<NotificationListener> ranListenerRegistration =
+ notificationService.registerNotificationListener(listener);
log.info("End registration listener for Mountpoint {} Listener: {} Result: {}",
mountpoint.getIdentifier().toString(), optionalNotificationService, ranListenerRegistration);
return ranListenerRegistration;
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/NetconfNodeStateServiceImpl.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/NetconfNodeStateServiceImpl.java
index adced6b33..c190346c4 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/NetconfNodeStateServiceImpl.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/NetconfNodeStateServiceImpl.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,7 +14,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
* ============LICENSE_END==========================================================================
- ******************************************************************************/
+ */
package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl;
import java.util.Collection;
@@ -144,7 +144,7 @@ public class NetconfNodeStateServiceImpl implements NetconfNodeStateService, Rpc
this.listenerL1 = null;
this.listenerL2 = null;
- this.initializationSuccessful= false;
+ this.initializationSuccessful = false;
this.netconfNodeConnectListenerList = new CopyOnWriteArrayList<>();
this.netconfNodeStateListenerList = new CopyOnWriteArrayList<>();
this.vesNotificationListenerList = new CopyOnWriteArrayList<>();
@@ -165,9 +165,11 @@ public class NetconfNodeStateServiceImpl implements NetconfNodeStateService, Rpc
public void setMountPointService(MountPointService mountPointService) {
this.mountPointService = mountPointService;
}
+
public void setClusterSingletonService(ClusterSingletonServiceProvider clusterSingletonService) {
this.clusterSingletonServiceProvider = clusterSingletonService;
}
+
public void setEntityDataProvider(IEntityDataProvider iEntityDataProvider) {
this.iEntityDataProvider = iEntityDataProvider;
}
@@ -187,8 +189,9 @@ public class NetconfNodeStateServiceImpl implements NetconfNodeStateService, Rpc
this.clusterName = akkaConfig == null ? "" : akkaConfig.getClusterConfig().getClusterSeedNodeName("abc");
// Provide status information
- ClusterConfig cc = akkaConfig==null?null:akkaConfig.getClusterConfig();
- this.iEntityDataProvider.setStatus(StatusKey.CLUSTER_SIZE,cc==null?"1":String.format("%d",cc.getClusterSize()));
+ ClusterConfig cc = akkaConfig == null ? null : akkaConfig.getClusterConfig();
+ this.iEntityDataProvider.setStatus(StatusKey.CLUSTER_SIZE,
+ cc == null ? "1" : String.format("%d", cc.getClusterSize()));
// RPC Service for specific services
this.rpcApiService.setStatusCallback(this);
@@ -206,6 +209,7 @@ public class NetconfNodeStateServiceImpl implements NetconfNodeStateService, Rpc
LOG.info("Session Initiated end. Initialization done {}", initializationSuccessful);
}
+
/** Blueprint destroy-method method */
public void destroy() {
close();
@@ -213,6 +217,7 @@ public class NetconfNodeStateServiceImpl implements NetconfNodeStateService, Rpc
/**
* Getter
+ *
* @return NetconfnodeStateServiceRpcApiImpl
*/
public NetconfnodeStateServiceRpcApiImpl getNetconfnodeStateServiceRpcApiImpl() {
@@ -227,7 +232,7 @@ public class NetconfNodeStateServiceImpl implements NetconfNodeStateService, Rpc
@Override
public <L extends NetconfNodeConnectListener> @NonNull ListenerRegistration<L> registerNetconfNodeConnectListener(
final @NonNull L netconfNodeConnectListener) {
- LOG.info("Register connect listener {}",netconfNodeConnectListener.getClass().getName());
+ LOG.info("Register connect listener {}", netconfNodeConnectListener.getClass().getName());
netconfNodeConnectListenerList.add(netconfNodeConnectListener);
return new ListenerRegistration<L>() {
@@ -238,7 +243,7 @@ public class NetconfNodeStateServiceImpl implements NetconfNodeStateService, Rpc
@Override
public void close() {
- LOG.info("Remove connect listener {}",netconfNodeConnectListener);
+ LOG.info("Remove connect listener {}", netconfNodeConnectListener);
netconfNodeConnectListenerList.remove(netconfNodeConnectListener);
}
};
@@ -247,7 +252,7 @@ public class NetconfNodeStateServiceImpl implements NetconfNodeStateService, Rpc
@Override
public <L extends NetconfNodeStateListener> @NonNull ListenerRegistration<L> registerNetconfNodeStateListener(
@NonNull L netconfNodeStateListener) {
- LOG.info("Register state listener {}",netconfNodeStateListener.getClass().getName());
+ LOG.info("Register state listener {}", netconfNodeStateListener.getClass().getName());
netconfNodeStateListenerList.add(netconfNodeStateListener);
return new ListenerRegistration<L>() {
@@ -258,7 +263,7 @@ public class NetconfNodeStateServiceImpl implements NetconfNodeStateService, Rpc
@Override
public void close() {
- LOG.info("Remove state listener {}",netconfNodeStateListener);
+ LOG.info("Remove state listener {}", netconfNodeStateListener);
netconfNodeStateListenerList.remove(netconfNodeStateListener);
}
};
@@ -267,7 +272,7 @@ public class NetconfNodeStateServiceImpl implements NetconfNodeStateService, Rpc
@Override
public <L extends VesNotificationListener> @NonNull ListenerRegistration<L> registerVesNotifications(
@NonNull L vesNotificationListener) {
- LOG.info("Register Ves notification listener {}",vesNotificationListener.getClass().getName());
+ LOG.info("Register Ves notification listener {}", vesNotificationListener.getClass().getName());
vesNotificationListenerList.add(vesNotificationListener);
return new ListenerRegistration<L>() {
@@ -278,7 +283,7 @@ public class NetconfNodeStateServiceImpl implements NetconfNodeStateService, Rpc
@Override
public void close() {
- LOG.info("Remove Ves notification listener {}",vesNotificationListener);
+ LOG.info("Remove Ves notification listener {}", vesNotificationListener);
vesNotificationListenerList.remove(vesNotificationListener);
}
};
@@ -311,6 +316,7 @@ public class NetconfNodeStateServiceImpl implements NetconfNodeStateService, Rpc
/**
* Indication if init() of this bundle successfully done.
+ *
* @return true if init() was successful. False if not done or not successful.
*/
public boolean isInitializationSuccessful() {
@@ -322,8 +328,9 @@ public class NetconfNodeStateServiceImpl implements NetconfNodeStateService, Rpc
*/
/**
- * For each mounted device a mountpoint is created and this listener is called.
- * Mountpoint was created or existing. Managed device is now fully connected to node/mountpoint.
+ * For each mounted device a mountpoint is created and this listener is called. Mountpoint was created or existing.
+ * Managed device is now fully connected to node/mountpoint.
+ *
* @param nNodeId id of the mountpoint
* @param netconfNode mountpoint contents
*/
@@ -349,8 +356,8 @@ public class NetconfNodeStateServiceImpl implements NetconfNodeStateService, Rpc
LOG.info("isNetconfNodeMaster indication {} for mountpoint {}", isNetconfNodeMaster, mountPointNodeName);
if (isNetconfNodeMaster) {
- InstanceIdentifier<Node> instanceIdentifier = NETCONF_TOPO_IID.child(Node.class,
- new NodeKey(new NodeId(mountPointNodeName)));
+ InstanceIdentifier<Node> instanceIdentifier =
+ NETCONF_TOPO_IID.child(Node.class, new NodeKey(new NodeId(mountPointNodeName)));
Optional<MountPoint> optionalMountPoint = null;
int timeout = 10000;
@@ -399,6 +406,7 @@ public class NetconfNodeStateServiceImpl implements NetconfNodeStateService, Rpc
/**
* Leave the connected status to a non connected or removed status for master mountpoint
+ *
* @param action that occurred
* @param nNodeId id of the mountpoint
* @param netconfNode mountpoint contents or not available on remove
@@ -407,8 +415,8 @@ public class NetconfNodeStateServiceImpl implements NetconfNodeStateService, Rpc
String mountPointNodeName = nNodeId.getValue();
LOG.info("netconfNode id {}", mountPointNodeName);
- InstanceIdentifier<Node> instanceIdentifier = NETCONF_TOPO_IID.child(Node.class,
- new NodeKey(new NodeId(mountPointNodeName)));
+ InstanceIdentifier<Node> instanceIdentifier =
+ NETCONF_TOPO_IID.child(Node.class, new NodeKey(new NodeId(mountPointNodeName)));
Optional<MountPoint> optionalMountPoint = mountPointService.getMountPoint(instanceIdentifier);
if (optionalMountPoint.isPresent()) {
Optional<DataBroker> optionalNetconfNodeDatabroker = optionalMountPoint.get().getService(DataBroker.class);
@@ -436,15 +444,14 @@ public class NetconfNodeStateServiceImpl implements NetconfNodeStateService, Rpc
final DataObjectModification<Node> root = change.getRootNode();
//if (LOG.isTraceEnabled()) {
- LOG.info /*trace*/("Handle this modificationType:{} path:{} root:{}", root.getModificationType(),
- change.getRootPath(), root);
+ LOG.info /*trace*/("Handle this modificationType:{} path:{} root:{}", root.getModificationType(),
+ change.getRootPath(), root);
//}
// Catch potential nullpointer exceptions ..
try {
ModificationType modificationTyp = root.getModificationType();
- Node node = modificationTyp == ModificationType.DELETE ? root.getDataBefore()
- : root.getDataAfter();
+ Node node = modificationTyp == ModificationType.DELETE ? root.getDataBefore() : root.getDataAfter();
NodeId nodeId = node != null ? node.getNodeId() : null;
if (nodeId != null) {
if (nodeId.equals(CONTROLLER)) {
@@ -453,70 +460,70 @@ public class NetconfNodeStateServiceImpl implements NetconfNodeStateService, Rpc
} else {
if (modificationTyp != null) {
switch (modificationTyp) {
- case SUBTREE_MODIFIED: // Create or modify sub level node
- case WRITE: // Create or modify top level node
- // Treat an overwrite as an update
- // leaveconnected state.before = connected; state.after != connected
- // enterConnected state.after == connected
- // => Here create or update by checking root.getDataBefore() != null
-
- boolean connectedBefore, connectedAfter, created=false;
- NetconfNode nNodeAfter = getNetconfNode(root.getDataAfter());
- connectedAfter = isConnected(nNodeAfter);
- if (root.getDataBefore() != null) {
- // It is an update
- NetconfNode nodeBefore = getNetconfNode(root.getDataBefore());
- connectedBefore = isConnected(nodeBefore);
- } else {
- // It is a create
- connectedBefore = false;
- created = true;
- }
-
- LOG.info(
- "L1 NETCONF Node change with id:{} ConnectedBefore:{} connectedAfter {}:cluster status:{} akkaIsCluster:{}",
- nodeId, connectedBefore, connectedAfter,
- getClusteredConnectionStatus(nNodeAfter), isCluster);
-
- if(created) {
- netconfNodeStateListenerList.forEach(item -> {
- try {
- item.onCreated(nodeId, nNodeAfter);
- } catch (Exception e) {
- LOG.info("Exception during onCreated listener call", e);
- }
- });
- }
- if (!connectedBefore && connectedAfter) {
- enterConnectedState(nodeId, nNodeAfter);
- } else {
- LOG.debug("State change {} {}", connectedBefore, connectedAfter);
- if (connectedBefore && !connectedAfter) {
- leaveConnectedState(nodeId, Optional.of(nNodeAfter));
+ case SUBTREE_MODIFIED: // Create or modify sub level node
+ case WRITE: // Create or modify top level node
+ // Treat an overwrite as an update
+ // leaveconnected state.before = connected; state.after != connected
+ // enterConnected state.after == connected
+ // => Here create or update by checking root.getDataBefore() != null
+
+ boolean connectedBefore, connectedAfter, created = false;
+ NetconfNode nNodeAfter = getNetconfNode(root.getDataAfter());
+ connectedAfter = isConnected(nNodeAfter);
+ if (root.getDataBefore() != null) {
+ // It is an update
+ NetconfNode nodeBefore = getNetconfNode(root.getDataBefore());
+ connectedBefore = isConnected(nodeBefore);
+ } else {
+ // It is a create
+ connectedBefore = false;
+ created = true;
+ }
+
+ LOG.info(
+ "L1 NETCONF Node change with id:{} ConnectedBefore:{} connectedAfter {}:cluster status:{} akkaIsCluster:{}",
+ nodeId, connectedBefore, connectedAfter,
+ getClusteredConnectionStatus(nNodeAfter), isCluster);
+
+ if (created) {
+ netconfNodeStateListenerList.forEach(item -> {
+ try {
+ item.onCreated(nodeId, nNodeAfter);
+ } catch (Exception e) {
+ LOG.info("Exception during onCreated listener call", e);
+ }
+ });
+ }
+ if (!connectedBefore && connectedAfter) {
+ enterConnectedState(nodeId, nNodeAfter);
+ } else {
+ LOG.debug("State change {} {}", connectedBefore, connectedAfter);
+ if (connectedBefore && !connectedAfter) {
+ leaveConnectedState(nodeId, Optional.of(nNodeAfter));
+ }
+ netconfNodeStateListenerList.forEach(item -> {
+ try {
+ item.onStateChange(nodeId, nNodeAfter);
+ } catch (Exception e) {
+ LOG.info("Exception during onStateChange listener call", e);
+ }
+ });
}
+ // doProcessing(update ? Action.UPDATE : Action.CREATE, nodeId, root);
+ break;
+ case DELETE:
+ // Node removed
+ // leaveconnected state.before = connected;
+ leaveConnectedState(nodeId, Optional.empty());
netconfNodeStateListenerList.forEach(item -> {
try {
- item.onStateChange(nodeId, nNodeAfter);
+ item.onRemoved(nodeId);
} catch (Exception e) {
- LOG.info("Exception during onStateChange listener call", e);
+ LOG.info("Exception during onRemoved listener call", e);
}
});
- }
- // doProcessing(update ? Action.UPDATE : Action.CREATE, nodeId, root);
- break;
- case DELETE:
- // Node removed
- // leaveconnected state.before = connected;
- leaveConnectedState(nodeId, Optional.empty());
- netconfNodeStateListenerList.forEach(item -> {
- try {
- item.onRemoved(nodeId);
- } catch (Exception e) {
- LOG.info("Exception during onRemoved listener call", e);
- }
- });
- // doProcessing(Action.REMOVE, nodeId, root);
- break;
+ // doProcessing(Action.REMOVE, nodeId, root);
+ break;
}
}
}
@@ -530,14 +537,13 @@ public class NetconfNodeStateServiceImpl implements NetconfNodeStateService, Rpc
// ---- subclasses for listeners
/**
- * Clustered listener function to select the right node from
- * DataObjectModification. Called at all nodes.
+ * Clustered listener function to select the right node from DataObjectModification. Called at all nodes.
*/
private class L1 implements ClusteredDataTreeChangeListener<Node> {
@Override
public void onDataTreeChanged(@NonNull Collection<DataTreeModification<Node>> changes) {
LOG.info("L1 TreeChange enter changes:{}", changes.size());
- new Thread( () -> onDataTreeChangedHandler(changes)).start();
+ new Thread(() -> onDataTreeChangedHandler(changes)).start();
LOG.info("L1 TreeChange leave");
}
}
@@ -557,7 +563,7 @@ public class NetconfNodeStateServiceImpl implements NetconfNodeStateService, Rpc
/* --- private helpers --- */
private static @Nullable NetconfNode getNetconfNode(Node node) {
- return node != null ? node.augmentation(NetconfNode.class) : null;
+ return node != null ? node.augmentation(NetconfNode.class) : null;
}
private static boolean isConnected(NetconfNode nNode) {
@@ -603,7 +609,9 @@ public class NetconfNodeStateServiceImpl implements NetconfNodeStateService, Rpc
LOG.debug("check if me is responsible for node");
ClusteredConnectionStatus ccs = nNode.getClusteredConnectionStatus();
@SuppressWarnings("null")
- @NonNull String masterNodeName = ccs == null || ccs.getNetconfMasterNode() == null ? "null" : ccs.getNetconfMasterNode();
+ @NonNull
+ String masterNodeName =
+ ccs == null || ccs.getNetconfMasterNode() == null ? "null" : ccs.getNetconfMasterNode();
LOG.debug("sdnMasterNode=" + masterNodeName + " and sdnMyNode=" + this.clusterName);
if (!masterNodeName.equals(this.clusterName)) {
LOG.debug("netconf change but me is not master for this node");
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlAkka/AkkaConfig.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlAkka/AkkaConfig.java
index d0ea0eb69..64b0edbd6 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlAkka/AkkaConfig.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlAkka/AkkaConfig.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,7 +14,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
* ============LICENSE_END==========================================================================
- ******************************************************************************/
+ */
package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.conf.odlAkka;
import java.io.File;
@@ -77,10 +77,11 @@ public class AkkaConfig {
public boolean isSingleNode() {
return !this.isCluster();
}
- public static AkkaConfig parse(String content) throws Exception {
+
+ public static AkkaConfig parse(String content) throws Exception {
Config cfg = ConfigFactory.parseString(content);
AkkaConfig c = new AkkaConfig();
- c.cluserConfig=new ClusterConfig(cfg.getConfig("odl-cluster-data").getConfig("akka").getConfig("cluster"));
+ c.cluserConfig = new ClusterConfig(cfg.getConfig("odl-cluster-data").getConfig("akka").getConfig("cluster"));
return c;
}
}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlAkka/ClusterConfig.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlAkka/ClusterConfig.java
index 7f8d6cc78..47d3ec3b7 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlAkka/ClusterConfig.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlAkka/ClusterConfig.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,7 +14,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
* ============LICENSE_END==========================================================================
- ******************************************************************************/
+ */
package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.conf.odlAkka;
import java.util.ArrayList;
@@ -35,20 +35,20 @@ public class ClusterConfig {
private final ClusterRoleInfoCollection roles;
private ClusterNodeInfo ismeInfo;
- public static ClusterConfig defaultSingleNodeConfig()
- {
- ClusterConfig cfg=new ClusterConfig();
- cfg.ismeInfo=ClusterNodeInfo.defaultSingleNodeInfo();
+ public static ClusterConfig defaultSingleNodeConfig() {
+ ClusterConfig cfg = new ClusterConfig();
+ cfg.ismeInfo = ClusterNodeInfo.defaultSingleNodeInfo();
cfg.seedNodes.add(cfg.ismeInfo);
cfg.roles.add(ClusterRoleInfo.defaultSingleNodeRole());
return cfg;
}
- public ClusterConfig()
- {
+
+ public ClusterConfig() {
this.seedNodes = new ArrayList<>();
this.roles = new ClusterRoleInfoCollection();
}
+
public ClusterConfig(Config o) throws Exception {
{
this.seedNodes = new ArrayList<>();
@@ -87,9 +87,9 @@ public class ClusterConfig {
public String getHostName(String defaultValue) {
if (getRoleMemberIndex() > 0 && getRoleMemberIndex() <= seedNodes.size()) {
- return this.seedNodes.get(getRoleMemberIndex()-1).getRemoteAddress();
+ return this.seedNodes.get(getRoleMemberIndex() - 1).getRemoteAddress();
} else {
- LOG.warn("Seednode not available for roleMemberIndex {}. Using default {}",getRoleMember(), defaultValue);
+ LOG.warn("Seednode not available for roleMemberIndex {}. Using default {}", getRoleMember(), defaultValue);
return defaultValue;
}
}
@@ -97,33 +97,37 @@ public class ClusterConfig {
public String getDBClusterName(String defaultValue) {
String r = null;
if (this.seedNodes != null && this.seedNodes.size() > 0) {
- r = String.format("cluster-%s.%d", this.seedNodes.get(0).getRemoteAddress(), this.seedNodes.get(0).getPort());
+ r = String.format("cluster-%s.%d", this.seedNodes.get(0).getRemoteAddress(),
+ this.seedNodes.get(0).getPort());
}
if (r == null || r.isEmpty()) {
r = defaultValue;
}
return r;
}
+
public String getClusterSeedNodeName() {
return this.getClusterSeedNodeName("");
}
+
public String getClusterSeedNodeName(String defaultValue) {
- int idx=this.getRoleMemberIndex()-1;
- String r=null;
- if(this.seedNodes!=null && idx>=0 && this.seedNodes.size()>0 && this.seedNodes.size()>idx)
- {
- r=this.seedNodes.get(idx).getSeedNodeName();
+ int idx = this.getRoleMemberIndex() - 1;
+ String r = null;
+ if (this.seedNodes != null && idx >= 0 && this.seedNodes.size() > 0 && this.seedNodes.size() > idx) {
+ r = this.seedNodes.get(idx).getSeedNodeName();
}
if (r == null || r.isEmpty()) {
r = defaultValue;
}
return r;
}
+
public int getRoleMemberIndex() {
- ClusterRoleInfo role=this.roles.get("member");
- return role!=null?role.getIndex():0;
+ ClusterRoleInfo role = this.roles.get("member");
+ return role != null ? role.getIndex() : 0;
}
+
public ClusterRoleInfo getRoleMember() {
return this.roles.get("member");
}
@@ -133,9 +137,9 @@ public class ClusterConfig {
return "ClusterConfig [seedNodes=" + seedNodes + ", roles=" + roles + ", ismeInfo=" + ismeInfo + "]";
}
- public int getClusterSize() {
- return this.seedNodes == null ? 0 : this.seedNodes.size();
- }
+ public int getClusterSize() {
+ return this.seedNodes == null ? 0 : this.seedNodes.size();
+ }
}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlAkka/ClusterNodeInfo.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlAkka/ClusterNodeInfo.java
index ef161ad12..b27a7bd5c 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlAkka/ClusterNodeInfo.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlAkka/ClusterNodeInfo.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,13 +14,13 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
* ============LICENSE_END==========================================================================
- ******************************************************************************/
+ */
package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.conf.odlAkka;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-public class ClusterNodeInfo {
+public class ClusterNodeInfo {
private final String protocol;
private final String clusterName;
private final String remoteAdr;
@@ -28,7 +28,7 @@ public class ClusterNodeInfo {
private final String seedNodeName;
public static ClusterNodeInfo defaultSingleNodeInfo() {
- return new ClusterNodeInfo("akka.tcp","opendaylight-cluster-data","127.0.0.1",2550);
+ return new ClusterNodeInfo("akka.tcp", "opendaylight-cluster-data", "127.0.0.1", 2550);
}
public ClusterNodeInfo(String s) throws Exception {
@@ -46,11 +46,11 @@ public class ClusterNodeInfo {
}
public ClusterNodeInfo(String protocol, String clustername, String remoteadr, int port) {
- this.protocol=protocol;
- this.clusterName=clustername;
- this.remoteAdr=remoteadr;
- this.port=port;
- this.seedNodeName=this.protocol+"://"+this.clusterName+"@"+this.remoteAdr+":"+this.port;
+ this.protocol = protocol;
+ this.clusterName = clustername;
+ this.remoteAdr = remoteadr;
+ this.port = port;
+ this.seedNodeName = this.protocol + "://" + this.clusterName + "@" + this.remoteAdr + ":" + this.port;
}
public String getProtocol() {
@@ -64,6 +64,7 @@ public class ClusterNodeInfo {
public String getRemoteAddress() {
return remoteAdr;
}
+
public String getSeedNodeName() {
return seedNodeName;
}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlGeo/ClusterRoleInfo.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlGeo/ClusterRoleInfo.java
index 994ef548b..8f4446bb4 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlGeo/ClusterRoleInfo.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlGeo/ClusterRoleInfo.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,7 +14,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
* ============LICENSE_END==========================================================================
- ******************************************************************************/
+ */
package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.conf.odlGeo;
import java.util.regex.Matcher;
@@ -29,24 +29,25 @@ public class ClusterRoleInfo {
final Pattern pattern = Pattern.compile(regex);
final Matcher matcher = pattern.matcher(s);
if (!matcher.find()) {
- throw new Exception("unexpected role format:"+s);
+ throw new Exception("unexpected role format:" + s);
}
this.Role = matcher.group(1);
this.Index = Integer.parseInt(matcher.group(2));
}
private ClusterRoleInfo(String role, int idx) {
- this.Role=role;
- this.Index=idx;
+ this.Role = role;
+ this.Index = idx;
}
public static ClusterRoleInfo defaultSingleNodeRole() {
- return new ClusterRoleInfo("member",1);
+ return new ClusterRoleInfo("member", 1);
}
public String getRole() {
return Role;
}
+
public int getIndex() {
return Index;
}
@@ -84,6 +85,7 @@ public class ClusterRoleInfo {
}
return true;
}
+
@Override
public String toString() {
return "ClusterRoleInfo [Role=" + Role + ", Index=" + Index + "]";
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlGeo/ClusterRoleInfoCollection.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlGeo/ClusterRoleInfoCollection.java
index 478ed8394..e50ac9daa 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlGeo/ClusterRoleInfoCollection.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlGeo/ClusterRoleInfoCollection.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,7 +14,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
* ============LICENSE_END==========================================================================
- ******************************************************************************/
+ */
package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.conf.odlGeo;
import java.util.ArrayList;
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlGeo/GeoConfig.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlGeo/GeoConfig.java
index c25f3264b..5091e5219 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlGeo/GeoConfig.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlGeo/GeoConfig.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,7 +14,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
* ============LICENSE_END==========================================================================
- ******************************************************************************/
+ */
package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.conf.odlGeo;
import java.io.File;
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/rpc/NetconfnodeStateServiceRpcApiImpl.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/rpc/NetconfnodeStateServiceRpcApiImpl.java
index 9215887ff..896f010d8 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/rpc/NetconfnodeStateServiceRpcApiImpl.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/rpc/NetconfnodeStateServiceRpcApiImpl.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,7 +14,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
* ============LICENSE_END==========================================================================
- ******************************************************************************/
+ */
package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.rpc;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.VesNotificationListener;
@@ -113,9 +113,11 @@ public class NetconfnodeStateServiceRpcApiImpl implements NetconfnodeStateServic
PushAttributeChangeNotificationInput input) {
RpcResultBuilder<PushAttributeChangeNotificationOutput> result;
try {
- AttributeChangeNotificationBuilder attributeChangeNotificationBuilder = new AttributeChangeNotificationBuilder();
+ AttributeChangeNotificationBuilder attributeChangeNotificationBuilder =
+ new AttributeChangeNotificationBuilder();
attributeChangeNotificationBuilder.fieldsFrom(input);
- vesNotificationListenerList.forEach(item -> item.onNotification(attributeChangeNotificationBuilder.build()));
+ vesNotificationListenerList
+ .forEach(item -> item.onNotification(attributeChangeNotificationBuilder.build()));
result = RpcResultBuilder.success();
} catch (Exception e) {
result = RpcResultBuilder.failed();
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/rpc/RpcApigetStateCallback.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/rpc/RpcApigetStateCallback.java
index 1434cf41a..b33c1473d 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/rpc/RpcApigetStateCallback.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/rpc/RpcApigetStateCallback.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,7 +14,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
* ============LICENSE_END==========================================================================
- ******************************************************************************/
+ */
package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.rpc;
@@ -23,5 +23,5 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconfn
public interface RpcApigetStateCallback {
- GetStatusOutputBuilder getStatus(GetStatusInput input);
+ GetStatusOutputBuilder getStatus(GetStatusInput input);
}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestAkkaConfig.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestAkkaConfig.java
index dd317c781..a420b5e91 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestAkkaConfig.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestAkkaConfig.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START=======================================================
* ONAP : ccsdk feature sdnr wt
* ================================================================================
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- ******************************************************************************/
+ */
package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.test;
import static org.junit.Assert.fail;
@@ -108,7 +108,7 @@ public class TestAkkaConfig {
String failMessage = "failed: " + e.getMessage();
System.out.println(failMessage);
fail(failMessage);
- }
+ }
}
@Test
@@ -123,7 +123,7 @@ public class TestAkkaConfig {
System.out.println("testing clusternode config1");
System.out.println("===========================");
cfg = AkkaConfig.load(file.getAbsolutePath());
- System.out.println("succeeded: "+cfg.hashCode());
+ System.out.println("succeeded: " + cfg.hashCode());
System.out.println(cfg.toString());
System.out.println(String.format("found %d cluster nodes", cfg.getClusterConfig().getSeedNodes().size()));
for (ClusterNodeInfo n : cfg.getClusterConfig().getSeedNodes()) {
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestGeoConfig.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestGeoConfig.java
index 915c88d50..327a87d2b 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestGeoConfig.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestGeoConfig.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START=======================================================
* ONAP : ccsdk feature sdnr wt
* ================================================================================
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- ******************************************************************************/
+ */
package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.test;
import static org.junit.Assert.*;
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestNetconfNodeStateService.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestNetconfNodeStateService.java
index 5427c0339..eb07a48f1 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestNetconfNodeStateService.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestNetconfNodeStateService.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START======================================================= ONAP : ccsdk
* feature sdnr wt ================================================================================
* Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
@@ -12,7 +12,7 @@
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License. ============LICENSE_END=========================================================
- ******************************************************************************/
+ */
package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.test;
import static org.mockito.Mockito.mock;
@@ -149,8 +149,7 @@ public class TestNetconfNodeStateService {
System.out.println("Test2: Register state listener");
NetconfNodeStateListener nSL = mock(NetconfNodeStateListener.class);
- ListenerRegistration<NetconfNodeStateListener> res =
- netconfStateService.registerNetconfNodeStateListener(nSL);
+ ListenerRegistration<NetconfNodeStateListener> res = netconfStateService.registerNetconfNodeStateListener(nSL);
assertNotNull("Result should be null", res);
res.getInstance();
res.close();
@@ -163,7 +162,7 @@ public class TestNetconfNodeStateService {
NetconfNodeConnectListener nCL = mock(NetconfNodeConnectListener.class);
ListenerRegistration<NetconfNodeConnectListener> res =
- netconfStateService.registerNetconfNodeConnectListener(nCL);
+ netconfStateService.registerNetconfNodeConnectListener(nCL);
assertNotNull("Result should be null", res);
res.getInstance();
res.close();
@@ -212,7 +211,7 @@ public class TestNetconfNodeStateService {
//verify that it was called one time and nodeId is the expected
ArgumentCaptor<NetconfAccessor> varArgs = ArgumentCaptor.forClass(NetconfAccessor.class);
verify(nCL).onEnterConnected(varArgs.capture());
- System.out.println("Accessor "+varArgs.getValue().getNodeId());
+ System.out.println("Accessor " + varArgs.getValue().getNodeId());
assertEquals(nodeIdString, varArgs.getValue().getNodeId().getValue());
}
@@ -252,7 +251,7 @@ public class TestNetconfNodeStateService {
ListenableFuture<RpcResult<GetStatusOutput>> statusOutput = api.getStatus(statusInput.build());
RpcResult<GetStatusOutput> res = statusOutput.get();
GetStatusOutput output = res.getResult();
- System.out.println("Output "+output);
+ System.out.println("Output " + output);
}
@@ -269,15 +268,16 @@ public class TestNetconfNodeStateService {
FaultNotification fault = faultBuilder.build();
PushFaultNotificationInputBuilder statusInput = new PushFaultNotificationInputBuilder();
statusInput.fieldsFrom(fault);
- ListenableFuture<RpcResult<PushFaultNotificationOutput>> rpcOutput = api.pushFaultNotification(statusInput.build());
+ ListenableFuture<RpcResult<PushFaultNotificationOutput>> rpcOutput =
+ api.pushFaultNotification(statusInput.build());
RpcResult<PushFaultNotificationOutput> res = rpcOutput.get();
PushFaultNotificationOutput output = res.getResult();
//verify that it was called one time
- verify(vNL,times(1)).onNotification(fault);
+ verify(vNL, times(1)).onNotification(fault);
registration.close();
- System.out.println("Output "+output);
+ System.out.println("Output " + output);
}
@Test
@@ -293,15 +293,16 @@ public class TestNetconfNodeStateService {
AttributeChangeNotification change = changeBuilder.build();
PushAttributeChangeNotificationInputBuilder statusInput = new PushAttributeChangeNotificationInputBuilder();
statusInput.fieldsFrom(change);
- ListenableFuture<RpcResult<PushAttributeChangeNotificationOutput>> rpcOutput = api.pushAttributeChangeNotification(statusInput.build());
+ ListenableFuture<RpcResult<PushAttributeChangeNotificationOutput>> rpcOutput =
+ api.pushAttributeChangeNotification(statusInput.build());
RpcResult<PushAttributeChangeNotificationOutput> res = rpcOutput.get();
PushAttributeChangeNotificationOutput output = res.getResult();
//verify that it was called one time
- verify(vNL,times(1)).onNotification(change);
+ verify(vNL, times(1)).onNotification(change);
registration.close();
- System.out.println("Output "+output);
+ System.out.println("Output " + output);
}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/ClusterSingletonServiceProviderMock.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/ClusterSingletonServiceProviderMock.java
index 86340c052..cc502b4aa 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/ClusterSingletonServiceProviderMock.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/ClusterSingletonServiceProviderMock.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
@@ -14,7 +14,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
* ============LICENSE_END==========================================================================
- ******************************************************************************/
+ */
package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.test.mock;
@@ -24,14 +24,14 @@ import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegist
public class ClusterSingletonServiceProviderMock implements ClusterSingletonServiceProvider {
- @Override
- public void close() throws Exception {
+ @Override
+ public void close() throws Exception {
- }
+ }
- @Override
- public ClusterSingletonServiceRegistration registerClusterSingletonService(ClusterSingletonService service) {
- return null;
- }
+ @Override
+ public ClusterSingletonServiceRegistration registerClusterSingletonService(ClusterSingletonService service) {
+ return null;
+ }
}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/DataBrokerMountpointMock.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/DataBrokerMountpointMock.java
index 48401c881..ebcf5fb40 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/DataBrokerMountpointMock.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/DataBrokerMountpointMock.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START=======================================================
* ONAP : ccsdk feature sdnr wt
* ================================================================================
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- ******************************************************************************/
+ */
package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.test.mock;
import org.eclipse.jdt.annotation.NonNull;
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/DataBrokerNetconfMock.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/DataBrokerNetconfMock.java
index 90ab8608c..7db577cc8 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/DataBrokerNetconfMock.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/DataBrokerNetconfMock.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START=======================================================
* ONAP : ccsdk feature sdnr wt
* ================================================================================
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- ******************************************************************************/
+ */
package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.test.mock;
import java.util.Collection;
@@ -64,7 +64,7 @@ public class DataBrokerNetconfMock implements DataBroker {
@Override
public <T extends DataObject, L extends DataTreeChangeListener<T>> @NonNull ListenerRegistration<L> registerDataTreeChangeListener(
@NonNull DataTreeIdentifier<T> treeId, @NonNull L pListener) {
- System.out.println("Register "+pListener.getClass().getName());
+ System.out.println("Register " + pListener.getClass().getName());
if (pListener instanceof ClusteredDataTreeChangeListener) {
System.out.println("Clustered listener");
this.listenerClustered = (ClusteredDataTreeChangeListener<Node>) pListener;
@@ -80,8 +80,7 @@ public class DataBrokerNetconfMock implements DataBroker {
}
@Override
- public void close() {
- }
+ public void close() {}
};
}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/MountPointMock.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/MountPointMock.java
index e5bff451d..77d5e5e38 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/MountPointMock.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/MountPointMock.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START=======================================================
* ONAP : ccsdk feature sdnr wt sdnr-wt-devicemanager-provider
* ================================================================================
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- ******************************************************************************/
+ */
package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.test.mock;
@@ -57,12 +57,13 @@ public class MountPointMock implements MountPoint {
@Override
public <T extends BindingService> Optional<T> getService(Class<T> service) {
- System.out.println("Requested mountpoint service: "+service.getSimpleName()+" databrokerAbsent state: "+databrokerAbsent);
+ System.out.println("Requested mountpoint service: " + service.getSimpleName() + " databrokerAbsent state: "
+ + databrokerAbsent);
Optional<? extends BindingService> res;
if (service.isInstance(dataBroker)) {
System.out.println("Delivering databroker");
- res = databrokerAbsent ? Optional.empty() : Optional.of(dataBroker);
+ res = databrokerAbsent ? Optional.empty() : Optional.of(dataBroker);
} else if (service.isInstance(rpcConsumerRegistry)) {
System.out.println("Delivering RpcConsumerRegistryMock");
res = Optional.of(rpcConsumerRegistry);
@@ -76,7 +77,7 @@ public class MountPointMock implements MountPoint {
return (Optional<T>) res;
}
- public void setDatabrokerAbsent( boolean state) {
+ public void setDatabrokerAbsent(boolean state) {
this.databrokerAbsent = state;
}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/MountPointServiceMock.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/MountPointServiceMock.java
index 127019633..996549e3d 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/MountPointServiceMock.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/MountPointServiceMock.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START=======================================================
* ONAP : ccsdk feature sdnr wt
* ================================================================================
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- ******************************************************************************/
+ */
package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.test.mock;
import java.util.Optional;
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/NotificationPublishServiceMock.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/NotificationPublishServiceMock.java
index 0564c56a3..2b3e00f5c 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/NotificationPublishServiceMock.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/NotificationPublishServiceMock.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START=======================================================
* ONAP : ccsdk feature sdnr wt
* ================================================================================
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- ******************************************************************************/
+ */
package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.test.mock;
import com.google.common.util.concurrent.ListenableFuture;
@@ -32,14 +32,13 @@ public class NotificationPublishServiceMock implements NotificationPublishServic
return null;
}
- @Override
+ @Override
public ListenableFuture<?> offerNotification(Notification notification, int timeout, TimeUnit unit)
throws InterruptedException {
return null;
}
@Override
- public void putNotification(Notification notification) throws InterruptedException {
- }
+ public void putNotification(Notification notification) throws InterruptedException {}
}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/RpcConsumerRegistryMock.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/RpcConsumerRegistryMock.java
index 7e48ff2e5..8eea79abc 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/RpcConsumerRegistryMock.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/RpcConsumerRegistryMock.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START=======================================================
* ONAP : ccsdk feature sdnr wt sdnr-wt-devicemanager-provider
* ================================================================================
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- ******************************************************************************/
+ */
package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.test.mock;
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/RpcProviderRegistryMock.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/RpcProviderRegistryMock.java
index fbcb21db9..f2f6c0e68 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/RpcProviderRegistryMock.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/RpcProviderRegistryMock.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*
* ============LICENSE_START=======================================================
* ONAP : ccsdk feature sdnr wt
* ================================================================================
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- ******************************************************************************/
+ */
package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.test.mock;
import java.util.Set;