Support NS Instance Restart for VF-C 12/71712/1
authorguochuyicmri <guochuyi@chinamobile.com>
Fri, 2 Nov 2018 02:42:43 +0000 (10:42 +0800)
committerguochuyicmri <guochuyi@chinamobile.com>
Fri, 2 Nov 2018 02:48:37 +0000 (10:48 +0800)
Change-Id: I411ecfac1c848f314b8e1d5d06a79e58593232e9
Issue-ID: USECASEUI-163
Signed-off-by: guochuyicmri <guochuyi@chinamobile.com>
server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java
server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java
server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/VfcService.java
server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java

index f580a9f..64d5f59 100644 (file)
@@ -248,4 +248,9 @@ public class PackageDistributionController {
     public String scaleNetworkServiceInstance(HttpServletRequest request,@RequestParam String ns_instance_id){
         return packageDistributionService.scaleNetworkServiceInstance(request,ns_instance_id);
     }
+    
+    @RequestMapping(value = {"/uui-lcm/VnfInfo/{vnfinstid}"}, method = RequestMethod.POST , produces = "application/json")
+    public String getVnfInfoById(@PathVariable String vnfinstid){
+        return packageDistributionService.getVnfInfoById(vnfinstid);
+    }
 }
index cd49038..2c89dad 100644 (file)
@@ -95,4 +95,6 @@ public interface PackageDistributionService {
     String healNetworkServiceInstance(HttpServletRequest request,String networkServiceInstanceId);
     
     String scaleNetworkServiceInstance(HttpServletRequest request,String networkServiceInstanceId);
+    
+    String getVnfInfoById(String vnfinstid);
 }
index 9495477..fdc11b5 100644 (file)
@@ -117,4 +117,7 @@ public interface VfcService {
     
     @DELETE("/api/nsd/v1/pnf_descriptors/{pnfdInfoId}")
     Call<ResponseBody> deletePnfdPackage(@Path("pnfdInfoId") String pnfdInfoId);
+    
+    @GET("/api/nslcm/v1/ns/vnfs/{vnfinstid}")
+    Call<ResponseBody> getVnfInfoById(@Path("vnfinstid") String vnfinstid);
 }
index c4c6a20..25598f0 100644 (file)
@@ -737,4 +737,26 @@ public class DefaultPackageDistributionService implements PackageDistributionSer
         }
         return result;
        }
+
+       @Override
+       public String getVnfInfoById(String vnfinstid) {
+
+               String result="";
+        try {
+               logger.info("vfc getVnfInfoById is starting!");
+            Response<ResponseBody> response = this.vfcService.getVnfInfoById(vnfinstid).execute();
+            logger.info("vfc getVnfInfoById has finished!");
+            if (response.isSuccessful()) {
+               result=new String(response.body().bytes());
+            } else {
+                logger.info(String.format("Can not get getVnfInfoById[code=%s, message=%s]", response.code(), response.message()));
+                result=Constant.CONSTANT_FAILED;;
+            }
+        } catch (IOException e) {
+            logger.error("getVnfInfoById occur exception:"+e);
+            result=Constant.CONSTANT_FAILED;;
+        }
+        return result;
+       
+       }
 }