summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuji7 <lu.ji3@zte.com.cn>2017-09-22 17:25:51 +0800
committerLuji7 <lu.ji3@zte.com.cn>2017-09-22 17:25:58 +0800
commitda86aa52d6cc136a040f342709b425be82ce187d (patch)
treef4b6e26dec2a225b8f774d10c28a9ed49ea4ee11
parent3132da22b04febc6df23504f82e0f8b13d163697 (diff)
query customer and service from aai
Change-Id: I70a04ae2b6834ffe5c1faa62a33dda4a88d81d77 Issue-Id: USECASEUI-36 Signed-off-by: Luji7 <lu.ji3@zte.com.cn>
-rw-r--r--pom.xml11
-rw-r--r--src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplate.java19
-rw-r--r--src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java43
-rw-r--r--src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java54
-rw-r--r--src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceTemplateController.java49
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/lcm/CustomerService.java24
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/lcm/ServiceInstanceService.java25
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/lcm/ServiceTemplateService.java25
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java44
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAICustomer.java53
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceInstance.java89
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/exceptions/AAIException.java23
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/SDCCatalogService.java38
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/SDCServiceTemplate.java21
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/Vnf.java19
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/consts/SDCConsts.java24
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/exceptions/SDCCatalogException.java23
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java57
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java57
-rw-r--r--src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java69
-rw-r--r--src/main/java/org/onap/usecaseui/server/util/RestfulServices.java30
21 files changed, 797 insertions, 0 deletions
diff --git a/pom.xml b/pom.xml
index fedfb8eb..341cc604 100644
--- a/pom.xml
+++ b/pom.xml
@@ -171,6 +171,17 @@
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>com.squareup.retrofit2</groupId>
+ <artifactId>retrofit</artifactId>
+ <version>2.3.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.retrofit2</groupId>
+ <artifactId>converter-jackson</artifactId>
+ <version>2.3.0</version>
+ </dependency>
</dependencies>
<build>
diff --git a/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplate.java b/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplate.java
new file mode 100644
index 00000000..bc23ac76
--- /dev/null
+++ b/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplate.java
@@ -0,0 +1,19 @@
+/**
+ * Copyright 2016-2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.bean.lcm;
+
+public class ServiceTemplate {
+}
diff --git a/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java b/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java
new file mode 100644
index 00000000..a1b8d0ef
--- /dev/null
+++ b/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java
@@ -0,0 +1,43 @@
+/**
+ * Copyright 2016-2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.controller.lcm;
+
+import org.onap.usecaseui.server.service.lcm.CustomerService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomer;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+@Controller
+@org.springframework.context.annotation.Configuration
+@EnableAspectJAutoProxy
+public class CustomerController {
+
+ @Resource(name="CustomerService")
+ private CustomerService customerService;
+
+ @ResponseBody
+ @RequestMapping(value = {"/lcm/customers"}, method = RequestMethod.GET , produces = "application/json")
+ public List<AAICustomer> getCustomers(HttpServletRequest request){
+ return customerService.listCustomer();
+ }
+}
diff --git a/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java b/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java
new file mode 100644
index 00000000..3d51f649
--- /dev/null
+++ b/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java
@@ -0,0 +1,54 @@
+/**
+ * Copyright 2016-2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.controller.lcm;
+
+import org.onap.usecaseui.server.service.lcm.ServiceInstanceService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceInstance;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+@Controller
+@org.springframework.context.annotation.Configuration
+@EnableAspectJAutoProxy
+public class ServiceInstanceController {
+
+ private static final Logger logger = LoggerFactory.getLogger(ServiceInstanceController.class);
+
+ @Resource(name="ServiceInstanceService")
+ private ServiceInstanceService serviceInstanceService;
+
+ @ResponseBody
+ @RequestMapping(value = {"/lcm/service-instances"}, method = RequestMethod.GET , produces = "application/json")
+ public List<ServiceInstance> getCustomers(HttpServletRequest request){
+ String customerId = request.getParameter("customerId");
+ String serviceType = request.getParameter("serviceType");
+ logger.info(String.format(
+ "list service instances with [customerId=%s, serviceType=%s]",
+ customerId,
+ serviceType));
+
+ return serviceInstanceService.listServiceInstances(customerId, serviceType);
+ }
+}
diff --git a/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceTemplateController.java b/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceTemplateController.java
new file mode 100644
index 00000000..53f77ee0
--- /dev/null
+++ b/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceTemplateController.java
@@ -0,0 +1,49 @@
+/**
+ * Copyright 2016-2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.controller.lcm;
+
+import org.onap.usecaseui.server.bean.lcm.ServiceTemplate;
+import org.onap.usecaseui.server.service.lcm.ServiceTemplateService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+@Controller
+@org.springframework.context.annotation.Configuration
+@EnableAspectJAutoProxy
+public class ServiceTemplateController {
+
+ private static final Logger logger = LoggerFactory.getLogger(ServiceTemplateController.class);
+
+ @Resource(name="ServiceTemplateService")
+ private ServiceTemplateService serviceTemplateService;
+
+ @ResponseBody
+ @RequestMapping(value = {"/lcm/service-templates"}, method = RequestMethod.GET , produces = "application/json")
+ public List<ServiceTemplate> getServiceTemplates(HttpServletRequest request){
+ return serviceTemplateService.listDistributedServiceTemplate();
+ }
+
+
+}
diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/CustomerService.java b/src/main/java/org/onap/usecaseui/server/service/lcm/CustomerService.java
new file mode 100644
index 00000000..9c659469
--- /dev/null
+++ b/src/main/java/org/onap/usecaseui/server/service/lcm/CustomerService.java
@@ -0,0 +1,24 @@
+/**
+ * Copyright 2016-2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.service.lcm;
+
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomer;
+
+import java.util.List;
+
+public interface CustomerService {
+ List<AAICustomer> listCustomer();
+}
diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceInstanceService.java b/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceInstanceService.java
new file mode 100644
index 00000000..1775211c
--- /dev/null
+++ b/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceInstanceService.java
@@ -0,0 +1,25 @@
+/**
+ * Copyright 2016-2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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);
+}
diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceTemplateService.java b/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceTemplateService.java
new file mode 100644
index 00000000..ea2d818d
--- /dev/null
+++ b/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceTemplateService.java
@@ -0,0 +1,25 @@
+/**
+ * Copyright 2016-2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.service.lcm;
+
+import org.onap.usecaseui.server.bean.lcm.ServiceTemplate;
+
+import java.util.List;
+
+public interface ServiceTemplateService {
+
+ List<ServiceTemplate> listDistributedServiceTemplate();
+}
diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java
new file mode 100644
index 00000000..b4683b21
--- /dev/null
+++ b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java
@@ -0,0 +1,44 @@
+/**
+ * Copyright 2016-2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.service.lcm.domain.aai;
+
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomer;
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceInstance;
+import retrofit2.Call;
+import retrofit2.http.GET;
+import retrofit2.http.Headers;
+import retrofit2.http.Path;
+
+import java.util.List;
+
+public interface AAIService {
+
+ @Headers({
+ "X-TransactionId: 7777",
+ "X-FromAppId: uui",
+ "Authorization: QUFJOkFBSQ=="
+ })
+ @GET("/api/aai-business/v11/customers")
+ Call<List<AAICustomer>> listCustomer();
+
+ @Headers({
+ "X-TransactionId: 7777",
+ "X-FromAppId: uui",
+ "Authorization: QUFJOkFBSQ=="
+ })
+ @GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances")
+ Call<List<ServiceInstance>> listServiceInstances(@Path("global-customer-id") String customerId, @Path("service-type") String serviceType);
+}
diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAICustomer.java b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAICustomer.java
new file mode 100644
index 00000000..e1135236
--- /dev/null
+++ b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAICustomer.java
@@ -0,0 +1,53 @@
+/**
+ * Copyright 2016-2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.service.lcm.domain.aai.bean;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class AAICustomer {
+
+ private String globalCustomerId;
+
+ private String subscriberName;
+
+ private String subscriberType;
+
+ @JsonCreator
+ public AAICustomer(
+ @JsonProperty("global-customer-id") String globalCustomerId,
+ @JsonProperty("subscriber-name") String subscriberName,
+ @JsonProperty("subscriber-type") String subscriberType) {
+ this.globalCustomerId = globalCustomerId;
+ this.subscriberName = subscriberName;
+ this.subscriberType = subscriberType;
+ }
+
+ @JsonProperty("global-customer-id")
+ public String getGlobalCustomerId() {
+ return globalCustomerId;
+ }
+
+ @JsonProperty("subscriber-name")
+ public String getSubscriberName() {
+ return subscriberName;
+ }
+
+ @JsonProperty("subscriber-type")
+ public String getSubscriberType() {
+ return subscriberType;
+ }
+}
diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceInstance.java b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceInstance.java
new file mode 100644
index 00000000..5245d27b
--- /dev/null
+++ b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/ServiceInstance.java
@@ -0,0 +1,89 @@
+/**
+ * Copyright 2016-2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.service.lcm.domain.aai.bean;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class ServiceInstance {
+
+ private String globalCustomerId;
+
+ private String serviceType;
+
+ private String serviceInstanceId;
+
+ private String subscriberName;
+
+ private String subscriberType;
+
+ private String serviceInstanceName;
+
+ private String serviceInstanceLocationId;
+
+ @JsonCreator
+ public ServiceInstance(
+ @JsonProperty("global-customer-id") String globalCustomerId,
+ @JsonProperty("service-type") String serviceType,
+ @JsonProperty("service-instance-id") String serviceInstanceId,
+ @JsonProperty("subscriber-name") String subscriberName,
+ @JsonProperty("subscriber-type") String subscriberType,
+ @JsonProperty("service-instance-name") String serviceInstanceName,
+ @JsonProperty("service-instance-location-id") String serviceInstanceLocationId) {
+ this.globalCustomerId = globalCustomerId;
+ this.serviceType = serviceType;
+ this.serviceInstanceId = serviceInstanceId;
+ this.subscriberName = subscriberName;
+ this.subscriberType = subscriberType;
+ this.serviceInstanceName = serviceInstanceName;
+ this.serviceInstanceLocationId = serviceInstanceLocationId;
+ }
+
+ @JsonProperty("global-customer-id")
+ public String getGlobalCustomerId() {
+ return globalCustomerId;
+ }
+
+ @JsonProperty("service-type")
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ @JsonProperty("service-instance-id")
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ @JsonProperty("subscriber-name")
+ public String getSubscriberName() {
+ return subscriberName;
+ }
+
+ @JsonProperty("subscriber-type")
+ public String getSubscriberType() {
+ return subscriberType;
+ }
+
+ @JsonProperty("service-instance-name")
+ public String getServiceInstanceName() {
+ return serviceInstanceName;
+ }
+
+ @JsonProperty("service-instance-location-id")
+ public String getServiceInstanceLocationId() {
+ return serviceInstanceLocationId;
+ }
+}
diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/exceptions/AAIException.java b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/exceptions/AAIException.java
new file mode 100644
index 00000000..e7bc0d9b
--- /dev/null
+++ b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/exceptions/AAIException.java
@@ -0,0 +1,23 @@
+/**
+ * Copyright 2016-2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.service.lcm.domain.aai.exceptions;
+
+public class AAIException extends RuntimeException {
+
+ public AAIException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/SDCCatalogService.java b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/SDCCatalogService.java
new file mode 100644
index 00000000..f6abba08
--- /dev/null
+++ b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/SDCCatalogService.java
@@ -0,0 +1,38 @@
+/**
+ * Copyright 2016-2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.service.lcm.domain.sdc;
+
+import okhttp3.ResponseBody;
+import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate;
+import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.Vnf;
+import retrofit2.Call;
+import retrofit2.http.GET;
+import retrofit2.http.Query;
+import retrofit2.http.Url;
+
+import java.util.List;
+
+public interface SDCCatalogService {
+
+ @GET("sdc/v1/catalog/services")
+ Call<List<SDCServiceTemplate>> listServices(@Query("category")String category, @Query("distributionStatus") String distributionStatus);
+
+ @GET
+ Call<ResponseBody> downloadCsar(@Url String fileUrl);
+
+ @GET("sdc/v1/catalog/resources")
+ Call<List<Vnf>> listResources(@Query("resourceType") String resourceType, @Query("distributionStatus") String distributionStatus);
+}
diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/SDCServiceTemplate.java b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/SDCServiceTemplate.java
new file mode 100644
index 00000000..48da58a4
--- /dev/null
+++ b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/SDCServiceTemplate.java
@@ -0,0 +1,21 @@
+/**
+ * Copyright 2016-2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.service.lcm.domain.sdc.bean;
+
+public class SDCServiceTemplate {
+
+
+}
diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/Vnf.java b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/Vnf.java
new file mode 100644
index 00000000..8b98c71c
--- /dev/null
+++ b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/bean/Vnf.java
@@ -0,0 +1,19 @@
+/**
+ * Copyright 2016-2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.service.lcm.domain.sdc.bean;
+
+public class Vnf {
+}
diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/consts/SDCConsts.java b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/consts/SDCConsts.java
new file mode 100644
index 00000000..76914e4a
--- /dev/null
+++ b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/consts/SDCConsts.java
@@ -0,0 +1,24 @@
+/**
+ * Copyright 2016-2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.service.lcm.domain.sdc.consts;
+
+public class SDCConsts {
+
+ public static final String CATEGORY_E2E_SERVICE = "e2e";
+ public static final String CATEGORY_NS = "ns";
+ public static final String DISTRIBUTION_STATUS_DISTRIBUTED = "DISTRIBUTED";
+ public static final String RESOURCETYPE_VF = "VF";
+}
diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/exceptions/SDCCatalogException.java b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/exceptions/SDCCatalogException.java
new file mode 100644
index 00000000..b0998486
--- /dev/null
+++ b/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/exceptions/SDCCatalogException.java
@@ -0,0 +1,23 @@
+/**
+ * Copyright 2016-2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.service.lcm.domain.sdc.exceptions;
+
+public class SDCCatalogException extends RuntimeException {
+
+ public SDCCatalogException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java b/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java
new file mode 100644
index 00000000..9332dcf7
--- /dev/null
+++ b/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java
@@ -0,0 +1,57 @@
+/**
+ * Copyright 2016-2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.service.lcm.impl;
+
+import org.onap.usecaseui.server.service.lcm.CustomerService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomer;
+import org.onap.usecaseui.server.service.lcm.domain.aai.exceptions.AAIException;
+import org.onap.usecaseui.server.util.RestfulServices;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.util.List;
+
+@Service("CustomerService")
+@org.springframework.context.annotation.Configuration
+@EnableAspectJAutoProxy
+public class DefaultCustomerService implements CustomerService {
+
+ private static final Logger logger = LoggerFactory.getLogger(DefaultCustomerService.class);
+
+ private AAIService aaiService;
+
+ public DefaultCustomerService() {
+ this(RestfulServices.create(AAIService.class));
+ }
+
+ public DefaultCustomerService(AAIService aaiService) {
+ this.aaiService = aaiService;
+ }
+
+ @Override
+ public List<AAICustomer> listCustomer() {
+ try {
+ return this.aaiService.listCustomer().execute().body();
+ } catch (IOException e) {
+ logger.error("list customers occur exception");
+ throw new AAIException("AAI is not available.", e);
+ }
+ }
+}
diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java b/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java
new file mode 100644
index 00000000..540a0dad
--- /dev/null
+++ b/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java
@@ -0,0 +1,57 @@
+/**
+ * Copyright 2016-2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.service.lcm.impl;
+
+import org.onap.usecaseui.server.service.lcm.ServiceInstanceService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceInstance;
+import org.onap.usecaseui.server.service.lcm.domain.aai.exceptions.AAIException;
+import org.onap.usecaseui.server.util.RestfulServices;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.util.List;
+
+@Service("ServiceInstanceService")
+@org.springframework.context.annotation.Configuration
+@EnableAspectJAutoProxy
+public class DefaultServiceInstanceService implements ServiceInstanceService {
+
+ private static final Logger logger = LoggerFactory.getLogger(DefaultServiceInstanceService.class);
+
+ private AAIService aaiService;
+
+ public DefaultServiceInstanceService() {
+ this(RestfulServices.create(AAIService.class));
+ }
+
+ public DefaultServiceInstanceService(AAIService aaiService) {
+ this.aaiService = aaiService;
+ }
+
+ @Override
+ public List<ServiceInstance> listServiceInstances(String customerId, String serviceType) {
+ try {
+ return aaiService.listServiceInstances(customerId, serviceType).execute().body();
+ } catch (IOException e) {
+ logger.error("list services instances occur exception");
+ throw new AAIException("AAI is not available.", e);
+ }
+ }
+}
diff --git a/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java b/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java
new file mode 100644
index 00000000..a5d90ed3
--- /dev/null
+++ b/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java
@@ -0,0 +1,69 @@
+/**
+ * Copyright 2016-2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.service.lcm.impl;
+
+import org.onap.usecaseui.server.bean.lcm.ServiceTemplate;
+import org.onap.usecaseui.server.service.lcm.ServiceTemplateService;
+import org.onap.usecaseui.server.service.lcm.domain.sdc.SDCCatalogService;
+import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate;
+import org.onap.usecaseui.server.service.lcm.domain.sdc.exceptions.SDCCatalogException;
+import org.onap.usecaseui.server.util.RestfulServices;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.stereotype.Service;
+
+import javax.transaction.Transactional;
+import java.io.IOException;
+import java.util.List;
+
+import static org.onap.usecaseui.server.service.lcm.domain.sdc.consts.SDCConsts.CATEGORY_E2E_SERVICE;
+import static org.onap.usecaseui.server.service.lcm.domain.sdc.consts.SDCConsts.DISTRIBUTION_STATUS_DISTRIBUTED;
+
+@Service("ServiceTemplateService")
+@Transactional
+@org.springframework.context.annotation.Configuration
+@EnableAspectJAutoProxy
+public class DefaultServiceTemplateService implements ServiceTemplateService {
+
+ private static final Logger logger = LoggerFactory.getLogger(DefaultServiceTemplateService.class);
+
+ private SDCCatalogService sdcCatalog;
+
+ public DefaultServiceTemplateService() {
+ this(RestfulServices.create(SDCCatalogService.class));
+ }
+
+ public DefaultServiceTemplateService(SDCCatalogService sdcCatalog) {
+ this.sdcCatalog = sdcCatalog;
+ }
+
+ @Override
+ public List<ServiceTemplate> listDistributedServiceTemplate() {
+ try {
+ List<SDCServiceTemplate> serviceTemplate = this.sdcCatalog.listServices(CATEGORY_E2E_SERVICE, DISTRIBUTION_STATUS_DISTRIBUTED).execute().body();
+ return translate(serviceTemplate);
+ } catch (IOException e) {
+ logger.error("Visit SDC Catalog occur exception");
+ logger.info("SDC Catalog Exception: ", e);
+ throw new SDCCatalogException("SDC Catalog is not available.", e);
+ }
+ }
+
+ private List<ServiceTemplate> translate(List<SDCServiceTemplate> serviceTemplate) {
+ return null;
+ }
+}
diff --git a/src/main/java/org/onap/usecaseui/server/util/RestfulServices.java b/src/main/java/org/onap/usecaseui/server/util/RestfulServices.java
new file mode 100644
index 00000000..c26aab69
--- /dev/null
+++ b/src/main/java/org/onap/usecaseui/server/util/RestfulServices.java
@@ -0,0 +1,30 @@
+/**
+ * Copyright 2016-2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.util;
+
+import retrofit2.Retrofit;
+import retrofit2.converter.jackson.JacksonConverterFactory;
+
+public class RestfulServices {
+
+ public static <T> T create(Class<T> clazz) {
+ Retrofit retrofit = new Retrofit.Builder()
+ .baseUrl("http://localhost")
+ .addConverterFactory(JacksonConverterFactory.create())
+ .build();
+ return retrofit.create(clazz);
+ }
+}