GSO-26 Fix the wrong url sent to service gateway. Modify the codes for deleting servi...
authorLuji7 <lu.ji3@zte.com.cn>
Wed, 19 Oct 2016 09:52:42 +0000 (17:52 +0800)
committerLuji <lu.ji3@zte.com.cn>
Wed, 19 Oct 2016 10:02:17 +0000 (10:02 +0000)
Change-Id: If9242f8c956d5e93f49c4359a959343ed34cfefb
Signed-off-by: Luji7 <lu.ji3@zte.com.cn>
(cherry picked from commit cddbebf090d52a234e536bef5f7e6dbd6ddcc9e0)

openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/gsolcm.js
servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/roa/inf/IServiceGatewayRoaModule.java
servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/service/impl/ServiceGatewayImpl.java

index 30231fc..37cb05f 100644 (file)
@@ -357,7 +357,7 @@ function formatDate(date) {
 function deleteNe(rowId, row) {
     var instanceId = row.serviceId;
     var serviceType = row.serviceType;
-    var gatewayService = '/openoapi/servicegateway/v1/services';
+    var gatewayService = '/openoapi/servicegateway/v1/services/' + instanceId + '/terminate';
     var remove = function () {
         $('#sai').bootstrapTable('remove', {field: 'serviceId', values: [instanceId]});
     };
@@ -404,7 +404,7 @@ function deleteNetworkServiceInstance(gatewayService, nsUri, instanceId) {
         'gatewayUri': instanceUri
     };
     return $.ajax({
-        type: "DELETE",
+        type: "POST",
         url: gatewayService,
         contentType: "application/json",
         dataType: "json",
@@ -423,7 +423,7 @@ function terminateNetworkServiceInstance(gatewayService, nsUri, instanceId) {
         'gatewayUri': nsTerminateUri
     };
     return $.ajax({
-        type: "DELETE",
+        type: "POST",
         url: gatewayService,
         contentType: "application/json",
         dataType: "json",
index 302b2bd..0e8b03c 100644 (file)
@@ -18,7 +18,6 @@ package org.openo.gso.gui.servicegateway.roa.inf;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
@@ -63,10 +62,10 @@ public interface IServiceGatewayRoaModule {
      * @throws ServiceException when operate database or parameter is wrong.
      * @since GSO 0.5
      */
-    @DELETE
+    @POST
     @Produces({"application/json"})
     @Consumes({"application/json"})
-    @Path("/{serviceId}")
+    @Path("/{serviceId}/terminate")
     Response deleteService(@PathParam("serviceId") String serviceId, @Context HttpServletRequest servletReq)
             throws ServiceException;
 
index c3dee4a..3ff4f89 100644 (file)
@@ -139,21 +139,16 @@ public class ServiceGatewayImpl implements IServiceGateway {
         // Parse request
         String reqContent = RestUtils.getRequestBody(httpRequest);
         Map<String, Object> requestBody = JsonUtil.unMarshal(reqContent, Map.class);
-        Map<String, Object> service = (Map<String, Object>)requestBody.get(Constant.SERVICE_INDENTIFY);
-        if(null == service)
-        {
-            service = requestBody;
-        }
         ValidateUtil.assertObjectNotNull(requestBody);
 
         // Validate data
-        String gatewayUri = (String)service.get(Constant.SERVICE_GATEWAY_URI);
+        String gatewayUri = (String)requestBody.get(Constant.SERVICE_GATEWAY_URI);
         ValidateUtil.assertStringNotNull(gatewayUri);
-        service.remove(Constant.SERVICE_GATEWAY_URI);
+        requestBody.remove(Constant.SERVICE_GATEWAY_URI);
 
-        String operation = (String) service.get(Constant.SERVICE_OPERATION);
+        String operation = (String) requestBody.get(Constant.SERVICE_OPERATION);
         ValidateUtil.assertStringNotNull(operation);
-        service.remove(Constant.SERVICE_OPERATION);
+        requestBody.remove(Constant.SERVICE_OPERATION);
 
         // call the restful
         try {