summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuji7 <lu.ji3@zte.com.cn>2017-10-22 16:10:21 +0800
committerLuji7 <lu.ji3@zte.com.cn>2017-10-22 16:10:28 +0800
commite95ca1850bf09a99fd8854b3884984cac7cb40bd (patch)
tree9df0267786fc2fe98bc16f8a0e50ab0e989f6b4f
parent0407aa05f15150068001ee0c128c747298de959b (diff)
add sdnc controller para.
Change-Id: I1d9bb257f674837a5083242cb05497320de57cbf Issue-id: USECASEUI-53 Signed-off-by: Luji7 <lu.ji3@zte.com.cn>
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplateInput.java4
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceTemplateController.java7
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceTemplateService.java3
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java11
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/SDNCController.java47
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/SDNCControllerRsp.java35
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java24
7 files changed, 127 insertions, 4 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplateInput.java b/server/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplateInput.java
index 91a3eb05..0e25e0de 100644
--- a/server/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplateInput.java
+++ b/server/src/main/java/org/onap/usecaseui/server/bean/lcm/ServiceTemplateInput.java
@@ -117,6 +117,10 @@ public class ServiceTemplateInput {
this.inputs.add(input);
}
+ public void setType(String type) {
+ this.type = type;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceTemplateController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceTemplateController.java
index bbe25b70..9683eab3 100644
--- a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceTemplateController.java
+++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceTemplateController.java
@@ -17,6 +17,7 @@ package org.onap.usecaseui.server.controller.lcm;
import org.onap.usecaseui.server.bean.lcm.ServiceTemplateInput;
import org.onap.usecaseui.server.service.lcm.ServiceTemplateService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.SDNCController;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfo;
import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate;
import org.slf4j.Logger;
@@ -59,4 +60,10 @@ public class ServiceTemplateController {
public List<VimInfo> getLocations(){
return serviceTemplateService.listVim();
}
+
+ @ResponseBody
+ @RequestMapping(value = {"/uui-lcm/sdnc-controllers/"}, method = RequestMethod.GET , produces = "application/json")
+ public List<SDNCController> getSDNCControllers(){
+ return serviceTemplateService.listSDNCControllers();
+ }
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceTemplateService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceTemplateService.java
index c2607d4c..d14774fd 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceTemplateService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceTemplateService.java
@@ -16,6 +16,7 @@
package org.onap.usecaseui.server.service.lcm;
import org.onap.usecaseui.server.bean.lcm.ServiceTemplateInput;
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.SDNCController;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfo;
import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate;
@@ -28,4 +29,6 @@ public interface ServiceTemplateService {
ServiceTemplateInput fetchServiceTemplateInput(String uuid, String toscaModelPath);
List<VimInfo> listVim();
+
+ List<SDNCController> listSDNCControllers();
} \ No newline at end of file
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 df1e076f..d1ea6815 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
@@ -21,8 +21,6 @@ import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.Path;
-import java.util.List;
-
public interface AAIService {
@Headers({
@@ -64,4 +62,13 @@ public interface AAIService {
// @GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions")
@GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions")
Call<ServiceSubscriptionRsp> listServiceSubscriptions(@Path("global-customer-id") String customerId);
+
+ @Headers({
+ "X-TransactionId: 7777",
+ "X-FromAppId: uui",
+ "Authorization: Basic QUFJOkFBSQ==",
+ "Accept: application/json"
+ })
+ @GET("/api/aai-externalSystem/v11/esr-thirdparty-sdnc-list")
+ Call<SDNCControllerRsp> listSdncControllers();
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/SDNCController.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/SDNCController.java
new file mode 100644
index 00000000..b73cd400
--- /dev/null
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/SDNCController.java
@@ -0,0 +1,47 @@
+/**
+ * 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.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonIgnoreProperties(ignoreUnknown=true)
+public class SDNCController {
+
+ private String sdncId;
+
+ private String location;
+
+ @JsonProperty("thirdparty-sdnc-id")
+ public String getSdncId() {
+ return sdncId;
+ }
+
+ @JsonProperty("thirdparty-sdnc-id")
+ public void setSdncId(String sdncId) {
+ this.sdncId = sdncId;
+ }
+
+ @JsonProperty("location")
+ public String getLocation() {
+ return location;
+ }
+
+ @JsonProperty("location")
+ public void setLocation(String location) {
+ this.location = location;
+ }
+}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/SDNCControllerRsp.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/SDNCControllerRsp.java
new file mode 100644
index 00000000..3ceb3e72
--- /dev/null
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/SDNCControllerRsp.java
@@ -0,0 +1,35 @@
+/**
+ * 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.JsonProperty;
+
+import java.util.List;
+
+public class SDNCControllerRsp {
+
+ private List<SDNCController> esrThirdpartySdncList;
+
+ @JsonProperty("esr-thirdparty-sdnc-list")
+ public List<SDNCController> getEsrThirdpartySdncList() {
+ return esrThirdpartySdncList;
+ }
+
+ @JsonProperty("esr-thirdparty-sdnc-list")
+ public void setEsrThirdpartySdncList(List<SDNCController> esrThirdpartySdncList) {
+ this.esrThirdpartySdncList = esrThirdpartySdncList;
+ }
+}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java
index 92973e77..7d50a170 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java
@@ -21,6 +21,8 @@ import org.onap.usecaseui.server.bean.lcm.ServiceTemplateInput;
import org.onap.usecaseui.server.bean.lcm.TemplateInput;
import org.onap.usecaseui.server.service.lcm.ServiceTemplateService;
import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.SDNCController;
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.SDNCControllerRsp;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfo;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfoRsp;
import org.onap.usecaseui.server.service.lcm.domain.aai.exceptions.AAIException;
@@ -132,6 +134,7 @@ public class DefaultServiceTemplateService implements ServiceTemplateService {
List<TemplateInput> serviceInputs = getServiceInputs(inputsMap.values());
serviceTemplateInput.addInputs(serviceInputs);
if (isVF) {
+ serviceTemplateInput.setType("VF");
appendLocationParameters(serviceTemplateInput, tosca);
appendSdnControllerParameter(serviceTemplateInput);
}
@@ -141,12 +144,13 @@ public class DefaultServiceTemplateService implements ServiceTemplateService {
private void appendLocationParameters(ServiceTemplateInput serviceTemplateInput, ToscaTemplate tosca) {
for (NodeTemplate nodeTemplate : tosca.getNodeTemplates()) {
String type = nodeTemplate.getMetaData().getValue("type");
+ String uuid = nodeTemplate.getMetaData().getValue("UUID");
if ("VF".equals(type)) {
serviceTemplateInput.addInput(
new TemplateInput(
- nodeTemplate.getName() + "_location",
+ uuid,
"vf_location",
- "location for the service",
+ "location for the service " + uuid,
"true",
""
)
@@ -339,4 +343,20 @@ public class DefaultServiceTemplateService implements ServiceTemplateService {
throw new AAIException("AAI is not available.", e);
}
}
+
+ @Override
+ public List<SDNCController> listSDNCControllers() {
+ try {
+ Response<SDNCControllerRsp> response = aaiService.listSdncControllers().execute();
+ if (response.isSuccessful()) {
+ return response.body().getEsrThirdpartySdncList();
+ } else {
+ logger.info(String.format("Can not get sdnc controllers[code=%s, message=%s]", response.code(), response.message()));
+ return Collections.emptyList();
+ }
+ } catch (IOException e) {
+ logger.error("Visit AAI occur exception");
+ throw new AAIException("AAI is not available.", e);
+ }
+ }
}