Add new LCM actions DownloadNESw and ActivateNESw, etc
[appc.git] / appc-provider / appc-provider-bundle / src / main / java / org / onap / appc / provider / AppcProviderLcm.java
index cd5576b..4aad668 100644 (file)
@@ -6,7 +6,9 @@
  * ================================================================================
  * Copyright (C) 2017 Amdocs
  * ================================================================================
- * Modifications Copyright (C) 2018 Orange
+ * Modifications Copyright (C) 2018-2019 Orange
+ * ================================================================================
+ * Modifications Copyright (C) 2019 Ericsson
  * =============================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -44,13 +46,30 @@ import org.onap.appc.provider.lcm.service.ResumeTrafficService;
 import org.onap.appc.provider.lcm.service.UpgradeService;
 import org.onap.appc.provider.lcm.service.VolumeService;
 import org.onap.appc.provider.lcm.service.ConfigScaleOutService;
+import org.onap.appc.provider.lcm.service.PreConfigure;
+import org.onap.appc.provider.lcm.service.PreRebuild;
+import org.onap.appc.provider.lcm.service.GetConfigService;
+import org.onap.appc.provider.lcm.service.PostRebuild;
+import org.onap.appc.provider.lcm.service.PostEvacuateService;
+import org.onap.appc.provider.lcm.service.PreMigrateService;
+import org.onap.appc.provider.lcm.service.PostMigrateService;
 import org.onap.appc.provider.lcm.service.DistributeTrafficService;
+import org.onap.appc.provider.lcm.service.DistributeTrafficCheckService;
+import org.onap.appc.provider.lcm.service.PreEvacuate;
+import org.onap.appc.provider.lcm.service.ProvisioningService;
+import org.onap.appc.provider.lcm.service.LicenseManagementService;
+import org.onap.appc.provider.lcm.service.StartTraffic;
+import org.onap.appc.provider.lcm.service.StatusTraffic;
+import org.onap.appc.provider.lcm.service.StopTraffic;
+import org.onap.appc.provider.lcm.service.ConfigScaleInService;
+import org.onap.appc.provider.lcm.service.DownloadNESw;
+import org.onap.appc.provider.lcm.service.ActivateNESw;
 import org.onap.appc.provider.lcm.util.RequestInputBuilder;
 import org.onap.appc.provider.lcm.util.ValidationService;
 import org.onap.appc.requesthandler.objects.RequestHandlerInput;
 import org.onap.appc.requesthandler.objects.RequestHandlerOutput;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.NotificationPublishService;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.*;
@@ -112,7 +131,6 @@ public class AppcProviderLcm extends AbstractBaseUtils implements AutoCloseable,
         if (this.rpcRegistry != null) {
             rpcRegistration = rpcRegistry.addRpcImplementation(AppcProviderLcmService.class, this);
         }
-
         logger.info(Msg.COMPONENT_INITIALIZED, appName, "provider");
     }
 
@@ -499,6 +517,15 @@ public class AppcProviderLcm extends AbstractBaseUtils implements AutoCloseable,
         return Futures.immediateFuture(result);
     }
 
+    @Override
+    public ListenableFuture<RpcResult<DistributeTrafficCheckOutput>> distributeTrafficCheck(DistributeTrafficCheckInput input) {
+        logger.debug(String.format("LCM DistributeTrafficCheck, received input: %s", input.toString()));
+        DistributeTrafficCheckOutputBuilder outputBuilder = new DistributeTrafficCheckService().process(input);
+        RpcResult<DistributeTrafficCheckOutput> result =
+                RpcResultBuilder.<DistributeTrafficCheckOutput>status(true).withResult(outputBuilder.build()).build();
+        return Futures.immediateFuture(result);
+    }
+
     @Override
     public ListenableFuture<RpcResult<UpgradePreCheckOutput>> upgradePreCheck(UpgradePreCheckInput input) {
         logger.debug(String.format("LCM upgradeprecheck received input: %s", input.toString()));
@@ -544,6 +571,114 @@ public class AppcProviderLcm extends AbstractBaseUtils implements AutoCloseable,
         return Futures.immediateFuture(result);
     }
 
