diff options
author | KAPIL SINGAL <ks220y@att.com> | 2020-07-10 17:17:51 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-07-10 17:17:51 +0000 |
commit | a83f54d267caddc33e97bb534c09b950638fbb38 (patch) | |
tree | 7fc56880393295a59c3c7746ccfa3e8c44fc0cde /sdnr | |
parent | 06332d2a54f0d83c1929142aab98753385cec49e (diff) | |
parent | 49ae7927cb3137ed8ae645278082d03c83ffd940 (diff) |
Merge "Reformat sdnr netconfnode-state-service to ONAP code style"
Diffstat (limited to 'sdnr')
29 files changed, 333 insertions, 289 deletions
diff --git a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/Capabilities.java b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/Capabilities.java index ba80d305f..50176f4cf 100644 --- a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/Capabilities.java +++ b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/Capabilities.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========================================================================== - ******************************************************************************/ + */ /** * Convert capabilities of netconfnode into internal format. Boron and Carbon are providing * different versions @@ -40,8 +40,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Wrapper class for capabilites for Boron and later releases. Uses generics because yang model was - * changed from Boron to later version. Interface class: + * Wrapper class for capabilites for Boron and later releases. Uses generics because yang model was changed from Boron + * to later version. Interface class: * org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.available.capabilities.AvailableCapability */ public class Capabilities { @@ -61,7 +61,7 @@ public class Capabilities { if (nnode != null) { AvailableCapabilities availableCapabilites = nnode.getAvailableCapabilities(); if (availableCapabilites != null) { - capabilities.constructor(availableCapabilites.getAvailableCapability()); + capabilities.constructor(availableCapabilites.getAvailableCapability()); } else { LOG.debug("empty capabilites"); } @@ -78,7 +78,7 @@ public class Capabilities { if (nnode != null) { UnavailableCapabilities availableCapabilites = nnode.getUnavailableCapabilities(); if (availableCapabilites != null) { - capabilities.constructor(availableCapabilites.getUnavailableCapability()); + capabilities.constructor(availableCapabilites.getUnavailableCapability()); } else { LOG.debug("empty capabilites"); } @@ -102,7 +102,7 @@ public class Capabilities { Method methodGetCapability; for (Object capability : pcapabilities) { - if (capability instanceof String) { // ODL Boron specific + if (capability instanceof String) { // ODL Boron specific this.capabilities.add((String) capability); } else { // Carbon specific part .. handled via generics try { @@ -122,6 +122,7 @@ public class Capabilities { /** * Get Capabilites + * * @return List<String> with capabilites */ public List<String> getCapabilities() { @@ -130,6 +131,7 @@ public class Capabilities { /** * Verify if the namespace is supported + * * @param qCapability from model * @return true if namespace is supported */ @@ -146,7 +148,7 @@ public class Capabilities { * * @param qCapability capability from the model * @return true if supporting the model AND revision<br> - * false if revision not available or both not found. + * false if revision not available or both not found. */ public boolean isSupportingNamespaceAndRevision(QName qCapability) { @@ -176,6 +178,7 @@ public class Capabilities { /** * Provide revision as String from QName, considering older formats. + * * @param qCapability that specifies the revision * @return String with revisiondate or null */ @@ -204,12 +207,13 @@ public class Capabilities { /** * Get revision of first entry of related capability + * * @param qCapability that specifies the namespace * @return String with date or */ public String getRevisionForNamespace(QName qCapability) { String namespace = qCapability.getNamespace().toString(); - for (String capability : capabilities) { + for (String capability : capabilities) { if (capability.contains(namespace)) { return QName.create(capability).getRevision().get().toString(); } diff --git a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfAccessor.java b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfAccessor.java index 3ca851184..1161681e6 100644 --- a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfAccessor.java +++ b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfAccessor.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; import com.google.common.util.concurrent.ListenableFuture; @@ -29,7 +29,7 @@ import org.opendaylight.yangtools.yang.binding.NotificationListener; import org.opendaylight.yangtools.yang.common.RpcResult; /** - * Interface handling netconf connection. + * Interface handling netconf connection. */ public interface NetconfAccessor { @@ -69,8 +69,8 @@ public interface NetconfAccessor { /** * Register netconf notification listener for related mountpoint * - * @param <T> specific child class of NotificationListener - * @param listener listener to be called + * @param <T> specific child class of NotificationListener + * @param listener listener to be called * @return handler to manager registration */ <T extends NotificationListener> ListenerRegistration<NotificationListener> doRegisterNotificationListener( @@ -78,6 +78,7 @@ public interface NetconfAccessor { /** * Register notifications stream for the connection. + * * @param streamName that should be "NETCONF" as default. * @return progress indication */ diff --git a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfNodeConnectListener.java b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfNodeConnectListener.java index cebed4c8a..e29bb79e9 100644 --- a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfNodeConnectListener.java +++ b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfNodeConnectListener.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; @@ -25,28 +25,28 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev15 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; /** - * Indicate if device is connected or not. - * A NetconfNode (Mountpoint) is providing the status. - * If this is Master and connected, this function is calles. + * Indicate if device is connected or not. A NetconfNode (Mountpoint) is providing the status. If this is Master and + * connected, this function is calles. */ public interface NetconfNodeConnectListener extends EventListener, AutoCloseable { /** * Called if device state changes to "connected" for a netconf master node. + * * @param acessor containing <br> - * - nNodeId name of mount point<br> - * - netconfNode with related information<br> - * - mountPoint of the node<br> - * -netconfNodeDataBroker to access connected netconf device + * - nNodeId name of mount point<br> + * - netconfNode with related information<br> + * - mountPoint of the node<br> + * -netconfNodeDataBroker to access connected netconf device */ - public void onEnterConnected(@NonNull NetconfAccessor acessor ); + public void onEnterConnected(@NonNull NetconfAccessor acessor); + /** - * Notify of device state change to "not connected" mount point supervision for - * master mountpoint HINT: This callback could be called multiple times also the - * onEnterConnected state was not called. + * Notify of device state change to "not connected" mount point supervision for master mountpoint HINT: This + * callback could be called multiple times also the onEnterConnected state was not called. * - * @param nNodeId name of mount point + * @param nNodeId name of mount point * @param optionalNetconfNode with new status or if removed not present */ public void onLeaveConnected(@NonNull NodeId nNodeId, @NonNull Optional<NetconfNode> optionalNetconfNode); diff --git a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfNodeStateListener.java b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfNodeStateListener.java index 253af0598..fdbcf9595 100644 --- a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfNodeStateListener.java +++ b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfNodeStateListener.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; @@ -24,30 +24,32 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev15 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; /** - * Indicate all state changes of NetconfNode (Mountpoint). Cleans up and - * summarizes the + * Indicate all state changes of NetconfNode (Mountpoint). Cleans up and summarizes the */ public interface NetconfNodeStateListener extends EventListener { - /** - * New NetconfNode has been created - * @param nNodeId of Node - * @param netconfNode object - */ - - void onCreated(NodeId nNodeId, NetconfNode netconfNode); - - /** - * New NetconfNode has been created - * @param nNodeId of node - * @param netconfNode object after change - */ - void onStateChange(NodeId nNodeId, NetconfNode netconfNode); - - /** - * NetconfNode has been removed - * @param nNodeId of related node - */ - void onRemoved(NodeId nNodeId); + /** + * New NetconfNode has been created + * + * @param nNodeId of Node + * @param netconfNode object + */ + + void onCreated(NodeId nNodeId, NetconfNode netconfNode); + + /** + * New NetconfNode has been created + * + * @param nNodeId of node + * @param netconfNode object after change + */ + void onStateChange(NodeId nNodeId, NetconfNode netconfNode); + + /** + * NetconfNode has been removed + * + * @param nNodeId of related node + */ + void onRemoved(NodeId nNodeId); } diff --git a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfNodeStateService.java b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfNodeStateService.java index 0105c36e8..4e82b3d25 100644 --- a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfNodeStateService.java +++ b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfNodeStateService.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; @@ -26,23 +26,32 @@ public interface NetconfNodeStateService extends Registration { /** * Register for indication that Master NetconNode is entering or leaving Connected state. + * * @param netconfNodeConnectListener * @return managing object for listener */ - @NonNull <L extends NetconfNodeConnectListener> ListenerRegistration<L> registerNetconfNodeConnectListener(@NonNull L netconfNodeConnectListener); + @NonNull + <L extends NetconfNodeConnectListener> ListenerRegistration<L> registerNetconfNodeConnectListener( + @NonNull L netconfNodeConnectListener); /** * Register for all NetconfNode specific state changes + * * @param netconfNodeStateListener * @return managing object for listener */ - @NonNull <L extends NetconfNodeStateListener> ListenerRegistration<L> registerNetconfNodeStateListener(@NonNull L netconfNodeStateListener); + @NonNull + <L extends NetconfNodeStateListener> ListenerRegistration<L> registerNetconfNodeStateListener( + @NonNull L netconfNodeStateListener); /** * Register for Ves/DmaaP provided messages + * * @param netconfNodeStateListener * @return managing object for listener */ - @NonNull <L extends VesNotificationListener> ListenerRegistration<L> registerVesNotifications(@NonNull L netconfNodeStateListener); + @NonNull + <L extends VesNotificationListener> ListenerRegistration<L> registerVesNotifications( + @NonNull L netconfNodeStateListener); } diff --git a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/TransactionUtils.java b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/TransactionUtils.java index da8da5c7f..752e3c6b9 100644 --- a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/TransactionUtils.java +++ b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/TransactionUtils.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; import java.util.concurrent.atomic.AtomicBoolean; @@ -31,32 +31,32 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; */ public interface TransactionUtils { - /** - * Deliver the data back or null. Warning - * - * @param <T> SubType of the DataObject to be handled - * @param dataBroker for accessing data - * @param dataStoreType to address datastore - * @param iid id to access data - * @return null or object - */ - @Nullable - <T extends DataObject> T readData(DataBroker dataBroker, LogicalDatastoreType dataStoreType, - InstanceIdentifier<T> iid); + /** + * Deliver the data back or null. Warning + * + * @param <T> SubType of the DataObject to be handled + * @param dataBroker for accessing data + * @param dataStoreType to address datastore + * @param iid id to access data + * @return null or object + */ + @Nullable + <T extends DataObject> T readData(DataBroker dataBroker, LogicalDatastoreType dataStoreType, + InstanceIdentifier<T> iid); - /** - * Deliver the data back or null - * - * @param <T> SubType of the DataObject to be handled - * @param dataBroker for accessing data - * @param dataStoreType to address datastore - * @param iid id to access data - * @param noErrorIndication (Output) true if data could be read and are available and is not null - * @param statusIndicator (Output) String with status indications during the read. - * @return null or object - */ - @Nullable - <T extends DataObject> T readDataOptionalWithStatus(DataBroker dataBroker, LogicalDatastoreType dataStoreType, - InstanceIdentifier<T> iid, AtomicBoolean noErrorIndication, AtomicReference<String> statusIndicator); + /** + * Deliver the data back or null + * + * @param <T> SubType of the DataObject to be handled + * @param dataBroker for accessing data + * @param dataStoreType to address datastore + * @param iid id to access data + * @param noErrorIndication (Output) true if data could be read and are available and is not null + * @param statusIndicator (Output) String with status indications during the read. + * @return null or object + */ + @Nullable + <T extends DataObject> T readDataOptionalWithStatus(DataBroker dataBroker, LogicalDatastoreType dataStoreType, + InstanceIdentifier<T> iid, AtomicBoolean noErrorIndication, AtomicReference<String> statusIndicator); -}
\ No newline at end of file +} diff --git a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/VesNotificationListener.java b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/VesNotificationListener.java index e7d2481b8..8be6b85cc 100644 --- a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/VesNotificationListener.java +++ b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/VesNotificationListener.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; @@ -23,21 +23,22 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconfn import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconfnode.state.rev191011.FaultNotification; /** - * Indicate if device is connected or not. - * A NetconfNode (Mountpoint) is providing the status. - * If this is Master and connected, this function is calles. + * Indicate if device is connected or not. A NetconfNode (Mountpoint) is providing the status. If this is Master and + * connected, this function is calles. */ public interface VesNotificationListener extends EventListener, AutoCloseable { /** * Called in case of fault notification + * * @param faultNotification to handle */ public void onNotification(FaultNotification faultNotification); /** * Called in case of attributeChange notification + * * @param attributeChangeNotification to handle */ public void onNotification(AttributeChangeNotification attributeChangeNotification); 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; |