summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager-onf14/provider/src
diff options
context:
space:
mode:
authorRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2021-02-03 15:29:21 +0100
committerDan Timoney <dtimoney@att.com>2021-02-05 22:57:32 +0000
commitece5215df091114be3bffee073c8d3b0bc1ee1bc (patch)
tree0754b73eadae34a61df8703e3733cd237df56362 /sdnr/wt/devicemanager-onf14/provider/src
parentf2b7adc8df29246e154011293c7a4afdd242df60 (diff)
Migrate devicemanager-openroadm and devicemanager-onf14
Migrate devicemanager-openroadm and devicemanager-onf14 to Aluminium Issue-ID: CCSDK-3134 Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> Change-Id: If5f7073d56c9a334e6a23cc0a2dd9b68e7f19512 Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/devicemanager-onf14/provider/src')
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/DeviceManagerOnf14Impl.java2
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14AirInterface.java58
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14DomNetworkElement.java209
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14EthernetContainer.java58
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14NetworkElement.java29
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14NetworkElementFactory.java24
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14WireInterface.java58
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/dataprovider/InternalDataModelSeverity.java55
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/dataprovider/Onf14ToInternalDataModel.java (renamed from sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14ToInternalDataModel.java)17
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/equipment/Onf14DomEquipmentManager.java231
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14AirInterface.java39
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14AirInterfaceNotificationListener.java (renamed from sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14AirInterfaceNotificationListener.java)2
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14DomInterfacePacManager.java356
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14EthernetContainer.java40
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14EthernetContainerNotificationListener.java (renamed from sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14EthernetContainerNotificationListener.java)2
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14WireInterface.java (renamed from sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/test/mock/TransactionUtilsMock.java)34
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14WireInterfaceNotificationListener.java (renamed from sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14WireInterfaceNotificationListener.java)2
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/TechnologySpecificPacKeys.java54
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/util/Debug.java72
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestDeviceManagerOnf14Impl.java1
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14AirInterfaceNotificationListener.java9
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14EthernetContainerNotificationListener.java17
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElement.java43
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14NetworkElementFactory.java16
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14ToInternalDataModel2.java12
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14WireInterfaceNotificationListener.java9
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestSeverity.java80
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/test/mock/NetconfAccessorMock.java112
28 files changed, 1261 insertions, 380 deletions
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/DeviceManagerOnf14Impl.java b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/DeviceManagerOnf14Impl.java
index df34ce5c8..5c57054ff 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/DeviceManagerOnf14Impl.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/DeviceManagerOnf14Impl.java
@@ -51,7 +51,7 @@ public class DeviceManagerOnf14Impl implements AutoCloseable {
LOG.info("Session Initiated start {}", APPLICATION_NAME);
- resOnf = netconfNetworkElementService.registerNetworkElementFactory(new Onf14NetworkElementFactory());
+ resOnf = netconfNetworkElementService.registerBindingNetworkElementFactory(new Onf14NetworkElementFactory());
netconfNetworkElementService.writeToEventLog(APPLICATION_NAME, "startup", "done");
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14AirInterface.java b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14AirInterface.java
deleted file mode 100644
index ca00ae87c..000000000
--- a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14AirInterface.java
+++ /dev/null
@@ -1,58 +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.onf14.impl;
-
-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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @author alexs
- *
- */
-public class Onf14AirInterface {
-
- private static final Logger log = LoggerFactory.getLogger(Onf14AirInterface.class);
-
- public static org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType mapSeverity(
- Class<? extends SEVERITYTYPE> severity) {
-
- if (severity != null) {
- if (severity.getTypeName() == SEVERITYTYPECRITICAL.class.getName()) {
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.Critical;
- } else if (severity.getTypeName() == SEVERITYTYPEMAJOR.class.getName()) {
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.Major;
- } else if (severity.getTypeName() == SEVERITYTYPEMINOR.class.getName()) {
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.Minor;
- } else if (severity.getTypeName() == SEVERITYTYPEWARNING.class.getName()) {
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.Warning;
- } else if (severity.getTypeName() == SEVERITYTYPENONALARMED.class.getName()) {
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.NonAlarmed;
- }
- }
-
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.NonAlarmed;
- }
-
-
-}
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
new file mode 100644
index 000000000..0a63b7449
--- /dev/null
+++ b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14DomNetworkElement.java
@@ -0,0 +1,209 @@
+/*
+ * ============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.onf14.impl;
+
+import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElementService;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.dataprovider.Onf14ToInternalDataModel;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.equipment.Onf14DomEquipmentManager;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces.Onf14DomInterfacePacManager;
+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;
+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.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.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
+ */
+public class Onf14DomNetworkElement implements NetworkElement {
+
+ private static final Logger log = LoggerFactory.getLogger(Onf14DomNetworkElement.class);
+
+ // protected static final InstanceIdentifier<ControlConstruct> CONTROLCONSTRUCT_IID =
+ // InstanceIdentifier.builder(ControlConstruct.class).build();
+ protected static final YangInstanceIdentifier CONTROLCONSTRUCT_IID =
+ YangInstanceIdentifier.builder().node(ControlConstruct.QNAME).build();
+
+ private final NetconfDomAccessor netconfDomAccessor;
+ private final DataProvider databaseService;
+ private final @NonNull FaultService faultService;
+ private final @NonNull NotificationService notificationService;
+
+ private final Onf14ToInternalDataModel onf14Mapper;
+
+ private final @NonNull Onf14DomEquipmentManager equipmentManager;
+ private final @NonNull Onf14DomInterfacePacManager interfacePacManager;
+
+
+ public Onf14DomNetworkElement(NetconfDomAccessor netconfDomAccessor, DeviceManagerServiceProvider serviceProvider) {
+ log.info("Create {}", Onf14DomNetworkElement.class.getSimpleName());
+ this.netconfDomAccessor = netconfDomAccessor;
+ this.databaseService = serviceProvider.getDataProvider();
+ this.notificationService = serviceProvider.getNotificationService();
+ this.faultService = serviceProvider.getFaultService();
+ this.onf14Mapper = new Onf14ToInternalDataModel();
+ this.equipmentManager = new Onf14DomEquipmentManager(netconfDomAccessor, databaseService, onf14Mapper);
+ this.interfacePacManager = new Onf14DomInterfacePacManager(netconfDomAccessor, serviceProvider);
+ }
+
+ /**
+ * reading the inventory (CoreModel 1.4 Equipment Model) and adding it to the DB
+ */
+ public void initialReadFromNetworkElement() {
+
+ //Read complete device tree
+ Optional<ControlConstruct> oControlConstruct = readControlConstruct(netconfDomAccessor);
+
+ if (oControlConstruct.isPresent()) {
+ ControlConstruct controlConstruct = oControlConstruct.get();
+
+ 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");
+
+ equipmentManager.readTopLevelEquipment(netconfDomAccessor);
+ //Do it only once for test purpose
+ break;
+ }
+ //-- End For test purpose
+
+ // storing all the LTP UUIDs internally, for later usage, for air-interface and ethernet-container
+ interfacePacManager.readKeys(controlConstruct);
+
+ // Read all fault data
+ FaultData resultList = new FaultData();
+
+ int problems = faultService.removeAllCurrentProblemsOfNode(netconfDomAccessor.getNodeId());
+ log.debug("Removed all {} problems from database at registration", problems);
+
+ interfacePacManager.readAllAirInterfaceCurrentProblems(netconfDomAccessor, controlConstruct, resultList);
+ problems = resultList.size();
+ log.debug("NETCONF read air interface current problems completed. Got back {} problems.", problems);
+ /*
+ readAllEhernetContainerCurrentProblems(resultList);
+ problems = resultList.size() - problems;
+ log.debug("NETCONF read current problems completed. Got back {} problems.", resultList.size());
+
+ readAllWireInterfaceCurrentProblems(resultList);
+ problems = resultList.size();
+ log.debug("NETCONF read wire interface current problems completed. Got back {} problems.", problems);
+ */
+ faultService.initCurrentProblemStatus(netconfDomAccessor.getNodeId(), resultList);
+ log.debug("DB write current problems completed");
+ }
+ }
+
+ /**
+ * @param nNode set core-model-capability
+ */
+ public void setCoreModel(@NonNull NetconfNode nNode) {
+ 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");
+ }
+ databaseService.updateNetworkConnection22(eb.build(), netconfDomAccessor.getNodeId().getValue());
+ }
+
+ @Override
+ public void register() {
+ // Set core-model revision value in "core-model-capability" field
+ setCoreModel(netconfDomAccessor.getNetconfNode());
+ 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);
+ // }
+ }
+
+ @Override
+ public void deregister() {}
+
+
+ @Override
+ public NodeId getNodeId() {
+ return netconfDomAccessor.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(netconfDomAccessor);
+ }
+
+ @Override
+ public NetworkElementDeviceType getDeviceType() {
+ return NetworkElementDeviceType.Wireless;
+ }
+
+ private static Optional<ControlConstruct> readControlConstruct(NetconfDomAccessor netconfDomAccessor) {
+ 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/Onf14EthernetContainer.java b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14EthernetContainer.java
deleted file mode 100644
index 27d61be48..000000000
--- a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14EthernetContainer.java
+++ /dev/null
@@ -1,58 +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.onf14.impl;
-
-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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @author alexs
- *
- */
-public class Onf14EthernetContainer {
-
- private static final Logger log = LoggerFactory.getLogger(Onf14EthernetContainer.class);
-
- public static org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType mapSeverity(
- Class<? extends SEVERITYTYPE> severity) {
-
- if (severity != null) {
- if (severity.getTypeName() == SEVERITYTYPECRITICAL.class.getName()) {
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.Critical;
- } else if (severity.getTypeName() == SEVERITYTYPEMAJOR.class.getName()) {
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.Major;
- } else if (severity.getTypeName() == SEVERITYTYPEMINOR.class.getName()) {
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.Minor;
- } else if (severity.getTypeName() == SEVERITYTYPEWARNING.class.getName()) {
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.Warning;
- } else if (severity.getTypeName() == SEVERITYTYPENONALARMED.class.getName()) {
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.NonAlarmed;
- }
- }
-
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.NonAlarmed;
- }
-
-
-}
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 d2db231bc..a5599be30 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
@@ -27,11 +27,20 @@ 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.onf14.impl.dataprovider.Onf14ToInternalDataModel;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces.Onf14AirInterface;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces.Onf14AirInterfaceNotificationListener;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces.Onf14EthernetContainer;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces.Onf14EthernetContainerNotificationListener;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces.Onf14WireInterface;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces.Onf14WireInterfaceNotificationListener;
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.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;
@@ -76,7 +85,7 @@ public class Onf14NetworkElement implements NetworkElement {
private static final int EQUIPMENTROOTLEVEL = 0;
- private final NetconfAccessor netconfAccessor;
+ private final NetconfBindingAccessor netconfAccessor;
private final DataProvider databaseService;
private final Onf14ToInternalDataModel onf14Mapper;
private final @NonNull FaultService faultService;
@@ -86,27 +95,30 @@ public class Onf14NetworkElement implements NetworkElement {
// 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;
- Onf14NetworkElement(NetconfAccessor netconfAccess, DeviceManagerServiceProvider serviceProvider) {
+ Onf14NetworkElement(NetconfBindingAccessor netconfAccess, DeviceManagerServiceProvider serviceProvider) {
log.info("Create {}", Onf14NetworkElement.class.getSimpleName());
this.netconfAccessor = netconfAccess;
this.databaseService = serviceProvider.getDataProvider();
this.faultService = serviceProvider.getFaultService();
this.onf14Mapper = new Onf14ToInternalDataModel();
this.airInterfaceNotificationListenerHandler = null;
- airInterfaceNotificationListener = new Onf14AirInterfaceNotificationListener(netconfAccess, serviceProvider);
+ this.airInterfaceNotificationListener = new Onf14AirInterfaceNotificationListener(netconfAccess, serviceProvider);
this.etherneContainerNotificationListenerHandler = null;
ethernetContainerNotificationListener =
new Onf14EthernetContainerNotificationListener(netconfAccess, serviceProvider);
@@ -211,7 +223,10 @@ public class Onf14NetworkElement implements NetworkElement {
netconfAccessor.doRegisterNotificationListener(ethernetContainerNotificationListener);
wireInterfaceNotificationListenerHandler =
netconfAccessor.doRegisterNotificationListener(wireInterfaceNotificationListener);
- netconfAccessor.registerNotificationsStream(NetconfAccessor.DefaultNotificationsStream);
+ Optional<NetconfNotifications> notificationsSupport = netconfAccessor.getNotificationAccessor();
+ if (notificationsSupport.isPresent()) {
+ notificationsSupport.get().registerNotificationsStream(NetconfBindingAccessor.DefaultNotificationsStream);
+ }
}
@Override
@@ -459,12 +474,12 @@ public class Onf14NetworkElement implements NetworkElement {
}
}
- private Optional<ControlConstruct> readControlConstruct(NetconfAccessor netconfAccessor) {
+ private Optional<ControlConstruct> readControlConstruct(NetconfBindingAccessor netconfAccessor) {
return Optional.ofNullable(netconfAccessor.getTransactionUtils().readData(netconfAccessor.getDataBroker(),
LogicalDatastoreType.CONFIGURATION, CONTROLCONSTRUCT_IID));
}
- private @Nullable Equipment readEquipmentInstance(NetconfAccessor accessData, UniversalId equipmentUuid) {
+ private @Nullable Equipment readEquipmentInstance(NetconfBindingAccessor accessData, UniversalId equipmentUuid) {
final Class<?> clazzPac = Equipment.class;
@@ -497,10 +512,12 @@ public class Onf14NetworkElement implements NetworkElement {
return localId;
}
+ @SuppressWarnings("unused")
public void setLtpUuid(UniversalId uuid) {
this.ltpUuid = uuid;
}
+ @SuppressWarnings("unused")
public void setLocalId(String lId) {
this.localId = lId;
}
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 5505cecd6..514100292 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
@@ -23,21 +23,25 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.factory.NetworkElementFa
import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
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);
- @Override
- public Optional<NetworkElement> create(NetconfAccessor acessor, DeviceManagerServiceProvider serviceProvider) {
- if (acessor.getCapabilites().isSupportingNamespace(ControlConstruct.QNAME)) {
- log.info("Create device {} ", Onf14NetworkElement.class.getName());
- return Optional.of(new Onf14NetworkElement(acessor, serviceProvider));
- } else {
- return 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();
+
+ }
}
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14WireInterface.java b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14WireInterface.java
deleted file mode 100644
index 4446c2087..000000000
--- a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14WireInterface.java
+++ /dev/null
@@ -1,58 +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.onf14.impl;
-
-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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @author alexs
- *
- */
-public class Onf14WireInterface {
-
- private static final Logger log = LoggerFactory.getLogger(Onf14WireInterface.class);
-
- public static org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType mapSeverity(
- Class<? extends SEVERITYTYPE> severity) {
-
- if (severity != null) {
- if (severity.getTypeName() == SEVERITYTYPECRITICAL.class.getName()) {
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.Critical;
- } else if (severity.getTypeName() == SEVERITYTYPEMAJOR.class.getName()) {
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.Major;
- } else if (severity.getTypeName() == SEVERITYTYPEMINOR.class.getName()) {
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.Minor;
- } else if (severity.getTypeName() == SEVERITYTYPEWARNING.class.getName()) {
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.Warning;
- } else if (severity.getTypeName() == SEVERITYTYPENONALARMED.class.getName()) {
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.NonAlarmed;
- }
- }
-
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.NonAlarmed;
- }
-
-
-}
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/dataprovider/InternalDataModelSeverity.java b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/dataprovider/InternalDataModelSeverity.java
new file mode 100644
index 000000000..97395f496
--- /dev/null
+++ b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/dataprovider/InternalDataModelSeverity.java
@@ -0,0 +1,55 @@
+/*
+ * ============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.onf14.impl.dataprovider;
+
+import java.util.Map;
+import org.eclipse.jdt.annotation.Nullable;
+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.SEVERITYTYPEWARNING;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType;
+import org.opendaylight.yangtools.yang.binding.BaseIdentity;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class InternalDataModelSeverity {
+
+ @SuppressWarnings("unused")
+ private static final Logger LOG = LoggerFactory.getLogger(InternalDataModelSeverity.class);
+
+ private static final Map<String, SeverityType> SEVERITYMAP = Map.of(
+ SEVERITYTYPEMAJOR.class.getSimpleName(), SeverityType.Major,
+ SEVERITYTYPECRITICAL.class.getSimpleName(), SeverityType.Critical,
+ SEVERITYTYPEMINOR.class.getSimpleName(), SeverityType.Minor,
+ SEVERITYTYPEWARNING.class.getSimpleName(), SeverityType.Warning);
+
+ public static SeverityType mapSeverity(@Nullable Class<? extends BaseIdentity> severity) {
+ SeverityType res = null;
+ if (severity != null) {
+ String severityName = severity.getSimpleName();
+ res = severityName != null ? SEVERITYMAP.get(severity.getSimpleName()) : null;
+ }
+ return res == null ? SeverityType.NonAlarmed : res;
+ }
+
+}
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14ToInternalDataModel.java b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/dataprovider/Onf14ToInternalDataModel.java
index 52b159c73..36eaf2fd3 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14ToInternalDataModel.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/dataprovider/Onf14ToInternalDataModel.java
@@ -15,7 +15,7 @@
* the License.
* ============LICENSE_END==========================================================================
*/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl;
+package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.dataprovider;
import java.util.ArrayList;
import java.util.Collection;
@@ -34,6 +34,7 @@ import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.equi
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.yang.common.Uint32;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -43,7 +44,7 @@ import org.slf4j.LoggerFactory;
*/
public class Onf14ToInternalDataModel {
- private static final Logger log = LoggerFactory.getLogger(Onf14ToInternalDataModel.class);
+ private static final Logger LOG = LoggerFactory.getLogger(Onf14ToInternalDataModel.class);
public Inventory getInternalEquipment(NodeId nodeId, Equipment currentEq, Equipment parentEq, long treeLevel) {
@@ -56,7 +57,7 @@ public class Onf14ToInternalDataModel {
// General
inventoryBuilder.setNodeId(nodeId.getValue());
- inventoryBuilder.setTreeLevel(treeLevel);
+ inventoryBuilder.setTreeLevel(Uint32.valueOf(treeLevel));
inventoryBuilder.setUuid(currentEq.getUuid().getValue());
if (parentEq != null) {
@@ -88,7 +89,7 @@ public class Onf14ToInternalDataModel {
inventoryBuilder.setManufacturerName(manProp.getManufacturerName());
inventoryBuilder.setManufacturerIdentifier(manProp.getManufacturerIdentifier());
} else {
- log.debug("manufacturer-properties is not present in Equipment with uuid={}",
+ LOG.debug("manufacturer-properties is not present in Equipment with uuid={}",
currentEq.getUuid().getValue());
}
@@ -99,7 +100,7 @@ public class Onf14ToInternalDataModel {
inventoryBuilder.setSerial(eqInstance.getSerialNumber());
inventoryBuilder.setDate(eqInstance.getManufactureDate().getValue());
} else {
- log.debug("equipment-instance is not present in Equipment with uuid={}",
+ LOG.debug("equipment-instance is not present in Equipment with uuid={}",
currentEq.getUuid().getValue());
}
@@ -113,15 +114,15 @@ public class Onf14ToInternalDataModel {
inventoryBuilder.setModelIdentifier(eqType.getModelIdentifier());
inventoryBuilder.setTypeName(eqType.getTypeName());
} else {
- log.debug("equipment-type is not present in Equipment with uuid={}",
+ LOG.debug("equipment-type is not present in Equipment with uuid={}",
currentEq.getUuid().getValue());
}
} else {
- log.debug("manufactured-thing is not present in Equipment with uuid={}",
+ LOG.debug("manufactured-thing is not present in Equipment with uuid={}",
currentEq.getUuid().getValue());
}
} else {
- log.debug("actual-equipment is not present in Equipment with uuid={}", currentEq.getUuid().getValue());
+ LOG.debug("actual-equipment is not present in Equipment with uuid={}", currentEq.getUuid().getValue());
}
return inventoryBuilder.build();
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
new file mode 100644
index 000000000..72ffdf6bc
--- /dev/null
+++ b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/equipment/Onf14DomEquipmentManager.java
@@ -0,0 +1,231 @@
+/*
+ * ============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.onf14.impl.equipment;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.onap.ccsdk.features.sdnr.wt.common.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.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.yangtools.util.UnmodifiableCollection;
+import org.opendaylight.yangtools.yang.binding.CodeHelpers;
+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.NormalizedNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Onf14DomEquipmentManager {
+
+
+ // constants
+ private static final Logger log = LoggerFactory.getLogger(Onf14DomEquipmentManager.class);
+ private static final int EQUIPMENTROOTLEVEL = 0;
+ // end of constants
+
+ // variables
+ private final NetconfDomAccessor netconfDomAccessor;
+ 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<>();
+ // end of variables
+
+ // constructors
+ public Onf14DomEquipmentManager(NetconfDomAccessor netconfDomAccessor, DataProvider databaseService,
+ Onf14ToInternalDataModel onf14Mapper) {
+ super();
+ this.netconfDomAccessor = Objects.requireNonNull(netconfDomAccessor);
+ this.databaseService = Objects.requireNonNull(databaseService);
+ this.onf14Mapper = Objects.requireNonNull(onf14Mapper);
+ }
+ // end of constructors
+
+ // getters and setters
+ public List<UniversalId> getEquipmentUuidList() {
+ return equipmentUuidList;
+ }
+ // end of getters and setters
+
+ // private methods
+ private void addEquipmentToDb(Equipment currentEq, Equipment parentEq, long treeLevel,
+ Map<EquipmentKey, Equipment> equipmentMap, EquipmentKey equipmentKey) {
+ if (currentEq == null) {
+ log.info("Ignore empty equipment with key {}", equipmentKey);
+ return;
+ }
+
+ // if the Equipment UUID is already in the list, it was already processed
+ // needed for solving possible circular dependencies
+ if (equipmentUuidList.contains(currentEq.getUuid())) {
+ log.debug("Not adding equipment with uuid {} because it was aleady added...",
+ currentEq.getUuid().getValue());
+ return;
+ }
+
+ // we add this to our internal list, such that we avoid circular dependencies
+ equipmentUuidList.add(currentEq.getUuid());
+ 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));
+
+ // 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
+ for (ContainedHolder holder : YangHelper.getCollection(currentEq.nonnullContainedHolder())) {
+ @Nullable
+ UniversalId occupyingFru = holder.getOccupyingFru();
+ if (occupyingFru != null) {
+ equipmentKey = new EquipmentKey(occupyingFru);
+ addEquipmentToDb(equipmentMap.get(equipmentKey), currentEq, treeLevel + 1, equipmentMap, equipmentKey);
+ }
+ }
+ }
+ // end of private methods
+
+ // public methods
+ /**
+ * Set all equipment data from controlConstruct into database and into this manager.
+ *
+ * @param controlConstruct with complete device data
+ */
+ public void setEquipmentData(ControlConstruct controlConstruct) {
+ Objects.requireNonNull(controlConstruct);
+
+ // the top-level-equipment list contains the root objects of the Equipment Model
+ log.debug("Getting list of topLevelEquipment for mountpoint {}", netconfDomAccessor.getNodeId());
+ // adding all root Equipment objects to the DB
+ for (UniversalId uuid : CodeHelpers.nonnull(controlConstruct.getTopLevelEquipment())) {
+ log.debug("Got back topLevelEquipment with uuid {}", uuid.getValue());
+ EquipmentKey equipmentKey = new EquipmentKey(uuid);
+
+ // 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);
+ }
+ }
+
+ /**
+ * Read one equipment from device
+ *
+ * @param accessData to access device
+ * @param equipmentUuid uuid of equipment to be read
+ * @return Optional Equipment
+ */
+ public Optional<Equipment> readEquipmentInstance(NetconfDomAccessor accessData, UniversalId equipmentUuid) {
+
+ final Class<?> clazzPac = Equipment.class;
+
+ log.info("DBRead Get equipment for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
+ accessData.getNodeId().getValue(), equipmentUuid.getValue());
+
+ InstanceIdentifierBuilder equipmentIIDBuilder =
+ YangInstanceIdentifier.builder().node(ControlConstruct.QNAME).node(Equipment.QNAME).nodeWithKey(
+ Equipment.QNAME, QName.create(Equipment.QNAME, "uuid").intern(), equipmentUuid.getValue());
+
+ return accessData.readData(LogicalDatastoreType.CONFIGURATION, equipmentIIDBuilder.build(), Equipment.class);
+ }
+
+ /**
+ * 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) {
+
+ log.info("DBRead Get equipment-list for mountpoint {} for uuid {}", accessData.getNodeId().getValue(),
+ equipmentUuid.getValue());
+
+ YangInstanceIdentifier equipmentIIDBuilder = YangInstanceIdentifier.builder()
+ .node(ControlConstruct.QNAME)
+ .node(Equipment.QNAME)
+ .node(NodeIdentifierWithPredicates.of(Equipment.QNAME))
+ .build();
+
+ return accessData.readData(LogicalDatastoreType.CONFIGURATION, equipmentIIDBuilder,
+ ControlConstruct.class);
+ }
+
+ /**
+ * Read one equipment list from device
+ *
+ * @param accessData to access device
+ * @param equipmentUuid uuid of equipment to be read
+ * @return Optional Equipment
+ */
+ public void readTopLevelEquipment(NetconfDomAccessor accessData) {
+
+ log.info("DBRead Get top-level-equipment for mountpoint {}", accessData.getNodeId().getValue());
+
+ InstanceIdentifierBuilder equipmentIIDBuilder = YangInstanceIdentifier.builder().node(ControlConstruct.QNAME)
+ .node(QName.create(ControlConstruct.QNAME, "top-level-equipment"));
+
+ 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());
+ }
+ }
+ }
+ }
+ }
+ // end of public methods
+
+ // static methods
+ // end of static methods
+
+ // private classes
+ // end of private classes
+}
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14AirInterface.java b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14AirInterface.java
new file mode 100644
index 000000000..2d0d3c52d
--- /dev/null
+++ b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14AirInterface.java
@@ -0,0 +1,39 @@
+/*
+ * ============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.onf14.impl.interfaces;
+
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.dataprovider.InternalDataModelSeverity;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.SEVERITYTYPE;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author alexs
+ *
+ */
+public class Onf14AirInterface {
+
+ @SuppressWarnings("unused")
+ private static final Logger LOG = LoggerFactory.getLogger(Onf14AirInterface.class);
+
+ public static SeverityType mapSeverity(
+ Class<? extends SEVERITYTYPE> severity) {
+ return InternalDataModelSeverity.mapSeverity(severity);
+ }
+}
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14AirInterfaceNotificationListener.java b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14AirInterfaceNotificationListener.java
index dc37949cd..c72976732 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14AirInterfaceNotificationListener.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14AirInterfaceNotificationListener.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*
*/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl;
+package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
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
new file mode 100644
index 000000000..f4e697aec
--- /dev/null
+++ b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14DomInterfacePacManager.java
@@ -0,0 +1,356 @@
+/*
+ * ============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.onf14.impl.interfaces;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+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;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.equipment.Onf14DomEquipmentManager;
+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.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.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;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.LAYERPROTOCOLNAMETYPE;
+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.LogicalTerminationPoint;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.control.construct.LogicalTerminationPointKey;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.logical.termination.point.LayerProtocol;
+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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Onf14DomInterfacePacManager {
+
+ // constants
+ private static final Logger log = LoggerFactory.getLogger(Onf14DomEquipmentManager.class);
+ // end of constants
+
+ // variables
+ private final NetconfDomAccessor netconfDomAccessor;
+ private final @NonNull DeviceManagerServiceProvider serviceProvider;
+
+ // 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;
+ // end of variables
+
+ // constructors
+ public Onf14DomInterfacePacManager(@NonNull NetconfDomAccessor netconfDomAccessor,
+ @NonNull DeviceManagerServiceProvider serviceProvider) {
+
+ this.netconfDomAccessor = Objects.requireNonNull(netconfDomAccessor);
+ this.serviceProvider = Objects.requireNonNull(serviceProvider);
+
+ this.airInterfaceNotificationListenerHandler = null;
+ this.airInterfaceNotificationListener =
+ new Onf14AirInterfaceNotificationListener(netconfDomAccessor, serviceProvider);
+ this.etherneContainerNotificationListenerHandler = null;
+ ethernetContainerNotificationListener =
+ new Onf14EthernetContainerNotificationListener(netconfDomAccessor, serviceProvider);
+ this.wireInterfaceNotificationListenerHandler = null;
+ wireInterfaceNotificationListener =
+ new Onf14WireInterfaceNotificationListener(netconfDomAccessor, serviceProvider);
+ }
+ // end of constructors
+
+ // getters and setters
+ // end of getters and setters
+
+ // private methods
+ // end of private methods
+
+ // public methods
+ public void readAllAirInterfaceCurrentProblems(NetconfDomAccessor netconfDomAccessor,
+ ControlConstruct controlConstruct, FaultData resultList) {
+
+ int idxStart; // Start index for debug messages
+
+ for (TechnologySpecificPacKeys key : airInterfaceList) {
+ idxStart = resultList.size();
+
+ readAirInterfaceCurrentProblemForLtp(netconfDomAccessor, controlConstruct, key.getLtpUuid(),
+ key.getLocalId(), resultList);
+ Debug.debugResultList(key.getLtpUuid().getValue(), resultList, idxStart);
+ }
+ }
+
+ /*
+ public void readAllEhernetContainerCurrentProblems(FaultData resultList) {
+
+ int idxStart; // Start index for debug messages
+
+ for (TechnologySpecificPacKeys key : ethernetContainerList) {
+ idxStart = resultList.size();
+
+ readEthernetConainerCurrentProblemForLtp(key.getLtpUuid(), key.getLocalId(), resultList);
+ debugResultList(key.getLtpUuid().getValue(), resultList, idxStart);
+ }
+ }
+
+ public void readAllWireInterfaceCurrentProblems(FaultData resultList) {
+
+ int idxStart; // Start index for debug messages
+
+ for (TechnologySpecificPacKeys key : wireInterfaceList) {
+ idxStart = resultList.size();
+
+ readWireInterfaceCurrentProblemForLtp(key.getLtpUuid(), key.getLocalId(), resultList);
+ debugResultList(key.getLtpUuid().getValue(), resultList, idxStart);
+ }
+ }*/
+ public void readKeys(ControlConstruct controlConstruct) {
+
+ @NonNull
+ Collection<LogicalTerminationPoint> ltpList =
+ YangHelper.getCollection(controlConstruct.nonnullLogicalTerminationPoint());
+ log.debug("Iterating the LTP list for node {}", netconfDomAccessor.getNodeId().getValue());
+
+ // iterating all the Logical Termination Point list
+ for (LogicalTerminationPoint ltp : ltpList) {
+ @NonNull
+ List<LayerProtocol> lpList = YangHelper.getList(ltp.nonnullLayerProtocol());
+ // the Layer Protocol list should contain only one item, since we have an 1:1 relationship between the LTP and the LP
+ if (lpList.size() != 1) {
+ log.debug("Layer protocol has no 1:1 relationship with the LTP.");
+ return;
+ }
+ // accessing the LP, which should be only 1
+ LayerProtocol lp = lpList.get(0);
+ @Nullable
+ Class<? extends LAYERPROTOCOLNAMETYPE> layerProtocolName = lp.getLayerProtocolName();
+ if (layerProtocolName != null) {
+ // if the LTP has an airInterface technology extension, the layer protocol name is air-layer
+ if (layerProtocolName.getTypeName() == LAYERPROTOCOLNAMETYPEAIRLAYER.class.getName()) {
+ TechnologySpecificPacKeys airInterfaceKey =
+ new TechnologySpecificPacKeys(ltp.getUuid(), lp.getLocalId());
+ airInterfaceList.add(airInterfaceKey);
+ log.debug("Adding Ltp with uuid {} and local-id {} to the air-interface list",
+ ltp.getUuid().getValue(), lp.getLocalId());
+ }
+ // if the LTP has an ethernetContainier technology extension, the layer protocol name is ethernet-container-layer
+ else if (layerProtocolName.getTypeName() == LAYERPROTOCOLNAMETYPEETHERNETCONTAINERLAYER.class
+ .getName()) {
+ TechnologySpecificPacKeys ethernetContainerKey =
+ new TechnologySpecificPacKeys(ltp.getUuid(), lp.getLocalId());
+ ethernetContainerList.add(ethernetContainerKey);
+ log.debug("Adding Ltp with uuid {} and local-id {} to the ethernet-contatinier list",
+ ltp.getUuid().getValue(), lp.getLocalId());
+ } else if (layerProtocolName.getTypeName() == LAYERPROTOCOLNAMETYPEWIRELAYER.class.getName()) {
+ TechnologySpecificPacKeys wireInterfaceKey =
+ new TechnologySpecificPacKeys(ltp.getUuid(), lp.getLocalId());
+ wireInterfaceList.add(wireInterfaceKey);
+ log.debug("Adding Ltp with uuid {} and local-id {} to the wire-interface list",
+ ltp.getUuid().getValue(), lp.getLocalId());
+ }
+ }
+ }
+ }
+
+ private static void readAirInterfaceCurrentProblemForLtp(NetconfDomAccessor netconfDomAccessor,
+ ControlConstruct controlConstruct, UniversalId ltpUuid, String localId, FaultData resultList) {
+
+ final Class<AirInterfacePac> clazzPac = AirInterfacePac.class;
+
+ log.info("DBRead Get current problems for class {} from mountpoint {} for LTP uuid {} and local-id {}",
+ clazzPac.getSimpleName(), netconfDomAccessor.getNodeId().getValue(), ltpUuid.getValue(), localId);
+
+ // constructing the IID needs the augmentation exposed byy the air-interface-2-0 model
+ // InstanceIdentifier<AirInterfaceCurrentProblems> airInterfaceCurrentProblem_IID = InstanceIdentifier
+ // .builder(ControlConstruct.class)
+ // .child(LogicalTerminationPoint.class, new LogicalTerminationPointKey(ltpUuid))
+ // .child(LayerProtocol.class, new LayerProtocolKey(localId))
+ // .augmentation(
+ // org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.LayerProtocol1.class)
+ // .child(AirInterfacePac.class)
+ // .child(AirInterfaceCurrentProblems.class).build();
+ /*
+ final YangInstanceIdentifier airInterfaceCurrentProblem_IID =
+ YangInstanceIdentifier.builder().node(ControlConstruct.QNAME)
+ .nodeWithKey(LogicalTerminationPoint.QNAME,
+ QName.create(LogicalTerminationPoint.QNAME, "logical-termination-point-key").intern(),
+ ltpUuid.getValue())
+ .nodeWithKey(LayerProtocol.QNAME,
+ QName.create(LayerProtocol.QNAME, "layer-protocol-key").intern(), localId)
+ //.node(org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.LayerProtocol1.QNAME)
+ .node(AirInterfacePac.QNAME).node(AirInterfaceCurrentProblems.QNAME).build();
+
+ // reading all the current-problems list for this specific LTP and LP
+ AirInterfaceCurrentProblems problems =
+ netconfDomAccessor.readData(LogicalDatastoreType.OPERATIONAL, airInterfaceCurrentProblem_IID);
+ */
+
+ @NonNull
+ Map<LogicalTerminationPointKey, LogicalTerminationPoint> ltpMap =
+ controlConstruct.nonnullLogicalTerminationPoint();
+ LogicalTerminationPoint ltp = ltpMap.get(new LogicalTerminationPointKey(ltpUuid));
+ if (ltp != null) {
+ @NonNull
+ Map<LayerProtocolKey, LayerProtocol> lpMap = ltp.nonnullLayerProtocol();
+ LayerProtocol lp = lpMap.get(new LayerProtocolKey(localId));
+ @Nullable
+ LayerProtocol1 lp1 = lp.augmentation(
+ org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.LayerProtocol1.class);
+ if (lp1 != null) {
+ @Nullable
+ AirInterfacePac airInterfacePack = lp1.getAirInterfacePac();
+ if (airInterfacePack != null) {
+ @Nullable
+ AirInterfaceCurrentProblems cp = airInterfacePack.getAirInterfaceCurrentProblems();
+ if (cp == null) {
+ log.debug("DBRead Id {} no AirInterfaceCurrentProblems", ltpUuid);
+ } else {
+ for (org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.air._interface.current.problems.CurrentProblemList problem : YangHelper
+ .getCollection(cp.nonnullCurrentProblemList())) {
+ resultList.add(netconfDomAccessor.getNodeId(), (int) problem.getSequenceNumber(),
+ problem.getTimestamp(), ltpUuid.getValue(), problem.getProblemName(),
+ Onf14AirInterface.mapSeverity(problem.getProblemSeverity()));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ private void readEthernetConainerCurrentProblemForLtp(UniversalId ltpUuid, String localId, FaultData resultList) {
+
+ final Class<EthernetContainerPac> clazzPac = EthernetContainerPac.class;
+
+ log.info("DBRead Get current problems for class {} from mountpoint {} for LTP uuid {} and local-id {}",
+ clazzPac.getSimpleName(), netconfDomAccessor.getNodeId().getValue(), ltpUuid.getValue(), localId);
+
+ // constructing the IID needs the augmentation exposed by the ethernet-container-2-0 model
+ // InstanceIdentifier<EthernetContainerCurrentProblems> etherneContainerCurrentProblem_IID = InstanceIdentifier
+ // .builder(ControlConstruct.class)
+ // .child(LogicalTerminationPoint.class, new LogicalTerminationPointKey(ltpUuid))
+ // .child(LayerProtocol.class, new LayerProtocolKey(localId))
+ // .augmentation(
+ // org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.LayerProtocol1.class)
+ // .child(EthernetContainerPac.class).child(EthernetContainerCurrentProblems.class).build();
+ final YangInstanceIdentifier etherneContainerCurrentProblem_IID =
+ YangInstanceIdentifier.builder().node(ControlConstruct.QNAME)
+ .nodeWithKey(LogicalTerminationPoint.QNAME,
+ QName.create(LogicalTerminationPoint.QNAME, "logical-termination-point-key").intern(),
+ ltpUuid.getValue())
+ .nodeWithKey(LayerProtocol.QNAME,
+ QName.create(LayerProtocol.QNAME, "layer-protocol-key").intern(), localId)
+ //.node(org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.LayerProtocol1.QNAME)
+ .node(EthernetContainerPac.QNAME).node(EthernetContainerCurrentProblems.QNAME).build();
+
+ // reading all the current-problems list for this specific LTP and LP
+ EthernetContainerCurrentProblems problems =
+ netconfDomAccessor.readData(LogicalDatastoreType.OPERATIONAL, etherneContainerCurrentProblem_IID);
+
+ if (problems == null) {
+ log.debug("DBRead Id {} no EthernetContainerCurrentProblems", ltpUuid);
+ } 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())) {
+ resultList.add(netconfDomAccessor.getNodeId(), (int) problem.getSequenceNumber(),
+ problem.getTimestamp(), ltpUuid.getValue(), problem.getProblemName(),
+ Onf14EthernetContainer.mapSeverity(problem.getProblemSeverity()));
+ }
+ }
+ }
+
+ private void readWireInterfaceCurrentProblemForLtp(UniversalId ltpUuid, String localId, FaultData resultList) {
+
+ final Class<WireInterfacePac> clazzPac = WireInterfacePac.class;
+
+ log.info("DBRead Get current problems for class {} from mountpoint {} for LTP uuid {} and local-id {}",
+ clazzPac.getSimpleName(), netconfDomAccessor.getNodeId().getValue(), ltpUuid.getValue(), localId);
+
+ // constructing the IID needs the augmentation exposed by the wire-interface-2-0 model
+ // InstanceIdentifier<WireInterfaceCurrentProblems> wireInterfaceCurrentProblem_IID = InstanceIdentifier
+ // .builder(ControlConstruct.class)
+ // .child(LogicalTerminationPoint.class, new LogicalTerminationPointKey(ltpUuid))
+ // .child(LayerProtocol.class, new LayerProtocolKey(localId))
+ // .augmentation(
+ // org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.LayerProtocol1.class)
+ // .child(WireInterfacePac.class).child(WireInterfaceCurrentProblems.class).build();
+ final YangInstanceIdentifier wireInterfaceCurrentProblem_IID =
+ YangInstanceIdentifier.builder().node(ControlConstruct.QNAME)
+ .nodeWithKey(LogicalTerminationPoint.QNAME,
+ QName.create(LogicalTerminationPoint.QNAME, "logical-termination-point-key").intern(),
+ ltpUuid.getValue())
+ .nodeWithKey(LayerProtocol.QNAME,
+ QName.create(LayerProtocol.QNAME, "layer-protocol-key").intern(), localId)
+ //.node(org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.LayerProtocol1.QNAME)
+ .node(WireInterfacePac.QNAME).node(WireInterfaceCurrentProblems.QNAME).build();
+
+ // reading all the current-problems list for this specific LTP and LP
+ WireInterfaceCurrentProblems problems =
+ netconfDomAccessor.readData(LogicalDatastoreType.OPERATIONAL, wireInterfaceCurrentProblem_IID);
+
+ if (problems == null) {
+ log.debug("DBRead Id {} no WireInterfaceCurrentProblems", ltpUuid);
+ } 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())) {
+ resultList.add(netconfDomAccessor.getNodeId(), (int) problem.getSequenceNumber(),
+ problem.getTimestamp(), ltpUuid.getValue(), problem.getProblemName(),
+ Onf14WireInterface.mapSeverity(problem.getProblemSeverity()));
+ }
+ }
+ }
+ */
+
+ // end of public methods
+
+ // static methods
+ // end of static methods
+
+ // private classes
+ // end of private classes
+}
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14EthernetContainer.java b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14EthernetContainer.java
new file mode 100644
index 000000000..f9769951f
--- /dev/null
+++ b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14EthernetContainer.java
@@ -0,0 +1,40 @@
+/*
+ * ============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.onf14.impl.interfaces;
+
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.dataprovider.InternalDataModelSeverity;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.SEVERITYTYPE;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author alexs
+ *
+ */
+public class Onf14EthernetContainer {
+
+ @SuppressWarnings("unused")
+ private static final Logger LOG = LoggerFactory.getLogger(Onf14EthernetContainer.class);
+
+ public static SeverityType mapSeverity(
+ Class<? extends SEVERITYTYPE> severity) {
+ return InternalDataModelSeverity.mapSeverity(severity);
+ }
+
+}
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14EthernetContainerNotificationListener.java b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14EthernetContainerNotificationListener.java
index f68d6f306..7cc3c9b4e 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14EthernetContainerNotificationListener.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14EthernetContainerNotificationListener.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*
*/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl;
+package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/test/mock/TransactionUtilsMock.java b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14WireInterface.java
index 9546ae9f9..acb262fcb 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/test/mock/TransactionUtilsMock.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14WireInterface.java
@@ -15,30 +15,26 @@
* the License.
* ============LICENSE_END==========================================================================
*/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.test.mock;
+package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.jdt.annotation.Nullable;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.dataprovider.InternalDataModelSeverity;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.SEVERITYTYPE;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-public class TransactionUtilsMock implements TransactionUtils {
+/**
+ * @author alexs
+ *
+ */
+public class Onf14WireInterface {
- @Override
- public <T extends DataObject> @Nullable T readData(DataBroker dataBroker, LogicalDatastoreType dataStoreType,
- InstanceIdentifier<T> iid) {
- return null;
- }
+ @SuppressWarnings("unused")
+ private static final Logger LOG = LoggerFactory.getLogger(Onf14WireInterface.class);
- @Override
- public <T extends DataObject> @Nullable T readDataOptionalWithStatus(DataBroker dataBroker,
- LogicalDatastoreType dataStoreType, InstanceIdentifier<T> iid, AtomicBoolean noErrorIndication,
- AtomicReference<String> statusIndicator) {
- return null;
+ public static SeverityType mapSeverity(@Nullable Class<? extends SEVERITYTYPE> severity) {
+ return InternalDataModelSeverity.mapSeverity(severity);
}
}
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14WireInterfaceNotificationListener.java b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14WireInterfaceNotificationListener.java
index 1d4d5d8e4..0db482afb 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14WireInterfaceNotificationListener.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14WireInterfaceNotificationListener.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*
*/
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl;
+package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/TechnologySpecificPacKeys.java b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/TechnologySpecificPacKeys.java
new file mode 100644
index 000000000..552ba6604
--- /dev/null
+++ b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/TechnologySpecificPacKeys.java
@@ -0,0 +1,54 @@
+/*
+ * ============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.onf14.impl.interfaces;
+
+import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.UniversalId;
+
+/**
+ * Defining a structure that can map the LP local-id and its corresponding LTP uuid
+ */
+class TechnologySpecificPacKeys {
+
+ private UniversalId ltpUuid;
+ private String localId;
+
+ public TechnologySpecificPacKeys(UniversalId uuid, String lId) {
+ this.ltpUuid = uuid;
+ this.localId = lId;
+ }
+
+ public UniversalId getLtpUuid() {
+ return ltpUuid;
+ }
+
+ public String getLocalId() {
+ return localId;
+ }
+
+ public void setLtpUuid(UniversalId uuid) {
+ this.ltpUuid = uuid;
+ }
+
+ public void setLocalId(String lId) {
+ this.localId = lId;
+ }
+}
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/util/Debug.java b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/util/Debug.java
new file mode 100644
index 000000000..efa3cf169
--- /dev/null
+++ b/sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/util/Debug.java
@@ -0,0 +1,72 @@
+/*
+ * ============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.onf14.impl.util;
+
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Debug {
+
+ // constants
+ private static final Logger log = LoggerFactory.getLogger(Debug.class);
+ // end of constants
+
+ // variables
+ // end of variables
+
+ // constructors
+ // end of constructors
+
+ // getters and setters
+ // end of getters and setters
+
+ // private methods
+ // end of private methods
+
+ // public methods
+ /**
+ * LOG the newly added problems of the interface pac
+ *
+ * @param idxStart
+ * @param uuid
+ * @param resultList
+ */
+ public static void debugResultList(String uuid, FaultData resultList, int idxStart) {
+ StringBuilder sb = new StringBuilder();
+ int idx = 0;
+ for (int t = idxStart; t < resultList.size(); t++) {
+ sb.append(idx++);
+ sb.append(":{");
+ sb.append(resultList.get(t));
+ sb.append('}');
+ }
+ log.debug("Found problems {} {}", uuid, sb);
+ }
+ // end of public methods
+
+ // static methods
+ // end of static methods
+
+ // private classes
+ // end of private classes
+}
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestDeviceManagerOnf14Impl.java b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestDeviceManagerOnf14Impl.java
index 8dbfa2f5c..4b69e4232 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestDeviceManagerOnf14Impl.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestDeviceManagerOnf14Impl.java
@@ -43,7 +43,6 @@ public class TestDeviceManagerOnf14Impl extends Mockito {
devMgrOnf14.setNetconfNetworkElementService(netconfElemService);
devMgrOnf14.init();
} catch (Exception e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
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 7dbbc22b3..d03d50c1a 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
@@ -23,12 +23,11 @@ import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.Onf14AirInterfaceNotificationListener;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.test.mock.NetconfAccessorMock;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces.Onf14AirInterfaceNotificationListener;
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;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
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;
@@ -44,7 +43,7 @@ import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.Univ
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
public class TestOnf14AirInterfaceNotificationListener extends Mockito {
- private NetconfAccessor accessor;
+ private NetconfBindingAccessor accessor;
private NodeId nodeId;
private DeviceManagerServiceProvider serviceProvider;
private FaultService faultService;
@@ -58,7 +57,7 @@ public class TestOnf14AirInterfaceNotificationListener extends Mockito {
@Before
public void init() {
- accessor = mock(NetconfAccessorMock.class);
+ accessor = mock(NetconfBindingAccessor.class);
nodeId = mock(NodeId.class);
serviceProvider = mock(DeviceManagerServiceProvider.class);
faultService = mock(FaultService.class);
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 dedcf79c8..f6f7d9045 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
@@ -23,12 +23,11 @@ import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.Onf14EthernetContainerNotificationListener;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.test.mock.NetconfAccessorMock;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces.Onf14EthernetContainerNotificationListener;
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;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
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;
@@ -44,7 +43,7 @@ import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
public class TestOnf14EthernetContainerNotificationListener extends Mockito {
- private NetconfAccessor accessor;
+ private NetconfBindingAccessor accessor;
private NodeId nodeId;
private DeviceManagerServiceProvider serviceProvider;
private FaultService faultService;
@@ -58,7 +57,7 @@ public class TestOnf14EthernetContainerNotificationListener extends Mockito {
@Before
public void init() {
- accessor = mock(NetconfAccessorMock.class);
+ accessor = mock(NetconfBindingAccessor.class);
nodeId = mock(NodeId.class);
serviceProvider = mock(DeviceManagerServiceProvider.class);
faultService = mock(FaultService.class);
@@ -71,23 +70,23 @@ public class TestOnf14EthernetContainerNotificationListener extends Mockito {
attrValChangedNotif = mock(AttributeValueChangedNotification.class);
when(accessor.getNodeId()).thenReturn(nodeId);
- when(problemNotif.getCounter()).thenReturn(new Long(10));
+ when(problemNotif.getCounter()).thenReturn(10L);
when(problemNotif.getTimestamp()).thenReturn(new DateAndTime("2020-02-05T12:30:45.283Z"));
when(problemNotif.getObjectIdRef()).thenReturn(new UniversalId("12345678-0123-0abc-abcd-0123456789AB"));
when(problemNotif.getProblem()).thenReturn("modulationIsDownShifted");
when(attrValChangedNotif.getAttributeName()).thenReturn("12345678-0123-2345-abcd-0123456789AB");
- when(attrValChangedNotif.getCounter()).thenReturn(new Long(20));
+ when(attrValChangedNotif.getCounter()).thenReturn(20L);
when(attrValChangedNotif.getNewValue()).thenReturn("new-value");
when(attrValChangedNotif.getObjectIdRef()).thenReturn(new UniversalId("12345678-0123-1234-abcd-0123456789AB"));
when(attrValChangedNotif.getTimestamp()).thenReturn(new DateAndTime("2020-02-05T12:30:45.283Z"));
when(creationNotif.getObjectType()).thenReturn("air-interface-name");
- when(creationNotif.getCounter()).thenReturn(new Long(20));
+ when(creationNotif.getCounter()).thenReturn(20L);
when(creationNotif.getObjectIdRef()).thenReturn(new UniversalId("12345678-0123-1234-abcd-0123456789AB"));
when(creationNotif.getTimestamp()).thenReturn(new DateAndTime("2020-02-05T12:30:45.283Z"));
- when(deletionNotif.getCounter()).thenReturn(new Long(20));
+ when(deletionNotif.getCounter()).thenReturn(20L);
when(deletionNotif.getObjectIdRef()).thenReturn(new UniversalId("12345678-0123-1234-abcd-0123456789AB"));
when(deletionNotif.getTimestamp()).thenReturn(new DateAndTime("2020-02-05T12:30:45.283Z"));
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 d87e6d232..7a5658a4f 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
@@ -28,35 +28,36 @@ import org.mockito.Mockito;
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;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.test.mock.NetconfAccessorMock;
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.netconfnodestateservice.Capabilities;
+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.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.mdsal.dom.api.DOMDataBroker;
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.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
public class TestOnf14NetworkElement extends Mockito {
- static NetconfAccessorMock accessor;
+ private static String NODEIDSTRING = "nSky";
+
+ static NetconfDomAccessor accessor;
static DeviceManagerServiceProvider serviceProvider;
static Capabilities capabilities;
- QName qCapability;
static DataProvider dataProvider;
static FaultService faultService;
- static DataBroker dataBroker;
+ static DOMDataBroker dataBroker;
static TransactionUtils transactionUtils;
static ControlConstruct controlConstruct;
@Before
public void init() {
capabilities = mock(Capabilities.class);
- accessor = mock(NetconfAccessorMock.class);
+ accessor = mock(NetconfDomAccessor.class);
serviceProvider = mock(DeviceManagerServiceProvider.class);
NodeId nNodeId = new NodeId("nSky");
@@ -69,17 +70,16 @@ public class TestOnf14NetworkElement extends Mockito {
faultService = mock(FaultService.class);
when(serviceProvider.getFaultService()).thenReturn(faultService);
- dataBroker = mock(DataBroker.class);
+ dataBroker = mock(DOMDataBroker.class);
when(accessor.getDataBroker()).thenReturn(dataBroker);
controlConstruct = mock(ControlConstruct.class);
- transactionUtils = mock(TransactionUtils.class);
- when(accessor.getTransactionUtils()).thenReturn(transactionUtils);
- InstanceIdentifier<ControlConstruct> CONTROLCONSTRUCT_IID =
- InstanceIdentifier.builder(ControlConstruct.class).build();
- when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.CONFIGURATION,
- CONTROLCONSTRUCT_IID)).thenReturn(controlConstruct);
+ YangInstanceIdentifier CONTROLCONSTRUCT_IID =
+ YangInstanceIdentifier.builder().node(ControlConstruct.QNAME).build();
+
+ when(accessor.readData(LogicalDatastoreType.CONFIGURATION, CONTROLCONSTRUCT_IID, ControlConstruct.class))
+ .thenReturn(Optional.of(controlConstruct));
List<UniversalId> topLevelEqList = null;
UniversalId uuid = new UniversalId("0Aabcdef-0abc-0cfD-0abC-0123456789AB");
@@ -91,10 +91,21 @@ public class TestOnf14NetworkElement extends Mockito {
@Test
public void testGeneric() {
Optional<NetworkElement> onfNe;
+ NodeId nodeId = new NodeId(NODEIDSTRING);
+ NetconfBindingAccessor bindingAccessor = mock(NetconfBindingAccessor.class);
+ when(bindingAccessor.getTransactionUtils()).thenReturn(mock(TransactionUtils.class));
+ when(bindingAccessor.getNodeId()).thenReturn(nodeId);
+
+ NetconfDomAccessor domAccessor = mock(NetconfDomAccessor.class);
+ when(domAccessor.getNodeId()).thenReturn(nodeId);
+
when(accessor.getCapabilites().isSupportingNamespace(ControlConstruct.QNAME)).thenReturn(true);
+ when(accessor.getNetconfBindingAccessor()).thenReturn(Optional.of(bindingAccessor));
+ when(accessor.getNetconfDomAccessor()).thenReturn(Optional.of(domAccessor));
+
Onf14NetworkElementFactory factory = new Onf14NetworkElementFactory();
onfNe = factory.create(accessor, serviceProvider);
- assertTrue(factory.create(accessor, serviceProvider).isPresent());
+ assertTrue(onfNe.isPresent());
onfNe.get().register();
onfNe.get().deregister();
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 59e57da11..4087607d1 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
@@ -19,20 +19,22 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
+import java.util.Optional;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mockito;
+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.onf14.test.mock.NetconfAccessorMock;
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.opendaylight.yangtools.yang.common.QName;
public class TestOnf14NetworkElementFactory extends Mockito {
- static NetconfAccessor accessor;
+ static NetconfBindingAccessor accessor;
static DeviceManagerServiceProvider serviceProvider;
static Capabilities capabilities;
QName qCapability;
@@ -40,16 +42,18 @@ public class TestOnf14NetworkElementFactory extends Mockito {
@BeforeClass
public static void init() throws InterruptedException, IOException {
capabilities = mock(Capabilities.class);
- accessor = mock(NetconfAccessorMock.class);
+ accessor = mock(NetconfBindingAccessor.class);
serviceProvider = mock(DeviceManagerServiceProvider.class);
when(accessor.getCapabilites()).thenReturn(capabilities);
- when(serviceProvider.getDataProvider()).thenReturn(null);
+ when(serviceProvider.getDataProvider()).thenReturn(mock(DataProvider.class));
}
@Test
public void testCreateOnf14Component() throws Exception {
when(accessor.getCapabilites().isSupportingNamespace(ControlConstruct.QNAME)).thenReturn(true);
+ when(accessor.getNetconfBindingAccessor()).thenReturn(Optional.of(mock(NetconfBindingAccessor.class)));
+ when(accessor.getNetconfDomAccessor()).thenReturn(Optional.of(mock(NetconfDomAccessor.class)));
Onf14NetworkElementFactory factory = new Onf14NetworkElementFactory();
assertTrue((factory.create(accessor, serviceProvider)).isPresent());
}
@@ -58,7 +62,7 @@ public class TestOnf14NetworkElementFactory extends Mockito {
public void testCreateNone() throws Exception {
when(accessor.getCapabilites().isSupportingNamespace(ControlConstruct.QNAME)).thenReturn(false);
Onf14NetworkElementFactory factory = new Onf14NetworkElementFactory();
- assertTrue(!(factory.create(accessor, serviceProvider).isPresent()));
+ assertTrue(factory.create(accessor, serviceProvider).isEmpty());
}
}
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14ToInternalDataModel2.java b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14ToInternalDataModel2.java
index ca36f7946..b0b00d935 100644
--- a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14ToInternalDataModel2.java
+++ b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14ToInternalDataModel2.java
@@ -18,17 +18,19 @@
package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14;
import static org.junit.Assert.assertEquals;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.jdt.annotation.NonNull;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mockito;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.Onf14ToInternalDataModel;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.dataprovider.Onf14ToInternalDataModel;
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.Equipment;
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.equipment.ActualEquipment;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.equipment.ContainedHolder;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.equipment.ContainedHolderKey;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.equipment.detail.ManufacturedThing;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.manufactured.thing.EquipmentInstance;
import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.manufactured.thing.EquipmentType;
@@ -65,8 +67,8 @@ public class TestOnf14ToInternalDataModel2 extends Mockito {
when(currentEq.getUuid()).thenReturn(new UniversalId("0Aabcdef-0abc-0cfD-0abC-0123456789AB"));
when(parentEq.getUuid()).thenReturn(new UniversalId("0Aabcdef-0123-0abc-abcd-0123456789AB"));
- List<ContainedHolder> containedHolderList = new ArrayList<ContainedHolder>();
- containedHolderList.add(holder);
+ @NonNull Map<ContainedHolderKey, ContainedHolder> containedHolderList = new HashMap<>();
+ containedHolderList.put(holder.key(),holder);
when(currentEq.nonnullContainedHolder()).thenReturn(containedHolderList);
}
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 267e9a813..e1b13f118 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
@@ -23,12 +23,11 @@ import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.Onf14WireInterfaceNotificationListener;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.test.mock.NetconfAccessorMock;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces.Onf14WireInterfaceNotificationListener;
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;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
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;
@@ -44,7 +43,7 @@ import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
public class TestOnf14WireInterfaceNotificationListener extends Mockito {
- private NetconfAccessor accessor;
+ private NetconfBindingAccessor accessor;
private NodeId nodeId;
private DeviceManagerServiceProvider serviceProvider;
private FaultService faultService;
@@ -58,7 +57,7 @@ public class TestOnf14WireInterfaceNotificationListener extends Mockito {
@Before
public void init() {
- accessor = mock(NetconfAccessorMock.class);
+ accessor = mock(NetconfBindingAccessor.class);
nodeId = mock(NodeId.class);
serviceProvider = mock(DeviceManagerServiceProvider.class);
faultService = mock(FaultService.class);
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestSeverity.java b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestSeverity.java
new file mode 100644
index 000000000..686942a6b
--- /dev/null
+++ b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestSeverity.java
@@ -0,0 +1,80 @@
+/*
+ * ============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.onf14;
+
+import static org.junit.Assert.assertTrue;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces.Onf14AirInterface;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces.Onf14WireInterface;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType;
+
+public class TestSeverity extends Mockito {
+
+ @Test
+ public void test1_1() {
+ assertTrue(Onf14WireInterface.mapSeverity(
+ org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.SEVERITYTYPECRITICAL.class)
+ .equals(SeverityType.Critical));
+ }
+
+ @Test
+ public void test1_2() {
+ assertTrue(Onf14WireInterface.mapSeverity(
+ org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.SEVERITYTYPEWARNING.class)
+ .equals(SeverityType.Warning));
+ }
+
+ @Test
+ public void test1_3() {
+ assertTrue(Onf14WireInterface.mapSeverity(
+ org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.SEVERITYTYPEMINOR.class)
+ .equals(SeverityType.Minor));
+ }
+
+ @Test
+ public void test1_4() {
+ assertTrue(Onf14WireInterface.mapSeverity(
+ org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.SEVERITYTYPEMAJOR.class)
+ .equals(SeverityType.Major));
+ }
+
+ public void test2_1() {
+ assertTrue(Onf14AirInterface.mapSeverity(
+ org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.SEVERITYTYPECRITICAL.class)
+ .equals(SeverityType.Critical));
+ }
+
+ @Test
+ public void test2_2() {
+ assertTrue(Onf14AirInterface.mapSeverity(
+ org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.SEVERITYTYPEMINOR.class)
+ .equals(SeverityType.Minor));
+ }
+
+ @Test
+ public void test2_3() {
+ assertTrue(Onf14AirInterface.mapSeverity(null).equals(SeverityType.NonAlarmed));
+ }
+
+
+}
diff --git a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/test/mock/NetconfAccessorMock.java b/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/test/mock/NetconfAccessorMock.java
deleted file mode 100644
index 832485410..000000000
--- a/sdnr/wt/devicemanager-onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/test/mock/NetconfAccessorMock.java
+++ /dev/null
@@ -1,112 +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.onf14.test.mock;
-
-import com.google.common.util.concurrent.ListenableFuture;
-import java.util.List;
-import org.eclipse.jdt.annotation.NonNull;
-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.TransactionUtils;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.MountPoint;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionOutput;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.Stream;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
-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.NotificationListener;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-
-/**
- */
-public class NetconfAccessorMock implements NetconfAccessor {
-
- private final NodeId nNodeId;
- private final NetconfNode netconfNode;
- private final MountPoint mountpoint;
- private final DataBroker netconfNodeDataBroker;
-
- public NetconfAccessorMock(NodeId nNodeId, NetconfNode netconfNode, MountPoint mountpoint,
- DataBroker netconfNodeDataBroker) {
- this.nNodeId = nNodeId;
- this.netconfNode = netconfNode;
- this.mountpoint = mountpoint;
- this.netconfNodeDataBroker = netconfNodeDataBroker;
- }
-
- @Override
- public NodeId getNodeId() {
- return nNodeId;
- }
-
- @Override
- public NetconfNode getNetconfNode() {
- return netconfNode;
- }
-
- @Override
- public Capabilities getCapabilites() {
- return null;
- }
-
- @Override
- public DataBroker getDataBroker() {
- return netconfNodeDataBroker;
- }
-
- @Override
- public MountPoint getMountpoint() {
- return mountpoint;
- }
-
- @Override
- public TransactionUtils getTransactionUtils() {
- return null;
- }
-
- @Override
- public <T extends NotificationListener> ListenerRegistration<NotificationListener> doRegisterNotificationListener(
- @NonNull T listener) {
- return null;
- }
-
- @Override
- public ListenableFuture<RpcResult<CreateSubscriptionOutput>> registerNotificationsStream(String streamName) {
- return null;
- }
-
- @Override
- public void registerNotificationsStream(List<Stream> streamList) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public boolean isNCNotificationsSupported() {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public List<Stream> getNotificationStreams() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}