use of org.onap.appc.client.lcm.model.Payload in project so by onap.
the class ApplicationControllerClient method createRequest.
public Object createRequest(Action action, ActionIdentifiers identifier, Payload payload, String requestId, String requestorId) {
Object requestObject = appCSupport.getInput(action.name());
try {
CommonHeader commonHeader = buildCommonHeader(requestId, requestorId);
requestObject.getClass().getDeclaredMethod("setCommonHeader", CommonHeader.class).invoke(requestObject, commonHeader);
requestObject.getClass().getDeclaredMethod("setAction", Action.class).invoke(requestObject, action);
requestObject.getClass().getDeclaredMethod("setActionIdentifiers", ActionIdentifiers.class).invoke(requestObject, identifier);
if (payload != null) {
logger.info("payload in RunCommand: " + payload.getValue());
requestObject.getClass().getDeclaredMethod("setPayload", Payload.class).invoke(requestObject, payload);
}
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
logger.error("Error building Appc request", e);
}
return requestObject;
}
use of org.onap.appc.client.lcm.model.Payload in project so by onap.
the class ApplicationControllerClient method createRequest.
public Object createRequest(Action action, ActionIdentifiers identifier, Payload payload, String requestId) {
Object requestObject = appCSupport.getInput(action.name());
try {
CommonHeader commonHeader = buildCommonHeader(requestId);
requestObject.getClass().getDeclaredMethod("setCommonHeader", CommonHeader.class).invoke(requestObject, commonHeader);
requestObject.getClass().getDeclaredMethod("setAction", Action.class).invoke(requestObject, action);
requestObject.getClass().getDeclaredMethod("setActionIdentifiers", ActionIdentifiers.class).invoke(requestObject, identifier);
if (payload != null) {
requestObject.getClass().getDeclaredMethod("setPayload", Payload.class).invoke(requestObject, payload);
}
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
logger.error("Error building Appc request", e);
}
return requestObject;
}
use of org.onap.appc.client.lcm.model.Payload in project so by onap.
the class ApplicationControllerOrchestrator method vnfCommand.
public Status vnfCommand(Action action, String requestId, String vnfId, Optional<String> vserverId, Optional<String> request, String controllerType) throws ApplicationControllerOrchestratorException {
ApplicationControllerClient client = new ApplicationControllerClient(controllerType);
Status status;
ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
actionIdentifiers.setVnfId(vnfId);
if (vserverId.isPresent()) {
actionIdentifiers.setVserverId(vserverId.get());
}
Payload payload = null;
if (request.isPresent()) {
payload = new Payload(request.get());
}
status = client.runCommand(action, actionIdentifiers, payload, requestId);
if (ApplicationControllerSupport.getCategoryOf(status).equals(StatusCategory.ERROR)) {
throw new ApplicationControllerOrchestratorException(status.getMessage(), status.getCode());
} else {
return status;
}
}
use of org.onap.appc.client.lcm.model.Payload in project so by onap.
the class ApplicationControllerClient method vnfCommand.
public Status vnfCommand(Action action, String requestId, String vnfId, Optional<String> vserverId, Optional<String> request, String controllerType, ApplicationControllerCallback listener, String requestorId) throws ApplicationControllerOrchestratorException {
this.setControllerType(controllerType);
Status status;
ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
actionIdentifiers.setVnfId(vnfId);
if (vserverId.isPresent()) {
actionIdentifiers.setVserverId(vserverId.get());
}
Payload payload = null;
if (request.isPresent()) {
payload = new Payload(request.get());
}
status = runCommand(action, actionIdentifiers, payload, requestId, listener, requestorId);
if (appCSupport.getCategoryOf(status).equals(StatusCategory.ERROR)) {
throw new ApplicationControllerOrchestratorException(status.getMessage(), status.getCode());
} else {
return status;
}
}
Aggregations