diff options
Diffstat (limited to 'sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main')
20 files changed, 322 insertions, 1572 deletions
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanChangeNotificationListener.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanChangeNotificationListener.java deleted file mode 100644 index abed01a44..000000000 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanChangeNotificationListener.java +++ /dev/null @@ -1,138 +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.binding; - -import com.fasterxml.jackson.core.JsonProcessingException; -import java.util.List; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationProxyParser; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESCommonEventHeaderPOJO; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESNotificationFieldsPOJO; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; -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.rev201110.EventlogBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogEntity; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType; -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 NetconfBindingAccessor netconfAccessor; - private final DataProvider databaseService; - private final NotificationService notificationService; - private final VESCollectorService vesCollectorService; - private final NotificationProxyParser notificationProxyParser; - private ORanNotifToVESEventAssembly mapper = null; - - private static int sequenceNo = 0; - - public ORanChangeNotificationListener(NetconfBindingAccessor netconfAccessor, - DeviceManagerServiceProvider serviceProvider) { - this.netconfAccessor = netconfAccessor; - this.databaseService = serviceProvider.getDataProvider(); - this.notificationService = serviceProvider.getNotificationService(); - this.vesCollectorService = serviceProvider.getVESCollectorService(); - this.notificationProxyParser = vesCollectorService.getNotificationProxyParser(); - } - - @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.toString()); - - StringBuffer sb = new StringBuffer(); - List<Edit> editList = notification.nonnullEdit(); - for (Edit edit : editList) { - if (sb.length() > 0) { - sb.append(", "); - } - sb.append(edit); - - InstanceIdentifier<?> target = edit.getTarget(); - if (target != null) { - log.info("TARGET: {} {}", target.getClass(), target.getTargetType()); - for (PathArgument pa : target.getPathArguments()) { - log.info("PathArgument {} Type {}", pa, pa.getType().getFields()); - } - - EventlogEntity eventLogEntity1 = new EventlogBuilder().setNodeId(netconfAccessor.getNodeId().getValue()) - .setCounter(sequenceNo++).setTimestamp(NetconfTimeStampImpl.getConverter().getTimeStamp()) - .setObjectId(target.getTargetType().getCanonicalName()).setAttributeName("N.A") - .setSourceType(SourceType.Netconf).setNewValue(String.valueOf(edit.getOperation())).build(); - databaseService.writeEventLog(eventLogEntity1); - } - } - log.info("onNetconfConfigChange (2) {}", sb); - - if (vesCollectorService.getConfig().isVESCollectorEnabled()) { - if (mapper == null) { - this.mapper = new ORanNotifToVESEventAssembly(netconfAccessor, vesCollectorService); - } - VESCommonEventHeaderPOJO header = - mapper.createVESCommonEventHeader(notificationProxyParser.getTime(notification), - NetconfConfigChange.class.getSimpleName(), sequenceNo); - VESNotificationFieldsPOJO body = - mapper.createVESNotificationFields(notificationProxyParser.parseNotificationProxy(notification), - NetconfConfigChange.class.getSimpleName()); - try { - vesCollectorService.publishVESMessage(vesCollectorService.generateVESEvent(header, body)); - } catch (JsonProcessingException e) { - log.warn("Exception while generating JSON object ", e); - - } - } - - } -} diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanFaultNotificationListener.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanFaultNotificationListener.java deleted file mode 100644 index d03b39480..000000000 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanFaultNotificationListener.java +++ /dev/null @@ -1,166 +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.binding; - -import com.fasterxml.jackson.core.JsonProcessingException; -import java.time.Instant; -import java.time.format.DateTimeParseException; -import java.util.Collection; -import java.util.Date; -import java.util.Objects; -import org.eclipse.jdt.annotation.NonNull; -import org.json.JSONException; -import org.json.JSONObject; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.NetconfTimeStamp; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESCommonEventHeaderPOJO; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESFaultFieldsPOJO; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESMessage; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; -import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.hardware.Component; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; -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.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ORanFaultNotificationListener implements ORanFmListener { - - private static final Logger LOG = LoggerFactory.getLogger(ORanFaultNotificationListener.class); - - private final @NonNull NetconfBindingAccessor netconfAccessor; - private final @NonNull VESCollectorService vesCollectorService; - private final @NonNull ORanFaultToVESFaultMapper mapper; - private final @NonNull FaultService faultService; - private final @NonNull WebsocketManagerService websocketManagerService; - private final @NonNull DataProvider databaseService; - private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStampImpl.getConverter(); - - private Integer counter; //Local counter is assigned to Notifications - - public ORanFaultNotificationListener(@NonNull NetconfBindingAccessor netconfAccessor, - @NonNull VESCollectorService vesCollectorService, @NonNull FaultService faultService, - @NonNull WebsocketManagerService websocketManagerService, @NonNull DataProvider databaseService) { - this.netconfAccessor = Objects.requireNonNull(netconfAccessor); - this.vesCollectorService = Objects.requireNonNull(vesCollectorService); - this.faultService = Objects.requireNonNull(faultService); - this.websocketManagerService = Objects.requireNonNull(websocketManagerService); - this.databaseService = Objects.requireNonNull(databaseService); - - this.mapper = new ORanFaultToVESFaultMapper(netconfAccessor.getNodeId(), vesCollectorService, - AlarmNotif.class.getSimpleName()); - this.counter = 0; - } - - /** - * Gets the mfg name, mode-name and Uuid of the root component (Ex: Chassis.) - * In cases where there are multiple root components i.e., components with no parent, - * the Uuid of the last occurred component from the componentList will be considered. - * Till now we haven't seen Uuid set for root components, so not an issue for now. - * @param componentList - */ - public void setComponentList(Collection<Component> componentList) { - for (Component component : ORanToInternalDataModel.getRootComponents(componentList)) { - mapper.setMfgName(component.getMfgName()); - mapper.setUuid(component.getUuid()!=null?component.getUuid().getValue():netconfAccessor.getNodeId().getValue()); - mapper.setModelName(component.getModelName()); - } - } - - @Override - public void onAlarmNotif(AlarmNotif notification) { - - LOG.debug("onAlarmNotif {}", notification.getClass().getSimpleName()); - counter++; - - // Send devicemanager specific notification for database and ODLUX - Instant eventTimeInstant = ORanToInternalDataModel.getInstantTime(notification.getEventTime()); - faultService.faultNotification( - ORanToInternalDataModel.getFaultLog(notification, netconfAccessor.getNodeId(), counter)); - // Send model specific notification to WebSocketManager - websocketManagerService.sendNotification(notification, netconfAccessor.getNodeId(), AlarmNotif.QNAME); - - try { - if (vesCollectorService.getConfig().isVESCollectorEnabled()) { - VESCommonEventHeaderPOJO header = mapper.mapCommonEventHeader(notification, eventTimeInstant, counter); - VESFaultFieldsPOJO body = mapper.mapFaultFields(notification); - VESMessage vesMsg = vesCollectorService.generateVESEvent(header, body); - vesCollectorService.publishVESMessage(vesMsg); - LOG.info("VES Message is {}",vesMsg.getMessage()); - writeToEventLog(vesMsg.getMessage(), eventTimeInstant, AlarmNotif.QNAME.toString(), counter); - } - } catch (JsonProcessingException | DateTimeParseException e) { - LOG.debug("Can not convert event into VES message {}", notification, e); - } - } - - private void writeToEventLog(String data, Instant instant, String notificationName, - int sequenceNo) { - EventlogBuilder eventlogBuilder = new EventlogBuilder(); - - eventlogBuilder.setObjectId("Device"); - eventlogBuilder.setCounter(sequenceNo); - eventlogBuilder.setAttributeName(notificationName); - eventlogBuilder.setNodeId(netconfAccessor.getNodeId().getValue()); - String eventLogMsgLvl = vesCollectorService.getConfig().getEventLogMsgDetail(); - if (eventLogMsgLvl.equalsIgnoreCase("SHORT")) { - data = getShortEventLogMessage(data); - } else if (eventLogMsgLvl.equalsIgnoreCase("MEDIUM")) { - data = getMediumEventLogMessage(data); - } else if (eventLogMsgLvl.equalsIgnoreCase("LONG")) { - // do nothing, data already contains long message - } else { // Unknown value, default to "SHORT" - data = getShortEventLogMessage(data); - } - eventlogBuilder.setNewValue(data); - eventlogBuilder.setSourceType(SourceType.Netconf); - - Date eventDate = Date.from(instant); - eventlogBuilder.setTimestamp(new DateAndTime(NETCONFTIME_CONVERTER.getTimeStamp(eventDate))); - - databaseService.writeEventLog(eventlogBuilder.build()); - } - - private String getShortEventLogMessage(String data) { - try { - JSONObject jsonObj = new JSONObject(data); - String domain = jsonObj.getJSONObject("event").getJSONObject("commonEventHeader").getString("domain"); - String eventId = jsonObj.getJSONObject("event").getJSONObject("commonEventHeader").getString("eventId"); - return "domain:" + domain + " eventId:" + eventId; - } catch (JSONException e) { - LOG.debug("{}", e); - return "Invalid message received"; - } - } - - private String getMediumEventLogMessage(String data) { - try { - JSONObject jsonObj = new JSONObject(data); - return jsonObj.getJSONObject("event").getJSONObject("commonEventHeader").toString(); - } catch (JSONException e) { - LOG.debug("{}", e); - return "Invalid message received"; - } - } -} diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanFaultToVESFaultMapper.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanFaultToVESFaultMapper.java deleted file mode 100644 index f5873df96..000000000 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanFaultToVESFaultMapper.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * ONAP : ccsdk features - * ================================================================================ - * Copyright (C) 2021 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.binding; - -import java.time.Instant; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESCommonEventHeaderPOJO; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESFaultFieldsPOJO; -import org.opendaylight.yang.gen.v1.urn.o.ran.fm._1._0.rev190204.AlarmNotif; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -//@formatter:off -/* - * Maps ORAN Fault fields to VES fault domain fields and VES commonEventHeader fields - * - * - * VES Fields Mapping - * ---------- ------- - * domain "fault" - * eventId "nt:network-topology/nt:topology/nt:node/nt:node-id" - * eventName "nt:network-topology/nt:topology/nt:node/nt:node-id" - * eventType "O-RAN-RU-Fault" - * lastEpochMicrosec TimeStamp represented by <eventTime> field in NetConf notification header in unix time format - as microseconds elapsed since 1 Jan 1970 not including leap seconds. - * nfcNamingCode always "" - * nfNamingCode always "" - * nfVendorName /ietf-hardware:hardware/component[not(parent)][1]/mfg-name - * priority "Normal" - * reportingEntityId The OAM-Controller identifier with in the SMO - e.g. the fully qualified domain name or IP-Address. - * reportingEntityName as configured by helm charts for the OpenDaylight cluster name ?????? - * sequence As per NetConf notification increasing sequence number as unsigned integer 32 bits. The value is reused in the eventId field. - * sourceId Value of ietf-hardware (RFC8348) /hardware/component[not(parent)][1]/uuid or 'nt:network-topology/nt:topology/nt:node/nt:node-id' if ietf component not found. - * sourceName "nt:network-topology/nt:topology/nt:node/nt:node-id" - * startEpochMicrosec Current OAM-Controller Node timestamp in unix time format - as microseconds elapsed since 1 Jan 1970 not including leap seconds. - * timeZoneOffset Static text: "+00:00" - * version "4.1" - * vesEventListenerVersion "7.2.1" - * - * - * alarmAdditionalInformation - * alarmCondition Value of "o-ran-fm:alarm-notif/fault-id" - * alarmInterfaceA Value of "o-ran-fm:alarm-notif/fault-source" - * eventCategory Static text "O-RU failure" - * eventSeverity Value of "o-ran-fm:alarm-notif/fault-severity". But if "o-ran-fm:alarm-notif/is-cleared" then "NORMAL" - * eventSourceType The value of ietf-hardware (RFC8348) /hardware/component[not(parent)][1]/model-name or "O-RU" if not found. - * faultFieldsVersion "4.0" - * specificProblem A mapping of the fault-id to its description according to O-RAN OpenFronthaul specification. - * vfStatus "Active" - * - */ -//@formatter:on - -public class ORanFaultToVESFaultMapper { - - @SuppressWarnings("unused") - private static final Logger LOG = LoggerFactory.getLogger(ORanFaultToVESFaultMapper.class); - private static final String VES_EVENT_DOMAIN = "fault"; - private static final String VES_EVENTTYPE = "ORAN_Fault"; - private static final String VES_EVENT_PRIORITY = "Normal"; - private static final String VES_EVENT_CATEGORY = "O-RU Failure"; - private static final String VES_FAULT_FIELDS_VERSION = "4.0"; - private static final String VES_FAULT_FIELDS_VFSTATUS = "Active"; //virtual function status - - private final VESCollectorService vesProvider; - private final String notifName; // Name - private final String nodeIdString; // Sourcename - private String mfgName; - private String uuid; - private String modelName; - - public ORanFaultToVESFaultMapper(NodeId nodeId, VESCollectorService vesCollectorService, - String notifName) { - this.nodeIdString = nodeId.getValue(); - this.vesProvider = vesCollectorService; - this.notifName = notifName; - } - - public void setMfgName(String mfgName) { - this.mfgName= mfgName; - } - - private String getMfgName() { - return mfgName; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - private String getUuid() { - return uuid; - } - - public void setModelName(String modelName) { - this.modelName = modelName; - } - - private String getModelName() { - return modelName; - } - - public VESCommonEventHeaderPOJO mapCommonEventHeader(AlarmNotif notification, Instant eventTime, int sequenceNo) { - VESCommonEventHeaderPOJO vesCEH = new VESCommonEventHeaderPOJO(); - vesCEH.setDomain(VES_EVENT_DOMAIN); - vesCEH.setEventName(notifName); - vesCEH.setEventType(VES_EVENTTYPE); - vesCEH.setPriority(VES_EVENT_PRIORITY); - - String eventId; - - eventId = notifName + "-" + Long.toUnsignedString(sequenceNo); - - vesCEH.setEventId(eventId); - vesCEH.setStartEpochMicrosec(eventTime.toEpochMilli() * 1000); - vesCEH.setLastEpochMicrosec(eventTime.toEpochMilli() * 1000); - vesCEH.setNfVendorName(getMfgName()); - vesCEH.setReportingEntityName(vesProvider.getConfig().getReportingEntityName()); - vesCEH.setSequence(sequenceNo); - vesCEH.setSourceId(getUuid()); - vesCEH.setSourceName(nodeIdString); - - return vesCEH; - } - - public VESFaultFieldsPOJO mapFaultFields(AlarmNotif alarmNotif) { - VESFaultFieldsPOJO vesFaultFields = new VESFaultFieldsPOJO(); - - vesFaultFields.setAlarmCondition(alarmNotif.getFaultId().toString()); - vesFaultFields.setAlarmInterfaceA(alarmNotif.getFaultSource()); - vesFaultFields.setEventCategory(VES_EVENT_CATEGORY); - if (alarmNotif.getIsCleared()) { - vesFaultFields.setEventSeverity("NORMAL"); - } else { - vesFaultFields.setEventSeverity(alarmNotif.getFaultSeverity().getName()); - } - vesFaultFields.setEventSourceType(getModelName()); - vesFaultFields.setFaultFieldsVersion(VES_FAULT_FIELDS_VERSION); - vesFaultFields.setSpecificProblem(alarmNotif.getFaultText()); - vesFaultFields.setVfStatus(VES_FAULT_FIELDS_VFSTATUS); - - return vesFaultFields; - } - -} diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanNetworkElement.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanNetworkElement.java deleted file mode 100644 index e16df1d1c..000000000 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanNetworkElement.java +++ /dev/null @@ -1,278 +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.binding; - -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.jdt.annotation.Nullable; -import org.onap.ccsdk.features.sdnr.wt.common.YangHelper; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElementService; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfDomAccessor; -import org.opendaylight.mdsal.common.api.LogicalDatastoreType; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.Stream; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.StreamKey; -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.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.onap.system.rev201026.System1; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Guicutthrough; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Inventory; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementDeviceType; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.NetconfCallhomeServer; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.AllowedDevices; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.Device; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.NotificationListener; -import org.opendaylight.yangtools.yang.common.QName; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ORanNetworkElement implements NetworkElement { - - private static final Logger LOG = LoggerFactory.getLogger(ORanNetworkElement.class); - - public static final QName ONAP_SYSTEM = - org.opendaylight.yang.gen.v1.urn.onap.system.rev201026.$YangModuleInfoImpl.getInstance().getName(); - private static final InstanceIdentifier<System1> SYSTEM1_IID = InstanceIdentifier - .builder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.system.rev140806.System.class) - .augmentation(System1.class).build(); - - private final NetconfBindingAccessor netconfAccessor; - private final Optional<NetconfBindingAccessor> netconfAccessorOpt; - - private final Optional<NetconfDomAccessor> netconfDomAccessor; - private final DataProvider databaseService; - private final ORanRegistrationToVESpnfRegistrationMapper mapper; - private final VESCollectorService vesCollectorService; - - private ListenerRegistration<NotificationListener> oRanListenerRegistrationResult; - //private @NonNull final ORanChangeNotificationListener oRanListener; - private ListenerRegistration<NotificationListener> oRanFaultListenerRegistrationResult; - private @NonNull final ORanFaultNotificationListener oRanFaultListener; - - //ORanNetworkElement(NetconfBindingAccessor netconfAccess, DeviceManagerServiceProvider serviceProvider) { - ORanNetworkElement(NetconfAccessor netconfAccess, DeviceManagerServiceProvider serviceProvider) { - LOG.info("Create {}", ORanNetworkElement.class.getSimpleName()); - // Read parameters - this.netconfAccessorOpt = netconfAccess.getNetconfBindingAccessor(); - this.netconfAccessor = netconfAccessorOpt.get(); - this.netconfDomAccessor = netconfAccess.getNetconfDomAccessor(); - // Get services - this.databaseService = serviceProvider.getDataProvider(); - this.vesCollectorService = serviceProvider.getVESCollectorService(); - - this.mapper = new ORanRegistrationToVESpnfRegistrationMapper(netconfAccessor, vesCollectorService); - - // Register callbacks - this.oRanListenerRegistrationResult = null; - //this.oRanListener = new ORanChangeNotificationListener(netconfAccessor, serviceProvider); - - this.oRanFaultListenerRegistrationResult = null; - this.oRanFaultListener = new ORanFaultNotificationListener(netconfAccessor, vesCollectorService, - serviceProvider.getFaultService(), serviceProvider.getWebsocketService(), databaseService); - - } - - private Collection<Component> initialReadFromNetworkElement() { - Collection<Component> componentList; - Hardware hardware = readHardware(); - if (hardware != null) { - componentList = YangHelper.getCollection(hardware.nonnullComponent()); - List<Inventory> inventoryList = - ORanToInternalDataModel.getInventoryList(netconfAccessor.getNodeId(), componentList); - databaseService.writeInventory(netconfAccessor.getNodeId().getValue(), inventoryList); - } else { - componentList = Collections.emptyList(); - } - - Optional<Guicutthrough> oGuicutthrough = ORanToInternalDataModel.getGuicutthrough(getOnapSystemData()); - if (oGuicutthrough.isPresent()) { - databaseService.writeGuiCutThroughData(oGuicutthrough.get(), netconfAccessor.getNodeId().getValue()); - } - return componentList; - } - - @Override - public NetworkElementDeviceType getDeviceType() { - return NetworkElementDeviceType.ORAN; - } - - @Override - public void register() { - // Read data from device - Collection<Component> componentList = initialReadFromNetworkElement(); - oRanFaultListener.setComponentList(componentList); - // Publish the mountpoint to VES if enabled - publishMountpointToVES(componentList); - // Register call back class for receiving notifications - //this.oRanListenerRegistrationResult = netconfAccessor.doRegisterNotificationListener(oRanListener); - this.oRanFaultListenerRegistrationResult = netconfAccessor.doRegisterNotificationListener(oRanFaultListener); - // Register notifications stream - /*if (netconfAccessor.isNotificationsRFC5277Supported()) { - netconfAccessor.registerNotificationsStream(); - }*/ - - QName[] notifications = { NetconfConfigChange.QNAME, NetconfConfirmedCommit.QNAME, - NetconfSessionStart.QNAME, NetconfSessionEnd.QNAME, NetconfCapabilityChange.QNAME }; - //netconfDomAccessor.get().doRegisterNotificationListener(new ORanDOMChangeNotificationListener(netconfDomAccessor.get(), databaseService), notifications); - // Output notification streams to LOG - Map<StreamKey, Stream> streams = netconfDomAccessor.get().getNotificationStreamsAsMap(); - LOG.info("Available notifications streams: {}", streams); - // Register to default stream - netconfDomAccessor.get().invokeCreateSubscription(); - } - - @Override - public void deregister() { - if (oRanListenerRegistrationResult != null) { - this.oRanListenerRegistrationResult.close(); - } - if (oRanFaultListenerRegistrationResult != null) { - this.oRanFaultListenerRegistrationResult.close(); - } ; - databaseService.clearGuiCutThroughEntriesOfNode(getMountpointId()); - } - - @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() {} - - @Override - public Optional<NetconfAccessor> getAcessor() { - return Optional.of(netconfAccessor); - } - - // Private functions - - private String getMountpointId() { - return getNodeId().getValue(); - } - - // Read from device - /** - * Read system data with GUI cut through information from device if ONAP_SYSTEM YANG is supported. - * - * @return System1 data with GUI cut through information or null if not available. - */ - private @Nullable System1 getOnapSystemData() { - LOG.info("Get System1 for class {} from mountpoint {}", netconfAccessor.getNodeId().getValue()); - Capabilities x = netconfAccessor.getCapabilites(); - LOG.info("Capabilites: {}", x); - if (x.isSupportingNamespace(ONAP_SYSTEM)) { - @Nullable - System1 res = netconfAccessor.getTransactionUtils().readData(netconfAccessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, SYSTEM1_IID); - LOG.debug("Result of System1 = {}", res); - return res; - } else { - LOG.debug("No GUI cut through support"); - return null; - } - } - - private Hardware readHardware() { - final Class<Hardware> clazzPac = Hardware.class; - LOG.info("DBRead Get hardware for class {} from mountpoint {}", clazzPac.getSimpleName(), - netconfAccessor.getNodeId().getValue()); - InstanceIdentifier<Hardware> hardwareIID = InstanceIdentifier.builder(clazzPac).build(); - Hardware res = netconfAccessor.getTransactionUtils().readData(netconfAccessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, hardwareIID); - LOG.debug("Result of Hardware = {}", res); - return res; - } - - // VES related - private void publishMountpointToVES(Collection<Component> componentList) { - - LOG.debug("In publishMountpointToVES()"); - - /* - * 1. Check if this device is in the list of allowed-devices. 2. If device - * exists in allowed-devices, then create VES pnfRegistration event and publish - * to VES - */ - if (inAllowedDevices(getMountpointId())) { - if (vesCollectorService.getConfig().isVESCollectorEnabled()) { - for (Component component : ORanToInternalDataModel.getRootComponents(componentList)) { - // Just get one component. At the moment we don't care which one. Also since - // there is only one management address, we assume there will be only one - // chassis. - // If the device supports subtended configuration then it is assumed that the - // Chassis containing the management interface will be the root component and - // there will be only one root. - /*VESCommonEventHeaderPOJO header = mapper.mapCommonEventHeader(component); - VESPNFRegistrationFieldsPOJO body = mapper.mapPNFRegistrationFields(component); - try { - vesCollectorService.publishVESMessage(vesCollectorService.generateVESEvent(header, body)); - } catch (JsonProcessingException e) { - LOG.warn("Error while serializing VES Event to String ", e); - }*/ - } - } - } - } - - private boolean inAllowedDevices(String mountpointName) { - final InstanceIdentifier<AllowedDevices> ALL_DEVICES = - InstanceIdentifier.create(NetconfCallhomeServer.class).child(AllowedDevices.class); - - AllowedDevices allowedDevices = netconfAccessor.getTransactionUtils().readData( - netconfAccessor.getControllerBindingDataBroker(), LogicalDatastoreType.CONFIGURATION, ALL_DEVICES); - - if (allowedDevices != null) { - Collection<Device> deviceList = YangHelper.getCollection(allowedDevices.nonnullDevice()); - for (Device device : deviceList) { - LOG.info("Device in allowed-devices is - {}", device.getUniqueId()); - if (device.getUniqueId().equals(netconfAccessor.getNodeId().getValue())) { - LOG.info("Mountpoint is part of allowed-devices list"); - return true; - } - } - } - - LOG.info("Mountpoint {} is not part of allowed-devices list", mountpointName); - return false; - } - -} diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanNotifToVESEventAssembly.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanNotifToVESEventAssembly.java deleted file mode 100644 index 6e31ffb6f..000000000 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanNotifToVESEventAssembly.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * ONAP : ccsdk features - * ================================================================================ - * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. - * All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - * - */ -package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.binding; - -import java.time.Instant; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map.Entry; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESCommonEventHeaderPOJO; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESNotificationFieldsPOJO; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ORanNotifToVESEventAssembly { - - private static final Logger log = LoggerFactory.getLogger(ORanNotifToVESEventAssembly.class); - private static final String VES_EVENT_DOMAIN = "notification"; - private static final String VES_EVENTTYPE = "ORAN_notification"; - private static final String VES_EVENT_PRIORITY = "Normal"; - private NetconfBindingAccessor netconfAccessor; - private VESCollectorService vesProvider; - - public ORanNotifToVESEventAssembly(NetconfBindingAccessor netconfAccessor, VESCollectorService vesProvider) { - this.netconfAccessor = netconfAccessor; - this.vesProvider = vesProvider; - } - - // VES CommonEventHeader fields - public VESCommonEventHeaderPOJO createVESCommonEventHeader(Instant time, String notificationTypeName, - long sequenceNo) { - VESCommonEventHeaderPOJO vesCEH = new VESCommonEventHeaderPOJO(); - vesCEH.setDomain(VES_EVENT_DOMAIN); - vesCEH.setEventName(notificationTypeName); - vesCEH.setEventType(VES_EVENTTYPE); - vesCEH.setPriority(VES_EVENT_PRIORITY); - - String eventId; - - eventId = notificationTypeName + "-" + Long.toUnsignedString(sequenceNo); - - vesCEH.setEventId(eventId); - vesCEH.setStartEpochMicrosec(time.toEpochMilli() * 1000); - vesCEH.setLastEpochMicrosec(time.toEpochMilli() * 1000); - vesCEH.setNfVendorName("ORAN"); - vesCEH.setReportingEntityName(vesProvider.getConfig().getReportingEntityName()); - vesCEH.setSequence(sequenceNo); - vesCEH.setSourceId("ORAN"); - vesCEH.setSourceName(netconfAccessor.getNodeId().getValue()); - return vesCEH; - } - - // Notification fields - public VESNotificationFieldsPOJO createVESNotificationFields(HashMap<String, String> xPathFields, - String notificationTypeName) { - VESNotificationFieldsPOJO vesNotifFields = new VESNotificationFieldsPOJO(); - - vesNotifFields.setChangeType(notificationTypeName); - vesNotifFields.setChangeIdentifier(netconfAccessor.getNodeId().getValue()); - - StringBuffer buf = new StringBuffer(); - Iterator<Entry<String, String>> it = xPathFields.entrySet().iterator(); - while (it.hasNext()) { - Entry<String, String> pair = it.next(); - buf.append("\n" + pair.getKey() + " = " + pair.getValue()); - } - log.info("Resultlist({}):{}", xPathFields.size(), buf.toString()); - - ArrayList<HashMap<String, Object>> arrayOfNamedHashMap = new ArrayList<HashMap<String, Object>>(); - HashMap<String, Object> namedHashMap = new HashMap<String, Object>(); - namedHashMap.put("hashMap", xPathFields); - namedHashMap.put("name", notificationTypeName); - arrayOfNamedHashMap.add(namedHashMap); - vesNotifFields.setArrayOfNamedHashMap(arrayOfNamedHashMap); - return vesNotifFields; - - } -} diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanToInternalDataModel.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanToInternalDataModel.java deleted file mode 100644 index 2469e46b7..000000000 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanToInternalDataModel.java +++ /dev/null @@ -1,276 +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.binding; - -import java.time.Instant; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import org.eclipse.jdt.annotation.Nullable; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana.hardware.rev180313.HardwareClass; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.hardware.Component; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; -import org.opendaylight.yang.gen.v1.urn.o.ran.fm._1._0.rev190204.Alarm.FaultSeverity; -import org.opendaylight.yang.gen.v1.urn.o.ran.fm._1._0.rev190204.AlarmNotif; -import org.opendaylight.yang.gen.v1.urn.onap.system.rev201026.System1; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogEntity; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Guicutthrough; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.GuicutthroughBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Inventory; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.InventoryBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; -import org.opendaylight.yangtools.yang.binding.CodeHelpers; -import org.opendaylight.yangtools.yang.common.Uint32; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Convert data to data-provider model and perform consistency checks.<br> - * <b>Component list characteristics:</b><br> - * <ul> - * <li>component list is a flat list tree structure specified - * <li>via "component.getParent()": - * <ul> - * <li>If null we have a root element - * <li>if not null it is a child element with generated child level<br> - * </ul> - * </ul> - * Example of List:<br> - * - * - */ -public class ORanToInternalDataModel { - - private static final Logger log = LoggerFactory.getLogger(ORanToInternalDataModel.class); - - public static List<Inventory> getInventoryList(NodeId nodeId, Collection<Component> componentList) { - - List<Inventory> inventoryResultList = new ArrayList<Inventory>(); - for (Component component : getRootComponents(componentList)) { - inventoryResultList = recurseGetInventory(nodeId, component, componentList, 0, inventoryResultList); - } - // Verify if result is complete - if (componentList.size() != inventoryResultList.size()) { - log.warn( - "Not all data were written to the Inventory. Potential entries with missing " - + "contained-child. Node Id = {}, Components Found = {}, Entries written to Database = {}", - nodeId.getValue(), componentList.size(), inventoryResultList.size()); - } - return inventoryResultList; - } - - private static List<Inventory> recurseGetInventory(NodeId nodeId, Component component, - Collection<Component> componentList, int treeLevel, List<Inventory> inventoryResultList) { - - //Add element to list, if conversion successfull - Optional<Inventory> oInventory = getInternalEquipment(nodeId, component, treeLevel); - if (oInventory.isPresent()) { - inventoryResultList.add(oInventory.get()); - } - //Walk trough list of child keys and add to list - for (String childUuid : CodeHelpers.nonnull(component.getContainsChild())) { - for (Component c : getComponentsByName(childUuid, componentList)) { - inventoryResultList = recurseGetInventory(nodeId, c, componentList, treeLevel + 1, inventoryResultList); - } - } - return inventoryResultList; - } - - public static List<Component> getRootComponents(Collection<Component> componentList) { - List<Component> resultList = new ArrayList<>(); - for (Component c : componentList) { - if (c.getParent() == null) { // Root elements do not have a parent - resultList.add(c); - } - } - return resultList; - } - - private static List<Component> getComponentsByName(String name, Collection<Component> componentList) { - List<Component> resultList = new ArrayList<>(); - for (Component c : componentList) { - if (name.equals(c.getName())) { // <-- Component list is flat search for child's of name - resultList.add(c); - } - } - return resultList; - } - - /** - * Convert equipment into Inventory. Decide if inventory can by created from content or not. Public for test case. - * - * @param nodeId of node (Similar to mountpointId) - * @param component to handle - * @param treeLevel of components - * @return Inventory if possible to be created. - */ - public static Optional<Inventory> getInternalEquipment(NodeId nodeId, Component component, int treeLevel) { - - // Make sure that expected data are not null - Objects.requireNonNull(nodeId); - Objects.requireNonNull(component); - - // Read manadatory data - - @Nullable - String nodeIdString = nodeId.getValue(); - @Nullable - String uuid = component.getName(); - @Nullable - String idParent = component.getParent(); - @Nullable - String uuidParent = idParent != null ? idParent : uuid; //<- Passt nicht - - // do consistency check if all mandatory parameters are there - if (treeLevel >= 0 && nodeIdString != null && uuid != null && uuidParent != null) { - - // Build output data - - InventoryBuilder inventoryBuilder = new InventoryBuilder(); - - // General assumed as mandatory - inventoryBuilder.setNodeId(nodeIdString); - inventoryBuilder.setUuid(uuid); - inventoryBuilder.setParentUuid(uuidParent); - inventoryBuilder.setTreeLevel(Uint32.valueOf(treeLevel)); - - // -- String list with ids of holders (optional) - inventoryBuilder.setContainedHolder(CodeHelpers.nonnull(component.getContainsChild())); - - // -- Manufacturer related things (optional) - @Nullable - String mfgName = component.getMfgName(); - inventoryBuilder.setManufacturerName(mfgName); - inventoryBuilder.setManufacturerIdentifier(mfgName); - - // Equipment type (optional) - inventoryBuilder.setDescription(component.getDescription()); - inventoryBuilder.setModelIdentifier(component.getModelName()); - @Nullable - Class<? extends HardwareClass> xmlClass = component.getXmlClass(); - if (xmlClass != null) { - inventoryBuilder.setPartTypeId(xmlClass.getName()); - } - inventoryBuilder.setTypeName(component.getName()); - inventoryBuilder.setVersion(component.getHardwareRev()); - - // Equipment instance (optional) - @Nullable - DateAndTime mfgDate = component.getMfgDate(); - if (mfgDate != null) { - inventoryBuilder.setDate(mfgDate.getValue()); - } - inventoryBuilder.setSerial(component.getSerialNum()); - - return Optional.of(inventoryBuilder.build()); - } - return Optional.empty(); - } - - /** - * If system data is available convert - * - * @param sys - * @return - */ - public static Optional<Guicutthrough> getGuicutthrough(@Nullable System1 sys) { - if (sys != null) { - String name = sys.getName(); - @Nullable - Uri uri = sys.getWebUi(); - if (uri != null) { - GuicutthroughBuilder gcBuilder = new GuicutthroughBuilder(); - if (name != null) { - gcBuilder.setName(name); - } - gcBuilder.setWeburi(uri.getValue()); - return Optional.of(gcBuilder.build()); - } - log.warn("Uri not set to invoke a Gui cut through session to the device. Please set the Uri in the device"); - } - log.warn("Retrieving augmented System details failed. Gui cut through information not available"); - return Optional.empty(); - } - - /** - * Convert netconf time into Instant - * - * @param eventTime with netconf time - * @return Instant with converted time. If not convertable provide Instant.Min - */ - public static Instant getInstantTime(@Nullable DateAndTime eventTime) { - return eventTime != null ? Instant.parse(eventTime.getValue()) : Instant.MIN; - } - - /** - * Convert fault notification into data-provider FaultLogEntity - * - * @param notification with O-RAN notification - * @param nodeId of node to handle - * @param counter to be integrated into data - * @return FaultlogEntity with data - */ - public static FaultlogEntity getFaultLog(AlarmNotif notification, NodeId nodeId, Integer counter) { - FaultlogBuilder faultAlarm = new FaultlogBuilder(); - faultAlarm.setNodeId(nodeId.getValue()); - faultAlarm.setObjectId(notification.getFaultSource()); - faultAlarm.setProblem(notification.getFaultText()); - faultAlarm.setSeverity(getSeverityType(notification.getFaultSeverity(), notification.getIsCleared())); - faultAlarm.setCounter(counter); - faultAlarm.setId(String.valueOf(notification.getFaultId())); - faultAlarm.setSourceType(SourceType.Netconf); - faultAlarm.setTimestamp(notification.getEventTime()); - return faultAlarm.build(); - } - - /** - * Convert O-RAN specific severity into data-provider severity - * - * @param faultSeverity O-RAN severity - * @param isCleared clear indicator - * @return data-provider severity type - * @throws IllegalArgumentException if conversion not possible. - */ - public static SeverityType getSeverityType(@Nullable FaultSeverity faultSeverity, @Nullable Boolean isCleared) - throws IllegalArgumentException { - if (isCleared != null && isCleared) { - return SeverityType.NonAlarmed; - } - if (faultSeverity != null) { - switch (faultSeverity) { - case CRITICAL: - return SeverityType.Critical; - case MAJOR: - return SeverityType.Major; - case MINOR: - return SeverityType.Minor; - case WARNING: - return SeverityType.Warning; - } - } - throw new IllegalArgumentException("Unknown Alarm state represent as Critical. isCleared=" + isCleared - + " faultSeverity=" + faultSeverity); - } - -} diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/DOMNotificationToXPath.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/DOMNotificationToXPath.java index 64fb9b857..abe89df7a 100644 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/DOMNotificationToXPath.java +++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/DOMNotificationToXPath.java @@ -21,6 +21,7 @@ */ package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom; +import com.google.common.base.VerifyException; import java.time.Instant; import java.util.Collection; import java.util.HashMap; @@ -43,193 +44,191 @@ import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.base.VerifyException; - public class DOMNotificationToXPath { - private static final Logger LOG = LoggerFactory.getLogger(DOMNotificationToXPath.class); - - public HashMap<String, String> convertDomNotifToXPath(@NonNull DOMNotification domNotification) { - @NonNull - ContainerNode notifContainer = domNotification.getBody(); - HashMap<String, String> xPathData = new HashMap<String, String>(); - - Collection<DataContainerChild> data = notifContainer.body(); - for (DataContainerChild data1 : data) { - String namePath = ""; - recurseDOMData(notifContainer, data1, notifContainer, xPathData, namePath); - } - LOG.debug("XPath Data = {}", xPathData); - return xPathData; - - } - - private void recurseDOMData(@NonNull ContainerNode notifContainer, DataContainerChild domData, DataContainerNode cn, - HashMap<String, String> result, String namePath) { - PathArgument pa1 = domData.getIdentifier(); - namePath += "/" + pa1.getNodeType().getLocalName(); - if (domData.getClass().getSimpleName().equals("ImmutableContainerNode")) { - try { - ContainerNode cn1 = (ContainerNode) cn.getChildByArg(pa1); - for (DataContainerChild data1 : cn1.body()) { - recurseDOMData(notifContainer, data1, cn1, result, namePath); - } - } catch (VerifyException ve) { - LOG.debug("{} does not exist", pa1); - } - } - - if (domData.getClass().getSimpleName().equals("ImmutableChoiceNode")) { - try { - ChoiceNode cn1 = (ChoiceNode) cn.getChildByArg(pa1); - for (DataContainerChild data1 : cn1.body()) { - // recurseChoiceData(data1, cn1, namePath); - recurseDOMData(notifContainer, data1, cn1, result, namePath); - } - } catch (VerifyException ve) { - LOG.debug("{} does not exist", pa1); - } - } - - if (domData.getClass().getSimpleName().equals("ImmutableUnkeyedListNode")) { - try { - UnkeyedListNode cn1 = (UnkeyedListNode) cn.getChildByArg(pa1); - for (UnkeyedListEntryNode data1 : cn1.body()) { - recurseUnkeyedListEntryNodeData(data1, cn1, result, namePath); - } - } catch (VerifyException ve) { - LOG.debug("{} does not exist", pa1); - } - } - - if (domData.getClass().getSimpleName().equals("ImmutableMapNode")) { - try { - MapNode cn1 = (MapNode) cn.getChildByArg(pa1); - for (MapEntryNode data1 : cn1.body()) { - recurseMapEntryNodeData(notifContainer, data1, cn1, result, namePath); - } - } catch (VerifyException ve) { - LOG.debug("{} does not exist", pa1); - } - } - - if (domData.getClass().getSimpleName().equals("ImmutableLeafSetNode")) { - try { - LeafSetNode<?> cn1 = (LeafSetNode<?>) cn.getChildByArg(pa1); - for (LeafSetEntryNode<?> data1 : cn1.body()) { - recurseLeafSetEntryNodeData(data1, cn1, result, namePath); - } - } catch (VerifyException ve) { - LOG.debug("{} does not exist", pa1); - } - } - - if (domData.getClass().getSimpleName().equals("ImmutableLeafNode")) { - recurseLeafNode(domData, result, namePath); - } - } - - private void recurseLeafSetEntryNodeData(LeafSetEntryNode<?> data, LeafSetNode<?> cn1, - HashMap<String, String> result, String namePath) { - PathArgument pa1 = data.getIdentifier(); - namePath += "/" + pa1.getNodeType().getLocalName(); - - if (data.getClass().getSimpleName().equals("ImmutableLeafSetEntryNode")) { - LOG.debug("{}={}", namePath, data.body()); - result.put(namePath, data.body().toString()); - } - } - - private void recurseMapEntryNodeData(@NonNull ContainerNode notifContainer, MapEntryNode data, MapNode cn1, - HashMap<String, String> result, String namePath) { - PathArgument pa1 = data.getIdentifier(); - NodeIdentifierWithPredicates ni = data.getIdentifier(); - - for (QName qn : ni.keySet()) { - namePath += "/" + ni.getValue(qn); - } - - if (data.getClass().getSimpleName().equals("ImmutableMapEntryNode")) { - for (DataContainerChild data1 : data.body()) { - if (data1.getClass().getSimpleName().equals("ImmutableLeafSetNode")) { - try { - LeafSetNode<?> cn2 = (LeafSetNode<?>) data.getChildByArg(data1.getIdentifier()); - for (LeafSetEntryNode<?> data2 : cn2.body()) { - recurseLeafSetEntryNodeData(data2, cn2, result, namePath); - } - } catch (VerifyException ve) { - LOG.debug("{} does not exist", data1.getIdentifier()); - } - } else { - recurseLeafNode(data1, result, namePath); - } - } - } - - if (data.getClass().getSimpleName().equals("ImmutableLeafSetNode")) { - try { - LeafSetNode<?> cn2 = (LeafSetNode<?>) notifContainer.getChildByArg(pa1); - for (LeafSetEntryNode<?> data1 : cn2.body()) { - recurseLeafSetEntryNodeData(data1, cn2, result, namePath); - } - } catch (VerifyException ve) { - LOG.debug("{} does not exist", pa1); - } - } - - if (data.getClass().getSimpleName().equals("ImmutableLeafNode")) { - LOG.debug("{}={}", namePath, data.body()); - result.put(namePath, data.body().toString()); - } - } - - private void recurseUnkeyedListEntryNodeData(UnkeyedListEntryNode data, UnkeyedListNode cn1, - HashMap<String, String> result, String namePath) { - PathArgument pa1 = data.getIdentifier(); - namePath += "/" + pa1.getNodeType().getLocalName(); - - if (data.getClass().getSimpleName().equals("ImmutableUnkeyedListEntryNode")) { - for (DataContainerChild data1 : data.body()) { - recurseLeafNode(data1, result, namePath); - } - } - - if (data.getClass().getSimpleName().equals("ImmutableLeafNode")) { - LOG.debug("{}={}", namePath, data.body()); - result.put(namePath, data.body().toString()); - } - } - - public void recurseLeafNode(DataContainerChild data, HashMap<String, String> result, String namePath) { - PathArgument pa1 = data.getIdentifier(); - if (!(data.getClass().getSimpleName().equals("ImmutableAugmentationNode"))) - namePath += "/" + pa1.getNodeType().getLocalName(); - if (data.getClass().getSimpleName().equals("ImmutableLeafNode")) { - LOG.debug("{}={}", namePath, data.body()); - result.put(namePath, data.body().toString()); - } - } - - public void recurseChoiceData(HashMap<String, String> result, DataContainerChild data, ChoiceNode cn, - String namePath) { - PathArgument pa1 = data.getIdentifier(); - namePath += "/" + pa1.getNodeType().getLocalName(); - // NodeIdentifier nodeId = new NodeIdentifier(pa1.getNodeType()); - if (data.getClass().getSimpleName().equals("ImmutableLeafNode")) { - LOG.debug("{}={}", namePath, data.body()); - result.put(namePath, data.body().toString()); - } - } - - public Instant getTime(@NonNull DOMNotification domNotification) { - @NonNull - Instant eventTime; - if (domNotification instanceof DOMEvent) { - eventTime = ((DOMEvent) domNotification).getEventInstant(); - LOG.info("Event time {}", eventTime); - } else { - eventTime = Instant.now(); - LOG.info("Defaulting to actual time of processing the notification - {}", eventTime); - } - return eventTime; - } + private static final Logger LOG = LoggerFactory.getLogger(DOMNotificationToXPath.class); + + public HashMap<String, String> convertDomNotifToXPath(@NonNull DOMNotification domNotification) { + @NonNull + ContainerNode notifContainer = domNotification.getBody(); + HashMap<String, String> xPathData = new HashMap<String, String>(); + + Collection<DataContainerChild> data = notifContainer.body(); + for (DataContainerChild data1 : data) { + String namePath = ""; + recurseDOMData(notifContainer, data1, notifContainer, xPathData, namePath); + } + LOG.debug("XPath Data = {}", xPathData); + return xPathData; + + } + + private void recurseDOMData(@NonNull ContainerNode notifContainer, DataContainerChild domData, DataContainerNode cn, + HashMap<String, String> result, String namePath) { + PathArgument pa1 = domData.getIdentifier(); + namePath += "/" + pa1.getNodeType().getLocalName(); + if (domData.getClass().getSimpleName().equals("ImmutableContainerNode")) { + try { + ContainerNode cn1 = (ContainerNode) cn.getChildByArg(pa1); + for (DataContainerChild data1 : cn1.body()) { + recurseDOMData(notifContainer, data1, cn1, result, namePath); + } + } catch (VerifyException ve) { + LOG.debug("{} does not exist", pa1); + } + } + + if (domData.getClass().getSimpleName().equals("ImmutableChoiceNode")) { + try { + ChoiceNode cn1 = (ChoiceNode) cn.getChildByArg(pa1); + for (DataContainerChild data1 : cn1.body()) { + // recurseChoiceData(data1, cn1, namePath); + recurseDOMData(notifContainer, data1, cn1, result, namePath); + } + } catch (VerifyException ve) { + LOG.debug("{} does not exist", pa1); + } + } + + if (domData.getClass().getSimpleName().equals("ImmutableUnkeyedListNode")) { + try { + UnkeyedListNode cn1 = (UnkeyedListNode) cn.getChildByArg(pa1); + for (UnkeyedListEntryNode data1 : cn1.body()) { + recurseUnkeyedListEntryNodeData(data1, cn1, result, namePath); + } + } catch (VerifyException ve) { + LOG.debug("{} does not exist", pa1); + } + } + + if (domData.getClass().getSimpleName().equals("ImmutableMapNode")) { + try { + MapNode cn1 = (MapNode) cn.getChildByArg(pa1); + for (MapEntryNode data1 : cn1.body()) { + recurseMapEntryNodeData(notifContainer, data1, cn1, result, namePath); + } + } catch (VerifyException ve) { + LOG.debug("{} does not exist", pa1); + } + } + + if (domData.getClass().getSimpleName().equals("ImmutableLeafSetNode")) { + try { + LeafSetNode<?> cn1 = (LeafSetNode<?>) cn.getChildByArg(pa1); + for (LeafSetEntryNode<?> data1 : cn1.body()) { + recurseLeafSetEntryNodeData(data1, cn1, result, namePath); + } + } catch (VerifyException ve) { + LOG.debug("{} does not exist", pa1); + } + } + + if (domData.getClass().getSimpleName().equals("ImmutableLeafNode")) { + recurseLeafNode(domData, result, namePath); + } + } + + private void recurseLeafSetEntryNodeData(LeafSetEntryNode<?> data, LeafSetNode<?> cn1, + HashMap<String, String> result, String namePath) { + PathArgument pa1 = data.getIdentifier(); + namePath += "/" + pa1.getNodeType().getLocalName(); + + if (data.getClass().getSimpleName().equals("ImmutableLeafSetEntryNode")) { + LOG.debug("{}={}", namePath, data.body()); + result.put(namePath, data.body().toString()); + } + } + + private void recurseMapEntryNodeData(@NonNull ContainerNode notifContainer, MapEntryNode data, MapNode cn1, + HashMap<String, String> result, String namePath) { + PathArgument pa1 = data.getIdentifier(); + NodeIdentifierWithPredicates ni = data.getIdentifier(); + + for (QName qn : ni.keySet()) { + namePath += "/" + ni.getValue(qn); + } + + if (data.getClass().getSimpleName().equals("ImmutableMapEntryNode")) { + for (DataContainerChild data1 : data.body()) { + if (data1.getClass().getSimpleName().equals("ImmutableLeafSetNode")) { + try { + LeafSetNode<?> cn2 = (LeafSetNode<?>) data.getChildByArg(data1.getIdentifier()); + for (LeafSetEntryNode<?> data2 : cn2.body()) { + recurseLeafSetEntryNodeData(data2, cn2, result, namePath); + } + } catch (VerifyException ve) { + LOG.debug("{} does not exist", data1.getIdentifier()); + } + } else { + recurseLeafNode(data1, result, namePath); + } + } + } + + if (data.getClass().getSimpleName().equals("ImmutableLeafSetNode")) { + try { + LeafSetNode<?> cn2 = (LeafSetNode<?>) notifContainer.getChildByArg(pa1); + for (LeafSetEntryNode<?> data1 : cn2.body()) { + recurseLeafSetEntryNodeData(data1, cn2, result, namePath); + } + } catch (VerifyException ve) { + LOG.debug("{} does not exist", pa1); + } + } + + if (data.getClass().getSimpleName().equals("ImmutableLeafNode")) { + LOG.debug("{}={}", namePath, data.body()); + result.put(namePath, data.body().toString()); + } + } + + private void recurseUnkeyedListEntryNodeData(UnkeyedListEntryNode data, UnkeyedListNode cn1, + HashMap<String, String> result, String namePath) { + PathArgument pa1 = data.getIdentifier(); + namePath += "/" + pa1.getNodeType().getLocalName(); + + if (data.getClass().getSimpleName().equals("ImmutableUnkeyedListEntryNode")) { + for (DataContainerChild data1 : data.body()) { + recurseLeafNode(data1, result, namePath); + } + } + + if (data.getClass().getSimpleName().equals("ImmutableLeafNode")) { + LOG.debug("{}={}", namePath, data.body()); + result.put(namePath, data.body().toString()); + } + } + + public void recurseLeafNode(DataContainerChild data, HashMap<String, String> result, String namePath) { + PathArgument pa1 = data.getIdentifier(); + if (!(data.getClass().getSimpleName().equals("ImmutableAugmentationNode"))) + namePath += "/" + pa1.getNodeType().getLocalName(); + if (data.getClass().getSimpleName().equals("ImmutableLeafNode")) { + LOG.debug("{}={}", namePath, data.body()); + result.put(namePath, data.body().toString()); + } + } + + public void recurseChoiceData(HashMap<String, String> result, DataContainerChild data, ChoiceNode cn, + String namePath) { + PathArgument pa1 = data.getIdentifier(); + namePath += "/" + pa1.getNodeType().getLocalName(); + // NodeIdentifier nodeId = new NodeIdentifier(pa1.getNodeType()); + if (data.getClass().getSimpleName().equals("ImmutableLeafNode")) { + LOG.debug("{}={}", namePath, data.body()); + result.put(namePath, data.body().toString()); + } + } + + public Instant getTime(@NonNull DOMNotification domNotification) { + @NonNull + Instant eventTime; + if (domNotification instanceof DOMEvent) { + eventTime = ((DOMEvent) domNotification).getEventInstant(); + LOG.info("Event time {}", eventTime); + } else { + eventTime = Instant.now(); + LOG.info("Defaulting to actual time of processing the notification - {}", eventTime); + } + return eventTime; + } } diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/DeviceManagerORanImpl.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/DeviceManagerORanImpl.java index 7e04e8c1a..de018ba4e 100644 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/DeviceManagerORanImpl.java +++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/DeviceManagerORanImpl.java @@ -15,11 +15,10 @@ * the License. * ============LICENSE_END========================================================================== */ -package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.binding; +package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom; 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.oran.impl.startup.ORanNetworkElementFactory; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDMDOMUtility.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDMDOMUtility.java index 947677bb6..279620cf8 100644 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDMDOMUtility.java +++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDMDOMUtility.java @@ -42,49 +42,49 @@ import org.slf4j.LoggerFactory; import com.google.common.base.VerifyException; public class ORanDMDOMUtility { - public static final Logger LOG = LoggerFactory.getLogger(ORanDMDOMUtility.class); + public static final Logger LOG = LoggerFactory.getLogger(ORanDMDOMUtility.class); - public static String getKeyValue(MapEntryNode componentEntry) { - NodeIdentifierWithPredicates componentKey = componentEntry.getIdentifier(); // list key - return (String) componentKey.getValue(ORanDeviceManagerQNames.IETF_HW_COMPONENT_LIST_KEY); - } + public static String getKeyValue(MapEntryNode componentEntry) { + NodeIdentifierWithPredicates componentKey = componentEntry.getIdentifier(); // list key + return (String) componentKey.getValue(ORanDeviceManagerQNames.IETF_HW_COMPONENT_LIST_KEY); + } - public static String getLeafValue(DataContainerNode componentEntry, QName leafQName) { - NodeIdentifier leafNodeIdentifier = new NodeIdentifier(leafQName); - try { - LeafNode<?> optLeafNode = (LeafNode<?>) componentEntry.getChildByArg(leafNodeIdentifier); - if (optLeafNode.body() instanceof QName) { - LOG.debug("Leaf is of type QName"); - } - return optLeafNode.body().toString(); - } catch (VerifyException ve) { - LOG.debug("Leaf with QName {} not found", leafQName.toString()); - return null; - } - } + public static String getLeafValue(DataContainerNode componentEntry, QName leafQName) { + NodeIdentifier leafNodeIdentifier = new NodeIdentifier(leafQName); + try { + LeafNode<?> optLeafNode = (LeafNode<?>) componentEntry.getChildByArg(leafNodeIdentifier); + if (optLeafNode.body() instanceof QName) { + LOG.debug("Leaf is of type QName"); + } + return optLeafNode.body().toString(); + } catch (VerifyException ve) { + LOG.debug("Leaf with QName {} not found", leafQName.toString()); + return null; + } + } - public static List<String> getLeafListValue(DataContainerNode componentEntry, QName leafListQName) { - List<String> containsChildList = new ArrayList<String>(); - try { - DataContainerChild childSet = componentEntry.getChildByArg(new NodeIdentifier(leafListQName)); - Collection<?> childEntry = (Collection<?>) childSet.body(); - Iterator<?> childEntryItr = childEntry.iterator(); - while (childEntryItr.hasNext()) { - LeafSetEntryNode<?> childEntryNode = (LeafSetEntryNode<?>) childEntryItr.next(); - containsChildList.add(childEntryNode.body().toString()); - } - } catch (VerifyException ve) { - LOG.debug("Child for {} does not exist", leafListQName); - } - return containsChildList; - } + public static List<String> getLeafListValue(DataContainerNode componentEntry, QName leafListQName) { + List<String> containsChildList = new ArrayList<String>(); + try { + DataContainerChild childSet = componentEntry.getChildByArg(new NodeIdentifier(leafListQName)); + Collection<?> childEntry = (Collection<?>) childSet.body(); + Iterator<?> childEntryItr = childEntry.iterator(); + while (childEntryItr.hasNext()) { + LeafSetEntryNode<?> childEntryNode = (LeafSetEntryNode<?>) childEntryItr.next(); + containsChildList.add(childEntryNode.body().toString()); + } + } catch (VerifyException ve) { + LOG.debug("Child for {} does not exist", leafListQName); + } + return containsChildList; + } - public static Instant getNotificationInstant(DOMNotification notification) { - if (notification instanceof DOMEvent) { - return ((DOMEvent) notification).getEventInstant(); - } else { - return Instant.now(); - } - } + public static Instant getNotificationInstant(DOMNotification notification) { + if (notification instanceof DOMEvent) { + return ((DOMEvent) notification).getEventInstant(); + } else { + return Instant.now(); + } + } } diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMChangeNotificationListener.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMChangeNotificationListener.java index aa375eff7..39eabcdc6 100644 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMChangeNotificationListener.java +++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMChangeNotificationListener.java @@ -37,9 +37,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types. import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogEntity; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType; -import org.opendaylight.yangtools.yang.binding.CodeHelpers; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier; -import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode; import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute; @@ -48,103 +46,103 @@ import org.slf4j.LoggerFactory; public class ORanDOMChangeNotificationListener implements DOMNotificationListener { - private static final Logger log = LoggerFactory.getLogger(ORanDOMChangeNotificationListener.class); + private static final Logger log = LoggerFactory.getLogger(ORanDOMChangeNotificationListener.class); - private final NetconfDomAccessor netconfDomAccessor; - private final DataProvider databaseService; - private @NonNull VESCollectorService vesCollectorService; - private final DOMNotificationToXPath domNotificationXPath; - private ORanDOMNotifToVESEventAssembly mapper = null; - private static int sequenceNo = 0; + private final NetconfDomAccessor netconfDomAccessor; + private final DataProvider databaseService; + private @NonNull VESCollectorService vesCollectorService; + private final DOMNotificationToXPath domNotificationXPath; + private ORanDOMNotifToVESEventAssembly mapper = null; + private static int sequenceNo = 0; - public ORanDOMChangeNotificationListener(NetconfDomAccessor netconfDomAccessor, - @NonNull VESCollectorService vesCollectorService, DataProvider databaseService) { - this.netconfDomAccessor = netconfDomAccessor; - this.databaseService = databaseService; - this.vesCollectorService = vesCollectorService; - domNotificationXPath = new DOMNotificationToXPath(); - } + public ORanDOMChangeNotificationListener(NetconfDomAccessor netconfDomAccessor, + @NonNull VESCollectorService vesCollectorService, DataProvider databaseService) { + this.netconfDomAccessor = netconfDomAccessor; + this.databaseService = databaseService; + this.vesCollectorService = vesCollectorService; + domNotificationXPath = new DOMNotificationToXPath(); + } - @Override - public void onNotification(@NonNull DOMNotification domNotification) { - if (domNotification.getType() - .equals(Absolute.of(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_NETCONF_CONFIG_CHANGE))) { - handleNetconfConfigChange(domNotification); - } - } + @Override + public void onNotification(@NonNull DOMNotification domNotification) { + if (domNotification.getType() + .equals(Absolute.of(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_NETCONF_CONFIG_CHANGE))) { + handleNetconfConfigChange(domNotification); + } + } - private void handleNetconfConfigChange(@NonNull DOMNotification domNotification) { - DateAndTime eventTime; - Instant notificationEventTime = null; - if (domNotification instanceof DOMEvent) { - notificationEventTime = ((DOMEvent) domNotification).getEventInstant(); - eventTime = NetconfTimeStampImpl.getConverter().getTimeStamp(notificationEventTime.toString()); - } else { - eventTime = NetconfTimeStampImpl.getConverter().getTimeStamp(); - } + private void handleNetconfConfigChange(@NonNull DOMNotification domNotification) { + DateAndTime eventTime; + Instant notificationEventTime = null; + if (domNotification instanceof DOMEvent) { + notificationEventTime = ((DOMEvent) domNotification).getEventInstant(); + eventTime = NetconfTimeStampImpl.getConverter().getTimeStamp(notificationEventTime.toString()); + } else { + eventTime = NetconfTimeStampImpl.getConverter().getTimeStamp(); + } - ContainerNode cn = domNotification.getBody(); + ContainerNode cn = domNotification.getBody(); - // Process the changed-by child -// ContainerNode changedByContainerNode = (ContainerNode) cn -// .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_CHANGEDBY)); -// ChoiceNode serverOrUserIDVal = (ChoiceNode) changedByContainerNode -// .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_SERVERORUSER)); -// @SuppressWarnings("unused") -// String userIDValue = serverOrUserIDVal -// .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_USERNAME)).body() -// .toString(); -// @SuppressWarnings("unused") -// Integer sessionIDVal = Integer.valueOf(serverOrUserIDVal -// .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_SESSIONID)).body() -// .toString()); -// -// // Process the datastore child -// @SuppressWarnings("unused") -// String datastoreValue = cn -// .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_DATASTORE)).body() -// .toString(); + // Process the changed-by child + // ContainerNode changedByContainerNode = (ContainerNode) cn + // .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_CHANGEDBY)); + // ChoiceNode serverOrUserIDVal = (ChoiceNode) changedByContainerNode + // .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_SERVERORUSER)); + // @SuppressWarnings("unused") + // String userIDValue = serverOrUserIDVal + // .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_USERNAME)).body() + // .toString(); + // @SuppressWarnings("unused") + // Integer sessionIDVal = Integer.valueOf(serverOrUserIDVal + // .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_SESSIONID)).body() + // .toString()); + // + // // Process the datastore child + // @SuppressWarnings("unused") + // String datastoreValue = cn + // .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_DATASTORE)).body() + // .toString(); - // Process the edit child - UnkeyedListNode editList = (UnkeyedListNode) cn - .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_EDITNODE)); - if (editList != null) { - for (int listCnt = 0; listCnt < editList.size(); listCnt++) { - String operationValue = editList.childAt(listCnt) - .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_OPERATION)) - .body().toString(); - String targetValue = editList.childAt(listCnt) - .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_TARGET)) - .body().toString(); + // Process the edit child + UnkeyedListNode editList = (UnkeyedListNode) cn + .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_EDITNODE)); + if (editList != null) { + for (int listCnt = 0; listCnt < editList.size(); listCnt++) { + String operationValue = editList.childAt(listCnt) + .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_OPERATION)) + .body().toString(); + String targetValue = editList.childAt(listCnt) + .childByArg(new NodeIdentifier(ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_TARGET)) + .body().toString(); - EventlogEntity eventLogEntity1 = new EventlogBuilder() - .setNodeId(netconfDomAccessor.getNodeId().getValue()).setCounter(sequenceNo++) - .setTimestamp(eventTime).setObjectId(targetValue).setAttributeName("N.A") - .setSourceType(SourceType.Netconf).setNewValue(String.valueOf(operationValue)).build(); - databaseService.writeEventLog(eventLogEntity1); - } - } + EventlogEntity eventLogEntity1 = new EventlogBuilder() + .setNodeId(netconfDomAccessor.getNodeId().getValue()).setCounter(sequenceNo++) + .setTimestamp(eventTime).setObjectId(targetValue).setAttributeName("N.A") + .setSourceType(SourceType.Netconf).setNewValue(String.valueOf(operationValue)).build(); + databaseService.writeEventLog(eventLogEntity1); + } + } - if (vesCollectorService.getConfig().isVESCollectorEnabled()) { - if (mapper == null) { - this.mapper = new ORanDOMNotifToVESEventAssembly(netconfDomAccessor, vesCollectorService); - } - VESCommonEventHeaderPOJO header = mapper.createVESCommonEventHeader( - domNotificationXPath.getTime(domNotification), - ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_NETCONF_CONFIG_CHANGE.getLocalName(), - sequenceNo); - VESNotificationFieldsPOJO body = mapper.createVESNotificationFields( - domNotificationXPath.convertDomNotifToXPath(domNotification), - ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_NETCONF_CONFIG_CHANGE.getLocalName()); - log.info("domNotification in XPath format = {}", - domNotificationXPath.convertDomNotifToXPath(domNotification)); - try { - vesCollectorService.publishVESMessage(vesCollectorService.generateVESEvent(header, body)); - } catch (JsonProcessingException e) { - log.warn("Exception while generating JSON object ", e); + if (vesCollectorService.getConfig().isVESCollectorEnabled()) { + if (mapper == null) { + this.mapper = new ORanDOMNotifToVESEventAssembly(netconfDomAccessor, vesCollectorService); + } + VESCommonEventHeaderPOJO header = + mapper.createVESCommonEventHeader(domNotificationXPath.getTime(domNotification), + ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_NETCONF_CONFIG_CHANGE.getLocalName(), + sequenceNo); + VESNotificationFieldsPOJO body = + mapper.createVESNotificationFields(domNotificationXPath.convertDomNotifToXPath(domNotification), + ORanDeviceManagerQNames.IETF_NETCONF_NOTIFICATIONS_NETCONF_CONFIG_CHANGE.getLocalName()); + log.info("domNotification in XPath format = {}", + domNotificationXPath.convertDomNotifToXPath(domNotification)); + try { + vesCollectorService.publishVESMessage(vesCollectorService.generateVESEvent(header, body)); + } catch (JsonProcessingException e) { + log.warn("Exception while generating JSON object ", e); - } - } + } + } - } + } } diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMFaultToVESFaultMapper.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMFaultToVESFaultMapper.java index b05e83f9a..77bd82d12 100644 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMFaultToVESFaultMapper.java +++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMFaultToVESFaultMapper.java @@ -22,7 +22,6 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom; import java.time.Instant; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.binding.ORanFaultToVESFaultMapper; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESCommonEventHeaderPOJO; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESFaultFieldsPOJO; @@ -74,7 +73,7 @@ import org.slf4j.LoggerFactory; public class ORanDOMFaultToVESFaultMapper { @SuppressWarnings("unused") - private static final Logger LOG = LoggerFactory.getLogger(ORanFaultToVESFaultMapper.class); + private static final Logger LOG = LoggerFactory.getLogger(ORanDOMFaultToVESFaultMapper.class); private static final String VES_EVENT_DOMAIN = "fault"; private static final String VES_EVENTTYPE = "ORAN_Fault"; private static final String VES_EVENT_PRIORITY = "Normal"; diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMNetworkElement.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMNetworkElement.java index 64006339d..9b4f11e27 100644 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMNetworkElement.java +++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanDOMNetworkElement.java @@ -34,7 +34,6 @@ import org.eclipse.jdt.annotation.Nullable; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement; import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElementService; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.binding.ORanRegistrationToVESpnfRegistrationMapper; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService; diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/startup/ORanNetworkElementFactory.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanNetworkElementFactory.java index afeac1932..05561d2ca 100644 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/startup/ORanNetworkElementFactory.java +++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanNetworkElementFactory.java @@ -18,13 +18,11 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.startup; +package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom; 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.oran.impl.dom.ORanDOMNetworkElement; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom.ORanDeviceManagerQNames; 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; diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanRegistrationToVESpnfRegistrationMapper.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanRegistrationToVESpnfRegistrationMapper.java index 206abb5d7..5cad5881c 100644 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/binding/ORanRegistrationToVESpnfRegistrationMapper.java +++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/ORanRegistrationToVESpnfRegistrationMapper.java @@ -19,11 +19,10 @@ * ============LICENSE_END========================================================= * */ -package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.binding; +package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom; import java.time.Instant; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom.ORanDMDOMUtility; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom.ORanDeviceManagerQNames; + import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESCommonEventHeaderPOJO; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESPNFRegistrationFieldsPOJO; @@ -35,7 +34,7 @@ import org.slf4j.LoggerFactory; public class ORanRegistrationToVESpnfRegistrationMapper { @SuppressWarnings("unused") - private static final Logger LOG = LoggerFactory.getLogger(ORanFaultToVESFaultMapper.class); + private static final Logger LOG = LoggerFactory.getLogger(ORanRegistrationToVESpnfRegistrationMapper.class); //CommonEventHeader fields private static final String VES_EVENT_DOMAIN = "pnfRegistration"; private static final String VES_EVENTTYPE = "NetConf Callhome Registration"; diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/OperatorStateBuilder.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/OperatorStateBuilder.java deleted file mode 100644 index 48d8e802a..000000000 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/OperatorStateBuilder.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911; - -import java.lang.String; -import java.lang.UnsupportedOperationException; - -/** - * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string - * representation. In some cases it is very difficult to automate it since there can be unions such as (uint32 - - * uint16), or (string - uint32). - * - * The reason behind putting it under src/main/java is: This class is generated in form of a stub and needs to be - * finished by the user. This class is generated only once to prevent loss of user code. - * - */ -public class OperatorStateBuilder { - private OperatorStateBuilder() { - //Exists only to defeat instantiation. - } - - public static OperatorState getDefaultInstance(String defaultValue) { - throw new UnsupportedOperationException("Not yet implemented"); - } - -} diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceBuilder.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceBuilder.java deleted file mode 100644 index fb2e5d59d..000000000 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceBuilder.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911; - -import java.lang.String; -import java.lang.UnsupportedOperationException; - -/** - * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string - * representation. In some cases it is very difficult to automate it since there can be unions such as (uint32 - - * uint16), or (string - uint32). - * - * The reason behind putting it under src/main/java is: This class is generated in form of a stub and needs to be - * finished by the user. This class is generated only once to prevent loss of user code. - * - */ -public class ResourceBuilder { - private ResourceBuilder() { - //Exists only to defeat instantiation. - } - - public static Resource getDefaultInstance(String defaultValue) { - throw new UnsupportedOperationException("Not yet implemented"); - } - -} diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceMatchBuilder.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceMatchBuilder.java deleted file mode 100644 index 2f4b5931f..000000000 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceMatchBuilder.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911; - -import java.lang.String; -import java.lang.UnsupportedOperationException; - -/** - * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string - * representation. In some cases it is very difficult to automate it since there can be unions such as (uint32 - - * uint16), or (string - uint32). - * - * The reason behind putting it under src/main/java is: This class is generated in form of a stub and needs to be - * finished by the user. This class is generated only once to prevent loss of user code. - * - */ -public class ResourceMatchBuilder { - private ResourceMatchBuilder() { - //Exists only to defeat instantiation. - } - - public static ResourceMatch getDefaultInstance(String defaultValue) { - throw new UnsupportedOperationException("Not yet implemented"); - } - -} diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/SeverityWithClearBuilder.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/SeverityWithClearBuilder.java deleted file mode 100644 index 49e50e004..000000000 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/SeverityWithClearBuilder.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911; - -import java.lang.String; -import java.lang.UnsupportedOperationException; - -/** - * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string - * representation. In some cases it is very difficult to automate it since there can be unions such as (uint32 - - * uint16), or (string - uint32). - * - * The reason behind putting it under src/main/java is: This class is generated in form of a stub and needs to be - * finished by the user. This class is generated only once to prevent loss of user code. - * - */ -public class SeverityWithClearBuilder { - private SeverityWithClearBuilder() { - //Exists only to defeat instantiation. - } - - public static SeverityWithClear getDefaultInstance(String defaultValue) { - throw new UnsupportedOperationException("Not yet implemented"); - } - -} diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/alarms/ControlMaxAlarmStatusChangesBuilder.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/alarms/ControlMaxAlarmStatusChangesBuilder.java deleted file mode 100644 index c2a500986..000000000 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/alarms/ControlMaxAlarmStatusChangesBuilder.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911.alarms; - -import java.lang.String; -import java.lang.UnsupportedOperationException; - -/** - * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string - * representation. In some cases it is very difficult to automate it since there can be unions such as (uint32 - - * uint16), or (string - uint32). - * - * The reason behind putting it under src/main/java is: This class is generated in form of a stub and needs to be - * finished by the user. This class is generated only once to prevent loss of user code. - * - */ -public class ControlMaxAlarmStatusChangesBuilder { - private ControlMaxAlarmStatusChangesBuilder() { - //Exists only to defeat instantiation. - } - - public static Control.MaxAlarmStatusChanges getDefaultInstance(String defaultValue) { - throw new UnsupportedOperationException("Not yet implemented"); - } - -} diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml index b4cc2d927..c8970f652 100644 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml +++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml @@ -31,7 +31,7 @@ interface="org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService"/> <bean id="provider" - class="org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.binding.DeviceManagerORanImpl" + class="org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom.DeviceManagerORanImpl" init-method="init" destroy-method="close"> <property name="netconfNetworkElementService" ref="netconfNetworkElementService"/> </bean> |