+    @Override
+    public ListenableFuture<RpcResult<PreConfigureOutput>> preConfigure(PreConfigureInput input) {
+        logger.debug(String.format("LCM PreConfigure received input: %s", input.toString()));
+        PreConfigureOutputBuilder outputBuilder = new PreConfigure().process(input);
+        RpcResult<PreConfigureOutput> result =
+                RpcResultBuilder.<PreConfigureOutput>status(true).withResult(outputBuilder.build()).build();
+        return Futures.immediateFuture(result);
+    }
+
+    @Override
+    public ListenableFuture<RpcResult<GetConfigOutput>> getConfig(GetConfigInput input) {
+        logger.debug(String.format("LCM getConfig received input: %s", input.toString()));
+        GetConfigOutputBuilder outputBuilder = new GetConfigService().process(input);
+        RpcResult<GetConfigOutput> result =
+                RpcResultBuilder.<GetConfigOutput>status(true).withResult(outputBuilder.build()).build();
+        return Futures.immediateFuture(result);
+    }
+
+    @Override
+    public ListenableFuture<RpcResult<PreRebuildOutput>> preRebuild(PreRebuildInput input) {
+        logger.debug(String.format("LCM PreRebuild received input: %s", input.toString()));
+        PreRebuildOutputBuilder outputBuilder = new PreRebuild().process(input);
+        RpcResult<PreRebuildOutput> result =
+                RpcResultBuilder.<PreRebuildOutput>status(true).withResult(outputBuilder.build()).build();
+        return Futures.immediateFuture(result);
+    }
+
+    @Override
+    public ListenableFuture<RpcResult<PostRebuildOutput>> postRebuild(PostRebuildInput input) {
+        logger.debug(String.format("LCM PostRebuild received input: %s", input.toString()));
+        PostRebuildOutputBuilder outputBuilder = new PostRebuild().process(input);
+        RpcResult<PostRebuildOutput> result =
+                RpcResultBuilder.<PostRebuildOutput>status(true).withResult(outputBuilder.build()).build();
+        return Futures.immediateFuture(result);
+    }
+
+    @Override
+    public ListenableFuture<RpcResult<PreEvacuateOutput>> preEvacuate(PreEvacuateInput input) {
+        logger.debug(String.format("LCM PreEvacuate received input: %s", input.toString()));
+        PreEvacuateOutputBuilder outputBuilder = new PreEvacuate().process(input);
+        RpcResult<PreEvacuateOutput> result =
+                RpcResultBuilder.<PreEvacuateOutput>status(true).withResult(outputBuilder.build()).build();
+        return Futures.immediateFuture(result);
+    }
+
+    @Override
+    public ListenableFuture<RpcResult<ProvisioningOutput>> provisioning(ProvisioningInput input) {
+        logger.debug(String.format("LCM ProvisioningService received input: %s", input.toString()));
+        ProvisioningOutputBuilder outputBuilder = new ProvisioningService().process(input);
+        RpcResult<ProvisioningOutput> result =
+                RpcResultBuilder.<ProvisioningOutput>status(true).withResult(outputBuilder.build()).build();
+        return Futures.immediateFuture(result);
+    }
+
+ @Override
+    public ListenableFuture<RpcResult<LicenseManagementOutput>> licenseManagement(LicenseManagementInput input) {
+        logger.debug(String.format("LCM licensemangementService received input: %s", input.toString()));
+        LicenseManagementOutputBuilder outputBuilder = new LicenseManagementService().process(input);
+        RpcResult<LicenseManagementOutput> result =
+                RpcResultBuilder.<LicenseManagementOutput>status(true).withResult(outputBuilder.build()).build();
+        return Futures.immediateFuture(result);
+    }
+
+    @Override
+    public ListenableFuture<RpcResult<StartTrafficOutput>> startTraffic(StartTrafficInput input) {
+        logger.debug(String.format("LCM StartTraffic received input: %s", input.toString()));
+        StartTrafficOutputBuilder outputBuilder = new StartTraffic().process(input);
+        RpcResult<StartTrafficOutput> result =
+                RpcResultBuilder.<StartTrafficOutput>status(true).withResult(outputBuilder.build()).build();
+        return Futures.immediateFuture(result);
+    }
+
+    @Override
+    public ListenableFuture<RpcResult<StatusTrafficOutput>> statusTraffic(StatusTrafficInput input) {
+        logger.debug(String.format("LCM StatusTraffic received input: %s", input.toString()));
+        StatusTrafficOutputBuilder outputBuilder = new StatusTraffic().process(input);
+        RpcResult<StatusTrafficOutput> result =
+                RpcResultBuilder.<StatusTrafficOutput>status(true).withResult(outputBuilder.build()).build();
+        return Futures.immediateFuture(result);
+    }
+
+    @Override
+    public ListenableFuture<RpcResult<StopTrafficOutput>> stopTraffic(StopTrafficInput input) {
+        logger.debug(String.format("LCM StopTraffic received input: %s", input.toString()));
+        StopTrafficOutputBuilder outputBuilder = new StopTraffic().process(input);
+        RpcResult<StopTrafficOutput> result =
+                RpcResultBuilder.<StopTrafficOutput>status(true).withResult(outputBuilder.build()).build();
+        return Futures.immediateFuture(result);
+    }
+
+    @Override
+    public ListenableFuture<RpcResult<DownloadNESwOutput>> downloadNESw(DownloadNESwInput input) {
+        logger.debug(String.format("LCM DownloadNESw received input: %s", input.toString()));
+        DownloadNESwOutputBuilder outputBuilder = new DownloadNESw().process(input);
+        RpcResult<DownloadNESwOutput> result =
+                RpcResultBuilder.<DownloadNESwOutput>status(true).withResult(outputBuilder.build()).build();
+        return Futures.immediateFuture(result);
+    }
+
+    @Override
+    public ListenableFuture<RpcResult<ActivateNESwOutput>> activateNESw(ActivateNESwInput input) {
+        logger.debug(String.format("LCM ActivateNESw received input: %s", input.toString()));
+        ActivateNESwOutputBuilder outputBuilder = new ActivateNESw().process(input);
+        RpcResult<ActivateNESwOutput> result =
+                RpcResultBuilder.<ActivateNESwOutput>status(true).withResult(outputBuilder.build()).build();
+        return Futures.immediateFuture(result);
+    }
+
     @Override
     public ListenableFuture<RpcResult<TerminateOutput>> terminate(TerminateInput input) {
         logger.debug("Input received : " + input.toString());
@@ -661,6 +796,38 @@ public class AppcProviderLcm extends AbstractBaseUtils implements AutoCloseable,
         RpcResult<ConfigScaleOutOutput> result = RpcResultBuilder.<ConfigScaleOutOutput> status(true).withResult(outputBuilder.build()).build();
         return Futures.immediateFuture(result);
     }
