From 7a80462a5fabf473bcb48e1b3ede695fbc067d2e Mon Sep 17 00:00:00 2001 From: Ravi Pendurty Date: Wed, 19 Aug 2020 16:33:48 +0200 Subject: [PATCH] New Devicemanager for NTSIM Functionality devicemanager-adapter-manager for support of NTSIM functionality by removing from devicemanager-oran Issue-ID: CCSDK-2573 Signed-off-by: Ravi Pendurty Change-Id: Ie9a667c954749055b81caad8131d54c412a47270 Signed-off-by: Ravi Pendurty --- .../devicemanager-adapter-manager/feature/pom.xml | 50 ++++ .../installer/pom.xml | 116 ++++++++ .../src/assembly/assemble_mvnrepo_zip.xml | 47 ++++ .../wt/devicemanager-adapter-manager/model/pom.xml | 72 +++++ .../main/yang/devicemanager-adapter-manager.yang | 36 +++ sdnr/wt/devicemanager-adapter-manager/pom.xml | 53 ++++ .../provider/copyright | 17 ++ .../devicemanager-adapter-manager/provider/pom.xml | 117 ++++++++ .../impl/AdapterManagerNetworkElementFactory.java | 42 +++ .../impl/DeviceManagerAdapterManagerImpl.java | 86 ++++++ .../adaptermanager/impl/NtsNetworkElement.java | 77 ++++++ .../org/opendaylight/blueprint/impl-blueprint.xml | 38 +++ .../provider/src/main/resources/version.properties | 24 ++ .../src/main/yang/network-topology-simulator.yang | 297 +++++++++++++++++++++ .../test/TestAdapterManagerNetworkElement.java | 82 ++++++ .../TestAdapterManagerNetworkElementFactory.java | 73 +++++ .../test/TestDeviceManagerAdapterManagerImpl.java | 95 +++++++ .../test/mock/NetconfAccessorMock.java | 92 +++++++ .../test/mock/TransactionUtilsMock.java | 47 ++++ .../src/test/resources/simplelogger.properties | 61 +++++ sdnr/wt/pom.xml | 1 + 21 files changed, 1523 insertions(+) create mode 100644 sdnr/wt/devicemanager-adapter-manager/feature/pom.xml create mode 100755 sdnr/wt/devicemanager-adapter-manager/installer/pom.xml create mode 100644 sdnr/wt/devicemanager-adapter-manager/installer/src/assembly/assemble_mvnrepo_zip.xml create mode 100644 sdnr/wt/devicemanager-adapter-manager/model/pom.xml create mode 100644 sdnr/wt/devicemanager-adapter-manager/model/src/main/yang/devicemanager-adapter-manager.yang create mode 100755 sdnr/wt/devicemanager-adapter-manager/pom.xml create mode 100644 sdnr/wt/devicemanager-adapter-manager/provider/copyright create mode 100644 sdnr/wt/devicemanager-adapter-manager/provider/pom.xml create mode 100644 sdnr/wt/devicemanager-adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/AdapterManagerNetworkElementFactory.java create mode 100644 sdnr/wt/devicemanager-adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/DeviceManagerAdapterManagerImpl.java create mode 100644 sdnr/wt/devicemanager-adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/NtsNetworkElement.java create mode 100644 sdnr/wt/devicemanager-adapter-manager/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml create mode 100644 sdnr/wt/devicemanager-adapter-manager/provider/src/main/resources/version.properties create mode 100644 sdnr/wt/devicemanager-adapter-manager/provider/src/main/yang/network-topology-simulator.yang create mode 100644 sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestAdapterManagerNetworkElement.java create mode 100644 sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestAdapterManagerNetworkElementFactory.java create mode 100644 sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestDeviceManagerAdapterManagerImpl.java create mode 100644 sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/mock/NetconfAccessorMock.java create mode 100644 sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/mock/TransactionUtilsMock.java create mode 100644 sdnr/wt/devicemanager-adapter-manager/provider/src/test/resources/simplelogger.properties diff --git a/sdnr/wt/devicemanager-adapter-manager/feature/pom.xml b/sdnr/wt/devicemanager-adapter-manager/feature/pom.xml new file mode 100644 index 000000000..74c6b24db --- /dev/null +++ b/sdnr/wt/devicemanager-adapter-manager/feature/pom.xml @@ -0,0 +1,50 @@ + + + + + 4.0.0 + + + org.onap.ccsdk.parent + single-feature-parent + 2.0.1-SNAPSHOT + + + + org.onap.ccsdk.features.sdnr.wt + sdnr-wt-devicemanager-adapter-manager-feature + 1.0.1-SNAPSHOT + feature + + ccsdk-features :: ${project.artifactId} + + + + ${project.groupId} + sdnr-wt-devicemanager-adapter-manager-provider + ${project.version} + + + diff --git a/sdnr/wt/devicemanager-adapter-manager/installer/pom.xml b/sdnr/wt/devicemanager-adapter-manager/installer/pom.xml new file mode 100755 index 000000000..a4d2f87e4 --- /dev/null +++ b/sdnr/wt/devicemanager-adapter-manager/installer/pom.xml @@ -0,0 +1,116 @@ + + + + + 4.0.0 + + + org.onap.ccsdk.parent + odlparent-lite + 2.0.1-SNAPSHOT + + + + org.onap.ccsdk.features.sdnr.wt + sdnr-wt-devicemanager-adapter-manager-installer + 1.0.1-SNAPSHOT + pom + + ccsdk-features :: ${project.artifactId} + + + sdnr-wt-devicemanager-adapter-manager + false + + + + + org.onap.ccsdk.features.sdnr.wt + ${application.name}-feature + ${project.version} + xml + features + + + * + * + + + + + org.onap.ccsdk.features.sdnr.wt + ${application.name}-provider + ${project.version} + + + + + + + maven-assembly-plugin + + + maven-repo-zip + + single + + package + + true + stage/${application.name}-${project.version} + + src/assembly/assemble_mvnrepo_zip.xml + + true + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-nested-dependencies + + copy-dependencies + + prepare-package + + true + ${project.build.directory}/assembly/system + false + true + true + true + false + false + + + + + + + diff --git a/sdnr/wt/devicemanager-adapter-manager/installer/src/assembly/assemble_mvnrepo_zip.xml b/sdnr/wt/devicemanager-adapter-manager/installer/src/assembly/assemble_mvnrepo_zip.xml new file mode 100644 index 000000000..dfe5060bf --- /dev/null +++ b/sdnr/wt/devicemanager-adapter-manager/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -0,0 +1,47 @@ + + + + + + repo + + zip + + + + false + + + + target/assembly/ + . + + + + + + diff --git a/sdnr/wt/devicemanager-adapter-manager/model/pom.xml b/sdnr/wt/devicemanager-adapter-manager/model/pom.xml new file mode 100644 index 000000000..c85f0f0aa --- /dev/null +++ b/sdnr/wt/devicemanager-adapter-manager/model/pom.xml @@ -0,0 +1,72 @@ + + + + + 4.0.0 + + + org.onap.ccsdk.parent + binding-parent + 2.0.1-SNAPSHOT + + + + org.onap.ccsdk.features.sdnr.wt + sdnr-wt-devicemanager-adapter-manager-model + 1.0.1-SNAPSHOT + bundle + + ccsdk-features :: ${project.artifactId} + + + Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0 + + + + + true + + + + + + + + + org.jacoco + jacoco-maven-plugin + + + **/gen/** + **/generated-sources/** + **/yang-gen-sal/** + **/pax/** + + + + + + diff --git a/sdnr/wt/devicemanager-adapter-manager/model/src/main/yang/devicemanager-adapter-manager.yang b/sdnr/wt/devicemanager-adapter-manager/model/src/main/yang/devicemanager-adapter-manager.yang new file mode 100644 index 000000000..5fa43c496 --- /dev/null +++ b/sdnr/wt/devicemanager-adapter-manager/model/src/main/yang/devicemanager-adapter-manager.yang @@ -0,0 +1,36 @@ +module devicemanager-adapter-manager { + + yang-version 1; + namespace "urn:opendaylight:params:xml:ns:yang:devicemanager-adapter-manager"; + prefix devicemanager-adapter-manager; + + organization + "highstreet technologies GmbH"; + contact + "Web: "; + + description + "DeviceManager adapter-manager Api Module + + Copyright 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."; + + revision 2020-08-19 { + description + "Initial revision"; + reference + "https://jira.onap.org/browse/CCSDK-2573"; + } +} diff --git a/sdnr/wt/devicemanager-adapter-manager/pom.xml b/sdnr/wt/devicemanager-adapter-manager/pom.xml new file mode 100755 index 000000000..4e8b15012 --- /dev/null +++ b/sdnr/wt/devicemanager-adapter-manager/pom.xml @@ -0,0 +1,53 @@ + + + + + 4.0.0 + + + org.onap.ccsdk.parent + odlparent-lite + 2.0.1-SNAPSHOT + + + + org.onap.ccsdk.features.sdnr.wt + sdnr-wt-devicemanager-adapter-manager-top + 1.0.1-SNAPSHOT + pom + + ccsdk-features :: ${project.artifactId} + + + model + provider + feature + installer + + + + sdnr-wt-devicemanager-adapter-manager + + diff --git a/sdnr/wt/devicemanager-adapter-manager/provider/copyright b/sdnr/wt/devicemanager-adapter-manager/provider/copyright new file mode 100644 index 000000000..754b6218f --- /dev/null +++ b/sdnr/wt/devicemanager-adapter-manager/provider/copyright @@ -0,0 +1,17 @@ +/** + * ============LICENSE_START======================================================================== + * ONAP : ccsdk feature sdnr wt + * ================================================================================================= + * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. + * ================================================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * ============LICENSE_END========================================================================== + */ diff --git a/sdnr/wt/devicemanager-adapter-manager/provider/pom.xml b/sdnr/wt/devicemanager-adapter-manager/provider/pom.xml new file mode 100644 index 000000000..8ba76a59e --- /dev/null +++ b/sdnr/wt/devicemanager-adapter-manager/provider/pom.xml @@ -0,0 +1,117 @@ + + + + + 4.0.0 + + + org.onap.ccsdk.parent + binding-parent + 2.0.1-SNAPSHOT + + + + org.onap.ccsdk.features.sdnr.wt + sdnr-wt-devicemanager-adapter-manager-provider + 1.0.1-SNAPSHOT + bundle + + ccsdk-features :: ${project.artifactId} + + + Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0 + + + + + true + true + yyyy-MM-dd HH:mm + ${maven.build.timestamp} UTC + 49400 + + + + + + org.mockito + mockito-core + test + + + + + ${project.groupId} + sdnr-wt-devicemanager-adapter-manager-model + ${project.version} + + + org.onap.ccsdk.features.sdnr.wt + sdnr-wt-devicemanager-model + ${project.version} + provided + + + ${project.groupId} + sdnr-wt-netconfnode-state-service-model + ${project.version} + provided + + + org.opendaylight.netconf + sal-netconf-connector + provided + + + org.opendaylight.mdsal + mdsal-singleton-common-api + provided + + + + + + + src/main/resources + true + + + + + org.jacoco + jacoco-maven-plugin + + + **/gen/** + **/generated-sources/** + **/yang-gen-sal/** + **/pax/** + + + + + + diff --git a/sdnr/wt/devicemanager-adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/AdapterManagerNetworkElementFactory.java b/sdnr/wt/devicemanager-adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/AdapterManagerNetworkElementFactory.java new file mode 100644 index 000000000..db9fd94b1 --- /dev/null +++ b/sdnr/wt/devicemanager-adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/AdapterManagerNetworkElementFactory.java @@ -0,0 +1,42 @@ +/* + * ============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.adaptermanager.impl; + +import java.util.Optional; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.factory.NetworkElementFactory; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.network.topology.simulator.rev191025.SimulatorStatus; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AdapterManagerNetworkElementFactory implements NetworkElementFactory { + + private static final Logger log = LoggerFactory.getLogger(AdapterManagerNetworkElementFactory.class); + + @Override + public Optional create(NetconfAccessor acessor, DeviceManagerServiceProvider serviceProvider) { + if (acessor.getCapabilites().isSupportingNamespace(SimulatorStatus.QNAME)) { + log.info("Create device {} ", NtsNetworkElement.class.getName()); + return Optional.of(new NtsNetworkElement(acessor, serviceProvider.getDataProvider())); + } + return Optional.empty(); + } +} diff --git a/sdnr/wt/devicemanager-adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/DeviceManagerAdapterManagerImpl.java b/sdnr/wt/devicemanager-adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/DeviceManagerAdapterManagerImpl.java new file mode 100644 index 000000000..33ad9c0ed --- /dev/null +++ b/sdnr/wt/devicemanager-adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/DeviceManagerAdapterManagerImpl.java @@ -0,0 +1,86 @@ +/* + * ============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.adaptermanager.impl; + +import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.factory.FactoryRegistration; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DeviceManagerAdapterManagerImpl implements AutoCloseable { + + private static final Logger LOG = LoggerFactory.getLogger(DeviceManagerAdapterManagerImpl.class); + private static final String APPLICATION_NAME = "DeviceManagerAdapterManager"; + + private NetconfNetworkElementService netconfNetworkElementService; + + private HtDatabaseClient htDatabaseClient; + private Boolean devicemanagerInitializationOk = false; + private FactoryRegistration resAdapterManager; + + // Blueprint begin + public DeviceManagerAdapterManagerImpl() { + LOG.info("Creating provider for {}", APPLICATION_NAME); + resAdapterManager = null; + } + + public void setNetconfNetworkElementService(NetconfNetworkElementService netconfNetworkElementService) { + this.netconfNetworkElementService = netconfNetworkElementService; + } + + public void init() throws Exception { + + LOG.info("Session Initiated start {}", APPLICATION_NAME); + + resAdapterManager = netconfNetworkElementService.registerNetworkElementFactory(new AdapterManagerNetworkElementFactory()); + + + netconfNetworkElementService.writeToEventLog(APPLICATION_NAME, "startup", "done"); + this.devicemanagerInitializationOk = true; + + LOG.info("Session Initiated end. Initialization done {}", devicemanagerInitializationOk); + } + // Blueprint end + + @Override + public void close() throws Exception { + LOG.info("closing ..."); + close(htDatabaseClient); + close(resAdapterManager); + LOG.info("closing done"); + } + + /** + * Used to close all Services, that should support AutoCloseable Pattern + * + * @param toClose + * @throws Exception + */ + private void close(AutoCloseable... toCloseList) { + for (AutoCloseable element : toCloseList) { + if (element != null) { + try { + element.close(); + } catch (Exception e) { + LOG.warn("Fail during close: ", e); + } + } + } + } +} diff --git a/sdnr/wt/devicemanager-adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/NtsNetworkElement.java b/sdnr/wt/devicemanager-adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/NtsNetworkElement.java new file mode 100644 index 000000000..cf0168246 --- /dev/null +++ b/sdnr/wt/devicemanager-adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/NtsNetworkElement.java @@ -0,0 +1,77 @@ +/* + * ============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.adaptermanager.impl; + +import java.util.Optional; +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.netconfnodestateservice.NetconfAccessor; +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.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author herbert + * + */ +public class NtsNetworkElement implements NetworkElement { + + private static final Logger LOG = LoggerFactory.getLogger(NtsNetworkElement.class); + + private final NetconfAccessor netconfAccessor; + + @SuppressWarnings("unused") + private final DataProvider databaseService; + + NtsNetworkElement(NetconfAccessor netconfAccess, DataProvider databaseService) { + LOG.info("Create {}", NtsNetworkElement.class.getSimpleName()); + this.netconfAccessor = netconfAccess; + this.databaseService = databaseService; + } + + @Override + public void deregister() {} + + @Override + public NodeId getNodeId() { + return netconfAccessor.getNodeId(); + } + + @Override + public Optional getService(Class clazz) { + return Optional.empty(); + } + + @Override + public void warmstart() {} + + @Override + public void register() {} + + @Override + public NetworkElementDeviceType getDeviceType() { + return NetworkElementDeviceType.NtsManager; + } + + @Override + public Optional getAcessor() { + return Optional.of(this.netconfAccessor); + } +} diff --git a/sdnr/wt/devicemanager-adapter-manager/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/sdnr/wt/devicemanager-adapter-manager/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml new file mode 100644 index 000000000..a0b20b3d3 --- /dev/null +++ b/sdnr/wt/devicemanager-adapter-manager/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + diff --git a/sdnr/wt/devicemanager-adapter-manager/provider/src/main/resources/version.properties b/sdnr/wt/devicemanager-adapter-manager/provider/src/main/resources/version.properties new file mode 100644 index 000000000..6638c04f9 --- /dev/null +++ b/sdnr/wt/devicemanager-adapter-manager/provider/src/main/resources/version.properties @@ -0,0 +1,24 @@ +# +# ============LICENSE_START======================================================= +# ONAP : ccsdk features +# ================================================================================ +# Copyright (C) 2020 AT&T 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======================================================= +# +# + +# Properties filled in by maven during build process +version = ${project.version} +build = ${buildtime} diff --git a/sdnr/wt/devicemanager-adapter-manager/provider/src/main/yang/network-topology-simulator.yang b/sdnr/wt/devicemanager-adapter-manager/provider/src/main/yang/network-topology-simulator.yang new file mode 100644 index 000000000..ac2cf8dd3 --- /dev/null +++ b/sdnr/wt/devicemanager-adapter-manager/provider/src/main/yang/network-topology-simulator.yang @@ -0,0 +1,297 @@ +module network-topology-simulator { + yang-version 1.1; + namespace "urn:onf:params:xml:ns:yang:network-topology-simulator"; + prefix network-topology-simulator; + + import ietf-inet-types { + prefix inet; + } + + organization + "Melacon"; + contact + "Web: + Editors: Alex Stancu + "; + description + "This module contains a collection of YANG definitions for managing the Network Topology Simulator."; + + revision 2019-10-25 { + description + "Modify notifications. Add VES message configuration options."; + reference + "O-RAN SC SIM project"; + } + revision 2019-06-07 { + description + "Modify controller details."; + reference + "O-RAN SC SIM project"; + } + revision 2019-03-07 { + description + "Initial version"; + reference + "O-RAN SC SIM project"; + } + + typedef operational-state-type { + type enumeration { + enum not-specified { + description + "none"; + } + enum running { + description + "none"; + } + enum created { + description + "none"; + } + enum exited { + description + "none"; + } + } + description + "The operation state of the simulated device."; + } + + typedef authentication-method-type { + type enumeration { + enum no-auth { + description + "no security (http)"; + } + enum cert-only { + description + "auth by certificate (https)"; + } + enum basic-auth { + description + "auth by basic auth username and password (https)"; + } + enum cert-basic-auth { + description + "auth by certificate and basic auth username / password (https)"; + } + } + description + "The authentication method for VES messaging."; + } + + typedef percent { + type decimal64 { + fraction-digits 2; + range "0 .. 100"; + } + description + "Percentage"; + } + + grouping controller-details-type-g { + leaf controller-ip { + type inet:ip-address; + description + "The IP Address of the SDN Controller."; + } + leaf controller-port { + type inet:port-number; + description + "The Port of the SDN Controller."; + } + leaf controller-username { + type string; + description + "The Username of the SDN Controller."; + } + leaf controller-password { + type string; + description + "The Password of the SDN Controller."; + } + description + "none"; + } + + grouping simulated-devices-type-g { + leaf uuid { + type string; + description + "The UUID of the simulated device."; + } + leaf device-ip { + type string; + description + "The IP Address of the simulated device."; + } + leaf-list device-port { + type uint32; + description + "A NETCONF endpoint (port) of the simulated device."; + } + leaf is-mounted { + type boolean; + description + "Specifies if the simulated device is mounted in the SDN Controller."; + } + leaf operational-state { + type operational-state-type; + description + "Specifies the operational state of the simulated device."; + } + description + "none"; + } + + container simulator-config { + description + "Configuration container of the simulator."; + leaf simulated-devices { + type uint32; + default "0"; + description + "The number of devices to be simulated."; + } + leaf mounted-devices { + type uint32; + default "0"; + description + "The number of devices to be mounted in ODL. The configured number should not exceed the number of mounted devices."; + } + container notification-config { + leaf fault-notification-delay-period { + type uint32; + default "0"; + description + "Interval in seconds between two consecutive notifications. If the attribute is set to 0, nofitications are not generated."; + } + leaf ves-heartbeat-period { + type uint32; + default "0"; + description + "Interval in seconds between two VES heartbeat messages. If the attribute is set to 0, heartbeat messages are not generated."; + } + leaf is-netconf-available { + type boolean; + default "true"; + description + "If set to 'true', NETCONF notifications will be generated."; + } + leaf is-ves-available { + type boolean; + default "true"; + description + "If set to 'true', VES messages will be generated."; + } + description + "none"; + } + container controller-details { + uses controller-details-type-g; + description + "The connectivity details of the SDN Controller where we want to mount our simulated devices."; + } + container ves-endpoint-details { + must 'ves-registration = "false" or ../mounted-devices = 0' { + error-message "VES registration cannot be active while devices are still mounted to ODL not via VES."; + } + leaf ves-endpoint-ip { + type inet:ip-address; + description + "The IP Address of the VES Endpoint."; + } + leaf ves-endpoint-port { + type inet:port-number; + description + "The Port of the VES Endpoint."; + } + leaf ves-endpoint-auth-method { + type authentication-method-type; + default "no-auth"; + description + "The type of the authentication to be used with the VES Endpoint."; + } + leaf ves-endpoint-username { + when "../ves-endpoint-auth-method = 'basic-auth' or ../ves-endpoint-auth-method = 'cert-basic-auth'"; + type string; + description + "The Username to be used to authenticate to the VES Endpoint."; + } + leaf ves-endpoint-password { + when "../ves-endpoint-auth-method = 'basic-auth' or ../ves-endpoint-auth-method = 'cert-basic-auth'"; + type string; + description + "The Password to be used to authenticate to the VES Endpoint."; + } + leaf ves-endpoint-certificate { + when "../ves-endpoint-auth-method = 'cert-only' or ../ves-endpoint-auth-method = 'cert-basic-auth'"; + type string; + description + "The Certificate to be used to authenticate to the VES Endpoint."; + } + leaf ves-registration { + type boolean; + default "false"; + description + "If this is set to 'True', the simulated devices will automatically send a pnfRegistration VES message when they start. This cannot be set to 'True' if we already have 'mounted-devices' greater that 0, because we already mounted the devices directly to ODL."; + } + description + "none"; + } + } + container simulator-status { + config false; + container simulation-usage-details { + config false; + leaf running-simulated-devices { + type uint32; + description + "The current number of running simulated devices."; + } + leaf running-mounted-devices { + type uint32; + description + "The current number of running simulated devices that are mounted in ODL."; + } + leaf base-netconf-port { + type uint32; + default "30000"; + description + "The starting port number for the NETCONF connections exposed."; + } + leaf cpu-usage { + type percent; + description + "Specifies the CPU load generated by this simulated device."; + } + leaf mem-usage { + type uint32; + description + "Specifies the RAM in MB used by this simulated device."; + } + description + "The details about the simulation, including resources consumed."; + } + list simulated-devices-list { + key "uuid"; + config false; + uses simulated-devices-type-g; + description + "The list of the devices that are currently simulated."; + } + description + "State data container of the simulator."; + } + + rpc restart-simulation { + description + "Operation to restart all the simulated devices with the new configuration of the simulator."; + } + + rpc add-key-pair-to-odl { + description + "Operation to add a key pair signed by the NTS to OpenDaylight, such that it can connect to devices using TLS."; + } +} diff --git a/sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestAdapterManagerNetworkElement.java b/sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestAdapterManagerNetworkElement.java new file mode 100644 index 000000000..0fa83c031 --- /dev/null +++ b/sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestAdapterManagerNetworkElement.java @@ -0,0 +1,82 @@ +/* + * ============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.adaptermanager.test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; +import java.io.IOException; +import java.util.Optional; +import org.junit.After; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.adaptermanager.impl.AdapterManagerNetworkElementFactory; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.adaptermanager.test.mock.NetconfAccessorMock; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.adaptermanager.test.mock.TransactionUtilsMock; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.network.topology.simulator.rev191025.SimulatorStatus; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; +import org.opendaylight.yangtools.yang.common.QName; + +public class TestAdapterManagerNetworkElement { + + static NetconfAccessorMock accessor; + static DeviceManagerServiceProvider serviceProvider; + static Capabilities capabilities; + QName qCapability; + + @BeforeClass + public static void init() throws InterruptedException, IOException { + capabilities = mock(Capabilities.class); + //accessor = mock(NetconfAccessorMock.class); + accessor = spy(new NetconfAccessorMock(null, null, null, null)); + serviceProvider = mock(DeviceManagerServiceProvider.class); + + NodeId nNodeId = new NodeId("nSky"); + when(accessor.getCapabilites()).thenReturn(capabilities); + when(accessor.getNodeId()).thenReturn(nNodeId); + when(accessor.getTransactionUtils()).thenReturn(new TransactionUtilsMock()); + + DataProvider dataProvider = mock(DataProvider.class); + when(serviceProvider.getDataProvider()).thenReturn(dataProvider); + } + + @Test + public void test() { + Optional adapterManagerNe; + when(accessor.getCapabilites().isSupportingNamespace(SimulatorStatus.QNAME)).thenReturn(true); + AdapterManagerNetworkElementFactory factory = new AdapterManagerNetworkElementFactory(); + adapterManagerNe = factory.create(accessor, serviceProvider); + assertTrue(factory.create(accessor, serviceProvider).isPresent()); + adapterManagerNe.get().register(); + adapterManagerNe.get().deregister(); + adapterManagerNe.get().getAcessor(); + adapterManagerNe.get().getDeviceType(); + assertEquals(adapterManagerNe.get().getNodeId().getValue(), "nSky"); + } + + @After + public void cleanUp() throws Exception { + + } +} diff --git a/sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestAdapterManagerNetworkElementFactory.java b/sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestAdapterManagerNetworkElementFactory.java new file mode 100644 index 000000000..228401d6e --- /dev/null +++ b/sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestAdapterManagerNetworkElementFactory.java @@ -0,0 +1,73 @@ +/* + * ============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.adaptermanager.test; + +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import java.io.IOException; +import org.junit.After; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.adaptermanager.impl.AdapterManagerNetworkElementFactory; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.adaptermanager.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.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.network.topology.simulator.rev191025.SimulatorStatus; +import org.opendaylight.yangtools.yang.common.QName; + +public class TestAdapterManagerNetworkElementFactory { + + static NetconfAccessor accessor; + static DeviceManagerServiceProvider serviceProvider; + static Capabilities capabilities; + QName qCapability; + + @BeforeClass + public static void init() throws InterruptedException, IOException { + capabilities = mock(Capabilities.class); + accessor = mock(NetconfAccessorMock.class); + serviceProvider = mock(DeviceManagerServiceProvider.class); + + when(accessor.getCapabilites()).thenReturn(capabilities); + when(serviceProvider.getDataProvider()).thenReturn(null); + + + } + + @Test + public void testCreateSimulator() throws Exception { + when(accessor.getCapabilites().isSupportingNamespace(SimulatorStatus.QNAME)).thenReturn(true); + AdapterManagerNetworkElementFactory factory = new AdapterManagerNetworkElementFactory(); + assertTrue(factory.create(accessor, serviceProvider).isPresent()); + } + + @Test + public void testCreateNone() throws Exception { + when(accessor.getCapabilites().isSupportingNamespace(SimulatorStatus.QNAME)).thenReturn(false); + AdapterManagerNetworkElementFactory factory = new AdapterManagerNetworkElementFactory(); + assertTrue(!(factory.create(accessor, serviceProvider).isPresent())); + } + + @After + public void cleanUp() throws Exception { + + } +} + diff --git a/sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestDeviceManagerAdapterManagerImpl.java b/sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestDeviceManagerAdapterManagerImpl.java new file mode 100644 index 000000000..5f79d943a --- /dev/null +++ b/sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestDeviceManagerAdapterManagerImpl.java @@ -0,0 +1,95 @@ +/* + * ============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.adaptermanager.test; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.adaptermanager.impl.DeviceManagerAdapterManagerImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TestDeviceManagerAdapterManagerImpl { + private static Path KARAF_ETC = Paths.get("etc"); + private static final Logger LOG = LoggerFactory.getLogger(TestDeviceManagerAdapterManagerImpl.class); + DeviceManagerAdapterManagerImpl devMgrAdapterManager; + + @Before + public void init() throws InterruptedException, IOException { + /*System.out.println("Logger: " + LOG.getClass().getName() + " " + LOG.getName()); + Path etc = KARAF_ETC; + delete(etc); + + System.out.println("Create empty:" + etc.toString()); + Files.createDirectories(etc);*/ + } + + @Test + public void test() throws Exception { + devMgrAdapterManager = new DeviceManagerAdapterManagerImpl(); + /*DeviceManagerImpl devMgr = new DeviceManagerImpl(); + + try { + devMgr.init(); + devMgrOran.setNetconfNetworkElementService(devMgr); + devMgrOran.init(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + }*/ + /* + * devMgrOran.setNetconfNetworkElementService(null); devMgrOran.init(); + * NetconfNetworkElementService netConfNetworkElementService = + * mock(NetconfNetworkElementService.class); devMgrOran = + * mock(DeviceManagerORanImpl.class); + * when(netConfNetworkElementService.registerNetworkElementFactory(new + * ORanNetworkElementFactory())).thenReturn(null); + */ + + + } + + @After + public void cleanUp() throws Exception { + devMgrAdapterManager.close(); + } + + private static void delete(Path etc) throws IOException { + if (Files.exists(etc)) { + System.out.println("Found, removing:" + etc.toString()); + delete(etc.toFile()); + } + } + + private static void delete(File f) throws IOException { + if (f.isDirectory()) { + for (File c : f.listFiles()) { + delete(c); + } + } + if (!f.delete()) { + throw new FileNotFoundException("Failed to delete file: " + f); + } + } +} diff --git a/sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/mock/NetconfAccessorMock.java b/sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/mock/NetconfAccessorMock.java new file mode 100644 index 000000000..fa0a9cb2f --- /dev/null +++ b/sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/mock/NetconfAccessorMock.java @@ -0,0 +1,92 @@ +/* + * ============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.adaptermanager.test.mock; + +import com.google.common.util.concurrent.ListenableFuture; +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.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 ListenerRegistration doRegisterNotificationListener( + @NonNull T listener) { + return null; + } + + @Override + public ListenableFuture> registerNotificationsStream(String streamName) { + return null; + } + +} diff --git a/sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/mock/TransactionUtilsMock.java b/sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/mock/TransactionUtilsMock.java new file mode 100644 index 000000000..e3aa0ae43 --- /dev/null +++ b/sdnr/wt/devicemanager-adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/mock/TransactionUtilsMock.java @@ -0,0 +1,47 @@ +/* + * ============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.adaptermanager.test.mock; + +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; + +public class TransactionUtilsMock implements TransactionUtils { + + @Override + public @Nullable T readData(DataBroker dataBroker, LogicalDatastoreType dataStoreType, + InstanceIdentifier iid) { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable T readDataOptionalWithStatus(DataBroker dataBroker, + LogicalDatastoreType dataStoreType, InstanceIdentifier iid, AtomicBoolean noErrorIndication, + AtomicReference statusIndicator) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/sdnr/wt/devicemanager-adapter-manager/provider/src/test/resources/simplelogger.properties b/sdnr/wt/devicemanager-adapter-manager/provider/src/test/resources/simplelogger.properties new file mode 100644 index 000000000..9af26dc96 --- /dev/null +++ b/sdnr/wt/devicemanager-adapter-manager/provider/src/test/resources/simplelogger.properties @@ -0,0 +1,61 @@ +# +# ============LICENSE_START======================================================= +# ONAP : ccsdk features +# ================================================================================ +# Copyright (C) 2020 AT&T 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======================================================= +# +# + +# SLF4J's SimpleLogger configuration file +# Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err. + +# Default logging detail level for all instances of SimpleLogger. +# Must be one of ("trace", "debug", "info", "warn", or "error"). +# If not specified, defaults to "info". +org.slf4j.simpleLogger.defaultLogLevel=info + +# Logging detail level for a SimpleLogger instance named "xxx.yyy.zzz". +# Must be one of ("trace", "debug", "info", "warn", or "error"). +# If not specified, the default logging detail level is used. +# org.slf4j.simpleLogger.log.xxx.yyy=debug +org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager=info +org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.test=debug +org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.database=debug +org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.archiveservice=info +org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.Resources=info +org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container=info + +# Set to true if you want the current date and time to be included in output messages. +# Default is false, and will output the number of milliseconds elapsed since startup. +#org.slf4j.simpleLogger.showDateTime=false + +# The date and time format to be used in the output messages. +# The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat. +# If the format is not specified or is invalid, the default format is used. +# The default format is yyyy-MM-dd HH:mm:ss:SSS Z. +#org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z + +# Set to true if you want to output the current thread name. +# Defaults to true. +#org.slf4j.simpleLogger.showThreadName=true + +# Set to true if you want the Logger instance name to be included in output messages. +# Defaults to true. +#org.slf4j.simpleLogger.showLogName=true + +# Set to true if you want the last component of the name to be included in output messages. +# Defaults to false. +#org.slf4j.simpleLogger.showShortLogName=false diff --git a/sdnr/wt/pom.xml b/sdnr/wt/pom.xml index 4c6ead7a3..fa1ea1fcb 100644 --- a/sdnr/wt/pom.xml +++ b/sdnr/wt/pom.xml @@ -52,6 +52,7 @@ devicemanager devicemanager-onf devicemanager-openroadm + devicemanager-adapter-manager mountpoint-registrar odlux featureaggregator -- 2.16.6