add topology function 99/67199/1
authorguochuyicmri <guochuyi@chinamobile.com>
Tue, 18 Sep 2018 06:36:57 +0000 (14:36 +0800)
committerguochuyicmri <guochuyi@chinamobile.com>
Tue, 18 Sep 2018 06:37:18 +0000 (14:37 +0800)
Change-Id: I30594ef9f76e7bb88769720262304f73b85692bf
Issue-ID: USECASEUI-141
Signed-off-by: guochuyicmri <guochuyi@chinamobile.com>
server/src/main/java/org/onap/usecaseui/server/controller/sotn/SotnController.java
server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java
server/src/main/java/org/onap/usecaseui/server/service/sotn/SOTNService.java
server/src/main/java/org/onap/usecaseui/server/service/sotn/impl/SOTNServiceImpl.java

index c6cb032..550e044 100644 (file)
@@ -131,6 +131,29 @@ public class SotnController {
        return sotnService.serviceInstanceInfo(customerId, serviceType, serviceId);
     }
     
+    @RequestMapping(value = {"/getPnfInfo/{pnfName}"}, method = RequestMethod.GET)
+    public String getPnfInfo(@PathVariable(value="pnfName") String pnfName){
+       return sotnService.getPnfInfo(pnfName);
+    }
+    
+    @RequestMapping(value = {"/getAllottedResources"}, method = RequestMethod.GET)
+    public String getAllottedResources(HttpServletRequest request){
+        String customerId = request.getParameter("customerId");
+        String serviceType = request.getParameter("serviceType");
+        String serviceId = request.getParameter("serviceId");
+       return sotnService.getAllottedResources(customerId, serviceType,serviceId);
+    }
+    
+    @RequestMapping(value = {"/getConnectivityInfo/{connectivityId}"}, method = RequestMethod.GET)
+    public String getConnectivityInfo(@PathVariable(value="connectivityId") String connectivityId){
+       return sotnService.getConnectivityInfo(connectivityId);
+    }
+    
+    @RequestMapping(value = {"/getPinterfaceByVpnId/{vpnId}"}, method = RequestMethod.GET)
+    public String getPinterfaceByVpnId(@PathVariable(value="vpnId") String vpnId){
+       return sotnService.getPinterfaceByVpnId(vpnId);
+    }
+    
     @RequestMapping(value = {"/getServiceInstanceList"}, method = RequestMethod.GET)
     public String getServiceInstanceList(HttpServletRequest request){
         String customerId = request.getParameter("customerId");
index 7192f46..0f11f07 100644 (file)
@@ -209,4 +209,40 @@ public interface AAIService {
     })
     @GET("/api/aai-business/v13/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances")
     Call<ResponseBody> serviceInstaneInfo(@Path("global-customer-id") String globalCustomerId,@Path("service-type") String serviceType,@Query("service-instance-id") String serviceInstanceId);
+    
+    @Headers({
+       "X-TransactionId: 7777",
+       "X-FromAppId: uui",
+       "Authorization: Basic QUFJOkFBSQ==",
+       "Accept: application/json"
+    })
+    @GET("/api/aai-business/v13/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}/allotted-resources")
+    Call<ResponseBody> getAllottedResources(@Path("global-customer-id") String globalCustomerId,@Path("service-type") String serviceType,@Path("service-instance-id") String serviceInstanceId);
+    
+    @Headers({
+       "X-TransactionId: 7777",
+       "X-FromAppId: uui",
+       "Authorization: Basic QUFJOkFBSQ==",
+       "Accept: application/json"
+    })
+    @GET("/api/aai-network/v13/pnfs/pnf/{pnfName}")
+    Call<ResponseBody> getPnfInfo(@Path("pnfName") String pnfName);
+    
+    @Headers({
+       "X-TransactionId: 7777",
+       "X-FromAppId: uui",
+       "Authorization: Basic QUFJOkFBSQ==",
+       "Accept: application/json"
+    })
+    @GET("/api/aai-network/v13/connectivities")
+    Call<ResponseBody> getConnectivityInfo(@Query("connectivity-id") String connectivityId);
+    
+    @Headers({
+       "X-TransactionId: 7777",
+       "X-FromAppId: uui",
+       "Authorization: Basic QUFJOkFBSQ==",
+       "Accept: application/json"
+    })
+    @PUT("/api/aai-network/v13/vpn-bindings")
+    Call<ResponseBody> getPinterfaceByVpnId(@Query("vpn-id") String vpnId);
 }
