aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java10
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java32
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java4
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceInstanceService.java4
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceInstanceRsp.java6
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/VfcService.java6
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java43
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java2
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceServiceTest.java4
9 files changed, 90 insertions, 21 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java
index d3da9a89..bb6c06dc 100644
--- a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java
+++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java
@@ -81,6 +81,16 @@ public class PackageDistributionController {
return packageDistributionService.deleteVfPackage(casrId);
}
+ @RequestMapping(value = {"/uui-lcm/fetchNsTemplateData}"}, method = RequestMethod.GET , produces = "application/json")
+ public String fetchNsTemplateData(HttpServletRequest request){
+ return packageDistributionService.fetchNsTemplateData(request);
+ }
+
+ @RequestMapping(value = {"/uui-lcm/listNsTemplates}"}, method = RequestMethod.GET , produces = "application/json")
+ public String listNsTemplates(){
+ return packageDistributionService.listNsTemplates();
+ }
+
@RequestMapping(value = {"/uui-lcm/ns-packages}"}, method = RequestMethod.GET , produces = "application/json")
public String getNsPackages(){
return packageDistributionService.getNetworkServicePackages();
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java
index b8c86fd3..55c97d0a 100644
--- a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java
+++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java
@@ -15,6 +15,8 @@
*/
package org.onap.usecaseui.server.controller.lcm;
+import java.io.IOException;
+import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
@@ -36,6 +38,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
@Controller
@org.springframework.context.annotation.Configuration
@@ -60,20 +64,12 @@ public class ServiceInstanceController {
@ResponseBody
@RequestMapping(value = {"/uui-lcm/service-instances"}, method = RequestMethod.GET , produces = "application/json")
- public List<ServiceInstance> listServiceInstances(HttpServletRequest request){
+ public List<String> listServiceInstances(HttpServletRequest request){
+ List<String> result = new ArrayList<String>();
String customerId = request.getParameter("customerId");
String serviceType = request.getParameter("serviceType");
- List<ServiceInstance> list =serviceInstanceService.listServiceInstances(customerId, serviceType);
- if(list.size()>0){
- for(ServiceInstance serviceInstance:list){
- ServiceBean serviceBean = serviceLcmService.getServiceBeanByServiceInStanceId(serviceInstance.getServiceInstanceId());
- if(UuiCommonUtil.isNotNullOrEmpty(serviceBean)){
- serviceInstance.setServiceDomain(serviceBean.getServiceDomain());
- }
- }
- }
- System.out.println(list);
- return list;
+ List<String> serviceInstances =serviceInstanceService.listServiceInstances(customerId, serviceType);
+ return result;
}
@ResponseBody
@RequestMapping(value = {"/uui-lcm/getServiceInstanceById"}, method = RequestMethod.GET , produces = "application/json")
@@ -112,4 +108,16 @@ public class ServiceInstanceController {
}
return result.toString() ;
}
+
+ private void parseServiceInstance(List<String> list){
+ ObjectMapper mapper = new ObjectMapper();
+ for(String serviceInstance:list){
+ try {
+ JsonNode node = mapper.readTree(serviceInstance);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java
index ddea5bf1..5f5ccc80 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java
@@ -38,6 +38,10 @@ public interface PackageDistributionService {
Job deleteVfPackage(String csarId);
+ String listNsTemplates();
+
+ String fetchNsTemplateData(HttpServletRequest request);
+
String getVnfPackages();
String getNetworkServicePackages();
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceInstanceService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceInstanceService.java
index 49fa8e32..e9416f8f 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceInstanceService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceInstanceService.java
@@ -15,13 +15,11 @@
*/
package org.onap.usecaseui.server.service.lcm;
-import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceInstance;
-
import java.util.List;
public interface ServiceInstanceService {
- List<ServiceInstance> listServiceInstances(String customerId, String serviceType);
+ List<String> listServiceInstances(String customerId, String serviceType);
String getRelationShipData(String customerId, String serviceType,String serviceId );
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceInstanceRsp.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceInstanceRsp.java
index 499798db..c8040f94 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceInstanceRsp.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceInstanceRsp.java
@@ -21,15 +21,15 @@ import java.util.List;
public class ServiceInstanceRsp {
- private List<ServiceInstance> serviceInstances;
+ private List<String> serviceInstances;
@JsonProperty("service-instance")
- public List<ServiceInstance> getServiceInstances() {
+ public List<String> getServiceInstances() {
return serviceInstances;
}
@JsonProperty("service-instance")
- public void setServiceInstances(List<ServiceInstance> serviceInstances) {
+ public void setServiceInstances(List<String> serviceInstances) {
this.serviceInstances = serviceInstances;
}
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/VfcService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/VfcService.java
index ea5a80c9..0dd91a95 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/VfcService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/VfcService.java
@@ -42,6 +42,12 @@ public interface VfcService {
@DELETE("/api/catalog/v1/vnfpackages/{csarId}")
Call<Job> deleteVnfPackage(@Path("csarId") String csarId);
+ @GET("/api/catalog/v1/nspackages")
+ Call<ResponseBody> listNsTemplates();
+
+ @GET("/api/catalog/v1/parsernsd")
+ Call<ResponseBody> fetchNsTemplateData(@Body RequestBody body);
+
@GET("/api/nslcm/v1/ns")
Call<ResponseBody> getNetworkServiceInfo();
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java
index e440b217..4234e921 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java
@@ -625,4 +625,47 @@ public class DefaultPackageDistributionService implements PackageDistributionSer
return result;
}
+
+ @Override
+ public String listNsTemplates() {
+
+ String result="";
+ try {
+ logger.info("vfc listNsTemplates is starting!");
+ Response<ResponseBody> response = this.vfcService.listNsTemplates().execute();
+ logger.info("vfc listNsTemplates has finished!");
+ if (response.isSuccessful()) {
+ result=new String(response.body().bytes());
+ } else {
+ logger.info(String.format("Can not get listNsTemplates[code=%s, message=%s]", response.code(), response.message()));
+ result=Constant.CONSTANT_FAILED;;
+ }
+ } catch (IOException e) {
+ logger.error("listNsTemplates occur exception:"+e);
+ result=Constant.CONSTANT_FAILED;;
+ }
+ return result;
+
+ }
+
+ @Override
+ public String fetchNsTemplateData(HttpServletRequest request) {
+ String result = "";
+ try {
+ logger.info("aai fetchNsTemplateData is starting");
+ RequestBody requestBody = extractBody(request);
+ Response<ResponseBody> response = vfcService.fetchNsTemplateData(requestBody).execute();
+ logger.info("aai fetchNsTemplateData has finished");
+ if (response.isSuccessful()) {
+ result=new String(response.body().bytes());
+ } else {
+ result=Constant.CONSTANT_FAILED;
+ logger.error(String.format("Can not fetchNsTemplateData[code=%s, message=%s]", response.code(), response.message()));
+ }
+ } catch (Exception e) {
+ result=Constant.CONSTANT_FAILED;
+ logger.error("fetchNsTemplateData occur exception:"+e);
+ }
+ return result;
+ }
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java
index 8cd7ab5e..ed12b82d 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java
@@ -51,7 +51,7 @@ public class DefaultServiceInstanceService implements ServiceInstanceService {
}
@Override
- public List<ServiceInstance> listServiceInstances(String customerId, String serviceType) {
+ public List<String> listServiceInstances(String customerId, String serviceType) {
try {
Response<ServiceInstanceRsp> response = aaiService.listServiceInstances(customerId, serviceType).execute();
if (response.isSuccessful()) {
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceServiceTest.java b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceServiceTest.java
index a8e2dd45..c63bf714 100644
--- a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceServiceTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceServiceTest.java
@@ -39,7 +39,7 @@ public class DefaultServiceInstanceServiceTest {
AAIService aaiService = mock(AAIService.class);
String customerId = "1";
String serviceType = "service";
- List<ServiceInstance> instances = Collections.singletonList(new ServiceInstance("1","service","1","VoLTE","e2eservice","abc","vim1"));
+ List<String> instances = Collections.singletonList("{\"service-instance-id\":\"35e88f8e-473f-4d88-92f8-6739a42baa23\",\"service-instance-name\":\"SDWANVPNInfra1\",\"service-type\":\"E2E Service\",\"service-role\":\"E2E Service\",\"model-invariant-id\":\"88dcb2f0-085b-4548-8b93-0882e37d25d8\",\"model-version-id\":\"462f84e5-f0e5-44c5-ab95-38fb4bf77064\",\"resource-version\":\"1535687551051\",\"input-parameters\":\"{\\n \\\"service\\\":{\\n \\\"name\\\":\\\"SDWANVPNInfra\\\",\\n \\\"description\\\":\\\"SDWANVPNInfra\\\",\\n \\\"serviceInvariantUuid\\\":\\\"88dcb2f0-085b-4548-8b93-0882e37d25d8\\\",\\n \\\"serviceUuid\\\":\\\"462f84e5-f0e5-44c5-ab95-38fb4bf77064\\\",\\n \\\"globalSubscriberId\\\":\\\"Demonstration\\\",\\n \\\"serviceType\\\":\\\"CCVPN\\\",\\n \\\"parameters\\\":{\\n \\\"locationConstraints\\\":[\\n\\n ],\\n \\\"resources\\\":[\\n {\\n \\\"resourceName\\\":\\\"SDWANConnectivity 0\\\",\\n \\\"resourceInvariantUuid\\\":\\\"f99a9a23-c88e-44ff-a4dc-22b88675d278\\\",\\n \\\"resourceUuid\\\":\\\"7baa7742-3a13-4288-8330-868015adc340\\\",\\n \\\"resourceCustomizationUuid\\\":\\\"94ec574b-2306-4cbd-8214-09662b040f73\\\",\\n \\\"parameters\\\":{\\n \\\"locationConstraints\\\":[\\n\\n ],\\n \\\"resources\\\":[\\n\\n ],\\n \\\"requestInputs\\\":{\\n\\n }\\n }\\n },\\n {\\n \\\"resourceName\\\":\\\"SPPartnerVF 0\\\",\\n \\\"resourceInvariantUuid\\\":\\\"072f9238-15b0-4bc5-a5f5-f18548739470\\\",\\n \\\"resourceUuid\\\":\\\"81b9430b-8abe-45d6-8bf9-f41a8f5c735f\\\",\\n \\\"resourceCustomizationUuid\\\":\\\"a7baba5d-6ac3-42b5-b47d-070841303ab1\\\",\\n \\\"parameters\\\":{\\n \\\"locationConstraints\\\":[\\n\\n ],\\n \\\"resources\\\":[\\n\\n ],\\n \\\"requestInputs\\\":{\\n\\n }\\n }\\n }\\n ],\\n \\\"requestInputs\\\":{\\n \\\"sdwanconnectivity0_name\\\":\\\"CMCCVPN\\\",\\n \\\"sdwanconnectivity0_topology\\\":\\\"hub-spoke\\\"\\n }\\n }\\n }\\n}\",\"relationship-list\":{\"relationship\":[{\"related-to\":\"sdwan-vpn\",\"relationship-label\":\"org.onap.relationships.inventory.PartOf\",\"related-link\":\"/aai/v13/network/sdwan-vpns/sdwan-vpn/4efe6dff-acfc-4d13-a3fd-1177d3c08e89\",\"relationship-data\":[{\"relationship-key\":\"sdwan-vpn.sdwan-vpn-id\",\"relationship-value\":\"4efe6dff-acfc-4d13-a3fd-1177d3c08e89\"}],\"related-to-property\":[{\"property-key\":\"sdwan-vpn.sdwan-vpn-name\",\"property-value\":\"vdfvpn\"}]},{\"related-to\":\"sp-partner\",\"relationship-label\":\"org.onap.relationships.inventory.PartOf\",\"related-link\":\"/aai/v13/business/sp-partners/sp-partner/1b9c677d-fddf-4b70-938b-925a7fa57d00\",\"relationship-data\":[{\"relationship-key\":\"sp-partner.sp-partner-id\",\"relationship-value\":\"1b9c677d-fddf-4b70-938b-925a7fa57d00\"}],\"related-to-property\":[{\"property-key\":\"sp-partner.sp-partner-id\",\"property-value\":\"1b9c677d-fddf-4b70-938b-925a7fa57d00\"}]},{\"related-to\":\"allotted-resource\",\"relationship-label\":\"org.onap.relationships.inventory.Uses\",\"related-link\":\"/aai/v13/business/customers/customer/Democcy/service-subscriptions/service-subscription/CCVPN/service-instances/service-instance/189b87a5-72fe-4197-a307-6929c3831f81/allotted-resources/allotted-resource/2214feec-1aef-4890-abba-f8f3a906935f\",\"relationship-data\":[{\"relationship-key\":\"customer.global-customer-id\",\"relationship-value\":\"Democcy\"},{\"relationship-key\":\"service-subscription.service-type\",\"relationship-value\":\"CCVPN\"},{\"relationship-key\":\"service-instance.service-instance-id\",\"relationship-value\":\"189b87a5-72fe-4197-a307-6929c3831f81\"},{\"relationship-key\":\"allotted-resource.id\",\"relationship-value\":\"2214feec-1aef-4890-abba-f8f3a906935f\"}],\"related-to-property\":[{\"property-key\":\"allotted-resource.description\",\"property-value\":\"2214feec-1aef-4890-abba-f8f3a906935f\"},{\"property-key\":\"allotted-resource.allotted-resource-name\",\"property-value\":\"sdwan ar\"}]},{\"related-to\":\"allotted-resource\",\"relationship-label\":\"org.onap.relationships.inventory.Uses\",\"related-link\":\"/aai/v13/business/customers/customer/Democcy/service-subscriptions/service-subscription/CCVPN/service-instances/service-instance/089b87a5-72fe-4197-a307-6929c3831f80/allotted-resources/allotted-resource/1114feec-1aef-4890-abba-f8f3a906935f\",\"relationship-data\":[{\"relationship-key\":\"customer.global-customer-id\",\"relationship-value\":\"Democcy\"},{\"relationship-key\":\"service-subscription.service-type\",\"relationship-value\":\"CCVPN\"},{\"relationship-key\":\"service-instance.service-instance-id\",\"relationship-value\":\"089b87a5-72fe-4197-a307-6929c3831f80\"},{\"relationship-key\":\"allotted-resource.id\",\"relationship-value\":\"1114feec-1aef-4890-abba-f8f3a906935f\"}],\"related-to-property\":[{\"property-key\":\"allotted-resource.description\",\"property-value\":\"1114feec-1aef-4890-abba-f8f3a906935f\"},{\"property-key\":\"allotted-resource.allotted-resource-name\",\"property-value\":\"sdwan ar\"}]}]}}");
ServiceInstanceRsp rsp = new ServiceInstanceRsp();
rsp.setServiceInstances(instances);
when(aaiService.listServiceInstances(customerId, serviceType)).thenReturn(successfulCall(rsp));
@@ -68,7 +68,7 @@ public class DefaultServiceInstanceServiceTest {
when(aaiService.listServiceInstances(customerId, serviceType)).thenReturn(emptyBodyCall());
ServiceInstanceService service = new DefaultServiceInstanceService(aaiService);
- List<ServiceInstance> serviceInstances = service.listServiceInstances(customerId, serviceType);
+ List<String> serviceInstances = service.listServiceInstances(customerId, serviceType);
Assert.assertTrue("service instances should be empty.", serviceInstances.isEmpty());
}