From 17fd7d683b0b38a401481ae85cc5927679e20ce3 Mon Sep 17 00:00:00 2001 From: Ravi Pendurty Date: Wed, 16 Jun 2021 10:22:36 +0530 Subject: Include missing mapping of O-RAN fault fields Refactor O-RAN devicemanager and correct VES fault fields characteristics Issue-ID: CCSDK-3309 Change-Id: I01441cb9c84660c0ee6931d6bbe3f28993cfd054 Signed-off-by: Ravi Pendurty --- .../wt/devicemanager/service/VESEventMapper.java | 121 --------------------- .../types/VESCommonEventHeaderPOJO.java | 2 +- .../types/VESPNFRegistrationFieldsPOJO.java | 28 +++-- 3 files changed, 17 insertions(+), 134 deletions(-) delete mode 100644 sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/VESEventMapper.java (limited to 'sdnr/wt/devicemanager-core/model/src') diff --git a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/VESEventMapper.java b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/VESEventMapper.java deleted file mode 100644 index 76c8305a2..000000000 --- a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/service/VESEventMapper.java +++ /dev/null @@ -1,121 +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.service; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.time.Instant; -import java.util.HashMap; -import java.util.Map; -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.VESNotificationFieldsPOJO; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.VESPNFRegistrationFieldsPOJO; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; -import org.opendaylight.yangtools.yang.binding.Notification; - -/* - * Interface for mapping ODL notification to VES event fields grouped by event type. - * Also includes the commonEventHeader which is applicable for all events. - * Ex: fault event, notification event. - * - * No base implementation exists for this interface. Clients that need to map their data into VES formats must implement this interface. - */ - -public abstract class VESEventMapper { - - /** - * Creates VESEvent mapping - */ - public abstract String createMapping(NetconfBindingAccessor netconfAccessor, - VESCollectorService vesCollectorService, Notification notification, String notifName, int sequenceNo, - Instant eventTime); - - /** - * Returns VES commonEventHeader fields - */ - public abstract VESCommonEventHeaderPOJO mapCommonEventHeader(N notification); - - /** - * Returns VES faultFields - */ - public abstract VESFaultFieldsPOJO mapFaultFields(F notification); - - /** - * Returns VES Notification Fields - */ - public abstract VESNotificationFieldsPOJO mapNotificationFields(T notification); - - /** - * Returns VES pnfRegistration domain fields - * - * @return - */ - public abstract VESPNFRegistrationFieldsPOJO mapPNFRegistrationFields(); - - /** - * Generates VES Event JSON containing commonEventHeader and notificationFields fields - * - * @param commonEventHeader - * @param notifFields - * @return String - representing the VESEvent JSON - */ - String generateVESEvent(VESCommonEventHeaderPOJO commonEventHeader, VESNotificationFieldsPOJO notifFields) { - Map innerEvent = new HashMap(); - innerEvent.put("commonEventHeader", commonEventHeader); - innerEvent.put("notificationFields", notifFields); - - Map outerEvent = new HashMap(); - outerEvent.put("event", innerEvent); - try { - ObjectMapper objMapper = new ObjectMapper(); - return objMapper.writeValueAsString(outerEvent); - } catch (JsonProcessingException e) { - e.printStackTrace(); - } - return null; - } - - /** - * Generates VES Event JSON containing commonEventHeader and faultFields fields - * - * @param commonEventHeader - * @param faultFields - * @return String - representing the VES Event JSON - */ - String generateVESEvent(VESCommonEventHeaderPOJO commonEventHeader, VESFaultFieldsPOJO faultFields) { - Map innerEvent = new HashMap(); - innerEvent.put("commonEventHeader", commonEventHeader); - innerEvent.put("faultFields", faultFields); - - Map outerEvent = new HashMap(); - outerEvent.put("event", innerEvent); - try { - ObjectMapper objMapper = new ObjectMapper(); - return objMapper.writeValueAsString(outerEvent); - } catch (JsonProcessingException e) { - e.printStackTrace(); - } - return null; - } - -} diff --git a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/types/VESCommonEventHeaderPOJO.java b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/types/VESCommonEventHeaderPOJO.java index db76b84c7..272e4a9a3 100644 --- a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/types/VESCommonEventHeaderPOJO.java +++ b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/types/VESCommonEventHeaderPOJO.java @@ -48,7 +48,7 @@ public class VESCommonEventHeaderPOJO { private String nfVendorName = ""; private String timeZoneOffset = "+00:00"; private String version = "4.1"; - private String vesEventListenerVersion = "7.1.1"; + private String vesEventListenerVersion = "7.2.1"; public String getDomain() { return domain; diff --git a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/types/VESPNFRegistrationFieldsPOJO.java b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/types/VESPNFRegistrationFieldsPOJO.java index e564914da..111a8fd78 100644 --- a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/types/VESPNFRegistrationFieldsPOJO.java +++ b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/types/VESPNFRegistrationFieldsPOJO.java @@ -24,21 +24,25 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.types; import java.util.HashMap; import java.util.Map; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +@JsonInclude(Include.NON_NULL) public class VESPNFRegistrationFieldsPOJO { private Map additionalFields = new HashMap(); - private String lastServiceDate = ""; - private String macAddress = ""; - private String manufactureDate = ""; - private String modelNumber = ""; - private String oamV4IpAddress = ""; - private String oamV6IpAddress = ""; - private String pnfRegistrationFieldsVersion = "2.0"; - private String serialNumber = ""; - private String softwareVersion = ""; - private String unitFamily = ""; - private String unitType = ""; - private String vendorName = ""; + private String lastServiceDate; + private String macAddress; + private String manufactureDate; + private String modelNumber; + private String oamV4IpAddress; + private String oamV6IpAddress; + private String pnfRegistrationFieldsVersion = "2.0"; // This is the only mandatory field as per the VES Event schema definition + private String serialNumber; + private String softwareVersion; + private String unitFamily; + private String unitType; + private String vendorName; public Map getAdditionalFields() { return additionalFields; -- cgit 1.2.3-korg