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;
24 import java.time.Instant;
25 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService;
26 import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESCommonEventHeaderPOJO;
27 import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESFaultFieldsPOJO;
28 import org.opendaylight.yang.gen.v1.urn.o.ran.fm._1._0.rev190204.AlarmNotif;
29 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
30 import org.slf4j.Logger;
31 import org.slf4j.LoggerFactory;
35 * Maps ORAN Fault fields to VES fault domain fields and VES commonEventHeader fields
40 * eventId "nt:network-topology/nt:topology/nt:node/nt:node-id"
41 * eventName "nt:network-topology/nt:topology/nt:node/nt:node-id"
42 * eventType "O-RAN-RU-Fault"
43 * 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.
44 * nfcNamingCode always ""
45 * nfNamingCode always ""
48 * reportingEntityId The OAM-Controller identifier with in the SMO - e.g. the fully qualified domain name or IP-Address.
49 * reportingEntityName as configured by helm charts for the OpenDaylight cluster name ??????
50 * sequence As per NetConf notification increasing sequence number as unsigned integer 32 bits. The value is reused in the eventId field.
52 * sourceName "nt:network-topology/nt:topology/nt:node/nt:node-id"
56 * vesEventListenerVersion "7.2"
59 * alarmAdditionalInformation
60 * alarmCondition Value of "o-ran-fm:alarm-notif/fault-id"
61 * alarmInterfaceA Value of "o-ran-fm:alarm-notif/fault-source"
62 * eventCategory Static text "O-RU failure"
63 * eventSeverity Value of "o-ran-fm:alarm-notif/fault-severity". But if "o-ran-fm:alarm-notif/is-cleared" then "NORMAL"
64 * eventSourceType The value of ietf-hardware (RFC8348) /hardware/component[not(parent)][1]/mfg-model or "O-RU" if not found.
65 * faultFieldsVersion "4.0"
66 * specificProblem A mapping of the fault-id to its description according to O-RAN OpenFronthaul specification.
72 public class ORanFaultToVESFaultMapper {
74 private static final Logger LOG = LoggerFactory.getLogger(ORanFaultToVESFaultMapper.class);
75 private static final String VES_EVENT_DOMAIN = "fault";
76 private static final String VES_EVENTTYPE = "ORAN_Fault";
77 private static final String VES_EVENT_PRIORITY = "Normal";
78 private static final String VES_EVENT_CATEGORY = "O-RU Failure";
79 private static final String VES_FAULT_FIELDS_VERSION = "4.0";
80 private static final String VES_FAULT_FIELDS_VFSTATUS = "Active"; //virtual function status
82 private final VESCollectorService vesProvider;
83 private final String notifName; // Name
84 private final String nodeIdString; // Sourcename
87 public ORanFaultToVESFaultMapper(NodeId nodeId, VESCollectorService vesCollectorService,
89 this.nodeIdString = nodeId.getValue();
90 this.vesProvider = vesCollectorService;
91 this.notifName = notifName;
94 public VESCommonEventHeaderPOJO mapCommonEventHeader(AlarmNotif notification, Instant eventTime, int sequenceNo) {
95 VESCommonEventHeaderPOJO vesCEH = new VESCommonEventHeaderPOJO();
96 vesCEH.setDomain(VES_EVENT_DOMAIN);
97 vesCEH.setEventName(notifName);
98 vesCEH.setEventType(VES_EVENTTYPE);
99 vesCEH.setPriority(VES_EVENT_PRIORITY);
103 eventId = notifName + "-" + Long.toUnsignedString(sequenceNo);
105 vesCEH.setEventId(eventId);
106 vesCEH.setStartEpochMicrosec(eventTime.toEpochMilli() * 1000);
107 vesCEH.setLastEpochMicrosec(eventTime.toEpochMilli() * 1000);
108 vesCEH.setNfVendorName("ORAN");
109 vesCEH.setReportingEntityName(vesProvider.getConfig().getReportingEntityName());
110 vesCEH.setSequence(sequenceNo);
111 vesCEH.setSourceId("ORAN");
112 vesCEH.setSourceName(nodeIdString);
117 public VESFaultFieldsPOJO mapFaultFields(AlarmNotif alarmNotif) {
118 VESFaultFieldsPOJO vesFaultFields = new VESFaultFieldsPOJO();
120 vesFaultFields.setAlarmCondition(alarmNotif.getFaultId().toString());
121 vesFaultFields.setAlarmInterfaceA(alarmNotif.getFaultSource());
122 vesFaultFields.setEventCategory(VES_EVENT_CATEGORY);
123 vesFaultFields.setEventSeverity(alarmNotif.getFaultSeverity().getName());
124 vesFaultFields.setFaultFieldsVersion(VES_FAULT_FIELDS_VERSION);
125 vesFaultFields.setSpecificProblem(alarmNotif.getFaultText());
126 vesFaultFields.setVfStatus(VES_FAULT_FIELDS_VFSTATUS);
128 return vesFaultFields;