diff options
-rw-r--r-- | Changelog.md | 4 | ||||
-rw-r--r-- | dpo/spec/sonhandler-componentspec.json | 8 | ||||
-rw-r--r-- | pom.xml | 4 | ||||
-rw-r--r-- | src/main/java/org/onap/dcaegen2/services/sonhms/Configuration.java | 51 | ||||
-rw-r--r-- | src/main/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClient.java | 23 | ||||
-rw-r--r-- | src/main/java/org/onap/dcaegen2/services/sonhms/restclient/SdnrRestClient.java | 16 | ||||
-rw-r--r-- | src/test/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClientTest.java | 19 | ||||
-rw-r--r-- | version.properties | 4 |
8 files changed, 75 insertions, 54 deletions
diff --git a/Changelog.md b/Changelog.md index 5a0864b..caaf6b4 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,10 @@ 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.6] - 2022/02/07 + - [DCAEGEN2-3057](https://jira.onap.org/browse/DCAEGEN2-3057) - Fix bug in triggering control loop for PCI collision/confusion - by replacing Config DB with CPS + ## [2.1.5] - 2021/10/14 - [DCAEGEN2-2943](https://jira.onap.org/browse/DCAEGEN2-2943) - Fix bug in filtering new FM notification diff --git a/dpo/spec/sonhandler-componentspec.json b/dpo/spec/sonhandler-componentspec.json index 4133c73..6805f0c 100644 --- a/dpo/spec/sonhandler-componentspec.json +++ b/dpo/spec/sonhandler-componentspec.json @@ -273,7 +273,7 @@ "designer_editable": false }, { - "name": "sonhandler.get.cell.data.url", + "name": "cps.get.celldata", "value": "execute/cps-ran-schemaset/get-cell-list", "description": "Cps get cell data url", "sourced_at_deployment": false, @@ -281,7 +281,7 @@ "designer_editable": false }, { - "name": "sonhandler.get.nbr.list.url", + "name": "cps.get.nbr.list.url", "value": "execute/cps-ran-schemaset/get-nbr-list", "description": "Cps get nbr list url", "sourced_at_deployment": false, @@ -289,7 +289,7 @@ "designer_editable": false }, { - "name": "sonhandler.get.pci.url", + "name": "cps.get.pci.url", "value": "execute/ran-network-schemaset/get-pci", "description": "Cps get pci url", "sourced_at_deployment": false, @@ -297,7 +297,7 @@ "designer_editable": false }, { - "name": "sonhandler.get.pnf.url", + "name": "cps.get.pnf.url", "value": "execute/ran-network-schemaset/get-pnf", "description": "Cps get pnf url", "sourced_at_deployment": false, @@ -4,7 +4,7 @@ * ============LICENSE_START======================================================= * son-handler * ================================================================================ - * Copyright (C) 2019-2021 Wipro Limited. + * Copyright (C) 2019-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. @@ -27,7 +27,7 @@ <groupId>org.onap.dcaegen2.services.son-handler</groupId> <artifactId>son-handler</artifactId> <name>dcaegen2-services-son-handler</name> - <version>2.1.5-SNAPSHOT</version> + <version>2.1.6-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 2ddeaa6..1824e92 100644 --- a/src/main/java/org/onap/dcaegen2/services/sonhms/Configuration.java +++ b/src/main/java/org/onap/dcaegen2/services/sonhms/Configuration.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * son-handler * ================================================================================ - * Copyright (C) 2019-2021 Wipro Limited. + * Copyright (C) 2019-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. @@ -390,28 +390,28 @@ public class Configuration { } public int getPolicyNegativeAckThreshold() { - return policyNegativeAckThreshold; - } + return policyNegativeAckThreshold; + } - public void setPolicyNegativeAckThreshold(int policyNegativeAckThreshold) { - this.policyNegativeAckThreshold = policyNegativeAckThreshold; - } + public void setPolicyNegativeAckThreshold(int policyNegativeAckThreshold) { + this.policyNegativeAckThreshold = policyNegativeAckThreshold; + } - public long getPolicyFixedPciTimeInterval() { - return policyFixedPciTimeInterval; - } + public long getPolicyFixedPciTimeInterval() { + return policyFixedPciTimeInterval; + } - public void setPolicyFixedPciTimeInterval(long policyFixedPciTimeInterval) { - this.policyFixedPciTimeInterval = policyFixedPciTimeInterval; - } + public void setPolicyFixedPciTimeInterval(long policyFixedPciTimeInterval) { + this.policyFixedPciTimeInterval = policyFixedPciTimeInterval; + } - public String getNfNamingCode() { - return nfNamingCode; - } + public String getNfNamingCode() { + return nfNamingCode; + } - public void setNfNamingCode(String nfNamingCode) { - this.nfNamingCode = nfNamingCode; - } + public void setNfNamingCode(String nfNamingCode) { + this.nfNamingCode = nfNamingCode; + } public static Logger getLog() { return log; @@ -465,13 +465,6 @@ public class Configuration { Configuration.instance = instance; } - public ConfigInterface getConfigurationClient() - { - ConfigInterface conf = ConfigurationClient.configClient(Configuration.getInstance().getConfigClientType()); - log.info("ConfigurationClient obj is : " + conf); - return conf; - } - @Override public String toString() { return "Configuration [pgHost=" + pgHost + ", pgPort=" + pgPort + ", pgUsername=" + pgUsername + ", pgPassword=" @@ -554,12 +547,18 @@ public class Configuration { getCellDataUrl = jsonObject.get("cps.get.celldata").getAsString(); 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(); ConfigClientType = jsonObject.get("sonhandler.clientType").getAsString(); log.info("configuration from CBS {}", this); } - + public ConfigInterface getConfigurationClient() + { + ConfigInterface conf = ConfigurationClient.configClient(Configuration.getInstance().getConfigClientType()); + log.info("ConfigurationClient obj is : " + conf); + return conf; + } } 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 f19c9e8..282fe91 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * son-handler * ================================================================================ - * Copyright (C) 2021 Wipro Limited. + * Copyright (C) 2021-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. @@ -65,9 +65,10 @@ public class CpsClient extends ConfigInterface { reqbody.put("inputParameters", inputparam); log.debug("request url: {}", requestUrl); String response = sendRequest(requestUrl, reqbody); + log.info("Response from CPS is : " + response); List<CellPciPair> nbrList = new ArrayList<>(); - - JSONArray nbrListObj = new JSONArray(response); + JSONObject responseJson = new JSONObject(response); + JSONArray nbrListObj = responseJson.getJSONArray("NRCellRelation"); for (int i = 0; i < nbrListObj.length(); i++) { JSONObject cellObj = nbrListObj.getJSONObject(i); JSONObject obj = cellObj.getJSONObject("attributes"); @@ -95,8 +96,11 @@ public class CpsClient extends ConfigInterface { inputparam.put("cellId", cellId); reqbody.put("inputParameters", inputparam); String response = sendRequest(requestUrl, reqbody); + log.info("Response from CPS is : " + response); JSONObject respObj = new JSONObject(response); - return respObj.getInt("value"); + int obj = respObj.getInt("nRPCI"); + log.info("The nRPCI value is " + obj ); + return respObj.getInt("nRPCI"); } /** @@ -107,14 +111,20 @@ public class CpsClient extends ConfigInterface { @Override public String getPnfName(String cellId) throws CpsNotFoundException { Configuration configuration = Configuration.getInstance(); + String responseObject = ""; String requestUrl = configuration.getCpsServiceUrl() + "/" + configuration.getGetPnfUrl(); 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("value"); + log.info("Response from CPS is : " + response); + JSONArray requestArray = new JSONArray(response); + for (int i=0;i<requestArray.length();i++) { + String pnfName = requestArray.getJSONObject(i).optString("idGNBCUCPFunction"); + responseObject = pnfName; + } + return responseObject; } /** @@ -132,6 +142,7 @@ public class CpsClient extends ConfigInterface { inputparam.put("cellId", cellId); reqbody.put("inputParameters", inputparam); String response = sendRequest(requestUrl, reqbody); + log.info("Response from CPS is : " + response); JSONObject responseObject = new JSONObject(response); return responseObject; } diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/SdnrRestClient.java b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/SdnrRestClient.java index 9a05b88..b085aeb 100644 --- a/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/SdnrRestClient.java +++ b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/SdnrRestClient.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * son-handler * ================================================================================ - * Copyright (C) 2019-2021 Wipro Limited. + * Copyright (C) 2019-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. @@ -66,6 +66,7 @@ public class SdnrRestClient extends ConfigInterface { + "/" + ts; log.debug("request url: {}", requestUrl); String response = sendRequest(requestUrl); + log.info("Response from configdb getNbrList is : " + response); List<CellPciPair> nbrList = new ArrayList<>(); JSONObject responseJson = new JSONObject(response); JSONArray nbrListObj = responseJson.getJSONArray("nbrList"); @@ -94,6 +95,7 @@ public class SdnrRestClient extends ConfigInterface { String requestUrl = configuration.getConfigDbService() + "/api/sdnc-config-db/v3/getPCI" + "/" + cellId + "/" + ts; String response = sendRequest(requestUrl); + log.info("Response from configdb getPci is : " + response); JSONObject respObj = new JSONObject(response); return respObj.getInt("value"); } @@ -112,6 +114,7 @@ public class SdnrRestClient extends ConfigInterface { String requestUrl = configuration.getConfigDbService() + "/api/sdnc-config-db/v3/getPnfId" + "/" + cellId + "/" + ts; String response = sendRequest(requestUrl); + log.info("Response from configdb getPnfName is : " + response); JSONObject responseObject = new JSONObject(response); return responseObject.getString("value"); } @@ -125,11 +128,12 @@ public class SdnrRestClient extends ConfigInterface { @Override public JSONObject getCellData(String cellId) throws ConfigDbNotFoundException { - Configuration configuration = Configuration.getInstance(); - String requestUrl = configuration.getConfigDbService() + "/api/sdnc-config-db/v3/getCell" + "/" + cellId; - String response = sendRequest(requestUrl); - JSONObject responseObject = new JSONObject(response); - return responseObject; + Configuration configuration = Configuration.getInstance(); + String requestUrl = configuration.getConfigDbService() + "/api/sdnc-config-db/v3/getCell" + "/" + cellId; + String response = sendRequest(requestUrl); + log.info("Response from configdb getCellData is : " + response); + JSONObject responseObject = new JSONObject(response); + 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 a531b4d..e43a635 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * son-handler * ================================================================================ - * Copyright (C) 2021 Wipro Limited. + * Copyright (C) 2021-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. @@ -103,7 +103,7 @@ public class CpsClientTest { @Test public void getPciTest() { - String responseBody = "{\n" + " \"attribute-name\": \"string\",\n" + " \"value\": 0\n" + "}"; + String responseBody = "{\n" + " \"nRPCI\": \"11\",\n" + " \"value\": 0\n" + "}"; PowerMockito.mockStatic(SonHandlerRestTemplate.class); PowerMockito.mockStatic(Configuration.class); PowerMockito.when(Configuration.getInstance()).thenReturn(configuration); @@ -116,7 +116,7 @@ public class CpsClientTest { int result = cps.getPci("1"); String response = ResponseEntity.ok(responseBody).getBody(); JSONObject respObj = new JSONObject(response); - assertEquals(respObj.getInt("value"), result); + assertEquals(respObj.getInt("nRPCI"), result); } catch (CpsNotFoundException e) { log.debug("CpsNotFoundException {}", e.toString()); ; @@ -127,7 +127,7 @@ public class CpsClientTest { @Test public void getPnfNameTest() { - String responseBody = "{\n" + " \"attribute-name\": \"string\",\n" + " \"value\": \"string\"\n" + "}"; + String responseBody = "[{\n" + " \"idGNBCUCPFunction\": \"cucpserver1\",\n" + " \"value\": \"string\"\n" + "}]"; PowerMockito.mockStatic(SonHandlerRestTemplate.class); PowerMockito.mockStatic(Configuration.class); PowerMockito.when(Configuration.getInstance()).thenReturn(configuration); @@ -136,10 +136,13 @@ public class CpsClientTest { Matchers.<ParameterizedTypeReference<String>>any())) .thenReturn(ResponseEntity.ok(responseBody)); try { - String result = cps.getPnfName("1"); + String result = cps.getPnfName("cucpserver1"); String response = ResponseEntity.ok(responseBody).getBody(); - JSONObject respObj = new JSONObject(response); - assertEquals(respObj.getString("value"), result); + + JSONArray requestArray = new JSONArray(response); + for (int i=0;i<requestArray.length();i++) { + assertEquals(requestArray.getJSONObject(i).getString("idGNBCUCPFunction"), result); + } } catch (CpsNotFoundException e) { log.debug("CpsNotFoundException {}", e.toString()); ; @@ -168,4 +171,4 @@ public class CpsClientTest { } -}
\ No newline at end of file +} diff --git a/version.properties b/version.properties index 1d2b98e..01f80e6 100644 --- a/version.properties +++ b/version.properties @@ -2,7 +2,7 @@ # ============LICENSE_START======================================================= # son-handler # ================================================================================ -# Copyright (C) 2019-2020 Wipro Limited. +# Copyright (C) 2019-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. @@ -20,7 +20,7 @@ ############################################################################### major=2 minor=1 -patch=5 +patch=6 base_version=${major}.${minor}.${patch} release_version=${base_version} snapshot_version=${base_version}-SNAPSHOT |