diff options
Diffstat (limited to 'dcae-analytics/dcae-analytics-web/src')
2 files changed, 54 insertions, 58 deletions
diff --git a/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/spring/ConfigBindingServiceEnvironmentPostProcessor.java b/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/spring/ConfigBindingServiceEnvironmentPostProcessor.java index 8798b4e..b809858 100644 --- a/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/spring/ConfigBindingServiceEnvironmentPostProcessor.java +++ b/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/spring/ConfigBindingServiceEnvironmentPostProcessor.java @@ -1,6 +1,7 @@ /* * ================================================================================ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (c) 2019-2020 China Mobile. 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. @@ -234,7 +235,6 @@ public class ConfigBindingServiceEnvironmentPostProcessor implements Environment configServiceJsonOptional = Optional.of(jsonConfig.toString()); policies = jsonConfig.getAsJsonObject().get(ConfigBindingServiceConstants.POLICIES) .getAsJsonObject().getAsJsonArray(ConfigBindingServiceConstants.ITEMS).get(0) - .getAsJsonObject().get(ConfigBindingServiceConstants.CONFIG) .getAsJsonObject().get(ConfigBindingServiceConstants.TCAPOLICY).toString(); } else { configServiceJsonOptional = Optional.of(jsonObject.toString()); @@ -245,7 +245,7 @@ public class ConfigBindingServiceEnvironmentPostProcessor implements Environment Map<String, Object> configPropertiesMap = configServiceJsonOptional .map(new JsonStringToMapFunction(configServicePropertiesKey)).orElse(Collections.emptyMap()); if (policies != null) { - configPropertiesMap.put(ConfigBindingServiceConstants.CONFIG_POLICIES, policies); + configPropertiesMap.put(ConfigBindingServiceConstants.POLICY, policies); } if (configPropertiesMap.isEmpty()) { diff --git a/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/spring/ConfigBindingServiceEnvironmentPostProcessorTest.java b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/spring/ConfigBindingServiceEnvironmentPostProcessorTest.java index 5e97765..e07c83d 100644 --- a/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/spring/ConfigBindingServiceEnvironmentPostProcessorTest.java +++ b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/spring/ConfigBindingServiceEnvironmentPostProcessorTest.java @@ -219,34 +219,32 @@ public class ConfigBindingServiceEnvironmentPostProcessorTest extends BaseAnalyt " \"items\": [{\r\n" + " \"policyName\": \"onap.vfirewall.tca.1-0-0.xml\",\r\n" + " \"name\": \"onap.vfirewall.tca\",\r\n" + - " \"config\": {\r\n" + - " \"tca.policy\": {\r\n" + - " \"domain\": \"measurementsForVfScaling\",\r\n" + - " \"metricsPerEventName\": [{\r\n" + - " \"policyName\": \"onap.vfirewall.tca\",\r\n" + - " \"policyScope\": \"resource=vLoadBalancer;type=configuration\",\r\n" + - " \"thresholds\": [{\r\n" + - " \"direction\": \"LESS_OR_EQUAL\",\r\n" + - " \"severity\": \"MAJOR\",\r\n" + - " \"closedLoopControlName\": \"VVK_ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\r\n" + - " \"fieldPath\": \"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\",\r\n" + - " \"version\": \"1.0.2\",\r\n" + - " \"closedLoopEventStatus\": \"ONSET\",\r\n" + - " \"thresholdValue\": 500\r\n" + - " }, {\r\n" + - " \"direction\": \"GREATER_OR_EQUAL\",\r\n" + - " \"severity\": \"CRITICAL\",\r\n" + - " \"closedLoopControlName\": \"VVK_ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\r\n" + - " \"fieldPath\": \"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\",\r\n" + - " \"version\": \"1.0.2\",\r\n" + - " \"closedLoopEventStatus\": \"ONSET\",\r\n" + - " \"thresholdValue\": 5000\r\n" + - " }],\r\n" + - " \"eventName\": \"vLoadBalancer\",\r\n" + - " \"controlLoopSchemaType\": \"VNF\",\r\n" + - " \"policyVersion\": \"v0.0.1\"\r\n" + - " }]\r\n" + - " }\r\n" + + " \"tca.policy\": {\r\n" + + " \"domain\": \"measurementsForVfScaling\",\r\n" + + " \"metricsPerEventName\": [{\r\n" + + " \"policyName\": \"onap.vfirewall.tca\",\r\n" + + " \"policyScope\": \"resource=vLoadBalancer;type=configuration\",\r\n" + + " \"thresholds\": [{\r\n" + + " \"direction\": \"LESS_OR_EQUAL\",\r\n" + + " \"severity\": \"MAJOR\",\r\n" + + " \"closedLoopControlName\": \"VVK_ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\r\n" + + " \"fieldPath\": \"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\",\r\n" + + " \"version\": \"1.0.2\",\r\n" + + " \"closedLoopEventStatus\": \"ONSET\",\r\n" + + " \"thresholdValue\": 500\r\n" + + " }, {\r\n" + + " \"direction\": \"GREATER_OR_EQUAL\",\r\n" + + " \"severity\": \"CRITICAL\",\r\n" + + " \"closedLoopControlName\": \"VVK_ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\r\n" + + " \"fieldPath\": \"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\",\r\n" + + " \"version\": \"1.0.2\",\r\n" + + " \"closedLoopEventStatus\": \"ONSET\",\r\n" + + " \"thresholdValue\": 5000\r\n" + + " }],\r\n" + + " \"eventName\": \"vLoadBalancer\",\r\n" + + " \"controlLoopSchemaType\": \"VNF\",\r\n" + + " \"policyVersion\": \"v0.0.1\"\r\n" + + " }]\r\n" + " },\r\n" + " \"type_version\": \"1.0.0\",\r\n" + " \"version\": \"1.0.0\",\r\n" + @@ -312,34 +310,32 @@ public class ConfigBindingServiceEnvironmentPostProcessorTest extends BaseAnalyt " \"items\": [{\r\n" + " \"policyName\": \"onap.vfirewall.tca.1-0-0.xml\",\r\n" + " \"name\": \"onap.vfirewall.tca\",\r\n" + - " \"config\": {\r\n" + - " \"tca.policy\": {\r\n" + - " \"domain\": \"measurementsForVfScaling\",\r\n" + - " \"metricsPerEventName\": [{\r\n" + - " \"policyName\": \"onap.vfirewall.tca\",\r\n" + - " \"policyScope\": \"resource=vLoadBalancer;type=configuration\",\r\n" + - " \"thresholds\": [{\r\n" + - " \"direction\": \"LESS_OR_EQUAL\",\r\n" + - " \"severity\": \"MAJOR\",\r\n" + - " \"closedLoopControlName\": \"VVK_ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\r\n" + - " \"fieldPath\": \"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\",\r\n" + - " \"version\": \"1.0.2\",\r\n" + - " \"closedLoopEventStatus\": \"ONSET\",\r\n" + - " \"thresholdValue\": 500\r\n" + - " }, {\r\n" + - " \"direction\": \"GREATER_OR_EQUAL\",\r\n" + - " \"severity\": \"CRITICAL\",\r\n" + - " \"closedLoopControlName\": \"VVK_ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\r\n" + - " \"fieldPath\": \"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\",\r\n" + - " \"version\": \"1.0.2\",\r\n" + - " \"closedLoopEventStatus\": \"ONSET\",\r\n" + - " \"thresholdValue\": 5000\r\n" + - " }],\r\n" + - " \"eventName\": \"vLoadBalancer\",\r\n" + - " \"controlLoopSchemaType\": \"VNF\",\r\n" + - " \"policyVersion\": \"v0.0.1\"\r\n" + - " }]\r\n" + - " }\r\n" + + " \"tca.policy\": {\r\n" + + " \"domain\": \"measurementsForVfScaling\",\r\n" + + " \"metricsPerEventName\": [{\r\n" + + " \"policyName\": \"onap.vfirewall.tca\",\r\n" + + " \"policyScope\": \"resource=vLoadBalancer;type=configuration\",\r\n" + + " \"thresholds\": [{\r\n" + + " \"direction\": \"LESS_OR_EQUAL\",\r\n" + + " \"severity\": \"MAJOR\",\r\n" + + " \"closedLoopControlName\": \"VVK_ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\r\n" + + " \"fieldPath\": \"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\",\r\n" + + " \"version\": \"1.0.2\",\r\n" + + " \"closedLoopEventStatus\": \"ONSET\",\r\n" + + " \"thresholdValue\": 500\r\n" + + " }, {\r\n" + + " \"direction\": \"GREATER_OR_EQUAL\",\r\n" + + " \"severity\": \"CRITICAL\",\r\n" + + " \"closedLoopControlName\": \"VVK_ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\r\n" + + " \"fieldPath\": \"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\",\r\n" + + " \"version\": \"1.0.2\",\r\n" + + " \"closedLoopEventStatus\": \"ONSET\",\r\n" + + " \"thresholdValue\": 5000\r\n" + + " }],\r\n" + + " \"eventName\": \"vLoadBalancer\",\r\n" + + " \"controlLoopSchemaType\": \"VNF\",\r\n" + + " \"policyVersion\": \"v0.0.1\"\r\n" + + " }]\r\n" + " },\r\n" + " \"type_version\": \"1.0.0\",\r\n" + " \"version\": \"1.0.0\",\r\n" + |