summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxg353y <xg353y@intl.att.com>2017-11-03 16:16:16 +0100
committerxg353y <xg353y@intl.att.com>2017-11-03 21:02:20 +0100
commitda4caf492050e17c1aaa8915064659a16e060d8d (patch)
treede359e80745e77725187bd800ed4d0801715f174
parentbe0c6335f150d36bf50518e42dc2a03eae69dfb3 (diff)
Update the policyName send to Policy
Change-Id: Ib8ef7feb2404b15f215a1a7967d3af7d6ac89da0 Issue-Id: CLAMP-62 Signed-off-by: xg353y <xg353y@intl.att.com>
-rw-r--r--src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java6
-rw-r--r--src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java5
-rw-r--r--src/main/java/org/onap/clamp/clds/client/req/TcaRequestFormatter.java4
-rw-r--r--src/main/java/org/onap/clamp/clds/util/CryptoUtils.java3
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/app.js29
-rw-r--r--src/main/resources/clds/clds-reference.properties1
-rw-r--r--src/test/resources/clds/clds-reference.properties1
-rw-r--r--src/test/resources/example/tca-policy-req/blueprint-expected.yaml2
-rw-r--r--src/test/resources/example/tca-policy-req/tca-policy-expected.json4
9 files changed, 44 insertions, 11 deletions
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 718a2e997..f285dc27c 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 71e57ded9..a53ea6475 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<String> 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 9698a9958..8a6f7e8aa 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 fd4d1b15c..86f57dcee 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";
diff --git a/src/main/resources/META-INF/resources/designer/scripts/app.js b/src/main/resources/META-INF/resources/designer/scripts/app.js
index f300bb092..3c723626e 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/app.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/app.js
@@ -393,7 +393,7 @@ var app = angular.module('clds-app', ['ngRoute',
$scope
.cldsConfirmPerformAction("RESTART");
} else if (name == "Refresh Status") {
- $scope.cldsPerformAction("REFRESH");
+ $scope.refreshStatus();
} else if (name == "Properties CL") {
$scope.cldsOpenModelProperties();
} else if (name == "Deploy") {
@@ -1175,7 +1175,32 @@ var app = angular.module('clds-app', ['ngRoute',
// + data);
});
};
-
+ $scope.refreshStatus = function() {
+ var modelName = selected_model;
+ var svgXml = "";
+ console.log(abootDiagram.saveSVG({
+ format: true
+ }, function(err, xml) {
+ if (err)
+ console.log("error")
+ else
+ console.log(xml)
+ svgXml = xml;
+ }));
+ console.log("refreStatus modelName=" + modelName);
+ cldsModelService
+ .getModel(modelName)
+ .then(
+ function(pars) {
+ console
+ .log("refreStatus: pars=" +
+ pars);
+ cldsModelService
+ .processRefresh(pars);
+ },
+ function(data) {
+ });
+ };
$scope.cldsConfirmPerformAction = function(uiAction) {
var dlg = dialogs.confirm('Message',
'Do you want to ' +
diff --git a/src/main/resources/clds/clds-reference.properties b/src/main/resources/clds/clds-reference.properties
index ab33d5ce6..a17537603 100644
--- a/src/main/resources/clds/clds-reference.properties
+++ b/src/main/resources/clds/clds-reference.properties
@@ -29,6 +29,7 @@
#
dcae.template={"properties":{"service_name":"","service_ids":[],"vnf_ids":[],"location_ids":[]},"template":{"tca":{"dcae":{"inputTopic":"","outputTopic":"","closedLoopControlName":"","closedLoopEventClient":"configuration.dcae.microservice.tca.xml","policyName":"","policyScope":"service=vSCP;resource=F5;type=configuration","policyVersion":"v0.0.1","serviceConfigurations":{}}}}}
dcae.decode.service_ids={"vUSP":["vUSP - vCTS"],"Trinity":["ASBGv TLS VNF","ASBGv No TLS","ASBGv (NO TLS) VNF","ASBGv TLS","NSBGv VNF","NSBGv"],"vSCP":["AKRON_vSCP_F5_FW-SVC/vSCP_F5_FW 1","ALLEN_vSCP_F5_FW-SVC/vSCP_F5_FW 1"],"vProbes":["vProbes - FW"]}
+dcae.deployment.template={"serviceTypeId": "???", "inputs": {"aaiEnrichmentHost": "10.0.1.1", "enableAAIEnrichment": "true", "subscriberHostName" : "10.0.11.1", "publisherHostName" : "10.0.11.1"}}
#
# SDC request blueprint properties
#
diff --git a/src/test/resources/clds/clds-reference.properties b/src/test/resources/clds/clds-reference.properties
index f45957e76..0657fe7ba 100644
--- a/src/test/resources/clds/clds-reference.properties
+++ b/src/test/resources/clds/clds-reference.properties
@@ -38,6 +38,7 @@ tca.thresholds.template={"closedLoopControlName": "???", "version": "1.0.2","fie
#
dcae.template={"properties":{"service_name":"","service_ids":[],"vnf_ids":[],"location_ids":[]},"template":{"tca":{"dcae":{"inputTopic":"","outputTopic":"","closedLoopControlName":"","closedLoopEventClient":"configuration.dcae.microservice.tca.xml","policyName":"","policyScope":"service=vSCP;resource=F5;type=configuration","policyVersion":"v0.0.1","serviceConfigurations":{}}}}}
dcae.decode.service_ids={"vUSP":["vUSP - vCTS"],"Trinity":["ASBGv TLS VNF","ASBGv No TLS","ASBGv (NO TLS) VNF","ASBGv TLS","NSBGv VNF","NSBGv"],"vSCP":["AKRON_vSCP_F5_FW-SVC/vSCP_F5_FW 1","ALLEN_vSCP_F5_FW-SVC/vSCP_F5_FW 1"],"vProbes":["vProbes - FW"]}
+dcae.deployment.template={"serviceTypeId": "???", "inputs": {"aaiEnrichmentHost": "10.0.1.1", "enableAAIEnrichment": "true", "subscriberHostName" : "10.0.11.1", "publisherHostName" : "10.0.11.1"}}
#
# SDC request blueprint properties
#
diff --git a/src/test/resources/example/tca-policy-req/blueprint-expected.yaml b/src/test/resources/example/tca-policy-req/blueprint-expected.yaml
index ffc50576f..7862e48f7 100644
--- a/src/test/resources/example/tca-policy-req/blueprint-expected.yaml
+++ b/src/test/resources/example/tca-policy-req/blueprint-expected.yaml
@@ -30,7 +30,7 @@ node_templates:
subscriberMessageLimit: '-1', subscriberPollingInterval: '20000', subscriberProtocol: https,
subscriberTimeoutMS: '-1', subscriberTopicName: com.att.dcae.dmaap.mtnje2.DcaeTestVESSub,
subscriberUserName: m00502@tca.af.dcae.att.com, subscriberUserPassword: Te5021abc,
- tca_policy: '{"domain":"measurementsForVfScaling","metricsPerEventName":[{"eventName":"vFirewallBroadcastPackets","controlLoopSchemaType":"VNF","policyScope":"DCAE","policyName":"DCAE.Config_example_model01.ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_TCA_1jy9to4","policyVersion":"v0.0.1","thresholds":[{"closedLoopControlName":"ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_null","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta","thresholdValue":123,"direction":"GREATER_OR_EQUAL","severity":"MAJOR","closedLoopEventStatus":"ONSET"},{"closedLoopControlName":"ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_null","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta","thresholdValue":123,"direction":"GREATER_OR_EQUAL","severity":"MAJOR","closedLoopEventStatus":"ONSET"}]}]}'}
+ tca_policy: '{"domain":"measurementsForVfScaling","metricsPerEventName":[{"eventName":"vFirewallBroadcastPackets","controlLoopSchemaType":"VNF","policyScope":"DCAE","policyName":"example_model01.ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_TCA_1jy9to4","policyVersion":"v0.0.1","thresholds":[{"closedLoopControlName":"ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_null","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta","thresholdValue":123,"direction":"GREATER_OR_EQUAL","severity":"MAJOR","closedLoopEventStatus":"ONSET"},{"closedLoopControlName":"ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_null","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta","thresholdValue":123,"direction":"GREATER_OR_EQUAL","severity":"MAJOR","closedLoopEventStatus":"ONSET"}]}]}'}
artifact_name: dcae-analytics-tca
artifact_version: 1.0.0
connections:
diff --git a/src/test/resources/example/tca-policy-req/tca-policy-expected.json b/src/test/resources/example/tca-policy-req/tca-policy-expected.json
index 2ade75f1e..b71328dd9 100644
--- a/src/test/resources/example/tca-policy-req/tca-policy-expected.json
+++ b/src/test/resources/example/tca-policy-req/tca-policy-expected.json
@@ -6,7 +6,7 @@
"uuid": "test",
"policyScope": "resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e",
"templateVersion": "OpenSource.version.1",
- "policyName": "DCAE.Config_example_model01.ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_TCA_1jy9to4",
+ "policyName": "example_model01.ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_TCA_1jy9to4",
"description": "MicroService vCPE Policy",
"priority": "1",
"riskType": "SampleRiskType",
@@ -20,7 +20,7 @@
"eventName": "vFirewallBroadcastPackets",
"controlLoopSchemaType": "VNF",
"policyScope": "DCAE",
- "policyName": "DCAE.Config_example_model01.ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_TCA_1jy9to4",
+ "policyName": "example_model01.ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_TCA_1jy9to4",
"policyVersion": "v0.0.1",
"thresholds": [
{