summaryrefslogtreecommitdiffstats
path: root/intentanalysis
diff options
context:
space:
mode:
Diffstat (limited to 'intentanalysis')
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessActuationModule.java2
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceActuationModule.java66
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryActuationModule.java69
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputActuationModule.java2
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/ActuationModule.java2
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentProcessService.java1
6 files changed, 124 insertions, 18 deletions
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessActuationModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessActuationModule.java
index 3cbffcb..62626bc 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessActuationModule.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessActuationModule.java
@@ -53,7 +53,7 @@ public class CLLBusinessActuationModule extends ActuationModule {
}
@Override
- public void directOperation() {
+ public void directOperation(IntentGoalBean intentGoalBean) {
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceActuationModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceActuationModule.java
index 6a091c5..c80c717 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceActuationModule.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceActuationModule.java
@@ -15,22 +15,44 @@
*/
package org.onap.usecaseui.intentanalysis.cllassuranceIntentmgt.cllassurancemodule;
-import org.onap.usecaseui.intentanalysis.bean.models.Intent;
-import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
+import org.apache.commons.lang.StringUtils;
+import org.onap.usecaseui.intentanalysis.adapters.policy.PolicyService;
+import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
+import org.onap.usecaseui.intentanalysis.bean.models.*;
import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule;
+import org.onap.usecaseui.intentanalysis.service.IntentService;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import java.util.List;
+
@Component
public class CLLAssuranceActuationModule extends ActuationModule {
+ @Autowired
+ private IntentService intentService;
+
+ @Autowired
+ private PolicyService policyService;
+
@Override
public void toNextIntentHandler(IntentGoalBean intentGoalBean, IntentManagementFunction IntentHandler) {
}
@Override
- public void directOperation() {
-
+ public void directOperation(IntentGoalBean intentGoalBean) {
+ Intent intent = intentGoalBean.getIntent();
+ String cllId = getCLLId(intent);
+ String bandwidth = getBandwidth(cllId);
+ IntentGoalType intentGoalType = intentGoalBean.getIntentGoalType();
+ if (StringUtils.equalsIgnoreCase("create", intentGoalType.name())) {
+ policyService.updateIntentConfigPolicy(cllId, bandwidth, "true");
+ } else if (StringUtils.equalsIgnoreCase("update", intentGoalType.name())) {
+ policyService.updateIntentConfigPolicy(cllId, bandwidth, "false");
+ } else if (StringUtils.equalsIgnoreCase("delete", intentGoalType.name())) {
+ policyService.updateIntentConfigPolicy(cllId, bandwidth, "false");
+ }
}
@Override
@@ -40,10 +62,44 @@ public class CLLAssuranceActuationModule extends ActuationModule {
@Override
public void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler) {
- directOperation();
+ directOperation(intentGoalBean);
}
+ @Override
public void updateIntentOperationInfo(Intent originIntent, IntentGoalBean intentGoalBean){
}
+
+ private String getBandwidth(String cllId) {
+ List<Intent> deliveryIntentList = intentService.getIntentByName("CLL Delivery Intent");
+ for (Intent deliveryIntent : deliveryIntentList) {
+ List<Expectation> deliveryExpectationList = deliveryIntent.getIntentExpectations();
+ for (Expectation deliveryExpectation : deliveryExpectationList) {
+ if (StringUtils.equalsIgnoreCase(cllId, deliveryExpectation.getExpectationObject().getObjectInstance())) {
+ List<ExpectationTarget> deliveryTargetList = deliveryExpectation.getExpectationTargets();
+ for (ExpectationTarget deliveryTarget : deliveryTargetList) {
+ if (StringUtils.equalsIgnoreCase("bandwidth", deliveryTarget.getTargetName())) {
+ List<Condition> deliveryConditionList = deliveryTarget.getTargetConditions();
+ for (Condition deliveryCondition : deliveryConditionList) {
+ if (StringUtils.equalsIgnoreCase("condition of the cll service bandwidth", deliveryCondition.getConditionName())) {
+ return deliveryCondition.getConditionValue();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public String getCLLId(Intent intent) {
+ List<Expectation> expectationList = intent.getIntentExpectations();
+ for (Expectation expectation : expectationList) {
+ if (StringUtils.equalsIgnoreCase("assurance", expectation.getExpectationType().name())) {
+ return expectation.getExpectationObject().getObjectInstance();
+ }
+ }
+ return null;
+ }
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryActuationModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryActuationModule.java
index cca03fe..641ecaf 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryActuationModule.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryActuationModule.java
@@ -15,21 +15,32 @@
*/
package org.onap.usecaseui.intentanalysis.clldeliveryIntentmgt.clldeliverymodule;
-import java.util.List;
-import org.onap.usecaseui.intentanalysis.bean.models.Expectation;
-import org.onap.usecaseui.intentanalysis.bean.models.ExpectationObject;
-import org.onap.usecaseui.intentanalysis.bean.models.Intent;
-import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
+import org.apache.commons.lang.StringUtils;
+import org.onap.usecaseui.intentanalysis.adapters.so.SOService;
+import org.onap.usecaseui.intentanalysis.bean.models.*;
import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule;
+import org.onap.usecaseui.intentanalysis.service.ExpectationObjectService;
import org.onap.usecaseui.intentanalysis.service.IntentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
@Component
public class CLLDeliveryActuationModule extends ActuationModule {
+
+ @Autowired
+ private SOService soService;
+
+ @Autowired
+ private ExpectationObjectService expectationObjectService;
+
@Autowired
- IntentService intentService;
+ private IntentService intentService;
@Override
public void toNextIntentHandler(IntentGoalBean intentGoalBean, IntentManagementFunction IntentHandler) {
@@ -37,8 +48,37 @@ public class CLLDeliveryActuationModule extends ActuationModule {
}
@Override
- public void directOperation() {
-
+ public void directOperation(IntentGoalBean intentGoalBean) {
+ Intent intent = intentGoalBean.getIntent();
+ if (StringUtils.equalsIgnoreCase("create", intentGoalBean.getIntentGoalType().name())) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> accessPointOne = new HashMap<>();
+ List<ExpectationTarget> targetList = intent.getIntentExpectations().get(0).getExpectationTargets();
+ for (ExpectationTarget target : targetList) {
+ String conditionName = target.getTargetConditions().get(0).getConditionName();
+ String conditionValue = target.getTargetConditions().get(0).getConditionValue();
+ if (StringUtils.containsIgnoreCase(conditionName, "source")) {
+ accessPointOne.put("name", conditionValue);
+ } else if (StringUtils.containsIgnoreCase(conditionName, "destination")) {
+ params.put("cloudPointName", conditionValue);
+ } else if (StringUtils.containsIgnoreCase(conditionName, "bandwidth")) {
+ accessPointOne.put("bandwidth", conditionValue);
+ }
+ }
+ params.put("accessPointOne", accessPointOne);
+ params.put("instanceId", getInstanceId());
+ params.put("name", "cll-" + params.get("instanceId"));
+ params.put("protect", false);
+ soService.createIntentInstance(params);
+ String expectationId = intent.getIntentExpectations().get(0).getExpectationId();
+ ExpectationObject expectationObject = expectationObjectService.getExpectationObject(expectationId);
+ expectationObject.setObjectInstance((String) params.get("name"));
+ expectationObjectService.updateExpectationObject(expectationObject, expectationId);
+ } else {
+ String instanceId = intent.getIntentExpectations().get(0).getExpectationObject().getObjectInstance();
+ soService.deleteIntentInstance(instanceId);
+ intentService.deleteIntent(intent.getIntentId());
+ }
}
@Override
@@ -48,7 +88,18 @@ public class CLLDeliveryActuationModule extends ActuationModule {
@Override
public void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler) {
- this.directOperation();
+ this.directOperation(intentGoalBean);
+ }
+
+ public String getInstanceId() {
+ int random = (int) (Math.random() * 9 + 1);
+
+ String randomString = String.valueOf(random);
+ int hashCode = UUID.randomUUID().toString().hashCode();
+ if (hashCode < 0) {
+ hashCode = -hashCode;
+ }
+ return randomString + String.format("%015d", hashCode);
}
public void updateIntentOperationInfo(Intent originIntent, IntentGoalBean intentGoalBean){
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputActuationModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputActuationModule.java
index 8a5dfaf..c3c8f3d 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputActuationModule.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputActuationModule.java
@@ -48,7 +48,7 @@ public class FormatIntentInputActuationModule extends ActuationModule {
}
@Override
- public void directOperation() {
+ public void directOperation(IntentGoalBean intentGoalBean) {
}
@Override
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/ActuationModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/ActuationModule.java
index 84c391e..5641e99 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/ActuationModule.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/ActuationModule.java
@@ -36,7 +36,7 @@ public abstract class ActuationModule {
public abstract void toNextIntentHandler(IntentGoalBean intentGoalBean, IntentManagementFunction IntentHandler);
//Direct operation
- public abstract void directOperation();
+ public abstract void directOperation(IntentGoalBean intentGoalBean);
public abstract void interactWithIntentHandle();
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentProcessService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentProcessService.java
index 5c447d9..4dfc492 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentProcessService.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentProcessService.java
@@ -59,7 +59,6 @@ public class IntentProcessService {
intentDetectionService.setIntentRole(intentOwner, intentHandler);
IntentGoalBean newIntentGoalBean = intentDetectionService.detectionProcess(originIntentGoalBean);
- //如果是update,直接在investigationProcess获得intent中定义的handler的信息,然后一个update 或者两个update
//investigation process
intentInvestigationService.setIntentRole(intentOwner, intentHandler);
LinkedHashMap<IntentGoalBean, IntentManagementFunction> intentMap =