aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src/main/java/org/openecomp
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main/java/org/openecomp')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerAction.java47
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java18
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestrator.java4
3 files changed, 36 insertions, 33 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerAction.java
index 8b870889ac..44da566ec7 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerAction.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerAction.java
@@ -46,8 +46,7 @@ public class ApplicationControllerAction {
private String errorMessage = "Unable to reach App C Servers";
protected final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
- public void runAppCCommand(Action action, String msoRequestId, String vnfId, Optional<String> payload, HashMap<String, String> payloadInfo){
- Status appCStatus = null;
+ public void runAppCCommand(Action action, String msoRequestId, String vnfId, Optional<String> payload, HashMap<String, String> payloadInfo, String controllerType){ Status appCStatus = null;
try{
String vnfName = payloadInfo.getOrDefault("vnfName", "");
String aicIdentity = payloadInfo.getOrDefault("vnfName","");
@@ -56,21 +55,21 @@ public class ApplicationControllerAction {
String identityUrl = payloadInfo.getOrDefault("identityUrl", "");
switch(action){
case ResumeTraffic:
- appCStatus = resumeTrafficAction(msoRequestId, vnfId, vnfName);
+ appCStatus = resumeTrafficAction(msoRequestId, vnfId, vnfName, controllerType);
break;
case Start:
case Stop:
- appCStatus = startStopAction(action, msoRequestId, vnfId, aicIdentity);
+ appCStatus = startStopAction(action, msoRequestId, vnfId, aicIdentity, controllerType);
break;
case Unlock:
case Lock:
- appCStatus = client.vnfCommand(action, msoRequestId, vnfId, Optional.empty());
+ appCStatus = client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), controllerType);
break;
case QuiesceTraffic:
- appCStatus = quiesceTrafficAction(msoRequestId, vnfId, payload, vnfName);
+ appCStatus = quiesceTrafficAction(msoRequestId, vnfId, payload, vnfName, controllerType);
break;
case HealthCheck:
- appCStatus = healthCheckAction(msoRequestId, vnfId, vnfName, vnfHostIpAddress);
+ appCStatus = healthCheckAction(msoRequestId, vnfId, vnfName, vnfHostIpAddress, controllerType);
break;
case Snapshot:
String vmIds = JsonUtils.getJsonValue(vmIdList, "vmIds");
@@ -80,18 +79,18 @@ public class ApplicationControllerAction {
int i = 0;
while(i < vmIdJsonList.size()){
vmId = vmIdJsonList.get(i);
- appCStatus = snapshotAction(msoRequestId, vnfId, vmId, identityUrl);
+ appCStatus = snapshotAction(msoRequestId, vnfId, vmId, identityUrl, controllerType);
i++;
}
break;
case ConfigModify:
- appCStatus = payloadAction(action, msoRequestId, vnfId, payload);
+ appCStatus = payloadAction(action, msoRequestId, vnfId, payload, controllerType);
break;
case UpgradePreCheck:
case UpgradePostCheck:
case UpgradeSoftware:
case UpgradeBackup:
- appCStatus = upgradeAction(action,msoRequestId, vnfId, payload, vnfName);
+ appCStatus = upgradeAction(action,msoRequestId, vnfId, payload, vnfName, controllerType);
break;
default:
errorMessage = "Unable to idenify Action request for AppCClient";
@@ -125,47 +124,47 @@ public class ApplicationControllerAction {
}
}
- private Status payloadAction(Action action, String msoRequestId, String vnfId, Optional<String> payload) throws JsonProcessingException, Exception{
+ private Status payloadAction(Action action, String msoRequestId, String vnfId, Optional<String> payload, String controllerType) throws JsonProcessingException, Exception{
if(!(payload.isPresent())){
throw new IllegalArgumentException("Payload is not present for " + action.toString());
}
- return client.vnfCommand(action, msoRequestId, vnfId, payload);
+ return client.vnfCommand(action, msoRequestId, vnfId, payload, controllerType);
}
- private Status quiesceTrafficAction(String msoRequestId, String vnfId, Optional<String> payload, String vnfName) throws JsonProcessingException, Exception{
+ private Status quiesceTrafficAction(String msoRequestId, String vnfId, Optional<String> payload, String vnfName, String controllerType) throws JsonProcessingException, Exception{
if(!(payload.isPresent())){
throw new IllegalArgumentException("Payload is not present for " + Action.QuiesceTraffic.toString());
}
payload = PayloadClient.quiesceTrafficFormat(payload, vnfName);
- return client.vnfCommand(Action.QuiesceTraffic, msoRequestId, vnfId, payload);
+ return client.vnfCommand(Action.QuiesceTraffic, msoRequestId, vnfId, payload, controllerType);
}
- private Status upgradeAction(Action action, String msoRequestId, String vnfId, Optional<String> payload, String vnfName) throws JsonProcessingException, Exception{
+ private Status upgradeAction(Action action, String msoRequestId, String vnfId, Optional<String> payload, String vnfName, String controllerType) throws JsonProcessingException, Exception{
if(!(payload.isPresent())){
throw new IllegalArgumentException("Payload is not present for " + action.toString());
}
payload = PayloadClient.upgradeFormat(payload, vnfName);
- return client.vnfCommand(action, msoRequestId, vnfId, payload);
+ return client.vnfCommand(action, msoRequestId, vnfId, payload, controllerType);
}
- private Status resumeTrafficAction(String msoRequestId, String vnfId, String vnfName)throws JsonProcessingException, Exception{
+ private Status resumeTrafficAction(String msoRequestId, String vnfId, String vnfName, String controllerType)throws JsonProcessingException, Exception{
Optional<String> payload = PayloadClient.resumeTrafficFormat(vnfName);
- return client.vnfCommand(Action.ResumeTraffic, msoRequestId, vnfId, payload);
+ return client.vnfCommand(Action.ResumeTraffic, msoRequestId, vnfId, payload, controllerType);
}
- private Status startStopAction(Action action, String msoRequestId, String vnfId, String aicIdentity)throws JsonProcessingException, Exception{
+ private Status startStopAction(Action action, String msoRequestId, String vnfId, String aicIdentity, String controllerType)throws JsonProcessingException, Exception{
Optional<String> payload = PayloadClient.startStopFormat(aicIdentity);
- return client.vnfCommand(action, msoRequestId, vnfId, payload);
+ return client.vnfCommand(action, msoRequestId, vnfId, payload, controllerType);
}
- private Status healthCheckAction(String msoRequestId, String vnfId, String vnfName, String vnfHostIpAddress)throws JsonProcessingException, Exception{
+ private Status healthCheckAction(String msoRequestId, String vnfId, String vnfName, String vnfHostIpAddress, String controllerType)throws JsonProcessingException, Exception{
Optional<String> payload = PayloadClient.healthCheckFormat(vnfName, vnfHostIpAddress);
- return client.vnfCommand(Action.HealthCheck, msoRequestId, vnfId, payload);
+ return client.vnfCommand(Action.HealthCheck, msoRequestId, vnfId, payload, controllerType);
}
- private Status snapshotAction(String msoRequestId, String vnfId, String vmId, String identityUrl) throws JsonProcessingException, Exception{
+ private Status snapshotAction(String msoRequestId, String vnfId, String vmId, String identityUrl, String controllerType) throws JsonProcessingException, Exception{
Optional<String> payload = PayloadClient.snapshotFormat(vmId, identityUrl);
- return client.vnfCommand(Action.Snapshot, msoRequestId, vnfId, payload);
+ return client.vnfCommand(Action.Snapshot, msoRequestId, vnfId, payload, controllerType);
}
public String getErrorMessage(){
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java
index c383408488..8c57b9255c 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java
@@ -60,11 +60,11 @@ public class ApplicationControllerClient {
@Autowired
public ApplicationControllerSupport appCSupport;
- private static LifeCycleManagerStateful client;
+ private static LifeCycleManagerStateful client;
- public ApplicationControllerClient() {
+ public ApplicationControllerClient(String controllerType) {
appCSupport = new ApplicationControllerSupport();
- client = this.getAppCClient();
+ client = this.getAppCClient(controllerType);
}
public Status runCommand(Action action, org.onap.appc.client.lcm.model.ActionIdentifiers actionIdentifiers, org.onap.appc.client.lcm.model.Payload payload, String requestID)
@@ -81,27 +81,31 @@ public class ApplicationControllerClient {
}
}
- public LifeCycleManagerStateful getAppCClient() {
+ public LifeCycleManagerStateful getAppCClient(String controllerType) {
if (client == null)
try {
client = AppcClientServiceFactoryProvider.getFactory(AppcLifeCycleManagerServiceFactory.class)
- .createLifeCycleManagerStateful(new ApplicationContext(), getLCMProperties());
+ .createLifeCycleManagerStateful(new ApplicationContext(), getLCMProperties(controllerType));
} catch (AppcClientException e) {
auditLogger.log(Level.ERROR, "Error in getting LifeCycleManagerStateful: ", e, e.getMessage());
}
return client;
}
- protected Properties getLCMProperties() {
+ protected Properties getLCMProperties(String controllerType) {
Properties properties = new Properties();
Map<String, String> globalProperties = PropertyConfiguration.getInstance()
.getProperties("mso.bpmn.urn.properties");
-
+ String controllerTypeValue = controllerType;
+ if (controllerType == null) {
+ controllerTypeValue = "";
+ }
properties.put("topic.read", globalProperties.get("appc.topic.read"));
properties.put("topic.read.timeout", globalProperties.get("appc.topic.read.timeout"));
properties.put("client.response.timeout", globalProperties.get("appc.client.response.timeout"));
properties.put("topic.write", globalProperties.get("appc.topic.write"));
properties.put("poolMembers", globalProperties.get("appc.poolMembers"));
+ properties.put("client.controllerType", controllerTypeValue);
properties.put("client.key", globalProperties.get("appc.client.key"));
properties.put("client.secret", globalProperties.get("appc.client.secret"));
properties.put("client.name", CLIENT_NAME);
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestrator.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestrator.java
index 217525e56a..744be5f28f 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestrator.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestrator.java
@@ -31,8 +31,8 @@ import org.onap.appc.client.lcm.model.Status;
public class ApplicationControllerOrchestrator {
- public Status vnfCommand(Action action, String requestId, String vnfId, Optional<String> request) throws ApplicationControllerOrchestratorException {
- ApplicationControllerClient client = new ApplicationControllerClient();
+ public Status vnfCommand(Action action, String requestId, String vnfId, Optional<String> request, String controllerType) throws ApplicationControllerOrchestratorException {
+ ApplicationControllerClient client = new ApplicationControllerClient(controllerType);
Status status;
ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
actionIdentifiers.setVnfId(vnfId);