summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager-o-ran-sc/o-ran
diff options
context:
space:
mode:
authorRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2022-04-20 09:45:54 +0530
committerRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2022-04-20 09:47:33 +0530
commitd3f6bbcb21f8549f857b0167a75d5b9014e4ab88 (patch)
tree6ef0698814d38d67c4feda250bf10acbba02f7cd /sdnr/wt/devicemanager-o-ran-sc/o-ran
parent763fab14b1205be8582a1bb913bbd685cdf66278 (diff)
Use DOM API for ORAN Devicemanager
All functions of Devicemanager are upgraded to use DOM API Issue-ID: CCSDK-3636 Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> Change-Id: If8b401d513055e1167ed0824e596ffa3ad7bac2f Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/devicemanager-o-ran-sc/o-ran')
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/feature/pom.xml1
-rwxr-xr-xsdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/installer/pom.xml1
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/model/pom.xml1
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/pom.xml22
-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/binding/ORanChangeNotificationListener.java138
-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/binding/ORanFaultNotificationListener.java166
-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/binding/ORanFaultToVESFaultMapper.java164
-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/binding/ORanNetworkElement.java278
-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/binding/ORanNotifToVESEventAssembly.java99
-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/binding/ORanToInternalDataModel.java276
-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/DOMNotificationToXPath.java375
-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.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/binding/DeviceManagerORanImpl.java)3
-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/ORanDMDOMUtility.java80
-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/ORanDOMChangeNotificationListener.java178
-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/ORanDOMFaultToVESFaultMapper.java3
-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.java1
-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.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/startup/ORanNetworkElementFactory.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/impl/dom/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/binding/ORanRegistrationToVESpnfRegistrationMapper.java)7
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/OperatorStateBuilder.java24
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceBuilder.java24
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceMatchBuilder.java24
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/SeverityWithClearBuilder.java24
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/alarms/ControlMaxAlarmStatusChangesBuilder.java24
-rw-r--r--sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml2
-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/binding/ComponentHelper.java179
-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/binding/TestAlarmNotif.java88
-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/binding/TestHardwareClass.java24
-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/binding/TestORanChangeNotificationListener.java111
-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/binding/TestORanFaultNotificationListener.java115
-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/binding/TestORanNetworkElement.java115
-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/binding/TestORanToInternalDataModel.java96
-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/TestDeviceManagerORanImpl.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/TestORANInventory.java250
-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/TestORANReadHardware.java383
-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.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/TestORanDOMNetworkElement.java1
-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.java272
-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.java1
-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.java115
39 files changed, 542 insertions, 3133 deletions
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/feature/pom.xml b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/feature/pom.xml
index 5b71decd5..b0124e148 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/feature/pom.xml
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/feature/pom.xml
@@ -22,6 +22,7 @@
~ ============LICENSE_END=======================================================
~
-->
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/installer/pom.xml b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/installer/pom.xml
index bf86e22cb..0cea8a065 100755
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/installer/pom.xml
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/installer/pom.xml
@@ -22,6 +22,7 @@
~ ============LICENSE_END=======================================================
~
-->
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/model/pom.xml b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/model/pom.xml
index 994501be2..d7648a41e 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/model/pom.xml
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/model/pom.xml
@@ -22,6 +22,7 @@
~ ============LICENSE_END=======================================================
~
-->
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/pom.xml b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/pom.xml
index 83c4dcf49..cd16c9105 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/pom.xml
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/pom.xml
@@ -22,6 +22,7 @@
~ ============LICENSE_END=======================================================
~
-->
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -122,6 +123,27 @@
<filtering>true</filtering>
</resource>
</resources>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-maven-plugin</artifactId>
+ <version>7.0.9</version>
+ <executions>
+ <execution>
+ <id>binding</id>
+ <phase>none</phase>
+ <goals>
+ <goal>generate-sources</goal>
+ </goals>
+ <configuration>
+ <inspectDependencies>true</inspectDependencies>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
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/binding/ORanChangeNotificationListener.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/binding/ORanChangeNotificationListener.java
deleted file mode 100644
index abed01a44..000000000
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanChangeNotificationListener.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.binding;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import java.util.List;
-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.service.DeviceManagerServiceProvider;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationProxyParser;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService;
-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;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.IetfNetconfNotificationsListener;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfCapabilityChange;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfConfigChange;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfConfirmedCommit;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfSessionEnd;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfSessionStart;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.netconf.config.change.Edit;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogEntity;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Listener for change notifications
- */
-public class ORanChangeNotificationListener implements IetfNetconfNotificationsListener {
-
- private static final Logger log = LoggerFactory.getLogger(ORanChangeNotificationListener.class);
-
- private final NetconfBindingAccessor netconfAccessor;
- private final DataProvider databaseService;
- private final NotificationService notificationService;
- private final VESCollectorService vesCollectorService;
- private final NotificationProxyParser notificationProxyParser;
- private ORanNotifToVESEventAssembly mapper = null;
-
- private static int sequenceNo = 0;
-
- public ORanChangeNotificationListener(NetconfBindingAccessor netconfAccessor,
- DeviceManagerServiceProvider serviceProvider) {
- this.netconfAccessor = netconfAccessor;
- this.databaseService = serviceProvider.getDataProvider();
- this.notificationService = serviceProvider.getNotificationService();
- this.vesCollectorService = serviceProvider.getVESCollectorService();
- this.notificationProxyParser = vesCollectorService.getNotificationProxyParser();
- }
-
- @Override
- public void onNetconfConfirmedCommit(NetconfConfirmedCommit notification) {
- log.info("onNetconfConfirmedCommit {}", notification);
- }
-
- @Override
- public void onNetconfSessionStart(NetconfSessionStart notification) {
- log.info("onNetconfSessionStart {}", notification);
- }
-
- @Override
- public void onNetconfSessionEnd(NetconfSessionEnd notification) {
- log.info("onNetconfSessionEnd {}", notification);
- }
-
- @Override
- public void onNetconfCapabilityChange(NetconfCapabilityChange notification) {
- log.info("onNetconfCapabilityChange {}", notification);
- }
-
- @Override
- public void onNetconfConfigChange(NetconfConfigChange notification) {
- log.info("onNetconfConfigChange (1) {}", notification.toString());
-
- StringBuffer sb = new StringBuffer();
- List<Edit> editList = notification.nonnullEdit();
- for (Edit edit : editList) {
- if (sb.length() > 0) {
- sb.append(", ");
- }
- sb.append(edit);
-
- InstanceIdentifier<?> target = edit.getTarget();
- if (target != null) {
- log.info("TARGET: {} {}", target.getClass(), target.getTargetType());
- for (PathArgument pa : target.getPathArguments()) {
- log.info("PathArgument {} Type {}", pa, pa.getType().getFields());
- }
-
- EventlogEntity eventLogEntity1 = new EventlogBuilder().setNodeId(netconfAccessor.getNodeId().getValue())
- .setCounter(sequenceNo++).setTimestamp(NetconfTimeStampImpl.getConverter().getTimeStamp())
- .setObjectId(target.getTargetType().getCanonicalName()).setAttributeName("N.A")
- .setSourceType(SourceType.Netconf).setNewValue(String.valueOf(edit.getOperation())).build();
- databaseService.writeEventLog(eventLogEntity1);
- }
- }
- log.info("onNetconfConfigChange (2) {}", sb);
-
- if (vesCollectorService.getConfig().isVESCollectorEnabled()) {
- if (mapper == null) {
- this.mapper = new ORanNotifToVESEventAssembly(netconfAccessor, vesCollectorService);
- }
- VESCommonEventHeaderPOJO header =
- mapper.createVESCommonEventHeader(notificationProxyParser.getTime(notification),
- NetconfConfigChange.class.getSimpleName(), sequenceNo);
- VESNotificationFieldsPOJO body =
- mapper.createVESNotificationFields(notificationProxyParser.parseNotificationProxy(notification),
- NetconfConfigChange.class.getSimpleName());
- try {
- vesCollectorService.publishVESMessage(vesCollectorService.generateVESEvent(header, body));
- } catch (JsonProcessingException e) {
- log.warn("Exception while generating JSON object ", 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/binding/ORanFaultNotificationListener.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/binding/ORanFaultNotificationListener.java
deleted file mode 100644
index d03b39480..000000000
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanFaultNotificationListener.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.binding;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import java.time.Instant;
-import java.time.format.DateTimeParseException;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Objects;
-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.dataprovider.model.NetconfTimeStamp;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl;
-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;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESFaultFieldsPOJO;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESMessage;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
-import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.hardware.Component;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
-import org.opendaylight.yang.gen.v1.urn.o.ran.fm._1._0.rev190204.AlarmNotif;
-import org.opendaylight.yang.gen.v1.urn.o.ran.fm._1._0.rev190204.ORanFmListener;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ORanFaultNotificationListener implements ORanFmListener {
-
- private static final Logger LOG = LoggerFactory.getLogger(ORanFaultNotificationListener.class);
-
- private final @NonNull NetconfBindingAccessor netconfAccessor;
- private final @NonNull VESCollectorService vesCollectorService;
- private final @NonNull ORanFaultToVESFaultMapper mapper;
- private final @NonNull FaultService faultService;
- private final @NonNull WebsocketManagerService websocketManagerService;
- private final @NonNull DataProvider databaseService;
- private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStampImpl.getConverter();
-
- private Integer counter; //Local counter is assigned to Notifications
-
- public ORanFaultNotificationListener(@NonNull NetconfBindingAccessor netconfAccessor,
- @NonNull VESCollectorService vesCollectorService, @NonNull FaultService faultService,
- @NonNull WebsocketManagerService websocketManagerService, @NonNull DataProvider databaseService) {
- this.netconfAccessor = Objects.requireNonNull(netconfAccessor);
- this.vesCollectorService = Objects.requireNonNull(vesCollectorService);
- this.faultService = Objects.requireNonNull(faultService);
- this.websocketManagerService = Objects.requireNonNull(websocketManagerService);
- this.databaseService = Objects.requireNonNull(databaseService);
-
- this.mapper = new ORanFaultToVESFaultMapper(netconfAccessor.getNodeId(), vesCollectorService,
- AlarmNotif.class.getSimpleName());
- this.counter = 0;
- }
-
- /**
- * Gets the mfg name, mode-name and Uuid of the root component (Ex: Chassis.)
- * In cases where there are multiple root components i.e., components with no parent,
- * the Uuid of the last occurred component from the componentList will be considered.
- * Till now we haven't seen Uuid set for root components, so not an issue for now.
- * @param componentList
- */
- public void setComponentList(Collection<Component> componentList) {
- for (Component component : ORanToInternalDataModel.getRootComponents(componentList)) {
- mapper.setMfgName(component.getMfgName());
- mapper.setUuid(component.getUuid()!=null?component.getUuid().getValue():netconfAccessor.getNodeId().getValue());
- mapper.setModelName(component.getModelName());
- }
- }
-
- @Override
- public void onAlarmNotif(AlarmNotif notification) {
-
- LOG.debug("onAlarmNotif {}", notification.getClass().getSimpleName());
- counter++;
-
- // Send devicemanager specific notification for database and ODLUX
- Instant eventTimeInstant = ORanToInternalDataModel.getInstantTime(notification.getEventTime());
- faultService.faultNotification(
- ORanToInternalDataModel.getFaultLog(notification, netconfAccessor.getNodeId(), counter));
- // Send model specific notification to WebSocketManager
- websocketManagerService.sendNotification(notification, netconfAccessor.getNodeId(), AlarmNotif.QNAME);
-
- try {
- if (vesCollectorService.getConfig().isVESCollectorEnabled()) {
- VESCommonEventHeaderPOJO header = mapper.mapCommonEventHeader(notification, eventTimeInstant, counter);
- VESFaultFieldsPOJO body = mapper.mapFaultFields(notification);
- VESMessage vesMsg = vesCollectorService.generateVESEvent(header, body);
- vesCollectorService.publishVESMessage(vesMsg);
- LOG.info("VES Message is {}",vesMsg.getMessage());
- writeToEventLog(vesMsg.getMessage(), eventTimeInstant, AlarmNotif.QNAME.toString(), counter);
- }
- } catch (JsonProcessingException | DateTimeParseException e) {
- LOG.debug("Can not convert event into VES message {}", notification, e);
- }
- }
-
- private void writeToEventLog(String data, Instant instant, String notificationName,
- int sequenceNo) {
- EventlogBuilder eventlogBuilder = new EventlogBuilder();
-
- eventlogBuilder.setObjectId("Device");
- eventlogBuilder.setCounter(sequenceNo);
- eventlogBuilder.setAttributeName(notificationName);
- eventlogBuilder.setNodeId(netconfAccessor.getNodeId().getValue());
- String eventLogMsgLvl = vesCollectorService.getConfig().getEventLogMsgDetail();
- if (eventLogMsgLvl.equalsIgnoreCase("SHORT")) {
- data = getShortEventLogMessage(data);
- } else if (eventLogMsgLvl.equalsIgnoreCase("MEDIUM")) {
- data = getMediumEventLogMessage(data);
- } else if (eventLogMsgLvl.equalsIgnoreCase("LONG")) {
- // do nothing, data already contains long message
- } else { // Unknown value, default to "SHORT"
- data = getShortEventLogMessage(data);
- }
- eventlogBuilder.setNewValue(data);
- eventlogBuilder.setSourceType(SourceType.Netconf);
-
- Date eventDate = Date.from(instant);
- eventlogBuilder.setTimestamp(new DateAndTime(NETCONFTIME_CONVERTER.getTimeStamp(eventDate)));
-
- databaseService.writeEventLog(eventlogBuilder.build());
- }
-
- private String getShortEventLogMessage(String data) {
- try {
- JSONObject jsonObj = new JSONObject(data);
- String domain = jsonObj.getJSONObject("event").getJSONObject("commonEventHeader").getString("domain");
- String eventId = jsonObj.getJSONObject("event").getJSONObject("commonEventHeader").getString("eventId");
- return "domain:" + domain + " eventId:" + eventId;
- } catch (JSONException e) {
- LOG.debug("{}", e);
- return "Invalid message received";
- }
- }
-
- private String getMediumEventLogMessage(String data) {
- try {
- JSONObject jsonObj = new JSONObject(data);
- return jsonObj.getJSONObject("event").getJSONObject("commonEventHeader").toString();
- } catch (JSONException e) {
- LOG.debug("{}", e);
- return "Invalid message received";
- }
- }
-}
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/binding/ORanFaultToVESFaultMapper.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/binding/ORanFaultToVESFaultMapper.java
deleted file mode 100644
index f5873df96..000000000
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanFaultToVESFaultMapper.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : ccsdk features
- * ================================================================================
- * Copyright (C) 2021 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.impl.binding;
-
-import java.time.Instant;
-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;
-import org.opendaylight.yang.gen.v1.urn.o.ran.fm._1._0.rev190204.AlarmNotif;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-//@formatter:off
-/*
- * Maps ORAN Fault fields to VES fault domain fields and VES commonEventHeader fields
- *
- *
- * VES Fields Mapping
- * ---------- -------
- * domain "fault"
- * eventId "nt:network-topology/nt:topology/nt:node/nt:node-id"
- * eventName "nt:network-topology/nt:topology/nt:node/nt:node-id"
- * eventType "O-RAN-RU-Fault"
- * lastEpochMicrosec TimeStamp represented by <eventTime> field in NetConf notification header in unix time format - as microseconds elapsed since 1 Jan 1970 not including leap seconds.
- * nfcNamingCode always ""
- * nfNamingCode always ""
- * nfVendorName /ietf-hardware:hardware/component[not(parent)][1]/mfg-name
- * priority "Normal"
- * reportingEntityId The OAM-Controller identifier with in the SMO - e.g. the fully qualified domain name or IP-Address.
- * reportingEntityName as configured by helm charts for the OpenDaylight cluster name ??????
- * sequence As per NetConf notification increasing sequence number as unsigned integer 32 bits. The value is reused in the eventId field.
- * sourceId Value of ietf-hardware (RFC8348) /hardware/component[not(parent)][1]/uuid or 'nt:network-topology/nt:topology/nt:node/nt:node-id' if ietf component not found.
- * sourceName "nt:network-topology/nt:topology/nt:node/nt:node-id"
- * startEpochMicrosec Current OAM-Controller Node timestamp in unix time format - as microseconds elapsed since 1 Jan 1970 not including leap seconds.
- * timeZoneOffset Static text: "+00:00"
- * version "4.1"
- * vesEventListenerVersion "7.2.1"
- *
- *
- * alarmAdditionalInformation
- * alarmCondition Value of "o-ran-fm:alarm-notif/fault-id"
- * alarmInterfaceA Value of "o-ran-fm:alarm-notif/fault-source"
- * eventCategory Static text "O-RU failure"
- * eventSeverity Value of "o-ran-fm:alarm-notif/fault-severity". But if "o-ran-fm:alarm-notif/is-cleared" then "NORMAL"
- * eventSourceType The value of ietf-hardware (RFC8348) /hardware/component[not(parent)][1]/model-name or "O-RU" if not found.
- * faultFieldsVersion "4.0"
- * specificProblem A mapping of the fault-id to its description according to O-RAN OpenFronthaul specification.
- * vfStatus "Active"
- *
- */
-//@formatter:on
-
-public class ORanFaultToVESFaultMapper {
-
- @SuppressWarnings("unused")
- private static final Logger LOG = LoggerFactory.getLogger(ORanFaultToVESFaultMapper.class);
- private static final String VES_EVENT_DOMAIN = "fault";
- private static final String VES_EVENTTYPE = "ORAN_Fault";
- private static final String VES_EVENT_PRIORITY = "Normal";
- private static final String VES_EVENT_CATEGORY = "O-RU Failure";
- private static final String VES_FAULT_FIELDS_VERSION = "4.0";
- private static final String VES_FAULT_FIELDS_VFSTATUS = "Active"; //virtual function status
-
- private final VESCollectorService vesProvider;
- private final String notifName; // Name
- private final String nodeIdString; // Sourcename
- private String mfgName;
- private String uuid;
- private String modelName;
-
- public ORanFaultToVESFaultMapper(NodeId nodeId, VESCollectorService vesCollectorService,
- String notifName) {
- this.nodeIdString = nodeId.getValue();
- this.vesProvider = vesCollectorService;
- this.notifName = notifName;
- }
-
- public void setMfgName(String mfgName) {
- this.mfgName= mfgName;
- }
-
- private String getMfgName() {
- return mfgName;
- }
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- private String getUuid() {
- return uuid;
- }
-
- public void setModelName(String modelName) {
- this.modelName = modelName;
- }
-
- private String getModelName() {
- return modelName;
- }
-
- public VESCommonEventHeaderPOJO mapCommonEventHeader(AlarmNotif notification, Instant eventTime, int sequenceNo) {
- VESCommonEventHeaderPOJO vesCEH = new VESCommonEventHeaderPOJO();
- vesCEH.setDomain(VES_EVENT_DOMAIN);
- vesCEH.setEventName(notifName);
- vesCEH.setEventType(VES_EVENTTYPE);
- vesCEH.setPriority(VES_EVENT_PRIORITY);
-
- String eventId;
-
- eventId = notifName + "-" + Long.toUnsignedString(sequenceNo);
-
- vesCEH.setEventId(eventId);
- vesCEH.setStartEpochMicrosec(eventTime.toEpochMilli() * 1000);
- vesCEH.setLastEpochMicrosec(eventTime.toEpochMilli() * 1000);
- vesCEH.setNfVendorName(getMfgName());
- vesCEH.setReportingEntityName(vesProvider.getConfig().getReportingEntityName());
- vesCEH.setSequence(sequenceNo);
- vesCEH.setSourceId(getUuid());
- vesCEH.setSourceName(nodeIdString);
-
- return vesCEH;
- }
-
- public VESFaultFieldsPOJO mapFaultFields(AlarmNotif alarmNotif) {
- VESFaultFieldsPOJO vesFaultFields = new VESFaultFieldsPOJO();
-
- vesFaultFields.setAlarmCondition(alarmNotif.getFaultId().toString());
- vesFaultFields.setAlarmInterfaceA(alarmNotif.getFaultSource());
- vesFaultFields.setEventCategory(VES_EVENT_CATEGORY);
- if (alarmNotif.getIsCleared()) {
- vesFaultFields.setEventSeverity("NORMAL");
- } else {
- vesFaultFields.setEventSeverity(alarmNotif.getFaultSeverity().getName());
- }
- vesFaultFields.setEventSourceType(getModelName());
- vesFaultFields.setFaultFieldsVersion(VES_FAULT_FIELDS_VERSION);
- vesFaultFields.setSpecificProblem(alarmNotif.getFaultText());
- 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/impl/binding/ORanNetworkElement.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/binding/ORanNetworkElement.java
deleted file mode 100644
index e16df1d1c..000000000
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanNetworkElement.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.binding;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.onap.ccsdk.features.sdnr.wt.common.YangHelper;
-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.service.DeviceManagerServiceProvider;
-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.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.Stream;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.StreamKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.Hardware;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.hardware.Component;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfCapabilityChange;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfConfigChange;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfConfirmedCommit;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfSessionEnd;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfSessionStart;
-import org.opendaylight.yang.gen.v1.urn.onap.system.rev201026.System1;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Guicutthrough;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Inventory;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementDeviceType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.NetconfCallhomeServer;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.AllowedDevices;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.Device;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.NotificationListener;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ORanNetworkElement implements NetworkElement {
-
- private static final Logger LOG = LoggerFactory.getLogger(ORanNetworkElement.class);
-
- public static final QName ONAP_SYSTEM =
- org.opendaylight.yang.gen.v1.urn.onap.system.rev201026.$YangModuleInfoImpl.getInstance().getName();
- private static final InstanceIdentifier<System1> SYSTEM1_IID = InstanceIdentifier
- .builder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.system.rev140806.System.class)
- .augmentation(System1.class).build();
-
- private final NetconfBindingAccessor netconfAccessor;
- private final Optional<NetconfBindingAccessor> netconfAccessorOpt;
-
- private final Optional<NetconfDomAccessor> netconfDomAccessor;
- private final DataProvider databaseService;
- private final ORanRegistrationToVESpnfRegistrationMapper mapper;
- private final VESCollectorService vesCollectorService;
-
- private ListenerRegistration<NotificationListener> oRanListenerRegistrationResult;
- //private @NonNull final ORanChangeNotificationListener oRanListener;
- private ListenerRegistration<NotificationListener> oRanFaultListenerRegistrationResult;
- private @NonNull final ORanFaultNotificationListener oRanFaultListener;
-
- //ORanNetworkElement(NetconfBindingAccessor netconfAccess, DeviceManagerServiceProvider serviceProvider) {
- ORanNetworkElement(NetconfAccessor netconfAccess, DeviceManagerServiceProvider serviceProvider) {
- LOG.info("Create {}", ORanNetworkElement.class.getSimpleName());
- // Read parameters
- this.netconfAccessorOpt = netconfAccess.getNetconfBindingAccessor();
- this.netconfAccessor = netconfAccessorOpt.get();
- this.netconfDomAccessor = netconfAccess.getNetconfDomAccessor();
- // Get services
- this.databaseService = serviceProvider.getDataProvider();
- this.vesCollectorService = serviceProvider.getVESCollectorService();
-
- this.mapper = new ORanRegistrationToVESpnfRegistrationMapper(netconfAccessor, vesCollectorService);
-
- // Register callbacks
- this.oRanListenerRegistrationResult = null;
- //this.oRanListener = new ORanChangeNotificationListener(netconfAccessor, serviceProvider);
-
- this.oRanFaultListenerRegistrationResult = null;
- this.oRanFaultListener = new ORanFaultNotificationListener(netconfAccessor, vesCollectorService,
- serviceProvider.getFaultService(), serviceProvider.getWebsocketService(), databaseService);
-
- }
-
- private Collection<Component> initialReadFromNetworkElement() {
- Collection<Component> componentList;
- Hardware hardware = readHardware();
- if (hardware != null) {
- componentList = YangHelper.getCollection(hardware.nonnullComponent());
- List<Inventory> inventoryList =
- ORanToInternalDataModel.getInventoryList(netconfAccessor.getNodeId(), componentList);
- databaseService.writeInventory(netconfAccessor.getNodeId().getValue(), inventoryList);
- } else {
- componentList = Collections.emptyList();
- }
-
- Optional<Guicutthrough> oGuicutthrough = ORanToInternalDataModel.getGuicutthrough(getOnapSystemData());
- if (oGuicutthrough.isPresent()) {
- databaseService.writeGuiCutThroughData(oGuicutthrough.get(), netconfAccessor.getNodeId().getValue());
- }
- return componentList;
- }
-
- @Override
- public NetworkElementDeviceType getDeviceType() {
- return NetworkElementDeviceType.ORAN;
- }
-
- @Override
- public void register() {
- // Read data from device
- Collection<Component> componentList = initialReadFromNetworkElement();
- oRanFaultListener.setComponentList(componentList);
- // Publish the mountpoint to VES if enabled
- publishMountpointToVES(componentList);
- // Register call back class for receiving notifications
- //this.oRanListenerRegistrationResult = netconfAccessor.doRegisterNotificationListener(oRanListener);
- this.oRanFaultListenerRegistrationResult = netconfAccessor.doRegisterNotificationListener(oRanFaultListener);
- // Register notifications stream
- /*if (netconfAccessor.isNotificationsRFC5277Supported()) {
- netconfAccessor.registerNotificationsStream();
- }*/
-
- QName[] notifications = { NetconfConfigChange.QNAME, NetconfConfirmedCommit.QNAME,
- NetconfSessionStart.QNAME, NetconfSessionEnd.QNAME, NetconfCapabilityChange.QNAME };
- //netconfDomAccessor.get().doRegisterNotificationListener(new ORanDOMChangeNotificationListener(netconfDomAccessor.get(), databaseService), notifications);
- // Output notification streams to LOG
- Map<StreamKey, Stream> streams = netconfDomAccessor.get().getNotificationStreamsAsMap();
- LOG.info("Available notifications streams: {}", streams);
- // Register to default stream
- netconfDomAccessor.get().invokeCreateSubscription();
- }
-
- @Override
- public void deregister() {
- if (oRanListenerRegistrationResult != null) {
- this.oRanListenerRegistrationResult.close();
- }
- if (oRanFaultListenerRegistrationResult != null) {
- this.oRanFaultListenerRegistrationResult.close();
- } ;
- databaseService.clearGuiCutThroughEntriesOfNode(getMountpointId());
- }
-
- @Override
- public NodeId getNodeId() {
- return netconfAccessor.getNodeId();
- }
-
- @Override
- public <L extends NetworkElementService> Optional<L> getService(Class<L> clazz) {
- return Optional.empty();
- }
-
- @Override
- public void warmstart() {}
-
- @Override
- public Optional<NetconfAccessor> getAcessor() {
- return Optional.of(netconfAccessor);
- }
-
- // Private functions
-
- private String getMountpointId() {
- return getNodeId().getValue();
- }
-
- // Read from device
- /**
- * Read system data with GUI cut through information from device if ONAP_SYSTEM YANG is supported.
- *
- * @return System1 data with GUI cut through information or null if not available.
- */
- private @Nullable System1 getOnapSystemData() {
- LOG.info("Get System1 for class {} from mountpoint {}", netconfAccessor.getNodeId().getValue());
- Capabilities x = netconfAccessor.getCapabilites();
- LOG.info("Capabilites: {}", x);
- if (x.isSupportingNamespace(ONAP_SYSTEM)) {
- @Nullable
- System1 res = netconfAccessor.getTransactionUtils().readData(netconfAccessor.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, SYSTEM1_IID);
- LOG.debug("Result of System1 = {}", res);
- return res;
- } else {
- LOG.debug("No GUI cut through support");
- return null;
- }
- }
-
- private Hardware readHardware() {
- final Class<Hardware> clazzPac = Hardware.class;
- LOG.info("DBRead Get hardware for class {} from mountpoint {}", clazzPac.getSimpleName(),
- netconfAccessor.getNodeId().getValue());
- InstanceIdentifier<Hardware> hardwareIID = InstanceIdentifier.builder(clazzPac).build();
- Hardware res = netconfAccessor.getTransactionUtils().readData(netconfAccessor.getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, hardwareIID);
- LOG.debug("Result of Hardware = {}", res);
- return res;
- }
-
- // VES related
- private void publishMountpointToVES(Collection<Component> componentList) {
-
- LOG.debug("In publishMountpointToVES()");
-
- /*
- * 1. Check if this device is in the list of allowed-devices. 2. If device
- * exists in allowed-devices, then create VES pnfRegistration event and publish
- * to VES
- */
- if (inAllowedDevices(getMountpointId())) {
- if (vesCollectorService.getConfig().isVESCollectorEnabled()) {
- for (Component component : ORanToInternalDataModel.getRootComponents(componentList)) {
- // Just get one component. At the moment we don't care which one. Also since
- // there is only one management address, we assume there will be only one
- // chassis.
- // If the device supports subtended configuration then it is assumed that the
- // Chassis containing the management interface will be the root component and
- // there will be only one root.
- /*VESCommonEventHeaderPOJO header = mapper.mapCommonEventHeader(component);
- VESPNFRegistrationFieldsPOJO body = mapper.mapPNFRegistrationFields(component);
- try {
- vesCollectorService.publishVESMessage(vesCollectorService.generateVESEvent(header, body));
- } catch (JsonProcessingException e) {
- LOG.warn("Error while serializing VES Event to String ", e);
- }*/
- }
- }
- }
- }
-
- private boolean inAllowedDevices(String mountpointName) {
- final InstanceIdentifier<AllowedDevices> ALL_DEVICES =
- InstanceIdentifier.create(NetconfCallhomeServer.class).child(AllowedDevices.class);
-
- AllowedDevices allowedDevices = netconfAccessor.getTransactionUtils().readData(
- netconfAccessor.getControllerBindingDataBroker(), LogicalDatastoreType.CONFIGURATION, ALL_DEVICES);
-
- if (allowedDevices != null) {
- Collection<Device> deviceList = YangHelper.getCollection(allowedDevices.nonnullDevice());
- for (Device device : deviceList) {
- LOG.info("Device in allowed-devices is - {}", device.getUniqueId());
- if (device.getUniqueId().equals(netconfAccessor.getNodeId().getValue())) {
- LOG.info("Mountpoint is part of allowed-devices list");
- return true;
- }
- }
- }
-
- LOG.info("Mountpoint {} is not part of allowed-devices list", mountpointName);
- return false;
- }
-
-}
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/binding/ORanNotifToVESEventAssembly.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/binding/ORanNotifToVESEventAssembly.java
deleted file mode 100644
index 6e31ffb6f..000000000
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanNotifToVESEventAssembly.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : ccsdk features
- * ================================================================================
- * Copyright (C) 2020 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.impl.binding;
-
-import java.time.Instant;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map.Entry;
-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;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ORanNotifToVESEventAssembly {
-
- private static final Logger log = LoggerFactory.getLogger(ORanNotifToVESEventAssembly.class);
- private static final String VES_EVENT_DOMAIN = "notification";
- private static final String VES_EVENTTYPE = "ORAN_notification";
- private static final String VES_EVENT_PRIORITY = "Normal";
- private NetconfBindingAccessor netconfAccessor;
- private VESCollectorService vesProvider;
-
- public ORanNotifToVESEventAssembly(NetconfBindingAccessor netconfAccessor, VESCollectorService vesProvider) {
- this.netconfAccessor = netconfAccessor;
- this.vesProvider = vesProvider;
- }
-
- // VES CommonEventHeader fields
- public VESCommonEventHeaderPOJO createVESCommonEventHeader(Instant time, String notificationTypeName,
- long sequenceNo) {
- VESCommonEventHeaderPOJO vesCEH = new VESCommonEventHeaderPOJO();
- vesCEH.setDomain(VES_EVENT_DOMAIN);
- vesCEH.setEventName(notificationTypeName);
- vesCEH.setEventType(VES_EVENTTYPE);
- vesCEH.setPriority(VES_EVENT_PRIORITY);
-
- String eventId;
-
- eventId = notificationTypeName + "-" + Long.toUnsignedString(sequenceNo);
-
- vesCEH.setEventId(eventId);
- vesCEH.setStartEpochMicrosec(time.toEpochMilli() * 1000);
- vesCEH.setLastEpochMicrosec(time.toEpochMilli() * 1000);
- vesCEH.setNfVendorName("ORAN");
- vesCEH.setReportingEntityName(vesProvider.getConfig().getReportingEntityName());
- vesCEH.setSequence(sequenceNo);
- vesCEH.setSourceId("ORAN");
- vesCEH.setSourceName(netconfAccessor.getNodeId().getValue());
- return vesCEH;
- }
-
- // Notification fields
- public VESNotificationFieldsPOJO createVESNotificationFields(HashMap<String, String> xPathFields,
- String notificationTypeName) {
- VESNotificationFieldsPOJO vesNotifFields = new VESNotificationFieldsPOJO();
-
- vesNotifFields.setChangeType(notificationTypeName);
- vesNotifFields.setChangeIdentifier(netconfAccessor.getNodeId().getValue());
-
- StringBuffer buf = new StringBuffer();
- Iterator<Entry<String, String>> it = xPathFields.entrySet().iterator();
- while (it.hasNext()) {
- Entry<String, String> pair = it.next();
- buf.append("\n" + pair.getKey() + " = " + pair.getValue());
- }
- log.info("Resultlist({}):{}", xPathFields.size(), buf.toString());
-
- ArrayList<HashMap<String, Object>> arrayOfNamedHashMap = new ArrayList<HashMap<String, Object>>();
- HashMap<String, Object> namedHashMap = new HashMap<String, Object>();
- namedHashMap.put("hashMap", xPathFields);
- namedHashMap.put("name", notificationTypeName);
- arrayOfNamedHashMap.add(namedHashMap);
- vesNotifFields.setArrayOfNamedHashMap(arrayOfNamedHashMap);
- return vesNotifFields;
-
- }
-}
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/binding/ORanToInternalDataModel.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/binding/ORanToInternalDataModel.java
deleted file mode 100644
index 2469e46b7..000000000
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanToInternalDataModel.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.binding;
-
-import java.time.Instant;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-import org.eclipse.jdt.annotation.Nullable;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana.hardware.rev180313.HardwareClass;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.hardware.Component;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
-import org.opendaylight.yang.gen.v1.urn.o.ran.fm._1._0.rev190204.Alarm.FaultSeverity;
-import org.opendaylight.yang.gen.v1.urn.o.ran.fm._1._0.rev190204.AlarmNotif;
-import org.opendaylight.yang.gen.v1.urn.onap.system.rev201026.System1;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogEntity;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Guicutthrough;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.GuicutthroughBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Inventory;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.InventoryBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.opendaylight.yangtools.yang.binding.CodeHelpers;
-import org.opendaylight.yangtools.yang.common.Uint32;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Convert data to data-provider model and perform consistency checks.<br>
- * <b>Component list characteristics:</b><br>
- * <ul>
- * <li>component list is a flat list tree structure specified
- * <li>via "component.getParent()":
- * <ul>
- * <li>If null we have a root element
- * <li>if not null it is a child element with generated child level<br>
- * </ul>
- * </ul>
- * Example of List:<br>
- *
- *
- */
-public class ORanToInternalDataModel {
-
- private static final Logger log = LoggerFactory.getLogger(ORanToInternalDataModel.class);
-
- public static List<Inventory> getInventoryList(NodeId nodeId, Collection<Component> componentList) {
-
- List<Inventory> inventoryResultList = new ArrayList<Inventory>();
- for (Component component : getRootComponents(componentList)) {
- inventoryResultList = recurseGetInventory(nodeId, component, componentList, 0, inventoryResultList);
- }
- // Verify if result is complete
- if (componentList.size() != inventoryResultList.size()) {
- log.warn(
- "Not all data were written to the Inventory. Potential entries with missing "
- + "contained-child. Node Id = {}, Components Found = {}, Entries written to Database = {}",
- nodeId.getValue(), componentList.size(), inventoryResultList.size());
- }
- return inventoryResultList;
- }
-
- private static List<Inventory> recurseGetInventory(NodeId nodeId, Component component,
- Collection<Component> componentList, int treeLevel, List<Inventory> inventoryResultList) {
-
- //Add element to list, if conversion successfull
- Optional<Inventory> oInventory = getInternalEquipment(nodeId, component, treeLevel);
- if (oInventory.isPresent()) {
- inventoryResultList.add(oInventory.get());
- }
- //Walk trough list of child keys and add to list
- for (String childUuid : CodeHelpers.nonnull(component.getContainsChild())) {
- for (Component c : getComponentsByName(childUuid, componentList)) {
- inventoryResultList = recurseGetInventory(nodeId, c, componentList, treeLevel + 1, inventoryResultList);
- }
- }
- return inventoryResultList;
- }
-
- public static List<Component> getRootComponents(Collection<Component> componentList) {
- List<Component> resultList = new ArrayList<>();
- for (Component c : componentList) {
- if (c.getParent() == null) { // Root elements do not have a parent
- resultList.add(c);
- }
- }
- return resultList;
- }
-
- private static List<Component> getComponentsByName(String name, Collection<Component> componentList) {
- List<Component> resultList = new ArrayList<>();
- for (Component c : componentList) {
- if (name.equals(c.getName())) { // <-- Component list is flat search for child's of name
- resultList.add(c);
- }
- }
- return resultList;
- }
-
- /**
- * Convert equipment into Inventory. Decide if inventory can by created from content or not. Public for test case.
- *
- * @param nodeId of node (Similar to mountpointId)
- * @param component to handle
- * @param treeLevel of components
- * @return Inventory if possible to be created.
- */
- public static Optional<Inventory> getInternalEquipment(NodeId nodeId, Component component, int treeLevel) {
-
- // Make sure that expected data are not null
- Objects.requireNonNull(nodeId);
- Objects.requireNonNull(component);
-
- // Read manadatory data
-
- @Nullable
- String nodeIdString = nodeId.getValue();
- @Nullable
- String uuid = component.getName();
- @Nullable
- String idParent = component.getParent();
- @Nullable
- String uuidParent = idParent != null ? idParent : uuid; //<- Passt nicht
-
- // do consistency check if all mandatory parameters are there
- if (treeLevel >= 0 && nodeIdString != null && uuid != null && uuidParent != null) {
-
- // Build output data
-
- InventoryBuilder inventoryBuilder = new InventoryBuilder();
-
- // General assumed as mandatory
- inventoryBuilder.setNodeId(nodeIdString);
- inventoryBuilder.setUuid(uuid);
- inventoryBuilder.setParentUuid(uuidParent);
- inventoryBuilder.setTreeLevel(Uint32.valueOf(treeLevel));
-
- // -- String list with ids of holders (optional)
- inventoryBuilder.setContainedHolder(CodeHelpers.nonnull(component.getContainsChild()));
-
- // -- Manufacturer related things (optional)
- @Nullable
- String mfgName = component.getMfgName();
- inventoryBuilder.setManufacturerName(mfgName);
- inventoryBuilder.setManufacturerIdentifier(mfgName);
-
- // Equipment type (optional)
- inventoryBuilder.setDescription(component.getDescription());
- inventoryBuilder.setModelIdentifier(component.getModelName());
- @Nullable
- Class<? extends HardwareClass> xmlClass = component.getXmlClass();
- if (xmlClass != null) {
- inventoryBuilder.setPartTypeId(xmlClass.getName());
- }
- inventoryBuilder.setTypeName(component.getName());
- inventoryBuilder.setVersion(component.getHardwareRev());
-
- // Equipment instance (optional)
- @Nullable
- DateAndTime mfgDate = component.getMfgDate();
- if (mfgDate != null) {
- inventoryBuilder.setDate(mfgDate.getValue());
- }
- inventoryBuilder.setSerial(component.getSerialNum());
-
- return Optional.of(inventoryBuilder.build());
- }
- return Optional.empty();
- }
-
- /**
- * If system data is available convert
- *
- * @param sys
- * @return
- */
- public static Optional<Guicutthrough> getGuicutthrough(@Nullable System1 sys) {
- if (sys != null) {
- String name = sys.getName();
- @Nullable
- Uri uri = sys.getWebUi();
- if (uri != null) {
- GuicutthroughBuilder gcBuilder = new GuicutthroughBuilder();
- if (name != null) {
- gcBuilder.setName(name);
- }
- gcBuilder.setWeburi(uri.getValue());
- return Optional.of(gcBuilder.build());
- }
- log.warn("Uri not set to invoke a Gui cut through session to the device. Please set the Uri in the device");
- }
- log.warn("Retrieving augmented System details failed. Gui cut through information not available");
- return Optional.empty();
- }
-
- /**
- * Convert netconf time into Instant
- *
- * @param eventTime with netconf time
- * @return Instant with converted time. If not convertable provide Instant.Min
- */
- public static Instant getInstantTime(@Nullable DateAndTime eventTime) {
- return eventTime != null ? Instant.parse(eventTime.getValue()) : Instant.MIN;
- }
-
- /**
- * Convert fault notification into data-provider FaultLogEntity
- *
- * @param notification with O-RAN notification
- * @param nodeId of node to handle
- * @param counter to be integrated into data
- * @return FaultlogEntity with data
- */
- public static FaultlogEntity getFaultLog(AlarmNotif notification, NodeId nodeId, Integer counter) {
- FaultlogBuilder faultAlarm = new FaultlogBuilder();
- faultAlarm.setNodeId(nodeId.getValue());
- faultAlarm.setObjectId(notification.getFaultSource());
- faultAlarm.setProblem(notification.getFaultText());
- faultAlarm.setSeverity(getSeverityType(notification.getFaultSeverity(), notification.getIsCleared()));
- faultAlarm.setCounter(counter);
- faultAlarm.setId(String.valueOf(notification.getFaultId()));
- faultAlarm.setSourceType(SourceType.Netconf);
- faultAlarm.setTimestamp(notification.getEventTime());
- return faultAlarm.build();
- }
-
- /**
- * Convert O-RAN specific severity into data-provider severity
- *
- * @param faultSeverity O-RAN severity
- * @param isCleared clear indicator
- * @return data-provider severity type
- * @throws IllegalArgumentException if conversion not possible.
- */
- public static SeverityType getSeverityType(@Nullable FaultSeverity faultSeverity, @Nullable Boolean isCleared)
- throws IllegalArgumentException {
- if (isCleared != null && isCleared) {
- return SeverityType.NonAlarmed;
- }
- if (faultSeverity != null) {
- switch (faultSeverity) {
- case CRITICAL:
- return SeverityType.Critical;
- case MAJOR:
- return SeverityType.Major;
- case MINOR:
- return SeverityType.Minor;
- case WARNING:
- return SeverityType.Warning;
- }
- }
- throw new IllegalArgumentException("Unknown Alarm state represent as Critical. isCleared=" + isCleared
- + " faultSeverity=" + faultSeverity);
- }
-
-}
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/impl/dom/DOMNotificationToXPath.java
index 64fb9b857..abe89df7a 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/impl/dom/DOMNotificationToXPath.java
@@ -21,6 +21,7 @@
*/
package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom;
+import com.google.common.base.VerifyException;
import java.time.Instant;
import java.util.Collection;
import java.util.HashMap;
@@ -43,193 +44,191 @@ import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.base.VerifyException;
-
public class DOMNotificationToXPath {
- private static final Logger LOG = LoggerFactory.getLogger(DOMNotificationToXPath.class);
-
- public HashMap<String, String> convertDomNotifToXPath(@NonNull DOMNotification domNotification) {
- @NonNull
- ContainerNode notifContainer = domNotification.getBody();
- HashMap<String, String> xPathData = new HashMap<String, String>();
-
- Collection<DataContainerChild> data = notifContainer.body();
- for (DataContainerChild data1 : data) {
- String namePath = "";
- recurseDOMData(notifContainer, data1, notifContainer, xPathData, namePath);
- }
- LOG.debug("XPath Data = {}", xPathData);
- return xPathData;
-
- }
-
- private void recurseDOMData(@NonNull ContainerNode notifContainer, DataContainerChild domData, DataContainerNode cn,
- HashMap<String, String> result, String namePath) {
- PathArgument pa1 = domData.getIdentifier();
- namePath += "/" + pa1.getNodeType().getLocalName();
- if (domData.getClass().getSimpleName().equals("ImmutableContainerNode")) {
- try {
- ContainerNode cn1 = (ContainerNode) cn.getChildByArg(pa1);
- for (DataContainerChild data1 : cn1.body()) {
- recurseDOMData(notifContainer, data1, cn1, result, namePath);
- }
- } catch (VerifyException ve) {
- LOG.debug("{} does not exist", pa1);
- }
- }
-
- if (domData.getClass().getSimpleName().equals("ImmutableChoiceNode")) {
- try {
- ChoiceNode cn1 = (ChoiceNode) cn.getChildByArg(pa1);
- for (DataContainerChild data1 : cn1.body()) {
- // recurseChoiceData(data1, cn1, namePath);
- recurseDOMData(notifContainer, data1, cn1, result, namePath);
- }
- } catch (VerifyException ve) {
- LOG.debug("{} does not exist", pa1);
- }
- }
-
- if (domData.getClass().getSimpleName().equals("ImmutableUnkeyedListNode")) {
- try {
- UnkeyedListNode cn1 = (UnkeyedListNode) cn.getChildByArg(pa1);
- for (UnkeyedListEntryNode data1 : cn1.body()) {
- recurseUnkeyedListEntryNodeData(data1, cn1, result, namePath);
- }
- } catch (VerifyException ve) {
- LOG.debug("{} does not exist", pa1);
- }
- }
-
- if (domData.getClass().getSimpleName().equals("ImmutableMapNode")) {
- try {
- MapNode cn1 = (MapNode) cn.getChildByArg(pa1);
- for (MapEntryNode data1 : cn1.body()) {
- recurseMapEntryNodeData(notifContainer, data1, cn1, result, namePath);
- }
- } catch (VerifyException ve) {
- LOG.debug("{} does not exist", pa1);
- }
- }
-
- if (domData.getClass().getSimpleName().equals("ImmutableLeafSetNode")) {
- try {
- LeafSetNode<?> cn1 = (LeafSetNode<?>) cn.getChildByArg(pa1);
- for (LeafSetEntryNode<?> data1 : cn1.body()) {
- recurseLeafSetEntryNodeData(data1, cn1, result, namePath);
- }
- } catch (VerifyException ve) {
- LOG.debug("{} does not exist", pa1);
- }
- }
-
- if (domData.getClass().getSimpleName().equals("ImmutableLeafNode")) {
- recurseLeafNode(domData, result, namePath);
- }
- }
-
- private void recurseLeafSetEntryNodeData(LeafSetEntryNode<?> data, LeafSetNode<?> cn1,
- HashMap<String, String> result, String namePath) {
- PathArgument pa1 = data.getIdentifier();
- namePath += "/" + pa1.getNodeType().getLocalName();
-
- if (data.getClass().getSimpleName().equals("ImmutableLeafSetEntryNode")) {
- LOG.debug("{}={}", namePath, data.body());
- result.put(namePath, data.body().toString());
- }
- }
-
- private void recurseMapEntryNodeData(@NonNull ContainerNode notifContainer, MapEntryNode data, MapNode cn1,
- HashMap<String, String> result, String namePath) {
- PathArgument pa1 = data.getIdentifier();
- NodeIdentifierWithPredicates ni = data.getIdentifier();
-
- for (QName qn : ni.keySet()) {
- namePath += "/" + ni.getValue(qn);
- }
-
- if (data.getClass().getSimpleName().equals("ImmutableMapEntryNode")) {
- for (DataContainerChild data1 : data.body()) {
- if (data1.getClass().getSimpleName().equals("ImmutableLeafSetNode")) {
- try {
- LeafSetNode<?> cn2 = (LeafSetNode<?>) data.getChildByArg(data1.getIdentifier());
- for (LeafSetEntryNode<?> data2 : cn2.body()) {
- recurseLeafSetEntryNodeData(data2, cn2, result, namePath);
- }
- } catch (VerifyException ve) {
- LOG.debug("{} does not exist", data1.getIdentifier());
- }
- } else {
- recurseLeafNode(data1, result, namePath);
- }
- }
- }
-
- if (data.getClass().getSimpleName().equals("ImmutableLeafSetNode")) {
- try {
- LeafSetNode<?> cn2 = (LeafSetNode<?>) notifContainer.getChildByArg(pa1);
- for (LeafSetEntryNode<?> data1 : cn2.body()) {
- recurseLeafSetEntryNodeData(data1, cn2, result, namePath);
- }
- } catch (VerifyException ve) {
- LOG.debug("{} does not exist", pa1);
- }
- }
-
- if (data.getClass().getSimpleName().equals("ImmutableLeafNode")) {
- LOG.debug("{}={}", namePath, data.body());
- result.put(namePath, data.body().toString());
- }
- }
-
- private void recurseUnkeyedListEntryNodeData(UnkeyedListEntryNode data, UnkeyedListNode cn1,
- HashMap<String, String> result, String namePath) {
- PathArgument pa1 = data.getIdentifier();
- namePath += "/" + pa1.getNodeType().getLocalName();
-
- if (data.getClass().getSimpleName().equals("ImmutableUnkeyedListEntryNode")) {
- for (DataContainerChild data1 : data.body()) {
- recurseLeafNode(data1, result, namePath);
- }
- }
-
- if (data.getClass().getSimpleName().equals("ImmutableLeafNode")) {
- LOG.debug("{}={}", namePath, data.body());
- result.put(namePath, data.body().toString());
- }
- }
-
- public void recurseLeafNode(DataContainerChild data, HashMap<String, String> result, String namePath) {
- PathArgument pa1 = data.getIdentifier();
- if (!(data.getClass().getSimpleName().equals("ImmutableAugmentationNode")))
- namePath += "/" + pa1.getNodeType().getLocalName();
- if (data.getClass().getSimpleName().equals("ImmutableLeafNode")) {
- LOG.debug("{}={}", namePath, data.body());
- result.put(namePath, data.body().toString());
- }
- }
-
- public void recurseChoiceData(HashMap<String, String> result, DataContainerChild data, ChoiceNode cn,
- String namePath) {
- PathArgument pa1 = data.getIdentifier();
- namePath += "/" + pa1.getNodeType().getLocalName();
- // NodeIdentifier nodeId = new NodeIdentifier(pa1.getNodeType());
- if (data.getClass().getSimpleName().equals("ImmutableLeafNode")) {
- LOG.debug("{}={}", namePath, data.body());
- result.put(namePath, data.body().toString());
- }
- }
-
- public Instant getTime(@NonNull DOMNotification domNotification) {
- @NonNull
- Instant eventTime;
- if (domNotification instanceof DOMEvent) {
- eventTime = ((DOMEvent) domNotification).getEventInstant();
- LOG.info("Event time {}", eventTime);
- } else {
- eventTime = Instant.now();
- LOG.info("Defaulting to actual time of processing the notification - {}", eventTime);
- }
- return eventTime;
- }
+ private static final Logger LOG = LoggerFactory.getLogger(DOMNotificationToXPath.class);
+
+ public HashMap<String, String> convertDomNotifToXPath(@NonNull DOMNotification domNotification) {
+ @NonNull
+ ContainerNode notifContainer = domNotification.getBody();
+ HashMap<String, String> xPathData = new HashMap<String, String>();
+
+ Collection<DataContainerChild> data = notifContainer.body();
+ for (DataContainerChild data1 : data) {
+ String namePath = "";
+ recurseDOMData(notifContainer, data1, notifContainer, xPathData, namePath);
+ }
+ LOG.debug("XPath Data = {}", xPathData);
+ return xPathData;
+
+ }
+
+ private void recurseDOMData(@NonNull ContainerNode notifContainer, DataContainerChild domData, DataContainerNode cn,
+ HashMap<String, String> result, String namePath) {
+ PathArgument pa1 = domData.getIdentifier();
+ namePath += "/" + pa1.getNodeType().getLocalName();
+ if (domData.getClass().getSimpleName().equals("ImmutableContainerNode")) {
+ try {
+ ContainerNode cn1 = (ContainerNode) cn.getChildByArg(pa1);
+ for (DataContainerChild data1 : cn1.body()) {
+ recurseDOMData(notifContainer, data1, cn1, result, namePath);
+ }
+ } catch (VerifyException ve) {
+ LOG.debug("{} does not exist", pa1);
+ }
+ }
+
+ if (domData.getClass().getSimpleName().equals("ImmutableChoiceNode")) {
+ try {
+ ChoiceNode cn1 = (ChoiceNode) cn.getChildByArg(pa1);
+ for (DataContainerChild data1 : cn1.body()) {
+ // recurseChoiceData(data1, cn1, namePath);
+ recurseDOMData(notifContainer, data1, cn1, result, namePath);
+ }
+ } catch (VerifyException ve) {
+ LOG.debug("{} does not exist", pa1);
+ }
+ }
+
+ if (domData.getClass().getSimpleName().equals("ImmutableUnkeyedListNode")) {
+ try {
+ UnkeyedListNode cn1 = (UnkeyedListNode) cn.getChildByArg(pa1);
+ for (UnkeyedListEntryNode data1 : cn1.body()) {
+ recurseUnkeyedListEntryNodeData(data1, cn1, result, namePath);
+ }
+ } catch (VerifyException ve) {
+ LOG.debug("{} does not exist", pa1);
+ }
+ }
+
+ if (domData.getClass().getSimpleName().equals("ImmutableMapNode")) {
+ try {
+ MapNode cn1 = (MapNode) cn.getChildByArg(pa1);
+ for (MapEntryNode data1 : cn1.body()) {
+ recurseMapEntryNodeData(notifContainer, data1, cn1, result, namePath);
+ }
+ } catch (VerifyException ve) {
+ LOG.debug("{} does not exist", pa1);
+ }
+ }
+
+ if (domData.getClass().getSimpleName().equals("ImmutableLeafSetNode")) {
+ try {
+ LeafSetNode<?> cn1 = (LeafSetNode<?>) cn.getChildByArg(pa1);
+ for (LeafSetEntryNode<?> data1 : cn1.body()) {
+ recurseLeafSetEntryNodeData(data1, cn1, result, namePath);
+ }
+ } catch (VerifyException ve) {
+ LOG.debug("{} does not exist", pa1);
+ }
+ }
+
+ if (domData.getClass().getSimpleName().equals("ImmutableLeafNode")) {
+ recurseLeafNode(domData, result, namePath);
+ }
+ }
+
+ private void recurseLeafSetEntryNodeData(LeafSetEntryNode<?> data, LeafSetNode<?> cn1,
+ HashMap<String, String> result, String namePath) {
+ PathArgument pa1 = data.getIdentifier();
+ namePath += "/" + pa1.getNodeType().getLocalName();
+
+ if (data.getClass().getSimpleName().equals("ImmutableLeafSetEntryNode")) {
+ LOG.debug("{}={}", namePath, data.body());
+ result.put(namePath, data.body().toString());
+ }
+ }
+
+ private void recurseMapEntryNodeData(@NonNull ContainerNode notifContainer, MapEntryNode data, MapNode cn1,
+ HashMap<String, String> result, String namePath) {
+ PathArgument pa1 = data.getIdentifier();
+ NodeIdentifierWithPredicates ni = data.getIdentifier();
+
+ for (QName qn : ni.keySet()) {
+ namePath += "/" + ni.getValue(qn);
+ }
+
+ if (data.getClass().getSimpleName().equals("ImmutableMapEntryNode")) {
+ for (DataContainerChild data1 : data.body()) {
+ if (data1.getClass().getSimpleName().equals("ImmutableLeafSetNode")) {
+ try {
+ LeafSetNode<?> cn2 = (LeafSetNode<?>) data.getChildByArg(data1.getIdentifier());
+ for (LeafSetEntryNode<?> data2 : cn2.body()) {
+ recurseLeafSetEntryNodeData(data2, cn2, result, namePath);
+ }
+ } catch (VerifyException ve) {
+ LOG.debug("{} does not exist", data1.getIdentifier());
+ }
+ } else {
+ recurseLeafNode(data1, result, namePath);
+ }
+ }
+ }
+
+ if (data.getClass().getSimpleName().equals("ImmutableLeafSetNode")) {
+ try {
+ LeafSetNode<?> cn2 = (LeafSetNode<?>) notifContainer.getChildByArg(pa1);
+ for (LeafSetEntryNode<?> data1 : cn2.body()) {
+ recurseLeafSetEntryNodeData(data1, cn2, result, namePath);
+ }
+ } catch (VerifyException ve) {
+ LOG.debug("{} does not exist", pa1);
+ }
+ }
+
+ if (data.getClass().getSimpleName().equals("ImmutableLeafNode")) {
+ LOG.debug("{}={}", namePath, data.body());
+ result.put(namePath, data.body().toString());
+ }
+ }
+
+ private void recurseUnkeyedListEntryNodeData(UnkeyedListEntryNode data, UnkeyedListNode cn1,
+ HashMap<String, String> result, String namePath) {
+ PathArgument pa1 = data.getIdentifier();
+ namePath += "/" + pa1.getNodeType().getLocalName();
+
+ if (data.getClass().getSimpleName().equals("ImmutableUnkeyedListEntryNode")) {
+ for (DataContainerChild data1 : data.body()) {
+ recurseLeafNode(data1, result, namePath);
+ }
+ }
+
+ if (data.getClass().getSimpleName().equals("ImmutableLeafNode")) {
+ LOG.debug("{}={}", namePath, data.body());
+ result.put(namePath, data.body().toString());
+ }
+ }
+
+ public void recurseLeafNode(DataContainerChild data, HashMap<String, String> result, String namePath) {
+ PathArgument pa1 = data.getIdentifier();
+ if (!(data.getClass().getSimpleName().equals("ImmutableAugmentationNode")))
+ namePath += "/" + pa1.getNodeType().getLocalName();
+ if (data.getClass().getSimpleName().equals("ImmutableLeafNode")) {
+ LOG.debug("{}={}", namePath, data.body());
+ result.put(namePath, data.body().toString());
+ }
+ }
+
+ public void recurseChoiceData(HashMap<String, String> result, DataContainerChild data, ChoiceNode cn,
+ String namePath) {
+ PathArgument pa1 = data.getIdentifier();
+ namePath += "/" + pa1.getNodeType().getLocalName();
+ // NodeIdentifier nodeId = new NodeIdentifier(pa1.getNodeType());
+ if (data.getClass().getSimpleName().equals("ImmutableLeafNode")) {
+ LOG.debug("{}={}", namePath, data.body());
+ result.put(namePath, data.body().toString());
+ }
+ }
+
+ public Instant getTime(@NonNull DOMNotification domNotification) {
+ @NonNull
+ Instant eventTime;
+ if (domNotification instanceof DOMEvent) {
+ eventTime = ((DOMEvent) domNotification).getEventInstant();
+ LOG.info("Event time {}", eventTime);
+ } else {
+ eventTime = Instant.now();
+ LOG.info("Defaulting to actual time of processing the notification - {}", eventTime);
+ }
+ return eventTime;
+ }
}
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/binding/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 7e04e8c1a..de018ba4e 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/binding/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
@@ -15,11 +15,10 @@
* the License.
* ============LICENSE_END==========================================================================
*/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.binding;
+package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom;
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.impl.startup.ORanNetworkElementFactory;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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/impl/dom/ORanDMDOMUtility.java
index 947677bb6..279620cf8 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/impl/dom/ORanDMDOMUtility.java
@@ -42,49 +42,49 @@ import org.slf4j.LoggerFactory;
import com.google.common.base.VerifyException;
public class ORanDMDOMUtility {
- public static final Logger LOG = LoggerFactory.getLogger(ORanDMDOMUtility.class);
+ public static final Logger LOG = LoggerFactory.getLogger(ORanDMDOMUtility.class);
- public static String getKeyValue(MapEntryNode componentEntry) {
- NodeIdentifierWithPredicates componentKey = componentEntry.getIdentifier(); // list key
- return (String) componentKey.getValue(ORanDeviceManagerQNames.IETF_HW_COMPONENT_LIST_KEY);
- }
+ public static String getKeyValue(MapEntryNode componentEntry) {
+ NodeIdentifierWithPredicates componentKey = componentEntry.getIdentifier(); // list key
+ return (String) componentKey.getValue(ORanDeviceManagerQNames.IETF_HW_COMPONENT_LIST_KEY);
+ }
- public static String getLeafValue(DataContainerNode componentEntry, QName leafQName) {
- NodeIdentifier leafNodeIdentifier = new NodeIdentifier(leafQName);
- try {
- LeafNode<?> optLeafNode = (LeafNode<?>) componentEntry.getChildByArg(leafNodeIdentifier);
- if (optLeafNode.body() instanceof QName) {
- LOG.debug("Leaf is of type QName");
- }
- return optLeafNode.body().toString();
- } catch (VerifyException ve) {
- LOG.debug("Leaf with QName {} not found", leafQName.toString());
- return null;
- }
- }
+ public static String getLeafValue(DataContainerNode componentEntry, QName leafQName) {
+ NodeIdentifier leafNodeIdentifier = new NodeIdentifier(leafQName);
+ try {
+ LeafNode<?> optLeafNode = (LeafNode<?>) componentEntry.getChildByArg(leafNodeIdentifier);
+ if (optLeafNode.body() instanceof QName) {
+ LOG.debug("Leaf is of type QName");
+ }
+ return optLeafNode.body().toString();
+ } catch (VerifyException ve) {
+ LOG.debug("Leaf with QName {} not found", leafQName.toString());
+ return null;
+ }
+ }
- public static List<String> getLeafListValue(DataContainerNode componentEntry, QName leafListQName) {
- List<String> containsChildList = new ArrayList<String>();
- try {
- DataContainerChild childSet = componentEntry.getChildByArg(new NodeIdentifier(leafListQName));
- Collection<?> childEntry = (Collection<?>) childSet.body();
- Iterator<?> childEntryItr = childEntry.iterator();
- while (childEntryItr.hasNext()) {
- LeafSetEntryNode<?> childEntryNode = (LeafSetEntryNode<?>) childEntryItr.next();
- containsChildList.add(childEntryNode.body().toString());
- }
- } catch (VerifyException ve) {
- LOG.debug("Child for {} does not exist", leafListQName);
- }
- return containsChildList;
- }
+ public static List<String> getLeafListValue(DataContainerNode componentEntry, QName leafListQName) {
+ List<String> containsChildList = new ArrayList<String>();
+ try {
+ DataContainerChild childSet = componentEntry.getChildByArg(new NodeIdentifier(leafListQName));
+ Collection<?> childEntry = (Collection<?>) childSet.body();
+ Iterator<?> childEntryItr = childEntry.iterator();
+ while (childEntryItr.hasNext()) {
+ LeafSetEntryNode<?> childEntryNode = (LeafSetEntryNode<?>) childEntryItr.next();
+ containsChildList.add(childEntryNode.body().toString());
+ }
+ } catch (VerifyException ve) {
+ LOG.debug("Child for {} does not exist", leafListQName);
+ }
+ return containsChildList;
+ }
- public static Instant getNotificationInstant(DOMNotification notification) {
- if (notification instanceof DOMEvent) {
- return ((DOMEvent) notification).getEventInstant();
- } else {
- return Instant.now();
- }
- }
+ public static Instant getNotificationInstant(DOMNotification notification) {
+ if (notification instanceof DOMEvent) {
+ return ((DOMEvent) notification).getEventInstant();
+ } else {
+ return Instant.now();
+ }
+ }
}
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/impl/dom/ORanDOMChangeNotificationListener.java
index aa375eff7..39eabcdc6 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/impl/dom/ORanDOMChangeNotificationListener.java
@@ -37,9 +37,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogEntity;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType;
-import org.opendaylight.yangtools.yang.binding.CodeHelpers;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode;
import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
@@ -48,103 +46,103 @@ import org.slf4j.LoggerFactory;
public class ORanDOMChangeNotificationListener implements DOMNotificationListener {
- private static final Logger log = LoggerFactory.getLogger(ORanDOMChangeNotificationListener.class);
+ private static final Logger log = LoggerFactory.getLogger(ORanDOMChangeNotificationListener.class);
- private final NetconfDomAccessor netconfDomAccessor;
- private final DataProvider databaseService;
- private @NonNull VESCollectorService vesCollectorService;
- private final DOMNotificationToXPath domNotificationXPath;
- private ORanDOMNotifToVESEventAssembly mapper = null;
- private static int sequenceNo = 0;
+ private final NetconfDomAccessor netconfDomAccessor;
+ private final DataProvider databaseService;
+ private @NonNull VESCollectorService vesCollectorService;
+ private final DOMNotificationToXPath domNotificationXPath;
+ private ORanDOMNotifToVESEventAssembly mapper = null;
+ private static int sequenceNo = 0;
- public ORanDOMChangeNotificationListener(NetconfDomAccessor netconfDomAccessor,
- @NonNull VESCollectorService vesCollectorService, DataProvider databaseService) {
- this.netconfDomAccessor = netconfDomAccessor;
- this.databaseService = databaseService;
- this.vesCollectorService = vesCollectorService;
- domNotificationXPath = new DOMNotificationToXPath();
- }
+ public ORanDOMChangeNotificationListener(NetconfDomAccessor netconfDomAccessor,
+ @NonNull VESCollectorService vesCollectorService, DataProvider databaseService) {
+ this.netconfDomAccessor = netconfDomAccessor;
+ this.databaseService = databaseService;
+ this.vesCollectorService = vesCollectorService;
+ domNotificationXPath = new DOMNotificationToXPath();
+ }
- @Override
- public void onNotification(@NonNull DOMNotification domNotification) {
- if (domNotification.getType()
- .equals(Absolute.of(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_NETCONF_CONFIG_CHANGE))) {
- handleNetconfConfigChange(domNotification);
- }
- }
+ @Override
+ public void onNotification(@NonNull DOMNotification domNotification) {
+ if (domNotification.getType()
+ .equals(Absolute.of(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_NETCONF_CONFIG_CHANGE))) {
+ handleNetconfConfigChange(domNotification);
+ }
+ }
- private void handleNetconfConfigChange(@NonNull DOMNotification domNotification) {
- DateAndTime eventTime;
- Instant notificationEventTime = null;
- if (domNotification instanceof DOMEvent) {
- notificationEventTime = ((DOMEvent) domNotification).getEventInstant();
- eventTime = NetconfTimeStampImpl.getConverter().getTimeStamp(notificationEventTime.toString());
- } else {
- eventTime = NetconfTimeStampImpl.getConverter().getTimeStamp();
- }
+ private void handleNetconfConfigChange(@NonNull DOMNotification domNotification) {
+ DateAndTime eventTime;
+ Instant notificationEventTime = null;
+ if (domNotification instanceof DOMEvent) {
+ notificationEventTime = ((DOMEvent) domNotification).getEventInstant();
+ eventTime = NetconfTimeStampImpl.getConverter().getTimeStamp(notificationEventTime.toString());
+ } else {
+ eventTime = NetconfTimeStampImpl.getConverter().getTimeStamp();
+ }
- ContainerNode cn = domNotification.getBody();
+ ContainerNode cn = domNotification.getBody();
- // Process the changed-by child
-// ContainerNode changedByContainerNode = (ContainerNode) cn
-// .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_CHANGEDBY));
-// ChoiceNode serverOrUserIDVal = (ChoiceNode) changedByContainerNode
-// .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_SERVERORUSER));
-// @SuppressWarnings("unused")
-// String userIDValue = serverOrUserIDVal
-// .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_USERNAME)).body()
-// .toString();
-// @SuppressWarnings("unused")
-// Integer sessionIDVal = Integer.valueOf(serverOrUserIDVal
-// .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_SESSIONID)).body()
-// .toString());
-//
-// // Process the datastore child
-// @SuppressWarnings("unused")
-// String datastoreValue = cn
-// .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_DATASTORE)).body()
-// .toString();
+ // Process the changed-by child
+ // ContainerNode changedByContainerNode = (ContainerNode) cn
+ // .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_CHANGEDBY));
+ // ChoiceNode serverOrUserIDVal = (ChoiceNode) changedByContainerNode
+ // .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_SERVERORUSER));
+ // @SuppressWarnings("unused")
+ // String userIDValue = serverOrUserIDVal
+ // .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_USERNAME)).body()
+ // .toString();
+ // @SuppressWarnings("unused")
+ // Integer sessionIDVal = Integer.valueOf(serverOrUserIDVal
+ // .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_SESSIONID)).body()
+ // .toString());
+ //
+ // // Process the datastore child
+ // @SuppressWarnings("unused")
+ // String datastoreValue = cn
+ // .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_DATASTORE)).body()
+ // .toString();
- // Process the edit child
- UnkeyedListNode editList = (UnkeyedListNode) cn
- .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_EDITNODE));
- if (editList != null) {
- for (int listCnt = 0; listCnt < editList.size(); listCnt++) {
- String operationValue = editList.childAt(listCnt)
- .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_OPERATION))
- .body().toString();
- String targetValue = editList.childAt(listCnt)
- .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_TARGET))
- .body().toString();
+ // Process the edit child
+ UnkeyedListNode editList = (UnkeyedListNode) cn
+ .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_EDITNODE));
+ if (editList != null) {
+ for (int listCnt = 0; listCnt < editList.size(); listCnt++) {
+ String operationValue = editList.childAt(listCnt)
+ .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_OPERATION))
+ .body().toString();
+ String targetValue = editList.childAt(listCnt)
+ .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_TARGET))
+ .body().toString();
- EventlogEntity eventLogEntity1 = new EventlogBuilder()
- .setNodeId(netconfDomAccessor.getNodeId().getValue()).setCounter(sequenceNo++)
- .setTimestamp(eventTime).setObjectId(targetValue).setAttributeName("N.A")
- .setSourceType(SourceType.Netconf).setNewValue(String.valueOf(operationValue)).build();
- databaseService.writeEventLog(eventLogEntity1);
- }
- }
+ EventlogEntity eventLogEntity1 = new EventlogBuilder()
+ .setNodeId(netconfDomAccessor.getNodeId().getValue()).setCounter(sequenceNo++)
+ .setTimestamp(eventTime).setObjectId(targetValue).setAttributeName("N.A")
+ .setSourceType(SourceType.Netconf).setNewValue(String.valueOf(operationValue)).build();
+ databaseService.writeEventLog(eventLogEntity1);
+ }
+ }
- if (vesCollectorService.getConfig().isVESCollectorEnabled()) {
- if (mapper == null) {
- this.mapper = new ORanDOMNotifToVESEventAssembly(netconfDomAccessor, vesCollectorService);
- }
- VESCommonEventHeaderPOJO header = mapper.createVESCommonEventHeader(
- domNotificationXPath.getTime(domNotification),
- ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_NETCONF_CONFIG_CHANGE.getLocalName(),
- sequenceNo);
- VESNotificationFieldsPOJO body = mapper.createVESNotificationFields(
- domNotificationXPath.convertDomNotifToXPath(domNotification),
- ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_NETCONF_CONFIG_CHANGE.getLocalName());
- log.info("domNotification in XPath format = {}",
- domNotificationXPath.convertDomNotifToXPath(domNotification));
- try {
- vesCollectorService.publishVESMessage(vesCollectorService.generateVESEvent(header, body));
- } catch (JsonProcessingException e) {
- log.warn("Exception while generating JSON object ", e);
+ if (vesCollectorService.getConfig().isVESCollectorEnabled()) {
+ if (mapper == null) {
+ this.mapper = new ORanDOMNotifToVESEventAssembly(netconfDomAccessor, vesCollectorService);
+ }
+ VESCommonEventHeaderPOJO header =
+ mapper.createVESCommonEventHeader(domNotificationXPath.getTime(domNotification),
+ ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_NETCONF_CONFIG_CHANGE.getLocalName(),
+ sequenceNo);
+ VESNotificationFieldsPOJO body =
+ mapper.createVESNotificationFields(domNotificationXPath.convertDomNotifToXPath(domNotification),
+ ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_NETCONF_CONFIG_CHANGE.getLocalName());
+ log.info("domNotification in XPath format = {}",
+ domNotificationXPath.convertDomNotifToXPath(domNotification));
+ try {
+ vesCollectorService.publishVESMessage(vesCollectorService.generateVESEvent(header, body));
+ } catch (JsonProcessingException e) {
+ log.warn("Exception while generating JSON object ", 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/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/impl/dom/ORanDOMFaultToVESFaultMapper.java
index b05e83f9a..77bd82d12 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/impl/dom/ORanDOMFaultToVESFaultMapper.java
@@ -22,7 +22,6 @@
package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom;
import java.time.Instant;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.binding.ORanFaultToVESFaultMapper;
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;
@@ -74,7 +73,7 @@ import org.slf4j.LoggerFactory;
public class ORanDOMFaultToVESFaultMapper {
@SuppressWarnings("unused")
- private static final Logger LOG = LoggerFactory.getLogger(ORanFaultToVESFaultMapper.class);
+ private static final Logger LOG = LoggerFactory.getLogger(ORanDOMFaultToVESFaultMapper.class);
private static final String VES_EVENT_DOMAIN = "fault";
private static final String VES_EVENTTYPE = "ORAN_Fault";
private static final String VES_EVENT_PRIORITY = "Normal";
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 64006339d..9b4f11e27 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
@@ -34,7 +34,6 @@ import org.eclipse.jdt.annotation.Nullable;
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.impl.binding.ORanRegistrationToVESpnfRegistrationMapper;
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;
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/startup/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 afeac1932..05561d2ca 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/startup/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
@@ -18,13 +18,11 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.startup;
+package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom;
import java.util.Optional;
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.impl.dom.ORanDOMNetworkElement;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom.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;
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/binding/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/impl/dom/ORanRegistrationToVESpnfRegistrationMapper.java
index 206abb5d7..5cad5881c 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/binding/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/impl/dom/ORanRegistrationToVESpnfRegistrationMapper.java
@@ -19,11 +19,10 @@
* ============LICENSE_END=========================================================
*
*/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.binding;
+package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom;
import java.time.Instant;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom.ORanDMDOMUtility;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom.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;
@@ -35,7 +34,7 @@ import org.slf4j.LoggerFactory;
public class ORanRegistrationToVESpnfRegistrationMapper {
@SuppressWarnings("unused")
- private static final Logger LOG = LoggerFactory.getLogger(ORanFaultToVESFaultMapper.class);
+ private static final Logger LOG = LoggerFactory.getLogger(ORanRegistrationToVESpnfRegistrationMapper.class);
//CommonEventHeader fields
private static final String VES_EVENT_DOMAIN = "pnfRegistration";
private static final String VES_EVENTTYPE = "NetConf Callhome Registration";
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/OperatorStateBuilder.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/OperatorStateBuilder.java
deleted file mode 100644
index 48d8e802a..000000000
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/OperatorStateBuilder.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911;
-
-import java.lang.String;
-import java.lang.UnsupportedOperationException;
-
-/**
- * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string
- * representation. In some cases it is very difficult to automate it since there can be unions such as (uint32 -
- * uint16), or (string - uint32).
- *
- * The reason behind putting it under src/main/java is: This class is generated in form of a stub and needs to be
- * finished by the user. This class is generated only once to prevent loss of user code.
- *
- */
-public class OperatorStateBuilder {
- private OperatorStateBuilder() {
- //Exists only to defeat instantiation.
- }
-
- public static OperatorState getDefaultInstance(String defaultValue) {
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
-}
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceBuilder.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceBuilder.java
deleted file mode 100644
index fb2e5d59d..000000000
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceBuilder.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911;
-
-import java.lang.String;
-import java.lang.UnsupportedOperationException;
-
-/**
- * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string
- * representation. In some cases it is very difficult to automate it since there can be unions such as (uint32 -
- * uint16), or (string - uint32).
- *
- * The reason behind putting it under src/main/java is: This class is generated in form of a stub and needs to be
- * finished by the user. This class is generated only once to prevent loss of user code.
- *
- */
-public class ResourceBuilder {
- private ResourceBuilder() {
- //Exists only to defeat instantiation.
- }
-
- public static Resource getDefaultInstance(String defaultValue) {
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
-}
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceMatchBuilder.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceMatchBuilder.java
deleted file mode 100644
index 2f4b5931f..000000000
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceMatchBuilder.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911;
-
-import java.lang.String;
-import java.lang.UnsupportedOperationException;
-
-/**
- * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string
- * representation. In some cases it is very difficult to automate it since there can be unions such as (uint32 -
- * uint16), or (string - uint32).
- *
- * The reason behind putting it under src/main/java is: This class is generated in form of a stub and needs to be
- * finished by the user. This class is generated only once to prevent loss of user code.
- *
- */
-public class ResourceMatchBuilder {
- private ResourceMatchBuilder() {
- //Exists only to defeat instantiation.
- }
-
- public static ResourceMatch getDefaultInstance(String defaultValue) {
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
-}
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/SeverityWithClearBuilder.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/SeverityWithClearBuilder.java
deleted file mode 100644
index 49e50e004..000000000
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/SeverityWithClearBuilder.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911;
-
-import java.lang.String;
-import java.lang.UnsupportedOperationException;
-
-/**
- * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string
- * representation. In some cases it is very difficult to automate it since there can be unions such as (uint32 -
- * uint16), or (string - uint32).
- *
- * The reason behind putting it under src/main/java is: This class is generated in form of a stub and needs to be
- * finished by the user. This class is generated only once to prevent loss of user code.
- *
- */
-public class SeverityWithClearBuilder {
- private SeverityWithClearBuilder() {
- //Exists only to defeat instantiation.
- }
-
- public static SeverityWithClear getDefaultInstance(String defaultValue) {
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
-}
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/alarms/ControlMaxAlarmStatusChangesBuilder.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/alarms/ControlMaxAlarmStatusChangesBuilder.java
deleted file mode 100644
index c2a500986..000000000
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/alarms/ControlMaxAlarmStatusChangesBuilder.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911.alarms;
-
-import java.lang.String;
-import java.lang.UnsupportedOperationException;
-
-/**
- * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string
- * representation. In some cases it is very difficult to automate it since there can be unions such as (uint32 -
- * uint16), or (string - uint32).
- *
- * The reason behind putting it under src/main/java is: This class is generated in form of a stub and needs to be
- * finished by the user. This class is generated only once to prevent loss of user code.
- *
- */
-public class ControlMaxAlarmStatusChangesBuilder {
- private ControlMaxAlarmStatusChangesBuilder() {
- //Exists only to defeat instantiation.
- }
-
- public static Control.MaxAlarmStatusChanges getDefaultInstance(String defaultValue) {
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
-}
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
index b4cc2d927..c8970f652 100644
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
+++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
@@ -31,7 +31,7 @@
interface="org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService"/>
<bean id="provider"
- class="org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.binding.DeviceManagerORanImpl"
+ class="org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom.DeviceManagerORanImpl"
init-method="init" destroy-method="close">
<property name="netconfNetworkElementService" ref="netconfNetworkElementService"/>
</bean>
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/binding/ComponentHelper.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/binding/ComponentHelper.java
deleted file mode 100644
index 64cdd5f80..000000000
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ComponentHelper.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : ccsdk features
- * ================================================================================
- * Copyright (C) 2020 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.impl.binding;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Scanner;
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
-import org.json.JSONArray;
-import org.json.JSONObject;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana.hardware.rev180313.Fan;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana.hardware.rev180313.HardwareClass;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana.hardware.rev180313.Port;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana.hardware.rev180313.Sensor;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.AdminState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.OperState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.SensorStatus;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.SensorValue;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.SensorValueType;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.hardware.Component;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.hardware.ComponentBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.hardware.component.SensorData;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.hardware.component.SensorDataBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.hardware.component.State;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.hardware.component.StateBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
-
-public class ComponentHelper {
-
- public static Component get(String name, String dateTimeString) {
- DateAndTime dateTime = new DateAndTime(dateTimeString);
- Uuid uuid = new Uuid("0Aabcdef-0abc-0cfD-0abC-0123456789AB");
-
- ComponentBuilder componentBuilder = new ComponentBuilder();
- componentBuilder.setParent("Shelf").setName("Slot-0").setParentRelPos(0);
- componentBuilder.setUuid(uuid);
- componentBuilder.setContainsChild(Arrays.asList("Card-01A", "Card-01B"));
- componentBuilder.setDescription("ORAN Network Element NO-456");
- componentBuilder.setXmlClass(TestHardwareClass.class);
- componentBuilder.setMfgName("Nokia");
- componentBuilder.setMfgDate(dateTime);
- return componentBuilder.build();
- }
-
- public static List<Component> getComponentList(String resourceName) {
- try (Scanner scanner = new Scanner(ComponentHelper.class.getResourceAsStream(resourceName), "UTF-8")) {
- String jsonString = scanner.useDelimiter("\\A").next();
- JSONObject jsonHardware = new JSONObject(jsonString).getJSONObject("hardware");
- JSONArray jsonComponentArray = jsonHardware.getJSONArray("component");
- return IntStream.range(0, jsonComponentArray.length())
- .mapToObj(idx -> ComponentHelper.get(jsonComponentArray.getJSONObject(idx)))
- .collect(Collectors.toList());
- }
- }
-
- public static Component get(JSONObject jsonComponent) {
- ComponentBuilder componentBuilder = new ComponentBuilder();
- componentBuilder.setName(getString(jsonComponent, "name"));
- componentBuilder.setParent(getString(jsonComponent, "parent"));
- componentBuilder.setParentRelPos(getInteger(jsonComponent, "parent-rel-pos"));
- componentBuilder.setAlias(getString(jsonComponent, "alias"));
- componentBuilder.setXmlClass(getXmlClass(jsonComponent, "class"));
- componentBuilder.setState(getState(jsonComponent, "state"));
- componentBuilder.setDescription(getString(jsonComponent, "description"));
- componentBuilder.setContainsChild(getStringArray(jsonComponent, "contains-child"));
- componentBuilder.setSensorData(getSensorData(jsonComponent, "sensor-data"));
- componentBuilder.setFirmwareRev(getString(jsonComponent, "firmware-rev"));
- componentBuilder.setSerialNum(getString(jsonComponent, "serial-num"));
- componentBuilder.setSoftwareRev(getString(jsonComponent, "software-rev"));
- return componentBuilder.build();
- }
-
- // Private
-
- private static State getState(JSONObject jsonComponent, String key) {
- if (jsonComponent.has(key)) {
- JSONObject jsonState = jsonComponent.getJSONObject(key);
- StateBuilder stateBuilder = new StateBuilder();
- stateBuilder.setOperState(getString(jsonState, "oper-state", value -> OperState.forName(value)).get());
- stateBuilder.setAdminState(getString(jsonState, "admin-state", value -> AdminState.forName(value)).get());
- return stateBuilder.build();
- }
- return null;
- }
-
- private static SensorData getSensorData(JSONObject jsonComponent, String key) {
- if (jsonComponent.has(key)) {
- JSONObject jsonSonsor = jsonComponent.getJSONObject(key);
- SensorDataBuilder sensorBuilder = new SensorDataBuilder();
- sensorBuilder.setValueTimestamp(getString(jsonSonsor, "value-timestamp", value -> new DateAndTime(value)));
- sensorBuilder.setValue(getInteger(jsonSonsor, "value", value -> new SensorValue(value)));
- sensorBuilder
- .setValueType(getString(jsonSonsor, "value-type", value -> SensorValueType.forName(value).get()));
- sensorBuilder
- .setOperStatus(getString(jsonSonsor, "oper-status", value -> SensorStatus.forName(value).get()));
- return sensorBuilder.build();
- }
- return null;
- }
-
- // Get data types
- private static Class<? extends HardwareClass> getXmlClass(JSONObject jsonComponent, String key) {
- return getString(jsonComponent, key, value -> {
- switch (value) {
- case "iana-hardware:sensor":
- return Sensor.class;
- case "iana-hardware:port":
- return Port.class;
- case "iana-hardware:fan":
- return Fan.class;
- default:
- return HardwareClass.class;
- }
- });
- }
-
- private static String getString(JSONObject jsonObject, String key) {
- return getString(jsonObject, key, value -> value);
- }
-
- private static Integer getInteger(JSONObject jsonObject, String key) {
- return getInteger(jsonObject, key, value -> value);
- }
-
- private interface ConvertString<T> {
- T convert(String value);
- }
-
- private static <T> T getString(JSONObject jsonObject, String key, ConvertString<T> convert) {
- if (jsonObject.has(key)) {
- String value = jsonObject.getString(key);
- return convert.convert(value);
- }
- return null;
- }
-
- private interface ConvertInteger<T> {
- T convert(int value);
- }
-
- private static <T> T getInteger(JSONObject jsonObject, String key, ConvertInteger<T> convert) {
- if (jsonObject.has(key)) {
- int value = jsonObject.getInt(key);
- return convert.convert(value);
- }
- return null;
- }
-
- private static List<String> getStringArray(JSONObject jsonComponent, String key) {
- if (jsonComponent.has(key)) {
- JSONArray stringArray = jsonComponent.getJSONArray(key);
- return IntStream.range(0, stringArray.length()).mapToObj(idx -> stringArray.getString(idx))
- .collect(Collectors.toList());
- }
- return null;
- }
-
-}
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/binding/TestAlarmNotif.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/binding/TestAlarmNotif.java
deleted file mode 100644
index 883271d4c..000000000
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/TestAlarmNotif.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : ccsdk features
- * ================================================================================
- * Copyright (C) 2020 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.impl.binding;
-
-import java.util.Map;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
-import org.opendaylight.yang.gen.v1.urn.o.ran.fm._1._0.rev190204.AlarmNotif;
-import org.opendaylight.yang.gen.v1.urn.o.ran.fm._1._0.rev190204.alarm.AffectedObjects;
-import org.opendaylight.yang.gen.v1.urn.o.ran.fm._1._0.rev190204.alarm.AffectedObjectsKey;
-import org.opendaylight.yangtools.yang.binding.Augmentation;
-import org.opendaylight.yangtools.yang.common.Uint16;
-
-public class TestAlarmNotif implements AlarmNotif {
-
- private static final Uint16 FAULT_ID = Uint16.valueOf(123);
-
- @Override
- public <A extends Augmentation<AlarmNotif>> @Nullable A augmentation(Class<A> augmentationType) {
- return null;
- }
-
- @Override
- public @Nullable Uint16 getFaultId() {
- return FAULT_ID;
- }
-
- @Override
- public @Nullable String getFaultSource() {
- return "ORAN-RU-FH";
- }
-
- @Override
- public @Nullable Map<AffectedObjectsKey, AffectedObjects> getAffectedObjects() {
- return null;
- }
-
- @Override
- public @Nullable FaultSeverity getFaultSeverity() {
- return FaultSeverity.CRITICAL;
- }
-
- public @Nullable Boolean isIsCleared() {
- return true;
- }
-
- @Override
- public @Nullable String getFaultText() {
- return "CPRI Port Down";
- }
-
- @Override
- public @Nullable DateAndTime getEventTime() {
- return new DateAndTime("2021-03-23T18:19:42.326144Z");
- }
-
- @Override
- public @NonNull Map<Class<? extends Augmentation<AlarmNotif>>, Augmentation<AlarmNotif>> augmentations() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Boolean getIsCleared() {
- return true;
- }
-
-}
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/binding/TestHardwareClass.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/binding/TestHardwareClass.java
deleted file mode 100644
index 753e6c97f..000000000
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/TestHardwareClass.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2020 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.impl.binding;
-
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana.hardware.rev180313.HardwareClass;
-
-public interface TestHardwareClass extends HardwareClass {
-
-}
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/binding/TestORanChangeNotificationListener.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/binding/TestORanChangeNotificationListener.java
deleted file mode 100644
index d8ea2664f..000000000
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/TestORanChangeNotificationListener.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2020 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.impl.binding;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import java.time.Instant;
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.jdt.annotation.NonNull;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.binding.ORanChangeNotificationListener;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationProxyParser;
-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.NetconfBindingAccessor;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.base._1._0.rev110601.EditOperationType;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfConfigChange;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.netconf.config.change.Edit;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.netconf.config.change.EditBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogEntity;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
-
-@RunWith(MockitoJUnitRunner.class)
-public class TestORanChangeNotificationListener {
-
- private static final String NODEID = "node1";
-
- @Mock
- DeviceManagerServiceProvider serviceProvider;
- @Mock
- NetconfBindingAccessor netconfAccessor;
- @Mock
- DataProvider databaseService;
- @Mock
- VESCollectorService vesCollectorService;
- @Mock
- VESCollectorCfgService vesCfgService;
- @Mock
- NotificationProxyParser notifProxyParser;
- @Mock
- static NetconfConfigChange change;
-
- @Test
- public void test() {
-
- when(vesCollectorService.getConfig()).thenReturn(vesCfgService);
- when(netconfAccessor.getNodeId()).thenReturn(new NodeId(NODEID));
- when(vesCfgService.isVESCollectorEnabled()).thenReturn(true);
- when(serviceProvider.getDataProvider()).thenReturn(databaseService);
- when(serviceProvider.getVESCollectorService()).thenReturn(vesCollectorService);
- when(vesCollectorService.getNotificationProxyParser()).thenReturn(notifProxyParser);
-
- ORanChangeNotificationListener notifListener =
- new ORanChangeNotificationListener(netconfAccessor, serviceProvider);
-
- Iterable<? extends PathArgument> pathArguments = Arrays.asList(new PathArgument() {
-
- @Override
- public int compareTo(PathArgument arg0) {
- return 0;
- }
-
- @Override
- public Class<? extends DataObject> getType() {
- return DataObject.class;
- }
- });
- InstanceIdentifier<?> target = InstanceIdentifier.create(pathArguments);
- NetconfConfigChange confChangeNotification = createNotification(EditOperationType.Create, target);
- when(notifProxyParser.getTime(confChangeNotification)).thenReturn(Instant.now());
- notifListener.onNetconfConfigChange(confChangeNotification);
- verify(databaseService).writeEventLog(any(EventlogEntity.class));
- }
-
- /**
- * @param type
- * @return
- */
- private static NetconfConfigChange createNotification(EditOperationType type, InstanceIdentifier<?> target) {
- @SuppressWarnings("null")
- final @NonNull List<Edit> edits = Arrays.asList(new EditBuilder().setOperation(type).setTarget(target).build());
- when(change.nonnullEdit()).thenReturn(edits);
- return change;
- }
-}
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/binding/TestORanFaultNotificationListener.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/binding/TestORanFaultNotificationListener.java
deleted file mode 100644
index e26af989e..000000000
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/TestORanFaultNotificationListener.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2020 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.impl.binding;
-
-import static org.mockito.Mockito.verify;
-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 org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-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.impl.binding.ORanFaultNotificationListener;
-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.NetconfBindingAccessor;
-import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogEntity;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@RunWith(MockitoJUnitRunner.class)
-public class TestORanFaultNotificationListener {
-
- private static final Logger LOG = LoggerFactory.getLogger(TestORanFaultNotificationListener.class);
- private static final String TESTFILENAME = "configFile.txt";
-
- // @formatter:off
- private static final String TESTCONFIG_CONTENT = "[VESCollector]\n"
- + "VES_COLLECTOR_ENABLED=true\n"
- + "VES_COLLECTOR_TLS_ENABLED=true\n"
- + "VES_COLLECTOR_TRUST_ALL_CERTS=true\n"
- + "VES_COLLECTOR_USERNAME=sample1\n"
- + "VES_COLLECTOR_PASSWORD=sample1\n"
- + "VES_COLLECTOR_IP=[2001:db8:1:1::1]\n"
- + "VES_COLLECTOR_PORT=8443\n"
- + "VES_COLLECTOR_VERSION=v7\n"
- + "REPORTING_ENTITY_NAME=ONAP SDN-R\n"
- + "EVENTLOG_MSG_DETAIL=SHORT\n"
- + "";
- // @formatter:on
-
- @Mock NetconfBindingAccessor bindingAccessor;
- @Mock DataProvider dataProvider;
- @Mock FaultService faultService;
- @Mock DeviceManagerServiceProvider serviceProvider;
- @Mock WebsocketManagerService websocketManagerService;
- @Mock DataProvider databaseService;
- VESCollectorService vesCollectorService;
-
- @After
- @Before
- public void afterAndBefore() {
- File f = new File(TESTFILENAME);
- if (f.exists()) {
- LOG.info("Remove {}", f.getAbsolutePath());
- f.delete();
- }
- }
-
- @Test
- public void test() throws IOException {
- Files.asCharSink(new File(TESTFILENAME), StandardCharsets.UTF_8).write(TESTCONFIG_CONTENT);
- vesCollectorService =
- new VESCollectorServiceImpl(new ConfigurationFileRepresentation(TESTFILENAME));
- when(bindingAccessor.getNodeId()).thenReturn(new NodeId("nSky"));
- ORanFaultNotificationListener faultListener = new ORanFaultNotificationListener(bindingAccessor,
- vesCollectorService, faultService, websocketManagerService, databaseService);
- faultListener.onAlarmNotif(new TestAlarmNotif());
-
- verify(faultService).faultNotification(getFaultLog());
- }
-
- private FaultlogEntity getFaultLog() {
- FaultlogBuilder faultAlarm = new FaultlogBuilder();
- faultAlarm.setNodeId("nSky");
- faultAlarm.setObjectId("ORAN-RU-FH");
- faultAlarm.setProblem("CPRI Port Down");
- faultAlarm.setSeverity(SeverityType.NonAlarmed);
- faultAlarm.setCounter(1);
- faultAlarm.setId("123");
- faultAlarm.setSourceType(SourceType.Netconf);
- faultAlarm.setTimestamp(new DateAndTime("2021-03-23T18:19:42.326144Z"));
- return faultAlarm.build();
- }
-
-}
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/binding/TestORanNetworkElement.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/binding/TestORanNetworkElement.java
deleted file mode 100644
index 3de211013..000000000
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/TestORanNetworkElement.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2020 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.impl.binding;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import java.io.IOException;
-import java.util.Optional;
-import org.eclipse.jdt.annotation.NonNull;
-import org.junit.BeforeClass;
-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.impl.startup.ORanNetworkElementFactory;
-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;
-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.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.o.ran.hardware._1._0.rev190328.ORANHWCOMPONENT;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.opendaylight.yangtools.yang.common.QName;
-
-public class TestORanNetworkElement {
-
- 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 = QName.create("urn:onap:system", "2020-10-26", "onap-system").intern();
- private static String NODEIDSTRING = "nSky";
- private static NodeId nodeId = new NodeId(NODEIDSTRING);
-
- private static NetconfAccessor accessor;
- private static DeviceManagerServiceProvider serviceProvider;
- private static Capabilities capabilities;
- private static TransactionUtils transactionUtils;
- private static NetconfBindingAccessor bindingAccessor;
- private static NetconfDomAccessor domAccessor;
- private static VESCollectorService vesCollectorService;
- private static NotificationProxyParser notificationProxyParser;
- private static VESCollectorCfgService vesCfgService;
- private static WebsocketManagerService websocketManagerService;
-
- @BeforeClass
- public static void init() throws InterruptedException, IOException {
- capabilities = mock(Capabilities.class);
- accessor = mock(NetconfAccessor.class);
- serviceProvider = mock(DeviceManagerServiceProvider.class);
- transactionUtils = mock(TransactionUtils.class);
- bindingAccessor = mock(NetconfBindingAccessor.class);
- domAccessor = mock(NetconfDomAccessor.class);
- vesCollectorService = mock(VESCollectorService.class);
- notificationProxyParser = mock(NotificationProxyParser.class);
- vesCfgService = mock(VESCollectorCfgService.class);
- websocketManagerService = mock(WebsocketManagerService.class);
-
- when(accessor.getCapabilites()).thenReturn(capabilities);
- when(accessor.getNodeId()).thenReturn(nodeId);
- when(accessor.getNetconfBindingAccessor()).thenReturn(Optional.of(bindingAccessor));
- when(accessor.getNetconfDomAccessor()).thenReturn(Optional.of(domAccessor));
- when(bindingAccessor.getCapabilites()).thenReturn(capabilities);
- when(bindingAccessor.getTransactionUtils()).thenReturn(transactionUtils);
- when(bindingAccessor.getNodeId()).thenReturn(nodeId);
- when(vesCollectorService.getNotificationProxyParser()).thenReturn(notificationProxyParser);
-
- DataProvider dataProvider = mock(DataProvider.class);
- FaultService faultService = mock(FaultService.class);
- when(serviceProvider.getWebsocketService()).thenReturn(websocketManagerService);
- when(serviceProvider.getFaultService()).thenReturn(faultService);
- when(serviceProvider.getDataProvider()).thenReturn(dataProvider);
- when(serviceProvider.getVESCollectorService()).thenReturn(vesCollectorService);
- when(vesCollectorService.getConfig()).thenReturn(vesCfgService);
- when(vesCfgService.isVESCollectorEnabled()).thenReturn(true);
-
- }
-
- //@Test
- public void test() {
- Optional<NetworkElement> oRanNe;
- when(capabilities.isSupportingNamespace(ORANHWCOMPONENT.QNAME)).thenReturn(true);
- when(capabilities.isSupportingNamespace(OneCell)).thenReturn(false);
- when(capabilities.isSupportingNamespace(OnapSystem)).thenReturn(false);
-
- ORanNetworkElementFactory factory = new ORanNetworkElementFactory();
- oRanNe = factory.create(accessor, serviceProvider);
- assertTrue(factory.create(accessor, serviceProvider).isPresent());
- oRanNe.get().register();
- oRanNe.get().deregister();
- oRanNe.get().getAcessor();
- oRanNe.get().getDeviceType();
- assertEquals(oRanNe.get().getNodeId().getValue(), "nSky");
- }
-
- }
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/binding/TestORanToInternalDataModel.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/binding/TestORanToInternalDataModel.java
deleted file mode 100644
index a4470d335..000000000
--- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/TestORanToInternalDataModel.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2020 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.impl.binding;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import java.io.IOException;
-import java.util.List;
-import java.util.Optional;
-import java.util.function.IntConsumer;
-import java.util.stream.IntStream;
-import org.eclipse.jdt.annotation.Nullable;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.hardware.Component;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Inventory;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.opendaylight.yangtools.yang.common.Uint32;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TestORanToInternalDataModel {
-
- private static final Logger LOG = LoggerFactory.getLogger(TestORanToInternalDataModel.class);
-
- NodeId nodeId = new NodeId("ORan-1000");
-
- @Test
- public void testInventory() {
- String dateTimeString = "2020-02-05T12:30:45.283Z";
- String name = "Slot-0";
-
- Component testComponent = ComponentHelper.get(name, dateTimeString);
- Optional<Inventory> oInventory = ORanToInternalDataModel.getInternalEquipment(nodeId, testComponent, 0);
-
- assertTrue(oInventory.isPresent());
- Inventory inventory = oInventory.get();
- assertEquals(name, inventory.getUuid());
- assertEquals(dateTimeString, inventory.getDate());
- assertEquals(nodeId.getValue(), inventory.getNodeId());
- }
-
- @Test
- public void testInventoryList() throws IOException, ClassNotFoundException {
- List<Component> componentList = ComponentHelper.getComponentList("/Device-ietf-hardware-Output.json");
- List<Inventory> inventoryList = ORanToInternalDataModel.getInventoryList(nodeId, componentList);
- //componentList.forEach(System.out::println);
- assertEquals("All elements", 27, inventoryList.size());
- assertEquals("Fully parseable", componentList.size(), inventoryList.size());
- assertEquals("Treelevel always there", 0,
- inventoryList.stream().filter(inventory -> inventory.getTreeLevel() == null).count());
- listAsTree(inventoryList);
- }
-
- private void listAsTree(List<Inventory> inventoryList) {
- //Walk through complete list and print parameters
- IntConsumer action = level -> IntStream.range(0, inventoryList.size())
- .filter(idx -> inventoryList.get(idx).getTreeLevel().intValue() == level)
- .forEach(idx2 -> printElements(idx2, level, inventoryList.get(idx2)));
- //Walk trough 10 levels
- IntStream.range(0, 10)
- .forEach(action);
- }
-
- private void printElements(int idx2, int level, Inventory inventory) {
- System.out.println(level + ": " + inventory.getParentUuid() + " "
- + inventory.getUuid());
- }
-
- @SuppressWarnings("unused")
- private boolean compareLevel(int idx, List<Component> componentList, List<Inventory> inventoryList) {
- @Nullable
- Integer relPos = componentList.get(idx).getParentRelPos();
- @Nullable
- Uint32 treeLevel = inventoryList.get(idx).getTreeLevel();
- LOG.warn("Treelevel relPos: {} treeLevel: {}", relPos, treeLevel);
- if (relPos != null && treeLevel != null) {
- return relPos == treeLevel.intValue();
- }
- return false;
- }
-}
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/TestDeviceManagerORanImpl.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/TestDeviceManagerORanImpl.java
index f3932bc41..bcec4a4d6 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/TestDeviceManagerORanImpl.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/TestDeviceManagerORanImpl.java
@@ -2,7 +2,7 @@
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
- * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved.
+ * Copyright (C) 2022 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
@@ -22,7 +22,6 @@ import java.io.IOException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.binding.DeviceManagerORanImpl;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService;
public class TestDeviceManagerORanImpl {
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/TestORANInventory.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/TestORANInventory.java
deleted file mode 100644
index 337996a3d..000000000
--- 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/TestORANInventory.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : ccsdk features
- * ================================================================================
- * Copyright (C) 2021 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.impl.dom;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Inventory;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.InventoryBuilder;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.opendaylight.yangtools.util.xml.UntrustedXML;
-import org.opendaylight.yangtools.yang.binding.CodeHelpers;
-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.Uint32;
-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.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.stream.NormalizedNodeStreamWriter;
-import org.opendaylight.yangtools.yang.data.codec.xml.XmlParserStream;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNormalizedNodeStreamWriter;
-import org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeResult;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.model.util.SchemaInferenceStack.Inference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xml.sax.SAXException;
-
-public class TestORANInventory {
-
- private static final Logger LOG = LoggerFactory.getLogger(TestORANInventory.class);
- private static final QNameModule IETF_HARDWARE_MODULE = QNameModule
- .create(XMLNamespace.of("urn:ietf:params:xml:ns:yang:ietf-hardware"), Revision.of("2018-03-13"));
- private static final QName HW_CONTAINER = QName.create(IETF_HARDWARE_MODULE, "hardware");
- private static final QName HW_COMPONENT_LIST = QName.create(IETF_HARDWARE_MODULE, "component");
- private static final QName HW_COMPONENT_LIST_KEY = QName.create(IETF_HARDWARE_MODULE, "name");
- private static final QName HW_COMPONENT_LIST_CLASS = QName.create(IETF_HARDWARE_MODULE, "class");
- private static final QName HW_COMPONENT_LIST_DESC = QName.create(IETF_HARDWARE_MODULE, "description"); // leaf:String
- private static final QName HW_COMPONENT_LIST_PARENT = QName.create(IETF_HARDWARE_MODULE, "parent"); // leaf:leafref
- private static final QName HW_COMPONENT_LIST_CONTAINS_CHILD = QName.create(IETF_HARDWARE_MODULE, "contains-child"); // leaf-list:leafref
- private static final QName HW_COMPONENT_LIST_HW_REV = QName.create(IETF_HARDWARE_MODULE, "hardware-rev"); // leaf:String
- private static final QName HW_COMPONENT_LIST_SER_NUM = QName.create(IETF_HARDWARE_MODULE, "serial-num"); // leaf:String
- private static final QName HW_COMPONENT_LIST_MFG_NAME = QName.create(IETF_HARDWARE_MODULE, "mfg-name"); // leaf:String
- private static final QName HW_COMPONENT_LIST_MODEL_NAME = QName.create(IETF_HARDWARE_MODULE, "model-name"); // leaf:String
- private static final QName HW_COMPONENT_LIST_MFG_DATE = QName.create(IETF_HARDWARE_MODULE, "mfg-date"); // leaf:yang:date-and-time
-
- private static EffectiveModelContext schemaContext;
- private static @NonNull Inference hwContainerSchema;
-
- @BeforeClass
- public static void setup() throws IOException {
- schemaContext = YangParserTestUtils.parseYangResourceDirectory("/");
- hwContainerSchema = Inference.ofDataTreePath(schemaContext, HW_CONTAINER);
- System.out.println("URL is - " + TestORANReadHardware.class.getResource("/"));
- }
-
- @AfterClass
- public static void cleanup() {
- schemaContext = null;
- hwContainerSchema = null;
- }
-
- @Test
- public void testIetfHardwareFromXML() throws XMLStreamException, URISyntaxException, IOException, SAXException {
-
- final InputStream resourceAsStream = TestORANReadHardware.class.getResourceAsStream("/ietf-hardware.xml");
-
- /*
- * final XMLInputFactory factory = XMLInputFactory.newInstance();
- * XMLStreamReader reader = factory.createXMLStreamReader(resourceAsStream);
- */
- final XMLStreamReader reader = UntrustedXML.createXMLStreamReader(resourceAsStream);
-
- final NormalizedNodeResult result = new NormalizedNodeResult();
- final NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result);
-
- final XmlParserStream xmlParser = XmlParserStream.create(streamWriter, hwContainerSchema);
- xmlParser.parse(reader);
-
- xmlParser.flush();
- xmlParser.close();
-
- NormalizedNode transformedInput = result.getResult();
- NodeId nodeId = new NodeId("nSky");
- getInventoryList(nodeId, transformedInput);
- }
-
- public static List<Inventory> getInventoryList(NodeId nodeId, NormalizedNode hwData) {
-
- List<Inventory> inventoryResultList = new ArrayList<Inventory>();
- ContainerNode hwContainer = (ContainerNode) hwData;
- MapNode componentMap = (MapNode) hwContainer.getChildByArg(new NodeIdentifier(HW_COMPONENT_LIST));
- Collection<MapEntryNode> componentMapEntries = componentMap.body();
-
- for (MapEntryNode componentMapEntryNode : getRootComponents(componentMapEntries)) {
- inventoryResultList = recurseGetInventory(nodeId, componentMapEntryNode, componentMapEntries, 0,
- inventoryResultList);
- }
- // Verify if result is complete
- if (componentMapEntries.size() != inventoryResultList.size()) {
- LOG.warn(
- "Not all data were written to the Inventory. Potential entries with missing "
- + "contained-child. Node Id = {}, Components Found = {}, Entries written to Database = {}",
- nodeId.getValue(), componentMapEntries.size(), inventoryResultList.size());
- }
- return inventoryResultList;
- }
-
- private static List<Inventory> recurseGetInventory(NodeId nodeId, MapEntryNode component,
- Collection<MapEntryNode> componentList, int treeLevel, List<Inventory> inventoryResultList) {
- LOG.info("Tree level = {}", treeLevel);
- // Add element to list, if conversion successfull
- Optional<Inventory> oInventory = getInternalEquipment(nodeId, component, treeLevel);
- if (oInventory.isPresent()) {
- inventoryResultList.add(oInventory.get());
- }
- // Walk through list of child keys and add to list
- for (String childUuid : CodeHelpers
- .nonnull(ORanDMDOMUtility.getLeafListValue(component, HW_COMPONENT_LIST_CONTAINS_CHILD))) {
- LOG.info("Calling recursively- component is {}", childUuid);
- for (MapEntryNode c : getComponentsByName(childUuid, componentList)) {
- inventoryResultList = recurseGetInventory(nodeId, c, componentList, treeLevel + 1, inventoryResultList);
- }
- }
- return inventoryResultList;
- }
-
- public static List<MapEntryNode> getRootComponents(Collection<MapEntryNode> componentMapEntries) {
- List<MapEntryNode> resultList = new ArrayList<>();
- for (MapEntryNode componentMapEntryNode : componentMapEntries) {
- if (ORanDMDOMUtility.getLeafValue(componentMapEntryNode, HW_COMPONENT_LIST_PARENT) == null) { // Root
- // elements
- // do not
- // have a
- // parent
- resultList.add(componentMapEntryNode);
- }
- }
- return resultList;
- }
-
- private static List<MapEntryNode> getComponentsByName(String name, Collection<MapEntryNode> componentList) {
- List<MapEntryNode> resultList = new ArrayList<>();
- for (MapEntryNode c : componentList) {
- if (name.equals(ORanDMDOMUtility.getKeyValue(c))) { // <-- Component list is flat search for child's of name
- resultList.add(c);
- }
- }
- return resultList;
- }
-
- public static Optional<Inventory> getInternalEquipment(NodeId nodeId, MapEntryNode component, int treeLevel) {
-
- // Make sure that expected data are not null
- Objects.requireNonNull(nodeId);
- Objects.requireNonNull(component);
-
- // Read manadatory data
-
- @Nullable
- String nodeIdString = nodeId.getValue();
- @Nullable
- String uuid = ORanDMDOMUtility.getKeyValue(component);
- @Nullable
- String idParent = ORanDMDOMUtility.getLeafValue(component, HW_COMPONENT_LIST_PARENT);
- @Nullable
- String uuidParent = idParent != null ? idParent : uuid; // <- Passt nicht
- LOG.info("Dump = {}, {}, {}, {}", uuidParent, uuid, treeLevel, nodeIdString);
- // do consistency check if all mandatory parameters are there
- if (treeLevel >= 0 && nodeIdString != null && uuid != null && uuidParent != null) {
- LOG.info("Creating new instance of Inventory");
- // Build output data
-
- InventoryBuilder inventoryBuilder = new InventoryBuilder();
-
- // General assumed as mandatory
- inventoryBuilder.setNodeId(nodeIdString);
- inventoryBuilder.setUuid(uuid);
- inventoryBuilder.setParentUuid(uuidParent);
- inventoryBuilder.setTreeLevel(Uint32.valueOf(treeLevel));
-
- // -- String list with ids of holders (optional)
- inventoryBuilder
- .setContainedHolder(ORanDMDOMUtility.getLeafListValue(component, HW_COMPONENT_LIST_CONTAINS_CHILD));
-
- // -- Manufacturer related things (optional)
- @Nullable
- String mfgName = ORanDMDOMUtility.getLeafValue(component, HW_COMPONENT_LIST_MFG_NAME);
- inventoryBuilder.setManufacturerName(mfgName);
- inventoryBuilder.setManufacturerIdentifier(mfgName);
-
- // Equipment type (optional)
- inventoryBuilder.setDescription(ORanDMDOMUtility.getLeafValue(component, HW_COMPONENT_LIST_DESC));
- inventoryBuilder.setModelIdentifier(ORanDMDOMUtility.getLeafValue(component, HW_COMPONENT_LIST_MODEL_NAME));
-
- inventoryBuilder.setPartTypeId(ORanDMDOMUtility.getLeafValue(component, HW_COMPONENT_LIST_CLASS));
-
- inventoryBuilder.setTypeName(ORanDMDOMUtility.getKeyValue(component));
- inventoryBuilder.setVersion(ORanDMDOMUtility.getLeafValue(component, HW_COMPONENT_LIST_HW_REV));
-
- // Equipment instance (optional)
- @Nullable
- String mfgDate = ORanDMDOMUtility.getLeafValue(component, HW_COMPONENT_LIST_MFG_DATE);
- if (mfgDate != null) {
- inventoryBuilder.setDate(mfgDate);
- }
- inventoryBuilder.setSerial(ORanDMDOMUtility.getLeafValue(component, HW_COMPONENT_LIST_SER_NUM));
-
- return Optional.of(inventoryBuilder.build());
- }
- return Optional.empty();
- }
-
-}
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/TestORANReadHardware.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/TestORANReadHardware.java
deleted file mode 100644
index b2da8e61f..000000000
--- 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/TestORANReadHardware.java
+++ /dev/null
@@ -1,383 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : ccsdk features
- * ================================================================================
- * Copyright (C) 2021 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.impl.dom;
-
-import com.google.common.base.VerifyException;
-import com.google.common.collect.ImmutableList;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.Optional;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.opendaylight.yangtools.util.xml.UntrustedXML;
-import org.opendaylight.yangtools.yang.binding.CodeHelpers;
-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.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
-import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
-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.stream.NormalizedNodeStreamWriter;
-import org.opendaylight.yangtools.yang.data.codec.xml.XmlParserStream;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNormalizedNodeStreamWriter;
-import org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeResult;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
-import org.opendaylight.yangtools.yang.model.util.SchemaInferenceStack.Inference;
-//import org.opendaylight.yangtools.yang.model.util.SchemaInferenceStack.Inference; //Yangtool 8.0
-import org.xml.sax.SAXException;
-
-public class TestORANReadHardware {
-
- /*
- * private static final QNameModule IETF_HARDWARE_MODULE =
- * QNameModule.create(XMLNamespace.of(
- * "urn:ietf:params:xml:ns:yang:ietf-hardware"), Revision.of("2018-03-13"));
- */ // Applicable for Yangtools 8.0
- // private static final URI IETF_HARDWARE_URI =
- // URI.create("urn:ietf:params:xml:ns:yang:ietf-hardware");
- private static final QNameModule IETF_HARDWARE_MODULE = QNameModule
- .create(XMLNamespace.of("urn:ietf:params:xml:ns:yang:ietf-hardware"), Revision.of("2018-03-13"));
- private static final QName HW_CONTAINER = QName.create(IETF_HARDWARE_MODULE, "hardware");
- private static final QName HW_COMPONENT_LIST = QName.create(IETF_HARDWARE_MODULE, "component");
- private static final QName HW_COMPONENT_LIST_KEY = QName.create(IETF_HARDWARE_MODULE, "name");
- private static final QName HW_COMPONENT_LIST_CLASS = QName.create(IETF_HARDWARE_MODULE, "class");
- private static final QName HW_COMPONENT_LIST_PHYSICAL_INDEX = QName.create(IETF_HARDWARE_MODULE, "physical-index"); // leaf:int32
- private static final QName HW_COMPONENT_LIST_DESC = QName.create(IETF_HARDWARE_MODULE, "description"); // leaf:String
- private static final QName HW_COMPONENT_LIST_PARENT = QName.create(IETF_HARDWARE_MODULE, "parent"); // leaf:leafref
- private static final QName HW_COMPONENT_LIST_PARENT_REL_POS = QName.create(IETF_HARDWARE_MODULE, "parent-rel-pos"); // leaf:int32
- private static final QName HW_COMPONENT_LIST_CONTAINS_CHILD = QName.create(IETF_HARDWARE_MODULE, "contains-child"); // leaf-list:leafref
- private static final QName HW_COMPONENT_LIST_HW_REV = QName.create(IETF_HARDWARE_MODULE, "hardware-rev"); // leaf:String
- private static final QName HW_COMPONENT_LIST_FW_REV = QName.create(IETF_HARDWARE_MODULE, "firmware-rev"); // leaf:String
- private static final QName HW_COMPONENT_LIST_SW_REV = QName.create(IETF_HARDWARE_MODULE, "software-rev"); // leaf:String
- private static final QName HW_COMPONENT_LIST_SER_NUM = QName.create(IETF_HARDWARE_MODULE, "serial-num"); // leaf:String
- private static final QName HW_COMPONENT_LIST_MFG_NAME = QName.create(IETF_HARDWARE_MODULE, "mfg-name"); // leaf:String
- private static final QName HW_COMPONENT_LIST_MODEL_NAME = QName.create(IETF_HARDWARE_MODULE, "model-name"); // leaf:String
- private static final QName HW_COMPONENT_LIST_ALIAS = QName.create(IETF_HARDWARE_MODULE, "alias"); // leaf:String
- private static final QName HW_COMPONENT_LIST_ASSET_ID = QName.create(IETF_HARDWARE_MODULE, "asset-id"); // leaf:String
- private static final QName HW_COMPONENT_LIST_IS_FRU = QName.create(IETF_HARDWARE_MODULE, "is-fru"); // leaf:boolean
- private static final QName HW_COMPONENT_LIST_MFG_DATE = QName.create(IETF_HARDWARE_MODULE, "mfg-date"); // leaf:yang:date-and-time
- private static final QName HW_COMPONENT_LIST_URI = QName.create(IETF_HARDWARE_MODULE, "uri"); // leaf-list:inet:uri
- private static final QName HW_COMPONENT_LIST_UUID = QName.create(IETF_HARDWARE_MODULE, "uuid"); // leaf:yang:uuid
- private static final QName HW_COMPONENT_LIST_STATE = QName.create(IETF_HARDWARE_MODULE, "state"); // leaf:yang:uuid
- private static final QName HW_COMPONENT_LIST_ADMIN_STATE = QName.create(IETF_HARDWARE_MODULE, "admin-state"); // leaf:yang:uuid
- private static final QName HW_COMPONENT_LIST_OPER_STATE = QName.create(IETF_HARDWARE_MODULE, "oper-state"); // leaf:yang:uuid
-
- private static EffectiveModelContext schemaContext;
- private static Inference hwContainerSchema;
-
- @BeforeClass
- public static void setup() throws IOException {
- schemaContext = YangParserTestUtils.parseYangResourceDirectory("/");
- hwContainerSchema = Inference.ofDataTreePath(schemaContext, HW_CONTAINER);
- System.out.println("URL is - " + TestORANReadHardware.class.getResource("/"));
- }
-
- @AfterClass
- public static void cleanup() {
- schemaContext = null;
- hwContainerSchema = null;
- }
-
- @Test
- public void testIetfHardwareFromXML() throws XMLStreamException, URISyntaxException, IOException, SAXException {
-
- final InputStream resourceAsStream = TestORANReadHardware.class.getResourceAsStream("/ietf-hardware.xml");
-
- /*
- * final XMLInputFactory factory = XMLInputFactory.newInstance();
- * XMLStreamReader reader = factory.createXMLStreamReader(resourceAsStream);
- */
- final XMLStreamReader reader = UntrustedXML.createXMLStreamReader(resourceAsStream);
-
- final NormalizedNodeResult result = new NormalizedNodeResult();
- final NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result);
-
- final XmlParserStream xmlParser = XmlParserStream.create(streamWriter, hwContainerSchema);
- xmlParser.parse(reader);
-
- xmlParser.flush();
- xmlParser.close();
-
- NormalizedNode transformedInput = result.getResult();
- System.out.println("Hardware Data = " + transformedInput);
-
- ContainerNode hwContainer = (ContainerNode) transformedInput;
- MapNode containerMap = (MapNode) hwContainer.getChildByArg(new NodeIdentifier(HW_COMPONENT_LIST));
- Collection<MapEntryNode> containerMapEntries = containerMap.body();
- for (MapEntryNode mapEntryNode : containerMapEntries) {
- NodeIdentifierWithPredicates componentKey = mapEntryNode.getIdentifier(); // list key
- System.out.println("Key Name is - " + componentKey.keySet());
- System.out.println("Key Value is - " + componentKey.getValue(HW_COMPONENT_LIST_KEY));
-
- LeafNode<?> classField = (LeafNode<?>) mapEntryNode
- .getChildByArg(new NodeIdentifier(HW_COMPONENT_LIST_CLASS));
- System.out.println("Class = " + classField.getIdentifier().getNodeType().getLocalName() + " Value = "
- + classField.body().toString());
- Object obj = classField.body();
- System.out.println(obj.getClass());
- if (obj instanceof QName) {
- System.out.println("This is of type QName");
- }
- LeafNode<?> aliasLeaf = (LeafNode<?>) mapEntryNode
- .getChildByArg(new NodeIdentifier(HW_COMPONENT_LIST_ALIAS));
- // System.out.println("Alias = " + aliasLeaf.getValue().toString());
- System.out.println("Alias = " + getLeafValue(mapEntryNode, HW_COMPONENT_LIST_ALIAS));
-
- try {
- DataContainerChild childSet = mapEntryNode
- .getChildByArg(new NodeIdentifier(HW_COMPONENT_LIST_CONTAINS_CHILD));
-
- Collection<?> childEntry = (Collection<?>) childSet.body();
- Iterator<?> childEntryItr = childEntry.iterator();
- while (childEntryItr.hasNext()) {
- LeafSetEntryNode<?> childEntryNode = (LeafSetEntryNode<?>) childEntryItr.next();
- System.out.println("Child Node - " + childEntryNode.body());
- }
- } catch (VerifyException ve) {
- // System.out.println("Child not not exist");
- }
-
- try {
- LeafSetNode<?> containsChildSet = (LeafSetNode<?>) mapEntryNode
- .getChildByArg(new NodeIdentifier(HW_COMPONENT_LIST_CONTAINS_CHILD));
- Collection<?> containsChildSetEntry = containsChildSet.body();
- Iterator<?> childItr = containsChildSetEntry.iterator();
- while (childItr.hasNext()) {
- LeafSetEntryNode<?> childEntryNode = (LeafSetEntryNode<?>) childItr.next();
- System.out.println("Child Node - " + childEntryNode.body());
- }
- } catch (VerifyException | NoSuchElementException e) {
- // System.out.println("Child not not exist");
- }
-
- try {
- System.out
- .println(CodeHelpers.nonnull(getLeafListValue(mapEntryNode, HW_COMPONENT_LIST_CONTAINS_CHILD)));
- for (String childUuid : CodeHelpers
- .nonnull(getLeafListValue(mapEntryNode, HW_COMPONENT_LIST_CONTAINS_CHILD))) {
- System.out.println("Calling recursively - " + childUuid);
- }
- } catch (VerifyException | NoSuchElementException e) {
- // System.out.println("Child not not exist");
- }
- try {
- String description = (String) mapEntryNode.getChildByArg(new NodeIdentifier(HW_COMPONENT_LIST_DESC))
- .body();
- System.out.println("Description = " + description);
- } catch (VerifyException | NoSuchElementException e) {
- // System.out.println("Child not not exist");
- }
- try {
- String serialNum = (String) mapEntryNode.getChildByArg(new NodeIdentifier(HW_COMPONENT_LIST_SER_NUM))
- .body();
- System.out.println("Serial Number = " + serialNum);
- } catch (VerifyException | NoSuchElementException e) {
- // System.out.println("Child not not exist");
- }
- try {
- String firmwareRev = (String) mapEntryNode.getChildByArg(new NodeIdentifier(HW_COMPONENT_LIST_FW_REV))
- .body();
- System.out.println("Firmware Rev = " + firmwareRev);
- } catch (VerifyException | NoSuchElementException e) {
- // System.out.println("Child not not exist");
- }
- try {
- String swRev = (String) mapEntryNode.getChildByArg(new NodeIdentifier(HW_COMPONENT_LIST_SW_REV)).body();
- System.out.println("Software Rev = " + swRev);
- } catch (VerifyException | NoSuchElementException e) {
- // System.out.println("Child not not exist");
- }
- try {
- String modelName = (String) mapEntryNode.getChildByArg(new NodeIdentifier(HW_COMPONENT_LIST_MODEL_NAME))
- .body();
- System.out.println("Model Name = " + modelName);
- } catch (VerifyException | NoSuchElementException e) {
- // System.out.println("Child not not exist");
- }
- try {
- Integer parentRelPos = (Integer) mapEntryNode
- .getChildByArg(new NodeIdentifier(HW_COMPONENT_LIST_PARENT_REL_POS)).body();
- System.out.println("Parent Rel Pos = " + (parentRelPos != null ? parentRelPos.intValue() : null));
- } catch (VerifyException | NoSuchElementException e) {
- // System.out.println("Child not not exist");
- }
- try {
- String parent = (String) mapEntryNode.getChildByArg(new NodeIdentifier(HW_COMPONENT_LIST_PARENT))
- .body();
- System.out.println("Parent = " + parent);
- } catch (VerifyException | NoSuchElementException e) {
- // System.out.println("Child not not exist");
- }
- try {
- String hwRev = (String) mapEntryNode.getChildByArg(new NodeIdentifier(HW_COMPONENT_LIST_HW_REV)).body();
- System.out.println("Hardware Revision = " + hwRev);
- } catch (VerifyException | NoSuchElementException e) {
- // System.out.println("Child not not exist");
- }
- try {
- String mfgName = (String) mapEntryNode.getChildByArg(new NodeIdentifier(HW_COMPONENT_LIST_MFG_NAME))
- .body();
- System.out.println("Manufacturer Name = " + mfgName);
- } catch (VerifyException | NoSuchElementException e) {
- // System.out.println("Child not not exist");
- }
- try {
- DataContainerChild mfgNameOpt = mapEntryNode
- .getChildByArg(new NodeIdentifier(HW_COMPONENT_LIST_MFG_NAME));
- if (mfgNameOpt != null) {
- System.out.println("Mfg Name - " + (String) mfgNameOpt.body());
- }
- } catch (VerifyException | NoSuchElementException e) {
- // System.out.println("Child not not exist");
- }
- try {
- String assetID = (String) mapEntryNode.getChildByArg(new NodeIdentifier(HW_COMPONENT_LIST_ASSET_ID))
- .body();
- System.out.println("Asset ID = " + assetID);
- } catch (VerifyException | NoSuchElementException e) {
- // System.out.println("Child not not exist");
- }
- try {
- String mfgDate = (String) mapEntryNode.getChildByArg(new NodeIdentifier(HW_COMPONENT_LIST_MFG_DATE))
- .body();
- System.out.println("Mfg Date = " + mfgDate);
- } catch (VerifyException | NoSuchElementException e) {
- // System.out.println("Child not not exist");
- }
- try {
- String uri = (String) mapEntryNode.getChildByArg(new NodeIdentifier(HW_COMPONENT_LIST_URI)).body();
- System.out.println("URI = " + uri);
- } catch (VerifyException | NoSuchElementException e) {
- // System.out.println("Child not not exist");
- }
- try {
- Boolean isFRU = (Boolean) mapEntryNode.getChildByArg(new NodeIdentifier(HW_COMPONENT_LIST_IS_FRU))
- .body();
- System.out.println("IS FRU = " + isFRU);
- } catch (VerifyException | NoSuchElementException e) {
- // System.out.println("Child not not exist");
- }
- try {
- String uuid = (String) mapEntryNode.getChildByArg(new NodeIdentifier(HW_COMPONENT_LIST_UUID)).body()
- .toString();
- System.out.println("UUID = " + uuid);
- } catch (VerifyException | NoSuchElementException e) {
- // System.out.println("Child not not exist");
- }
-
- try {
- ContainerNode state = (ContainerNode) mapEntryNode
- .getChildByArg(new NodeIdentifier(HW_COMPONENT_LIST_STATE));
- String adminState = (String) state.getChildByArg(new NodeIdentifier(HW_COMPONENT_LIST_ADMIN_STATE))
- .body().toString();
- System.out.println("Admin State = " + adminState);
- String operState = (String) state.getChildByArg(new NodeIdentifier(HW_COMPONENT_LIST_OPER_STATE)).body()
- .toString();
-
- System.out.println("Oper State = " + operState);
- } catch (VerifyException | NoSuchElementException e) {
- System.out.println("Child not not exist");
- }
-
- System.out.println("********************************************");
-
- }
- // assertNotNull(transformedInput);
-
- }
-
- public static String getLeafValue(DataContainerNode componentEntry, QName leafQName) {
- NodeIdentifier leafNodeIdentifier = new NodeIdentifier(leafQName);
- try {
- LeafNode<?> optLeafNode = (LeafNode<?>) componentEntry.getChildByArg(leafNodeIdentifier);
- if (optLeafNode.body() instanceof QName) {
- System.out.println("Leaf is of type QName");
- }
- return optLeafNode.body().toString();
- } catch (NoSuchElementException nsee) {
- System.out.println("Leaf with QName {} not found" + leafQName.toString());
- return null;
- }
- }
-
- public static List<String> getLeafListValue(DataContainerNode componentEntry, QName leafListQName) {
- if (componentEntry instanceof MapEntryNode) {
- List<String> containsChildList = new ArrayList<String>();
- DataContainerChild childSet = componentEntry.getChildByArg(new NodeIdentifier(leafListQName));
- if (childSet != null) {
- Collection<?> childEntry = (Collection<?>) childSet.body();
- Iterator<?> childEntryItr = childEntry.iterator();
- while (childEntryItr.hasNext()) {
- LeafSetEntryNode<?> childEntryNode = (LeafSetEntryNode<?>) childEntryItr.next();
- containsChildList.add(childEntryNode.body().toString());
- }
- }
- return containsChildList;
- }
- return null;
- }
-
- @Test
- public void testIetfHardwareFromNormalizedNode() {
- buildIetfHardwareContainerNode();
- }
-
- private static NormalizedNode buildIetfHardwareContainerNode() {
- MapNode componentMap = Builders.mapBuilder().withNodeIdentifier(new NodeIdentifier(HW_COMPONENT_LIST))
- .withChild(Builders.mapEntryBuilder()
- .withNodeIdentifier(
- NodeIdentifierWithPredicates.of(HW_COMPONENT_LIST, HW_COMPONENT_LIST_KEY, "chassis"))
- .withChild(
- Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(HW_COMPONENT_LIST_CLASS))
- .withValue("ianahw:chassis").build())
- .withChild(Builders.leafBuilder()
- .withNodeIdentifier(new NodeIdentifier(HW_COMPONENT_LIST_PHYSICAL_INDEX)).withValue(1)
- .build())
- .build())
- .build();
- return componentMap;
- }
-
-}
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 8abfb2d3e..89ff6dc90 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
@@ -37,7 +37,6 @@ 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.impl.binding.TestORanFaultNotificationListener;
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;
@@ -59,7 +58,7 @@ import org.slf4j.LoggerFactory;
@RunWith(MockitoJUnitRunner.class)
public class TestORanDOMFaultNotificationListener {
- private static final Logger LOG = LoggerFactory.getLogger(TestORanFaultNotificationListener.class);
+ private static final Logger LOG = LoggerFactory.getLogger(TestORanDOMFaultNotificationListener.class);
private static final String TESTFILENAME = "configFile.txt";
// @formatter:off
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 c75f4f5a1..283d122b0 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
@@ -32,7 +32,6 @@ 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.ne.service.NetworkElement;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.startup.ORanNetworkElementFactory;
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;
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 4eac71cde..e3113db3c 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
@@ -63,140 +63,140 @@ import org.xml.sax.SAXException;
public class TestORanDOMToInternalDataModel {
- private static final QNameModule IETF_HARDWARE_MODULE = QNameModule
- .create(XMLNamespace.of("urn:ietf:params:xml:ns:yang:ietf-hardware"), Revision.of("2018-03-13"));
- private static final QName HW_CONTAINER = QName.create(IETF_HARDWARE_MODULE, "hardware");
-
- private static final QNameModule IETF_SYSTEM_MODULE = 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 EffectiveModelContext schemaContext;
- private static Inference hwContainerSchema;
- private static Inference systemSchema;
-
- private static final NodeId nodeId = new NodeId("nSky");
-
- @BeforeClass
- public static void setup() throws IOException {
- schemaContext = YangParserTestUtils.parseYangResourceDirectory("/");
- hwContainerSchema = Inference.ofDataTreePath(schemaContext, HW_CONTAINER);
- systemSchema = Inference.ofDataTreePath(schemaContext, IETF_CONTAINER);
- }
-
- @AfterClass
- public static void cleanup() {
- schemaContext = null;
- hwContainerSchema = null;
- systemSchema = null;
- }
-
- @Test
- public void testIetfHardwareFromXML() throws XMLStreamException, URISyntaxException, IOException, SAXException {
-
- final InputStream resourceAsStream = TestORANReadHardware.class.getResourceAsStream("/ietf-hardware.xml");
-
- /*
- * final XMLInputFactory factory = XMLInputFactory.newInstance();
- * XMLStreamReader reader = factory.createXMLStreamReader(resourceAsStream);
- */
- final XMLStreamReader reader = UntrustedXML.createXMLStreamReader(resourceAsStream);
-
- final NormalizedNodeResult result = new NormalizedNodeResult();
- final NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result);
-
- final XmlParserStream xmlParser = XmlParserStream.create(streamWriter, hwContainerSchema);
- xmlParser.parse(reader);
-
- xmlParser.flush();
- xmlParser.close();
-
- NormalizedNode transformedInput = result.getResult();
-
- List<Inventory> inventoryList = ORanDOMToInternalDataModel.getInventoryList(nodeId, transformedInput);
- assertEquals("All elements", 27, inventoryList.size());
- assertEquals("Treelevel always there", 0,
- inventoryList.stream().filter(inventory -> inventory.getTreeLevel() == null).count());
- }
-
- @Test
- public void testIetfSystemFromXML() throws XMLStreamException, URISyntaxException, IOException, SAXException {
-
- final InputStream resourceAsStream = TestORANReadHardware.class.getResourceAsStream("/onap-system.xml");
-
- final XMLStreamReader reader = UntrustedXML.createXMLStreamReader(resourceAsStream);
-
- final NormalizedNodeResult result = new NormalizedNodeResult();
- final NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result);
-
- final XmlParserStream xmlParser = XmlParserStream.create(streamWriter, systemSchema);
- xmlParser.parse(reader);
-
- xmlParser.flush();
- xmlParser.close();
-
- 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));
- assertEquals(gc.isPresent(), true);
-
- }
-
- @Test
- public void testORANFault() {
- ContainerNode cn = createORANDOMFault();
- NetconfDeviceNotification faultNotif = new NetconfDeviceNotification(cn, Instant.now());
- FaultlogEntity fle = ORanDOMToInternalDataModel.getFaultLog(faultNotif, nodeId, 1);
- assertEquals(fle.getId(), "47");
- }
-
- 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();
- }
-
- public static class NetconfDeviceNotification implements DOMNotification, DOMEvent {
- private final ContainerNode content;
- private final Absolute schemaPath;
- private final Instant eventTime;
-
- NetconfDeviceNotification(final ContainerNode content, final Instant eventTime) {
- this.content = content;
- this.eventTime = eventTime;
- this.schemaPath = Absolute.of(content.getIdentifier().getNodeType());
- }
-
- NetconfDeviceNotification(final ContainerNode content, final Absolute schemaPath, final Instant eventTime) {
- this.content = content;
- this.eventTime = eventTime;
- this.schemaPath = schemaPath;
- }
-
- @Override
- public Absolute getType() {
- return schemaPath;
- }
-
- @Override
- public ContainerNode getBody() {
- return content;
- }
-
- @Override
- public Instant getEventInstant() {
- return eventTime;
- }
- }
+ private static final QNameModule IETF_HARDWARE_MODULE =
+ QNameModule.create(XMLNamespace.of("urn:ietf:params:xml:ns:yang:ietf-hardware"), Revision.of("2018-03-13"));
+ private static final QName HW_CONTAINER = QName.create(IETF_HARDWARE_MODULE, "hardware");
+
+ private static final QNameModule IETF_SYSTEM_MODULE =
+ 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 EffectiveModelContext schemaContext;
+ private static Inference hwContainerSchema;
+ private static Inference systemSchema;
+
+ private static final NodeId nodeId = new NodeId("nSky");
+
+ @BeforeClass
+ public static void setup() throws IOException {
+ schemaContext = YangParserTestUtils.parseYangResourceDirectory("/");
+ hwContainerSchema = Inference.ofDataTreePath(schemaContext, HW_CONTAINER);
+ systemSchema = Inference.ofDataTreePath(schemaContext, IETF_CONTAINER);
+ }
+
+ @AfterClass
+ public static void cleanup() {
+ schemaContext = null;
+ hwContainerSchema = null;
+ systemSchema = null;
+ }
+
+ @Test
+ public void testIetfHardwareFromXML() throws XMLStreamException, URISyntaxException, IOException, SAXException {
+
+ final InputStream resourceAsStream = TestORanDOMToInternalDataModel.class.getResourceAsStream("/ietf-hardware.xml");
+
+ /*
+ * final XMLInputFactory factory = XMLInputFactory.newInstance();
+ * XMLStreamReader reader = factory.createXMLStreamReader(resourceAsStream);
+ */
+ final XMLStreamReader reader = UntrustedXML.createXMLStreamReader(resourceAsStream);
+
+ final NormalizedNodeResult result = new NormalizedNodeResult();
+ final NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result);
+
+ final XmlParserStream xmlParser = XmlParserStream.create(streamWriter, hwContainerSchema);
+ xmlParser.parse(reader);
+
+ xmlParser.flush();
+ xmlParser.close();
+
+ NormalizedNode transformedInput = result.getResult();
+
+ List<Inventory> inventoryList = ORanDOMToInternalDataModel.getInventoryList(nodeId, transformedInput);
+ assertEquals("All elements", 27, inventoryList.size());
+ assertEquals("Treelevel always there", 0,
+ inventoryList.stream().filter(inventory -> inventory.getTreeLevel() == null).count());
+ }
+
+ @Test
+ public void testIetfSystemFromXML() throws XMLStreamException, URISyntaxException, IOException, SAXException {
+
+ final InputStream resourceAsStream = TestORanDOMToInternalDataModel.class.getResourceAsStream("/onap-system.xml");
+
+ final XMLStreamReader reader = UntrustedXML.createXMLStreamReader(resourceAsStream);
+
+ final NormalizedNodeResult result = new NormalizedNodeResult();
+ final NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result);
+
+ final XmlParserStream xmlParser = XmlParserStream.create(streamWriter, systemSchema);
+ xmlParser.parse(reader);
+
+ xmlParser.flush();
+ xmlParser.close();
+
+ 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));
+ assertEquals(gc.isPresent(), true);
+
+ }
+
+ @Test
+ public void testORANFault() {
+ ContainerNode cn = createORANDOMFault();
+ NetconfDeviceNotification faultNotif = new NetconfDeviceNotification(cn, Instant.now());
+ FaultlogEntity fle = ORanDOMToInternalDataModel.getFaultLog(faultNotif, nodeId, 1);
+ assertEquals(fle.getId(), "47");
+ }
+
+ 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();
+ }
+
+ public static class NetconfDeviceNotification implements DOMNotification, DOMEvent {
+ private final ContainerNode content;
+ private final Absolute schemaPath;
+ private final Instant eventTime;
+
+ NetconfDeviceNotification(final ContainerNode content, final Instant eventTime) {
+ this.content = content;
+ this.eventTime = eventTime;
+ this.schemaPath = Absolute.of(content.getIdentifier().getNodeType());
+ }
+
+ NetconfDeviceNotification(final ContainerNode content, final Absolute schemaPath, final Instant eventTime) {
+ this.content = content;
+ this.eventTime = eventTime;
+ this.schemaPath = schemaPath;
+ }
+
+ @Override
+ public Absolute getType() {
+ return schemaPath;
+ }
+
+ @Override
+ public ContainerNode getBody() {
+ return content;
+ }
+
+ @Override
+ public Instant getEventInstant() {
+ return eventTime;
+ }
+ }
}
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 27793e4bb..2ca2ee445 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
@@ -26,7 +26,6 @@ import org.junit.After;
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.impl.startup.ORanNetworkElementFactory;
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;
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 d520af5ba..af4514ef3 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
@@ -28,7 +28,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.binding.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;
@@ -51,69 +50,69 @@ import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
@RunWith(MockitoJUnitRunner.class)
public class TestORanRegistrationToVESpnfRegistration {
- @Mock
- NetconfAccessor netconfAccessor;
- @Mock
- VESCollectorService vesCollectorService;
- @Mock
- VESCollectorCfgService vesCfgService;
+ @Mock
+ NetconfAccessor netconfAccessor;
+ @Mock
+ VESCollectorService vesCollectorService;
+ @Mock
+ VESCollectorCfgService vesCfgService;
- private static final QNameModule IETF_HARDWARE_MODULE = QNameModule
- .create(XMLNamespace.of("urn:ietf:params:xml:ns:yang:ietf-hardware"), Revision.of("2018-03-13"));
- private static final QName HW_COMPONENT_LIST = QName.create(IETF_HARDWARE_MODULE, "component");
- private static final QName HW_COMPONENT_LIST_KEY = QName.create(IETF_HARDWARE_MODULE, "name");
- private static final QName HW_COMPONENT_LIST_CLASS = QName.create(IETF_HARDWARE_MODULE, "class");
- private static final QName HW_COMPONENT_LIST_PHYSICAL_INDEX = QName.create(IETF_HARDWARE_MODULE, "physical-index"); // leaf:int32
- private static final QName HW_COMPONENT_LIST_DESC = QName.create(IETF_HARDWARE_MODULE, "description"); // leaf:String
- private static final QName HW_COMPONENT_LIST_SW_REV = QName.create(IETF_HARDWARE_MODULE, "software-rev"); // leaf:String
- private static final QName HW_COMPONENT_LIST_SER_NUM = QName.create(IETF_HARDWARE_MODULE, "serial-num"); // leaf:String
- private static final QName HW_COMPONENT_LIST_MFG_NAME = QName.create(IETF_HARDWARE_MODULE, "mfg-name"); // leaf:String
- private static final QName HW_COMPONENT_LIST_MODEL_NAME = QName.create(IETF_HARDWARE_MODULE, "model-name"); // leaf:String
- private static final QName HW_COMPONENT_LIST_ALIAS = QName.create(IETF_HARDWARE_MODULE, "alias"); // leaf:String
+ private static final QNameModule IETF_HARDWARE_MODULE =
+ QNameModule.create(XMLNamespace.of("urn:ietf:params:xml:ns:yang:ietf-hardware"), Revision.of("2018-03-13"));
+ private static final QName HW_COMPONENT_LIST = QName.create(IETF_HARDWARE_MODULE, "component");
+ private static final QName HW_COMPONENT_LIST_KEY = QName.create(IETF_HARDWARE_MODULE, "name");
+ private static final QName HW_COMPONENT_LIST_CLASS = QName.create(IETF_HARDWARE_MODULE, "class");
+ private static final QName HW_COMPONENT_LIST_PHYSICAL_INDEX = QName.create(IETF_HARDWARE_MODULE, "physical-index"); // leaf:int32
+ private static final QName HW_COMPONENT_LIST_DESC = QName.create(IETF_HARDWARE_MODULE, "description"); // leaf:String
+ private static final QName HW_COMPONENT_LIST_SW_REV = QName.create(IETF_HARDWARE_MODULE, "software-rev"); // leaf:String
+ private static final QName HW_COMPONENT_LIST_SER_NUM = QName.create(IETF_HARDWARE_MODULE, "serial-num"); // leaf:String
+ private static final QName HW_COMPONENT_LIST_MFG_NAME = QName.create(IETF_HARDWARE_MODULE, "mfg-name"); // leaf:String
+ private static final QName HW_COMPONENT_LIST_MODEL_NAME = QName.create(IETF_HARDWARE_MODULE, "model-name"); // leaf:String
+ private static final QName HW_COMPONENT_LIST_ALIAS = QName.create(IETF_HARDWARE_MODULE, "alias"); // leaf:String
- @Test
- public void test() {
- NetconfNode testNetconfNode = mock(NetconfNode.class);
- when(testNetconfNode.getHost()).thenReturn(new Host(new IpAddress(new Ipv4Address("10.10.10.10"))));
+ @Test
+ public void test() {
+ NetconfNode testNetconfNode = mock(NetconfNode.class);
+ when(testNetconfNode.getHost()).thenReturn(new Host(new IpAddress(new Ipv4Address("10.10.10.10"))));
- when(netconfAccessor.getNodeId()).thenReturn(new NodeId("nSky"));
- when(netconfAccessor.getNetconfNode()).thenReturn(testNetconfNode);
- when(vesCollectorService.getConfig()).thenReturn(vesCfgService);
- when(vesCfgService.getReportingEntityName()).thenReturn("SDN-R");
+ when(netconfAccessor.getNodeId()).thenReturn(new NodeId("nSky"));
+ when(netconfAccessor.getNetconfNode()).thenReturn(testNetconfNode);
+ when(vesCollectorService.getConfig()).thenReturn(vesCfgService);
+ when(vesCfgService.getReportingEntityName()).thenReturn("SDN-R");
- ORanRegistrationToVESpnfRegistrationMapper mapper = new ORanRegistrationToVESpnfRegistrationMapper(
- netconfAccessor, vesCollectorService);
- VESCommonEventHeaderPOJO commonHeader = mapper.mapCommonEventHeader(buildComponentEntry());
- VESPNFRegistrationFieldsPOJO pnfFields = mapper.mapPNFRegistrationFields(buildComponentEntry());
+ ORanRegistrationToVESpnfRegistrationMapper mapper =
+ new ORanRegistrationToVESpnfRegistrationMapper(netconfAccessor, vesCollectorService);
+ VESCommonEventHeaderPOJO commonHeader = mapper.mapCommonEventHeader(buildComponentEntry());
+ VESPNFRegistrationFieldsPOJO pnfFields = mapper.mapPNFRegistrationFields(buildComponentEntry());
- assertEquals(commonHeader.getNfVendorName(), "ISCO");
- assertEquals(pnfFields.getUnitType(), "chassis");
- assertEquals(pnfFields.getSerialNumber(), "10283");
- assertEquals(pnfFields.getSoftwareVersion(), "3.8.1 (2020-10-30 11:47:59)");
- }
+ assertEquals(commonHeader.getNfVendorName(), "ISCO");
+ assertEquals(pnfFields.getUnitType(), "chassis");
+ assertEquals(pnfFields.getSerialNumber(), "10283");
+ assertEquals(pnfFields.getSoftwareVersion(), "3.8.1 (2020-10-30 11:47:59)");
+ }
- public MapEntryNode buildComponentEntry() {
- return Builders.mapEntryBuilder()
- .withNodeIdentifier(
- NodeIdentifierWithPredicates.of(HW_COMPONENT_LIST, HW_COMPONENT_LIST_KEY, "chassis"))
- .withChild(Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(HW_COMPONENT_LIST_CLASS))
- .withValue("ianahw:chassis").build())
- .withChild(Builders.leafBuilder()
- .withNodeIdentifier(new NodeIdentifier(HW_COMPONENT_LIST_PHYSICAL_INDEX)).withValue(1).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(HW_COMPONENT_LIST_MFG_NAME))
- .withValue("ISCO").build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(HW_COMPONENT_LIST_MODEL_NAME))
- .withValue("ProteusCPRI Compact").build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(HW_COMPONENT_LIST_ALIAS))
- .withValue("chassis").build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(HW_COMPONENT_LIST_SER_NUM))
- .withValue("10283").build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(HW_COMPONENT_LIST_DESC))
- .withValue("HighStreet-ONAP40").build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(HW_COMPONENT_LIST_SW_REV))
- .withValue("3.8.1 (2020-10-30 11:47:59)").build())
- .build();
+ public MapEntryNode buildComponentEntry() {
+ return Builders.mapEntryBuilder()
+ .withNodeIdentifier(
+ NodeIdentifierWithPredicates.of(HW_COMPONENT_LIST, HW_COMPONENT_LIST_KEY, "chassis"))
+ .withChild(Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(HW_COMPONENT_LIST_CLASS))
+ .withValue("ianahw:chassis").build())
+ .withChild(Builders.leafBuilder()
+ .withNodeIdentifier(new NodeIdentifier(HW_COMPONENT_LIST_PHYSICAL_INDEX)).withValue(1).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(HW_COMPONENT_LIST_MFG_NAME))
+ .withValue("ISCO").build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(HW_COMPONENT_LIST_MODEL_NAME))
+ .withValue("ProteusCPRI Compact").build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(HW_COMPONENT_LIST_ALIAS))
+ .withValue("chassis").build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(HW_COMPONENT_LIST_SER_NUM))
+ .withValue("10283").build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(HW_COMPONENT_LIST_DESC))
+ .withValue("HighStreet-ONAP40").build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(HW_COMPONENT_LIST_SW_REV))
+ .withValue("3.8.1 (2020-10-30 11:47:59)").build())
+ .build();
- }
+ }
}