From da4caf492050e17c1aaa8915064659a16e060d8d Mon Sep 17 00:00:00 2001 From: xg353y Date: Fri, 3 Nov 2017 16:16:16 +0100 Subject: Update the policyName send to Policy Change-Id: Ib8ef7feb2404b15f215a1a7967d3af7d6ac89da0 Issue-Id: CLAMP-62 Signed-off-by: xg353y --- .../java/org/onap/clamp/clds/client/DcaeDispatcherServices.java | 6 +++++- src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java | 5 ++--- .../java/org/onap/clamp/clds/client/req/TcaRequestFormatter.java | 4 ++-- src/main/java/org/onap/clamp/clds/util/CryptoUtils.java | 3 +++ 4 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src/main/java/org') diff --git a/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java b/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java index 718a2e99..f285dc27 100644 --- a/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java +++ b/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java @@ -25,6 +25,7 @@ package org.onap.clamp.clds.client; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; +import com.fasterxml.jackson.databind.node.ObjectNode; import java.io.BufferedReader; import java.io.DataOutputStream; @@ -235,7 +236,10 @@ public class DcaeDispatcherServices { Date startTime = new Date(); LoggingUtils.setTargetContext("DCAE", "createNewDeployment"); try { - String apiBodyString = "{\"serviceTypeId\": \"" + serviceTypeId + "\"}"; + ObjectNode rootNode = (ObjectNode) refProp.getJsonTemplate("dcae.deployment.template"); + ((ObjectNode) rootNode).put("serviceTypeId", serviceTypeId); + String apiBodyString = rootNode.toString(); + logger.info("Dcae api Body String - " + apiBodyString); String url = refProp.getStringValue("DCAE_DISPATCHER_URL") + "/dcae-deployments/" + deploymentId; logger.info("Dcae Dispatcher Service url - " + url); diff --git a/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java b/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java index 71e57ded..a53ea647 100644 --- a/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java +++ b/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java @@ -105,13 +105,12 @@ public class DcaeInventoryServices { Global global = prop.getGlobal(); String invariantServiceUuid = global.getService(); List resourceUuidList = global.getResourceVf(); - String serviceUuid = sdcCatalogServices.getServiceUuidFromServiceInvariantId(invariantServiceUuid); String resourceUuid = ""; if (resourceUuidList != null && !resourceUuidList.isEmpty()) { resourceUuid = resourceUuidList.get(0); } /* Invemtory service url is called in this method */ - isDcaeInfoAvailable = getDcaeInformation(artifactName, serviceUuid, resourceUuid); + isDcaeInfoAvailable = getDcaeInformation(artifactName, invariantServiceUuid, resourceUuid); /* set dcae events */ dcaeEvent.setArtifactName(artifactName); dcaeEvent.setEvent(DcaeEvent.EVENT_DISTRIBUTION); @@ -170,7 +169,7 @@ public class DcaeInventoryServices { throws IOException, ParseException { Date startTime = new Date(); LoggingUtils.setTargetContext("DCAE", "getDcaeInformation"); - String queryString = "?sdcResourceId=" + resourceUuid + "&sdcServiceId=" + serviceUuid + "&typeName=" + String queryString = "?asdcResourceId=" + resourceUuid + "&asdcServiceId=" + serviceUuid + "&typeName=" + artifactName; String fullUrl = refProp.getStringValue("DCAE_INVENTORY_URL") + "/dcae-service-types" + queryString; logger.info("Dcae Inventory Service full url - " + fullUrl); diff --git a/src/main/java/org/onap/clamp/clds/client/req/TcaRequestFormatter.java b/src/main/java/org/onap/clamp/clds/client/req/TcaRequestFormatter.java index 9698a995..8a6f7e8a 100644 --- a/src/main/java/org/onap/clamp/clds/client/req/TcaRequestFormatter.java +++ b/src/main/java/org/onap/clamp/clds/client/req/TcaRequestFormatter.java @@ -72,7 +72,7 @@ public class TcaRequestFormatter { Tca tca = modelProperties.getType(Tca.class); modelProperties.setCurrentModelElementId(tca.getId()); ObjectNode rootNode = (ObjectNode) refProp.getJsonTemplate("tca.policy.template", service); - String policyName = refProp.getStringValue("tca.policyid.prefix") + modelProperties.getCurrentPolicyScopeAndPolicyName(); + String policyName = modelProperties.getCurrentPolicyScopeAndPolicyName(); ((ObjectNode) rootNode).put("policyName", policyName); ((ObjectNode) rootNode).put("description", "MicroService vCPE Policy"); ((ObjectNode) rootNode.get("content")).replace("tca_policy", createPolicyContent(refProp, modelProperties, service, policyName, tca)); @@ -105,7 +105,7 @@ public class TcaRequestFormatter { modelProperties.setCurrentModelElementId(tca.getId()); } if (null == policyName) { - policyName = refProp.getStringValue("tca.policyid.prefix") + modelProperties.getCurrentPolicyScopeAndPolicyName(); + policyName = modelProperties.getCurrentPolicyScopeAndPolicyName(); } ObjectNode rootNode = (ObjectNode) refProp.getJsonTemplate("tca.template", service); ((ObjectNode) rootNode.get("metricsPerEventName").get(0)).put("eventName", tca.getTcaItem().getEventName()); diff --git a/src/main/java/org/onap/clamp/clds/util/CryptoUtils.java b/src/main/java/org/onap/clamp/clds/util/CryptoUtils.java index fd4d1b15..86f57dce 100644 --- a/src/main/java/org/onap/clamp/clds/util/CryptoUtils.java +++ b/src/main/java/org/onap/clamp/clds/util/CryptoUtils.java @@ -31,6 +31,8 @@ import javax.crypto.spec.SecretKeySpec; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; +import org.springframework.core.annotation.Order; +import org.springframework.core.Ordered; import org.springframework.stereotype.Component; /** @@ -39,6 +41,7 @@ import org.springframework.stereotype.Component; * */ @Component("CryptoUtils") +@Order(Ordered.HIGHEST_PRECEDENCE) public final class CryptoUtils { public static final String AES = "AES"; public static final String KEY_PARAM = "org.onap.clamp.encryption.aes.key"; -- cgit 1.2.3-korg