diff options
14 files changed, 688 insertions, 451 deletions
diff --git a/Changelog.md b/Changelog.md index d2791db..bb6311f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [2.1.11] - 2022/11/09 + - [DCAEGEN2-3311](https://jira.onap.org/browse/DCAEGEN2-3311) - Modify ANR Payload aligned to A1 schema in SDNR + ## [2.1.10] - 2022/09/20 - [DCAEGEN2-3242](https://jira.onap.org/browse/DCAEGEN2-3242) - Fix bug in ConfigFectchFromCbs that fetch will get hung when policy config in pdp engine is empty - [DCAEGEN2-3265](https://jira.onap.org/browse/DCAEGEN2-3265) - Fix started up exception diff --git a/dpo/spec/sonhandler-componentspec.json b/dpo/spec/sonhandler-componentspec.json index 6805f0c..4f41d69 100644 --- a/dpo/spec/sonhandler-componentspec.json +++ b/dpo/spec/sonhandler-componentspec.json @@ -1,383 +1,391 @@ { - "self": { - "version": "1.0.0", - "name": "docker.sonhandler.app", - "description": "Handles the PCI optimization for SON network", - "component_type": "docker" - }, - "streams": { - "subscribes": [ - { - "format": "SON_INPUT_FROM_SDNR", - "version": "1.0.0", - "config_key": "nbr_list_change_topic", - "type": "message router" - }, - { - "format": "VES_specification", - "version": "7.30.1", - "config_key": "fault_management_topic", - "type": "message router" - }, - { - "format": "VES_specification", - "version": "7.30.1", - "config_key": "performance_management_topic", - "type": "message router" - }, - { - "format": "SON_OOF_ASYNC_RESP", - "version": "1.0.0", - "route": "/callbackUrl", - "type": "http" - }, + "self": { + "version": "1.0.0", + "name": "docker.sonhandler.app", + "description": "Handles the PCI optimization for SON network", + "component_type": "docker" + }, + "streams": { + "subscribes": [ + { + "format": "SON_INPUT_FROM_SDNR", + "version": "1.0.0", + "config_key": "nbr_list_change_topic", + "type": "message router" + }, + { + "format": "VES_specification", + "version": "7.30.1", + "config_key": "fault_management_topic", + "type": "message router" + }, + { + "format": "VES_specification", + "version": "7.30.1", + "config_key": "performance_management_topic", + "type": "message router" + }, + { + "format": "SON_OOF_ASYNC_RESP", + "version": "1.0.0", + "route": "/callbackUrl", + "type": "http" + }, { "format": "POLICY_TO_SON_DMAAP", "version": "1.0.0", "config_key": "CL_RSP_topic", "type": "message router" } - ], - "publishes": [ - { - "format": "SON_TO_POLICY_DMAAP", - "version": "1.0.0", - "config_key": "CL_topic", - "type": "message router" - } - ] - }, - "services": { - "calls": [ - { - "config_key": "oof-req", - "request": { - "format": "SON_TO_OOF_REST_REQ", - "version": "1.0.0" - }, - "response": { - "format": "SON_OOF_SYNC_RESP", - "version": "1.0.0" - } - }, - { - "config_key": "sdnr-getpnfname", - "request": { - "format": "CONFIGDB-REQ", - "version": "1.0.0" - }, - "response": { - "format": "PNFNAME_FROM_SDNR", - "version": "1.0.0" - } - }, - { - "config_key": "sdnr-getcelllist", - "request": { - "format": "CONFIGDB-REQ", - "version": "1.0.0" - }, - "response": { - "format": "CELLLIST_FROM_SDNR", - "version": "1.0.0" - } - }, - { - "config_key": "sdnr-getnbrlist", - "request": { - "format": "CONFIGDB-REQ", - "version": "1.0.0" - }, - "response": { - "format": "NBRLST_FROM_SDNR", - "version": "1.0.0" - } - }, - { - "config_key": "sdnr-getpci", - "request": { - "format": "CONFIGDB-REQ", - "version": "1.0.0" - }, - "response": { - "format": "PCI_FROM_SDNR", - "version": "1.0.0" - } - } - ], - "provides": [] - }, - "parameters": [ - { - "name": "postgres.username", - "value": "sonuser", - "description": "postgres config", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "postgres.password", - "value": "sonpassword", - "description": "postgres config", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "postgres.host", - "value": "10.165.160.148", - "description": "postgres config", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "postgres.port", - "value": "5432", - "description": "postgres config", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "cps.username", - "value": "cpsuser", - "description": "cps configuration", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "cps.password", - "value": "cpsr0cks!", - "description": "cps configuration", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "sonhandler.optimizers", - "value": [ - "pci" - ], - "description": "son handler optimizers list", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "sonhandler.buffertime", - "value": "60", - "description": "buffer time in seconds", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "sonhandler.numsolutions", - "value": "10", - "description": "number of solutions", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "sonhandler.maximumclusters", - "value": "5", - "description": "maximum number of clusters", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "sonhandler.cg", - "value": "sonhms-cg", - "description": "son consumer group", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "sonhandler.cid", - "value": "sonhms-cid", - "description": "son consumer Id", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "sonhandler.clientType", - "value": "ConfigDB", - "description": "Client type", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "sonhandler.dmaap.servers", - "value": [ - "message-router:3904" - ], - "description": "dmaap server location", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "sonhandler.pollingInterval", - "value": "20", - "description": "dmaap polling interval", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "sonhandler.pollingTimeout", - "value": "60", - "description": "dmaap polling timeout", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "sonhandler.minCollision", - "value": "5", - "description": "minimum collision count", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "sonhandler.minConfusion", - "value": "5", - "description": "minimum confusion count", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "sonhandler.configDb.service", - "value": "http://sdnc:8282", - "description": "configDb service url", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "sonhandler.cps.service.url", - "value": "http://cps-tbdmt:8080", - "description": "Cps service url", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "cps.get.celldata", - "value": "execute/cps-ran-schemaset/get-cell-list", - "description": "Cps get cell data url", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "cps.get.nbr.list.url", - "value": "execute/cps-ran-schemaset/get-nbr-list", - "description": "Cps get nbr list url", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "cps.get.pci.url", - "value": "execute/ran-network-schemaset/get-pci", - "description": "Cps get pci url", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "cps.get.pnf.url", - "value": "execute/ran-network-schemaset/get-pnf", - "description": "Cps get pnf url", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "sonhandler.oof.service", - "value": "http://oof:8080", - "description": "oof service url", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "sonhandler.sourceId", - "value": "SONHMS", - "description": "sonhms source ID", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "sonhandler.badThreshold", - "value": "50", - "description": "Threshold for bad neighbors", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "sonhandler.poorThreshold", - "value": "70", - "description": "Threshold for poor neighbors", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - }, - { - "name": "sonhandler.namespace", - "value": "onap", - "description": "namespace where MS will be deployed", - "sourced_at_deployment": false, - "policy_editable": false, - "designer_editable": false - } - ], - "auxilary": { - "healthcheck": { - "type": "http", - "interval": "15s", - "timeout": "1s", - "endpoint": "/healthckeck" - }, - "volumes": [ - { - "container": { - "bind": "/etc/localtime" - }, - "host": { - "path": "/etc/localtime" - } - }, - { - "container": { - "bind": "/var/log/onap" - }, - "host": { - "path": "/dockerdata-nfs/pci-handler/logs" - } - } - ], - "ports": [ - "8080:8080" - ] - }, - "artifacts": [ - { - "type": "docker image", - "uri": "k8s-rancher-1:5000/son-handler:1.0.1" - } - ] + ], + "publishes": [ + { + "format": "SON_TO_POLICY_DMAAP", + "version": "1.0.0", + "config_key": "CL_topic", + "type": "message router" + } + ] + }, + "services": { + "calls": [ + { + "config_key": "oof-req", + "request": { + "format": "SON_TO_OOF_REST_REQ", + "version": "1.0.0" + }, + "response": { + "format": "SON_OOF_SYNC_RESP", + "version": "1.0.0" + } + }, + { + "config_key": "sdnr-getpnfname", + "request": { + "format": "CONFIGDB-REQ", + "version": "1.0.0" + }, + "response": { + "format": "PNFNAME_FROM_SDNR", + "version": "1.0.0" + } + }, + { + "config_key": "sdnr-getcelllist", + "request": { + "format": "CONFIGDB-REQ", + "version": "1.0.0" + }, + "response": { + "format": "CELLLIST_FROM_SDNR", + "version": "1.0.0" + } + }, + { + "config_key": "sdnr-getnbrlist", + "request": { + "format": "CONFIGDB-REQ", + "version": "1.0.0" + }, + "response": { + "format": "NBRLST_FROM_SDNR", + "version": "1.0.0" + } + }, + { + "config_key": "sdnr-getpci", + "request": { + "format": "CONFIGDB-REQ", + "version": "1.0.0" + }, + "response": { + "format": "PCI_FROM_SDNR", + "version": "1.0.0" + } + } + ], + "provides": [] + }, + "parameters": [ + { + "name": "postgres.username", + "value": "sonuser", + "description": "postgres config", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "postgres.password", + "value": "sonpassword", + "description": "postgres config", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "postgres.host", + "value": "10.165.160.148", + "description": "postgres config", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "postgres.port", + "value": "5432", + "description": "postgres config", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "cps.username", + "value": "cpsuser", + "description": "cps configuration", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "cps.password", + "value": "cpsr0cks!", + "description": "cps configuration", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "sonhandler.optimizers", + "value": [ + "pci" + ], + "description": "son handler optimizers list", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "sonhandler.buffertime", + "value": "60", + "description": "buffer time in seconds", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "sonhandler.numsolutions", + "value": "10", + "description": "number of solutions", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "sonhandler.maximumclusters", + "value": "5", + "description": "maximum number of clusters", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "sonhandler.cg", + "value": "sonhms-cg", + "description": "son consumer group", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "sonhandler.cid", + "value": "sonhms-cid", + "description": "son consumer Id", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "sonhandler.clientType", + "value": "ConfigDB", + "description": "Client type", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "sonhandler.dmaap.servers", + "value": [ + "message-router:3904" + ], + "description": "dmaap server location", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "sonhandler.pollingInterval", + "value": "20", + "description": "dmaap polling interval", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "sonhandler.pollingTimeout", + "value": "60", + "description": "dmaap polling timeout", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "sonhandler.minCollision", + "value": "5", + "description": "minimum collision count", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "sonhandler.minConfusion", + "value": "5", + "description": "minimum confusion count", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "sonhandler.configDb.service", + "value": "http://sdnc:8282", + "description": "configDb service url", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "sonhandler.cps.service.url", + "value": "http://cps-tbdmt:8080", + "description": "Cps service url", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "sonhandler.nearRtricUrl", + "value": "https://10.31.4.43:30294/a1-policy/v2/policies", + "description": "Cps service url", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "cps.get.celldata", + "value": "execute/cps-ran-schemaset/get-cell-list", + "description": "Cps get cell data url", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "cps.get.nbr.list.url", + "value": "execute/cps-ran-schemaset/get-nbr-list", + "description": "Cps get nbr list url", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "cps.get.pci.url", + "value": "execute/ran-network-schemaset/get-pci", + "description": "Cps get pci url", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "cps.get.pnf.url", + "value": "execute/ran-network-schemaset/get-pnf", + "description": "Cps get pnf url", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "sonhandler.oof.service", + "value": "http://oof:8080", + "description": "oof service url", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "sonhandler.sourceId", + "value": "SONHMS", + "description": "sonhms source ID", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "sonhandler.badThreshold", + "value": "50", + "description": "Threshold for bad neighbors", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "sonhandler.poorThreshold", + "value": "70", + "description": "Threshold for poor neighbors", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "sonhandler.namespace", + "value": "onap", + "description": "namespace where MS will be deployed", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + } + ], + "auxilary": { + "healthcheck": { + "type": "http", + "interval": "15s", + "timeout": "1s", + "endpoint": "/healthckeck" + }, + "volumes": [ + { + "container": { + "bind": "/etc/localtime" + }, + "host": { + "path": "/etc/localtime" + } + }, + { + "container": { + "bind": "/var/log/onap" + }, + "host": { + "path": "/dockerdata-nfs/pci-handler/logs" + } + } + ], + "ports": [ + "8080:8080" + ] + }, + "artifacts": [ + { + "type": "docker image", + "uri": "k8s-rancher-1:5000/son-handler:1.0.1" + } + ] } @@ -29,7 +29,7 @@ <groupId>org.onap.dcaegen2.services.son-handler</groupId> <artifactId>son-handler</artifactId> <name>dcaegen2-services-son-handler</name> - <version>2.1.10-SNAPSHOT</version> + <version>2.1.11-SNAPSHOT</version> <!--parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.4.RELEASE</version> </parent --> diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/Configuration.java b/src/main/java/org/onap/dcaegen2/services/sonhms/Configuration.java index ce8e016..a2ed3c0 100644 --- a/src/main/java/org/onap/dcaegen2/services/sonhms/Configuration.java +++ b/src/main/java/org/onap/dcaegen2/services/sonhms/Configuration.java @@ -53,6 +53,7 @@ public class Configuration { private String getPciUrl; private String getPnfUrl; private String getRicIdUrl; + private String nearRtricUrl; private String oofService; private String oofEndpoint; private String cg; @@ -470,6 +471,14 @@ public class Configuration { return getRicIdUrl; } + public void setNearRtricUrl(String nearRtricUrl) { + this.nearRtricUrl = nearRtricUrl; + } + + public String getNearRtricUrl() { + return nearRtricUrl; + } + public static void setInstance(Configuration instance) { Configuration.instance = instance; } @@ -479,7 +488,7 @@ public class Configuration { return "Configuration [pgHost=" + pgHost + ", pgPort=" + pgPort + ", pgUsername=" + pgUsername + ", pgPassword=" + pgPassword + ", dmaapServers=" + dmaapServers + ", configDbService=" + configDbService + ", cpsServiceUrl=" + cpsServiceUrl + ", CpsUsername=" + CpsUsername + ",CpsPassword=" + CpsPassword + ",ConfigClientType=" + ConfigClientType + ", getCellDataUrl=" + getCellDataUrl + ", getNbrListUrl=" - + getNbrListUrl + ", getPciUrl=" + getPciUrl + ", getPnfUrl=" + getPnfUrl + ", getRicIdUrl=" + getRicIdUrl + ",oofService=" + oofService + ", oofEndpoint=" + oofEndpoint + ", cg=" + cg + ", cid=" + cid + + getNbrListUrl + ", getPciUrl=" + getPciUrl + ", getPnfUrl=" + getPnfUrl + ", getRicIdUrl=" + getRicIdUrl + ", nearRtricUrl=" + nearRtricUrl + ",oofService=" + oofService + ", oofEndpoint=" + oofEndpoint + ", cg=" + cg + ", cid=" + cid + ", pollingInterval=" + pollingInterval + ", pollingTimeout=" + pollingTimeout + ", minCollision=" + minCollision + ", minConfusion=" + minConfusion + ", sourceId=" + sourceId + ", callbackUrl=" + callbackUrl + ", pciOptimizer=" + pciOptimizer + ", pciAnrOptimizer=" + pciAnrOptimizer @@ -557,6 +566,7 @@ public class Configuration { getPnfUrl = jsonObject.get("cps.get.pnf.url").getAsString(); getPciUrl = jsonObject.get("cps.get.pci.url").getAsString(); getNbrListUrl = jsonObject.get("cps.get.nbr.list.url").getAsString(); + nearRtricUrl = jsonObject.get("sonhandler.nearRtricUrl").getAsString(); ConfigClientType = jsonObject.get("sonhandler.clientType").getAsString(); log.info("configuration from CBS {}", this); diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/PmNotificationHandler.java b/src/main/java/org/onap/dcaegen2/services/sonhms/PmNotificationHandler.java index a1127fe..ce50090 100644 --- a/src/main/java/org/onap/dcaegen2/services/sonhms/PmNotificationHandler.java +++ b/src/main/java/org/onap/dcaegen2/services/sonhms/PmNotificationHandler.java @@ -32,12 +32,14 @@ import java.util.List; import java.util.Map; import java.util.UUID; +import org.onap.dcaegen2.services.sonhms.Configuration; import org.onap.dcaegen2.services.sonhms.child.ChildThreadUtils; import org.onap.dcaegen2.services.sonhms.child.PnfUtils; import org.onap.dcaegen2.services.sonhms.dao.HandOverMetricsRepository; import org.onap.dcaegen2.services.sonhms.dmaap.PolicyDmaapClient; import org.onap.dcaegen2.services.sonhms.entity.HandOverMetrics; import org.onap.dcaegen2.services.sonhms.model.AdditionalMeasurements; +import org.onap.dcaegen2.services.sonhms.model.A1Payload; import org.onap.dcaegen2.services.sonhms.model.ANRPayload; import org.onap.dcaegen2.services.sonhms.model.CellConfig; import org.onap.dcaegen2.services.sonhms.model.Common; @@ -46,6 +48,7 @@ import org.onap.dcaegen2.services.sonhms.model.Data; import org.onap.dcaegen2.services.sonhms.model.FapService; import org.onap.dcaegen2.services.sonhms.model.Flag; import org.onap.dcaegen2.services.sonhms.model.HoDetails; +import org.onap.dcaegen2.services.sonhms.model.Input; import org.onap.dcaegen2.services.sonhms.model.Lte; import org.onap.dcaegen2.services.sonhms.model.LteCell; import org.onap.dcaegen2.services.sonhms.model.NeighborListInUse; @@ -65,6 +68,7 @@ public class PmNotificationHandler { private static Logger log = LoggerFactory.getLogger(PmNotificationHandler.class); PolicyDmaapClient policyDmaapClient; + Configuration configuration = Configuration.getInstance(); public PmNotificationHandler() { @@ -108,7 +112,7 @@ public class PmNotificationHandler { .getAdditionalMeasurements()) { int attemptsCount = Integer.parseInt(additionalMeasurements.getHashMap().get("InterEnbOutAtt_X2HO")); int successCount = Integer.parseInt(additionalMeasurements.getHashMap().get("InterEnbOutSucc_X2HO")); - int successRate = (int)((float) successCount / attemptsCount) * 100; + int successRate = (int)(((float) successCount / attemptsCount) * 100); Neighbours neighbourCell = new Neighbours(); neighbourCell.setHoKpi(successRate); @@ -158,21 +162,25 @@ public class PmNotificationHandler { ObjectMapper mapper = new ObjectMapper(); try { mapper.setSerializationInclusion(Include.NON_NULL); + String nearRtricUrl = configuration.getNearRtricUrl(); String cellId = pmNotification.getEvent().getCommonEventHeader().getSourceName(); String pnfName = pmNotification.getEvent().getCommonEventHeader().getReportingEntityName(); String plmnId = pmNotification.getEvent().getMeasurementFields() .getAdditionalMeasurements().get(0).getHashMap().get("networkId"); - String ric_id = CpsClient.getRicId(cellId); - ANRPayload payload = new ANRPayload("CreatePolicy",1,1,ric_id, - (new PolicyData(pnfName,plmnId,cellId,neighbourList))); - log.info("payload : {}", payload); + UUID uuid = UUID.randomUUID(); + + A1Payload payload = new A1Payload(new Input(nearRtricUrl, + new ANRPayload(uuid.toString(),"ANR","a1-terminator", + new PolicyData(pnfName,plmnId,cellId,neighbourList),"",false,""))); + String anrUpdateString = mapper.writeValueAsString(payload); + log.info("After converting A1Paylod to String: " + anrUpdateString); ChildThreadUtils childUtils = new ChildThreadUtils(ConfigPolicy.getInstance(), new PnfUtils(), new PolicyDmaapClient(new DmaapUtils(), Configuration.getInstance()), new HoMetricsComponent()); String requestId = UUID.randomUUID().toString(); String notification = childUtils.getNotificationString( pmNotification.getEvent().getCommonEventHeader().getReportingEntityName(), requestId, - anrUpdateString, System.currentTimeMillis(), "ModifyA1Policy"); + anrUpdateString, System.currentTimeMillis(), "putA1Policy"); log.info("Policy Notification: {}", notification); Boolean result = policyDmaapClient.sendNotificationToPolicy(notification); log.info("send notification to policy result {} ", result); @@ -201,3 +209,4 @@ public class PmNotificationHandler { return true; } } + diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/child/ChildThreadUtils.java b/src/main/java/org/onap/dcaegen2/services/sonhms/child/ChildThreadUtils.java index 61653cf..524fabc 100644 --- a/src/main/java/org/onap/dcaegen2/services/sonhms/child/ChildThreadUtils.java +++ b/src/main/java/org/onap/dcaegen2/services/sonhms/child/ChildThreadUtils.java @@ -275,7 +275,7 @@ public class ChildThreadUtils { } String requestId = UUID.randomUUID().toString(); String notification = getNotificationString(pnfName, requestId, payloadString, - System.currentTimeMillis(), "ModifyA1Policy"); + System.currentTimeMillis(), "putA1Policy"); log.info("Policy Notification: {}", notification); Boolean result = policyDmaapClient.sendNotificationToPolicy(notification); log.info("send notification to policy result {} ", result); diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/model/A1Payload.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/A1Payload.java new file mode 100644 index 0000000..51764ae --- /dev/null +++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/A1Payload.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * son-handler + * ================================================================================ + * Copyright (C) 2022 Wipro Limited. + * ============================================================================== + * 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.dcaegen2.services.sonhms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +public class A1Payload { + + @JsonProperty("input") + private Input input; + + public A1Payload() { + + } + + public A1Payload(Input input) { + super(); + this.input = input; + } + + public Input getInput() { + return input; + } + + public void setInput(Input input) { + this.input = input; + } + + @Override + public String toString() { + return "Payload [input=" + input + "]"; + + } + +} diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/model/ANRPayload.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/ANRPayload.java index c8ff5e4..0debdad 100644 --- a/src/main/java/org/onap/dcaegen2/services/sonhms/model/ANRPayload.java +++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/ANRPayload.java @@ -31,85 +31,141 @@ import java.util.List; public class ANRPayload { - @JsonProperty("action") - private String action; + @JsonProperty("policy_id") + private String policy_id; - @JsonProperty("policy_id") - private int policy_id; + @JsonProperty("policytype_id") + private String policy_type_id; - @JsonProperty("policy_type_id") - private int policy_type_id; + @JsonProperty("ric_id") + private String ric_id; - @JsonProperty("ric_id") - private String ric_id; + @JsonProperty("policy_data") + private PolicyData policy_data; - @JsonProperty("policy_data") - private PolicyData policy_data; + @JsonProperty("service_id") + private String service_id; - /** - * Constructor - */ + @JsonProperty("transient") + private boolean transient1; - public ANRPayload() { + @JsonProperty("status_notification_uri") + private String status; - } + /** + * Constructor + */ - /** - * Constructor - */ + public ANRPayload() { - public ANRPayload(String action, int policy_id, int policy_type_id, String ric_id, PolicyData policy_data) { - super(); - this.action = action; - this.policy_id = policy_id; - this.policy_type_id = policy_type_id; - this.ric_id = ric_id; - this.policy_data=policy_data; - } + } - public String getAction() { - return action; - } + - public void setAction(String action) { - this.action = action; - } + public ANRPayload(String policy_id, String policy_type_id, String ric_id, PolicyData policy_data, + String service_id, boolean transient1, String status) { + super(); + this.policy_id = policy_id; + this.policy_type_id = policy_type_id; + this.ric_id = ric_id; + this.policy_data = policy_data; + this.service_id = service_id; + this.transient1 = transient1; + this.status = status; + } - public int getPolicyId(){ - return policy_id; - } - public void setPolicyId(int policy_id){ - this.policy_id = policy_id; - } + public String getPolicy_id() { + return policy_id; + } - public int getPolicyTypeId(){ - return policy_type_id; - } - public void setPolicyTypeId(int policy_type_id){ - this.policy_type_id = policy_type_id; - } - public String getRicId(){ - return ric_id; - } + public void setPolicy_id(String policy_id) { + this.policy_id = policy_id; + } - public void setRicId(String ric_id){ - this.ric_id = ric_id; - } - public PolicyData getPolicyData(){ - return policy_data; - } - public void setPolicyData(PolicyData policy_data){ - this.policy_data = policy_data; - } + public String getPolicy_type_id() { + return policy_type_id; + } - @Override - public String toString() { - return "Payload [=" + action + "]"; - } + + public void setPolicy_type_id(String policy_type_id) { + this.policy_type_id = policy_type_id; + } + + + + public String getRic_id() { + return ric_id; + } + + + + public void setRic_id(String ric_id) { + this.ric_id = ric_id; + } + + + + public PolicyData getPolicy_data() { + return policy_data; + } + + + + public void setPolicy_data(PolicyData policy_data) { + this.policy_data = policy_data; + } + + + + public String getService_id() { + return service_id; + } + + + + public void setService_id(String service_id) { + this.service_id = service_id; + } + + + + public boolean isTransient1() { + return transient1; + } + + + + public void setTransient1(boolean transient1) { + this.transient1 = transient1; + } + + + + public String getStatus() { + return status; + } + + + + public void setStatus(String status) { + this.status = status; + } + + + + @Override + public String toString() { + return "ANRPayload [ policy_id=" + policy_id + ", policy_type_id=" + policy_type_id + + ", ric_id=" + ric_id + ", policy_data=" + policy_data + ", service_id=" + service_id + ", transient1=" + + transient1 + ", status=" + status + "]"; + } + + } + diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/model/Input.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/Input.java new file mode 100644 index 0000000..e0df78a --- /dev/null +++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/Input.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * son-handler + * ================================================================================ + * Copyright (C) 2022 Wipro Limited. + * ============================================================================== + * 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.dcaegen2.services.sonhms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Input { + + @JsonProperty(value = "near-rt-ric-url") + private String url; + + @JsonProperty("body") + private ANRPayload anrPayload; + + public Input() { + + } + + /** + * Parameterized constructor. + */ + public Input(String url, ANRPayload anrPayload) { + super(); + this.url = url; + this.anrPayload = anrPayload; + } + + + public String getUrl() { + return url; + } + + + public void setUrl(String url) { + this.url = url; + } + + public ANRPayload getAnrPayload(){ + return anrPayload; + } + + public void setAnrPayload(ANRPayload anrPayload){ + this.anrPayload = anrPayload; + } + + @Override + public String toString() { + return "Input [url=" + url + ", anrPayload=" + anrPayload + "]"; + } +} + diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/model/Neighbours.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/Neighbours.java index 73c3cd5..f38ccaa 100644 --- a/src/main/java/org/onap/dcaegen2/services/sonhms/model/Neighbours.java +++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/Neighbours.java @@ -88,7 +88,14 @@ public class Neighbours { } public void setHoKpi(int hoKpi) { - this.hoKpi = hoKpi; + this.hoKpi = hoKpi; + } + + @Override + public String toString() { + return "Neighbours [pnfName=" + pnfName + ", plmnId=" + plmnId + ", cellId=" + cellId + ", hoKpi=" + hoKpi + + "]"; } } + diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/model/PolicyData.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/PolicyData.java index ff5b48e..6eec6a5 100644 --- a/src/main/java/org/onap/dcaegen2/services/sonhms/model/PolicyData.java +++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/PolicyData.java @@ -86,4 +86,14 @@ public class PolicyData { this.neighbours=neighbours; } + @Override + public String toString() { + return "PolicyData [pnfName=" + pnfName + ", plmnId=" + plmnId + ", cellId=" + cellId + ", neighbours=" + + neighbours + "]"; + } + + + + } + diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClient.java b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClient.java index caf94f1..2fa9514 100644 --- a/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClient.java +++ b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClient.java @@ -139,14 +139,20 @@ public class CpsClient extends ConfigInterface { public static String getRicId(String cellId) throws CpsNotFoundException { Configuration configuration = Configuration.getInstance(); + String responseObject = ""; String requestUrl = configuration.getCpsServiceUrl() + "/" + configuration.getGetRicIdUrl(); JSONObject inputparam = new JSONObject(); JSONObject reqbody = new JSONObject(); inputparam.put("cellId", cellId); reqbody.put("inputParameters", inputparam); String response = sendRequest(requestUrl, reqbody); - JSONObject responseObject = new JSONObject(response); - return responseObject.getString("idNearRTRIC"); + log.info("Response from CPS is : " + response); + JSONArray requestArray = new JSONArray(response); + for (int i=0;i<requestArray.length();i++) { + String ricId = requestArray.getJSONObject(i).optString("idNearRTRIC"); + responseObject = ricId; + } + return responseObject; } /** diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClientTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClientTest.java index 4d8713a..6b6c94d 100644 --- a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClientTest.java +++ b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClientTest.java @@ -153,7 +153,7 @@ public class CpsClientTest { @Test public void getRicIdTest() { - String responseBody = "{\"idNearRTRIC\":\"22\"}"; + String responseBody = "[{\"idNearRTRIC\":\"22\"}]"; PowerMockito.mockStatic(SonHandlerRestTemplate.class); PowerMockito.mockStatic(Configuration.class); PowerMockito.when(Configuration.getInstance()).thenReturn(configuration); @@ -164,8 +164,10 @@ public class CpsClientTest { try { String result = cps.getRicId("1"); String response = ResponseEntity.ok(responseBody).getBody(); - JSONObject respObj = new JSONObject(response); - assertEquals(respObj.get("idNearRTRIC"), result); + JSONArray requestArray = new JSONArray(response); + for (int i=0;i<requestArray.length();i++) { + assertEquals(requestArray.getJSONObject(i).getString("idNearRTRIC"), result); + } } catch (CpsNotFoundException e) { log.debug("CpsNotFoundException {}", e.toString()); } diff --git a/version.properties b/version.properties index bc9110f..eeb484b 100644 --- a/version.properties +++ b/version.properties @@ -21,7 +21,7 @@ ############################################################################### major=2 minor=1 -patch=10 +patch=11 base_version=${major}.${minor}.${patch} release_version=${base_version} snapshot_version=${base_version}-SNAPSHOT |