aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager-onf14
diff options
context:
space:
mode:
authorMichael DÜrre <michael.duerre@highstreet-technologies.com>2021-04-08 06:34:22 +0200
committerMichael DÜrre <michael.duerre@highstreet-technologies.com>2021-04-08 06:34:46 +0200
commitf3969004c6ccac18e742c5fc48c844e315991023 (patch)
treef5486a62e842bb16ca7d3af47a8663df08feef55 /sdnr/wt/devicemanager-onf14
parenta252be83694ae33260d99d5371ed48c1558aa2e8 (diff)
update websocketmanager
update complete notification flow Issue-ID: CCSDK-3252 Signed-off-by: Michael DÜrre <michael.duerre@highstreet-technologies.com> Change-Id: I87ba00f615707b942471fcace57bcda50ce37e61
Diffstat (limited to 'sdnr/wt/devicemanager-onf14')
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/pom.xml5
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14Configuration.java54
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14DomNetworkElement.java93
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14NetworkElement.java46
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14NetworkElementFactory.java43
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/dataprovider/Onf14ToInternalDataModel.java17
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/equipment/Onf14DomEquipmentManager.java106
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14AirInterfaceNotificationListener.java62
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14DomInterfacePacManager.java91
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14EthernetContainerNotificationListener.java80
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14WireInterfaceNotificationListener.java50
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14AirInterfaceNotificationListener.java5
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14EthernetContainerNotificationListener.java4
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElement.java4
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElementFactory.java13
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14WireInterfaceNotificationListener.java5
16 files changed, 491 insertions, 187 deletions
diff --git a/sdnr/wt/devicemanager-onf14/provider/pom.xml b/sdnr/wt/devicemanager-onf14/provider/pom.xml
index 6aa30a582..951a4d005 100644
--- a/sdnr/wt/devicemanager-onf14/provider/pom.xml
+++ b/sdnr/wt/devicemanager-onf14/provider/pom.xml
@@ -74,6 +74,11 @@
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>mdsal-binding-dom-codec-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>${project.groupId}</groupId>
<artifactId>sdnr-wt-netconfnode-state-service-model</artifactId>
<version>${project.version}</version>
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14Configuration.java b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14Configuration.java
new file mode 100644
index 000000000..8396e8d9c
--- /dev/null
+++ b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14Configuration.java
@@ -0,0 +1,54 @@
+/*
+ * ============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.onf14.impl;
+
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
+
+public class Onf14Configuration implements Configuration {
+
+ private static final String SECTION_MARKER_DMONF = "dmonf14";
+
+ private static final String DEFAULT_VALUE_ENABLED = "${SDNR_ONF14_USEDOMAPI}";
+ private static final String PROPERTY_KEY_USEDOMAPI = "useDomApi";
+
+ private final ConfigurationFileRepresentation configuration;
+
+ public Onf14Configuration(ConfigurationFileRepresentation configuration) {
+ this.configuration = configuration;
+ this.configuration.addSection(SECTION_MARKER_DMONF);
+ defaults();
+ }
+
+ public boolean isUseDomApiEnabled() {
+
+ return configuration.getPropertyBoolean(SECTION_MARKER_DMONF, PROPERTY_KEY_USEDOMAPI);
+ }
+
+ @Override
+ public String getSectionName() {
+ return SECTION_MARKER_DMONF;
+ }
+
+ @Override
+ public void defaults() {
+ //Add default if not available
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER_DMONF, PROPERTY_KEY_USEDOMAPI, DEFAULT_VALUE_ENABLED);
+ }
+
+}
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14DomNetworkElement.java b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14DomNetworkElement.java
index 0a63b7449..177f25e1e 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14DomNetworkElement.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14DomNetworkElement.java
@@ -17,6 +17,8 @@
*/
package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl;
+import java.util.List;
+import java.util.Map;
import java.util.Optional;
import org.eclipse.jdt.annotation.NonNull;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
@@ -29,26 +31,26 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServic
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData;
-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.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.onf.yang.core.model._1._4.rev191127.ControlConstruct;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.UniversalId;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.control.construct.Equipment;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementConnectionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementDeviceType;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Representation of ONF Core model 1.4 device Top level element is "ControlConstruct" (replaces "NetworkElement" of
- * older ONF Version)
- * NOTE: This class is still under development due to unmet dependencies (especially the ones related to DOM notifications) in ODL. Once the dependencies are complete, this class will replace the ONF14NetworkElement
+ * older ONF Version) NOTE: This class is still under development due to unmet dependencies (especially the ones related
+ * to DOM notifications) in ODL. Once the dependencies are complete, this class will replace the ONF14NetworkElement
*/
public class Onf14DomNetworkElement implements NetworkElement {
@@ -68,17 +70,24 @@ public class Onf14DomNetworkElement implements NetworkElement {
private final @NonNull Onf14DomEquipmentManager equipmentManager;
private final @NonNull Onf14DomInterfacePacManager interfacePacManager;
+ private final @NonNull String namespaceRevision;
+ private boolean experimental;
- public Onf14DomNetworkElement(NetconfDomAccessor netconfDomAccessor, DeviceManagerServiceProvider serviceProvider) {
+
+ public Onf14DomNetworkElement(NetconfDomAccessor netconfDomAccessor, DeviceManagerServiceProvider serviceProvider,
+ String namespaceRevision) {
log.info("Create {}", Onf14DomNetworkElement.class.getSimpleName());
this.netconfDomAccessor = netconfDomAccessor;
this.databaseService = serviceProvider.getDataProvider();
this.notificationService = serviceProvider.getNotificationService();
this.faultService = serviceProvider.getFaultService();
+ this.namespaceRevision = namespaceRevision;
this.onf14Mapper = new Onf14ToInternalDataModel();
this.equipmentManager = new Onf14DomEquipmentManager(netconfDomAccessor, databaseService, onf14Mapper);
+
this.interfacePacManager = new Onf14DomInterfacePacManager(netconfDomAccessor, serviceProvider);
+ this.experimental = false;
}
/**
@@ -94,20 +103,31 @@ public class Onf14DomNetworkElement implements NetworkElement {
equipmentManager.setEquipmentData(controlConstruct);
- //-- Start For test purpose
- for (UniversalId uuid : equipmentManager.getEquipmentUuidList()) {
- log.info("Read data with id {}", uuid);
- Optional<Equipment> res1 = equipmentManager.readEquipmentInstance(netconfDomAccessor, uuid);
- log.info("Res1: {}", res1.isPresent() ? res1.get() : "No data1");
-
- Optional<ControlConstruct> res2 = equipmentManager.readEquipmentList(netconfDomAccessor, uuid);
- log.info("Res2: {}", res2.isPresent() ? res2.get() : "No data2");
+ //-- Start for experimental purpose
+ if (experimental) {
+ log.warn("Experimental code activated");
+ for (UniversalId uuid : equipmentManager.getEquipmentUuidList()) {
+ log.info("Read data with id {}", uuid);
+ Optional<Equipment> res1 = equipmentManager.readEquipmentInstance(netconfDomAccessor, uuid);
+ log.info("Res1: {}", res1.isPresent() ? res1.get() : "No data1");
+
+ /*List<DataObject> res2 = equipmentManager.readEquipmentList(netconfDomAccessor);
+ log.info("Res2: {}", res2.isPresent() ? res2.get() : "No data2");*/
+
+ equipmentManager.readTopLevelEquipment(netconfDomAccessor);
+ //Do it only once for test purpose and break
+ break;
+ }
+ List<DataObject> res2 = equipmentManager.readEquipmentList(netconfDomAccessor);
+ //log.info("Res2: {}", res2.isPresent() ? res2.get() : "No data2");
+ for (DataObject dobj : res2) {
+ Equipment eqpt = (Equipment) dobj;
+ log.info("Equipment local ID is : {}", eqpt.getLocalId());
+ }
equipmentManager.readTopLevelEquipment(netconfDomAccessor);
- //Do it only once for test purpose
- break;
}
- //-- End For test purpose
+ //-- End for experimental purpose
// storing all the LTP UUIDs internally, for later usage, for air-interface and ethernet-container
interfacePacManager.readKeys(controlConstruct);
@@ -138,39 +158,27 @@ public class Onf14DomNetworkElement implements NetworkElement {
/**
* @param nNode set core-model-capability
*/
- public void setCoreModel(@NonNull NetconfNode nNode) {
+ public void setCoreModel() {
NetworkElementConnectionBuilder eb = new NetworkElementConnectionBuilder();
- String namespaceRevision;
- QName QNAME_COREMODEL14 = QName.create("urn:onf:yang:core-model-1-4", "2019-11-27", "core-model-1-4").intern();
-
- Capabilities availableCapabilities = Capabilities.getAvailableCapabilities(nNode);
- namespaceRevision = availableCapabilities.getRevisionForNamespace(QNAME_COREMODEL14);
-
- if (Capabilities.isNamespaceSupported(namespaceRevision)) {
- eb.setCoreModelCapability(namespaceRevision);
- } else {
- eb.setCoreModelCapability("Unsupported");
- }
+ eb.setCoreModelCapability(namespaceRevision);
databaseService.updateNetworkConnection22(eb.build(), netconfDomAccessor.getNodeId().getValue());
}
@Override
public void register() {
// Set core-model revision value in "core-model-capability" field
- setCoreModel(netconfDomAccessor.getNetconfNode());
+ setCoreModel();
initialReadFromNetworkElement();
- // Register netconf stream
- // airInterfaceNotificationListenerHandler =
- // netconfDomAccessor.doRegisterNotificationListener(airInterfaceNotificationListener);
- // etherneContainerNotificationListenerHandler =
- // netconfDomAccessor.doRegisterNotificationListener(ethernetContainerNotificationListener);
- // wireInterfaceNotificationListenerHandler =
- // netconfDomAccessor.doRegisterNotificationListener(wireInterfaceNotificationListener);
- // Optional<NetconfNotifications> notificationsSupport = netconfDomAccessor.getNotificationAccessor();
- // if (notificationsSupport.isPresent()) {
- // notificationsSupport.get().registerNotificationsStream(NetconfBindingAccessor.DefaultNotificationsStream);
- // }
+ if (netconfDomAccessor.isNotificationsRFC5277Supported()) {
+ // register listener
+ interfacePacManager.subscribeNotifications();
+ // Output notification streams to LOG
+ Map<StreamKey, Stream> streams = netconfDomAccessor.getNotificationStreamsAsMap();
+ log.info("Available notifications streams: {}", streams);
+ // Register to default stream
+ netconfDomAccessor.invokeCreateSubscription();
+ }
}
@Override
@@ -201,7 +209,8 @@ public class Onf14DomNetworkElement implements NetworkElement {
}
private static Optional<ControlConstruct> readControlConstruct(NetconfDomAccessor netconfDomAccessor) {
- return netconfDomAccessor.readData(LogicalDatastoreType.CONFIGURATION, CONTROLCONSTRUCT_IID, ControlConstruct.class);
+ return netconfDomAccessor.readData(LogicalDatastoreType.CONFIGURATION, CONTROLCONSTRUCT_IID,
+ ControlConstruct.class);
}
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14NetworkElement.java b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14NetworkElement.java
index a5599be30..b314dbdbe 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14NetworkElement.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14NetworkElement.java
@@ -40,7 +40,6 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData;
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.NetconfNotifications;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.LAYERPROTOCOLNAMETYPEAIRLAYER;
import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.air._interface.lp.spec.AirInterfacePac;
@@ -62,6 +61,7 @@ import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123
import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.wire._interface.lp.spec.WireInterfacePac;
import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.wire._interface.pac.WireInterfaceCurrentProblems;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
+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.NetworkElementConnectionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementDeviceType;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
@@ -118,7 +118,8 @@ public class Onf14NetworkElement implements NetworkElement {
this.faultService = serviceProvider.getFaultService();
this.onf14Mapper = new Onf14ToInternalDataModel();
this.airInterfaceNotificationListenerHandler = null;
- this.airInterfaceNotificationListener = new Onf14AirInterfaceNotificationListener(netconfAccess, serviceProvider);
+ this.airInterfaceNotificationListener =
+ new Onf14AirInterfaceNotificationListener(netconfAccess, serviceProvider);
this.etherneContainerNotificationListenerHandler = null;
ethernetContainerNotificationListener =
new Onf14EthernetContainerNotificationListener(netconfAccess, serviceProvider);
@@ -190,8 +191,7 @@ public class Onf14NetworkElement implements NetworkElement {
}
/**
- * @param nNode
- * set core-model-capability
+ * @param nNode set core-model-capability
*/
public void setCoreModel(@NonNull NetconfNode nNode) {
NetworkElementConnectionBuilder eb = new NetworkElementConnectionBuilder();
@@ -201,7 +201,7 @@ public class Onf14NetworkElement implements NetworkElement {
Capabilities availableCapabilities = Capabilities.getAvailableCapabilities(nNode);
namespaceRevision = availableCapabilities.getRevisionForNamespace(QNAME_COREMODEL14);
- log.info("In setCoreModel for Onf14NetworkElement- namespaceRevision = "+namespaceRevision);
+ log.info("In setCoreModel for Onf14NetworkElement- namespaceRevision = " + namespaceRevision);
if (Capabilities.isNamespaceSupported(namespaceRevision)) {
eb.setCoreModelCapability(namespaceRevision);
} else {
@@ -223,10 +223,7 @@ public class Onf14NetworkElement implements NetworkElement {
netconfAccessor.doRegisterNotificationListener(ethernetContainerNotificationListener);
wireInterfaceNotificationListenerHandler =
netconfAccessor.doRegisterNotificationListener(wireInterfaceNotificationListener);
- Optional<NetconfNotifications> notificationsSupport = netconfAccessor.getNotificationAccessor();
- if (notificationsSupport.isPresent()) {
- notificationsSupport.get().registerNotificationsStream(NetconfBindingAccessor.DefaultNotificationsStream);
- }
+ netconfAccessor.registerNotificationsStream(NetconfBindingAccessor.DefaultNotificationsStream);
}
@Override
@@ -267,6 +264,7 @@ public class Onf14NetworkElement implements NetworkElement {
List<UniversalId> topLevelEquipment = controlConstruct.get().getTopLevelEquipment();
if (topLevelEquipment != null) {
+ List<Inventory> inventoryList = new ArrayList<>();
for (UniversalId uuid : topLevelEquipment) {
log.debug("Got back topLevelEquipment with uuid {}", uuid.getValue());
@@ -275,9 +273,11 @@ public class Onf14NetworkElement implements NetworkElement {
Equipment equipmentInstance = readEquipmentInstance(netconfAccessor, uuid);
if (equipmentInstance != null) {
// recursively adding the root equipment and all its children into the DB
- addEquipmentToDb(equipmentInstance, null, EQUIPMENTROOTLEVEL);
+ collectEquipment(inventoryList, equipmentInstance, null, EQUIPMENTROOTLEVEL);
}
}
+ this.databaseService.writeInventory(this.netconfAccessor.getNodeId().getValue(), inventoryList);
+
}
}
@@ -285,14 +285,15 @@ public class Onf14NetworkElement implements NetworkElement {
readKeys(controlConstruct);
}
- private void addEquipmentToDb(Equipment currentEq, Equipment parentEq, long treeLevel) {
+ private List<Inventory> collectEquipment(List<Inventory> list, Equipment currentEq, Equipment parentEq,
+ long treeLevel) {
// if the Equipment UUID is already in the list, it was already processed
// needed for solving possible circular dependencies
if (equipmentUuidList.contains(currentEq.getUuid().getValue())) {
log.debug("Not adding equipment with uuid {} because it was aleady added...",
currentEq.getUuid().getValue());
- return;
+ return list;
}
// we add this to our internal list, such that we avoid circular dependencies
@@ -300,8 +301,7 @@ public class Onf14NetworkElement implements NetworkElement {
log.debug("Adding equipment with uuid {} to the database...", currentEq.getUuid().getValue());
// we add our current equipment to the database
- databaseService.writeInventory(
- onf14Mapper.getInternalEquipment(netconfAccessor.getNodeId(), currentEq, parentEq, treeLevel));
+ list.add(onf14Mapper.getInternalEquipment(netconfAccessor.getNodeId(), currentEq, parentEq, treeLevel));
// we iterate the kids of our current equipment and add them to the database recursively
// the actual reference is here: /core-model:control-construct/equipment/contained-holder/occupying-fru
@@ -317,17 +317,19 @@ public class Onf14NetworkElement implements NetworkElement {
if (childEq != null) {
// current becomes parent and tree level increases by 1
- addEquipmentToDb(childEq, currentEq, treeLevel + 1);
+ collectEquipment(list, childEq, currentEq, treeLevel + 1);
}
}
}
+ return list;
}
private void readKeys(Optional<ControlConstruct> controlConstruct) {
if (controlConstruct.isPresent()) {
@NonNull
- Collection<LogicalTerminationPoint> ltpList = YangHelper.getCollection(controlConstruct.get().nonnullLogicalTerminationPoint());
+ Collection<LogicalTerminationPoint> ltpList =
+ YangHelper.getCollection(controlConstruct.get().nonnullLogicalTerminationPoint());
log.debug("Iterating the LTP list for node {}", netconfAccessor.getNodeId().getValue());
// iterating all the Logical Termination Point list
@@ -397,8 +399,8 @@ public class Onf14NetworkElement implements NetworkElement {
} else if (problems.getCurrentProblemList() == null) {
log.debug("DBRead Id {} empty CurrentProblemList", ltpUuid);
} else {
- for (org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.air._interface.current.problems.CurrentProblemList problem : YangHelper.getCollection(problems
- .nonnullCurrentProblemList())) {
+ for (org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.air._interface.current.problems.CurrentProblemList problem : YangHelper
+ .getCollection(problems.nonnullCurrentProblemList())) {
resultList.add(netconfAccessor.getNodeId(), (int) problem.getSequenceNumber(), problem.getTimestamp(),
ltpUuid.getValue(), problem.getProblemName(),
Onf14AirInterface.mapSeverity(problem.getProblemSeverity()));
@@ -431,8 +433,8 @@ public class Onf14NetworkElement implements NetworkElement {
} else if (problems.getCurrentProblemList() == null) {
log.debug("DBRead Id {} empty CurrentProblemList", ltpUuid);
} else {
- for (org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.ethernet.container.current.problems.CurrentProblemList problem : YangHelper.getCollection(problems
- .nonnullCurrentProblemList())) {
+ for (org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.ethernet.container.current.problems.CurrentProblemList problem : YangHelper
+ .getCollection(problems.nonnullCurrentProblemList())) {
resultList.add(netconfAccessor.getNodeId(), (int) problem.getSequenceNumber(), problem.getTimestamp(),
ltpUuid.getValue(), problem.getProblemName(),
Onf14EthernetContainer.mapSeverity(problem.getProblemSeverity()));
@@ -465,8 +467,8 @@ public class Onf14NetworkElement implements NetworkElement {
} else if (problems.getCurrentProblemList() == null) {
log.debug("DBRead Id {} empty CurrentProblemList", ltpUuid);
} else {
- for (org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.wire._interface.current.problems.CurrentProblemList problem : YangHelper.getCollection(problems
- .nonnullCurrentProblemList())) {
+ for (org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.wire._interface.current.problems.CurrentProblemList problem : YangHelper
+ .getCollection(problems.nonnullCurrentProblemList())) {
resultList.add(netconfAccessor.getNodeId(), (int) problem.getSequenceNumber(), problem.getTimestamp(),
ltpUuid.getValue(), problem.getProblemName(),
Onf14WireInterface.mapSeverity(problem.getProblemSeverity()));
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14NetworkElementFactory.java b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14NetworkElementFactory.java
index 514100292..ecf53a1fa 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14NetworkElementFactory.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14NetworkElementFactory.java
@@ -22,26 +22,45 @@ 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.service.DeviceManagerServiceProvider;
+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.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.ControlConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Onf14NetworkElementFactory implements NetworkElementFactory {
- private static final Logger log = LoggerFactory.getLogger(Onf14NetworkElementFactory.class);
+ private static final Logger log = LoggerFactory.getLogger(Onf14NetworkElementFactory.class);
+ private Optional<Onf14Configuration> configuration = Optional.empty();
- @Override
- public Optional<NetworkElement> create(NetconfAccessor accessor, DeviceManagerServiceProvider serviceProvider) {
- if (accessor.getCapabilites().isSupportingNamespace(ControlConstruct.QNAME)) {
- log.info("Create device {} ", Onf14NetworkElement.class.getName());
- Optional<NetconfBindingAccessor> bindingAccessor = accessor.getNetconfBindingAccessor();
- if (bindingAccessor.isPresent()) {
- return Optional.of(new Onf14NetworkElement(bindingAccessor.get(), serviceProvider));
- }
- }
- return Optional.empty();
+ @Override
+ public Optional<NetworkElement> create(NetconfAccessor accessor, DeviceManagerServiceProvider serviceProvider) {
- }
+ Optional<NetworkElement> ne = Optional.empty();
+ Capabilities capabilities = accessor.getCapabilites();
+ if (capabilities.isSupportingNamespace(ControlConstruct.QNAME)) {
+ String namespaceRevision = capabilities.getRevisionForNamespace(ControlConstruct.QNAME);
+
+ if (configuration.isPresent() && configuration.get().isUseDomApiEnabled()) {
+ Optional<NetconfDomAccessor> domAccessor = accessor.getNetconfDomAccessor();
+ if (domAccessor.isPresent()) {
+ ne = Optional.of(new Onf14DomNetworkElement(domAccessor.get(), serviceProvider, namespaceRevision));
+ }
+ } else {
+ Optional<NetconfBindingAccessor> bindingAccessor = accessor.getNetconfBindingAccessor();
+ if (bindingAccessor.isPresent()) {
+ ne = Optional.of(new Onf14NetworkElement(bindingAccessor.get(), serviceProvider));
+ }
+ }
+ log.info("Create device:{}", ne.isPresent() ? ne.get().getClass().getSimpleName() : "not");
+ }
+ return ne;
+ }
+
+ @Override
+ public void init(DeviceManagerServiceProvider serviceProvider) {
+ configuration = Optional.of(new Onf14Configuration(serviceProvider.getConfigurationFileRepresentation()));
+ }
}
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/dataprovider/Onf14ToInternalDataModel.java b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/dataprovider/Onf14ToInternalDataModel.java
index 36eaf2fd3..52436da61 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/dataprovider/Onf14ToInternalDataModel.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/dataprovider/Onf14ToInternalDataModel.java
@@ -20,6 +20,7 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.dataprovider;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.Objects;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.onap.ccsdk.features.sdnr.wt.common.YangHelper;
@@ -48,27 +49,25 @@ public class Onf14ToInternalDataModel {
public Inventory getInternalEquipment(NodeId nodeId, Equipment currentEq, Equipment parentEq, long treeLevel) {
+ Objects.requireNonNull(nodeId);
+ Objects.requireNonNull(currentEq);
+
InventoryBuilder inventoryBuilder = new InventoryBuilder();
+ String parentUuid = parentEq != null ? parentEq.getUuid().getValue() : "None";
@Nullable
ActualEquipment component = currentEq.getActualEquipment();
if (component != null) {
-
// General
inventoryBuilder.setNodeId(nodeId.getValue());
-
inventoryBuilder.setTreeLevel(Uint32.valueOf(treeLevel));
inventoryBuilder.setUuid(currentEq.getUuid().getValue());
-
- if (parentEq != null) {
- inventoryBuilder.setParentUuid(parentEq.getUuid().getValue());
- } else {
- inventoryBuilder.setParentUuid("None");
- }
+ inventoryBuilder.setParentUuid(parentUuid);
List<String> containedHolderKeyList = new ArrayList<String>();
@NonNull
- Collection<ContainedHolder> containedHolderList = YangHelper.getCollection(currentEq.nonnullContainedHolder());
+ Collection<ContainedHolder> containedHolderList =
+ YangHelper.getCollection(currentEq.nonnullContainedHolder());
for (ContainedHolder holder : containedHolderList) {
@Nullable
UniversalId occupyingFru = holder.getOccupyingFru();
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/equipment/Onf14DomEquipmentManager.java b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/equipment/Onf14DomEquipmentManager.java
index 72ffdf6bc..092ad4a8f 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/equipment/Onf14DomEquipmentManager.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/equipment/Onf14DomEquipmentManager.java
@@ -22,31 +22,35 @@
package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.equipment;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
-
+import java.util.stream.Collectors;
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.onf14.impl.dataprovider.Onf14ToInternalDataModel;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfDomAccessor;
+import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.ControlConstruct;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.UniversalId;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.control.construct.Equipment;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.control.construct.EquipmentKey;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.equipment.ContainedHolder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Inventory;
import org.opendaylight.yangtools.util.UnmodifiableCollection;
import org.opendaylight.yangtools.yang.binding.CodeHelpers;
+import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.InstanceIdentifierBuilder;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -64,8 +68,9 @@ public class Onf14DomEquipmentManager {
private final DataProvider databaseService;
private final Onf14ToInternalDataModel onf14Mapper;
// for storing the Equipment UUIDs that are inserted in the DB
- private final List<UniversalId> equipmentUuidList = new ArrayList<>();
+ private final List<UniversalId> equipmentUuidList;
// end of variables
+ private final BindingNormalizedNodeSerializer serializer;
// constructors
public Onf14DomEquipmentManager(NetconfDomAccessor netconfDomAccessor, DataProvider databaseService,
@@ -74,6 +79,9 @@ public class Onf14DomEquipmentManager {
this.netconfDomAccessor = Objects.requireNonNull(netconfDomAccessor);
this.databaseService = Objects.requireNonNull(databaseService);
this.onf14Mapper = Objects.requireNonNull(onf14Mapper);
+ this.serializer = Objects.requireNonNull(netconfDomAccessor.getBindingNormalizedNodeSerializer());
+
+ this.equipmentUuidList = new ArrayList<>();
}
// end of constructors
@@ -84,11 +92,12 @@ public class Onf14DomEquipmentManager {
// end of getters and setters
// private methods
- private void addEquipmentToDb(Equipment currentEq, Equipment parentEq, long treeLevel,
- Map<EquipmentKey, Equipment> equipmentMap, EquipmentKey equipmentKey) {
+ private List<Inventory> collectEquipment(List<Inventory> list, Equipment currentEq, Equipment parentEq,
+ long treeLevel, Map<EquipmentKey, Equipment> equipmentMap, EquipmentKey equipmentKey) {
+ Objects.requireNonNull(list);
if (currentEq == null) {
log.info("Ignore empty equipment with key {}", equipmentKey);
- return;
+ return list;
}
// if the Equipment UUID is already in the list, it was already processed
@@ -96,7 +105,7 @@ public class Onf14DomEquipmentManager {
if (equipmentUuidList.contains(currentEq.getUuid())) {
log.debug("Not adding equipment with uuid {} because it was aleady added...",
currentEq.getUuid().getValue());
- return;
+ return list;
}
// we add this to our internal list, such that we avoid circular dependencies
@@ -104,8 +113,7 @@ public class Onf14DomEquipmentManager {
log.debug("Adding equipment with uuid {} to the database...", currentEq.getUuid().getValue());
// we add our current equipment to the database
- databaseService.writeInventory(
- onf14Mapper.getInternalEquipment(netconfDomAccessor.getNodeId(), currentEq, parentEq, treeLevel));
+ list.add(onf14Mapper.getInternalEquipment(netconfDomAccessor.getNodeId(), currentEq, parentEq, treeLevel));
// we iterate the kids of our current equipment and add them to the database recursively
// the actual reference is here: /core-model:control-construct/equipment/contained-holder/occupying-fru
@@ -114,9 +122,11 @@ public class Onf14DomEquipmentManager {
UniversalId occupyingFru = holder.getOccupyingFru();
if (occupyingFru != null) {
equipmentKey = new EquipmentKey(occupyingFru);
- addEquipmentToDb(equipmentMap.get(equipmentKey), currentEq, treeLevel + 1, equipmentMap, equipmentKey);
+ collectEquipment(list, equipmentMap.get(equipmentKey), currentEq, treeLevel + 1, equipmentMap,
+ equipmentKey);
}
}
+ return list;
}
// end of private methods
@@ -139,11 +149,14 @@ public class Onf14DomEquipmentManager {
// adding all root Equipment objects to the DB
Map<EquipmentKey, Equipment> equipmentMap = controlConstruct.nonnullEquipment();
// recursively adding the root equipment and all its children into the DB
- addEquipmentToDb(equipmentMap.get(equipmentKey), null, EQUIPMENTROOTLEVEL, equipmentMap, equipmentKey);
+ List<Inventory> dbInventory = collectEquipment(new ArrayList<>(), equipmentMap.get(equipmentKey), null,
+ EQUIPMENTROOTLEVEL, equipmentMap, equipmentKey);
+ this.databaseService.writeInventory(netconfDomAccessor.getNodeId().getValue(), dbInventory);
}
}
/**
+ * Experimental see section in {@link #Onf14DomNetworkElement.initialReadFromNetworkElement()}
* Read one equipment from device
*
* @param accessData to access device
@@ -165,28 +178,42 @@ public class Onf14DomEquipmentManager {
}
/**
- * Read one equipment list from device
+ * Experimental see section in {@link #Onf14DomNetworkElement.initialReadFromNetworkElement()}
+ * Read one equipment list from device.
*
* @param accessData to access device
* @param equipmentUuid uuid of equipment to be read
* @return Optional Equipment
*/
- public Optional<ControlConstruct> readEquipmentList(NetconfDomAccessor accessData, UniversalId equipmentUuid) {
+ public List<DataObject> readEquipmentList(NetconfDomAccessor accessData) {
+ log.info("DBRead Get equipment-list for mountpoint {} ", accessData.getNodeId().getValue());
+
+ InstanceIdentifierBuilder equipmentIIDBuilder =
+ YangInstanceIdentifier.builder().node(ControlConstruct.QNAME).node(Equipment.QNAME);
- log.info("DBRead Get equipment-list for mountpoint {} for uuid {}", accessData.getNodeId().getValue(),
- equipmentUuid.getValue());
+ InstanceIdentifierBuilder equipmentIIDBuilderOnly = YangInstanceIdentifier.builder().node(Equipment.QNAME);
- YangInstanceIdentifier equipmentIIDBuilder = YangInstanceIdentifier.builder()
- .node(ControlConstruct.QNAME)
- .node(Equipment.QNAME)
- .node(NodeIdentifierWithPredicates.of(Equipment.QNAME))
- .build();
+ Optional<NormalizedNode<?, ?>> oData =
+ accessData.readDataNode(LogicalDatastoreType.CONFIGURATION, equipmentIIDBuilder.build());
+ if (oData.isPresent()) {
+ NormalizedNode<?, ?> data = oData.get();
- return accessData.readData(LogicalDatastoreType.CONFIGURATION, equipmentIIDBuilder,
- ControlConstruct.class);
+ log.debug("convertNormalizedNode data identifier: {} data nodetype: {}", data.getIdentifier(),
+ data.getNodeType());
+ final List<DataObject> mapEntries1 = ((MapNode) data).getValue().stream().map(mapEntryNode -> {
+ final YangInstanceIdentifier mapEntryPath =
+ equipmentIIDBuilderOnly.build().node(mapEntryNode.getIdentifier());
+ return serializer.fromNormalizedNode(mapEntryPath, mapEntryNode).getValue();
+ }).collect(Collectors.toList());
+ return mapEntries1;
+ } else {
+ log.warn("Device does not provide any equipment");
+ return Collections.emptyList();
+ }
}
/**
+ * Experimental see section in {@link #Onf14DomNetworkElement.initialReadFromNetworkElement()}
* Read one equipment list from device
*
* @param accessData to access device
@@ -202,20 +229,27 @@ public class Onf14DomEquipmentManager {
Optional<NormalizedNode<?, ?>> oData =
accessData.readDataNode(LogicalDatastoreType.CONFIGURATION, equipmentIIDBuilder.build());
- NormalizedNode<?, ?> data = oData.get();
- Object value = data.getValue();
- log.info("DataNode: {} {}", data.getNodeType(), data.getIdentifier());
- if (value != null) {
- log.info("DataNode value: {} {}", value.getClass().getName(), value);
- if (value instanceof UnmodifiableCollection) {
- @SuppressWarnings("unchecked")
- UnmodifiableCollection<LeafSetEntryNode<String>> topLevelEquipmentCollection = (UnmodifiableCollection<LeafSetEntryNode<String>>) value;
- @NonNull
- Iterator<LeafSetEntryNode<String>> it = topLevelEquipmentCollection.iterator();
- while (it.hasNext()) {
- LeafSetEntryNode<String> topLevelEquipmentUuid = it.next();
- if (topLevelEquipmentUuid != null) {
- log.info("LeafSetEntryNode: {} {} {}", topLevelEquipmentUuid.getValue(), topLevelEquipmentUuid.getNodeType() ,topLevelEquipmentUuid.getValue().getClass().getName());
+ log.info("Checking for existence of data");
+ if (oData.isPresent()) {
+ log.info("data exists");
+ NormalizedNode<?, ?> data = oData.get();
+ Object value = data.getValue();
+ log.info("DataNode: {} {}", data.getNodeType(), data.getIdentifier());
+ if (value != null) {
+ log.info("DataNode value: {} {}", value.getClass().getName(), value);
+ if (value instanceof UnmodifiableCollection) {
+ @SuppressWarnings("unchecked")
+ UnmodifiableCollection<LeafSetEntryNode<String>> topLevelEquipmentCollection =
+ (UnmodifiableCollection<LeafSetEntryNode<String>>) value;
+ @NonNull
+ Iterator<LeafSetEntryNode<String>> it = topLevelEquipmentCollection.iterator();
+ while (it.hasNext()) {
+ LeafSetEntryNode<String> topLevelEquipmentUuid = it.next();
+ if (topLevelEquipmentUuid != null) {
+ log.info("LeafSetEntryNode: {} {} {}", topLevelEquipmentUuid.getValue(),
+ topLevelEquipmentUuid.getNodeType(),
+ topLevelEquipmentUuid.getValue().getClass().getName());
+ }
}
}
}
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14AirInterfaceNotificationListener.java b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14AirInterfaceNotificationListener.java
index c72976732..e1ca58055 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14AirInterfaceNotificationListener.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14AirInterfaceNotificationListener.java
@@ -21,31 +21,58 @@
*/
package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces;
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
+import org.opendaylight.mdsal.dom.api.DOMNotification;
+import org.opendaylight.mdsal.dom.api.DOMNotificationListener;
import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.AirInterface20Listener;
import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.AttributeValueChangedNotification;
import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.ObjectCreationNotification;
import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.ObjectDeletionNotification;
import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.ProblemNotification;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.SEVERITYTYPE;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.SEVERITYTYPECRITICAL;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.SEVERITYTYPEMAJOR;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.SEVERITYTYPEMINOR;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.SEVERITYTYPENONALARMED;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.SEVERITYTYPEWARNING;
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.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.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class Onf14AirInterfaceNotificationListener implements AirInterface20Listener {
+public class Onf14AirInterfaceNotificationListener implements AirInterface20Listener, DOMNotificationListener {
private static final Logger log = LoggerFactory.getLogger(Onf14AirInterfaceNotificationListener.class);
private final NetconfAccessor netconfAccessor;
private final DeviceManagerServiceProvider serviceProvider;
+ private static final Map<Class<? extends SEVERITYTYPE>,SeverityType> severityMap = initSeverityMap();
+
public Onf14AirInterfaceNotificationListener(NetconfAccessor netconfAccessor,
DeviceManagerServiceProvider serviceProvider) {
this.netconfAccessor = netconfAccessor;
this.serviceProvider = serviceProvider;
}
+ private static Map<Class<? extends SEVERITYTYPE>, SeverityType> initSeverityMap() {
+ Map<Class<? extends SEVERITYTYPE>, SeverityType> map = new HashMap<>();
+ map.put(SEVERITYTYPECRITICAL.class,SeverityType.Critical);
+ map.put(SEVERITYTYPEMAJOR.class,SeverityType.Major);
+ map.put(SEVERITYTYPEMINOR.class,SeverityType.Minor);
+ map.put(SEVERITYTYPEWARNING.class,SeverityType.Warning);
+ map.put(SEVERITYTYPENONALARMED.class,SeverityType.NonAlarmed);
+ return map;
+ }
+
@Override
public void onObjectDeletionNotification(ObjectDeletionNotification notification) {
log.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
@@ -56,8 +83,8 @@ public class Onf14AirInterfaceNotificationListener implements AirInterface20List
.setObjectId(notification.getObjectIdRef().getValue()).setSourceType(SourceType.Netconf)
.setTimestamp(notification.getTimestamp());
serviceProvider.getDataProvider().writeEventLog(eventlogBuilder.build());
- serviceProvider.getNotificationService().deletionNotification(netconfAccessor.getNodeId(),
- notification.getCounter(), notification.getTimestamp(), notification.getObjectIdRef().getValue());
+ serviceProvider.getWebsocketService().sendNotification(notification, netconfAccessor.getNodeId().getValue(),
+ ObjectDeletionNotification.QNAME, notification.getTimestamp());
log.debug("onObjectDeletionNotification log entry written");
}
@@ -65,11 +92,20 @@ public class Onf14AirInterfaceNotificationListener implements AirInterface20List
@Override
public void onProblemNotification(ProblemNotification notification) {
log.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
+ FaultlogEntity faultAlarm = new FaultlogBuilder().setObjectId(notification.getObjectIdRef().getValue())
+ .setProblem(notification.getProblem()).setSourceType(SourceType.Netconf)
+ .setTimestamp(notification.getTimestamp())
+ .setNodeId(this.netconfAccessor.getNodeId().getValue())
+ .setSeverity(mapSeverity(notification.getSeverity())).setCounter(notification.getCounter())
+ .build();
+ serviceProvider.getFaultService().faultNotification(faultAlarm);
+ serviceProvider.getWebsocketService().sendNotification(notification, netconfAccessor.getNodeId().getValue(),
+ ProblemNotification.QNAME, notification.getTimestamp());
- serviceProvider.getFaultService().faultNotification(netconfAccessor.getNodeId(), notification.getCounter(),
- notification.getTimestamp(), notification.getObjectIdRef().getValue(), notification.getProblem(),
- Onf14AirInterface.mapSeverity(notification.getSeverity()));
+ }
+ private SeverityType mapSeverity(@Nullable Class<? extends SEVERITYTYPE> severity) {
+ return severityMap.getOrDefault(severity,SeverityType.NonAlarmed);
}
@Override
@@ -82,8 +118,8 @@ public class Onf14AirInterfaceNotificationListener implements AirInterface20List
.setNewValue(notification.getNewValue()).setObjectId(notification.getObjectIdRef().getValue())
.setSourceType(SourceType.Netconf).setTimestamp(notification.getTimestamp());
serviceProvider.getDataProvider().writeEventLog(eventlogBuilder.build());
- serviceProvider.getNotificationService().eventNotification(eventlogBuilder.build());
-
+ serviceProvider.getWebsocketService().sendNotification(notification, netconfAccessor.getNodeId().getValue(),
+ AttributeValueChangedNotification.QNAME, notification.getTimestamp());
log.debug("onAttributeValueChangedNotification log entry written");
}
@@ -97,10 +133,14 @@ public class Onf14AirInterfaceNotificationListener implements AirInterface20List
.setObjectId(notification.getObjectIdRef().getValue()).setSourceType(SourceType.Netconf)
.setTimestamp(notification.getTimestamp());
serviceProvider.getDataProvider().writeEventLog(eventlogBuilder.build());
- serviceProvider.getNotificationService().creationNotification(netconfAccessor.getNodeId(),
- notification.getCounter(), notification.getTimestamp(), notification.getObjectIdRef().getValue());
-
+ serviceProvider.getWebsocketService().sendNotification(notification, netconfAccessor.getNodeId().getValue(),
+ ObjectCreationNotification.QNAME, notification.getTimestamp());
log.debug("onObjectCreationNotification log entry written");
}
+ @Override
+ public void onNotification(@NonNull DOMNotification notification) {
+
+ }
+
}
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14DomInterfacePacManager.java b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14DomInterfacePacManager.java
index f4e697aec..7fca996e9 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14DomInterfacePacManager.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14DomInterfacePacManager.java
@@ -34,8 +34,15 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.util.Debug;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfDomAccessor;
+import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
+import org.opendaylight.mdsal.dom.api.DOMNotification;
+import org.opendaylight.mdsal.dom.api.DOMNotificationListener;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.AttributeValueChangedNotification;
import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.LAYERPROTOCOLNAMETYPEAIRLAYER;
import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.LayerProtocol1;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.ObjectCreationNotification;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.ObjectDeletionNotification;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.ProblemNotification;
import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.air._interface.lp.spec.AirInterfacePac;
import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.air._interface.pac.AirInterfaceCurrentProblems;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.ControlConstruct;
@@ -47,12 +54,38 @@ import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.logi
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.logical.termination.point.LayerProtocolKey;
import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.LAYERPROTOCOLNAMETYPEETHERNETCONTAINERLAYER;
import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.LAYERPROTOCOLNAMETYPEWIRELAYER;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.NotificationListener;
+import org.opendaylight.yangtools.yang.binding.Notification;
+import org.opendaylight.yangtools.yang.common.QName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class Onf14DomInterfacePacManager {
+/*
+* Notifications streams provided by device NTSSim ONF14
+* Stream{getName=StreamNameType{_value=nc-notifications}, isReplaySupport=true, augmentation=[]},
+* Stream{getName=StreamNameType{_value=hybrid-mw-structure-2-0}, isReplaySupport=true, augmentation=[]},
+* Stream{getName=StreamNameType{_value=vlan-interface-1-0}, isReplaySupport=true, augmentation=[]},
+* Stream{getName=StreamNameType{_value=tdm-container-2-0}, isReplaySupport=true, augmentation=[]},
+* Stream{getName=StreamNameType{_value=ethernet-container-2-0}, isReplaySupport=true, augmentation=[]},
+* Stream{getName=StreamNameType{_value=ietf-yang-library}, isReplaySupport=false, augmentation=[]},
+* Stream{getDescription=Default NETCONF stream containing all the Event Notifications., getName=StreamNameType{_value=NETCONF}, isReplaySupport=true, augmentation=[]},
+* Stream{getName=StreamNameType{_value=vlan-fd-1-0}, isReplaySupport=true, augmentation=[]},
+* Stream{getName=StreamNameType{_value=wire-interface-2-0}, isReplaySupport=true, augmentation=[]},
+* Stream{getName=StreamNameType{_value=mac-fd-1-0}, isReplaySupport=true, augmentation=[]},
+* Stream{getName=StreamNameType{_value=co-channel-profile-1-0}, isReplaySupport=true, augmentation=[]},
+* Stream{getName=StreamNameType{_value=mac-interface-1-0}, isReplaySupport=true, augmentation=[]},
+* Stream{getName=StreamNameType{_value=ietf-keystore}, isReplaySupport=true, augmentation=[]},
+* Stream{getName=StreamNameType{_value=pure-ethernet-structure-2-0}, isReplaySupport=true, augmentation=[]},
+* Stream{getName=StreamNameType{_value=ietf-netconf-notifications}, isReplaySupport=true, augmentation=[]},
+* Stream{getName=StreamNameType{_value=mac-fc-1-0}, isReplaySupport=true, augmentation=[]},
+* Stream{getName=StreamNameType{_value=wred-profile-1-0}, isReplaySupport=true, augmentation=[]},
+* Stream{getName=StreamNameType{_value=air-interface-2-0}, isReplaySupport=true, augmentation=[]},
+* Stream{getName=StreamNameType{_value=ip-interface-1-0}, isReplaySupport=true, augmentation=[]},
+* Stream{getName=StreamNameType{_value=qos-profile-1-0}, isReplaySupport=true, augmentation=[]},
+* Stream{getName=StreamNameType{_value=vlan-fc-1-0}, isReplaySupport=true, augmentation=[]},
+* Stream{getName=StreamNameType{_value=l-3vpn-profile-1-0}, isReplaySupport=true, augmentation=[]}]
+*/
+
+public class Onf14DomInterfacePacManager implements DOMNotificationListener {
// constants
private static final Logger log = LoggerFactory.getLogger(Onf14DomEquipmentManager.class);
@@ -64,38 +97,32 @@ public class Onf14DomInterfacePacManager {
// air interface related members
private final List<TechnologySpecificPacKeys> airInterfaceList = new ArrayList<TechnologySpecificPacKeys>();
- @SuppressWarnings("unused")
- private ListenerRegistration<NotificationListener> airInterfaceNotificationListenerHandler;
private @NonNull final Onf14AirInterfaceNotificationListener airInterfaceNotificationListener;
// ethernet container related members
private final List<TechnologySpecificPacKeys> ethernetContainerList = new ArrayList<TechnologySpecificPacKeys>();
- @SuppressWarnings("unused")
- private ListenerRegistration<NotificationListener> etherneContainerNotificationListenerHandler;
private @NonNull final Onf14EthernetContainerNotificationListener ethernetContainerNotificationListener;
// wire interface related members
private final List<TechnologySpecificPacKeys> wireInterfaceList = new ArrayList<TechnologySpecificPacKeys>();
- @SuppressWarnings("unused")
- private ListenerRegistration<NotificationListener> wireInterfaceNotificationListenerHandler;
private @NonNull final Onf14WireInterfaceNotificationListener wireInterfaceNotificationListener;
+ private @NonNull final BindingNormalizedNodeSerializer serializer;
// end of variables
+
// constructors
public Onf14DomInterfacePacManager(@NonNull NetconfDomAccessor netconfDomAccessor,
@NonNull DeviceManagerServiceProvider serviceProvider) {
this.netconfDomAccessor = Objects.requireNonNull(netconfDomAccessor);
this.serviceProvider = Objects.requireNonNull(serviceProvider);
+ this.serializer = Objects.requireNonNull(netconfDomAccessor.getBindingNormalizedNodeSerializer());
- this.airInterfaceNotificationListenerHandler = null;
this.airInterfaceNotificationListener =
new Onf14AirInterfaceNotificationListener(netconfDomAccessor, serviceProvider);
- this.etherneContainerNotificationListenerHandler = null;
- ethernetContainerNotificationListener =
+ this.ethernetContainerNotificationListener =
new Onf14EthernetContainerNotificationListener(netconfDomAccessor, serviceProvider);
- this.wireInterfaceNotificationListenerHandler = null;
- wireInterfaceNotificationListener =
+ this.wireInterfaceNotificationListener =
new Onf14WireInterfaceNotificationListener(netconfDomAccessor, serviceProvider);
}
// end of constructors
@@ -258,6 +285,42 @@ public class Onf14DomInterfacePacManager {
}
}
+ @Override
+ public void onNotification(@NonNull DOMNotification domNotification) {
+ @Nullable
+ Notification notification =
+ serializer.fromNormalizedNodeNotification(domNotification.getType(), domNotification.getBody());
+ if (notification instanceof ProblemNotification) {
+ ProblemNotification problemNotification = (ProblemNotification) notification;
+ log.debug("DOM ProblemNotification: {}", problemNotification);
+ airInterfaceNotificationListener.onProblemNotification(problemNotification);
+ } else if (notification instanceof AttributeValueChangedNotification) {
+ AttributeValueChangedNotification attributeValueChangeNotification =
+ (AttributeValueChangedNotification) notification;
+ log.debug("DOM AttributeValueChangedNotification: {}", attributeValueChangeNotification);
+ airInterfaceNotificationListener.onAttributeValueChangedNotification(attributeValueChangeNotification);
+ } else if (notification instanceof ObjectDeletionNotification) {
+ ObjectDeletionNotification objectDeletionNotification = (ObjectDeletionNotification) notification;
+ log.debug("DOM ObjectDeletionNotification: {}", objectDeletionNotification);
+ airInterfaceNotificationListener.onObjectDeletionNotification(objectDeletionNotification);
+ } else if (notification instanceof ObjectCreationNotification) {
+ ObjectCreationNotification objectCreationNotification = (ObjectCreationNotification) notification;
+ log.debug("DOM ObjectDeletionNotification: {}", objectCreationNotification);
+ airInterfaceNotificationListener.onObjectCreationNotification(objectCreationNotification);
+ } else {
+ log.warn("DOM Notification ignored: {}", domNotification);
+ }
+ }
+
+ /**
+ * Register notifications to handle
+ */
+ public void subscribeNotifications() {
+ QName[] notifications = { ObjectCreationNotification.QNAME, ObjectDeletionNotification.QNAME,
+ AttributeValueChangedNotification.QNAME, ProblemNotification.QNAME };
+ netconfDomAccessor.doRegisterNotificationListener(this, notifications);
+ }
+
/*
private void readEthernetConainerCurrentProblemForLtp(UniversalId ltpUuid, String localId, FaultData resultList) {
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14EthernetContainerNotificationListener.java b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14EthernetContainerNotificationListener.java
index 7cc3c9b4e..fb67a24ab 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14EthernetContainerNotificationListener.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14EthernetContainerNotificationListener.java
@@ -21,6 +21,9 @@
*/
package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces;
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.jdt.annotation.Nullable;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.AttributeValueChangedNotification;
@@ -28,7 +31,16 @@ import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200
import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.ObjectCreationNotification;
import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.ObjectDeletionNotification;
import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.ProblemNotification;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.SEVERITYTYPE;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.SEVERITYTYPECRITICAL;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.SEVERITYTYPEMAJOR;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.SEVERITYTYPEMINOR;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.SEVERITYTYPENONALARMED;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.SEVERITYTYPEWARNING;
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.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.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -40,27 +52,37 @@ public class Onf14EthernetContainerNotificationListener implements EthernetConta
private final NetconfAccessor netconfAccessor;
private final DeviceManagerServiceProvider serviceProvider;
+ private static final Map<Class<? extends SEVERITYTYPE>, SeverityType> severityMap = initSeverityMap();
+
public Onf14EthernetContainerNotificationListener(NetconfAccessor netconfAccessor,
DeviceManagerServiceProvider serviceProvider) {
this.netconfAccessor = netconfAccessor;
this.serviceProvider = serviceProvider;
}
+ private static Map<Class<? extends SEVERITYTYPE>, SeverityType> initSeverityMap() {
+ Map<Class<? extends SEVERITYTYPE>, SeverityType> map = new HashMap<>();
+ map.put(SEVERITYTYPECRITICAL.class, SeverityType.Critical);
+ map.put(SEVERITYTYPEMAJOR.class, SeverityType.Major);
+ map.put(SEVERITYTYPEMINOR.class, SeverityType.Minor);
+ map.put(SEVERITYTYPEWARNING.class, SeverityType.Warning);
+ map.put(SEVERITYTYPENONALARMED.class, SeverityType.NonAlarmed);
+ return map;
+ }
+
@Override
public void onObjectDeletionNotification(ObjectDeletionNotification notification) {
log.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
EventlogBuilder eventlogBuilder = new EventlogBuilder();
- eventlogBuilder.setNodeId(netconfAccessor.getNodeId().getValue())
- .setAttributeName("")
- .setCounter(notification.getCounter().intValue())
- .setNewValue("deleted")
- .setObjectId(notification.getObjectIdRef().getValue())
- .setSourceType(SourceType.Netconf)
- .setTimestamp(notification.getTimestamp());
+ eventlogBuilder.setNodeId(netconfAccessor.getNodeId().getValue()).setAttributeName("")
+ .setCounter(notification.getCounter().intValue()).setNewValue("deleted")
+ .setObjectId(notification.getObjectIdRef().getValue()).setSourceType(SourceType.Netconf)
+ .setTimestamp(notification.getTimestamp());
serviceProvider.getDataProvider().writeEventLog(eventlogBuilder.build());
serviceProvider.getNotificationService().deletionNotification(netconfAccessor.getNodeId(),
- notification.getCounter().intValue(), notification.getTimestamp(), notification.getObjectIdRef().getValue());
+ notification.getCounter().intValue(), notification.getTimestamp(),
+ notification.getObjectIdRef().getValue());
log.debug("onObjectDeletionNotification log entry written");
}
@@ -68,12 +90,19 @@ public class Onf14EthernetContainerNotificationListener implements EthernetConta
@Override
public void onProblemNotification(ProblemNotification notification) {
log.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
+ FaultlogEntity faultAlarm = new FaultlogBuilder().setObjectId(notification.getObjectIdRef().getValue())
+ .setProblem(notification.getProblem()).setTimestamp(notification.getTimestamp())
+ .setNodeId(this.netconfAccessor.getNodeId().getValue()).setSourceType(SourceType.Netconf)
+ .setSeverity(mapSeverity(notification.getSeverity())).setCounter(notification.getCounter().intValue())
+ .build();
+ serviceProvider.getFaultService().faultNotification(faultAlarm);
+ serviceProvider.getWebsocketService().sendNotification(notification, netconfAccessor.getNodeId().getValue(),
+ ProblemNotification.QNAME, notification.getTimestamp());
- serviceProvider.getFaultService().faultNotification(netconfAccessor.getNodeId(),
- notification.getCounter().intValue(), notification.getTimestamp(),
- notification.getObjectIdRef().getValue(), notification.getProblem(),
- Onf14EthernetContainer.mapSeverity(notification.getSeverity()));
+ }
+ private SeverityType mapSeverity(@Nullable Class<? extends SEVERITYTYPE> severity) {
+ return severityMap.getOrDefault(severity, SeverityType.NonAlarmed);
}
@Override
@@ -82,14 +111,12 @@ public class Onf14EthernetContainerNotificationListener implements EthernetConta
EventlogBuilder eventlogBuilder = new EventlogBuilder();
eventlogBuilder.setNodeId(netconfAccessor.getNodeId().getValue())
- .setAttributeName(notification.getAttributeName())
- .setCounter(notification.getCounter().intValue())
- .setNewValue(notification.getNewValue())
- .setObjectId(notification.getObjectIdRef().getValue())
- .setSourceType(SourceType.Netconf)
- .setTimestamp(notification.getTimestamp());
+ .setAttributeName(notification.getAttributeName()).setCounter(notification.getCounter().intValue())
+ .setNewValue(notification.getNewValue()).setObjectId(notification.getObjectIdRef().getValue())
+ .setSourceType(SourceType.Netconf).setTimestamp(notification.getTimestamp());
serviceProvider.getDataProvider().writeEventLog(eventlogBuilder.build());
- serviceProvider.getNotificationService().eventNotification(eventlogBuilder.build());
+ serviceProvider.getWebsocketService().sendNotification(notification, netconfAccessor.getNodeId().getValue(),
+ AttributeValueChangedNotification.QNAME, notification.getTimestamp());
log.debug("onAttributeValueChangedNotification log entry written");
}
@@ -99,16 +126,13 @@ public class Onf14EthernetContainerNotificationListener implements EthernetConta
log.debug("Got event of type :: {}", ObjectCreationNotification.class.getSimpleName());
EventlogBuilder eventlogBuilder = new EventlogBuilder();
- eventlogBuilder.setNodeId(netconfAccessor.getNodeId().getValue())
- .setAttributeName(notification.getObjectType())
- .setCounter(notification.getCounter().intValue())
- .setNewValue("created")
- .setObjectId(notification.getObjectIdRef().getValue())
- .setSourceType(SourceType.Netconf)
- .setTimestamp(notification.getTimestamp());
+ eventlogBuilder.setNodeId(netconfAccessor.getNodeId().getValue()).setAttributeName(notification.getObjectType())
+ .setCounter(notification.getCounter().intValue()).setNewValue("created")
+ .setObjectId(notification.getObjectIdRef().getValue()).setSourceType(SourceType.Netconf)
+ .setTimestamp(notification.getTimestamp());
serviceProvider.getDataProvider().writeEventLog(eventlogBuilder.build());
- serviceProvider.getNotificationService().creationNotification(netconfAccessor.getNodeId(),
- notification.getCounter().intValue(), notification.getTimestamp(), notification.getObjectIdRef().getValue());
+ serviceProvider.getWebsocketService().sendNotification(notification, netconfAccessor.getNodeId().getValue(),
+ ObjectCreationNotification.QNAME, notification.getTimestamp());
log.debug("onObjectCreationNotification log entry written");
}
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14WireInterfaceNotificationListener.java b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14WireInterfaceNotificationListener.java
index 0db482afb..8a1d42fa4 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14WireInterfaceNotificationListener.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14WireInterfaceNotificationListener.java
@@ -21,14 +21,26 @@
*/
package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces;
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.jdt.annotation.Nullable;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.AttributeValueChangedNotification;
import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.ObjectCreationNotification;
import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.ObjectDeletionNotification;
import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.ProblemNotification;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.SEVERITYTYPE;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.SEVERITYTYPECRITICAL;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.SEVERITYTYPEMAJOR;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.SEVERITYTYPEMINOR;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.SEVERITYTYPENONALARMED;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.SEVERITYTYPEWARNING;
import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.WireInterface20Listener;
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.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.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -40,12 +52,24 @@ public class Onf14WireInterfaceNotificationListener implements WireInterface20Li
private final NetconfAccessor netconfAccessor;
private final DeviceManagerServiceProvider serviceProvider;
+ private static final Map<Class<? extends SEVERITYTYPE>,SeverityType> severityMap = initSeverityMap();
+
public Onf14WireInterfaceNotificationListener(NetconfAccessor netconfAccessor,
DeviceManagerServiceProvider serviceProvider) {
this.netconfAccessor = netconfAccessor;
this.serviceProvider = serviceProvider;
}
+ private static Map<Class<? extends SEVERITYTYPE>, SeverityType> initSeverityMap() {
+ Map<Class<? extends SEVERITYTYPE>, SeverityType> map = new HashMap<>();
+ map.put(SEVERITYTYPECRITICAL.class,SeverityType.Critical);
+ map.put(SEVERITYTYPEMAJOR.class,SeverityType.Major);
+ map.put(SEVERITYTYPEMINOR.class,SeverityType.Minor);
+ map.put(SEVERITYTYPEWARNING.class,SeverityType.Warning);
+ map.put(SEVERITYTYPENONALARMED.class,SeverityType.NonAlarmed);
+ return map;
+ }
+
@Override
public void onObjectDeletionNotification(ObjectDeletionNotification notification) {
log.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName());
@@ -59,8 +83,8 @@ public class Onf14WireInterfaceNotificationListener implements WireInterface20Li
.setSourceType(SourceType.Netconf)
.setTimestamp(notification.getTimestamp());
serviceProvider.getDataProvider().writeEventLog(eventlogBuilder.build());
- serviceProvider.getNotificationService().deletionNotification(netconfAccessor.getNodeId(),
- notification.getCounter(), notification.getTimestamp(), notification.getObjectIdRef().getValue());
+ serviceProvider.getWebsocketService().sendNotification(notification, netconfAccessor.getNodeId().getValue(),
+ ObjectDeletionNotification.QNAME, notification.getTimestamp());
log.debug("onObjectDeletionNotification log entry written");
}
@@ -68,11 +92,19 @@ public class Onf14WireInterfaceNotificationListener implements WireInterface20Li
@Override
public void onProblemNotification(ProblemNotification notification) {
log.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName());
+ FaultlogEntity faultAlarm = new FaultlogBuilder().setObjectId(notification.getObjectIdRef().getValue())
+ .setProblem(notification.getProblem()).setTimestamp(notification.getTimestamp())
+ .setNodeId(this.netconfAccessor.getNodeId().getValue()).setSourceType(SourceType.Netconf)
+ .setSeverity(mapSeverity(notification.getSeverity())).setCounter(notification.getCounter().intValue())
+ .build();
+ serviceProvider.getFaultService().faultNotification(faultAlarm);
+ serviceProvider.getWebsocketService().sendNotification( notification, netconfAccessor.getNodeId().getValue(),
+ ProblemNotification.QNAME, notification.getTimestamp());
- serviceProvider.getFaultService().faultNotification(netconfAccessor.getNodeId(), notification.getCounter(),
- notification.getTimestamp(), notification.getObjectIdRef().getValue(), notification.getProblem(),
- Onf14WireInterface.mapSeverity(notification.getSeverity()));
+ }
+ private SeverityType mapSeverity(@Nullable Class<? extends SEVERITYTYPE> severity) {
+ return severityMap.getOrDefault(severity,SeverityType.NonAlarmed);
}
@Override
@@ -88,7 +120,9 @@ public class Onf14WireInterfaceNotificationListener implements WireInterface20Li
.setSourceType(SourceType.Netconf)
.setTimestamp(notification.getTimestamp());
serviceProvider.getDataProvider().writeEventLog(eventlogBuilder.build());
- serviceProvider.getNotificationService().eventNotification(eventlogBuilder.build());
+ serviceProvider.getWebsocketService().sendNotification(notification, netconfAccessor.getNodeId().getValue(),
+ AttributeValueChangedNotification.QNAME, notification.getTimestamp());
+
log.debug("onAttributeValueChangedNotification log entry written");
}
@@ -106,8 +140,8 @@ public class Onf14WireInterfaceNotificationListener implements WireInterface20Li
.setSourceType(SourceType.Netconf)
.setTimestamp(notification.getTimestamp());
serviceProvider.getDataProvider().writeEventLog(eventlogBuilder.build());
- serviceProvider.getNotificationService().creationNotification(netconfAccessor.getNodeId(),
- notification.getCounter(), notification.getTimestamp(), notification.getObjectIdRef().getValue());
+ serviceProvider.getWebsocketService().sendNotification(notification, netconfAccessor.getNodeId().getValue(),
+ ObjectCreationNotification.QNAME, notification.getTimestamp());
log.debug("onObjectCreationNotification log entry written");
}
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14AirInterfaceNotificationListener.java b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14AirInterfaceNotificationListener.java
index d03d50c1a..b9f1c2131 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14AirInterfaceNotificationListener.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14AirInterfaceNotificationListener.java
@@ -17,6 +17,7 @@
*/
package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14;
+import org.eclipse.jdt.annotation.NonNull;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
@@ -28,6 +29,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServic
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService;
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.onf.yang.air._interface._2._0.rev200121.AttributeValueChangedNotification;
import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.ObjectCreationNotification;
@@ -54,6 +56,7 @@ public class TestOnf14AirInterfaceNotificationListener extends Mockito {
private ObjectCreationNotification creationNotif;
private ProblemNotification problemNotif;
private AttributeValueChangedNotification attrValChangedNotif;
+ private @NonNull WebsocketManagerService websocketService;
@Before
public void init() {
@@ -63,6 +66,7 @@ public class TestOnf14AirInterfaceNotificationListener extends Mockito {
faultService = mock(FaultService.class);
databaseService = mock(DataProvider.class);
notificationService = mock(NotificationService.class);
+ websocketService = mock(WebsocketManagerService.class);
problemNotif = mock(ProblemNotification.class);
deletionNotif = mock(ObjectDeletionNotification.class);
@@ -93,6 +97,7 @@ public class TestOnf14AirInterfaceNotificationListener extends Mockito {
when(serviceProvider.getFaultService()).thenReturn(faultService);
when(serviceProvider.getDataProvider()).thenReturn(databaseService);
when(serviceProvider.getNotificationService()).thenReturn(notificationService);
+ when(serviceProvider.getWebsocketService()).thenReturn(websocketService);
}
@Test
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14EthernetContainerNotificationListener.java b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14EthernetContainerNotificationListener.java
index f6f7d9045..09e44f47d 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14EthernetContainerNotificationListener.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14EthernetContainerNotificationListener.java
@@ -28,6 +28,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServic
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService;
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.onf.yang.core.model._1._4.rev191127.UniversalId;
import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.AttributeValueChangedNotification;
@@ -54,6 +55,7 @@ public class TestOnf14EthernetContainerNotificationListener extends Mockito {
private ObjectCreationNotification creationNotif;
private ProblemNotification problemNotif;
private AttributeValueChangedNotification attrValChangedNotif;
+ private WebsocketManagerService websocketService;
@Before
public void init() {
@@ -63,6 +65,7 @@ public class TestOnf14EthernetContainerNotificationListener extends Mockito {
faultService = mock(FaultService.class);
databaseService = mock(DataProvider.class);
notificationService = mock(NotificationService.class);
+ websocketService = mock(WebsocketManagerService.class);
problemNotif = mock(ProblemNotification.class);
deletionNotif = mock(ObjectDeletionNotification.class);
@@ -93,6 +96,7 @@ public class TestOnf14EthernetContainerNotificationListener extends Mockito {
when(serviceProvider.getFaultService()).thenReturn(faultService);
when(serviceProvider.getDataProvider()).thenReturn(databaseService);
when(serviceProvider.getNotificationService()).thenReturn(notificationService);
+ when(serviceProvider.getWebsocketService()).thenReturn(websocketService);
}
@Test
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElement.java b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElement.java
index 7a5658a4f..30b4c9b1a 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElement.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElement.java
@@ -25,6 +25,7 @@ import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.Onf14NetworkElementFactory;
@@ -103,6 +104,9 @@ public class TestOnf14NetworkElement extends Mockito {
when(accessor.getNetconfBindingAccessor()).thenReturn(Optional.of(bindingAccessor));
when(accessor.getNetconfDomAccessor()).thenReturn(Optional.of(domAccessor));
+ ConfigurationFileRepresentation configurationRepresentation = mock(ConfigurationFileRepresentation.class);
+ when(serviceProvider.getConfigurationFileRepresentation()).thenReturn(configurationRepresentation);
+
Onf14NetworkElementFactory factory = new Onf14NetworkElementFactory();
onfNe = factory.create(accessor, serviceProvider);
assertTrue(onfNe.isPresent());
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElementFactory.java b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElementFactory.java
index 4087607d1..f9041eb80 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElementFactory.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElementFactory.java
@@ -23,6 +23,7 @@ import java.util.Optional;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mockito;
+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.onf14.impl.Onf14NetworkElementFactory;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
@@ -30,23 +31,25 @@ import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfDomAccessor;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.ControlConstruct;
-import org.opendaylight.yangtools.yang.common.QName;
public class TestOnf14NetworkElementFactory extends Mockito {
- static NetconfBindingAccessor accessor;
- static DeviceManagerServiceProvider serviceProvider;
- static Capabilities capabilities;
- QName qCapability;
+ private static NetconfBindingAccessor accessor;
+ private static Capabilities capabilities;
+ private static DeviceManagerServiceProvider serviceProvider;
+ private static ConfigurationFileRepresentation configurationRepresentation;
+
@BeforeClass
public static void init() throws InterruptedException, IOException {
capabilities = mock(Capabilities.class);
accessor = mock(NetconfBindingAccessor.class);
serviceProvider = mock(DeviceManagerServiceProvider.class);
+ configurationRepresentation = mock(ConfigurationFileRepresentation.class);
when(accessor.getCapabilites()).thenReturn(capabilities);
when(serviceProvider.getDataProvider()).thenReturn(mock(DataProvider.class));
+ when(serviceProvider.getConfigurationFileRepresentation()).thenReturn(configurationRepresentation);
}
@Test
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14WireInterfaceNotificationListener.java b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14WireInterfaceNotificationListener.java
index e1b13f118..e64847b91 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14WireInterfaceNotificationListener.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14WireInterfaceNotificationListener.java
@@ -17,6 +17,7 @@
*/
package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14;
+import org.eclipse.jdt.annotation.NonNull;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
@@ -28,6 +29,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServic
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService;
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.onf.yang.core.model._1._4.rev191127.UniversalId;
import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.AttributeValueChangedNotification;
@@ -54,6 +56,7 @@ public class TestOnf14WireInterfaceNotificationListener extends Mockito {
private ObjectCreationNotification creationNotif;
private ProblemNotification problemNotif;
private AttributeValueChangedNotification attrValChangedNotif;
+ private @NonNull WebsocketManagerService websocketService;
@Before
public void init() {
@@ -63,6 +66,7 @@ public class TestOnf14WireInterfaceNotificationListener extends Mockito {
faultService = mock(FaultService.class);
databaseService = mock(DataProvider.class);
notificationService = mock(NotificationService.class);
+ websocketService = mock(WebsocketManagerService.class);
problemNotif = mock(ProblemNotification.class);
deletionNotif = mock(ObjectDeletionNotification.class);
@@ -93,6 +97,7 @@ public class TestOnf14WireInterfaceNotificationListener extends Mockito {
when(serviceProvider.getFaultService()).thenReturn(faultService);
when(serviceProvider.getDataProvider()).thenReturn(databaseService);
when(serviceProvider.getNotificationService()).thenReturn(notificationService);
+ when(serviceProvider.getWebsocketService()).thenReturn(websocketService);
}
@Test