summaryrefslogtreecommitdiffstats
path: root/sdnr/wt
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt')
-rw-r--r--sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Basic.java32
-rw-r--r--sdnr/wt/devicemanager-onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14NetworkElement.java27
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NetworkElementConnectionEntitiyUtil.java9
-rw-r--r--sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/Capabilities.java11
4 files changed, 70 insertions, 9 deletions
diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Basic.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Basic.java
index 19be0281a..93d31c5ea 100644
--- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Basic.java
+++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Basic.java
@@ -18,6 +18,7 @@
package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ne;
import org.eclipse.jdt.annotation.NonNull;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.impl.DeviceManagerOnfConfiguration;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.AaiService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
@@ -27,8 +28,12 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.MaintenanceService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.PerformanceManager;
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.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.rev190801.NetworkElementConnectionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.NetworkElementDeviceType;
+import org.opendaylight.yangtools.yang.common.QName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -57,6 +62,7 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base {
private final @NonNull AaiService aaiProviderClient;
private final @NonNull PerformanceManager performanceManager;
private final @NonNull EventHandlingService eventListenerHandler;
+ private final @NonNull DataProvider dataProvider;
private final @NonNull String mountPointNodeName;
@@ -69,7 +75,7 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base {
/**
* Basic element for netconf device with ONF Core model V1.2
- *
+ *
* @param acessor to manage device connection
* @param serviceProvider to get devicemanager services
*/
@@ -87,6 +93,7 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base {
this.aaiProviderClient = serviceProvider.getAaiService();
this.performanceManager = serviceProvider.getPerformanceManagerService();
this.eventListenerHandler = serviceProvider.getEventHandlingService();
+ this.dataProvider = serviceProvider.getDataProvider();
}
@@ -162,6 +169,25 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base {
}
/**
+ * @param nNode
+ * set core-model-capability
+ */
+ public void setCoreModel(@NonNull NetconfNode nNode) {
+ NetworkElementConnectionBuilder eb = new NetworkElementConnectionBuilder();
+
+ String namespaceRevision;
+ QName QNAME_COREMODEL = QName.create("urn:onf:params:xml:ns:yang:core-model", "2017-03-20", "core-model").intern();
+
+ Capabilities availableCapabilities = Capabilities.getAvailableCapabilities(nNode);
+ namespaceRevision = availableCapabilities.getRevisionForNamespace(QNAME_COREMODEL);
+ if (Capabilities.isNamespaceSupported(namespaceRevision)) {
+ eb.setCoreModelCapability(namespaceRevision);
+ } else {
+ eb.setCoreModelCapability("Unsupported");
+ }
+ dataProvider.updateNetworkConnection22(eb.build(), acessor.getNodeId().getValue());
+ }
+ /**
* Remove all entries from list
*/
@Override
@@ -178,6 +204,9 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base {
// Register netconf stream
acessor.registerNotificationsStream(NetconfAccessor.DefaultNotificationsStream);
+ // Set core-model revision value in "core-model-capability" field
+ setCoreModel(acessor.getNetconfNode());
+
// -- Read data from NE
initialReadFromNetworkElement();
@@ -204,6 +233,7 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base {
maintenanceService.deleteIfNotRequired(mountPointNodeName);
performanceManager.deRegistration(mountPointNodeName);
aaiProviderClient.onDeviceUnregistered(mountPointNodeName);
+ faultService.removeAllCurrentProblemsOfNode(acessor.getNodeId());
}
@Override
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 92840fb3c..816aa50f4 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
@@ -28,6 +28,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElementSe
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.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.LAYERPROTOCOLNAMETYPEAIRLAYER;
@@ -51,11 +52,14 @@ import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.cont
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.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.opendaylight.netconf.node.topology.rev150114.NetconfNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.NetworkElementConnectionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.NetworkElementDeviceType;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.NotificationListener;
+import org.opendaylight.yangtools.yang.common.QName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -125,8 +129,31 @@ public class Onf14NetworkElement implements NetworkElement {
}
}
+ /**
+ * @param nNode
+ * set core-model-capability
+ */
+ public void setCoreModel(@NonNull NetconfNode nNode) {
+ NetworkElementConnectionBuilder eb = new NetworkElementConnectionBuilder();
+ log.info("In setCoreModel for Onf14NetworkElement");
+ 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);
+ log.info("In setCoreModel for Onf14NetworkElement- namespaceRevision = "+namespaceRevision);
+ if (Capabilities.isNamespaceSupported(namespaceRevision)) {
+ eb.setCoreModelCapability(namespaceRevision);
+ } else {
+ eb.setCoreModelCapability("Unsupported");
+ }
+ databaseService.updateNetworkConnection22(eb.build(), netconfAccessor.getNodeId().getValue());
+ }
+
@Override
public void register() {
+ // Set core-model revision value in "core-model-capability" field
+ setCoreModel(netconfAccessor.getNetconfNode());
initialReadFromNetworkElement();
// Register netconf stream
airInterfaceNotificationListenerHandler =
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NetworkElementConnectionEntitiyUtil.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NetworkElementConnectionEntitiyUtil.java
index 789930c0a..23c79f763 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NetworkElementConnectionEntitiyUtil.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NetworkElementConnectionEntitiyUtil.java
@@ -30,7 +30,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.NetworkElementConnectionEntity;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.NetworkElementDeviceType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.network.element.connection.entity.NodeDetailsBuilder;
-import org.opendaylight.yangtools.yang.common.QName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,11 +38,8 @@ public class NetworkElementConnectionEntitiyUtil {
private static final Logger LOG = LoggerFactory.getLogger(NetworkElementConnectionEntitiyUtil.class);
- private static final QName QNAME_COREMODEL =
- QName.create("urn:onf:params:xml:ns:yang:core-model", "2017-03-20", "core-model").intern();
-
/**
- * Update devicetype and let all other field empty
+ * Update devicetype and let all other field empties
*
* @param deviceType that should be updated
* @return NetworkElementConnectionEntity with related parameter
@@ -75,8 +71,6 @@ public class NetworkElementConnectionEntitiyUtil {
Capabilities availableCapabilities = Capabilities.getAvailableCapabilities(nNode);
Capabilities unAvailableCapabilities = Capabilities.getUnavailableCapabilities(nNode);
- eb.setCoreModelCapability(availableCapabilities.getRevisionForNamespace(QNAME_COREMODEL));
-
NodeDetailsBuilder nodeDetails =
new NodeDetailsBuilder().setAvailableCapabilities(availableCapabilities.getCapabilities())
.setUnavailableCapabilities(unAvailableCapabilities.getCapabilities());
@@ -93,6 +87,7 @@ public class NetworkElementConnectionEntitiyUtil {
LoginPassword loginPassword = (LoginPassword) credentials;
eb.setUsername(loginPassword.getUsername()).setPassword(loginPassword.getPassword());
}
+ eb.setCoreModelCapability("Unsupported"); // Default value. Specific value (if any) is set in the specific devicemanagers
return eb.build();
}
}
diff --git a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/Capabilities.java b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/Capabilities.java
index 6b790afc8..a348b29ad 100644
--- a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/Capabilities.java
+++ b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/Capabilities.java
@@ -49,6 +49,7 @@ public class Capabilities {
private static final Logger LOG = LoggerFactory.getLogger(Capabilities.class);
private static final String METHODNAME = "getCapability";
+ private static final String UNSUPPORTED = "Unsupported";
private final List<String> capabilities = new ArrayList<>();
private final DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
@@ -218,9 +219,17 @@ public class Capabilities {
return QName.create(capability).getRevision().get().toString();
}
}
- return "Unsupported";
+ return UNSUPPORTED;
}
+ /**
+ * Verify if QName namespace is supported by capabilities
+ * @param revision result of getRevisionForNamespace()
+ * @return true if namespace is supported.
+ */
+ static public boolean isNamespaceSupported(String revision) {
+ return revision != UNSUPPORTED;
+ }
@Override
public String toString() {