summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguochuyicmri <guochuyi@chinamobile.com>2018-11-09 18:13:07 +0800
committerguochuyicmri <guochuyi@chinamobile.com>2018-11-09 18:13:42 +0800
commit6cebb4e97b436ed5d7bc4d8ed7866026318a942b (patch)
treeab49e7c5f948646216275d3f11dd93af729a5e37
parent8af2752b1dd509cddf737fc5198531cdf487f1a5 (diff)
Fix instance termination for SOTN
Change-Id: I431906bb38db4b942bc9e2ce15329c3876f7ff4b Issue-ID: USECASEUI-169 Signed-off-by: guochuyicmri <guochuyi@chinamobile.com>
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/bean/ServiceBean.java2
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/sotn/SotnController.java7
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java3
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/sotn/SOTNService.java2
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/sotn/impl/SOTNServiceImpl.java20
5 files changed, 33 insertions, 1 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/ServiceBean.java b/server/src/main/java/org/onap/usecaseui/server/bean/ServiceBean.java
index 0b54326b..af53ab25 100644
--- a/server/src/main/java/org/onap/usecaseui/server/bean/ServiceBean.java
+++ b/server/src/main/java/org/onap/usecaseui/server/bean/ServiceBean.java
@@ -21,7 +21,7 @@ import javax.persistence.Id;
import javax.persistence.Table;
@Entity
-@Table(name="service")
+@Table(name="service_instances")
public class ServiceBean {
@Id
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/sotn/SotnController.java b/server/src/main/java/org/onap/usecaseui/server/controller/sotn/SotnController.java
index a3d750d9..51f63e3a 100644
--- a/server/src/main/java/org/onap/usecaseui/server/controller/sotn/SotnController.java
+++ b/server/src/main/java/org/onap/usecaseui/server/controller/sotn/SotnController.java
@@ -32,6 +32,7 @@ import org.onap.usecaseui.server.util.UuiCommonUtil;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
@@ -166,6 +167,12 @@ public class SotnController {
String result = HttpUtil.sendGet("http://172.60.3.45:8099/oss/inventory", "");
return result;
}
+
+ @RequestMapping(value = {"/deleteExtNetWork"}, method = RequestMethod.DELETE)
+ public String deleteExtNetwork(@RequestParam String extNetworkId,@RequestParam(value="resourceVersion") String resourceVersion){
+ return sotnService.deleteExtNetwork(extNetworkId,resourceVersion);
+ }
+
private void createJson(String json,List<NetWorkResource> list){
ObjectMapper mapper = new ObjectMapper();
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java
index 2995f41d..6b76dcfc 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java
@@ -245,4 +245,7 @@ public interface AAIService {
})
@GET("/api/aai-network/v13/vpn-bindings")
Call<ResponseBody> getPinterfaceByVpnId(@Query("vpn-id") String vpnId);
+
+ @DELETE("/api/aai-network/v13/ext-aai-networks/ext-aai-network/{aai-id}")
+ Call<ResponseBody> deleteExtNetwork(@Path("aai-id") String aaiId,@Query("resource-version") String resourceVersion);
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/sotn/SOTNService.java b/server/src/main/java/org/onap/usecaseui/server/service/sotn/SOTNService.java
index dcae6623..3bef80b5 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/sotn/SOTNService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/sotn/SOTNService.java
@@ -56,4 +56,6 @@ public interface SOTNService {
public String getConnectivityInfo(String connectivityId);
public String getPinterfaceByVpnId(String vpnId);
+
+ public String deleteExtNetwork(String networkId,String resourceVersion);
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/sotn/impl/SOTNServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/sotn/impl/SOTNServiceImpl.java
index e317d258..a65aa90a 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/sotn/impl/SOTNServiceImpl.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/sotn/impl/SOTNServiceImpl.java
@@ -399,4 +399,24 @@ public class SOTNServiceImpl implements SOTNService{
}
return result;
}
+
+ @Override
+ public String deleteExtNetwork(String networkId,String resourceVersion) {
+ String result = "";
+ try {
+ logger.info("aai deleteExtNetwork is starting");
+ Response<ResponseBody> response = aaiService.deleteExtNetwork(networkId,resourceVersion).execute();
+ logger.info("aai deleteExtNetwork has finished");
+ if (response.isSuccessful()) {
+ result=Constant.CONSTANT_SUCCESS;
+ } else {
+ result=Constant.CONSTANT_FAILED;
+ logger.error(String.format("Can not deleteExtNetwork[code=%s, message=%s]", response.code(), response.message()));
+ }
+ } catch (Exception e) {
+ result=Constant.CONSTANT_FAILED;
+ logger.error("deleteExtNetwork occur exception:"+e);
+ }
+ return result;
+ }
}