summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author’zhaoyh6‘ <zhaoyh6@asiainfo.com>2021-11-03 11:17:58 +0800
committer’zhaoyh6‘ <zhaoyh6@asiainfo.com>2021-11-03 11:18:46 +0800
commit796799423400ef467e0087dec24c55f2925fcb4b (patch)
treebb93074721bf2ca8f9c503b21fceef48ab777e55
parent8a082cb9ef0b96a06760ee10233c629d12fab9cd (diff)
feat:Add the function of obtaining instance creation progress
Issue-ID: USECASEUI-605 Signed-off-by: ’zhaoyh6‘ <zhaoyh6@asiainfo.com> Change-Id: I4458ba77b61ee95ffafac6e3595421a68f2594ac
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/bean/intent/CCVPNInstance.java (renamed from server/src/main/java/org/onap/usecaseui/server/bean/intent/IntentInstance.java)6
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/conf/intent/IntentScheduleTask.java2
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/IntentController.java24
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/intent/IntentApiService.java9
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/intent/IntentInstanceService.java8
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/intent/impl/IntentInstanceServiceImpl.java140
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/controller/IntentControllerTest.java6
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/intent/impl/IntentInstanceServiceImplTest.java22
-rw-r--r--standalone/src/main/assembly/resources/dbscripts/postgres/uui_create_table.sql6
9 files changed, 117 insertions, 106 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/intent/IntentInstance.java b/server/src/main/java/org/onap/usecaseui/server/bean/intent/CCVPNInstance.java
index 8676821e..f9a56b97 100644
--- a/server/src/main/java/org/onap/usecaseui/server/bean/intent/IntentInstance.java
+++ b/server/src/main/java/org/onap/usecaseui/server/bean/intent/CCVPNInstance.java
@@ -18,8 +18,8 @@ import javax.persistence.*;
import java.io.Serializable;
@Entity
-@Table(name="intent_instance")
-public class IntentInstance implements Serializable {
+@Table(name="ccvpn_instance")
+public class CCVPNInstance implements Serializable {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@@ -59,7 +59,7 @@ public class IntentInstance implements Serializable {
@Column(name = "delete_state")
private int deleteState;
- public IntentInstance() {
+ public CCVPNInstance() {
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/conf/intent/IntentScheduleTask.java b/server/src/main/java/org/onap/usecaseui/server/conf/intent/IntentScheduleTask.java
index 4f168801..f84ad497 100644
--- a/server/src/main/java/org/onap/usecaseui/server/conf/intent/IntentScheduleTask.java
+++ b/server/src/main/java/org/onap/usecaseui/server/conf/intent/IntentScheduleTask.java
@@ -33,7 +33,7 @@ public class IntentScheduleTask {
@Scheduled(cron = "0/20 * * * * ?")
public void getIntentInstanceCompleteness() {
- intentInstanceService.getIntentInstanceCreateStatus();
+ intentInstanceService.getIntentInstanceProgress();
}
@Scheduled(cron = "0/20 * * * * ?")
public void getIntentInstanceBandwidth() throws IOException {
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/IntentController.java b/server/src/main/java/org/onap/usecaseui/server/controller/IntentController.java
index 4dbed7bd..3dd3572c 100644
--- a/server/src/main/java/org/onap/usecaseui/server/controller/IntentController.java
+++ b/server/src/main/java/org/onap/usecaseui/server/controller/IntentController.java
@@ -24,7 +24,7 @@ import javax.annotation.Resource;
import com.alibaba.fastjson.JSONArray;
import org.apache.commons.collections.MapUtils;
import org.onap.usecaseui.server.bean.HttpResponseResult;
-import org.onap.usecaseui.server.bean.intent.IntentInstance;
+import org.onap.usecaseui.server.bean.intent.CCVPNInstance;
import org.onap.usecaseui.server.bean.intent.IntentModel;
import org.onap.usecaseui.server.bean.intent.IntentResponseBody;
import org.onap.usecaseui.server.service.csmf.SlicingService;
@@ -362,16 +362,16 @@ public class IntentController {
String accessPointOneName = MapUtils.getString(accessPointOne, "name");
int accessPointOneBandWidth = MapUtils.getIntValue(accessPointOne, "bandwidth");
- IntentInstance intentInstance = new IntentInstance();
- intentInstance.setInstanceId(intentInstanceId);
- intentInstance.setName(name);
- intentInstance.setLineNum(lineNum);
- intentInstance.setCloudPointName(cloudPointName);
- intentInstance.setAccessPointOneName(accessPointOneName);
- intentInstance.setAccessPointOneBandWidth(accessPointOneBandWidth);
- intentInstance.setStatus("0");
+ CCVPNInstance instance = new CCVPNInstance();
+ instance.setInstanceId(intentInstanceId);
+ instance.setName(name);
+ instance.setLineNum(lineNum);
+ instance.setCloudPointName(cloudPointName);
+ instance.setAccessPointOneName(accessPointOneName);
+ instance.setAccessPointOneBandWidth(accessPointOneBandWidth);
+ instance.setStatus("0");
- int flag = intentInstanceService.createIntentInstance(intentInstance);
+ int flag = intentInstanceService.createIntentInstance(instance);
if(flag == 1) {
return "OK";
@@ -385,9 +385,9 @@ public class IntentController {
@GetMapping(value = {"/getFinishedInstanceInfo"},
produces = "application/json")
public Object getFinishedInstanceInfo() {
- List<IntentInstance> instanceList = intentInstanceService.getFinishedInstanceInfo();
+ List<CCVPNInstance> instanceList = intentInstanceService.getFinishedInstanceInfo();
List<Map<String, Object>> result = new ArrayList<>();
- for (IntentInstance instance : instanceList) {
+ for (CCVPNInstance instance : instanceList) {
Map<String, Object> instanceInfo = new HashMap<>();
instanceInfo.put("instanceId", instance.getInstanceId());
instanceInfo.put("name", instance.getName());
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/intent/IntentApiService.java b/server/src/main/java/org/onap/usecaseui/server/service/intent/IntentApiService.java
index 62f2381a..4d526389 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/intent/IntentApiService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/intent/IntentApiService.java
@@ -30,6 +30,15 @@ public interface IntentApiService {
@POST("/so/infra/serviceIntent/v1/create")
Call<JSONObject> createIntentInstance(@Body RequestBody body);
+// curl -X GET -H "content-type:application/json" http://so:8080/onap/so/infra/e2eServiceInstances/v3/cll-101/operations/0d698405-9109-49f2-9939-fd02ead31660 --user 'InfraPortalClient:password1$'
+
+ @Headers({
+ "Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==",
+ "Accept: application/json"
+ })
+ @GET("/so/infra/e2eServiceInstances/v3/{serviceId}/operations/{operationId}")
+ Call<JSONObject> queryOperationProgress(@Path("serviceId") String serviceId, @Path("operationId") String operationId);
+
@Headers({
"X-TransactionId: 9999",
"X-FromAppId: MSO",
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/intent/IntentInstanceService.java b/server/src/main/java/org/onap/usecaseui/server/service/intent/IntentInstanceService.java
index ddbcb6e4..2491cc26 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/intent/IntentInstanceService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/intent/IntentInstanceService.java
@@ -17,7 +17,7 @@ package org.onap.usecaseui.server.service.intent;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
-import org.onap.usecaseui.server.bean.intent.IntentInstance;
+import org.onap.usecaseui.server.bean.intent.CCVPNInstance;
import org.onap.usecaseui.server.util.Page;
import java.io.IOException;
@@ -25,11 +25,11 @@ import java.util.List;
import java.util.Map;
public interface IntentInstanceService {
- Page<IntentInstance> queryIntentInstance(IntentInstance intentInstance, int currentPage, int pageSize);
- int createIntentInstance(IntentInstance intentInstance);
+ Page<CCVPNInstance> queryIntentInstance(CCVPNInstance instance, int currentPage, int pageSize);
+ int createIntentInstance(CCVPNInstance instance);
void getIntentInstanceProgress();
void getIntentInstanceCreateStatus();
- List<IntentInstance> getFinishedInstanceInfo();
+ List<CCVPNInstance> getFinishedInstanceInfo();
void getIntentInstanceBandwidth() throws IOException;
void deleteIntentInstance(String instanceId);
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/intent/impl/IntentInstanceServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/intent/impl/IntentInstanceServiceImpl.java
index 6b1e96c9..2e3c9614 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/intent/impl/IntentInstanceServiceImpl.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/intent/impl/IntentInstanceServiceImpl.java
@@ -23,11 +23,10 @@ import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.onap.usecaseui.server.bean.intent.InstancePerformance;
-import org.onap.usecaseui.server.bean.intent.IntentInstance;
+import org.onap.usecaseui.server.bean.intent.CCVPNInstance;
import org.onap.usecaseui.server.service.intent.IntentApiService;
import org.onap.usecaseui.server.service.intent.IntentInstanceService;
import org.onap.usecaseui.server.service.lcm.domain.so.SOService;
-import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInformation;
import org.onap.usecaseui.server.util.Page;
import org.onap.usecaseui.server.util.RestfulServices;
import org.onap.usecaseui.server.util.UuiCommonUtil;
@@ -79,33 +78,33 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
}
@Override
- public Page<IntentInstance> queryIntentInstance(IntentInstance intentInstance, int currentPage, int pageSize) {
- Page<IntentInstance> page = new Page<IntentInstance>();
- int allRow =this.getAllCount(intentInstance,currentPage,pageSize);
+ public Page<CCVPNInstance> queryIntentInstance(CCVPNInstance instance, int currentPage, int pageSize) {
+ Page<CCVPNInstance> page = new Page<CCVPNInstance>();
+ int allRow =this.getAllCount(instance,currentPage,pageSize);
int offset = page.countOffset(currentPage, pageSize);
Session session = getSession();
try{
- StringBuffer hql =new StringBuffer("from IntentInstance a where deleteState = 0");
- if (null != intentInstance) {
- if(UuiCommonUtil.isNotNullOrEmpty(intentInstance.getInstanceId())) {
- String ver =intentInstance.getInstanceId();
+ StringBuffer hql =new StringBuffer("from CCVPNInstance a where deleteState = 0");
+ if (null != instance) {
+ if(UuiCommonUtil.isNotNullOrEmpty(instance.getInstanceId())) {
+ String ver =instance.getInstanceId();
hql.append(" and a.instance_id = '"+ver+"'");
}
- if(UuiCommonUtil.isNotNullOrEmpty(intentInstance.getJobId())) {
- String ver =intentInstance.getJobId();
+ if(UuiCommonUtil.isNotNullOrEmpty(instance.getJobId())) {
+ String ver =instance.getJobId();
hql.append(" and a.job_id = '"+ver+"'");
}
- if(UuiCommonUtil.isNotNullOrEmpty(intentInstance.getStatus())) {
- String ver =intentInstance.getStatus();
+ if(UuiCommonUtil.isNotNullOrEmpty(instance.getStatus())) {
+ String ver =instance.getStatus();
hql.append(" and a.status = '"+ver+"'");
}
}
hql.append(" order by id");
- logger.info("AlarmsHeaderServiceImpl queryIntentInstance: intentInstance={}", intentInstance);
+ logger.info("AlarmsHeaderServiceImpl queryIntentInstance: instance={}", instance);
Query query = session.createQuery(hql.toString());
query.setFirstResult(offset);
query.setMaxResults(pageSize);
- List<IntentInstance> list= query.list();
+ List<CCVPNInstance> list= query.list();
page.setPageNo(currentPage);
page.setPageSize(pageSize);
page.setTotalRecords(allRow);
@@ -120,21 +119,21 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
}
- public int getAllCount(IntentInstance intentInstance,int currentPage,int pageSize) {
+ public int getAllCount(CCVPNInstance instance, int currentPage, int pageSize) {
Session session = getSession();
try{
- StringBuffer count=new StringBuffer("select count(*) from IntentInstance a where deleteState = 0");
- if (null != intentInstance) {
- if(UuiCommonUtil.isNotNullOrEmpty(intentInstance.getInstanceId())) {
- String ver =intentInstance.getInstanceId();
+ StringBuffer count=new StringBuffer("select count(*) from CCVPNInstance a where deleteState = 0");
+ if (null != instance) {
+ if(UuiCommonUtil.isNotNullOrEmpty(instance.getInstanceId())) {
+ String ver =instance.getInstanceId();
count.append(" and a.instance_id = '"+ver+"'");
}
- if(UuiCommonUtil.isNotNullOrEmpty(intentInstance.getJobId())) {
- String ver =intentInstance.getJobId();
+ if(UuiCommonUtil.isNotNullOrEmpty(instance.getJobId())) {
+ String ver =instance.getJobId();
count.append(" and a.job_id = '"+ver+"'");
}
- if(UuiCommonUtil.isNotNullOrEmpty(intentInstance.getStatus())) {
- String ver =intentInstance.getStatus();
+ if(UuiCommonUtil.isNotNullOrEmpty(instance.getStatus())) {
+ String ver =instance.getStatus();
count.append(" and a.status = '"+ver+"'");
}
}
@@ -150,25 +149,25 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
}
@Override
- public int createIntentInstance(IntentInstance intentInstance) {
+ public int createIntentInstance(CCVPNInstance instance) {
Session session = getSession();
Transaction tx = null;
try{
- if (null == intentInstance){
- logger.error("intentInstance is null!");
+ if (null == instance){
+ logger.error("instance is null!");
return 0;
}
- String jobId = createIntentInstanceToSO(intentInstance);
+ String jobId = createIntentInstanceToSO(instance);
if (null == jobId){
logger.error("create Instance error:jobId is null");
return 0;
}
- intentInstance.setJobId(jobId);
- intentInstance.setResourceInstanceId("cll-"+intentInstance.getInstanceId());
+ instance.setJobId(jobId);
+ instance.setResourceInstanceId("cll-"+instance.getInstanceId());
tx = session.beginTransaction();
- session.save(intentInstance);
+ session.save(instance);
tx.commit();
return 1;
} catch (Exception e) {
@@ -182,9 +181,9 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
}
}
- private String createIntentInstanceToSO(IntentInstance intentInstance) throws IOException {
+ private String createIntentInstanceToSO(CCVPNInstance instance) throws IOException {
Map<String, Object> params = new HashMap<>();
- params.put("name", intentInstance.getName());
+ params.put("name", instance.getName());
params.put("modelInvariantUuid", "6790ab0e-034f-11eb-adc1-0242ac120002");
params.put("modelUuid", "6790ab0e-034f-11eb-adc1-0242ac120002");
params.put("globalSubscriberId", "IBNCustomer");
@@ -192,18 +191,18 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
params.put("serviceType", "CLL");
Map<String, Object> additionalProperties = new HashMap<>();
additionalProperties.put("enableSdnc", "false");
- additionalProperties.put("serviceInstanceID", "cll-" + intentInstance.getInstanceId());
+ additionalProperties.put("serviceInstanceID", "cll-" + instance.getInstanceId());
List<Map<String, Object>> transportNetworks = new ArrayList<>();
Map<String, Object> transportNetwork = new HashMap<>();
transportNetwork.put("id", "");
Map<String, Object> sla = new HashMap<>();
sla.put("latency", "2");
- sla.put("maxBandwidth", intentInstance.getAccessPointOneBandWidth());
+ sla.put("maxBandwidth", instance.getAccessPointOneBandWidth());
List<Map<String, Object>> connectionLinks = new ArrayList<>();
Map<String, Object> connectionLink = new HashMap<>();
connectionLink.put("name", "");
- connectionLink.put("transportEndpointA", intentInstance.getAccessPointOneName());
- connectionLink.put("transportEndpointB", intentInstance.getCloudPointName());
+ connectionLink.put("transportEndpointA", instance.getAccessPointOneName());
+ connectionLink.put("transportEndpointB", instance.getCloudPointName());
connectionLinks.add(connectionLink);
transportNetwork.put("sla", sla);
transportNetwork.put("connectionLinks", connectionLinks);
@@ -221,11 +220,12 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
@Override
public void getIntentInstanceProgress() {
- List<IntentInstance> instanceList = getInstanceByFinishedFlag("0");
- for (IntentInstance instance: instanceList) {
+ List<CCVPNInstance> instanceList = getInstanceByFinishedFlag("0");
+ for (CCVPNInstance instance: instanceList) {
try {
int progress = getProgressByJobId(instance);
+ instance.setProgress(progress);
if (progress >=100) {
instance.setStatus("1");
}
@@ -239,8 +239,8 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
}
@Override
public void getIntentInstanceCreateStatus() {
- List<IntentInstance> instanceList = getInstanceByFinishedFlag("0");
- for (IntentInstance instance: instanceList) {
+ List<CCVPNInstance> instanceList = getInstanceByFinishedFlag("0");
+ for (CCVPNInstance instance: instanceList) {
try {
int flag = getCreateStatusByJobId(instance);
@@ -256,7 +256,7 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
}
- private void saveProgress(List<IntentInstance> instanceList) {
+ private void saveProgress(List<CCVPNInstance> instanceList) {
if(instanceList == null || instanceList.isEmpty()) {
return;
}
@@ -264,7 +264,7 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
Transaction tx = null;
try {
tx = session.beginTransaction();
- for (IntentInstance instance : instanceList) {
+ for (CCVPNInstance instance : instanceList) {
session.update(instance);
session.flush();
}
@@ -282,16 +282,18 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
}
}
- private int getProgressByJobId(IntentInstance instance) throws IOException {
- Response<OperationProgressInformation> response = soService.queryOperationProgress(instance.getResourceInstanceId(), instance.getJobId()).execute();
+ private int getProgressByJobId(CCVPNInstance instance) throws IOException {
+ Response<JSONObject> response = intentApiService.queryOperationProgress(instance.getResourceInstanceId(), instance.getJobId()).execute();
logger.debug(response.toString());
if (response.isSuccessful()) {
- return response.body().getOperationStatus().getProgress();
+ if (response.body().containsKey("operation")) {
+ return response.body().getJSONObject("operation").getInteger("progress");
+ }
}
return -1;
}
- private int getCreateStatusByJobId(IntentInstance instance) throws IOException {
+ private int getCreateStatusByJobId(CCVPNInstance instance) throws IOException {
if (instance == null || instance.getResourceInstanceId() == null) {
return -1;
}
@@ -308,13 +310,13 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
return -1;
}
- private List<IntentInstance> getInstanceByFinishedFlag(String flag) {
+ private List<CCVPNInstance> getInstanceByFinishedFlag(String flag) {
Session session = getSession();
try{
- StringBuffer sql=new StringBuffer("from IntentInstance where deleteState = 0 and status = '" + flag + "'");
+ StringBuffer sql=new StringBuffer("from CCVPNInstance where deleteState = 0 and status = '" + flag + "'");
Query query = session.createQuery(sql.toString());
- List<IntentInstance> q=(List<IntentInstance>) query.list();
+ List<CCVPNInstance> q=(List<CCVPNInstance>) query.list();
logger.debug(q.toString());
return q;
} catch (Exception e) {
@@ -327,13 +329,13 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
@Override
- public List<IntentInstance> getFinishedInstanceInfo() {
+ public List<CCVPNInstance> getFinishedInstanceInfo() {
Session session = getSession();
try{
- StringBuffer count=new StringBuffer("from IntentInstance where status = '1' and deleteState = 0");
+ StringBuffer count=new StringBuffer("from CCVPNInstance where status = '1' and deleteState = 0");
Query query = session.createQuery(count.toString());
- List<IntentInstance> q=(List<IntentInstance>) query.list();
+ List<CCVPNInstance> q=(List<CCVPNInstance>) query.list();
logger.debug(q.toString());
return q;
} catch (Exception e) {
@@ -346,8 +348,8 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
@Override
public void getIntentInstanceBandwidth() throws IOException {
- List<IntentInstance> instanceList = getInstanceByFinishedFlag("1");
- for (IntentInstance instance : instanceList) {
+ List<CCVPNInstance> instanceList = getInstanceByFinishedFlag("1");
+ for (CCVPNInstance instance : instanceList) {
String serviceInstanceId = instance.getResourceInstanceId();
Response<JSONObject> response = intentApiService.getInstanceNetworkInfo(serviceInstanceId).execute();
if (!response.isSuccessful()) {
@@ -418,13 +420,13 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
@Override
public void deleteIntentInstance(String instanceId) {
- IntentInstance result = null;
+ CCVPNInstance result = null;
Session session = getSession();
try {
- result = (IntentInstance)session.createQuery("from IntentInstance where deleteState = 0 and instanceId = :instanceId")
+ result = (CCVPNInstance)session.createQuery("from CCVPNInstance where deleteState = 0 and instanceId = :instanceId")
.setParameter("instanceId", instanceId).uniqueResult();
- logger.info("get IntentInstance OK, id=" + instanceId);
+ logger.info("get CCVPNInstance OK, id=" + instanceId);
} catch (Exception e) {
logger.error("getodel occur exception:"+e);
@@ -454,7 +456,7 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
okhttp3.RequestBody requestBody = okhttp3.RequestBody.create(okhttp3.MediaType.parse("application/json"), JSON.toJSONString(params));
intentApiService.deleteIntentInstance(requestBody).execute();
}
- private String deleteInstance(IntentInstance instance) {
+ private String deleteInstance(CCVPNInstance instance) {
Transaction tx = null;
String result="0";
Session session = getSession();
@@ -480,17 +482,17 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
@Override
public void activeIntentInstance(String instanceId) {
- IntentInstance instance = null;
+ CCVPNInstance instance = null;
Session session = getSession();
Transaction tx = null;
try {
- instance = (IntentInstance)session.createQuery("from IntentInstance where deleteState = 0 and instanceId = :instanceId and status = :status")
+ instance = (CCVPNInstance)session.createQuery("from CCVPNInstance where deleteState = 0 and instanceId = :instanceId and status = :status")
.setParameter("instanceId", instanceId).setParameter("status", "3").uniqueResult();
logger.info("get instance OK, id=" + instanceId);
if (null == instance) {
- logger.error("intentInstance is null!");
+ logger.error("instance is null!");
return;
}
@@ -512,16 +514,16 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
}
public void invalidIntentInstance(String instanceId) {
- IntentInstance instance = null;
+ CCVPNInstance instance = null;
Session session = getSession();
Transaction tx = null;
try {
- instance = (IntentInstance)session.createQuery("from IntentInstance where deleteState = 0 and instanceId = :instanceId")
+ instance = (CCVPNInstance)session.createQuery("from CCVPNInstance where deleteState = 0 and instanceId = :instanceId")
.setParameter("instanceId", instanceId).uniqueResult();
logger.info("get instance OK, id=" + instanceId);
if (null == instance) {
- logger.error("intentInstance is null!");
+ logger.error("instance is null!");
return;
}
deleteInstanceToSO(instance.getInstanceId());
@@ -545,7 +547,7 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
public Map<String, Object> queryInstancePerformanceData(String instanceId) {
Session session = getSession();
try {
- String hql = "from IntentInstance i, InstancePerformance p where i.resourceInstanceId = p.resourceInstanceId and i.instanceId = :instanceId and i.deleteState = 0 order by p.date";
+ String hql = "from CCVPNInstance i, InstancePerformance p where i.resourceInstanceId = p.resourceInstanceId and i.instanceId = :instanceId and i.deleteState = 0 order by p.date";
Query query = session.createQuery(hql).setParameter("instanceId", instanceId);
List<Object[]> queryResult= query.list();
List<String> date = new ArrayList<>();
@@ -614,11 +616,11 @@ public class IntentInstanceServiceImpl implements IntentInstanceService {
try {
JSONObject result = new JSONObject();
JSONArray instanceInfos = new JSONArray();
- String hql = "from IntentInstance i where i.instanceId in (:ids)";
+ String hql = "from CCVPNInstance i where i.instanceId in (:ids)";
Query query = session.createQuery(hql).setParameter("ids", ids);
- List<IntentInstance> queryResult= query.list();
+ List<CCVPNInstance> queryResult= query.list();
if (queryResult != null && queryResult.size() > 0) {
- for (IntentInstance instance : queryResult) {
+ for (CCVPNInstance instance : queryResult) {
JSONObject instanceInfo = new JSONObject();
instanceInfo.put("id", instance.getInstanceId());
instanceInfo.put("status", instance.getStatus());
diff --git a/server/src/test/java/org/onap/usecaseui/server/controller/IntentControllerTest.java b/server/src/test/java/org/onap/usecaseui/server/controller/IntentControllerTest.java
index 4093d56d..e82ed0af 100644
--- a/server/src/test/java/org/onap/usecaseui/server/controller/IntentControllerTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/controller/IntentControllerTest.java
@@ -24,7 +24,7 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.onap.usecaseui.server.bean.HttpResponseResult;
-import org.onap.usecaseui.server.bean.intent.IntentInstance;
+import org.onap.usecaseui.server.bean.intent.CCVPNInstance;
import org.onap.usecaseui.server.bean.intent.IntentModel;
import org.onap.usecaseui.server.service.intent.IntentInstanceService;
import org.onap.usecaseui.server.service.intent.IntentService;
@@ -159,8 +159,8 @@ public class IntentControllerTest {
}
@Test
public void getFinishedInstanceInfo() {
- List<IntentInstance> instanceList = new ArrayList<>();
- IntentInstance instance = new IntentInstance();
+ List<CCVPNInstance> instanceList = new ArrayList<>();
+ CCVPNInstance instance = new CCVPNInstance();
instance.setInstanceId("instanceId");
instance.setName("name");
instanceList.add(instance);
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/intent/impl/IntentInstanceServiceImplTest.java b/server/src/test/java/org/onap/usecaseui/server/service/intent/impl/IntentInstanceServiceImplTest.java
index c1e7bdd1..8e591ea6 100644
--- a/server/src/test/java/org/onap/usecaseui/server/service/intent/impl/IntentInstanceServiceImplTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/service/intent/impl/IntentInstanceServiceImplTest.java
@@ -32,7 +32,7 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.onap.usecaseui.server.bean.intent.IntentInstance;
+import org.onap.usecaseui.server.bean.intent.CCVPNInstance;
import org.onap.usecaseui.server.bean.intent.IntentModel;
import org.onap.usecaseui.server.service.intent.IntentApiService;
import org.onap.usecaseui.server.service.lcm.domain.so.SOService;
@@ -81,7 +81,7 @@ public class IntentInstanceServiceImplTest {
@Test
public void queryIntentInstance() {
- IntentInstance instance = new IntentInstance();
+ CCVPNInstance instance = new CCVPNInstance();
instance.setInstanceId("1");
instance.setJobId("1");
instance.setStatus("1");
@@ -95,7 +95,7 @@ public class IntentInstanceServiceImplTest {
}
@Test
public void createIntentInstance() throws IOException {
- IntentInstance instance = new IntentInstance();
+ CCVPNInstance instance = new CCVPNInstance();
instance.setInstanceId("1");
instance.setJobId("1");
instance.setStatus("1");
@@ -119,9 +119,9 @@ public class IntentInstanceServiceImplTest {
public void getIntentInstanceProgress() throws IOException {
Query query1 = Mockito.mock(Query.class);
- when(session.createQuery("from IntentInstance where deleteState = 0 and status = '0'")).thenReturn(query1);
- List<IntentInstance> q = new ArrayList<>();
- IntentInstance instance = new IntentInstance();
+ when(session.createQuery("from CCVPNInstance where deleteState = 0 and status = '0'")).thenReturn(query1);
+ List<CCVPNInstance> q = new ArrayList<>();
+ CCVPNInstance instance = new CCVPNInstance();
instance.setInstanceId("1");
q.add(instance);
when(query1.list()).thenReturn(q);
@@ -155,9 +155,9 @@ public class IntentInstanceServiceImplTest {
@Test
public void getIntentInstanceBandwidth() throws IOException {
Query query1 = Mockito.mock(Query.class);
- when(session.createQuery("from IntentInstance where deleteState = 0 and status = '1'")).thenReturn(query1);
- List<IntentInstance> q = new ArrayList<>();
- IntentInstance instance = new IntentInstance();
+ when(session.createQuery("from CCVPNInstance where deleteState = 0 and status = '1'")).thenReturn(query1);
+ List<CCVPNInstance> q = new ArrayList<>();
+ CCVPNInstance instance = new CCVPNInstance();
instance.setInstanceId("1");
instance.setResourceInstanceId("1");
q.add(instance);
@@ -301,7 +301,7 @@ public class IntentInstanceServiceImplTest {
@Test
public void deleteIntentInstance() throws IOException {
- IntentInstance instance = new IntentInstance();
+ CCVPNInstance instance = new CCVPNInstance();
instance.setResourceInstanceId("1");
Query query = Mockito.mock(Query.class);
@@ -324,7 +324,7 @@ public class IntentInstanceServiceImplTest {
@Test
public void activeIntentInstance() throws IOException {
- IntentInstance instance = new IntentInstance();
+ CCVPNInstance instance = new CCVPNInstance();
instance.setInstanceId("1");
instance.setJobId("1");
instance.setStatus("1");
diff --git a/standalone/src/main/assembly/resources/dbscripts/postgres/uui_create_table.sql b/standalone/src/main/assembly/resources/dbscripts/postgres/uui_create_table.sql
index e6a4c1ed..6a3cf87c 100644
--- a/standalone/src/main/assembly/resources/dbscripts/postgres/uui_create_table.sql
+++ b/standalone/src/main/assembly/resources/dbscripts/postgres/uui_create_table.sql
@@ -164,10 +164,10 @@ CREATE TABLE instance_performance
);
-- ----------------------------
--- Table structure for intent_instance
+-- Table structure for ccvpn_instance
-- ----------------------------
-DROP TABLE IF EXISTS intent_instance;
-CREATE TABLE intent_instance
+DROP TABLE IF EXISTS ccvpn_instance;
+CREATE TABLE ccvpn_instance
(
id serial not null
constraint intent_instance_pk