diff options
author | 2020-01-28 16:45:58 +0100 | |
---|---|---|
committer | 2020-01-30 14:15:24 -0500 | |
commit | d1981f7e68272cdc5618139a363b80806c2aa77c (patch) | |
tree | 4aed1c81db6fab00d8266ff651e222b1b9fd4fed /sdnr/wt/devicemanager-onf/provider/src/main/java | |
parent | 032ce4ec7c3d7ac138555dfe980ca53ebbf39f01 (diff) |
SDN-R update common
update common and remove all dependent bundles
Issue-ID: SDNC-1025
Signed-off-by: herbert <herbert.eiselt@highstreet-technologies.com>
Change-Id: I0cebe27eff0489f9b221ee7451be9250e362a827
Diffstat (limited to 'sdnr/wt/devicemanager-onf/provider/src/main/java')
3 files changed, 0 insertions, 294 deletions
diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/DeviceManagerOnfImpl.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/DeviceManagerOnfImpl.java deleted file mode 100644 index 8783a6ad4..000000000 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/DeviceManagerOnfImpl.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.onf.impl; - -import org.eclipse.jdt.annotation.NonNull; -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 DeviceManagerOnfImpl implements AutoCloseable { - - private static final Logger LOG = LoggerFactory.getLogger(DeviceManagerOnfImpl.class); - private static final String APPLICATION_NAME = "DeviceManagerOnf"; - private static final String CONFIGURATIONFILE = "etc/devicemanager-onf.properties"; - - - private NetconfNetworkElementService netconfNetworkElementService; - - private HtDatabaseClient htDatabaseClient; - private Boolean devicemanagerInitializationOk = false; - private @NonNull FactoryRegistration<OnfNetworkElementFactory> resORan; - - // Blueprint begin - public DeviceManagerOnfImpl() { - 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 OnfNetworkElementFactory()); - - - 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-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/OnfNetworkElement.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/OnfNetworkElement.java deleted file mode 100644 index 03e1706b9..000000000 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/OnfNetworkElement.java +++ /dev/null @@ -1,163 +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.onf.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.binding.api.MountPoint; -import org.opendaylight.mdsal.binding.api.NotificationService; -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.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.InstanceIdentifier.PathArgument; -import org.opendaylight.yangtools.yang.binding.NotificationListener; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - */ -public class OnfNetworkElement implements NetworkElement { - - private static final Logger log = LoggerFactory.getLogger(OnfNetworkElement.class); - - private final INetconfAcessor netconfAccessor; - - private final DataProvider databaseService; - - private @NonNull final OnfListener ranListener; - - private ListenerRegistration<NotificationListener> ranListenerRegistrationResult; - - OnfNetworkElement(INetconfAcessor netconfAccess, DataProvider databaseService) { - log.info("Create {}",OnfNetworkElement.class.getSimpleName()); - this.netconfAccessor = netconfAccess; - this.databaseService = databaseService; - - this.ranListenerRegistrationResult = null; - this.ranListener = new OnfListener(); - - } - - public void initialReadFromNetworkElement() { - } - - @Override - public NetworkElementDeviceType getDeviceType() { - return NetworkElementDeviceType.ORAN; - } - - private void doRegisterNotificationListener(MountPoint mountPoint) { - log.info("Begin register listener for Mountpoint {}", mountPoint.getIdentifier().toString()); - final Optional<NotificationService> optionalNotificationService = mountPoint - .getService(NotificationService.class); - final NotificationService notificationService = optionalNotificationService.get(); - // notificationService.registerNotificationListener(microwaveEventListener); - ranListenerRegistrationResult = notificationService.registerNotificationListener(ranListener); - log.info("End registration listener for Mountpoint {} Listener: {} Result: {}", - mountPoint.getIdentifier().toString(), optionalNotificationService, ranListenerRegistrationResult); - } - - private class OnfListener implements IetfNetconfNotificationsListener { - - @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<Edit> 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); - } - } - - @Override - public void register() { - } - - @Override - public void deregister() { - } - - - @Override - public NodeId getNodeId() { - return netconfAccessor.getNodeId(); - } - - @Override - public <L extends NetworkElementService> Optional<L> getService(Class<L> clazz) { - return Optional.empty(); - } - - @Override - public void warmstart() { - } - -} diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/OnfNetworkElementFactory.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/OnfNetworkElementFactory.java deleted file mode 100644 index cd590c858..000000000 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/OnfNetworkElementFactory.java +++ /dev/null @@ -1,42 +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.onf.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.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class OnfNetworkElementFactory implements NetworkElementFactory { - - private static final Logger log = LoggerFactory.getLogger(OnfNetworkElementFactory.class); - - @Override - public Optional<NetworkElement> create(INetconfAcessor acessor, DeviceManagerServiceProvider serviceProvider) { - if (acessor.getCapabilites().isSupportingNamespace(org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement.QNAME)) { - log.info("Create device {} ",OnfNetworkElement.class.getName()); - return Optional.of(new OnfNetworkElement(acessor, serviceProvider.getDataProvider())); - } else { - return Optional.empty(); - } - } -} |