summaryrefslogtreecommitdiffstats
path: root/adapters/so-appc-orchestrator
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/so-appc-orchestrator')
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java21
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java9
-rw-r--r--adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java33
3 files changed, 62 insertions, 1 deletions
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java
index b065e9a0c3..e5321067ac 100644
--- a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java
@@ -1,5 +1,10 @@
package org.onap.so.adapters.appc.orchestrator.client.beans;
+import java.util.HashMap;
+import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -14,6 +19,8 @@ public class ConfigurationParameters {
private String nodeList;
@JsonProperty("file_parameter_content")
private String fileParameterContent;
+ @JsonIgnore
+ private Map<String, String> additionalProperties = new HashMap<>();
@JsonProperty("vnf_name")
@@ -50,4 +57,18 @@ public class ConfigurationParameters {
this.fileParameterContent = fileParameterContent;
}
+ @JsonAnyGetter
+ public Map<String, String> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, String value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ public void setAdditionalProperties(Map<String, String> map) {
+ this.additionalProperties = map;
+ }
+
}
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
index a174ccb05a..99d6b4dc12 100644
--- a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
@@ -32,10 +32,10 @@ public class ApplicationControllerTaskImpl {
Optional<String> vserverId = Optional.empty();
Parameters parameters = new Parameters();
ConfigurationParameters configParams = new ConfigurationParameters();
+ RequestParameters requestParams = new RequestParameters();
switch (request.getAction()) {
case HealthCheck:
- RequestParameters requestParams = new RequestParameters();
requestParams.setHostIpAddress(request.getApplicationControllerVnf().getVnfHostIpAddress());
parameters.setRequestParameters(requestParams);
payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
@@ -75,6 +75,12 @@ public class ApplicationControllerTaskImpl {
payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
break;
case ConfigModify:
+ requestParams.setHostIpAddress(request.getApplicationControllerVnf().getVnfHostIpAddress());
+ configParams.setAdditionalProperties(request.getConfigParams());
+ parameters.setRequestParameters(requestParams);
+ parameters.setConfigurationParameters(configParams);
+ payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
+ break;
case ConfigScaleOut:
break;
case UpgradePreCheck:
@@ -97,6 +103,7 @@ public class ApplicationControllerTaskImpl {
vserverId = Optional
.of(request.getApplicationControllerVnf().getApplicationControllerVm().getVserverId());
}
+ break;
default:
// errorMessage = "Unable to idenify Action request for AppCClient";
break;
diff --git a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
index 640e2dbd6e..973430c37e 100644
--- a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
+++ b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
@@ -1,5 +1,7 @@
package org.onap.so.adapters.appc.orchestrator.service;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
@@ -50,6 +52,10 @@ public class ApplicationControllerTaskImplTest {
request.setNewSoftwareVersion("2.0");
request.setExistingSoftwareVersion("1.0");
request.setOperationsTimeout("30");
+ Map<String, String> reqConfigParams = new HashMap<>();
+ reqConfigParams.put("name1", "value1");
+ reqConfigParams.put("name2", "value2");
+ request.setConfigParams(reqConfigParams);
ApplicationControllerVnf applicationControllerVnf = new ApplicationControllerVnf();
applicationControllerVnf.setVnfHostIpAddress("100.100");
applicationControllerVnf.setVnfId("testVnfId");
@@ -228,6 +234,33 @@ public class ApplicationControllerTaskImplTest {
}
@Test
+ public void testExcute_configModify() throws JsonProcessingException, ApplicationControllerOrchestratorException {
+ request.setAction(Action.ConfigModify);
+
+ Parameters parameters = new Parameters();
+ RequestParameters requestParams = new RequestParameters();
+ requestParams.setHostIpAddress(request.getApplicationControllerVnf().getVnfHostIpAddress());
+ parameters.setRequestParameters(requestParams);
+ ConfigurationParameters configParams = new ConfigurationParameters();
+ Map<String, String> configParamMap = new HashMap<>();
+ configParamMap.put("name1", "value1");
+ configParamMap.put("name2", "value2");
+ configParams.setAdditionalProperties(configParamMap);
+ parameters.setConfigurationParameters(configParams);
+ Optional<String> payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
+
+ Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
+ request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
+ listener)).thenReturn(new Status());
+
+ Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
+
+ Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
+ request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
+ listener);
+ }
+
+ @Test
public void testListener() throws Exception {
request.setAction(Action.QuiesceTraffic);
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);