diff options
author | Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> | 2021-06-16 10:22:36 +0530 |
---|---|---|
committer | Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> | 2021-06-16 10:23:34 +0530 |
commit | 17fd7d683b0b38a401481ae85cc5927679e20ce3 (patch) | |
tree | 03431a5ebf320e1c6efd3e6f5aef0b3029227a3d /sdnr/wt/devicemanager-core | |
parent | 17614362f2550c29dcd746ee2c1bc01d0df5de65 (diff) |
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 <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/devicemanager-core')
6 files changed, 23 insertions, 140 deletions
diff --git a/sdnr/wt/devicemanager-core/installer/pom.xml b/sdnr/wt/devicemanager-core/installer/pom.xml index 33067af4e..40d93634c 100755 --- a/sdnr/wt/devicemanager-core/installer/pom.xml +++ b/sdnr/wt/devicemanager-core/installer/pom.xml @@ -47,7 +47,7 @@ <dependencies> <dependency> - <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <groupId>${project.groupId}</groupId> <artifactId>${application.name}-feature</artifactId> <version>${project.version}</version> <type>xml</type> @@ -60,7 +60,7 @@ </exclusions> </dependency> <dependency> - <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <groupId>${project.groupId}</groupId> <artifactId>${application.name}-provider</artifactId> <version>${project.version}</version> </dependency> diff --git a/sdnr/wt/devicemanager-core/model/pom.xml b/sdnr/wt/devicemanager-core/model/pom.xml index 3de24156c..21aebf6c9 100644 --- a/sdnr/wt/devicemanager-core/model/pom.xml +++ b/sdnr/wt/devicemanager-core/model/pom.xml @@ -57,18 +57,18 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <groupId>${project.groupId}</groupId> <artifactId>sdnr-wt-data-provider-model</artifactId> <version>${project.version}</version> <scope>provided</scope> </dependency> <dependency> - <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <groupId>${project.groupId}</groupId> <artifactId>sdnr-wt-websocketmanager-model</artifactId> <version>${project.version}</version> </dependency> <dependency> - <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <groupId>${project.groupId}</groupId> <artifactId>sdnr-wt-netconfnode-state-service-model</artifactId> <version>${project.version}</version> <scope>provided</scope> 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<N extends Notification,F extends Notification,T extends Notification> { - - /** - * 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<String, Object> innerEvent = new HashMap<String, Object>(); - innerEvent.put("commonEventHeader", commonEventHeader); - innerEvent.put("notificationFields", notifFields); - - Map<String, Object> outerEvent = new HashMap<String, Object>(); - 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<String, Object> innerEvent = new HashMap<String, Object>(); - innerEvent.put("commonEventHeader", commonEventHeader); - innerEvent.put("faultFields", faultFields); - - Map<String, Object> outerEvent = new HashMap<String, Object>(); - 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<String, String> additionalFields = new HashMap<String, String>(); - 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<String, String> getAdditionalFields() { return additionalFields; diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/VESCollectorServiceImpl.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/VESCollectorServiceImpl.java index 47ac9c785..f1538fbff 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/VESCollectorServiceImpl.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/VESCollectorServiceImpl.java @@ -197,7 +197,7 @@ public class VESCollectorServiceImpl implements VESCollectorService, IConfigChan public VESMessage generateVESEvent(VESCommonEventHeaderPOJO commonEventHeader, VESPNFRegistrationFieldsPOJO pnfRegistrationFields) throws JsonProcessingException { Map<String, Object> innerEvent = new HashMap<String, Object>(); innerEvent.put("commonEventHeader", commonEventHeader); - innerEvent.put("pnfRegistration", pnfRegistrationFields); + innerEvent.put("pnfRegistrationFields", pnfRegistrationFields); Map<String, Object> outerEvent = new HashMap<String, Object>(); outerEvent.put("event", innerEvent); |