summaryrefslogtreecommitdiffstats
path: root/appc-provider/appc-provider-bundle/src/main
diff options
context:
space:
mode:
authormojahidi <mojahidul.islam@amdocs.com>2017-08-14 12:50:45 +0530
committerMarcus Williams <marcus.williams@intel.com>2017-08-22 16:21:44 +0000
commitde52c6240a7c4b7e0cab5ea4718ac0f4608f2aa2 (patch)
treed3456a7af375b3f0ae100694fcf99fc5320abd7c /appc-provider/appc-provider-bundle/src/main
parent247568d6746478e641f4cc959e1c95882f3826ad (diff)
Rename action Block/UnBlock and Update Orch
StopApplication : Renamed block traffic action to StopApplication. Transition of status in AAI will be stopping on accepting request followed by Stopped for Success and Error for error scenario’s StartApplicaiton: Renamed unblock traffic action to StartApplication. Transition of status in AAI will be starting on accepting request followed by Running for Success and Error for error scenario’s. Refactored to handle actions on basis of ReadOnly,OrchestrationStatus, BuiltIn and OperationalStatus instead of individual actions. Change-Id: Ia7c6b233ac9a0aabeb9a1f7d715629917f6b7b86 Issue-ID:APPC-55 Signed-off-by: mojahidi <mojahidul.islam@amdocs.com>
Diffstat (limited to 'appc-provider/appc-provider-bundle/src/main')
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderLcm.java70
1 files changed, 69 insertions, 1 deletions
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderLcm.java b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderLcm.java
index 292496958..370ed5287 100644
--- a/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderLcm.java
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderLcm.java
@@ -32,7 +32,6 @@ import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.Action;
import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.AppcProviderLcmService;
import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.AuditInput;
import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.AuditOutput;
@@ -109,8 +108,15 @@ import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.TestOutputB
import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.UnlockInput;
import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.UnlockOutput;
import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.UnlockOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.StartApplicationOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.StartApplicationOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.StartApplicationInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.StopApplicationOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.StopApplicationOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.StopApplicationInput;
import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.status.Status;
import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.status.StatusBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.lcm.rev160108.Action;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.openecomp.appc.Constants;
@@ -1115,6 +1121,68 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
RpcResult<ConfigExportOutput> result = RpcResultBuilder.<ConfigExportOutput> status(true).withResult(outputBuilder.build()).build();
return Futures.immediateFuture(result);
}
+ @Override
+ public Future<RpcResult<StartApplicationOutput>> startApplication(StartApplicationInput input) {
+ logger.debug("Input received : " + input.toString());
+
+ StartApplicationOutputBuilder outputBuilder = new StartApplicationOutputBuilder();
+ String action = Action.StartApplication.toString() ;
+ String rpcName = Action.StartApplication.name().toLowerCase();
+ Status status = ValidationService.getInstance().validateInput(input.getCommonHeader(), input.getAction(), action);
+ if(null == status) {
+ try {
+ RequestHandlerInput request = new RequestInputBuilder().requestContext()
+ .commonHeader(input.getCommonHeader())
+ .actionIdentifiers(input.getActionIdentifiers())
+ .payload(input.getPayload())
+ .action(action)
+ .rpcName(rpcName)
+ .build();
+
+ status = buildStatusWithDispatcherOutput(executeRequest(request));
+ logger.info(String.format("Execute of '%s' finished with status %s. Reason: %s", input.getActionIdentifiers(), status.getCode(), status.getMessage()));
+ } catch (ParseException e) {
+ status = buildParsingErrorStatus(e);
+
+ LoggingUtils.logErrorMessage(
+ LoggingConstants.TargetNames.APPC_PROVIDER,
+ String.format(COMMON_ERROR_MESSAGE_TEMPLATE, action, e.getMessage()),
+ this.getClass().getName());
+
+ }
+ }
+ outputBuilder.setCommonHeader(input.getCommonHeader());
+ outputBuilder.setStatus(status);
+ RpcResult<StartApplicationOutput> result = RpcResultBuilder.<StartApplicationOutput> status(true).withResult(outputBuilder.build()).build();
+ return Futures.immediateFuture(result);
+ }
+ @Override
+ public Future<RpcResult<StopApplicationOutput>> stopApplication(StopApplicationInput input){
+ logger.debug("Input received : " + input.toString());
+ StopApplicationOutputBuilder outputBuilder = new StopApplicationOutputBuilder();
+ String action = Action.StopApplication.toString() ;
+ String rpcName = Action.StopApplication.name().toLowerCase();
+ Status status = ValidationService.getInstance().validateInput(input.getCommonHeader(), input.getAction(), action);
+ if(null == status) {
+ try {
+ RequestHandlerInput request = new RequestInputBuilder().requestContext().commonHeader(input.getCommonHeader()).actionIdentifiers(input.getActionIdentifiers()).action(action).rpcName(rpcName).build();
+ status = buildStatusWithDispatcherOutput(executeRequest(request));
+ logger.info(String.format("Execute of '%s' finished with status %s. Reason: %s", input.getActionIdentifiers(), status.getCode(), status.getMessage()));
+ } catch (ParseException e) {
+ status = buildParsingErrorStatus(e);
+
+ LoggingUtils.logErrorMessage(
+ LoggingConstants.TargetNames.APPC_PROVIDER,
+ String.format(COMMON_ERROR_MESSAGE_TEMPLATE, action, e.getMessage()),
+ this.getClass().getName());
+
+ }
+ }
+ outputBuilder.setCommonHeader(input.getCommonHeader());
+ outputBuilder.setStatus(status);
+ RpcResult<StopApplicationOutput> result = RpcResultBuilder.<StopApplicationOutput> status(true).withResult(outputBuilder.build()).build();
+ return Futures.immediateFuture(result);
+ }
private String convertActionNameToUrl(String action) {
String regex = "([a-z])([A-Z]+)";