+    
+    @Override
+    public ListenableFuture<RpcResult<ConfigScaleInOutput>> configScaleIn(ConfigScaleInInput input) {
+        logger.debug("Input received : " + input.toString());
+        ConfigScaleInOutputBuilder outputBuilder = new ConfigScaleInService().process(input);
+        RpcResult<ConfigScaleInOutput> result = RpcResultBuilder.<ConfigScaleInOutput> status(true).withResult(outputBuilder.build()).build();
+        return Futures.immediateFuture(result);
+    }
+
+    @Override
+    public ListenableFuture<RpcResult<PostEvacuateOutput>> postEvacuate(PostEvacuateInput input) {
+        logger.debug("Input received : " + input.toString());
+        PostEvacuateOutputBuilder outputBuilder = new PostEvacuateService().process(input);
+        RpcResult<PostEvacuateOutput> result = RpcResultBuilder.<PostEvacuateOutput> status(true).withResult(outputBuilder.build()).build();
+        return Futures.immediateFuture(result);
+    }
+
+   @Override
+    public ListenableFuture<RpcResult<PreMigrateOutput>> preMigrate(PreMigrateInput input) {
+        logger.debug("Input received : " + input.toString());
+        PreMigrateOutputBuilder outputBuilder = new PreMigrateService().process(input);
+        RpcResult<PreMigrateOutput> result = RpcResultBuilder.<PreMigrateOutput> status(true).withResult(outputBuilder.build()).build();
+        return Futures.immediateFuture(result);
+    }
+
+    @Override
+    public ListenableFuture<RpcResult<PostMigrateOutput>> postMigrate(PostMigrateInput input) {
+        logger.debug("Input received : " + input.toString());
+        PostMigrateOutputBuilder outputBuilder = new PostMigrateService().process(input);
+        RpcResult<PostMigrateOutput> result = RpcResultBuilder.<PostMigrateOutput> status(true).withResult(outputBuilder.build()).build();
+        return Futures.immediateFuture(result);
+    }
 
     @Override
     public ListenableFuture<RpcResult<ConfigRestoreOutput>> configRestore(ConfigRestoreInput input) {