aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider
diff options
context:
space:
mode:
authorRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2023-10-20 14:30:41 +0530
committerRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2023-10-20 14:31:01 +0530
commitea5ba02bdfd1ed6e16683b01f1f499cb2473e37e (patch)
treea12785119b185c6ec3777ad7826dc4c27f0c26ef /sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider
parent70cc4c4295376e4af9cb9009a6ee5ddc389d61d9 (diff)
Support multiple YANG revisions
Provide o-ran-supervision messages to VES collector Issue-ID: CCSDK-3948 Change-Id: I16cb880414dde00a48fa59d8b90251beedae2c0e Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider')
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/config/ORanDMConfig.java83
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/dataprovider/ORanDOMToInternalDataModel.java (renamed from sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMToInternalDataModel.java)83
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/DeviceManagerORanImpl.java9
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMNetworkElement.java121
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanNetworkElementFactory.java14
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanDOMChangeNotificationListener.java (renamed from sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMChangeNotificationListener.java)7
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanDOMFaultNotificationListener.java (renamed from sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMFaultNotificationListener.java)21
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanDOMNotifToVESEventAssembly.java (renamed from sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMNotifToVESEventAssembly.java)2
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanDOMNotificationToXPath.java (renamed from sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/DOMNotificationToXPath.java)6
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanDOMSupervisionNotificationListener.java105
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanNotificationObserver.java31
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanNotificationObserverImpl.java43
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanNotificationReceivedService.java33
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/rpc/ORanSupervisionRPCImpl.java82
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/util/ORanDMDOMUtility.java (renamed from sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDMDOMUtility.java)8
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/util/ORanDeviceManagerQNames.java (renamed from sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDeviceManagerQNames.java)31
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/vesmapper/ORanDOMFaultToVESFaultMapper.java (renamed from sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMFaultToVESFaultMapper.java)19
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/vesmapper/ORanDOMSupervisionNotifToVESMapper.java206
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/vesmapper/ORanRegistrationToVESpnfRegistrationMapper.java (renamed from sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanRegistrationToVESpnfRegistrationMapper.java)4
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/yangspecs/ORANFM.java113
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/yangspecs/OnapSystem.java127
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/yangspecs/YangModule.java51
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMFaultNotificationListener.java36
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMNetworkElement.java38
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMNotification.java3
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMToInternalDataModel.java91
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanNetworkElementFactory.java61
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanRegistrationToVESpnfRegistration.java5
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/resources/o-ran-fm@2022-08-15.yang153
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/resources/oran-fm-active-alarm.xml25
30 files changed, 1429 insertions, 182 deletions
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/config/ORanDMConfig.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/config/ORanDMConfig.java
new file mode 100644
index 000000000..11a68e5fa
--- /dev/null
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/config/ORanDMConfig.java
@@ -0,0 +1,83 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk features
+ * ================================================================================
+ * Copyright (C) 2023 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.oran.config;
+
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
+
+public class ORanDMConfig implements Configuration {
+
+ private static final String SECTION_MARKER_ORAN_SUPERVISION = "ORAN-SUPERVISION";
+ private static final String PROPERTY_KEY_SUPERVISION_NOTIFICATION_INTERVAL = "supervision-notification-interval";
+ private static final String PROPERTY_KEY_GUARD_TIMER_OVERHEAD = "guard-timer-overhead";
+
+ private static final String DEFAULT_SUPERVISION_NOTIFICATION_INTERVAL = "${O_RU_SUPERVISION_NOTIFICATION_INTERVAL}";
+ private static final String DEFAULT_GUARD_TIMER_OVERHEAD = "${O_RU_GUARD_TIMER_OVERHEAD}";
+
+ private static final int DEFAULT_SUPERVISION_NOTIFICATION_INTERVAL_VAL = 60;
+ private static final int DEFAULT_GUARD_TIMER_OVERHEAD_VAL = 10;
+
+ private ConfigurationFileRepresentation configuration;
+
+ public ORanDMConfig(ConfigurationFileRepresentation configuration) {
+ this.configuration = configuration;
+ this.configuration.addSection(SECTION_MARKER_ORAN_SUPERVISION);
+ defaults();
+ }
+
+ @Override
+ public String getSectionName() {
+ return SECTION_MARKER_ORAN_SUPERVISION;
+ }
+
+ @Override
+ public void defaults() {
+ configuration.setPropertyIfNotAvailable(this.getSectionName(), PROPERTY_KEY_SUPERVISION_NOTIFICATION_INTERVAL,
+ DEFAULT_SUPERVISION_NOTIFICATION_INTERVAL);
+ configuration.setPropertyIfNotAvailable(this.getSectionName(), PROPERTY_KEY_GUARD_TIMER_OVERHEAD,
+ DEFAULT_GUARD_TIMER_OVERHEAD);
+ }
+
+ public int getNotificationInterval() {
+ String v = this.configuration.getProperty(SECTION_MARKER_ORAN_SUPERVISION,
+ PROPERTY_KEY_SUPERVISION_NOTIFICATION_INTERVAL);
+ return (v == null || v.equals("null") || v.isEmpty() || !isNumeric(v))
+ ? DEFAULT_SUPERVISION_NOTIFICATION_INTERVAL_VAL
+ : Integer.parseInt(v);
+ }
+
+ public int getWatchdogTimer() {
+ String v = this.configuration.getProperty(SECTION_MARKER_ORAN_SUPERVISION, PROPERTY_KEY_GUARD_TIMER_OVERHEAD);
+ return (v == null || v.equals("null") || v.isEmpty() || !isNumeric(v)) ? DEFAULT_GUARD_TIMER_OVERHEAD_VAL
+ : Integer.parseInt(v);
+ }
+
+ private boolean isNumeric(String v) {
+ try {
+ int i = Integer.parseInt(v);
+ } catch (NumberFormatException nfe) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMToInternalDataModel.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/dataprovider/ORanDOMToInternalDataModel.java
index 25a54f013..4b55f1681 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMToInternalDataModel.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/dataprovider/ORanDOMToInternalDataModel.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*
*/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom;
+package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.dataprovider;
import java.time.Instant;
import java.util.ArrayList;
@@ -28,9 +28,16 @@ import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.NetconfTimeStamp;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.util.ORanDMDOMUtility;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.util.ORanDeviceManagerQNames;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.yangspecs.ORANFM;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.yangspecs.OnapSystem;
import org.opendaylight.mdsal.dom.api.DOMEvent;
import org.opendaylight.mdsal.dom.api.DOMNotification;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
@@ -52,6 +59,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -195,12 +203,12 @@ public class ORanDOMToInternalDataModel {
* @param sys
* @return
*/
- public static Optional<Guicutthrough> getGuicutthrough(@Nullable NormalizedNode sys) {
- AugmentationNode onapSys = (AugmentationNode) sys;
- if (onapSys != null) {
- String name = ORanDMDOMUtility.getLeafValue(onapSys, ORanDeviceManagerQNames.ONAP_SYSTEM_NAME);
+ public static Optional<Guicutthrough> getGuicutthrough(@Nullable AugmentationNode onapSysAugData, @NonNull OnapSystem onapSys) {
+
+ if (onapSysAugData != null) {
+ String name = ORanDMDOMUtility.getLeafValue(onapSysAugData, onapSys.getName());
@Nullable
- Uri uri = new Uri(ORanDMDOMUtility.getLeafValue(onapSys, ORanDeviceManagerQNames.ONAP_SYSTEM_WEB_UI));
+ Uri uri = new Uri(ORanDMDOMUtility.getLeafValue(onapSysAugData, onapSys.getWebUi()));
if (uri.getValue() != null) {
GuicutthroughBuilder gcBuilder = new GuicutthroughBuilder();
if (name != null) {
@@ -219,27 +227,58 @@ public class ORanDOMToInternalDataModel {
* Convert fault notification into data-provider FaultLogEntity
*
* @param notification with O-RAN notification
+ * @param oranfm
* @param nodeId of node to handle
* @param counter to be integrated into data
* @return FaultlogEntity with data
*/
- public static FaultlogEntity getFaultLog(DOMNotification notification, NodeId nodeId, Integer counter) {
+ public static FaultlogEntity getFaultLog(DOMNotification notification, @NonNull ORANFM oranfm, NodeId nodeId, Integer counter) {
ContainerNode cn = notification.getBody();
FaultlogBuilder faultAlarm = new FaultlogBuilder();
faultAlarm.setNodeId(nodeId.getValue());
- faultAlarm.setObjectId(ORanDMDOMUtility.getLeafValue(cn, ORanDeviceManagerQNames.ORAN_FM_FAULT_SOURCE));
- faultAlarm.setProblem(ORanDMDOMUtility.getLeafValue(cn, ORanDeviceManagerQNames.ORAN_FM_FAULT_TEXT));
+ faultAlarm.setObjectId(ORanDMDOMUtility.getLeafValue(cn, oranfm.getFaultSourceQName()));
+ faultAlarm.setProblem(ORanDMDOMUtility.getLeafValue(cn, oranfm.getFaultTextQName()));
faultAlarm.setSeverity(getSeverityType(
- ORanDMDOMUtility.getLeafValue(cn, ORanDeviceManagerQNames.ORAN_FM_FAULT_SEVERITY),
- ORanDMDOMUtility.getLeafValue(cn, ORanDeviceManagerQNames.ORAN_FM_FAULT_IS_CLEARED).equals("true")));
+ ORanDMDOMUtility.getLeafValue(cn, oranfm.getFaultSeverityQName()),
+ ORanDMDOMUtility.getLeafValue(cn, oranfm.getFaultIsClearedQName()).equals("true")));
faultAlarm.setCounter(counter);
- faultAlarm.setId(ORanDMDOMUtility.getLeafValue(cn, ORanDeviceManagerQNames.ORAN_FM_FAULT_ID));
+ faultAlarm.setId(ORanDMDOMUtility.getLeafValue(cn, oranfm.getFaultIdQName()));
faultAlarm.setSourceType(SourceType.Netconf);
faultAlarm.setTimestamp(getEventTime(notification));
return faultAlarm.build();
}
- public static DateAndTime getEventTime(DOMNotification notification) {
+ public static FaultlogEntity getFaultLog(UnkeyedListEntryNode activeAlarmEntry, ORANFM oranfm, NodeId nodeId, Integer counter) {
+ FaultlogBuilder faultAlarm = new FaultlogBuilder();
+ faultAlarm.setNodeId(nodeId.getValue());
+ faultAlarm.setObjectId(getObjectId(
+ ORanDMDOMUtility.getLeafValue(activeAlarmEntry, oranfm.getFaultSourceQName())));
+ faultAlarm.setProblem(
+ ORanDMDOMUtility.getLeafValue(activeAlarmEntry, oranfm.getFaultTextQName()));
+ faultAlarm.setSeverity(getSeverityType(
+ ORanDMDOMUtility.getLeafValue(activeAlarmEntry, oranfm.getFaultSeverityQName()),
+ ORanDMDOMUtility.getLeafValue(activeAlarmEntry, oranfm.getFaultIsClearedQName())
+ .equals("true")));
+ faultAlarm.setCounter(counter);
+ faultAlarm.setId(ORanDMDOMUtility.getLeafValue(activeAlarmEntry, oranfm.getFaultIdQName()));
+ faultAlarm.setSourceType(SourceType.Netconf);
+ faultAlarm.setTimestamp(NetconfTimeStampImpl.getConverter().getTimeStamp(
+ ORanDMDOMUtility.getLeafValue(activeAlarmEntry, oranfm.getFaultEventTimeQName())));
+ return faultAlarm.build();
+
+ }
+
+ /**
+ * Convert Instant to NETCONF DateAndTime
+ * @param eventTimeInstant
+ * @return DateAndTime
+ */
+ public static DateAndTime getDateAndTimeOfInstant(Instant eventTimeInstant) {
+ Date eventDate = Date.from(eventTimeInstant);
+ return new DateAndTime(NETCONFTIME_CONVERTER.getTimeStamp(eventDate));
+ }
+
+ private static DateAndTime getEventTime(DOMNotification notification) {
DateAndTime eventTime;
Instant notificationEventTime = null;
if (notification instanceof DOMEvent) {
@@ -259,7 +298,7 @@ public class ORanDOMToInternalDataModel {
* @return data-provider severity type
* @throws IllegalArgumentException if conversion not possible.
*/
- public static SeverityType getSeverityType(@Nullable String faultSeverity, @Nullable Boolean isCleared)
+ private static SeverityType getSeverityType(@Nullable String faultSeverity, @Nullable Boolean isCleared)
throws IllegalArgumentException {
if (isCleared != null && isCleared) {
return SeverityType.NonAlarmed;
@@ -280,14 +319,14 @@ public class ORanDOMToInternalDataModel {
+ " faultSeverity=" + faultSeverity);
}
- /**
- * Convert Instant to NETCONF DataAndTime
- * @param eventTimeInstant
- * @return DateAndTime
- */
- public static DateAndTime getDateAndTimeOfInstant(Instant eventTimeInstant) {
- Date eventDate = Date.from(eventTimeInstant);
- return new DateAndTime(NETCONFTIME_CONVERTER.getTimeStamp(eventDate));
+ private static String getObjectId(String leafValue) {
+ // fault-source = /ietf-hardware:hardware/component[name='slot0-logical0']
+ Pattern p = Pattern.compile("\\/ietf-hardware:hardware\\/component\\[name=\\'(.*)\\']");
+ Matcher m = p.matcher(leafValue);
+ if (m.find()) {
+ return m.group(1);
+ }
+ return leafValue;
}
}
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/DeviceManagerORanImpl.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/DeviceManagerORanImpl.java
index de018ba4e..fd9ed2afa 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/DeviceManagerORanImpl.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/DeviceManagerORanImpl.java
@@ -17,8 +17,10 @@
*/
package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
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.oran.config.ORanDMConfig;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -27,7 +29,6 @@ public class DeviceManagerORanImpl implements AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(DeviceManagerORanImpl.class);
private static final String APPLICATION_NAME = "DeviceManagerORan";
- @SuppressWarnings("unused")
private static final String CONFIGURATIONFILE = "etc/devicemanager-oran.properties";
@@ -36,6 +37,7 @@ public class DeviceManagerORanImpl implements AutoCloseable {
private HtDatabaseClient htDatabaseClient;
private Boolean devicemanagerInitializationOk = false;
private FactoryRegistration<ORanNetworkElementFactory> resORan;
+ private ORanDMConfig oranSupervisionConfig;
// Blueprint begin
public DeviceManagerORanImpl() {
@@ -51,8 +53,11 @@ public class DeviceManagerORanImpl implements AutoCloseable {
LOG.info("Session Initiated start {}", APPLICATION_NAME);
- resORan = netconfNetworkElementService.registerBindingNetworkElementFactory(new ORanNetworkElementFactory());
+ ConfigurationFileRepresentation configFileRepresentation =
+ new ConfigurationFileRepresentation(CONFIGURATIONFILE);
+ oranSupervisionConfig = new ORanDMConfig(configFileRepresentation);
+ resORan = netconfNetworkElementService.registerBindingNetworkElementFactory(new ORanNetworkElementFactory(configFileRepresentation, oranSupervisionConfig));
netconfNetworkElementService.writeToEventLog(APPLICATION_NAME, "startup", "done");
this.devicemanagerInitializationOk = true;
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMNetworkElement.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMNetworkElement.java
index 5e25ce8b1..72cda1679 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMNetworkElement.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMNetworkElement.java
@@ -22,7 +22,6 @@
package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom;
import com.fasterxml.jackson.core.JsonProcessingException;
-import com.google.common.collect.Sets;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -30,10 +29,23 @@ import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.filechange.IConfigChangedListener;
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.devicemanager.oran.config.ORanDMConfig;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.dataprovider.ORanDOMToInternalDataModel;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.notification.ORanDOMChangeNotificationListener;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.notification.ORanDOMFaultNotificationListener;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.notification.ORanDOMSupervisionNotificationListener;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.notification.ORanNotificationObserverImpl;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.rpc.ORanSupervisionRPCImpl;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.util.ORanDMDOMUtility;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.util.ORanDeviceManagerQNames;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.vesmapper.ORanRegistrationToVESpnfRegistrationMapper;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.yangspecs.ORANFM;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.yangspecs.OnapSystem;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService;
@@ -52,17 +64,19 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.InstanceIdentifierBuilder;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class ORanDOMNetworkElement implements NetworkElement {
+public class ORanDOMNetworkElement implements NetworkElement, IConfigChangedListener {
private static final Logger LOG = LoggerFactory.getLogger(ORanDOMNetworkElement.class);
@@ -72,11 +86,16 @@ public class ORanDOMNetworkElement implements NetworkElement {
private final @NonNull NotificationService notificationService;
private final @NonNull ORanDOMChangeNotificationListener oranDomChangeNotificationListener;
private final @NonNull ORanDOMFaultNotificationListener oranDomFaultNotificationListener;
+ private final @NonNull ORanDOMSupervisionNotificationListener oranDomSupervisionNotificationListener;
private final @NonNull VESCollectorService vesCollectorService;
private final @NonNull ORanRegistrationToVESpnfRegistrationMapper mapper;
+ private final Optional<OnapSystem> onapSystem;
+ private final Optional<ORANFM> oranfm;
+ private ORanDMConfig oranSupervisionConfig;
public ORanDOMNetworkElement(@NonNull NetconfDomAccessor netconfDomAccessor,
- @NonNull DeviceManagerServiceProvider serviceProvider) {
+ @NonNull DeviceManagerServiceProvider serviceProvider, ORanDMConfig oranSupervisionConfig,
+ ConfigurationFileRepresentation configFileRepresentation) {
LOG.debug("Create {}", ORanDOMNetworkElement.class.getSimpleName());
this.netconfDomAccessor = Objects.requireNonNull(netconfDomAccessor);
Objects.requireNonNull(serviceProvider);
@@ -84,14 +103,21 @@ public class ORanDOMNetworkElement implements NetworkElement {
this.vesCollectorService = serviceProvider.getVESCollectorService();
this.faultService = serviceProvider.getFaultService();
this.notificationService = serviceProvider.getNotificationService();
+ this.onapSystem = OnapSystem.getModule(netconfDomAccessor);
+ this.oranfm = ORANFM.getModule(netconfDomAccessor);
+ this.oranSupervisionConfig = oranSupervisionConfig;
+ configFileRepresentation.registerConfigChangedListener(this);
this.oranDomChangeNotificationListener =
new ORanDOMChangeNotificationListener(netconfDomAccessor, vesCollectorService, databaseService);
this.oranDomFaultNotificationListener =
- new ORanDOMFaultNotificationListener(netconfDomAccessor, vesCollectorService,
+ new ORanDOMFaultNotificationListener(netconfDomAccessor, this.oranfm, vesCollectorService,
serviceProvider.getFaultService(), serviceProvider.getWebsocketService(), databaseService);
+ this.oranDomSupervisionNotificationListener = new ORanDOMSupervisionNotificationListener(netconfDomAccessor,
+ vesCollectorService, databaseService, oranSupervisionConfig);
+
this.mapper = new ORanRegistrationToVESpnfRegistrationMapper(netconfDomAccessor, vesCollectorService);
}
@@ -106,13 +132,28 @@ public class ORanDOMNetworkElement implements NetworkElement {
ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_NETCONF_SESSION_END,
ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_NETCONF_CAPABILITY_CHANGE};
netconfDomAccessor.doRegisterNotificationListener(oranDomChangeNotificationListener, notifications);
- QName[] faultNotification = {ORanDeviceManagerQNames.ORAN_FM_ALARM_NOTIF};
+
+ QName[] faultNotification = {oranfm.get().getAlarmNotifQName()};
netconfDomAccessor.doRegisterNotificationListener(oranDomFaultNotificationListener, faultNotification);
+
+ Capabilities x = netconfDomAccessor.getCapabilites();
+ if (x.isSupportingNamespaceAndRevision(ORanDeviceManagerQNames.ORAN_SUPERVISION_MODULE)) {
+ LOG.debug("Device {} supports oran-supervision", netconfDomAccessor.getNodeId().getValue());
+ oranDomSupervisionNotificationListener.setComponentList(componentList);
+ QName[] supervisionNotification = {ORanDeviceManagerQNames.ORAN_SUPERVISION_NOTIFICATION};
+ netconfDomAccessor.doRegisterNotificationListener(oranDomSupervisionNotificationListener,
+ supervisionNotification);
+ }
// Output notification streams to LOG
@SuppressWarnings("unused")
Map<StreamKey, Stream> streams = netconfDomAccessor.getNotificationStreamsAsMap();
// Register to default stream
netconfDomAccessor.invokeCreateSubscription();
+ if (x.isSupportingNamespaceAndRevision(ORanDeviceManagerQNames.ORAN_SUPERVISION_MODULE)) {
+ ORanSupervisionRPCImpl.invokeWatchdogReset(netconfDomAccessor, oranSupervisionConfig);
+ oranDomSupervisionNotificationListener.registerForNotificationReceivedEvent(
+ new ORanNotificationObserverImpl(netconfDomAccessor, oranSupervisionConfig));
+ }
}
public Collection<MapEntryNode> initialReadFromNetworkElement() {
@@ -133,9 +174,16 @@ public class ORanDOMNetworkElement implements NetworkElement {
componentMapEntries = Collections.emptyList();
}
- Optional<Guicutthrough> oGuicutthrough = ORanDOMToInternalDataModel.getGuicutthrough(getOnapSystemData());
- if (oGuicutthrough.isPresent()) {
- databaseService.writeGuiCutThroughData(oGuicutthrough.get(), netconfDomAccessor.getNodeId().getValue());
+ if (oranfm.isPresent()) {
+ getActiveAlarms();
+ }
+ if (onapSystem.isPresent()) {
+ AugmentationNode gcData = (AugmentationNode) onapSystem.get().getOnapSystemData();
+ Optional<Guicutthrough> oGuicutthrough =
+ ORanDOMToInternalDataModel.getGuicutthrough(gcData, onapSystem.get());
+ if (oGuicutthrough.isPresent()) {
+ databaseService.writeGuiCutThroughData(oGuicutthrough.get(), netconfDomAccessor.getNodeId().getValue());
+ }
}
return componentMapEntries;
}
@@ -192,36 +240,6 @@ public class ORanDOMNetworkElement implements NetworkElement {
return null;
}
- // Read from device
- /**
- * Read system data with GUI cut through information from device if ONAP_SYSTEM YANG is supported.
- *
- * @return NormalizedNode data with GUI cut through information or null if not available.
- */
- private @Nullable NormalizedNode getOnapSystemData() {
- LOG.debug("Get System1 for mountpoint {}", netconfDomAccessor.getNodeId().getValue());
- @NonNull
- InstanceIdentifierBuilder ietfSystemIID =
- YangInstanceIdentifier.builder().node(ORanDeviceManagerQNames.IETF_SYSTEM_CONTAINER);
- @NonNull
- AugmentationIdentifier onapSystemIID = YangInstanceIdentifier.AugmentationIdentifier
- .create(Sets.newHashSet(ORanDeviceManagerQNames.ONAP_SYSTEM_NAME,
- ORanDeviceManagerQNames.ONAP_SYSTEM_WEB_UI, ORanDeviceManagerQNames.ONAP_SYSTEM_GEOLOCATION));
- InstanceIdentifierBuilder augmentedOnapSystem =
- YangInstanceIdentifier.builder(ietfSystemIID.build()).node(onapSystemIID);
- Capabilities x = netconfDomAccessor.getCapabilites();
- LOG.debug("Capabilites: {}", x);
- if (x.isSupportingNamespace(ORanDeviceManagerQNames.ONAP_SYSTEM_QNAME)) {
- Optional<NormalizedNode> res =
- netconfDomAccessor.readDataNode(LogicalDatastoreType.OPERATIONAL, augmentedOnapSystem.build());
- LOG.debug("Result of System1 = {}", res);
- return res.isPresent() ? res.get() : null;
- } else {
- LOG.debug("No GUI cut through support");
- return null;
- }
- }
-
// VES related
private void publishMountpointToVES(Collection<MapEntryNode> componentList) {
/*
@@ -280,4 +298,27 @@ public class ORanDOMNetworkElement implements NetworkElement {
return false;
}
+ private void getActiveAlarms() {
+ InstanceIdentifierBuilder activeAlarmListBuilder =
+ YangInstanceIdentifier.builder().node(oranfm.get().getFaultActiveAlarmListQName());
+ Optional<NormalizedNode> oData =
+ netconfDomAccessor.readDataNode(LogicalDatastoreType.OPERATIONAL, activeAlarmListBuilder.build());
+ if (oData.isPresent()) {
+ ContainerNode cn = (ContainerNode) oData.get();
+ UnkeyedListNode activeAlarmsList =
+ (UnkeyedListNode) cn.childByArg(new NodeIdentifier(oranfm.get().getFaultActiveAlarmsQName()));
+ int counter = 0;
+ for (UnkeyedListEntryNode activeAlarmEntry : activeAlarmsList.body())
+ faultService.faultNotification(ORanDOMToInternalDataModel.getFaultLog(activeAlarmEntry, oranfm.get(),
+ netconfDomAccessor.getNodeId(), Integer.valueOf(counter++)));
+ }
+
+ }
+
+ @Override
+ public void onConfigChanged() {
+ LOG.info("O-RU Supervision Watchdog timers changed, resetting in O-RU via RPC");
+ ORanSupervisionRPCImpl.invokeWatchdogReset(netconfDomAccessor, oranSupervisionConfig);
+ }
+
}
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanNetworkElementFactory.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanNetworkElementFactory.java
index 05561d2ca..1f0fa06fb 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanNetworkElementFactory.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanNetworkElementFactory.java
@@ -21,8 +21,11 @@
package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom;
import java.util.Optional;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
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.oran.config.ORanDMConfig;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.util.ORanDeviceManagerQNames;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
@@ -37,6 +40,13 @@ public class ORanNetworkElementFactory implements NetworkElementFactory {
//Workaround
private static final QName OneCell =
QName.create("urn:onf:otcc:wireless:yang:radio-access:commscope-onecell", "2020-06-22", "onecell").intern();
+ private ORanDMConfig oranSupervisionConfig;
+ private ConfigurationFileRepresentation configFileRepresentation;
+
+ public ORanNetworkElementFactory(ConfigurationFileRepresentation configFileRepresentation, ORanDMConfig oranSupervisionConfig) {
+ this.configFileRepresentation = configFileRepresentation;
+ this.oranSupervisionConfig = oranSupervisionConfig;
+ }
@Override
public Optional<NetworkElement> create(NetconfAccessor accessor, DeviceManagerServiceProvider serviceProvider) {
@@ -44,11 +54,9 @@ public class ORanNetworkElementFactory implements NetworkElementFactory {
if (!capabilites.isSupportingNamespace(OneCell)) {
if (capabilites.isSupportingNamespace(ORanDeviceManagerQNames.ORAN_HW_COMPONENT)) {
log.info("Create device {} ", ORanDOMNetworkElement.class.getName());
- //Optional<NetconfBindingAccessor> bindingAccessor = accessor.getNetconfBindingAccessor();
Optional<NetconfDomAccessor> domAccessor = accessor.getNetconfDomAccessor();
if (domAccessor.isPresent()) {
- //return Optional.of(new ORanNetworkElement(bindingAccessor.get(), serviceProvider));
- return Optional.of(new ORanDOMNetworkElement(domAccessor.get(), serviceProvider));
+ return Optional.of(new ORanDOMNetworkElement(domAccessor.get(), serviceProvider, oranSupervisionConfig, configFileRepresentation));
}
}
}
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMChangeNotificationListener.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanDOMChangeNotificationListener.java
index f8e8b6da2..b4f0fe010 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMChangeNotificationListener.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanDOMChangeNotificationListener.java
@@ -19,13 +19,14 @@
* ============LICENSE_END=========================================================
*
*/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom;
+package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.notification;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.time.Instant;
import org.eclipse.jdt.annotation.NonNull;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.util.ORanDeviceManagerQNames;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESCommonEventHeaderPOJO;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESNotificationFieldsPOJO;
@@ -51,7 +52,7 @@ public class ORanDOMChangeNotificationListener implements DOMNotificationListene
private final NetconfDomAccessor netconfDomAccessor;
private final DataProvider databaseService;
private @NonNull VESCollectorService vesCollectorService;
- private final DOMNotificationToXPath domNotificationXPath;
+ private final ORanDOMNotificationToXPath domNotificationXPath;
private ORanDOMNotifToVESEventAssembly mapper = null;
private static int sequenceNo = 0;
@@ -60,7 +61,7 @@ public class ORanDOMChangeNotificationListener implements DOMNotificationListene
this.netconfDomAccessor = netconfDomAccessor;
this.databaseService = databaseService;
this.vesCollectorService = vesCollectorService;
- domNotificationXPath = new DOMNotificationToXPath();
+ domNotificationXPath = new ORanDOMNotificationToXPath();
}
@Override
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMFaultNotificationListener.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanDOMFaultNotificationListener.java
index 3e6921272..3e99bcd6d 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMFaultNotificationListener.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanDOMFaultNotificationListener.java
@@ -19,17 +19,23 @@
* ============LICENSE_END=========================================================
*
*/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom;
+package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.notification;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.time.Instant;
import java.time.format.DateTimeParseException;
import java.util.Collection;
import java.util.Objects;
+import java.util.Optional;
import org.eclipse.jdt.annotation.NonNull;
import org.json.JSONException;
import org.json.JSONObject;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.dataprovider.ORanDOMToInternalDataModel;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.util.ORanDMDOMUtility;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.util.ORanDeviceManagerQNames;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.vesmapper.ORanDOMFaultToVESFaultMapper;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.yangspecs.ORANFM;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESCommonEventHeaderPOJO;
@@ -55,10 +61,11 @@ public class ORanDOMFaultNotificationListener implements DOMNotificationListener
private final @NonNull FaultService faultService;
private final @NonNull WebsocketManagerService websocketManagerService;
private final @NonNull DataProvider databaseService;
+ private final @NonNull ORANFM oranfm;
private Integer counter; //Local counter is assigned to Notifications
- public ORanDOMFaultNotificationListener(@NonNull NetconfDomAccessor netconfDomAccessor,
+ public ORanDOMFaultNotificationListener(@NonNull NetconfDomAccessor netconfDomAccessor, Optional<ORANFM> oranfm,
@NonNull VESCollectorService vesCollectorService, @NonNull FaultService faultService,
@NonNull WebsocketManagerService websocketManagerService, @NonNull DataProvider databaseService) {
this.netconfDomAccessor = Objects.requireNonNull(netconfDomAccessor);
@@ -66,7 +73,7 @@ public class ORanDOMFaultNotificationListener implements DOMNotificationListener
this.faultService = Objects.requireNonNull(faultService);
this.websocketManagerService = Objects.requireNonNull(websocketManagerService);
this.databaseService = Objects.requireNonNull(databaseService);
-
+ this.oranfm = oranfm.get();
this.mapper =
new ORanDOMFaultToVESFaultMapper(netconfDomAccessor.getNodeId(), vesCollectorService, "AlarmNotif");
this.counter = 0;
@@ -105,18 +112,18 @@ public class ORanDOMFaultNotificationListener implements DOMNotificationListener
// Send devicemanager specific notification for database and ODLUX
Instant eventTimeInstant = ORanDMDOMUtility.getNotificationInstant(notification);
faultService.faultNotification(
- ORanDOMToInternalDataModel.getFaultLog(notification, netconfDomAccessor.getNodeId(), counter));
+ ORanDOMToInternalDataModel.getFaultLog(notification, oranfm, netconfDomAccessor.getNodeId(), counter));
// Send model specific notification to WebSocketManager
- websocketManagerService.sendNotification(notification, netconfDomAccessor.getNodeId(), ORanDeviceManagerQNames.ORAN_FM_ALARM_NOTIF);
+ websocketManagerService.sendNotification(notification, netconfDomAccessor.getNodeId(), oranfm.getAlarmNotifQName());
try {
if (vesCollectorService.getConfig().isVESCollectorEnabled()) {
VESCommonEventHeaderPOJO header = mapper.mapCommonEventHeader(notification, eventTimeInstant, counter);
- VESFaultFieldsPOJO body = mapper.mapFaultFields(notification);
+ VESFaultFieldsPOJO body = mapper.mapFaultFields(notification, oranfm);
VESMessage vesMsg = vesCollectorService.generateVESEvent(header, body);
vesCollectorService.publishVESMessage(vesMsg);
LOG.debug("VES Message is {}", vesMsg.getMessage());
- writeToEventLog(vesMsg.getMessage(), eventTimeInstant, ORanDeviceManagerQNames.ORAN_FM_ALARM_NOTIF.getLocalName(), counter);
+ writeToEventLog(vesMsg.getMessage(), eventTimeInstant, oranfm.getAlarmNotifQName().getLocalName(), counter);
}
} catch (JsonProcessingException | DateTimeParseException e) {
LOG.debug("Can not convert event into VES message {}", notification, e);
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMNotifToVESEventAssembly.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanDOMNotifToVESEventAssembly.java
index 7a2cd43cf..6c572f35c 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMNotifToVESEventAssembly.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanDOMNotifToVESEventAssembly.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*
*/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom;
+package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.notification;
import java.time.Instant;
import java.util.ArrayList;
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/DOMNotificationToXPath.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanDOMNotificationToXPath.java
index 3d7353328..697265f01 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/DOMNotificationToXPath.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanDOMNotificationToXPath.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*
*/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom;
+package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.notification;
import com.google.common.base.VerifyException;
import java.time.Instant;
@@ -44,8 +44,8 @@ import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class DOMNotificationToXPath {
- private static final Logger LOG = LoggerFactory.getLogger(DOMNotificationToXPath.class);
+public class ORanDOMNotificationToXPath {
+ private static final Logger LOG = LoggerFactory.getLogger(ORanDOMNotificationToXPath.class);
public HashMap<String, String> convertDomNotifToXPath(@NonNull DOMNotification domNotification) {
@NonNull
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanDOMSupervisionNotificationListener.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanDOMSupervisionNotificationListener.java
new file mode 100644
index 000000000..a0a075d0b
--- /dev/null
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanDOMSupervisionNotificationListener.java
@@ -0,0 +1,105 @@
+package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.notification;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import java.time.Instant;
+import java.time.format.DateTimeParseException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jdt.annotation.NonNull;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.config.ORanDMConfig;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.dataprovider.ORanDOMToInternalDataModel;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.util.ORanDMDOMUtility;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.util.ORanDeviceManagerQNames;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.vesmapper.ORanDOMSupervisionNotifToVESMapper;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESCommonEventHeaderPOJO;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESMessage;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESStndDefinedFieldsPOJO;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfDomAccessor;
+import org.opendaylight.mdsal.dom.api.DOMNotification;
+import org.opendaylight.mdsal.dom.api.DOMNotificationListener;
+import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ORanDOMSupervisionNotificationListener implements DOMNotificationListener, ORanNotificationReceivedService {
+ private static final Logger LOG = LoggerFactory.getLogger(ORanDOMSupervisionNotificationListener.class);
+
+ private @NonNull NetconfDomAccessor netconfDomAccessor;
+ private @NonNull DataProvider databaseService;
+ private @NonNull VESCollectorService vesCollectorService;
+ private List<ORanNotificationObserver> notificationObserverList;
+ private Integer counter; //Local counter is assigned to Notifications
+
+ private @NonNull ORanDOMSupervisionNotifToVESMapper mapper;
+
+ public ORanDOMSupervisionNotificationListener(@NonNull NetconfDomAccessor netconfDomAccessor,
+ @NonNull VESCollectorService vesCollectorService, @NonNull DataProvider databaseService,
+ ORanDMConfig oranSupervisionConfig) {
+ this.netconfDomAccessor = netconfDomAccessor;
+ this.databaseService = databaseService;
+ this.vesCollectorService = vesCollectorService;
+ this.mapper = new ORanDOMSupervisionNotifToVESMapper(netconfDomAccessor.getNodeId(), vesCollectorService, "o-ran-supervision");
+ notificationObserverList = new ArrayList<>();
+ this.counter = 0;
+ }
+
+ public void setComponentList(Collection<MapEntryNode> componentList) {
+ for (MapEntryNode component : ORanDOMToInternalDataModel.getRootComponents(componentList)) {
+ mapper.setMfgName(
+ ORanDMDOMUtility.getLeafValue(component, ORanDeviceManagerQNames.IETF_HW_COMPONENT_LIST_MFG_NAME));
+ mapper.setUuid(ORanDMDOMUtility.getLeafValue(component,
+ ORanDeviceManagerQNames.IETF_HW_COMPONENT_LIST_UUID) != null
+ ? ORanDMDOMUtility.getLeafValue(component,
+ ORanDeviceManagerQNames.IETF_HW_COMPONENT_LIST_UUID)
+ : netconfDomAccessor.getNodeId().getValue());
+ mapper.setModelName(ORanDMDOMUtility.getLeafValue(component,
+ ORanDeviceManagerQNames.IETF_HW_COMPONENT_LIST_MODEL_NAME));
+ }
+ }
+
+ @Override
+ public void onNotification(@NonNull DOMNotification notification) {
+ LOG.trace("Notification Type = {}", notification.getType().toString());
+ notifyObservers();
+ Instant eventTimeInstant = ORanDMDOMUtility.getNotificationInstant(notification);
+ try {
+ if (vesCollectorService.getConfig().isVESCollectorEnabled()) {
+ VESCommonEventHeaderPOJO header = mapper.mapCommonEventHeader(notification, eventTimeInstant, counter);
+ VESStndDefinedFieldsPOJO body = mapper.mapStndDefinedFields(eventTimeInstant);
+ VESMessage vesMsg = vesCollectorService.generateVESEvent(header, body);
+ vesCollectorService.publishVESMessage(vesMsg);
+ LOG.debug("VES Message is {}", vesMsg.getMessage());
+ }
+ } catch (JsonProcessingException | DateTimeParseException e) {
+ LOG.debug("Cannot convert event into VES message {}", notification, e);
+ }
+ }
+
+ private void notifyObservers() {
+ Iterator<ORanNotificationObserver> it = notificationObserverList.iterator();
+ while (it.hasNext()) {
+ ORanNotificationObserver o = it.next();
+ new Thread() {
+ @Override
+ public void run() {
+ o.observer();
+ }
+ }.start();
+ }
+ }
+
+ @Override
+ public void registerForNotificationReceivedEvent(ORanNotificationObserver o) {
+ notificationObserverList.add(o);
+ }
+
+ @Override
+ public void deregisterNotificationReceivedEvent(ORanNotificationObserver o) {
+ notificationObserverList.remove(o);
+ }
+
+}
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanNotificationObserver.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanNotificationObserver.java
new file mode 100644
index 000000000..ea56c983e
--- /dev/null
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanNotificationObserver.java
@@ -0,0 +1,31 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk features
+ * ================================================================================
+ * Copyright (C) 2023 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=========================================================
+ *
+ */
+
+/*
+ * Interface to be implemented by those interested in knowing the occurrence of Notifications
+ */
+package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.notification;
+
+public interface ORanNotificationObserver {
+
+ public void observer();
+}
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanNotificationObserverImpl.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanNotificationObserverImpl.java
new file mode 100644
index 000000000..f7f840c90
--- /dev/null
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanNotificationObserverImpl.java
@@ -0,0 +1,43 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk features
+ * ================================================================================
+ * Copyright (C) 2023 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.oran.notification;
+
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.config.ORanDMConfig;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.rpc.ORanSupervisionRPCImpl;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfDomAccessor;
+
+public class ORanNotificationObserverImpl implements ORanNotificationObserver {
+
+ private NetconfDomAccessor netconfDomAccessor;
+ private ORanDMConfig oruSupervisionConfig;
+
+ public ORanNotificationObserverImpl(NetconfDomAccessor netconfDomAccessor, ORanDMConfig oruSupervisionConfig) {
+ this.netconfDomAccessor = netconfDomAccessor;
+ this.oruSupervisionConfig = oruSupervisionConfig;
+ }
+
+ @Override
+ public void observer() {
+ ORanSupervisionRPCImpl.invokeWatchdogReset(netconfDomAccessor, oruSupervisionConfig);
+ }
+
+}
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanNotificationReceivedService.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanNotificationReceivedService.java
new file mode 100644
index 000000000..9c52c2daf
--- /dev/null
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/notification/ORanNotificationReceivedService.java
@@ -0,0 +1,33 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk features
+ * ================================================================================
+ * Copyright (C) 2023 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.oran.notification;
+
+/*
+ * Interface for registering and de-registering for listening of occurrence of notifications
+ */
+public interface ORanNotificationReceivedService {
+
+ void registerForNotificationReceivedEvent(ORanNotificationObserver o);
+
+ void deregisterNotificationReceivedEvent(ORanNotificationObserver o);
+
+}
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/rpc/ORanSupervisionRPCImpl.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/rpc/ORanSupervisionRPCImpl.java
new file mode 100644
index 000000000..30d413828
--- /dev/null
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/rpc/ORanSupervisionRPCImpl.java
@@ -0,0 +1,82 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk features
+ * ================================================================================
+ * Copyright (C) 2023 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.oran.rpc;
+
+import com.google.common.util.concurrent.ListenableFuture;
+import java.util.concurrent.TimeUnit;
+import org.eclipse.jdt.annotation.NonNull;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.config.ORanDMConfig;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.util.ORanDeviceManagerQNames;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfDomAccessor;
+import org.opendaylight.mdsal.dom.api.DOMRpcResult;
+import org.opendaylight.mdsal.dom.api.DOMRpcService;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
+import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
+import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ORanSupervisionRPCImpl {
+
+ private static final Logger LOG = LoggerFactory.getLogger(ORanSupervisionRPCImpl.class);
+ private static NodeIdentifier inputNodeIdentifier =
+ NodeIdentifier.create(QName.create(ORanDeviceManagerQNames.ORAN_SUPERVISION_MODULE, "input"));
+ private static NodeIdentifier supervisionNotificationIntervalIdentifier = NodeIdentifier
+ .create(QName.create(ORanDeviceManagerQNames.ORAN_SUPERVISION_MODULE, "supervision-notification-interval"));
+ private static NodeIdentifier guardTimerOverheadIdentifier = NodeIdentifier
+ .create(QName.create(ORanDeviceManagerQNames.ORAN_SUPERVISION_MODULE, "guard-timer-overhead"));
+
+ public static void invokeWatchdogReset(@NonNull NetconfDomAccessor netconfDomAccessor,
+ ORanDMConfig oruSupervisionConfig) {
+
+ LOG.debug(
+ "Resetting suppervision-notification-interval and guard-timer-overhead watchdog timers with values {} and {} respectively",
+ oruSupervisionConfig.getNotificationInterval(), oruSupervisionConfig.getWatchdogTimer());
+ ContainerNode rpcInputNode = Builders.containerBuilder().withNodeIdentifier(inputNodeIdentifier)
+ .withChild(ImmutableNodes.leafNode(supervisionNotificationIntervalIdentifier,
+ oruSupervisionConfig.getNotificationInterval()))
+ .withChild(
+ ImmutableNodes.leafNode(guardTimerOverheadIdentifier, oruSupervisionConfig.getWatchdogTimer()))
+ .build();
+
+ try {
+ DOMRpcService rpcService = netconfDomAccessor.getRpcService();
+ QName supervisionWatchdogResetQN =
+ QName.create(ORanDeviceManagerQNames.ORAN_SUPERVISION_MODULE, "supervision-watchdog-reset");
+
+ ListenableFuture<? extends DOMRpcResult> result =
+ rpcService.invokeRpc(supervisionWatchdogResetQN, rpcInputNode);
+ DOMRpcResult rpcResult = result.get(60000, TimeUnit.MILLISECONDS);
+ if (rpcResult.value() != null) {
+ ContainerNode rpcResultCn = (ContainerNode) rpcResult.value();
+ LOG.debug("Result of Supervision-Watchdog-Reset = {}", rpcResultCn.prettyTree());
+ }
+ } catch (Exception e) {
+ LOG.error("{}", e);
+ }
+ return;
+
+ }
+
+}
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDMDOMUtility.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/util/ORanDMDOMUtility.java
index a3bd14e3e..708ba8a47 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDMDOMUtility.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/util/ORanDMDOMUtility.java
@@ -19,16 +19,14 @@
* ============LICENSE_END=========================================================
*
*/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom;
+package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.util;
+import com.google.common.base.VerifyException;
import java.time.Instant;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.List;
import java.util.Set;
-
import org.opendaylight.mdsal.dom.api.DOMEvent;
import org.opendaylight.mdsal.dom.api.DOMNotification;
import org.opendaylight.yangtools.yang.common.QName;
@@ -42,8 +40,6 @@ import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.base.VerifyException;
-
public class ORanDMDOMUtility {
public static final Logger LOG = LoggerFactory.getLogger(ORanDMDOMUtility.class);
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDeviceManagerQNames.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/util/ORanDeviceManagerQNames.java
index 9949a6ffc..e2ad092dc 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDeviceManagerQNames.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/util/ORanDeviceManagerQNames.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*
*/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom;
+package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.util;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.QName;
@@ -33,17 +33,6 @@ public class ORanDeviceManagerQNames {
QName.create(IETF_SYSTEM_NS, IETF_SYSTEM_REVISION, "ietf-system");
public static final @NonNull QName IETF_SYSTEM_CONTAINER = QName.create(IETF_SYSTEM_QNAME, "system");
- // onap-system.yang
- public static final String ONAP_SYSTEM_NS = "urn:onap:system";
- public static final String ONAP_SYSTEM_REVISION = "2022-11-04";
- public static final @NonNull QName ONAP_SYSTEM_QNAME =
- QName.create(ONAP_SYSTEM_NS, ONAP_SYSTEM_REVISION, "onap-system");
-// public static final @NonNull QName ONAP_SYSTEM_QNAME =
-// QName.create(ONAP_SYSTEM_NS, "onap-system");
- public static final @NonNull QName ONAP_SYSTEM_NAME = QName.create(ONAP_SYSTEM_QNAME, "name");
- public static final @NonNull QName ONAP_SYSTEM_WEB_UI = QName.create(ONAP_SYSTEM_QNAME, "web-ui");
- public static final @NonNull QName ONAP_SYSTEM_GEOLOCATION = QName.create(ONAP_SYSTEM_QNAME, "geographical-location");
-
//ietf-hardware.yang
public static final String IETF_HW_NS = "urn:ietf:params:xml:ns:yang:ietf-hardware";
public static final String IETF_HW_REVISION = "2018-03-13";
@@ -85,18 +74,6 @@ public class ORanDeviceManagerQNames {
public static final @NonNull QName ORAN_HW_MODULE = QName.create(ORAN_HW_NS, ORAN_HW_REVISION, "o-ran-hardware").intern();
public static final @NonNull QName ORAN_HW_COMPONENT = QName.create(ORAN_HW_MODULE, "O-RAN-HW-COMPONENT");
- //o-ran-fm.yang
- public static final String ORAN_FM_NS = "urn:o-ran:fm:1.0";
- //public static final String ORAN_FM_REVISION = "2019-02-04";
- public static final String ORAN_FM_REVISION = "2022-08-15";
- public static final @NonNull QName ORAN_FM_MODULE = QName.create(ORAN_FM_NS, ORAN_FM_REVISION, "o-ran-fm");
- public static final @NonNull QName ORAN_FM_ALARM_NOTIF = QName.create(ORAN_FM_MODULE, "alarm-notif");
- public static final @NonNull QName ORAN_FM_FAULT_ID = QName.create(ORAN_FM_MODULE, "fault-id");
- public static final @NonNull QName ORAN_FM_FAULT_SOURCE = QName.create(ORAN_FM_MODULE, "fault-source");
- public static final @NonNull QName ORAN_FM_FAULT_SEVERITY = QName.create(ORAN_FM_MODULE, "fault-severity");
- public static final @NonNull QName ORAN_FM_FAULT_TEXT = QName.create(ORAN_FM_MODULE, "fault-text");
- public static final @NonNull QName ORAN_FM_FAULT_IS_CLEARED = QName.create(ORAN_FM_MODULE, "is-cleared");
-
//ietf-netconf-notifications.yang
public static final String IETF_NETCONF_NOTIFICATIONS_NS = "urn:ietf:params:xml:ns:yang:ietf-netconf-notifications";
public static final String IETF_NETCONF_NOTIFICATIONS_REVISION = "2012-02-06";
@@ -115,4 +92,10 @@ public class ORanDeviceManagerQNames {
public static final @NonNull QName IETF_NETCONF_NOTIFICATIONS_TARGET = QName.create(IETF_NETCONF_NOTIFICATIONS_MODULE, "target");
public static final @NonNull QName IETF_NETCONF_NOTIFICATIONS_DATASTORE = QName.create(IETF_NETCONF_NOTIFICATIONS_MODULE, "datastore");
+ //o-ran-supervision.yang
+ public static final String ORAN_SUPERVISION_NS = "urn:o-ran:supervision:1.0";
+ public static final String ORAN_SUPERVISION_REVISION = "2022-12-05";
+ public static final @NonNull QName ORAN_SUPERVISION_MODULE = QName.create(ORAN_SUPERVISION_NS, ORAN_SUPERVISION_REVISION, "o-ran-supervision");
+ public static final @NonNull QName ORAN_SUPERVISION_NOTIFICATION = QName.create(ORAN_SUPERVISION_MODULE, "supervision-notification");
+
}
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMFaultToVESFaultMapper.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/vesmapper/ORanDOMFaultToVESFaultMapper.java
index 77bd82d12..fabe26463 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMFaultToVESFaultMapper.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/vesmapper/ORanDOMFaultToVESFaultMapper.java
@@ -19,9 +19,11 @@
* ============LICENSE_END=========================================================
*
*/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom;
+package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.vesmapper;
import java.time.Instant;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.util.ORanDMDOMUtility;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.yangspecs.ORANFM;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESCommonEventHeaderPOJO;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESFaultFieldsPOJO;
@@ -129,23 +131,20 @@ public class ORanDOMFaultToVESFaultMapper {
return vesCEH;
}
- public VESFaultFieldsPOJO mapFaultFields(DOMNotification alarmNotif) {
+ public VESFaultFieldsPOJO mapFaultFields(DOMNotification alarmNotif, ORANFM oranfm) {
VESFaultFieldsPOJO vesFaultFields = new VESFaultFieldsPOJO();
ContainerNode cn = alarmNotif.getBody();
- vesFaultFields.setAlarmCondition(ORanDMDOMUtility.getLeafValue(cn, ORanDeviceManagerQNames.ORAN_FM_FAULT_ID));
- vesFaultFields
- .setAlarmInterfaceA(ORanDMDOMUtility.getLeafValue(cn, ORanDeviceManagerQNames.ORAN_FM_FAULT_SOURCE));
+ vesFaultFields.setAlarmCondition(ORanDMDOMUtility.getLeafValue(cn, oranfm.getFaultIdQName()));
+ vesFaultFields.setAlarmInterfaceA(ORanDMDOMUtility.getLeafValue(cn, oranfm.getFaultSourceQName()));
vesFaultFields.setEventCategory(VES_EVENT_CATEGORY);
- if (ORanDMDOMUtility.getLeafValue(cn, ORanDeviceManagerQNames.ORAN_FM_FAULT_IS_CLEARED).equals("true")) {
+ if (ORanDMDOMUtility.getLeafValue(cn, oranfm.getFaultIsClearedQName()).equals("true")) {
vesFaultFields.setEventSeverity("NORMAL");
} else {
- vesFaultFields.setEventSeverity(
- ORanDMDOMUtility.getLeafValue(cn, ORanDeviceManagerQNames.ORAN_FM_FAULT_SEVERITY));
+ vesFaultFields.setEventSeverity(ORanDMDOMUtility.getLeafValue(cn, oranfm.getFaultSeverityQName()));
}
vesFaultFields.setEventSourceType(modelName);
vesFaultFields.setFaultFieldsVersion(VES_FAULT_FIELDS_VERSION);
- vesFaultFields
- .setSpecificProblem(ORanDMDOMUtility.getLeafValue(cn, ORanDeviceManagerQNames.ORAN_FM_FAULT_TEXT));
+ vesFaultFields.setSpecificProblem(ORanDMDOMUtility.getLeafValue(cn, oranfm.getFaultTextQName()));
vesFaultFields.setVfStatus(VES_FAULT_FIELDS_VFSTATUS);
return vesFaultFields;
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/vesmapper/ORanDOMSupervisionNotifToVESMapper.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/vesmapper/ORanDOMSupervisionNotifToVESMapper.java
new file mode 100644
index 000000000..b87b93d80
--- /dev/null
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/vesmapper/ORanDOMSupervisionNotifToVESMapper.java
@@ -0,0 +1,206 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk features
+ * ================================================================================
+ * Copyright (C) 2023 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.oran.vesmapper;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.time.Instant;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.dataprovider.ORanDOMToInternalDataModel;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESCommonEventHeaderPOJO;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESStndDefinedFieldsPOJO;
+import org.opendaylight.mdsal.dom.api.DOMNotification;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+
+/*
+ * {
+ "event": {
+ "stndDefinedFields": {
+ "schemaReference": "https://gerrit.o-ran-sc.org/r/gitweb?p=scp/oam/modeling.git;a=blob_plain;f=data-model/yang/published/o-ran/ru-fh/o-ran-supervision.yang#components/schemas/ofhm-event-stream",
+ "stndDefinedFieldsVersion": "1.0",
+ "data": {
+ "ietf:notification": {
+ "eventTime": "2023-06-28T07:28:55.098Z",
+ "o-ran-supervision:supervision-notification": {
+ "session-id": 999999
+ }
+ }
+ }
+ },
+ "commonEventHeader": {
+ "domain": "stndDefined",
+ "eventType": "o-ran-supervision:supervision-notification",
+ "eventId": "pnf2_o-ran-supervision:supervision-notification_fed2ab31f6e1da56",
+ "eventName": "stndDefined_o-ran-supervision:supervision-notification",
+ "sequence": 1687937335098,
+ "priority": "Low",
+ "reportingEntityId": "c2b7d6e9-ee35-459a-ab8e-717a6fc1fde6",
+ "reportingEntityName": "flows",
+ "sourceId": "378e9904-6d39-40ea-9994-0596fe2235a3",
+ "sourceName": "O-RAN-SC-OAM-Test-Component-01",
+ "startEpochMicrosec": 1687937335098000,
+ "lastEpochMicrosec": 1687937335098000,
+ "nfNamingCode": "pnf2",
+ "nfVendorName": "O-RAN-SC-OAM-Project",
+ "timeZoneOffset": "+00:00",
+ "stndDefinedNamespace": "o-ran-supervision:supervision-notification",
+ "version": "4.1",
+ "vesEventListenerVersion": "7.2.1"
+ }
+ }
+}
+ */
+public class ORanDOMSupervisionNotifToVESMapper {
+
+ private static final String VES_EVENT_DOMAIN = "stndDefined";
+ private static final String VES_EVENTTYPE = "o-ran-supervision:supervision-notification";
+ private static final String VES_EVENT_PRIORITY = "Low";
+ private static final String O_RU_SUPERVISION_SCHEMA_REFERENCE =
+ "https://gerrit.o-ran-sc.org/r/gitweb?p=scp/oam/modeling.git;a=blob_plain;f=data-model/yang/published/o-ran/ru-fh/o-ran-supervision.yang#components/schemas/ofhm-event-stream";
+ private final VESCollectorService vesProvider;
+ private final String notifName;
+ private final String nodeIdString;
+ //Initialized during registration
+ private String mfgName;
+ private String uuid;
+ private String modelName;
+
+ public ORanDOMSupervisionNotifToVESMapper(NodeId nodeId, VESCollectorService vesCollectorService,
+ String notifName) {
+ this.nodeIdString = nodeId.getValue();
+ this.vesProvider = vesCollectorService;
+ this.notifName = notifName;
+ }
+
+ public void setMfgName(String mfgName) {
+ this.mfgName = mfgName;
+ }
+
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ public VESCommonEventHeaderPOJO mapCommonEventHeader(DOMNotification notification, Instant eventTime,
+ int sequenceNo) {
+ VESCommonEventHeaderPOJO vesCEH = new VESCommonEventHeaderPOJO();
+ vesCEH.setDomain(VES_EVENT_DOMAIN);
+ vesCEH.setEventName(VES_EVENT_DOMAIN + "_" + VES_EVENTTYPE);
+ vesCEH.setEventType(VES_EVENTTYPE);
+ vesCEH.setPriority(VES_EVENT_PRIORITY);
+
+ String eventId = notifName + "-" + Long.toUnsignedString(sequenceNo);
+
+ vesCEH.setEventId(eventId);
+ vesCEH.setStartEpochMicrosec(eventTime.toEpochMilli() * 1000);
+ vesCEH.setLastEpochMicrosec(eventTime.toEpochMilli() * 1000);
+ vesCEH.setNfVendorName(mfgName);
+ vesCEH.setReportingEntityName(vesProvider.getConfig().getReportingEntityName());
+ vesCEH.setSequence(sequenceNo);
+ vesCEH.setSourceId(uuid);
+ vesCEH.setSourceName(nodeIdString);
+
+ return vesCEH;
+ }
+
+ public VESStndDefinedFieldsPOJO mapStndDefinedFields(Instant eventTimeInstant) {
+ VESStndDefinedFieldsPOJO vesStndDefFields = new VESStndDefinedFieldsPOJO();
+ vesStndDefFields.setSchemaReference(O_RU_SUPERVISION_SCHEMA_REFERENCE);
+ vesStndDefFields.setData(getSupervisionData(eventTimeInstant));
+
+ return vesStndDefFields;
+ }
+
+ private DataObject getSupervisionData(Instant eventTimeInstant) {
+ ORanSupervisionNotification oruSuperNotif = new ORanSupervisionNotification();
+ oruSuperNotif.setSessionId(999999); // Hardcoded due to limitation in NTS Simulator. Ideally should be NETCONF Session ID
+
+ IetfNotification ietfNotif = new IetfNotification();
+ ietfNotif.setOranSupervisionNotif(oruSuperNotif);
+ ietfNotif.setEventTime(ORanDOMToInternalDataModel.getDateAndTimeOfInstant(eventTimeInstant).getValue());
+
+ DataObject data = new DataObject();
+ data.setIetfNotification(ietfNotif);
+ return data;
+ }
+
+}
+
+/* Classes for serialization of stndDefinedFields "data" object */
+class DataObject {
+ @JsonProperty("ietf:notification")
+ IetfNotification ietfNotification;
+
+ public DataObject() {}
+
+ public IetfNotification getIetfNotification() {
+ return ietfNotification;
+ }
+
+ public void setIetfNotification(IetfNotification ietfNotification) {
+ this.ietfNotification = ietfNotification;
+ }
+}
+
+
+class IetfNotification {
+ String eventTime;
+ @JsonProperty("o-ran-supervision:supervision-notification")
+ ORanSupervisionNotification oranSupervisionNotif;
+
+ public IetfNotification() {}
+
+ public String getEventTime() {
+ return eventTime;
+ }
+
+ public void setEventTime(String eventTime) {
+ this.eventTime = eventTime;
+ }
+
+ public ORanSupervisionNotification getOranSupervisionNotif() {
+ return oranSupervisionNotif;
+ }
+
+ public void setOranSupervisionNotif(ORanSupervisionNotification oranSupervisionNotif) {
+ this.oranSupervisionNotif = oranSupervisionNotif;
+ }
+
+}
+
+
+class ORanSupervisionNotification {
+ @JsonProperty("session-id")
+ int sessionId;
+
+ public ORanSupervisionNotification() {}
+
+ public int getSessionId() {
+ return sessionId;
+ }
+
+ public void setSessionId(int sessionId) {
+ this.sessionId = sessionId;
+ }
+}
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanRegistrationToVESpnfRegistrationMapper.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/vesmapper/ORanRegistrationToVESpnfRegistrationMapper.java
index 5cad5881c..9cbb45d55 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanRegistrationToVESpnfRegistrationMapper.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/vesmapper/ORanRegistrationToVESpnfRegistrationMapper.java
@@ -19,10 +19,12 @@
* ============LICENSE_END=========================================================
*
*/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom;
+package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.vesmapper;
import java.time.Instant;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.util.ORanDMDOMUtility;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.util.ORanDeviceManagerQNames;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESCommonEventHeaderPOJO;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESPNFRegistrationFieldsPOJO;
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/yangspecs/ORANFM.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/yangspecs/ORANFM.java
new file mode 100644
index 000000000..5be18e75b
--- /dev/null
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/yangspecs/ORANFM.java
@@ -0,0 +1,113 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk features
+ * ================================================================================
+ * Copyright (C) 2023 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.oran.yangspecs;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Optional;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfDomAccessor;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.common.Revision;
+import org.opendaylight.yangtools.yang.common.XMLNamespace;
+
+public class ORANFM extends YangModule {
+
+ public static final String NAMESPACE = "urn:o-ran:fm:1.0";
+ public static final QNameModule ORANFM_2019_02_04 =
+ QNameModule.create(XMLNamespace.of(NAMESPACE), Revision.of("2019-02-04"));
+ public static final QNameModule ORANFM_2022_08_15 =
+ QNameModule.create(XMLNamespace.of(NAMESPACE), Revision.of("2022-08-15"));
+ private static final List<QNameModule> MODULES = Arrays.asList(ORANFM_2019_02_04, ORANFM_2022_08_15);
+// private final QName ORAN_FM_ALARM_NOTIF;
+// private final QName ORAN_FM_FAULT_ID;
+// private final QName ORAN_FM_FAULT_SOURCE;
+// private final QName ORAN_FM_FAULT_SEVERITY;
+// private final QName ORAN_FM_FAULT_TEXT;
+// private final QName ORAN_FM_FAULT_IS_CLEARED;
+
+
+
+ ORANFM(NetconfDomAccessor netconfDomAccessor, QNameModule module) {
+ super(netconfDomAccessor, module);
+// ORAN_FM_ALARM_NOTIF = QName.create(module, "alarm-notif");
+// ORAN_FM_FAULT_ID = QName.create(module, "fault-id");
+// ORAN_FM_FAULT_SOURCE = QName.create(module, "fault-source");
+// ORAN_FM_FAULT_SEVERITY = QName.create(module, "fault-severity");
+// ORAN_FM_FAULT_TEXT = QName.create(module, "fault-text");
+// ORAN_FM_FAULT_IS_CLEARED = QName.create(module, "is-cleared");
+ }
+
+ public QName getFaultSourceQName() {
+ return getQName("fault-source");
+ }
+
+ public QName getFaultIdQName() {
+ return getQName("fault-id");
+ }
+
+ public QName getFaultSeverityQName() {
+ return getQName("fault-severity");
+ }
+
+ public QName getFaultTextQName() {
+ return getQName("fault-text");
+ }
+
+ public QName getAlarmNotifQName() {
+ return getQName("alarm-notif");
+ }
+
+ public QName getFaultIsClearedQName() {
+ return getQName("is-cleared");
+ }
+
+ public QName getFaultEventTimeQName() {
+ return getQName("event-time");
+ }
+
+ public QName getFaultActiveAlarmListQName() {
+ return getQName("active-alarm-list");
+ }
+
+ public QName getFaultActiveAlarmsQName() {
+ return getQName("active-alarms");
+ }
+
+ /**
+ * Get specific instance, depending on capabilities
+ *
+ * @param capabilities
+ * @return
+ */
+ public static Optional<ORANFM> getModule(NetconfDomAccessor netconfDomAccessor) {
+ Capabilities capabilities = netconfDomAccessor.getCapabilites();
+ for (QNameModule module : MODULES) {
+ if (capabilities.isSupportingNamespaceAndRevision(module)) {
+ return Optional.of(new ORANFM(netconfDomAccessor, module));
+ }
+ }
+ return Optional.empty();
+ }
+
+}
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/yangspecs/OnapSystem.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/yangspecs/OnapSystem.java
new file mode 100644
index 000000000..03ed89111
--- /dev/null
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/yangspecs/OnapSystem.java
@@ -0,0 +1,127 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk features
+ * ================================================================================
+ * Copyright (C) 2023 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.oran.yangspecs;
+
+import com.google.common.collect.Sets;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.util.ORanDeviceManagerQNames;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfDomAccessor;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.common.Revision;
+import org.opendaylight.yangtools.yang.common.XMLNamespace;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.InstanceIdentifierBuilder;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+
+public class OnapSystem extends YangModule {
+
+ private static final Logger LOG = LoggerFactory.getLogger(OnapSystem.class);
+ public static final String NAMESPACE = "urn:onap:system";
+ public static final QNameModule ONAPSYSTEM_2020_10_26 =
+ QNameModule.create(XMLNamespace.of(NAMESPACE), Revision.of("2020-10-26"));
+ public static final QNameModule ONAPSYSTEM_2022_11_04 =
+ QNameModule.create(XMLNamespace.of(NAMESPACE), Revision.of("2022-11-04"));
+ private static final List<QNameModule> MODULES = Arrays.asList(ONAPSYSTEM_2020_10_26, ONAPSYSTEM_2022_11_04);
+
+ private final QName NAME;
+ private final QName WEB_UI;
+ private final QName GEOGRAPHICAL_LOCATION;
+
+ OnapSystem(NetconfDomAccessor netconfDomAccessor, QNameModule module) {
+ super(netconfDomAccessor, module);
+
+ NAME = QName.create(module, "name");
+ WEB_UI = QName.create(module, "web-ui");
+ GEOGRAPHICAL_LOCATION = QName.create(module, "geographical-location");
+ }
+
+ public QName getName() {
+ return NAME;
+ }
+
+ public QName getWebUi() {
+ return WEB_UI;
+ }
+
+ public QName getGeoLocation() {
+ return GEOGRAPHICAL_LOCATION;
+ }
+
+ // Read from device
+ /**
+ * Read system data with GUI cut through information from device if ONAP_SYSTEM YANG is supported.
+ *
+ * @return NormalizedNode data with GUI cut through information or null if not available.
+ */
+ public @Nullable NormalizedNode getOnapSystemData() {
+ LOG.debug("Get System1 for mountpoint {}", netconfDomAccessor.getNodeId().getValue());
+ @NonNull
+ InstanceIdentifierBuilder ietfSystemIID =
+ YangInstanceIdentifier.builder().node(ORanDeviceManagerQNames.IETF_SYSTEM_CONTAINER);
+ @NonNull
+ AugmentationIdentifier onapSystemIID = null;
+ if (netconfDomAccessor.getCapabilites().isSupportingNamespaceAndRevision(ONAPSYSTEM_2020_10_26))
+ onapSystemIID = YangInstanceIdentifier.AugmentationIdentifier.create(Sets.newHashSet(NAME, WEB_UI));
+ else if (netconfDomAccessor.getCapabilites().isSupportingNamespaceAndRevision(ONAPSYSTEM_2022_11_04))
+ onapSystemIID = YangInstanceIdentifier.AugmentationIdentifier
+ .create(Sets.newHashSet(NAME, WEB_UI, GEOGRAPHICAL_LOCATION));
+
+ InstanceIdentifierBuilder augmentedOnapSystem =
+ YangInstanceIdentifier.builder(ietfSystemIID.build()).node(onapSystemIID);
+
+ Optional<NormalizedNode> res =
+ netconfDomAccessor.readDataNode(LogicalDatastoreType.OPERATIONAL, augmentedOnapSystem.build());
+ LOG.debug("Result of System1 = {}", res);
+ return res.isPresent() ? res.get() : null;
+
+ }
+
+ /**
+ * Get specific instance, depending on capabilities
+ *
+ * @param capabilities
+ * @return
+ */
+ public static Optional<OnapSystem> getModule(NetconfDomAccessor netconfDomAccessor) {
+ Capabilities capabilities = netconfDomAccessor.getCapabilites();
+ for (QNameModule module : MODULES) {
+ if (capabilities.isSupportingNamespaceAndRevision(module)) {
+ return Optional.of(new OnapSystem(netconfDomAccessor, module));
+ }
+ }
+ return Optional.empty();
+ }
+
+
+}
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/yangspecs/YangModule.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/yangspecs/YangModule.java
new file mode 100644
index 000000000..31010ab1d
--- /dev/null
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/yangspecs/YangModule.java
@@ -0,0 +1,51 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk features
+ * ================================================================================
+ * Copyright (C) 2023 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.oran.yangspecs;
+
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfDomAccessor;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.QNameModule;
+
+public class YangModule {
+
+ protected final NetconfDomAccessor netconfDomAccessor;
+ protected final QNameModule module;
+
+ YangModule(NetconfDomAccessor netconfDomAccessor, QNameModule module) {
+ super();
+ this.netconfDomAccessor = netconfDomAccessor;
+ this.module = module;
+ }
+
+ NetconfDomAccessor getNetconfDomAccessor() {
+ return netconfDomAccessor;
+ }
+
+ public QNameModule getQNameModule() {
+ return module;
+ }
+
+ public QName getQName(String localName) {
+ return QName.create(module, localName);
+ }
+
+}
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMFaultNotificationListener.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMFaultNotificationListener.java
index 89ff6dc90..de19bf1a2 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMFaultNotificationListener.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMFaultNotificationListener.java
@@ -22,6 +22,7 @@
package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import com.google.common.io.Files;
@@ -29,6 +30,7 @@ import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.time.Instant;
+import java.util.Optional;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -37,17 +39,22 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.notification.ORanDOMFaultNotificationListener;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.yangspecs.ORANFM;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.vescollectorconnector.impl.VESCollectorServiceImpl;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfDomAccessor;
import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService;
import org.opendaylight.mdsal.dom.api.DOMEvent;
import org.opendaylight.mdsal.dom.api.DOMNotification;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogEntity;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.common.Revision;
+import org.opendaylight.yangtools.yang.common.XMLNamespace;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
@@ -89,6 +96,8 @@ public class TestORanDOMFaultNotificationListener {
@Mock
DataProvider databaseService;
VESCollectorService vesCollectorService;
+ static Optional<ORANFM> oranfm;
+ private Capabilities capabilities;
@After
@Before
@@ -98,6 +107,11 @@ public class TestORanDOMFaultNotificationListener {
LOG.info("Remove {}", f.getAbsolutePath());
f.delete();
}
+ capabilities = mock(Capabilities.class);
+ when(domAccessor.getCapabilites()).thenReturn(capabilities);
+ when(capabilities.isSupportingNamespaceAndRevision(
+ QNameModule.create(XMLNamespace.of(ORANFM.NAMESPACE), Revision.of("2022-08-15")))).thenReturn(true);
+ oranfm = ORANFM.getModule(domAccessor);
}
@Test
@@ -105,7 +119,7 @@ public class TestORanDOMFaultNotificationListener {
Files.asCharSink(new File(TESTFILENAME), StandardCharsets.UTF_8).write(TESTCONFIG_CONTENT);
vesCollectorService = new VESCollectorServiceImpl(new ConfigurationFileRepresentation(TESTFILENAME));
when(domAccessor.getNodeId()).thenReturn(new NodeId("nSky"));
- ORanDOMFaultNotificationListener faultListener = new ORanDOMFaultNotificationListener(domAccessor,
+ ORanDOMFaultNotificationListener faultListener = new ORanDOMFaultNotificationListener(domAccessor, oranfm,
vesCollectorService, faultService, websocketManagerService, databaseService);
NetconfDeviceNotification ndn = new NetconfDeviceNotification(createORANDOMFault(), Instant.now());
faultListener.onNotification(ndn);
@@ -114,20 +128,14 @@ public class TestORanDOMFaultNotificationListener {
}
public static ContainerNode createORANDOMFault() {
- final QName fault_id = QName.create(ORanDeviceManagerQNames.ORAN_FM_ALARM_NOTIF, "fault-id");
- final QName fault_source = QName.create(ORanDeviceManagerQNames.ORAN_FM_ALARM_NOTIF, "fault-source");
- final QName fault_severity = QName.create(ORanDeviceManagerQNames.ORAN_FM_ALARM_NOTIF, "fault-severity");
- final QName is_cleared = QName.create(ORanDeviceManagerQNames.ORAN_FM_ALARM_NOTIF, "is-cleared");
- final QName fault_text = QName.create(ORanDeviceManagerQNames.ORAN_FM_ALARM_NOTIF, "fault-text");
- return Builders.containerBuilder().withNodeIdentifier(NodeIdentifier.create(ORanDeviceManagerQNames.ORAN_FM_ALARM_NOTIF))
- .withChild(ImmutableNodes.leafNode(fault_id, "47"))
- .withChild(ImmutableNodes.leafNode(fault_source, "Slot-2-Port-B"))
- .withChild(ImmutableNodes.leafNode(fault_severity, "MAJOR"))
- .withChild(ImmutableNodes.leafNode(is_cleared, "true"))
- .withChild(ImmutableNodes.leafNode(fault_text, "CPRI Port Down")).build();
+ return Builders.containerBuilder().withNodeIdentifier(NodeIdentifier.create(oranfm.get().getAlarmNotifQName()))
+ .withChild(ImmutableNodes.leafNode(oranfm.get().getFaultIdQName(), "47"))
+ .withChild(ImmutableNodes.leafNode(oranfm.get().getFaultSourceQName(), "Slot-2-Port-B"))
+ .withChild(ImmutableNodes.leafNode(oranfm.get().getFaultSeverityQName(), "MAJOR"))
+ .withChild(ImmutableNodes.leafNode(oranfm.get().getFaultIsClearedQName(), "true"))
+ .withChild(ImmutableNodes.leafNode(oranfm.get().getFaultTextQName(), "CPRI Port Down")).build();
}
-
public static class NetconfDeviceNotification implements DOMNotification, DOMEvent {
private final ContainerNode content;
private final Absolute schemaPath;
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMNetworkElement.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMNetworkElement.java
index 283d122b0..7fd947211 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMNetworkElement.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMNetworkElement.java
@@ -21,17 +21,25 @@
*/
package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+import com.google.common.io.Files;
+import java.io.File;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.Optional;
import org.eclipse.jdt.annotation.NonNull;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
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.oran.config.ORanDMConfig;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.util.ORanDeviceManagerQNames;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.yangspecs.ORANFM;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.yangspecs.OnapSystem;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationProxyParser;
@@ -43,12 +51,15 @@ import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfDomAccesso
import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.common.Revision;
+import org.opendaylight.yangtools.yang.common.XMLNamespace;
public class TestORanDOMNetworkElement {
private static final QName OneCell =
QName.create("urn:onf:otcc:wireless:yang:radio-access:commscope-onecell", "2020-06-22", "onecell").intern();
- private static final @NonNull QName OnapSystem =
+ private static final @NonNull QName OnapSystem1 =
QName.create("urn:onap:system", "2020-10-26", "onap-system").intern();
private static String NODEIDSTRING = "nSky";
private static NodeId nodeId = new NodeId(NODEIDSTRING);
@@ -61,6 +72,16 @@ public class TestORanDOMNetworkElement {
private static NotificationProxyParser notificationProxyParser;
private static VESCollectorCfgService vesCfgService;
private static WebsocketManagerService websocketManagerService;
+ private static ORanDMConfig oranDmConfig;
+ private static ConfigurationFileRepresentation oranCfg;
+
+ private static String fileName = "test1.properties";
+ // @formatter:off
+ private static final String TESTCONFIG_CONTENT = "[ORAN-SUPERVISION]\n"
+ + "supervision-notification-interval=60\n"
+ + "guard-timer-overhead=10\n"
+ + "";
+ // @formatter:on
@BeforeClass
public static void init() throws InterruptedException, IOException {
@@ -72,6 +93,7 @@ public class TestORanDOMNetworkElement {
notificationProxyParser = mock(NotificationProxyParser.class);
vesCfgService = mock(VESCollectorCfgService.class);
websocketManagerService = mock(WebsocketManagerService.class);
+ oranDmConfig = mock(ORanDMConfig.class);
when(accessor.getCapabilites()).thenReturn(capabilities);
when(accessor.getNodeId()).thenReturn(nodeId);
@@ -79,6 +101,10 @@ public class TestORanDOMNetworkElement {
when(domAccessor.getNodeId()).thenReturn(nodeId);
when(domAccessor.getCapabilites()).thenReturn(capabilities);
when(vesCollectorService.getNotificationProxyParser()).thenReturn(notificationProxyParser);
+ when(capabilities.isSupportingNamespaceAndRevision(
+ QNameModule.create(XMLNamespace.of(ORANFM.NAMESPACE), Revision.of("2022-08-15")))).thenReturn(true);
+ when(capabilities.isSupportingNamespaceAndRevision(
+ QNameModule.create(XMLNamespace.of(OnapSystem.NAMESPACE), Revision.of("2022-11-04")))).thenReturn(true);
DataProvider dataProvider = mock(DataProvider.class);
FaultService faultService = mock(FaultService.class);
@@ -89,6 +115,8 @@ public class TestORanDOMNetworkElement {
when(vesCollectorService.getConfig()).thenReturn(vesCfgService);
when(vesCfgService.isVESCollectorEnabled()).thenReturn(true);
+ Files.asCharSink(new File(fileName), StandardCharsets.UTF_8).write(TESTCONFIG_CONTENT);
+ oranCfg = new ConfigurationFileRepresentation(fileName);
}
@Test
@@ -96,9 +124,9 @@ public class TestORanDOMNetworkElement {
Optional<NetworkElement> oRanNe;
when(capabilities.isSupportingNamespace(ORanDeviceManagerQNames.ORAN_HW_COMPONENT)).thenReturn(true);
when(capabilities.isSupportingNamespace(OneCell)).thenReturn(false);
- when(capabilities.isSupportingNamespace(OnapSystem)).thenReturn(false);
+ when(capabilities.isSupportingNamespace(OnapSystem1)).thenReturn(false);
- ORanNetworkElementFactory factory = new ORanNetworkElementFactory();
+ ORanNetworkElementFactory factory = new ORanNetworkElementFactory(oranCfg, oranDmConfig);
oRanNe = factory.create(accessor, serviceProvider);
assertTrue(factory.create(accessor, serviceProvider).isPresent());
oRanNe.get().register();
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMNotification.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMNotification.java
index 1665ac1ad..96983b1ba 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMNotification.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMNotification.java
@@ -29,6 +29,8 @@ import java.time.Instant;
import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.notification.ORanDOMChangeNotificationListener;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.util.ORanDeviceManagerQNames;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorCfgService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfDomAccessor;
@@ -141,7 +143,6 @@ public class TestORanDOMNotification {
@Test
public void test() {
ContainerNode cn = createDOMNotificationBody();
- System.out.println(cn.toString());
NetconfDeviceNotification ndn = new NetconfDeviceNotification(cn, Instant.now());
ORanDOMChangeNotificationListener changeListener = new ORanDOMChangeNotificationListener(domAccessor, vesCollectorService, databaseService);
changeListener.onNotification(ndn);
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMToInternalDataModel.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMToInternalDataModel.java
index 5ce758210..01502e49c 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMToInternalDataModel.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMToInternalDataModel.java
@@ -22,6 +22,8 @@
package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom;
import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import com.google.common.collect.Sets;
import java.io.IOException;
import java.io.InputStream;
@@ -33,9 +35,13 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import org.junit.AfterClass;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.dataprovider.ORanDOMToInternalDataModel;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom.util.TestYangParserUtil;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.yangspecs.ORANFM;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.yangspecs.OnapSystem;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfDomAccessor;
import org.opendaylight.mdsal.dom.api.DOMEvent;
import org.opendaylight.mdsal.dom.api.DOMNotification;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogEntity;
@@ -48,10 +54,12 @@ import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.common.Revision;
import org.opendaylight.yangtools.yang.common.XMLNamespace;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode;
import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
import org.opendaylight.yangtools.yang.data.codec.xml.XmlParserStream;
import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
@@ -73,9 +81,18 @@ public class TestORanDOMToInternalDataModel {
QNameModule.create(XMLNamespace.of("urn:ietf:params:xml:ns:yang:ietf-system"), Revision.of("2014-08-06"));
private static final QName IETF_CONTAINER = QName.create(IETF_SYSTEM_MODULE, "system");
+ private static final QNameModule ORAN_MODULE =
+ QNameModule.create(XMLNamespace.of("urn:o-ran:fm:1.0"), Revision.of("2022-08-15"));
+ private static final QName ORAN_ACTIVE_ALARM_CONTAINER = QName.create(ORAN_MODULE, "active-alarm-list");
+
private static EffectiveModelContext schemaContext;
private static Inference hwContainerSchema;
private static Inference systemSchema;
+ private static Inference activeAlarmSchema;
+ private static Capabilities capabilities;
+ private static Optional<OnapSystem> onapSystem;
+ private static Optional<ORANFM> oranfm;
+ private static NetconfDomAccessor domAccessor;
private static final NodeId nodeId = new NodeId("nSky");
@@ -84,6 +101,18 @@ public class TestORanDOMToInternalDataModel {
schemaContext = TestYangParserUtil.parseYangResourceDirectory("/");
hwContainerSchema = Inference.ofDataTreePath(schemaContext, HW_CONTAINER);
systemSchema = Inference.ofDataTreePath(schemaContext, IETF_CONTAINER);
+ activeAlarmSchema = Inference.ofDataTreePath(schemaContext, ORAN_ACTIVE_ALARM_CONTAINER);
+
+ capabilities = mock(Capabilities.class);
+ domAccessor = mock(NetconfDomAccessor.class);
+ when(domAccessor.getCapabilites()).thenReturn(capabilities);
+ when(capabilities.isSupportingNamespaceAndRevision(
+ QNameModule.create(XMLNamespace.of(OnapSystem.NAMESPACE), Revision.of("2022-11-04")))).thenReturn(true);
+ onapSystem = OnapSystem.getModule(domAccessor);
+ when(capabilities.isSupportingNamespaceAndRevision(
+ QNameModule.create(XMLNamespace.of(ORANFM.NAMESPACE), Revision.of("2022-08-15")))).thenReturn(true);
+ oranfm = ORANFM.getModule(domAccessor);
+
}
@AfterClass
@@ -91,12 +120,14 @@ public class TestORanDOMToInternalDataModel {
schemaContext = null;
hwContainerSchema = null;
systemSchema = null;
+ activeAlarmSchema = null;
}
@Test
public void testIetfHardwareFromXML() throws XMLStreamException, URISyntaxException, IOException, SAXException {
- final InputStream resourceAsStream = TestORanDOMToInternalDataModel.class.getResourceAsStream("/ietf-hardware.xml");
+ final InputStream resourceAsStream =
+ TestORanDOMToInternalDataModel.class.getResourceAsStream("/ietf-hardware.xml");
/*
* final XMLInputFactory factory = XMLInputFactory.newInstance();
@@ -121,11 +152,11 @@ public class TestORanDOMToInternalDataModel {
inventoryList.stream().filter(inventory -> inventory.getTreeLevel() == null).count());
}
- @Ignore //TODO
@Test
public void testIetfSystemFromXML() throws XMLStreamException, URISyntaxException, IOException, SAXException {
- final InputStream resourceAsStream = TestORanDOMToInternalDataModel.class.getResourceAsStream("/onap-system.xml");
+ final InputStream resourceAsStream =
+ TestORanDOMToInternalDataModel.class.getResourceAsStream("/onap-system.xml");
final XMLStreamReader reader = UntrustedXML.createXMLStreamReader(resourceAsStream);
@@ -140,9 +171,10 @@ public class TestORanDOMToInternalDataModel {
NormalizedNode transformedInput = result.getResult();
ContainerNode cn = (ContainerNode) transformedInput;
- AugmentationIdentifier onapSystemIID = YangInstanceIdentifier.AugmentationIdentifier.create(
- Sets.newHashSet(ORanDeviceManagerQNames.ONAP_SYSTEM_NAME, ORanDeviceManagerQNames.ONAP_SYSTEM_WEB_UI));
- Optional<Guicutthrough> gc = ORanDOMToInternalDataModel.getGuicutthrough(cn.getChildByArg(onapSystemIID));
+ AugmentationNode gcData = (AugmentationNode) cn.childByArg(
+ YangInstanceIdentifier.AugmentationIdentifier.create(Sets.newHashSet(onapSystem.get().getName(),
+ onapSystem.get().getWebUi(), onapSystem.get().getGeoLocation())));
+ Optional<Guicutthrough> gc = ORanDOMToInternalDataModel.getGuicutthrough(gcData, onapSystem.get());
assertEquals(gc.isPresent(), true);
}
@@ -151,23 +183,40 @@ public class TestORanDOMToInternalDataModel {
public void testORANFault() {
ContainerNode cn = createORANDOMFault();
NetconfDeviceNotification faultNotif = new NetconfDeviceNotification(cn, Instant.now());
- FaultlogEntity fle = ORanDOMToInternalDataModel.getFaultLog(faultNotif, nodeId, 1);
+ FaultlogEntity fle = ORanDOMToInternalDataModel.getFaultLog(faultNotif, oranfm.get(), nodeId, 1);
assertEquals(fle.getId(), "47");
}
+ @Test
+ public void testORANActiveAlarms() throws XMLStreamException, URISyntaxException, IOException, SAXException {
+ final InputStream resourceAsStream =
+ TestORanDOMToInternalDataModel.class.getResourceAsStream("/oran-fm-active-alarm.xml");
+
+ final XMLStreamReader reader = UntrustedXML.createXMLStreamReader(resourceAsStream);
+ final NormalizedNodeResult result = new NormalizedNodeResult();
+ final NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result);
+
+ final XmlParserStream xmlParser = XmlParserStream.create(streamWriter, activeAlarmSchema);
+ xmlParser.parse(reader);
+
+ xmlParser.flush();
+ xmlParser.close();
+ NormalizedNode transformedInput = result.getResult();
+ ContainerNode cn = (ContainerNode) transformedInput;
+
+ UnkeyedListNode activeAlarmsList =
+ (UnkeyedListNode) cn.childByArg(new NodeIdentifier(oranfm.get().getFaultActiveAlarmsQName()));
+ for (UnkeyedListEntryNode activeAlarmEntry : activeAlarmsList.body())
+ ORanDOMToInternalDataModel.getFaultLog(activeAlarmEntry, oranfm.get(), new NodeId("nSky"), Integer.valueOf(0));
+ }
+
public static ContainerNode createORANDOMFault() {
- final QName fault_id = QName.create(ORanDeviceManagerQNames.ORAN_FM_FAULT_ID, "fault-id");
- final QName fault_source = QName.create(ORanDeviceManagerQNames.ORAN_FM_FAULT_SOURCE, "fault-source");
- final QName fault_severity = QName.create(ORanDeviceManagerQNames.ORAN_FM_FAULT_SEVERITY, "fault-severity");
- final QName is_cleared = QName.create(ORanDeviceManagerQNames.ORAN_FM_FAULT_IS_CLEARED, "is-cleared");
- final QName fault_text = QName.create(ORanDeviceManagerQNames.ORAN_FM_FAULT_TEXT, "fault-text");
- return Builders.containerBuilder()
- .withNodeIdentifier(NodeIdentifier.create(ORanDeviceManagerQNames.ORAN_FM_ALARM_NOTIF))
- .withChild(ImmutableNodes.leafNode(fault_id, "47"))
- .withChild(ImmutableNodes.leafNode(fault_source, "Slot-2-Port-B"))
- .withChild(ImmutableNodes.leafNode(fault_severity, "MAJOR"))
- .withChild(ImmutableNodes.leafNode(is_cleared, "true"))
- .withChild(ImmutableNodes.leafNode(fault_text, "CPRI Port Down")).build();
+ return Builders.containerBuilder().withNodeIdentifier(NodeIdentifier.create(oranfm.get().getAlarmNotifQName()))
+ .withChild(ImmutableNodes.leafNode(oranfm.get().getFaultIdQName(), "47"))
+ .withChild(ImmutableNodes.leafNode(oranfm.get().getFaultSourceQName(), "Slot-2-Port-B"))
+ .withChild(ImmutableNodes.leafNode(oranfm.get().getFaultSeverityQName(), "MAJOR"))
+ .withChild(ImmutableNodes.leafNode(oranfm.get().getFaultIsClearedQName(), "true"))
+ .withChild(ImmutableNodes.leafNode(oranfm.get().getFaultTextQName(), "CPRI Port Down")).build();
}
public static class NetconfDeviceNotification implements DOMNotification, DOMEvent {
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanNetworkElementFactory.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanNetworkElementFactory.java
index 2ca2ee445..cad0994cc 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanNetworkElementFactory.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanNetworkElementFactory.java
@@ -17,83 +17,110 @@
*/
package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+import com.google.common.io.Files;
+import java.io.File;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.Optional;
import org.junit.After;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.config.ORanDMConfig;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.util.ORanDeviceManagerQNames;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.yangspecs.ORANFM;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.yangspecs.OnapSystem;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfDomAccessor;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.common.Revision;
+import org.opendaylight.yangtools.yang.common.XMLNamespace;
public class TestORanNetworkElementFactory {
private static String NODEIDSTRING = "nSky";
private static NetconfAccessor accessor;
+ private static NetconfDomAccessor domAccessor;
private static DeviceManagerServiceProvider serviceProvider;
private static Capabilities capabilities;
private static VESCollectorService vesCollectorService;
private static FaultService faultService;
private static WebsocketManagerService notificationService;
private static DataProvider databaseService;
+ private static ORanDMConfig oranDmConfig;
+ private static ConfigurationFileRepresentation oranCfg;
private static NodeId nodeId = new NodeId(NODEIDSTRING);
- @BeforeClass
- public static void init() throws InterruptedException, IOException {
- NetconfBindingAccessor bindingAccessor = mock(NetconfBindingAccessor.class);
- when(bindingAccessor.getTransactionUtils()).thenReturn(mock(TransactionUtils.class));
- when(bindingAccessor.getNodeId()).thenReturn(nodeId);
+ private static String fileName = "test1.properties";
+ // @formatter:off
+ private static final String TESTCONFIG_CONTENT = "[ORAN-SUPERVISION]\n"
+ + "supervision-notification-interval=60\n"
+ + "guard-timer-overhead=10\n"
+ + "";
+ // @formatter:on
- NetconfDomAccessor domAccessor = mock(NetconfDomAccessor.class);
- when(domAccessor.getNodeId()).thenReturn(nodeId);
- capabilities = mock(Capabilities.class);
- //accessor = mock(NetconfBindingAccessor.class);
+ @BeforeClass
+ public static void init() throws InterruptedException, IOException {
accessor = mock(NetconfAccessor.class);
+ domAccessor = mock(NetconfDomAccessor.class);
+ capabilities = mock(Capabilities.class);
serviceProvider = mock(DeviceManagerServiceProvider.class);
vesCollectorService = mock(VESCollectorService.class);
faultService = mock(FaultService.class);
notificationService = mock(WebsocketManagerService.class);
databaseService = mock(DataProvider.class);
+ oranDmConfig = mock(ORanDMConfig.class);
+ when(domAccessor.getCapabilites()).thenReturn(capabilities);
+ when(domAccessor.getNodeId()).thenReturn(nodeId);
when(accessor.getCapabilites()).thenReturn(capabilities);
- when(accessor.getNetconfBindingAccessor()).thenReturn(Optional.of(bindingAccessor));
when(accessor.getNetconfDomAccessor()).thenReturn(Optional.of(domAccessor));
when(serviceProvider.getFaultService()).thenReturn(faultService);
when(serviceProvider.getWebsocketService()).thenReturn(notificationService);
when(serviceProvider.getDataProvider()).thenReturn(databaseService);
when(serviceProvider.getVESCollectorService()).thenReturn(vesCollectorService);
+ when(capabilities.isSupportingNamespaceAndRevision(
+ QNameModule.create(XMLNamespace.of(ORANFM.NAMESPACE), Revision.of("2022-08-15")))).thenReturn(true);
+ when(capabilities.isSupportingNamespaceAndRevision(
+ QNameModule.create(XMLNamespace.of(OnapSystem.NAMESPACE), Revision.of("2022-11-04")))).thenReturn(true);
+ Files.asCharSink(new File(fileName), StandardCharsets.UTF_8).write(TESTCONFIG_CONTENT);
+ oranCfg = new ConfigurationFileRepresentation(fileName);
}
@Test
public void testCreateORANHWComponent() throws Exception {
- when(accessor.getCapabilites().isSupportingNamespace(ORanDeviceManagerQNames.ORAN_HW_COMPONENT)).thenReturn(true);
- ORanNetworkElementFactory factory = new ORanNetworkElementFactory();
+ when(domAccessor.getCapabilites().isSupportingNamespace(ORanDeviceManagerQNames.ORAN_HW_COMPONENT)).thenReturn(true);
+ ORanNetworkElementFactory factory = new ORanNetworkElementFactory(oranCfg, oranDmConfig);
assertTrue((factory.create(accessor, serviceProvider)).isPresent());
}
@Test
public void testCreateNone() throws Exception {
- when(accessor.getCapabilites().isSupportingNamespace(ORanDeviceManagerQNames.ORAN_HW_COMPONENT)).thenReturn(false);
- ORanNetworkElementFactory factory = new ORanNetworkElementFactory();
+ when(domAccessor.getCapabilites().isSupportingNamespace(ORanDeviceManagerQNames.ORAN_HW_COMPONENT)).thenReturn(false);
+ ORanNetworkElementFactory factory = new ORanNetworkElementFactory(oranCfg, oranDmConfig);
assertTrue(!(factory.create(accessor, serviceProvider).isPresent()));
}
@After
public void cleanUp() throws Exception {
+ File file = new File(fileName);
+ if (file.exists()) {
+ System.out.println("File exists, Deleting it");
+ file.delete();
+ }
}
}
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanRegistrationToVESpnfRegistration.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanRegistrationToVESpnfRegistration.java
index b46595293..ad1fcede3 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanRegistrationToVESpnfRegistration.java
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanRegistrationToVESpnfRegistration.java
@@ -22,12 +22,13 @@
package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom;
import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.vesmapper.ORanRegistrationToVESpnfRegistrationMapper;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorCfgService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESCommonEventHeaderPOJO;
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/resources/o-ran-fm@2022-08-15.yang b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/resources/o-ran-fm@2022-08-15.yang
new file mode 100644
index 000000000..2abcc1ecc
--- /dev/null
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/resources/o-ran-fm@2022-08-15.yang
@@ -0,0 +1,153 @@
+module o-ran-fm {
+ yang-version 1.1;
+ namespace "urn:o-ran:fm:1.0";
+ prefix o-ran-fm;
+
+ import ietf-yang-types {
+ prefix yang;
+ revision-date 2013-07-15;
+ }
+
+ organization
+ "O-RAN Alliance";
+ contact
+ "www.o-ran.org";
+ description
+ "This module defines alarm reporting mechanism.
+
+ Copyright 2019 the O-RAN Alliance.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the above disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the above disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the Members of the O-RAN Alliance nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.";
+
+ revision 2022-08-15 {
+ description
+ "version 1.0.0
+
+ 1) imported model from xRAN
+ 2) changed namespace and reference from xran to o-ran";
+ reference
+ "ORAN-WG4.M.0-v01.00";
+ }
+
+ grouping alarm {
+ description
+ "Gropuping which can uniquely identify alarm";
+ leaf fault-id {
+ type uint16;
+ mandatory true;
+ description
+ "Fault specific Id that identifies the fault.";
+ }
+
+ leaf fault-source {
+ type string {
+ length "1..255";
+ }
+ mandatory true;
+ description
+ "Represents the Object or source that is suspected to be faulty.";
+ }
+
+ list affected-objects {
+ min-elements 1;
+ max-elements 100;
+ description
+ "List of affected-objects";
+ leaf name {
+ type string {
+ length "1..255";
+ }
+ mandatory true;
+ description
+ "Represents the Object or source that is suspected to be affected by this fault";
+ }
+ }
+
+ leaf fault-severity {
+ type enumeration {
+ enum "CRITICAL" {
+ description
+ "Critical alarm means that this device is not able to perform any further service";
+ }
+ enum "MAJOR" {
+ description
+ "Major alarm appeared on the device";
+ }
+ enum "MINOR" {
+ description
+ "Minor alarm appeared on the device";
+ }
+ enum "WARNING" {
+ description
+ "Warning is being reported by the device";
+ }
+ }
+ mandatory true;
+ description
+ "Fault severity defines the severity level of the fault. A notification, whose fault severity has the value 'warning',
+ is a special type of an alarm notification. For these alarm notifications,
+ the Master Agent does not expect to receive a clear alarm notification.";
+ }
+
+ leaf is-cleared {
+ type boolean;
+ mandatory true;
+ description
+ "Fault state determines the type of the event. Not used if faultSeverity is WARNING.";
+ }
+
+ leaf fault-text {
+ type string {
+ length "0..255";
+ }
+ description
+ "Textual description of the fault.";
+ }
+
+ leaf event-time {
+ type yang:date-and-time;
+ mandatory true;
+ description
+ "Timestamp to indicate the time when the fault is detected/cleared.";
+ }
+ }
+
+ container active-alarm-list {
+ config false;
+ description
+ "List of currently active alarms. An alarm is removed from this table when the state transitions to clear.";
+ list active-alarms {
+ description
+ "List of currenty active alarms";
+ uses alarm;
+ }
+ }
+
+ notification alarm-notif {
+ description
+ "Notification sent on initial alarm creation, as well as any time the alarm changes state, including clear";
+ uses alarm;
+ }
+} \ No newline at end of file
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/resources/oran-fm-active-alarm.xml b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/resources/oran-fm-active-alarm.xml
new file mode 100644
index 000000000..263a75856
--- /dev/null
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/resources/oran-fm-active-alarm.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<active-alarm-list xmlns="urn:o-ran:fm:1.0">
+ <active-alarms>
+ <fault-id>10001</fault-id>
+ <is-cleared>false</is-cleared>
+ <event-time>2021-03-18T19:51:50.4Z</event-time>
+ <affected-objects>
+ <name>slot0-logical0</name>
+ </affected-objects>
+ <fault-severity>MAJOR</fault-severity>
+ <fault-source>/ietf-hardware:hardware/component[name='slot0-logical0']</fault-source>
+ <fault-text>cpriPortDown</fault-text>
+ </active-alarms>
+ <active-alarms>
+ <fault-id>10002</fault-id>
+ <is-cleared>false</is-cleared>
+ <event-time>2021-03-18T19:52:50.4Z</event-time>
+ <affected-objects>
+ <name>slot2-logical2</name>
+ </affected-objects>
+ <fault-severity>MAJOR</fault-severity>
+ <fault-source>/ietf-hardware:hardware/component[name='slot2-logical2']</fault-source>
+ <fault-text>cpriPortDown</fault-text>
+ </active-alarms>
+</active-alarm-list>