summaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'intentanalysis/src/main')
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ObjectType.java4
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfo.java4
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceKnowledgeModule.java53
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModule.java4
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImpl.java12
-rw-r--r--intentanalysis/src/main/resources/intent-analysis-init.sql4
-rw-r--r--intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml4
-rw-r--r--intentanalysis/src/main/resources/mybatis/sql/IMFRegInfoMapper.xml11
8 files changed, 74 insertions, 22 deletions
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ObjectType.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ObjectType.java
index afd1a04..d636856 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ObjectType.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/ObjectType.java
@@ -20,8 +20,8 @@ import lombok.Setter;
@Getter
public enum ObjectType {
- OBJECT1(0, "objectType1"),
- OBJECT2(1, "objectType2");
+ SLICING(0, "objectType1"),
+ CCVPN(1, "objectType2");
private int index;
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfo.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfo.java
index 7b3ff5a..d6ab5b8 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfo.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfo.java
@@ -26,9 +26,9 @@ import java.util.List;
public class IntentManagementFunctionRegInfo {
private String id;
private String description;
- private List<SupportArea> supportArea;
+ private String supportArea;//Separate multiple values with commas
private String supportModel;
- private List<SupportInterface> supportInterfaces;
+ private String supportInterfaces;//Separate multiple values with commas
private String handleName;
//distinguish internal or external function
private IntentFunctionType intentFunctionType;
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceKnowledgeModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceKnowledgeModule.java
index c1300f0..dd560ff 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceKnowledgeModule.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceKnowledgeModule.java
@@ -15,13 +15,41 @@
*/
package org.onap.usecaseui.intentanalysis.cllassuranceIntentmgt.cllassurancemodule;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.log4j.Log4j2;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.onap.usecaseui.intentanalysis.adapters.aai.apicall.AAIAPICall;
+import org.onap.usecaseui.intentanalysis.adapters.aai.apicall.AAIAuthConfig;
import org.onap.usecaseui.intentanalysis.bean.models.Intent;
import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.KnowledgeModule;
+import org.onap.usecaseui.intentanalysis.util.RestfulServices;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import retrofit2.Response;
+import java.io.IOException;
+
+@Log4j2
@Component
public class CLLAssuranceKnowledgeModule extends KnowledgeModule {
+ private AAIAPICall aaiapiCall;
+ @Autowired
+ AAIAuthConfig aaiAuthConfig;
+
+ public AAIAPICall getAaiApiCall() {
+ if (null == aaiapiCall) {
+ this.aaiapiCall = RestfulServices.create(AAIAPICall.class,
+ aaiAuthConfig.getUserName(), aaiAuthConfig.getPassword());
+ }
+ return this.aaiapiCall;
+ }
+
+ public void setAAIApiCall(AAIAPICall aaiApiCall) {
+ this.aaiapiCall = aaiApiCall;
+ }
+
@Override
public IntentGoalBean intentCognition(Intent intent) {
return null;
@@ -41,4 +69,29 @@ public class CLLAssuranceKnowledgeModule extends KnowledgeModule {
public boolean recieveDeleteIntent() {
return false;
}
+
+ /**
+ * healthy check
+ */
+ int getSystemStatus(Intent intent) {
+ try {
+ if (CollectionUtils.isEmpty(intent.getIntentExpectations())) {
+ return -1;
+ }
+ String objectInstance = intent.getIntentExpectations().get(0).getExpectationObject().getObjectInstance();
+ if (StringUtils.isEmpty(objectInstance)){
+ return -1;
+ }
+ Response<JSONObject> response = getAaiApiCall().getInstanceInfo(objectInstance).execute();
+ log.debug(response.toString());
+ if (response.isSuccessful()) {
+ // TODO: 2022/9/20 judge by the return result
+ }
+ log.error("getIntentInstance Create Statue Error:" + response.toString());
+ return -1;
+ } catch (Exception ex) {
+ log.error("Details:" + ex.getMessage());
+ return 0;
+ }
+ }
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModule.java
index 968add2..507ada8 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModule.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModule.java
@@ -40,7 +40,7 @@ public class FormatIntentInputDecisionModule extends DecisionModule {
public IntentManagementFunction exploreIntentHandlers(IntentGoalBean intentGoalBean) {
// if intentName contain cll return
if (intentGoalBean.getIntent().getIntentName().toLowerCase(Locale.ROOT).contains("cll")) {
- return (IntentManagementFunction) applicationContext.getBean(CLLBusinessIntentManagementFunction.class.getSimpleName());
+ return (IntentManagementFunction) applicationContext.getBean(CLLBusinessIntentManagementFunction.class.getSimpleName());
}
return null;
}
@@ -63,7 +63,7 @@ public class FormatIntentInputDecisionModule extends DecisionModule {
boolean needDecompostion = needDecompostion(intentGoalBean);
if (needDecompostion) {
intentDecomposition(intentGoalBean);
- }else{
+ } else {
intentMap.put(intentGoalBean, exploreIntentHandlers(intentGoalBean));
}
return intentMap;
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImpl.java
index 595acad..ad636d8 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImpl.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImpl.java
@@ -16,6 +16,7 @@
package org.onap.usecaseui.intentanalysis.service.impl;
import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
import org.onap.usecaseui.intentanalysis.bean.enums.SupportArea;
@@ -58,14 +59,15 @@ public class ImfRegInfoServiceImpl implements ImfRegInfoService {
for (IntentManagementFunctionRegInfo imfr : imfRegInfoList) {
boolean containsArea = false;
boolean containsInterface = false;
- for (SupportArea area : imfr.getSupportArea()) {
- if (StringUtils.containsIgnoreCase(intentName, area.name())) {
+ for (String area : imfr.getSupportArea().split(",")) {
+ if (StringUtils.containsIgnoreCase(intentName, area)) {
containsArea = true;
break;
}
}
- for (SupportInterface supInterface : imfr.getSupportInterfaces()) {
- if (StringUtils.containsIgnoreCase(supInterface.name(), intentGoalType.name())) {
+ if (!containsArea) break;
+ for (String supInterface : imfr.getSupportInterfaces().split(",")) {
+ if (StringUtils.containsIgnoreCase(supInterface, intentGoalType.name())) {
containsInterface = true;
break;
}
@@ -74,7 +76,7 @@ public class ImfRegInfoServiceImpl implements ImfRegInfoService {
imfList.add(imfr);
}
}
- if (!Optional.ofNullable(imfList).isPresent()) {
+ if (CollectionUtils.isEmpty(imfList)) {
log.info("The intent name is %s not find the corresponding IntentManagementFunction", intentName);
}
//TODO call probe interface if fail intentFulfilmentInfo throw exception
diff --git a/intentanalysis/src/main/resources/intent-analysis-init.sql b/intentanalysis/src/main/resources/intent-analysis-init.sql
index e5af890..88773f6 100644
--- a/intentanalysis/src/main/resources/intent-analysis-init.sql
+++ b/intentanalysis/src/main/resources/intent-analysis-init.sql
@@ -64,9 +64,9 @@ create table if not exists condition(
create table if not exists intent_management_function_reg_info(
imfr_info_id varchar(255) primary key,
imfr_info_description varchar(255),
- support_area text ARRAY,
+ support_area varchar(255),
support_model varchar(255),
- support_interfaces text ARRAY,
+ support_interfaces varchar(255),
handle_name varchar(255),
intent_function_type varchar(255)
); \ No newline at end of file
diff --git a/intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml
index 012dfca..ccce147 100644
--- a/intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml
+++ b/intentanalysis/src/main/resources/mybatis/sql/ConditionMapper.xml
@@ -27,13 +27,13 @@
</insert>
<!-- 这里的查询有问题-->
<select id="selectConditionList" resultType="org.onap.usecaseui.intentanalysis.bean.models.Condition">
- select condition_id conditionId, condition_name conditionName, operator_type operator, condition_value conditionValue
+ select condition_id conditionId, condition_name conditionName, operator_type "operator", condition_value conditionValue
from condition
where parent_id = #{parentId}
</select>
<select id="selectCondition" resultType="org.onap.usecaseui.intentanalysis.bean.models.Condition">
- select condition_id conditionId, condition_name conditionName, operator_type operator, condition_value conditionValue
+ select condition_id conditionId, condition_name conditionName, operator_type "operator", condition_value conditionValue
from condition
where condition_id = #{conditionId}
</select>
diff --git a/intentanalysis/src/main/resources/mybatis/sql/IMFRegInfoMapper.xml b/intentanalysis/src/main/resources/mybatis/sql/IMFRegInfoMapper.xml
index fd632b3..504c244 100644
--- a/intentanalysis/src/main/resources/mybatis/sql/IMFRegInfoMapper.xml
+++ b/intentanalysis/src/main/resources/mybatis/sql/IMFRegInfoMapper.xml
@@ -5,19 +5,16 @@
<mapper namespace="org.onap.usecaseui.intentanalysis.mapper.IMFRegInfoMapper">
- <resultMap id="mapIMFRInfo" type="org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo">
- <result column="support_area" property="supportArea" typeHandler="org.onap.usecaseui.intentanalysis.util.ListArrayTypeHandler" jdbcType="ARRAY" javaType="java.util.List"/>
- <result column="support_interfaces" property="supportInterfaces" typeHandler="org.onap.usecaseui.intentanalysis.util.ListArrayTypeHandler" jdbcType="ARRAY" javaType="java.util.List"/>
- </resultMap>
-
<insert id="insertIMFRegInfoRegInfo">
insert into intent_management_function_reg_info(imfr_info_id,imfr_info_description,support_area,support_model,support_interfaces,handle_name,intent_function_type)
values
(#{imfregInfo.id}, #{imfregInfo.description},#{imfregInfo.supportArea} , #{imfregInfo.supportModel},#{imfregInfo.supportInterfaces},#{imfregInfo.handleName},#{imfregInfo.intentFunctionType})
</insert>
- <select id="getImfRegInfoList" resultMap="mapIMFRInfo">
- select * from intent_management_function_reg_info
+ <select id="getImfRegInfoList" resultType="org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo">
+ select imfr_info_id id,imfr_info_description description,support_area supportArea, support_model supportModel,
+ support_interfaces supportInterfaces,handle_name handleName,intent_function_type intentFunctionType
+ from intent_management_function_reg_info
</select>
</mapper>