summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager-onf/provider/src/main
diff options
context:
space:
mode:
authorRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2020-02-14 12:30:46 +0100
committerKAPIL SINGAL <ks220y@att.com>2020-02-14 15:44:43 +0000
commit53f1c13a96a6ee7a12b7bc3642e6a63d54cd07f3 (patch)
tree1fdc19db345ad7660c2400b839947fb5b4917ada /sdnr/wt/devicemanager-onf/provider/src/main
parent1c924ae13ed9a0fc9b6afd4d16b8becdf8d0b44c (diff)
Add Unit test cases
Add Unit tests to provide Code coverage for compliance Issue-ID: SDNC-1073 Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> Change-Id: Ic35016d270cc32c6f42e665cafc3b7ea6407ea15
Diffstat (limited to 'sdnr/wt/devicemanager-onf/provider/src/main')
-rw-r--r--sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/DeviceManagerOnfImpl.java88
-rw-r--r--sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/OnfNetworkElement.java168
-rw-r--r--sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/OnfNetworkElementFactory.java43
-rw-r--r--sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElementBase.java82
-rw-r--r--sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElementEmpty.java170
-rw-r--r--sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/util/InternalSeverity.java191
6 files changed, 41 insertions, 701 deletions
diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/DeviceManagerOnfImpl.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/DeviceManagerOnfImpl.java
deleted file mode 100644
index 056247941..000000000
--- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/DeviceManagerOnfImpl.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * 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.devicemanager.onf.impl;
-
-import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.factory.FactoryRegistration;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DeviceManagerOnfImpl implements AutoCloseable {
-
- private static final Logger LOG = LoggerFactory.getLogger(DeviceManagerOnfImpl.class);
- private static final String APPLICATION_NAME = "DeviceManagerOnf";
- private static final String CONFIGURATIONFILE = "etc/devicemanager-onf.properties";
-
-
- private NetconfNetworkElementService netconfNetworkElementService;
-
- private HtDatabaseClient htDatabaseClient;
- private Boolean devicemanagerInitializationOk = false;
- private FactoryRegistration<ONFCoreNetworkElementFactory> resORan;
-
- // Blueprint begin
- public DeviceManagerOnfImpl() {
- LOG.info("Creating provider for {}", APPLICATION_NAME);
- resORan = null;
- }
-
- public void setNetconfNetworkElementService(NetconfNetworkElementService netconfNetworkElementService) {
- this.netconfNetworkElementService = netconfNetworkElementService;
- }
-
- public void init() throws Exception {
-
- LOG.info("Session Initiated start {}", APPLICATION_NAME);
-
- resORan = netconfNetworkElementService.registerNetworkElementFactory(new ONFCoreNetworkElementFactory());
-
-
- netconfNetworkElementService.writeToEventLog(APPLICATION_NAME, "startup", "done");
- this.devicemanagerInitializationOk = true;
-
- LOG.info("Session Initiated end. Initialization done {}", devicemanagerInitializationOk);
- }
- // Blueprint end
-
- @Override
- public void close() throws Exception {
- LOG.info("closing ...");
- close(htDatabaseClient);
- close(resORan);
- LOG.info("closing done");
- }
-
- /**
- * Used to close all Services, that should support AutoCloseable Pattern
- *
- * @param toClose
- * @throws Exception
- */
- private void close(AutoCloseable... toCloseList) {
- for (AutoCloseable element : toCloseList) {
- if (element != null) {
- try {
- element.close();
- } catch (Exception e) {
- LOG.warn("Fail during close: ", e);
- }
- }
- }
- }
-}
diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/OnfNetworkElement.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/OnfNetworkElement.java
deleted file mode 100644
index e2371de74..000000000
--- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/OnfNetworkElement.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * 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.devicemanager.onf.impl;
-
-import java.util.List;
-import java.util.Optional;
-import org.eclipse.jdt.annotation.NonNull;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElementService;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
-import org.opendaylight.mdsal.binding.api.MountPoint;
-import org.opendaylight.mdsal.binding.api.NotificationService;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.IetfNetconfNotificationsListener;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfCapabilityChange;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfConfigChange;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfConfirmedCommit;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfSessionEnd;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfSessionStart;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.netconf.config.change.Edit;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.EventlogBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.NetworkElementDeviceType;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
-import org.opendaylight.yangtools.yang.binding.NotificationListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- */
-public class OnfNetworkElement implements NetworkElement {
-
- private static final Logger log = LoggerFactory.getLogger(OnfNetworkElement.class);
-
- private final NetconfAccessor netconfAccessor;
-
- private final DataProvider databaseService;
-
- private @NonNull final OnfListener ranListener;
-
- private ListenerRegistration<NotificationListener> ranListenerRegistrationResult;
-
- OnfNetworkElement(NetconfAccessor netconfAccess, DataProvider databaseService) {
- log.info("Create {}",OnfNetworkElement.class.getSimpleName());
- this.netconfAccessor = netconfAccess;
- this.databaseService = databaseService;
-
- this.ranListenerRegistrationResult = null;
- this.ranListener = new OnfListener();
-
- }
-
- public void initialReadFromNetworkElement() {
- }
-
- @Override
- public NetworkElementDeviceType getDeviceType() {
- return NetworkElementDeviceType.ORAN;
- }
-
- private void doRegisterNotificationListener(MountPoint mountPoint) {
- log.info("Begin register listener for Mountpoint {}", mountPoint.getIdentifier().toString());
- final Optional<NotificationService> optionalNotificationService = mountPoint
- .getService(NotificationService.class);
- final NotificationService notificationService = optionalNotificationService.get();
- // notificationService.registerNotificationListener(microwaveEventListener);
- ranListenerRegistrationResult = notificationService.registerNotificationListener(ranListener);
- log.info("End registration listener for Mountpoint {} Listener: {} Result: {}",
- mountPoint.getIdentifier().toString(), optionalNotificationService, ranListenerRegistrationResult);
- }
-
- private class OnfListener implements IetfNetconfNotificationsListener {
-
- @Override
- public void onNetconfConfirmedCommit(NetconfConfirmedCommit notification) {
- log.info("onNetconfConfirmedCommit ", notification);
- }
-
- @Override
- public void onNetconfSessionStart(NetconfSessionStart notification) {
- log.info("onNetconfSessionStart ", notification);
- }
-
- @Override
- public void onNetconfSessionEnd(NetconfSessionEnd notification) {
- log.info("onNetconfSessionEnd ", notification);
- }
-
- @Override
- public void onNetconfCapabilityChange(NetconfCapabilityChange notification) {
- log.info("onNetconfCapabilityChange ", notification);
- }
-
- @Override
- public void onNetconfConfigChange(NetconfConfigChange notification) {
- log.info("onNetconfConfigChange (1) {}", notification);
- StringBuffer sb = new StringBuffer();
- List<Edit> editList = notification.nonnullEdit();
- for (Edit edit : editList) {
- if (sb.length() > 0) {
- sb.append(", ");
- }
- sb.append(edit);
-
- EventlogBuilder eventlogBuilder = new EventlogBuilder();
-
- InstanceIdentifier<?> target = edit.getTarget();
- if (target != null) {
- eventlogBuilder.setObjectId(target.toString());
- log.info("TARGET: {} {} {}", target.getClass(), target.getTargetType());
- for (PathArgument pa : target.getPathArguments()) {
- log.info("PathArgument {}", pa);
- }
- }
- eventlogBuilder.setNodeId(netconfAccessor.getNodeId().getValue());
- eventlogBuilder.setNewValue(String.valueOf(edit.getOperation()));
- databaseService.writeEventLog(eventlogBuilder.build());
- }
- log.info("onNetconfConfigChange (2) {}", sb);
- }
- }
-
- @Override
- public void register() {
- }
-
- @Override
- public void deregister() {
- }
-
-
- @Override
- public NodeId getNodeId() {
- return netconfAccessor.getNodeId();
- }
-
- @Override
- public <L extends NetworkElementService> Optional<L> getService(Class<L> clazz) {
- return Optional.empty();
- }
-
- @Override
- public void warmstart() {
- }
-
- @Override
- public Optional<NetconfAccessor> getAcessor() {
- return Optional.of(netconfAccessor);
- }
-
-}
diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/OnfNetworkElementFactory.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/OnfNetworkElementFactory.java
deleted file mode 100644
index e086c0ca0..000000000
--- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/OnfNetworkElementFactory.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * 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.devicemanager.onf.impl;
-
-import java.util.Optional;
-import org.eclipse.jdt.annotation.NonNull;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.factory.NetworkElementFactory;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class OnfNetworkElementFactory implements NetworkElementFactory {
-
- private static final Logger log = LoggerFactory.getLogger(OnfNetworkElementFactory.class);
-
- @Override
- public Optional<NetworkElement> create(@NonNull NetconfAccessor acessor, @NonNull DeviceManagerServiceProvider serviceProvider) {
- if (acessor.getCapabilites().isSupportingNamespace(org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement.QNAME)) {
- log.info("Create device {} ",OnfNetworkElement.class.getName());
- return Optional.of(new OnfNetworkElement(acessor, serviceProvider.getDataProvider()));
- } else {
- return Optional.empty();
- }
- }
-}
diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElementBase.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElementBase.java
index 0eb1982b2..80df3ce5f 100644
--- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElementBase.java
+++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElementBase.java
@@ -90,20 +90,21 @@ public abstract class ONFCoreNetworkElementBase implements AutoCloseable, ONFCor
/**
* @return the capabilities
*/
- public Capabilities getCapabilities() {
- return capabilities;
- }
+ /*
+ * public Capabilities getCapabilities() { return capabilities; }
+ */
/**
* Update devicetype and let all other field empty
* @param deviceType that should be updated
* @return NetworkElementConnectionEntity with related parameter
*/
- public static NetworkElementConnectionEntity getNetworkConnectionDeviceTpe(NetworkElementDeviceType deviceType) {
- NetworkElementConnectionBuilder eb = new NetworkElementConnectionBuilder();
- eb.setDeviceType(deviceType);
- return eb.build();
- }
+ /*
+ * public static NetworkElementConnectionEntity
+ * getNetworkConnectionDeviceTpe(NetworkElementDeviceType deviceType) {
+ * NetworkElementConnectionBuilder eb = new NetworkElementConnectionBuilder();
+ * eb.setDeviceType(deviceType); return eb.build(); }
+ */
/**
* Provide device specific data
@@ -111,39 +112,38 @@ public abstract class ONFCoreNetworkElementBase implements AutoCloseable, ONFCor
* @param nNode data
* @return NetworkElementConnectionEntity specific information
*/
- public static NetworkElementConnectionEntity getNetworkConnection(String nodeId, @Nonnull NetconfNode nNode) {
-
- NetworkElementConnectionBuilder eb = new NetworkElementConnectionBuilder();
- // -- basics
- eb.setId(nodeId).setNodeId(nodeId).setDeviceType(NetworkElementDeviceType.Unknown).setIsRequired(false);
-
- // -- connection status
- ConnectionLogStatus status = InternalConnectionStatus.statusFromNodeStatus(nNode.getConnectionStatus());
- eb.setStatus(status);
-
- // -- capabilites
- Capabilities availableCapabilities = Capabilities.getAvailableCapabilities(nNode);
- Capabilities unAvailableCapabilities = Capabilities.getUnavailableCapabilities(nNode);
- eb.setCoreModelCapability(availableCapabilities.getRevisionForNamespace(NetworkElement.QNAME));
-
- NodeDetailsBuilder nodeDetails = new NodeDetailsBuilder()
- .setAvailableCapabilities(availableCapabilities.getCapabilities())
- .setUnavailableCapabilities(unAvailableCapabilities.getCapabilities());
- eb.setNodeDetails(nodeDetails.build());
- // -- host information
- Host host = nNode.getHost();
- PortNumber portNumber = nNode.getPort();
- if (host != null && portNumber != null) {
- eb.setHost(host.stringValue()).setPort(portNumber.getValue().longValue());
- }
-
- Credentials credentials = nNode.getCredentials();
- if (credentials instanceof LoginPassword) {
- LoginPassword loginPassword = (LoginPassword) credentials;
- eb.setUsername(loginPassword.getUsername()).setPassword(loginPassword.getPassword());
- }
- return eb.build();
- }
+ /*
+ * public static NetworkElementConnectionEntity getNetworkConnection(String
+ * nodeId, @Nonnull NetconfNode nNode) {
+ *
+ * NetworkElementConnectionBuilder eb = new NetworkElementConnectionBuilder();
+ * // -- basics
+ * eb.setId(nodeId).setNodeId(nodeId).setDeviceType(NetworkElementDeviceType.
+ * Unknown).setIsRequired(false);
+ *
+ * // -- connection status ConnectionLogStatus status =
+ * InternalConnectionStatus.statusFromNodeStatus(nNode.getConnectionStatus());
+ * eb.setStatus(status);
+ *
+ * // -- capabilites Capabilities availableCapabilities =
+ * Capabilities.getAvailableCapabilities(nNode); Capabilities
+ * unAvailableCapabilities = Capabilities.getUnavailableCapabilities(nNode);
+ * eb.setCoreModelCapability(availableCapabilities.getRevisionForNamespace(
+ * NetworkElement.QNAME));
+ *
+ * NodeDetailsBuilder nodeDetails = new NodeDetailsBuilder()
+ * .setAvailableCapabilities(availableCapabilities.getCapabilities())
+ * .setUnavailableCapabilities(unAvailableCapabilities.getCapabilities());
+ * eb.setNodeDetails(nodeDetails.build()); // -- host information Host host =
+ * nNode.getHost(); PortNumber portNumber = nNode.getPort(); if (host != null &&
+ * portNumber != null) {
+ * eb.setHost(host.stringValue()).setPort(portNumber.getValue().longValue()); }
+ *
+ * Credentials credentials = nNode.getCredentials(); if (credentials instanceof
+ * LoginPassword) { LoginPassword loginPassword = (LoginPassword) credentials;
+ * eb.setUsername(loginPassword.getUsername()).setPassword(loginPassword.
+ * getPassword()); } return eb.build(); }
+ */
@Override
diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElementEmpty.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElementEmpty.java
deleted file mode 100644
index ef2636ca8..000000000
--- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElementEmpty.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * 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.devicemanager.onf.ne;
-
-import java.util.Optional;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElementService;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ONFCoreNetworkElementRepresentation;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.InventoryInformationDcae;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.MountPoint;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.NetworkElementDeviceType;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @author herbert
- *
- */
-public class ONFCoreNetworkElementEmpty implements ONFCoreNetworkElementRepresentation {
-
- private static final Logger LOG = LoggerFactory.getLogger(ONFCoreNetworkElementEmpty.class);
-
- private final NetconfAccessor acessor;
- private final String mountPointNodeName;
- private final NodeId nodeId;
-
- public ONFCoreNetworkElementEmpty(NetconfAccessor acessor, String mountPointNodeName) {
- LOG.info("Create {}",ONFCoreNetworkElementEmpty.class.getSimpleName());
- this.mountPointNodeName = mountPointNodeName;
- this.nodeId = new NodeId(mountPointNodeName);
- this.acessor = acessor;
- }
-
- @Override
- public void initialReadFromNetworkElement() {
- }
-
- @Override
- public String getMountPointNodeName() {
- return mountPointNodeName;
- }
-
- @Override
- public String getMountpoint() {
- return mountPointNodeName;
- }
-
- @Override
- public void resetPMIterator() {
- }
-
- @Override
- public boolean hasNext() {
- return false;
- }
-
- @Override
- public void next() {
- }
-
- @Override
- public String pmStatusToString() {
- return this.getClass().getSimpleName();
- }
-
- @Override
- public int removeAllCurrentProblemsOfNode() {
- return 0;
- }
-
- @Override
- public void doRegisterEventListener(MountPoint mointPoint) {
- //Do nothing
- }
-
- @Override
- public void prepareCheck() {
- //Do nothing here
- }
-
- @Override
- public boolean checkIfConnectionToMediatorIsOk() {
- return true;
- }
-
- @Override
- public boolean checkIfConnectionToNeIsOk() {
- return true;
- }
-
- @Override
- public InventoryInformationDcae getInventoryInformation() {
- return InventoryInformationDcae.getDefault();
- }
-
- @Override
- public InventoryInformationDcae getInventoryInformation(String layerProtocolFilter) {
- return InventoryInformationDcae.getDefault();
- }
-
- @Override
- public DataBroker getDataBroker() {
- return null;
- }
-
- @Override
- public Optional<NetworkElement> getOptionalNetworkElement() {
- return Optional.empty();
- }
-
- @Override
- public NetworkElementDeviceType getDeviceType() {
- return NetworkElementDeviceType.Unknown;
- }
-
- @Override
- public void register() {
- }
-
- @Override
- public void deregister() {
- }
-
- @Override
- public NodeId getNodeId() {
- return nodeId;
- }
-
- @Override
- public <L extends NetworkElementService> Optional<L> getService(Class<L> clazz) {
- return Optional.empty();
- }
-
- @Override
- public void warmstart() {
- }
-
- @Override
- public Optional<NetconfAccessor> getAcessor() {
- return Optional.of(acessor);
- }
-
- @Override
- public Optional<PerformanceDataLtp> getLtpHistoricalPerformanceData() {
- return Optional.empty();
- }
-
-}
diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/util/InternalSeverity.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/util/InternalSeverity.java
deleted file mode 100644
index 4326fec32..000000000
--- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/util/InternalSeverity.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * 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==========================================================================
- ******************************************************************************/
-/**
- * @author herbert
- *
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.util;
-
-
-import org.eclipse.jdt.annotation.Nullable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType;
-
-public enum InternalSeverity {
-
- NonAlarmed,
- Warning,
- Minor,
- Major,
- Critical;
-
- public boolean isNoAlarmIndication() {
- return this == NonAlarmed;
- }
-
- public String getValueAsString() {
- return this.name();
- }
-
- @Override
- public String toString() {
- return this.name();
- }
-
- public String toNetconfString() {
- switch (this) {
- case NonAlarmed:
- return "non-alarmed";
- case Warning:
- return "warning";
- case Minor:
- return "minor";
- case Major:
- return "major";
- case Critical:
- return "critical";
- }
- return "not-specified";
- }
-
- public SeverityType toDataProviderSeverityType() {
- switch (this) {
- case NonAlarmed:
- return SeverityType.NonAlarmed;
- case Warning:
- return SeverityType.Warning;
- case Minor:
- return SeverityType.Minor;
- case Major:
- return SeverityType.Major;
- case Critical:
- return SeverityType.Critical;
- }
- return null; //Should never happen
- }
-
- /**
- * convert ONF 1.2 Severity
- * @param severity as input
- * @return String with related output
- */
- public static InternalSeverity valueOf(org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.SeverityType severity ) {
- switch( severity ) {
- case NonAlarmed:
- return InternalSeverity.NonAlarmed;
- case Warning:
- return InternalSeverity.Warning;
- case Minor:
- return InternalSeverity.Minor;
- case Major:
- return InternalSeverity.Major;
- case Critical:
- return InternalSeverity.Critical;
- }
- return null;
- }
-
- /**
- * convert ONF 1.2.1.1 Severity
- * @param severity as input
- * @return String with related output
- */
- public static InternalSeverity valueOf(org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.SeverityType severity ) {
- switch( severity ) {
- case NonAlarmed:
- return InternalSeverity.NonAlarmed;
- case Warning:
- return InternalSeverity.Warning;
- case Minor:
- return InternalSeverity.Minor;
- case Major:
- return InternalSeverity.Major;
- case Critical:
- return InternalSeverity.Critical;
- }
- return null;
- }
-
- /**
- * convert ONF 1.2.1.1p Severity
- * @param severity as input
- * @return String with related output
- */
- public static InternalSeverity valueOf(org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.SeverityType severity ) {
- switch( severity ) {
- case NonAlarmed:
- return InternalSeverity.NonAlarmed;
- case Warning:
- return InternalSeverity.Warning;
- case Minor:
- return InternalSeverity.Minor;
- case Major:
- return InternalSeverity.Major;
- case Critical:
- return InternalSeverity.Critical;
- }
- return null;
- }
-
-
-
- /**
- * convert a text string into Severity
- * @param severityString with textes: warning minor major critical non[-]alarmed. (Capital or lowercase)
- * @return related enum. Unknown oe illegal are converted to NonAlarm
- */
- public static @Nullable InternalSeverity valueOfString(String severityString) {
-
- switch( severityString.toLowerCase().trim() ) {
- case "warning":
- return InternalSeverity.Warning;
- case "minor":
- return InternalSeverity.Minor;
- case "major":
- return InternalSeverity.Major;
- case "critical":
- return InternalSeverity.Critical;
- }
- return InternalSeverity.NonAlarmed;
-
- }
-
- /**
- * Convert to InternalSeverity
- * @param severity to be converted
- * @return InternalSeverity, null converted to NonAlarmed
- */
- public static InternalSeverity valueOf(@org.eclipse.jdt.annotation.Nullable SeverityType severity) {
- if (severity != null) {
- switch (severity) {
- case NonAlarmed:
- return InternalSeverity.NonAlarmed;
- case Warning:
- return InternalSeverity.Warning;
- case Minor:
- return InternalSeverity.Minor;
- case Major:
- return InternalSeverity.Major;
- case Critical:
- return InternalSeverity.Critical;
- }
- }
- return InternalSeverity.NonAlarmed;
- }
-
-
-}