X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Fclamp%2Floop%2Fcomponents%2Fexternal%2FDcaeComponent.java;h=3e8cfaf9b1bb1550ddd34cc1f1a9b7a49eaa7167;hb=a2dbf1f653cba8c2d2835b36e8c89c9e41c5d1bb;hp=21960e387658c3282e9661273c0e2696129aac43;hpb=8d91398da6162c19643f3f7cae83327dd4e81263;p=clamp.git diff --git a/src/main/java/org/onap/clamp/loop/components/external/DcaeComponent.java b/src/main/java/org/onap/clamp/loop/components/external/DcaeComponent.java index 21960e38..3e8cfaf9 100644 --- a/src/main/java/org/onap/clamp/loop/components/external/DcaeComponent.java +++ b/src/main/java/org/onap/clamp/loop/components/external/DcaeComponent.java @@ -47,12 +47,15 @@ public class DcaeComponent extends ExternalComponent { private static final String DEPLOYMENT_PARAMETER = "dcaeDeployParameters"; private static final String DCAE_SERVICETYPE_ID = "serviceTypeId"; private static final String DCAE_INPUTS = "inputs"; + public static final String UNIQUE_BLUEPRINT_PARAMETERS = "uniqueBlueprintParameters"; + + private String name; public static final ExternalComponentState BLUEPRINT_DEPLOYED = new ExternalComponentState("BLUEPRINT_DEPLOYED", "The DCAE blueprint has been found in the DCAE inventory but not yet instancianted for this loop"); public static final ExternalComponentState PROCESSING_MICROSERVICE_INSTALLATION = new ExternalComponentState( "PROCESSING_MICROSERVICE_INSTALLATION", "Clamp has requested DCAE to install the microservices " - + "defined in the DCAE blueprint and it's currently processing the request"); + + "defined in the DCAE blueprint and it's currently processing the request"); public static final ExternalComponentState MICROSERVICE_INSTALLATION_FAILED = new ExternalComponentState( "MICROSERVICE_INSTALLATION_FAILED", "Clamp has requested DCAE to install the microservices defined in the DCAE blueprint and it failed"); @@ -61,7 +64,7 @@ public class DcaeComponent extends ExternalComponent { "Clamp has requested DCAE to install the DCAE blueprint and it has been installed successfully"); public static final ExternalComponentState PROCESSING_MICROSERVICE_UNINSTALLATION = new ExternalComponentState( "PROCESSING_MICROSERVICE_UNINSTALLATION", "Clamp has requested DCAE to uninstall the microservices " - + "defined in the DCAE blueprint and it's currently processing the request"); + + "defined in the DCAE blueprint and it's currently processing the request"); public static final ExternalComponentState MICROSERVICE_UNINSTALLATION_FAILED = new ExternalComponentState( "MICROSERVICE_UNINSTALLATION_FAILED", "Clamp has requested DCAE to uninstall the microservices defined in the DCAE blueprint and it failed"); @@ -73,16 +76,23 @@ public class DcaeComponent extends ExternalComponent { public DcaeComponent() { super(BLUEPRINT_DEPLOYED); + this.name = "DCAE"; + } + + public DcaeComponent(String name) { + super(BLUEPRINT_DEPLOYED); + this.name = "DCAE_" + name; } @Override public String getComponentName() { - return "DCAE"; + return name; } + /** * Convert the json response to a DcaeOperationStatusResponse. - * + * * @param responseBody The DCAE response Json paylaod * @return The dcae object provisioned */ @@ -122,7 +132,8 @@ public class DcaeComponent extends ExternalComponent { */ public static String getDeployPayload(Loop loop) { JsonObject globalProp = loop.getGlobalPropertiesJson(); - JsonObject deploymentProp = globalProp.getAsJsonObject(DEPLOYMENT_PARAMETER); + JsonObject deploymentProp = globalProp.getAsJsonObject(DEPLOYMENT_PARAMETER).getAsJsonObject( + UNIQUE_BLUEPRINT_PARAMETERS); String serviceTypeId = loop.getLoopTemplate().getDcaeBlueprintId(); @@ -137,15 +148,16 @@ public class DcaeComponent extends ExternalComponent { /** * Return the deploy payload for DCAE. * - * @param loop The loop object - * @param microServiceName The micro service name + * @param loop The loop object + * @param microServicePolicy The micro service policy * @return The payload used to send deploy closed loop request */ - public static String getDeployPayload(Loop loop, String microServiceName) { + public static String getDeployPayload(Loop loop, MicroServicePolicy microServicePolicy) { JsonObject globalProp = loop.getGlobalPropertiesJson(); - JsonObject deploymentProp = globalProp.getAsJsonObject(DEPLOYMENT_PARAMETER).getAsJsonObject(microServiceName); + JsonObject deploymentProp = + globalProp.getAsJsonObject(DEPLOYMENT_PARAMETER).getAsJsonObject(microServicePolicy.getName()); - String serviceTypeId = loop.getLoopTemplate().getDcaeBlueprintId(); + String serviceTypeId = microServicePolicy.getDcaeBlueprintId(); JsonObject rootObject = new JsonObject(); rootObject.addProperty(DCAE_SERVICETYPE_ID, serviceTypeId); @@ -170,7 +182,7 @@ public class DcaeComponent extends ExternalComponent { /** * Return the uninstallation payload for DCAE. * - * @param microServicePolicy The microServicePolicy object + * @param policy The microServicePolicy object * @return The payload in string (json) */ public static String getUndeployPayload(MicroServicePolicy policy) {