index 8a87645..dcae662 100644 (file)
@@ -48,4 +48,12 @@ public interface SOTNService {
        public String getServiceInstances(String customerId,String serviceType);
        
        public String serviceInstanceInfo(String customerId,String serviceType,String serviceInstanceId);
+       
+       public String getPnfInfo(String pnfName);
+       
+       public String getAllottedResources(String customerId,String serviceType,String serviceId);
+       
+       public String getConnectivityInfo(String connectivityId);
+       
+       public String getPinterfaceByVpnId(String vpnId);
 }
index b98e785..e317d25 100644 (file)
@@ -319,4 +319,84 @@ public class SOTNServiceImpl implements SOTNService{
             throw new SOException("aai serviceInstanceInfo is not available!", e);
         }
        }
+
+       @Override
+       public String getPnfInfo(String pnfName) {
+               String result="";
+        try {
+               logger.info("aai getPnfInfo is starting!");
+            Response<ResponseBody> response = this.aaiService.getPnfInfo(pnfName).execute();
+            logger.info("aai getPnfInfo has finished!");
+            if (response.isSuccessful()) {
+               result=new String(response.body().bytes());
+            } else {
+                logger.info(String.format("Can not get getPnfInfo[code=%s, message=%s]", response.code(), response.message()));
+                result=Constant.CONSTANT_FAILED;
+            }
+        } catch (IOException e) {
+            logger.error("getPnfInfo occur exception:"+e);
+            result=Constant.CONSTANT_FAILED;;
+        }
+        return result;
+       }
+
+       @Override
+       public String getAllottedResources(String customerId, String serviceType, String serviceId) {
+               String result="";
+        try {
+               logger.info("aai getAllottedResources is starting!");
+            Response<ResponseBody> response = this.aaiService.getAllottedResources(customerId, serviceType, serviceId).execute();
+            logger.info("aai getAllottedResources has finished!");
+            if (response.isSuccessful()) {
+               result=new String(response.body().bytes());
+            } else {
+                logger.info(String.format("Can not get getAllottedResources[code=%s, message=%s]", response.code(), response.message()));
+                result=Constant.CONSTANT_FAILED;
+            }
+        } catch (IOException e) {
+            logger.error("getAllottedResources occur exception:"+e);
+            result=Constant.CONSTANT_FAILED;;
+        }
+        return result;
+       }
+
+       @Override
+       public String getConnectivityInfo(String connectivityId) {
+               String result="";
+        try {
+               logger.info("aai getConnectivityInfo is starting!");
+            Response<ResponseBody> response = this.aaiService.getConnectivityInfo(connectivityId).execute();
+            logger.info("aai getConnectivityInfo has finished!");
+            if (response.isSuccessful()) {
+               result=new String(response.body().bytes());
+            } else {
+                logger.info(String.format("Can not get getConnectivityInfo[code=%s, message=%s]", response.code(), response.message()));
+                result=Constant.CONSTANT_FAILED;
+            }
+        } catch (IOException e) {
+            logger.error("getConnectivityInfo occur exception:"+e);
+            result=Constant.CONSTANT_FAILED;;
+        }
+        return result;
+       }
+
+       @Override
+       public String getPinterfaceByVpnId(String vpnId) {
+               String result="";
+        try {
+               logger.info("aai getPinterfaceByVpnId is starting!");
+            Response<ResponseBody> response = this.aaiService.getPinterfaceByVpnId(vpnId).execute();
+            logger.info("aai getPinterfaceByVpnId has finished!");
+            if (response.isSuccessful()) {
+               result=new String(response.body().bytes());
+            } else {
+                logger.info(String.format("Can not get getPinterfaceByVpnId[code=%s, message=%s]", response.code(), response.message()));
+                result=Constant.CONSTANT_FAILED;
+            }
+        } catch (IOException e) {
+            logger.error("getPinterfaceByVpnId occur exception:"+e);
+            result=Constant.CONSTANT_FAILED;;
+        }
+        return result;
+       }
 }