aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordecheng zhang <decheng.zhang@huawei.com>2022-05-01 12:44:13 -0400
committerdecheng zhang <decheng.zhang@huawei.com>2022-05-05 19:04:49 -0400
commit59eeb551e7f5f5bde588b244af412ffc1b90b2dd (patch)
tree80906653fc93b71262991bf0d359f65361d6e12d
parenta48697d5defad68726719354013861218a15a739 (diff)
fix: UUI backend AAI restful api and implementation for jakarta ccvpn usecase
Issue-ID: REQ-1103 Signed-off-by: decheng zhang <decheng.zhang@huawei.com> Change-Id: Ic6e909a4b83033b2bd9eba34ef25aaf848be9aa3 Signed-off-by: decheng zhang <decheng.zhang@huawei.com>
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/sotn/SotnController.java16
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java52
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/sotn/SOTNService.java6
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/sotn/impl/SOTNServiceImpl.java40
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/controller/sotn/SotnControllerTest.java18
5 files changed, 109 insertions, 23 deletions
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 c24619e3..36c67b8a 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
@@ -138,8 +138,8 @@ public class SotnController {
return sotnService.serviceInstanceInfo(customerId, serviceType, serviceId);
}
- @GetMapping(value = {"/getPnfInfo/{pnfName:.+}"})
- public String getPnfInfo(@PathVariable(value="pnfName") String pnfName){
+ @GetMapping(value = {"/getPnfInfo", "/getPnfInfo/{pnfName}"})
+ public String getPnfInfo(@PathVariable(required = false) String pnfName){
return sotnService.getPnfInfo(pnfName);
}
@@ -155,7 +155,17 @@ public class SotnController {
public String getConnectivityInfo(@PathVariable(required = false) String connectivityId){
return sotnService.getConnectivityInfo(connectivityId);
}
-
+
+ @GetMapping(value = {"/getVpnBindingInfo", "/getVpnBindingInfo/{vpnId}"})
+ public String getVpnBindingInfo(@PathVariable(required = false) String vpnId){
+ return sotnService.getVpnBindingInfo(vpnId);
+ }
+
+ @GetMapping(value = {"/getNetworkRouteInfo", "/getNetworkRouteInfo/{routeId}"})
+ public String getNetworkRouteInfo(@PathVariable(required = false) String routeId){
+ return sotnService.getNetworkRouteInfo(routeId);
+ }
+
@GetMapping(value = {"/getPinterfaceByVpnId/{vpnId:.+}"})
public String getPinterfaceByVpnId(@PathVariable(value="vpnId") String vpnId){
return sotnService.getPinterfaceByVpnId(vpnId);
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 66e0e1f2..b491552c 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
@@ -192,12 +192,12 @@ public interface AAIService {
Call<PinterfaceRsp> getPinterfaceByPnfName(@Path("pnfName") String pnfName);
@Headers({
- "X-TransactionId: 7777",
- "X-FromAppId: uui",
- "Authorization: Basic QUFJOkFBSQ==",
- "Accept: application/json"
+ "X-TransactionId: 9999",
+ "X-FromAppId: MSO",
+ "Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==",
+ "Accept: application/json"
})
- @GET("/api/aai-network/v24/logical-links")
+ @GET("/aai/v24/network/logical-links")
Call<ResponseBody> getLogicalLinks();
@Headers({
@@ -309,23 +309,41 @@ public interface AAIService {
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"
+ "X-TransactionId: 9999",
+ "X-FromAppId: MSO",
+ "Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==",
+ "Accept: application/json"
})
- @GET("/api/aai-network/v14/pnfs/pnf/{pnfName}")
- Call<ResponseBody> getPnfInfo(@Path("pnfName") String pnfName);
+ @GET("/aai/v24/network/pnfs")
+ Call<ResponseBody> getPnfInfo(@Query("pnfName") String pnfName);
@Headers({
- "X-TransactionId: 7777",
- "X-FromAppId: uui",
- "Authorization: Basic QUFJOkFBSQ==",
- "Accept: application/json"
+ "X-TransactionId: 9999",
+ "X-FromAppId: MSO",
+ "Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==",
+ "Accept: application/json"
})
- @GET("/api/aai-network/v24/connectivities")
+ @GET("/aai/v24/network/connectivities")
Call<ResponseBody> getConnectivityInfo(@Query("connectivity-id") String connectivityId);
-
+
+ @Headers({
+ "X-TransactionId: 9999",
+ "X-FromAppId: MSO",
+ "Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==",
+ "Accept: application/json"
+ })
+ @GET("/aai/v24/network/vpn-bindings")
+ Call<ResponseBody> getVpnBindingInfo(@Query("vpn-id") String vpnId);
+
+ @Headers({
+ "X-TransactionId: 9999",
+ "X-FromAppId: MSO",
+ "Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==",
+ "Accept: application/json"
+ })
+ @GET("/aai/v24/network/network-routes")
+ Call<ResponseBody> getNetworkRouteInfo(@Query("route-id") String routeId);
+
@Headers({
"X-TransactionId: 7777",
"X-FromAppId: uui",
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 08094a65..a7fe6eba 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,7 +56,11 @@ public interface SOTNService {
public String getAllottedResources(String customerId,String serviceType,String serviceId);
public String getConnectivityInfo(String connectivityId);
-
+
+ public String getVpnBindingInfo(String vpnId);
+
+ public String getNetworkRouteInfo(String routeId);
+
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 23d4d085..f688836b 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
@@ -400,6 +400,46 @@ public class SOTNServiceImpl implements SOTNService{
return result;
}
+ @Override
+ public String getVpnBindingInfo(String vpnId) {
+ String result="";
+ try {
+ logger.info("aai getVpnBindingInfo is starting!");
+ Response<ResponseBody> response = this.aaiService.getVpnBindingInfo(vpnId).execute();
+ logger.info("aai getVpnBindingInfo has finished!");
+ if (response.isSuccessful()) {
+ result=new String(response.body().bytes());
+ } else {
+ logger.info(String.format("Can not get getVpnBindingInfo[code=%s, message=%s]", response.code(), response.message()));
+ result= CommonConstant.CONSTANT_FAILED;
+ }
+ } catch (IOException e) {
+ logger.error("getVpnBindingInfo occur exception:"+e);
+ result= CommonConstant.CONSTANT_FAILED;
+ }
+ return result;
+ }
+
+ @Override
+ public String getNetworkRouteInfo(String routeId){
+ String result="";
+ try {
+ logger.info("aai getNetworkRouteInfo is starting!");
+ Response<ResponseBody> response = this.aaiService.getNetworkRouteInfo(routeId).execute();
+ logger.info("aai getNetworkRouteInfo has finished!");
+ if (response.isSuccessful()) {
+ result=new String(response.body().bytes());
+ } else {
+ logger.info(String.format("Can not get getNetworkRouteInfo[code=%s, message=%s]", response.code(), response.message()));
+ result= CommonConstant.CONSTANT_FAILED;
+ }
+ } catch (IOException e) {
+ logger.error("getNetworkRouteInfo occur exception:"+e);
+ result= CommonConstant.CONSTANT_FAILED;
+ }
+ return result;
+ }
+
@Override
public String getPinterfaceByVpnId(String vpnId) {
String result="";
diff --git a/server/src/test/java/org/onap/usecaseui/server/controller/sotn/SotnControllerTest.java b/server/src/test/java/org/onap/usecaseui/server/controller/sotn/SotnControllerTest.java
index 46f65220..67a51f4f 100644
--- a/server/src/test/java/org/onap/usecaseui/server/controller/sotn/SotnControllerTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/controller/sotn/SotnControllerTest.java
@@ -162,14 +162,28 @@ public class SotnControllerTest {
sotnController.getConnectivityInfo(linkName);
verify(sotnService, times(1)).getConnectivityInfo(linkName);
}
-
+
+ @Test
+ public void TestGetVpnBindingInfo(){
+ String vpnId = "vpnId";
+ sotnController.getVpnBindingInfo(vpnId);
+ verify(sotnService, times(1)).getVpnBindingInfo(vpnId);
+ }
+
+ @Test
+ public void TestGetNetworkRouteInfo(){
+ String linkName="routeId";
+ sotnController.getNetworkRouteInfo(linkName);
+ verify(sotnService, times(1)).getNetworkRouteInfo(linkName);
+ }
+
@Test
public void TestGetPinterfaceByVpnId(){
String linkName="pnfName";
sotnController.getPinterfaceByVpnId(linkName);
verify(sotnService, times(1)).getPinterfaceByVpnId(linkName);
}
-
+
@Test
public void TestGetServiceInstanceList(){
String linkName="pnfName";