*/
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.AAIServiceSubscription;
-import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceInstance;
-import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfo;
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.*;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Headers;
})
// @GET("/api/aai-business/v11/customers")
@GET("/aai-business/v11/customers")
- Call<List<AAICustomer>> listCustomer();
+ Call<AAICustomerRsp> listCustomer();
@Headers({
"X-TransactionId: 7777",
})
// @GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances")
@GET("/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);
+ Call<ServiceInstanceRsp> listServiceInstances(@Path("global-customer-id") String customerId, @Path("service-type") String serviceType);
@Headers({
"X-TransactionId: 7777",
})
// @GET("/cloud-infrastructure/cloud-regions")
@GET("/aai-cloudInfrastructure/v11/cloud-regions")
- Call<List<VimInfo>> listVimInfo();
+ Call<VimInfoRsp> listVimInfo();
@Headers({
"X-TransactionId: 7777",
})
// @GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions")
@GET("/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions")
- Call<List<AAIServiceSubscription>> listServiceSubscriptions(@Path("global-customer-id") String customerId);
+ Call<ServiceSubscriptionRsp> listServiceSubscriptions(@Path("global-customer-id") String customerId);
}
--- /dev/null
+/**
+ * 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 java.util.List;
+
+public class AAICustomerRsp {
+
+ private List<AAICustomer> customer;
+
+ public List<AAICustomer> getCustomer() {
+ return customer;
+ }
+
+ public void setCustomer(List<AAICustomer> customer) {
+ this.customer = customer;
+ }
+}
--- /dev/null
+/**
+ * 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 ServiceInstanceRsp {
+
+ private List<ServiceInstance> serviceInstances;
+
+ @JsonProperty("service-instances")
+ public List<ServiceInstance> getServiceInstances() {
+ return serviceInstances;
+ }
+
+ @JsonProperty("service-instances")
+ public void setServiceInstances(List<ServiceInstance> serviceInstances) {
+ this.serviceInstances = serviceInstances;
+ }
+}
--- /dev/null
+/**
+ * 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 ServiceSubscriptionRsp {
+
+ private List<AAIServiceSubscription> serviceSubscriptions;
+
+ @JsonProperty("service-subscription")
+ public List<AAIServiceSubscription> getServiceSubscriptions() {
+ return serviceSubscriptions;
+ }
+
+ @JsonProperty("service-subscription")
+ public void setServiceSubscriptions(List<AAIServiceSubscription> serviceSubscriptions) {
+ this.serviceSubscriptions = serviceSubscriptions;
+ }
+}
--- /dev/null
+/**
+ * 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 VimInfoRsp {
+
+ private List<VimInfo> cloudRegion;
+
+ @JsonProperty("cloud-region")
+ public List<VimInfo> getCloudRegion() {
+ return cloudRegion;
+ }
+
+ @JsonProperty("cloud-region")
+ public void setCloudRegion(List<VimInfo> cloudRegion) {
+ this.cloudRegion = cloudRegion;
+ }
+}
@Override
public List<AAICustomer> listCustomer() {
try {
- return this.aaiService.listCustomer().execute().body();
+ return this.aaiService.listCustomer().execute().body().getCustomer();
} catch (IOException e) {
logger.error("list customers occur exception");
throw new AAIException("AAI is not available.", e);
@Override
public List<AAIServiceSubscription> listServiceSubscriptions(String customerId) {
try {
- return this.aaiService.listServiceSubscriptions(customerId).execute().body();
+ return this.aaiService.listServiceSubscriptions(customerId).execute().body().getServiceSubscriptions();
} catch (IOException e) {
logger.error("list customers occur exception");
throw new AAIException("AAI is not available.", e);
@Override
public List<ServiceInstance> listServiceInstances(String customerId, String serviceType) {
try {
- return aaiService.listServiceInstances(customerId, serviceType).execute().body();
+ return aaiService.listServiceInstances(customerId, serviceType).execute().body().getServiceInstances();
} catch (IOException e) {
logger.error("list services instances occur exception");
throw new AAIException("AAI is not available.", e);
import org.onap.usecaseui.server.service.lcm.domain.aai.exceptions.AAIException;
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.consts.SDCConsts;
import org.onap.usecaseui.server.service.lcm.domain.sdc.exceptions.SDCCatalogException;
import org.onap.usecaseui.server.util.RestfulServices;
import org.openecomp.sdc.toscaparser.api.NodeTemplate;
String.valueOf(input.getDefault())
));
}
+ if (SDCConsts.CATEGORY_NS.equals(type)) {
+// templateInputs.add(new TemplateInput(
+//
+// ));
+ }
+ // sdn controller
+// templateInputs.add(new TemplateInput(
+// "sdncontroller",
+// "enum",
+// "sdn controller for the service",
+// "false",
+// ""
+// ));
return new ServiceTemplateInput(
invariantUUID,
uuid,
@Override
public List<VimInfo> listVim() {
try {
- return aaiService.listVimInfo().execute().body();
+ return aaiService.listVimInfo().execute().body().getCloudRegion();
} catch (IOException e) {
logger.error("Visit AAI occur exception");
throw new AAIException("AAI is not available.", e);
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.bean.AAICustomerRsp;
import org.onap.usecaseui.server.service.lcm.domain.aai.exceptions.AAIException;
import retrofit2.Call;
List<AAICustomer> customers = singletonList(new AAICustomer("1", "name", "type"));
AAIService aaiService = mock(AAIService.class);
- Call<List<AAICustomer>> call = successfulCall(customers);
+ AAICustomerRsp rsp = new AAICustomerRsp();
+ rsp.setCustomer(customers);
+ Call<AAICustomerRsp> call = successfulCall(rsp);
when(aaiService.listCustomer()).thenReturn(call);
CustomerService customerService = new DefaultCustomerService(aaiService);
@Test(expected = AAIException.class)
public void itWillThrowExceptionWhenAAIIsNotAvailable() {
AAIService aaiService = mock(AAIService.class);
- Call<List<AAICustomer>> call = failedCall("AAI is not available!");
+ Call<AAICustomerRsp> call = failedCall("AAI is not available!");
when(aaiService.listCustomer()).thenReturn(call);
CustomerService customerService = new DefaultCustomerService(aaiService);
import org.onap.usecaseui.server.service.lcm.PackageDistributionService;
import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
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.sdc.SDCCatalogService;
import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate;
import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.Vnf;
private AAIService newAAIService(List<VimInfo> vim) {
AAIService aaiService = mock(AAIService.class);
-
- Call<List<VimInfo>> vimCall = successfulCall(vim);
+ VimInfoRsp rsp = new VimInfoRsp();
+ rsp.setCloudRegion(vim);
+ Call<VimInfoRsp> vimCall = successfulCall(rsp);
when(aaiService.listVimInfo()).thenReturn(vimCall);
return aaiService;
}
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.bean.ServiceInstanceRsp;
import org.onap.usecaseui.server.service.lcm.domain.aai.exceptions.AAIException;
import java.util.Collections;
String customerId = "1";
String serviceType = "service";
List<ServiceInstance> instances = Collections.singletonList(new ServiceInstance("1","service","1","VoLTE","e2eservice","abc","vim1"));
- when(aaiService.listServiceInstances(customerId, serviceType)).thenReturn(successfulCall(instances));
+ ServiceInstanceRsp rsp = new ServiceInstanceRsp();
+ rsp.setServiceInstances(instances);
+ when(aaiService.listServiceInstances(customerId, serviceType)).thenReturn(successfulCall(rsp));
ServiceInstanceService service = new DefaultServiceInstanceService(aaiService);
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.VimInfo;
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfoRsp;
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;
private AAIService newAAIService(List<VimInfo> vim) {
AAIService aaiService = mock(AAIService.class);
-
- Call<List<VimInfo>> vimCall = successfulCall(vim);
+ VimInfoRsp rsp = new VimInfoRsp();
+ rsp.setCloudRegion(vim);
+ Call<VimInfoRsp> vimCall = successfulCall(rsp);
when(aaiService.listVimInfo()).thenReturn(vimCall);
return aaiService;
}