2 * ============LICENSE_START=======================================================
3 * ONAP : ccsdk features
4 * ================================================================================
5 * Copyright (C) 2021 highstreet technologies GmbH Intellectual Property.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom;
24 import java.time.Instant;
25 import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.binding.ORanFaultToVESFaultMapper;
26 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService;
27 import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESCommonEventHeaderPOJO;
28 import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESFaultFieldsPOJO;
29 import org.opendaylight.mdsal.dom.api.DOMNotification;
30 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
31 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
32 import org.slf4j.Logger;
33 import org.slf4j.LoggerFactory;
37 * Maps ORAN Fault fields to VES fault domain fields and VES commonEventHeader fields
43 * eventId "nt:network-topology/nt:topology/nt:node/nt:node-id"
44 * eventName "nt:network-topology/nt:topology/nt:node/nt:node-id"
45 * eventType "O-RAN-RU-Fault"
46 * 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.
47 * nfcNamingCode always ""
48 * nfNamingCode always ""
49 * nfVendorName /ietf-hardware:hardware/component[not(parent)][1]/mfg-name
51 * reportingEntityId The OAM-Controller identifier with in the SMO - e.g. the fully qualified domain name or IP-Address.
52 * reportingEntityName as configured by helm charts for the OpenDaylight cluster name ??????
53 * sequence As per NetConf notification increasing sequence number as unsigned integer 32 bits. The value is reused in the eventId field.
54 * 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.
55 * sourceName "nt:network-topology/nt:topology/nt:node/nt:node-id"
56 * startEpochMicrosec Current OAM-Controller Node timestamp in unix time format - as microseconds elapsed since 1 Jan 1970 not including leap seconds.
57 * timeZoneOffset Static text: "+00:00"
59 * vesEventListenerVersion "7.2.1"
62 * alarmAdditionalInformation
63 * alarmCondition Value of "o-ran-fm:alarm-notif/fault-id"
64 * alarmInterfaceA Value of "o-ran-fm:alarm-notif/fault-source"
65 * eventCategory Static text "O-RU failure"
66 * eventSeverity Value of "o-ran-fm:alarm-notif/fault-severity". But if "o-ran-fm:alarm-notif/is-cleared" then "NORMAL"
67 * eventSourceType The value of ietf-hardware (RFC8348) /hardware/component[not(parent)][1]/model-name or "O-RU" if not found.
68 * faultFieldsVersion "4.0"
69 * specificProblem A mapping of the fault-id to its description according to O-RAN OpenFronthaul specification.
75 public class ORanDOMFaultToVESFaultMapper {
76 @SuppressWarnings("unused")
77 private static final Logger LOG = LoggerFactory.getLogger(ORanFaultToVESFaultMapper.class);
78 private static final String VES_EVENT_DOMAIN = "fault";
79 private static final String VES_EVENTTYPE = "ORAN_Fault";
80 private static final String VES_EVENT_PRIORITY = "Normal";
81 private static final String VES_EVENT_CATEGORY = "O-RU Failure";
82 private static final String VES_FAULT_FIELDS_VERSION = "4.0";
83 private static final String VES_FAULT_FIELDS_VFSTATUS = "Active"; //virtual function status
85 private final VESCollectorService vesProvider;
86 private final String notifName; // Name
87 private final String nodeIdString; // Sourcename
88 //Initialized during registration
89 private String mfgName;
91 private String modelName;
93 public ORanDOMFaultToVESFaultMapper(NodeId nodeId, VESCollectorService vesCollectorService, String notifName) {
94 this.nodeIdString = nodeId.getValue();
95 this.vesProvider = vesCollectorService;
96 this.notifName = notifName;
99 public void setMfgName(String mfgName) {
100 this.mfgName = mfgName;
103 public void setUuid(String uuid) {
107 public void setModelName(String modelName) {
108 this.modelName = modelName;
111 public VESCommonEventHeaderPOJO mapCommonEventHeader(DOMNotification notification, Instant eventTime,
113 VESCommonEventHeaderPOJO vesCEH = new VESCommonEventHeaderPOJO();
114 vesCEH.setDomain(VES_EVENT_DOMAIN);
115 vesCEH.setEventName(notifName);
116 vesCEH.setEventType(VES_EVENTTYPE);
117 vesCEH.setPriority(VES_EVENT_PRIORITY);
119 String eventId = notifName + "-" + Long.toUnsignedString(sequenceNo);
121 vesCEH.setEventId(eventId);
122 vesCEH.setStartEpochMicrosec(eventTime.toEpochMilli() * 1000);
123 vesCEH.setLastEpochMicrosec(eventTime.toEpochMilli() * 1000);
124 vesCEH.setNfVendorName(mfgName);
125 vesCEH.setReportingEntityName(vesProvider.getConfig().getReportingEntityName());
126 vesCEH.setSequence(sequenceNo);
127 vesCEH.setSourceId(uuid);
128 vesCEH.setSourceName(nodeIdString);
133 public VESFaultFieldsPOJO mapFaultFields(DOMNotification alarmNotif) {
134 VESFaultFieldsPOJO vesFaultFields = new VESFaultFieldsPOJO();
135 ContainerNode cn = alarmNotif.getBody();
136 vesFaultFields.setAlarmCondition(ORanDMDOMUtility.getLeafValue(cn, ORanDeviceManagerQNames.ORAN_FM_FAULT_ID));
138 .setAlarmInterfaceA(ORanDMDOMUtility.getLeafValue(cn, ORanDeviceManagerQNames.ORAN_FM_FAULT_SOURCE));
139 vesFaultFields.setEventCategory(VES_EVENT_CATEGORY);
140 if (ORanDMDOMUtility.getLeafValue(cn, ORanDeviceManagerQNames.ORAN_FM_FAULT_IS_CLEARED).equals("true")) {
141 vesFaultFields.setEventSeverity("NORMAL");
143 vesFaultFields.setEventSeverity(
144 ORanDMDOMUtility.getLeafValue(cn, ORanDeviceManagerQNames.ORAN_FM_FAULT_SEVERITY));
146 vesFaultFields.setEventSourceType(modelName);
147 vesFaultFields.setFaultFieldsVersion(VES_FAULT_FIELDS_VERSION);
149 .setSpecificProblem(ORanDMDOMUtility.getLeafValue(cn, ORanDeviceManagerQNames.ORAN_FM_FAULT_TEXT));
150 vesFaultFields.setVfStatus(VES_FAULT_FIELDS_VFSTATUS);
152 return vesFaultFields;