From d1981f7e68272cdc5618139a363b80806c2aa77c Mon Sep 17 00:00:00 2001 From: herbert Date: Tue, 28 Jan 2020 16:45:58 +0100 Subject: SDN-R update common update common and remove all dependent bundles Issue-ID: SDNC-1025 Signed-off-by: herbert Change-Id: I0cebe27eff0489f9b221ee7451be9250e362a827 --- .../oran/impl/DeviceManagerORanImpl.java | 89 -------------- .../devicemanager/oran/impl/NtsNetworkElement.java | 78 ------------ .../oran/impl/ORanChangeNotificationListener.java | 99 --------------- .../oran/impl/ORanFaultNotificationListener.java | 39 ------ .../oran/impl/ORanNetworkElement.java | 135 --------------------- .../oran/impl/ORanNetworkElementFactory.java | 47 ------- .../oran/impl/ORanToInternalDataModel.java | 70 ----------- 7 files changed, 557 deletions(-) delete mode 100644 sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/DeviceManagerORanImpl.java delete mode 100644 sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/NtsNetworkElement.java delete mode 100644 sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanChangeNotificationListener.java delete mode 100644 sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanFaultNotificationListener.java delete mode 100644 sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanNetworkElement.java delete mode 100644 sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanNetworkElementFactory.java delete mode 100644 sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanToInternalDataModel.java (limited to 'sdnr/wt/devicemanager-oran/provider/src/main/java') diff --git a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/DeviceManagerORanImpl.java b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/DeviceManagerORanImpl.java deleted file mode 100644 index 991128d10..000000000 --- a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/DeviceManagerORanImpl.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * ============LICENSE_END========================================================================== - ******************************************************************************/ -package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl; - -import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.FactoryRegistration; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.NetconfNetworkElementService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class DeviceManagerORanImpl implements AutoCloseable { - - private static final Logger LOG = LoggerFactory.getLogger(DeviceManagerORanImpl.class); - private static final String APPLICATION_NAME = "DeviceManagerORan"; - @SuppressWarnings("unused") - private static final String CONFIGURATIONFILE = "etc/devicemanager-oran.properties"; - - - private NetconfNetworkElementService netconfNetworkElementService; - - private HtDatabaseClient htDatabaseClient; - private Boolean devicemanagerInitializationOk = false; - private FactoryRegistration resORan; - - // Blueprint begin - public DeviceManagerORanImpl() { - LOG.info("Creating provider for {}", APPLICATION_NAME); - resORan = null; - } - - public void setNetconfNetworkElementService(NetconfNetworkElementService netconfNetworkElementService) { - this.netconfNetworkElementService = netconfNetworkElementService; - } - - public void init() throws Exception { - - LOG.info("Session Initiated start {}", APPLICATION_NAME); - - resORan = netconfNetworkElementService.registerNetworkElementFactory(new ORanNetworkElementFactory()); - - - 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(resORan); - 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-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/NtsNetworkElement.java b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/NtsNetworkElement.java deleted file mode 100644 index c37c45506..000000000 --- a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/NtsNetworkElement.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * ============LICENSE_END========================================================================== - ******************************************************************************/ -/** - * - */ -package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl; - -import java.util.Optional; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.NetworkElement; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.NetworkElementService; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.INetconfAcessor; -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 INetconfAcessor netconfAccessor; - - @SuppressWarnings("unused") - private final DataProvider databaseService; - - NtsNetworkElement(INetconfAcessor 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; - } -} diff --git a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanChangeNotificationListener.java b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanChangeNotificationListener.java deleted file mode 100644 index 118c2d62e..000000000 --- a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanChangeNotificationListener.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * ============LICENSE_END========================================================================== - ******************************************************************************/ -package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl; - -import java.util.List; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.INetconfAcessor; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.IetfNetconfNotificationsListener; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfCapabilityChange; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfConfigChange; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfConfirmedCommit; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfSessionEnd; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfSessionStart; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.netconf.config.change.Edit; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.EventlogBuilder; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Listener for change notifications - */ -public class ORanChangeNotificationListener implements IetfNetconfNotificationsListener { - - private static final Logger log = LoggerFactory.getLogger(ORanChangeNotificationListener.class); - - private final INetconfAcessor netconfAccessor; - private final DataProvider databaseService; - - ORanChangeNotificationListener(INetconfAcessor netconfAccessor, DataProvider databaseService) { - this.netconfAccessor = netconfAccessor; - this.databaseService = databaseService; - } - - @Override - public void onNetconfConfirmedCommit(NetconfConfirmedCommit notification) { - log.info("onNetconfConfirmedCommit ", notification); - } - - @Override - public void onNetconfSessionStart(NetconfSessionStart notification) { - log.info("onNetconfSessionStart ", notification); - } - - @Override - public void onNetconfSessionEnd(NetconfSessionEnd notification) { - log.info("onNetconfSessionEnd ", notification); - } - - @Override - public void onNetconfCapabilityChange(NetconfCapabilityChange notification) { - log.info("onNetconfCapabilityChange ", notification); - } - - @Override - public void onNetconfConfigChange(NetconfConfigChange notification) { - log.info("onNetconfConfigChange (1) {}", notification); - StringBuffer sb = new StringBuffer(); - List editList = notification.nonnullEdit(); - for (Edit edit : editList) { - if (sb.length() > 0) { - sb.append(", "); - } - sb.append(edit); - - EventlogBuilder eventlogBuilder = new EventlogBuilder(); - - InstanceIdentifier target = edit.getTarget(); - if (target != null) { - eventlogBuilder.setObjectId(target.toString()); - log.info("TARGET: {} {} {}", target.getClass(), target.getTargetType()); - for (PathArgument pa : target.getPathArguments()) { - log.info("PathArgument {}", pa); - } - } - eventlogBuilder.setNodeId(netconfAccessor.getNodeId().getValue()); - eventlogBuilder.setNewValue(String.valueOf(edit.getOperation())); - databaseService.writeEventLog(eventlogBuilder.build()); - } - log.info("onNetconfConfigChange (2) {}", sb); - } - -} diff --git a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanFaultNotificationListener.java b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanFaultNotificationListener.java deleted file mode 100644 index a0fe6692c..000000000 --- a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanFaultNotificationListener.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * ============LICENSE_END========================================================================== - ******************************************************************************/ -package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl; - -import org.opendaylight.yang.gen.v1.urn.o.ran.fm._1._0.rev190204.AlarmNotif; -import org.opendaylight.yang.gen.v1.urn.o.ran.fm._1._0.rev190204.ORanFmListener; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author herbert - * - */ -public class ORanFaultNotificationListener implements ORanFmListener { - - private static final Logger log = LoggerFactory.getLogger(ORanFaultNotificationListener.class); - - @Override - public void onAlarmNotif(AlarmNotif notification) { - - log.info("onAlarmNotif {}", notification); - } - -} diff --git a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanNetworkElement.java b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanNetworkElement.java deleted file mode 100644 index f4cb8024d..000000000 --- a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanNetworkElement.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * ============LICENSE_END========================================================================== - ******************************************************************************/ -package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl; - -import java.util.List; -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.NetworkElement; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.NetworkElementService; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.INetconfAcessor; -import org.opendaylight.mdsal.common.api.LogicalDatastoreType; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.Hardware; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.hardware.Component; -import org.opendaylight.yang.gen.v1.urn.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.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - */ -public class ORanNetworkElement implements NetworkElement { - - private static final Logger log = LoggerFactory.getLogger(ORanNetworkElement.class); - - private final INetconfAcessor netconfAccessor; - - private final DataProvider databaseService; - - private final ORanToInternalDataModel oRanMapper; - - private ListenerRegistration oRanListenerRegistrationResult; - private @NonNull final ORanChangeNotificationListener oRanListener; - private ListenerRegistration oRanFaultListenerRegistrationResult; - private @NonNull final ORanFaultNotificationListener oRanFaultListener; - - ORanNetworkElement(INetconfAcessor netconfAccess, DataProvider databaseService) { - log.info("Create {}",ORanNetworkElement.class.getSimpleName()); - this.netconfAccessor = netconfAccess; - this.databaseService = databaseService; - - this.oRanListenerRegistrationResult = null; - this.oRanListener = new ORanChangeNotificationListener(netconfAccessor, databaseService); - - this.oRanFaultListenerRegistrationResult = null; - this.oRanFaultListener = new ORanFaultNotificationListener(); - - this.oRanMapper = new ORanToInternalDataModel(); - - } - - public void initialReadFromNetworkElement() { - Hardware hardware = readHardware(netconfAccessor); - if (hardware != null) { - List componentList = hardware.getComponent(); - if (componentList != null) { - for (Component component : componentList) { - databaseService.writeInventory( oRanMapper.getInternalEquipment(netconfAccessor.getNodeId(), component)); - } - } - } - } - - @Override - public NetworkElementDeviceType getDeviceType() { - return NetworkElementDeviceType.ORAN; - } - - private Hardware readHardware(INetconfAcessor accessData) { - - final Class clazzPac = Hardware.class; - - log.info("DBRead Get equipment for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), - accessData.getNodeId().getValue()); - - InstanceIdentifier hardwareIID = - InstanceIdentifier.builder(clazzPac).build(); - - Hardware res = accessData.getTransactionUtils().readData(accessData.getDataBroker(), LogicalDatastoreType.OPERATIONAL, - hardwareIID); - - return res; - } - - @Override - public void register() { - this.oRanListenerRegistrationResult = netconfAccessor.doRegisterNotificationListener(oRanListener); - this.oRanFaultListenerRegistrationResult = netconfAccessor.doRegisterNotificationListener(oRanFaultListener); - - } - - @Override - public void deregister() { - if (oRanListenerRegistrationResult != null) { - this.oRanListenerRegistrationResult.close(); - } - if (oRanFaultListenerRegistrationResult != null) { - this.oRanFaultListenerRegistrationResult.close(); - }; - } - - - @Override - public NodeId getNodeId() { - return netconfAccessor.getNodeId(); - } - - @Override - public Optional getService(Class clazz) { - return Optional.empty(); - } - - @Override - public void warmstart() { - } - -} diff --git a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanNetworkElementFactory.java b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanNetworkElementFactory.java deleted file mode 100644 index b1914cc16..000000000 --- a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanNetworkElementFactory.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * ============LICENSE_END========================================================================== - ******************************************************************************/ - -package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl; - -import java.util.Optional; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.DeviceManagerServiceProvider; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.NetworkElement; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.NetworkElementFactory; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.INetconfAcessor; -import org.opendaylight.yang.gen.v1.urn.o.ran.hardware._1._0.rev190328.ORANHWCOMPONENT; -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 ORanNetworkElementFactory implements NetworkElementFactory { - - private static final Logger log = LoggerFactory.getLogger(ORanNetworkElementFactory.class); - - @Override - public Optional create(INetconfAcessor acessor, DeviceManagerServiceProvider serviceProvider) { - if (acessor.getCapabilites().isSupportingNamespace(ORANHWCOMPONENT.QNAME)) { - log.info("Create device {} ",ORanNetworkElement.class.getName()); - return Optional.of(new ORanNetworkElement(acessor, serviceProvider.getDataProvider())); - } else if (acessor.getCapabilites().isSupportingNamespace(SimulatorStatus.QNAME)) { - log.info("Create device {} ",NtsNetworkElement.class.getName()); - return Optional.of(new NtsNetworkElement(acessor, serviceProvider.getDataProvider())); - } else { - return Optional.empty(); - } - } -} diff --git a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanToInternalDataModel.java b/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanToInternalDataModel.java deleted file mode 100644 index a2997c0e5..000000000 --- a/sdnr/wt/devicemanager-oran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/ORanToInternalDataModel.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * ============LICENSE_END========================================================================== - */ -package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl; - -import java.util.ArrayList; -import java.util.List; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.hardware.Component; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.Inventory; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.InventoryBuilder; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; - -/** - * @author herbert - * - */ -public class ORanToInternalDataModel { - - - public Inventory getInternalEquipment(NodeId nodeId, Component component) { - - InventoryBuilder inventoryBuilder = new InventoryBuilder(); - - // General - inventoryBuilder.setNodeId(nodeId.getValue()); - inventoryBuilder.setParentUuid(component.getParent()); - inventoryBuilder.setTreeLevel(new Long(component.getParentRelPos())); - - inventoryBuilder.setUuid(component.getUuid().getValue()); - // -- String list with ids of holders - List containerHolderKeyList = new ArrayList<>(); - List containerHolderList = component.getContainsChild(); - if (containerHolderList != null) { - for (String containerHolder : containerHolderList) { - containerHolderKeyList.add(containerHolder); - } - } - inventoryBuilder.setContainedHolder(containerHolderKeyList); - // -- Manufacturer related things - inventoryBuilder.setManufacturerName(component.getName()); - - // Equipment type - inventoryBuilder.setDescription(component.getDescription()); - inventoryBuilder.setModelIdentifier(component.getModelName()); - inventoryBuilder.setPartTypeId(component.getXmlClass().getName()); - inventoryBuilder.setTypeName(component.getName()); - inventoryBuilder.setVersion(component.getHardwareRev()); - - // Equipment instance - inventoryBuilder.setDate(component.getMfgDate().getValue()); - inventoryBuilder.setSerial(component.getSerialNum()); - - return inventoryBuilder.build(); - } - -} -- cgit 1.2.3-korg