summaryrefslogtreecommitdiffstats
path: root/sdnr/wt
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt')
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/InternalSeverity.java30
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/toggleAlarmFilter/NotificationDelayService.java9
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/HtDevicemanagerConfiguration.java8
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/DmConfig.java132
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitor.java53
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorEmptyImpl.java47
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorImpl.java28
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorProblems.java20
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java114
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/NetconfChangeListener.java31
10 files changed, 386 insertions, 86 deletions
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/InternalSeverity.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/InternalSeverity.java
index 20c3193b1..fcdb5e8ef 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/InternalSeverity.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/internalTypes/InternalSeverity.java
@@ -6,9 +6,9 @@
* =================================================================================================
* 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
@@ -21,6 +21,8 @@
*/
package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes;
+import javax.annotation.Nullable;
+
public enum InternalSeverity {
NonAlarmed,
@@ -122,4 +124,28 @@ public enum InternalSeverity {
}
return null;
}
+
+ /**
+ * convert a text string into Severity
+ * @param severityString with textes non[-]alarmed, warning minor major critical
+ * @return related enum or null
+ */
+ public static @Nullable InternalSeverity valueOfString(String severityString) {
+
+ switch( severityString.toLowerCase().trim() ) {
+ case "non-alarmed":
+ 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;
+
+ }
}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/toggleAlarmFilter/NotificationDelayService.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/toggleAlarmFilter/NotificationDelayService.java
index 47482b248..8ef302afa 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/toggleAlarmFilter/NotificationDelayService.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/toggleAlarmFilter/NotificationDelayService.java
@@ -24,7 +24,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.ToggleAlarmConf
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class NotificationDelayService<T> implements AutoCloseable {
+public class NotificationDelayService<T> implements AutoCloseable, IConfigChangedListener {
private static final Logger LOG = LoggerFactory.getLogger(NotificationDelayService.class);
private final HashMap<String, NotificationDelayFilter<T>> filters;
@@ -42,16 +42,17 @@ public class NotificationDelayService<T> implements AutoCloseable {
public NotificationDelayService(HtDevicemanagerConfiguration htconfig) {
this.filters = new HashMap<>();
- htconfig.registerConfigChangedListener(configChangedListener);
+ htconfig.registerConfigChangedListener(this);
NotificationDelayFilter.setDelay(htconfig.getToggleAlarm().getDelay());
NotificationDelayFilter.setEnabled(htconfig.getToggleAlarm().isEnabled());
}
- private final IConfigChangedListener configChangedListener = () -> {
+ @Override
+ public void onConfigChanged() {
ToggleAlarmConfig cfg = ToggleAlarmConfig.reload();
NotificationDelayFilter.setDelay(cfg.getDelay());
NotificationDelayFilter.setEnabled(cfg.isEnabled());
- };
+ }
@Override
public void close() throws Exception {
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/HtDevicemanagerConfiguration.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/HtDevicemanagerConfiguration.java
index c07bf4620..1f2dde235 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/HtDevicemanagerConfiguration.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/HtDevicemanagerConfiguration.java
@@ -23,6 +23,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.IniConfi
import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.IniConfigurationFile.ConfigurationException;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.AaiConfig;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.DcaeConfig;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.DmConfig;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.EsConfig;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.PmConfig;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.ToggleAlarmConfig;
@@ -82,7 +83,7 @@ public class HtDevicemanagerConfiguration {
public static HtDevicemanagerConfiguration getTestConfiguration() {
return getTestConfiguration(CONFIGURATIONTESTFILE,false);
}
-
+
public static HtDevicemanagerConfiguration getTestConfiguration(boolean newInstance) {
return getTestConfiguration(CONFIGURATIONTESTFILE,newInstance);
}
@@ -136,6 +137,10 @@ public class HtDevicemanagerConfiguration {
return ToggleAlarmConfig.getTa(mConfig, this.subconfigHandler);
}
+ public DmConfig getDmConfig() {
+ return DmConfig.getDmConfig(mConfig, this.subconfigHandler);
+ }
+
public ISubConfigHandler getSubconfigHandler() {
return subconfigHandler;
}
@@ -148,5 +153,6 @@ public class HtDevicemanagerConfiguration {
EsConfig.clear();
PmConfig.clear();
ToggleAlarmConfig.clear();
+ DmConfig.clear();
}
}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/DmConfig.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/DmConfig.java
new file mode 100644
index 000000000..c62a8eca6
--- /dev/null
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/config/impl/DmConfig.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * ============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.config.impl;
+
+import java.util.EnumMap;
+import java.util.Map;
+
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.IniConfigurationFile;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.IniConfigurationFile.ConfigurationException;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalSeverity;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.BaseSubConfig;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.ISubConfigHandler;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.devicemonitor.impl.DeviceMonitorProblems;
+
+/**
+ * Configuration of devicemonitor, section [devicemonitor]
+ * SeverityConnectionlossNeOAM=minor
+ * SeverityConnectionlossOAM=major
+ * SeverityConnectionlossMediator=critical
+ */
+public class DmConfig extends BaseSubConfig{
+
+ private static final String SECTION_MARKER_TA = "devicemonitor";
+ private static final String PROPERTY_KEY_PREFIX_Severity = "Severity";
+
+ private static DmConfig dmConfig = null;
+
+ private Map<DeviceMonitorProblems, InternalSeverity> severty = new EnumMap<>(DeviceMonitorProblems.class);
+
+ /*
+ * Constructor
+ */
+ private DmConfig() {
+ super();
+ }
+
+ public DmConfig(IniConfigurationFile config, ISubConfigHandler configHandler) throws ConfigurationException {
+ this(config, configHandler, true);
+ }
+
+ public DmConfig(IniConfigurationFile config, ISubConfigHandler configHandler, boolean save)
+ throws ConfigurationException {
+
+ super(config, configHandler, SECTION_MARKER_TA);
+
+ for (DeviceMonitorProblems problem : DeviceMonitorProblems.values()) {
+ severty.put(problem, readProperty(problem));
+ }
+
+ if (save) {
+ for (DeviceMonitorProblems problem : DeviceMonitorProblems.values()) {
+ configSetPropertyp(config, problem, severty.get(problem));
+ }
+ this.save();
+ }
+ }
+
+ public InternalSeverity getSeverity(DeviceMonitorProblems problem) {
+ return severty.get(problem);
+ }
+
+ public static DmConfig getDefaultConfiguration() {
+ DmConfig c = new DmConfig();
+ for (DeviceMonitorProblems problem : DeviceMonitorProblems.values()) {
+ c.severty.put(problem, InternalSeverity.Major);
+ }
+ return c;
+ }
+ public static boolean isInstantiated() {
+ return dmConfig != null;
+ }
+
+ public static DmConfig getDmConfig(IniConfigurationFile config, ISubConfigHandler configHandler) {
+ if (dmConfig == null) {
+ try {
+ dmConfig = new DmConfig(config, configHandler);
+ } catch (ConfigurationException e) {
+ dmConfig = DmConfig.getDefaultConfiguration();
+ }
+ }
+ return dmConfig;
+ }
+
+ public static DmConfig reload() {
+ if (dmConfig == null) {
+ return null;
+ }
+ DmConfig tmpConfig;
+ try {
+ tmpConfig = new DmConfig(dmConfig.getConfig(), dmConfig.getConfigHandler(), false);
+ } catch (ConfigurationException e) {
+ tmpConfig = DmConfig.getDefaultConfiguration();
+ }
+ dmConfig = tmpConfig;
+ return dmConfig;
+ }
+
+ public static void clear() {
+ dmConfig=null;
+ }
+
+ /*
+ * Private Helper functions
+ */
+ private static String getPropertyName(DeviceMonitorProblems problem) {
+ return PROPERTY_KEY_PREFIX_Severity+problem.name();
+ }
+
+ private static void configSetPropertyp(IniConfigurationFile config, DeviceMonitorProblems problem, InternalSeverity value) {
+ config.setProperty(SECTION_MARKER_TA + "."+getPropertyName(problem), value.getValueAsString());
+ }
+
+ private InternalSeverity readProperty(DeviceMonitorProblems problem) {
+ return InternalSeverity.valueOfString(getString(getPropertyName(problem), InternalSeverity.Major.getValueAsString()));
+ }
+
+}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitor.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitor.java
new file mode 100644
index 000000000..dd5ffd40b
--- /dev/null
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitor.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * ============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.devicemonitor.impl;
+
+public interface DeviceMonitor extends AutoCloseable {
+
+ /**
+ * Referesh database by raising all alarms again.
+ */
+ void refreshAlarmsInDb();
+
+ /**
+ * removeMountpointIndication deregisters a mountpoint for registration services
+ * @param mountPointNodeName to deregister
+ */
+ void removeMountpointIndication(String mountPointNodeName);
+
+ /**
+ * Notify of device state change to "disconnected"
+ * Mount point supervision
+ * @param mountPointNodeName to deregister
+ */
+ void deviceDisconnectIndication(String mountPointNodeName);
+
+ /**
+ * Notify of device state changes to "connected"
+ * @param mountPointNodeName name of mount point
+ * @param ne to monitor
+ */
+ void deviceConnectMasterIndication(String mountPointNodeName, DeviceMonitoredNe ne);
+
+ /**
+ * Notify of device state changes to "connected" for slave nodes
+ * @param mountPointNodeName name of mount point
+ */
+ void deviceConnectSlaveIndication(String mountPointNodeName);
+
+}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorEmptyImpl.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorEmptyImpl.java
new file mode 100644
index 000000000..ef2af1ae3
--- /dev/null
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorEmptyImpl.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * ============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.devicemonitor.impl;
+
+public class DeviceMonitorEmptyImpl implements DeviceMonitor {
+
+ @Override
+ public void refreshAlarmsInDb() {
+ }
+
+ @Override
+ public void removeMountpointIndication(String mountPointNodeName) {
+ }
+
+ @Override
+ public void deviceConnectMasterIndication(String mountPointNodeName, DeviceMonitoredNe ne) {
+ }
+
+ @Override
+ public void deviceDisconnectIndication(String mountPointNodeName) {
+ }
+
+ @Override
+ public void deviceConnectSlaveIndication(String mountPointNodeName) {
+ }
+
+ @Override
+ public void close() throws Exception {
+ }
+
+
+}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorImpl.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorImpl.java
index 89ee376da..fc9fb75c4 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorImpl.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorImpl.java
@@ -25,6 +25,12 @@ import java.util.Enumeration;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
+
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.toggleAlarmFilter.NotificationDelayFilter;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.HtDevicemanagerConfiguration;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.IConfigChangedListener;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.DmConfig;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.ToggleAlarmConfig;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.listener.ODLEventListener;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.slf4j.Logger;
@@ -62,7 +68,7 @@ import org.slf4j.LoggerFactory;
*/
@SuppressWarnings("deprecation")
-public class DeviceMonitorImpl implements AutoCloseable {
+public class DeviceMonitorImpl implements DeviceMonitor, IConfigChangedListener {
private static final Logger LOG = LoggerFactory.getLogger(DeviceMonitorImpl.class);
@@ -80,11 +86,16 @@ public class DeviceMonitorImpl implements AutoCloseable {
* Basic implementation of devicemonitoring
* @param odlEventListener as destination for problems
*/
- public DeviceMonitorImpl(DataBroker dataBroker, ODLEventListener odlEventListener) {
+ public DeviceMonitorImpl(DataBroker dataBroker, ODLEventListener odlEventListener, HtDevicemanagerConfiguration htconfig) {
LOG.info("Construct {}", this.getClass().getSimpleName());
this.odlEventListener = odlEventListener;
this.dataBroker = dataBroker;
+
+ htconfig.registerConfigChangedListener(this);
+ DmConfig dmConfig = htconfig.getDmConfig();
+ setDmConfig(dmConfig);
+
this.queue = new ConcurrentHashMap<>();
this.scheduler = Executors.newScheduledThreadPool(10);
}
@@ -104,6 +115,18 @@ public class DeviceMonitorImpl implements AutoCloseable {
scheduler.shutdown();
}
+ @Override
+ public void onConfigChanged() {
+ DmConfig cfg = DmConfig.reload();
+ setDmConfig(cfg);
+ }
+
+ private void setDmConfig(DmConfig dmConfig) {
+ for (DeviceMonitorProblems problem : DeviceMonitorProblems.values()) {
+ problem.setSeverity(dmConfig.getSeverity(problem));
+ }
+ }
+
/*-------------------------------------------------------------
* Start/ stop/ update service for Mountpoint
*/
@@ -160,7 +183,6 @@ public class DeviceMonitorImpl implements AutoCloseable {
DeviceMonitorTask task = queue.get(mountPointNodeName);
//Remove from here
queue.remove(mountPointNodeName);
-
//Clear all problems
task.removeMountpointIndication();
LOG.debug("Task stopped: {}", mountPointNodeName);
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorProblems.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorProblems.java
index 003c2002c..812d4dcf3 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorProblems.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorProblems.java
@@ -6,9 +6,9 @@
* =================================================================================================
* 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
@@ -23,7 +23,11 @@
*/
package org.onap.ccsdk.features.sdnr.wt.devicemanager.devicemonitor.impl;
+import javax.annotation.Nullable;
+
import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalSeverity;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public enum DeviceMonitorProblems {
@@ -43,15 +47,23 @@ public enum DeviceMonitorProblems {
*/
connectionLossNeOAM(InternalSeverity.Major);
+ private static final Logger LOG = LoggerFactory.getLogger(DeviceMonitorProblems.class);
InternalSeverity severity;
- DeviceMonitorProblems(InternalSeverity severity) {
- this.severity = severity;
+ DeviceMonitorProblems(@Nullable InternalSeverity severity) {
+ if (severity != null) {
+ this.severity = severity;
+ }
}
InternalSeverity getSeverity() {
return severity;
}
+ public void setSeverity(InternalSeverity severity) {
+ LOG.info("Change severity for {} from {} to {}", name(), this.severity, severity);
+ this.severity=severity;
+ }
+
}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java
index 97595ddac..6a693b735 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java
@@ -35,6 +35,8 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.EsConfig;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.GeoConfig;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.PmConfig;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl.DcaeProviderClient;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.devicemonitor.impl.DeviceMonitor;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.devicemonitor.impl.DeviceMonitorEmptyImpl;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.devicemonitor.impl.DeviceMonitorImpl;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.service.HtDatabaseEventsService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.listener.NetconfChangeListener;
@@ -61,6 +63,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification.
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.StreamNameType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeConnectionStatus.ConnectionStatus;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.ClusteredConnectionStatus;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.network.topology.topology.topology.types.TopologyNetconf;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
@@ -108,8 +111,8 @@ public class DeviceManagerImpl implements DeviceManagerService, AutoCloseable, R
private @Nullable PerformanceManagerImpl performanceManager = null;
private ProviderClient dcaeProviderClient;
private ProviderClient aotsMProvider;
- private @Nullable AaiProviderClient aaiProviderClient;
- private DeviceMonitorImpl deviceMonitor;
+ private @Nullable AaiProviderClient aaiProviderClient = null;
+ private @Nullable DeviceMonitor deviceMonitor = new DeviceMonitorEmptyImpl();
private IndexUpdateService updateService;
private IndexConfigService configService;
private IndexMwtnService mwtnService;
@@ -219,9 +222,6 @@ public class DeviceManagerImpl implements DeviceManagerService, AutoCloseable, R
LOG.warn("No configuration available. Don't start event manager");
} else {
this.databaseClientEvents = new HtDatabaseEventsService(htDatabase);
- //Make sure to start for one cluster node only
- if (akkaConfig == null || akkaConfig.isClusterAndFirstNode() || akkaConfig.isSingleNode()) {
- }
String myDbKeyNameExtended = MYDBKEYNAMEBASE + "-" + dbConfig.getCluster();
@@ -256,7 +256,7 @@ public class DeviceManagerImpl implements DeviceManagerService, AutoCloseable, R
// DeviceMonitor has to be available before netconfSubscriptionManager is
// configured
LOG.debug("start DeviceMonitor Service");
- this.deviceMonitor = new DeviceMonitorImpl(dataBroker, odlEventListener);
+ this.deviceMonitor = new DeviceMonitorImpl(dataBroker, odlEventListener, config);
// netconfSubscriptionManager should be the last one because this is a callback
// service
@@ -340,7 +340,7 @@ public class DeviceManagerImpl implements DeviceManagerService, AutoCloseable, R
return;
}
- if (!isMaster(nNode)) {
+ if (!isNetconfNodeMaster(nNode)) {
// Change Devicemonitor-status to connected ... for non master mountpoints.
deviceMonitor.deviceConnectSlaveIndication(mountPointNodeName);
return;
@@ -398,9 +398,8 @@ public class DeviceManagerImpl implements DeviceManagerService, AutoCloseable, R
ne.initialReadFromNetworkElement();
ne.initSynchronizationExtension();
- // Setup Service that monitors registration/ deregistration of session
- ConnectionStatus csts = nNode.getConnectionStatus();
- sendCreateOrUpdateNotification(mountPointNodeName, action, csts);
+
+ sendUpdateNotification(mountPointNodeName, nNode.getConnectionStatus());
if (aaiProviderClient != null) {
aaiProviderClient.onDeviceRegistered(mountPointNodeName);
@@ -426,15 +425,14 @@ public class DeviceManagerImpl implements DeviceManagerService, AutoCloseable, R
public void enterNonConnectedState(Action action, NodeId nNodeId, NetconfNode nNode) {
String mountPointNodeName = nNodeId.getValue();
ConnectionStatus csts = nNode.getConnectionStatus();
-
- sendCreateOrUpdateNotification(mountPointNodeName, action, csts);
+ if (isNetconfNodeMaster(nNode)) {
+ sendUpdateNotification(mountPointNodeName, csts);
+ }
// Handling if mountpoint exist. connected -> connecting/UnableToConnect
stopListenerOnNodeForConnectedState(mountPointNodeName);
- if (deviceMonitor != null) {
- deviceMonitor.deviceDisconnectIndication(mountPointNodeName);
- }
+ deviceMonitor.deviceDisconnectIndication(mountPointNodeName);
}
@@ -473,12 +471,10 @@ public class DeviceManagerImpl implements DeviceManagerService, AutoCloseable, R
}
}
- private void sendCreateOrUpdateNotification(String mountPointNodeName, Action action, ConnectionStatus csts) {
- LOG.info("enter Non ConnectedState for device :: Name : {} Action {} ConnectionStatus {}", mountPointNodeName, action, csts);
- if (action == Action.CREATE) {
- odlEventListener.registration(mountPointNodeName);
- } else {
- odlEventListener.updateRegistration(mountPointNodeName, ConnectionStatus.class.getSimpleName(), csts != null ? csts.getName() : "null");
+ private void sendUpdateNotification(String mountPointNodeName, ConnectionStatus csts) {
+ LOG.info("enter Non ConnectedState for device :: Name : {} ConnectionStatus {}", mountPointNodeName, csts);
+ if (odlEventListener != null) {
+ odlEventListener.updateRegistration(mountPointNodeName, ConnectionStatus.class.getSimpleName(), csts != null ? csts.getName() : "null");
}
}
@@ -486,32 +482,44 @@ public class DeviceManagerImpl implements DeviceManagerService, AutoCloseable, R
* Handle netconf/mountpoint changes
*/
@Override
- public void netconfChangeHandler(Action action, @Nullable ConnectionStatus csts, NodeId nodeId, NetconfNode nnode) {
- switch (action) {
- case REMOVE:
- removeMountpointState(nodeId); // Stop Monitor
- //deviceManagerService.enterNonConnectedState(nodeId, nnode); // Remove Mountpoint handler
- break;
-
- case UPDATE:
- case CREATE:
- if (csts != null) {
- switch (csts) {
- case Connected: {
- startListenerOnNodeForConnectedState(action, nodeId, nnode);
- break;
- }
- case UnableToConnect:
- case Connecting: {
- enterNonConnectedState(action, nodeId, nnode);
- break;
- }
- }
- } else {
- LOG.debug("NETCONF Node handled with null status for action", action);
- }
- break;
- }
+ public void netconfChangeHandler(Action action, @Nullable ConnectionStatus csts, NodeId nodeId, NetconfNode nNode) {
+
+ ClusteredConnectionStatus ccsts = nNode.getClusteredConnectionStatus();
+ String nodeIdString = nodeId.getValue();
+ if (action == Action.CREATE) {
+ if (odlEventListener != null) {
+ odlEventListener.registration(nodeIdString);
+ }
+ }
+ boolean isCluster = akkaConfig == null && akkaConfig.isCluster();
+ if (isCluster && ccsts == null) {
+ LOG.debug("NETCONF Node {} {} does not provide cluster status. Stop execution.", nodeIdString, action);
+ } else {
+ switch (action) {
+ case REMOVE:
+ removeMountpointState(nodeId); // Stop Monitor
+ break;
+
+ case UPDATE:
+ case CREATE:
+ if (csts != null) {
+ switch (csts) {
+ case Connected: {
+ startListenerOnNodeForConnectedState(action, nodeId, nNode);
+ break;
+ }
+ case UnableToConnect:
+ case Connecting: {
+ enterNonConnectedState(action, nodeId, nNode);
+ break;
+ }
+ }
+ } else {
+ LOG.debug("NETCONF Node handled with null status for action", action);
+ }
+ break;
+ }
+ }
}
/*-------------------------------------------------------------------------------------------
@@ -590,9 +598,7 @@ public class DeviceManagerImpl implements DeviceManagerService, AutoCloseable, R
}
// Force a sync
- if (this.deviceMonitor != null) {
- this.deviceMonitor.refreshAlarmsInDb();
- }
+ this.deviceMonitor.refreshAlarmsInDb();
threadDoClearCurrentFaultByNodename = new Thread(() -> {
refreshCounter++;
@@ -697,17 +703,11 @@ public class DeviceManagerImpl implements DeviceManagerService, AutoCloseable, R
return this.akkaConfig == null ? "" : this.akkaConfig.getClusterConfig().getClusterSeedNodeName("abc");
}
- private boolean isMaster(NetconfNode nnode) {
+ private boolean isNetconfNodeMaster(NetconfNode nnode) {
if (isInClusterMode()) {
LOG.debug("check if me is responsible for node");
String masterNodeName = nnode.getClusteredConnectionStatus() == null ? "null"
: nnode.getClusteredConnectionStatus().getNetconfMasterNode();
- /*
- * List<NodeStatus> clusterNodeStatusList=nnode.getClusteredConnectionStatus()==null?null:nnode.
- * getClusteredConnectionStatus().getNodeStatus(); if(clusterNodeStatusList!=null) { for(NodeStatus
- * s: clusterNodeStatusList) LOG.debug("node "+s.getNode()+
- * " with status "+(s.getStatus()==null?"null":s.getStatus().getName())); }
- */
String myNodeName = getClusterNetconfNodeName();
LOG.debug("sdnMasterNode=" + masterNodeName + " and sdnMyNode=" + myNodeName);
if (!masterNodeName.equals(myNodeName)) {
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/NetconfChangeListener.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/NetconfChangeListener.java
index a521bb94c..80aac1ac4 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/NetconfChangeListener.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/listener/NetconfChangeListener.java
@@ -29,6 +29,7 @@ import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeConnectionStatus.ConnectionStatus;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.ClusteredConnectionStatus;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.network.topology.topology.topology.types.TopologyNetconf;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
@@ -145,24 +146,24 @@ public class NetconfChangeListener implements ClusteredDataTreeChangeListener<No
}
if (node == null || nnode == null || nodeId == null || nodeKey == null) {
- LOG.warn("Unexpected node {}, netconf node {} or key {} or id {}", node, nnode, nodeKey, nodeId);
+ LOG.warn("Unexpected node {}, netconf node {} or key {} or id {}", node, nnode, nodeKey, nodeId);
} else {
-
- String nodeIdString = nodeId.getValue();
- ConnectionStatus csts = nnode.getConnectionStatus();
- LOG.debug("NETCONF Node processing with id {} action {} status {} cluster status {}", nodeIdString,
- action, csts, nnode.getClusteredConnectionStatus());
-
- // Do not forward any controller related events to devicemanager
- if (nodeIdString.equals(CONTROLLER)) {
- LOG.debug("Stop processing for [{}]", nodeIdString);
- } else {
- // Action forwarded to devicehandler
- deviceManagerService.netconfChangeHandler(action, csts, nodeId, nnode);
- }
+ String nodeIdString = nodeId.getValue();
+ // Do not forward any controller related events to devicemanager
+ if (nodeIdString.equals(CONTROLLER)) {
+ LOG.debug("Stop processing for [{}]", nodeIdString);
+ } else {
+
+ ClusteredConnectionStatus ccsts = nnode.getClusteredConnectionStatus();
+ ConnectionStatus csts = nnode.getConnectionStatus();
+ LOG.debug("NETCONF Node processing with id {} action {} status {} cluster status {}", nodeIdString,
+ action, csts, ccsts);
+ // Action forwarded to devicehandler
+ deviceManagerService.netconfChangeHandler(action, csts, nodeId, nnode);
+ }
}
} catch (NullPointerException e) {
- LOG.warn("Unexpected null .. stop processing.", e);
+ LOG.warn("Unexpected null .. stop processing.", e);
}
}