aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormukesh.paliwal1@huawei.com <mukesh.paliwal1@huawei.com>2020-04-14 12:17:05 +0530
committerMukesh Paliwal <mukesh.paliwal1@huawei.com>2020-04-14 09:44:50 +0000
commitebe8d6c38ab82c9a014b118cb5284a407ca042b0 (patch)
tree5c40bd5ca3f12f239f94cde6f2deefe45451d876
parente65c5a124de83043fb2085a5b415793d50d400ab (diff)
vnf and uni id is not filtering for Service topology
Issue-ID: USECASEUI-427 Signed-off-by: mukesh.paliwal1@huawei.com <mukesh.paliwal1@huawei.com> Change-Id: I667087ac48c059f52da83ff76a5db7cfe9c37ece
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/bean/activateEdge/ServiceInstantiationResponse.java46
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/lcm/SotnServiceLcmController.java7
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/customer/impl/CcvpnCustomerServiceImpl.java6
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/SotnServiceTemplateService.java1
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceQryServiceImpl.java2
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceTemplateServiceImpl.java306
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/bean/activeEdge/ServiceInstantiationResponseTest.java44
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/bean/lcm/sotne2eservice/PinterfaceTest.java11
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/bean/lcm/sotne2eservice/UniTest.java50
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/bean/lcm/sotne2eservice/VnfsTest.java56
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceTemplateServiceImplTest.java125
11 files changed, 508 insertions, 146 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/activateEdge/ServiceInstantiationResponse.java b/server/src/main/java/org/onap/usecaseui/server/bean/activateEdge/ServiceInstantiationResponse.java
new file mode 100644
index 00000000..e3230191
--- /dev/null
+++ b/server/src/main/java/org/onap/usecaseui/server/bean/activateEdge/ServiceInstantiationResponse.java
@@ -0,0 +1,46 @@
+/**
+ * Copyright (C) 2020 Huawei, Inc. and others. All rights reserved.
+ *
+ * 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.activateEdge;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "status"
+})
+public class ServiceInstantiationResponse {
+
+ @JsonProperty("status")
+ String status;
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ @Override
+ public String toString() {
+ return "{" +
+ "\"status\":\"" + status + '\"' +
+ '}';
+ }
+}
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/SotnServiceLcmController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/SotnServiceLcmController.java
index 2a5ebdd2..951af184 100644
--- a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/SotnServiceLcmController.java
+++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/SotnServiceLcmController.java
@@ -112,4 +112,11 @@ public class SotnServiceLcmController {
logger.info("Vpn Binding topology called.");
return sotnServiceTemplateService.getVPNBindingInformationTopology(servicetype, serviceInstanceId, vpinId);
}
+
+ @ResponseBody
+ @GetMapping(value = {"/uui-lcm/Sotnservices/serviceStatus/service-instance/{instanceid}"}, produces = "application/json")
+ public String getSotnServicestatus(@PathVariable("instanceid") String instanceid) {
+ logger.info("service status called.");
+ return sotnServiceTemplateService.getSOTNInstantiationstatus(instanceid);
+ }
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/customer/impl/CcvpnCustomerServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/customer/impl/CcvpnCustomerServiceImpl.java
index f7c67dd8..4fa79ade 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/customer/impl/CcvpnCustomerServiceImpl.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/customer/impl/CcvpnCustomerServiceImpl.java
@@ -126,8 +126,8 @@ public class CcvpnCustomerServiceImpl implements CcvpnCustomerService {
logger.error("getServiceSubscription exception occured:" + ex);
result = Constant.CONSTANT_FAILED;
}
- return "{\"subscriptions\":[{\"serviceType\":\"SOTN\"}]}";
- //return subscriptions.toString();
+ logger.info("getServiceSubscription:" + subscriptions.toString());
+ return subscriptions.toString();
}
@@ -154,4 +154,4 @@ public class CcvpnCustomerServiceImpl implements CcvpnCustomerService {
return null;
}
}
-} \ No newline at end of file
+}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/SotnServiceTemplateService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/SotnServiceTemplateService.java
index e2ed5b95..2d9c563f 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/SotnServiceTemplateService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/SotnServiceTemplateService.java
@@ -30,4 +30,5 @@ public interface SotnServiceTemplateService {
public String getService(String subscriptionType, String instanceid);
public String getServiceInformationTopology(String subscriptionType, String instanceid) throws Exception;
public String getVPNBindingInformationTopology(String subscriptionType, String instanceid, String vpnId) throws Exception;
+ public String getSOTNInstantiationstatus(String serviceid);
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceQryServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceQryServiceImpl.java
index 785cb6bc..c62cf232 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceQryServiceImpl.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceQryServiceImpl.java
@@ -104,7 +104,7 @@ public class SotnServiceQryServiceImpl implements SotnServiceQryService {
public ModelConfig readFile() {
JSONParser parser = new JSONParser();
- ClassLoader classLoader = new CcvpnCustomerServiceImpl().getClass().getClassLoader();
+ ClassLoader classLoader = new SotnServiceQryServiceImpl().getClass().getClassLoader();
File file = new File(classLoader.getResource("modelconfig.json").getFile());
ObjectMapper mapper = new ObjectMapper();
try {
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceTemplateServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceTemplateServiceImpl.java
index 845c94d0..2ce2cb24 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceTemplateServiceImpl.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceTemplateServiceImpl.java
@@ -27,7 +27,6 @@ import okhttp3.ResponseBody;
//import org.onap.usecaseui.server.bean.lcm.sotne2eservice.Connectivity;
//import org.onap.usecaseui.server.bean.sotn.Pinterface;
import org.onap.usecaseui.server.bean.orderservice.ServiceEstimationBean;
-import org.onap.usecaseui.server.service.customer.impl.CcvpnCustomerServiceImpl;
import org.onap.usecaseui.server.service.lcm.SotnServiceTemplateService;
import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.Relationship;
@@ -39,6 +38,9 @@ import org.onap.usecaseui.server.service.lcm.domain.so.bean.Operation;
import org.onap.usecaseui.server.service.lcm.domain.so.exceptions.SOException;
import org.onap.usecaseui.server.bean.lcm.sotne2eservice.*;
import org.onap.usecaseui.server.bean.activateEdge.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
import retrofit2.Response;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.RelationshipData;
@@ -61,6 +63,8 @@ import org.springframework.stereotype.Service;
@EnableAspectJAutoProxy
public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateService {
+ private static final Logger logger = LoggerFactory.getLogger(SotnServiceTemplateServiceImpl.class);
+
private SOService soService;
private AAIService aaiService;
@@ -75,30 +79,29 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
return null;
}
- public ModelConfig readFile() {
+ public ModelConfig readFile() {
JSONParser parser = new JSONParser();
- ClassLoader classLoader = new CcvpnCustomerServiceImpl().getClass().getClassLoader();
+ ClassLoader classLoader = new SotnServiceQryServiceImpl().getClass().getClassLoader();
File file = new File(classLoader.getResource("modelconfig.json").getFile());
ObjectMapper mapper = new ObjectMapper();
try {
-
Object object = parser.parse(new FileReader(file));
ModelConfig modelInformation = mapper.readValue(object.toString(), new TypeReference<ModelConfig>() {
});
return modelInformation;
} catch (ParseException | IOException ex) {
- // logger.error("Exception occured while reading configuration file:" + ex);
+ logger.error("Exception occured while reading configuration file:" + ex);
return null;
}
}
public ModelConfig readFile_unni(){
JSONParser parser = new JSONParser();
- ClassLoader classLoader = new CcvpnCustomerServiceImpl().getClass().getClassLoader();
+ ClassLoader classLoader = new SotnServiceQryServiceImpl().getClass().getClassLoader();
File file = new File(classLoader.getResource("modelconfigunni.json").getFile());
- ObjectMapper mapper = new ObjectMapper();
+ ObjectMapper mapper = new ObjectMapper();
try {
Object object = parser.parse(new FileReader(file));
ModelConfig modelInformation = mapper.readValue(object.toString(), new TypeReference<ModelConfig>() {
@@ -120,61 +123,41 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
//Map<String, Model> modelInfo = readConfigToMap(modelConfig);
List<ModelInfor> resourceModel = modelConfig.getResourcemodelinformation();
-// try {
-// inStream = request.getInputStream();
-// BufferedReader reader = new BufferedReader(new InputStreamReader(inStream));
-// String requestJson = IOUtils.read(reader);
-// logger.info("The request body content is: " + requestJson);
-// } catch (IOException e) {
-// logger.info("The request body parsing failed." + e.getMessage());
-// return null;
-// } finally {
-// if (inStream != null) {
-// try {
-// inStream.close();
-// } catch (IOException e) {
-//
-// }
-// }
-// }
-
String customerid = modelConfig.getSubscriberId();
String subscriptionType = modelConfig.getSubscriptionType();
requestBody = create_CCVPN_Request_Body(reqt, resourceModel, customerid, subscriptionType, servicemodel);
try {
- System.out.println("SO request formed : " + new ObjectMapper().writeValueAsString(requestBody));
+ logger.info("SO request formed : " + new ObjectMapper().writeValueAsString(requestBody));
} catch (IOException e) {
-
+ logger.info("IOException : " + e.getMessage());
}
ServiceOperation sotnserviceoperation = createSotnService(requestBody);
sotnservice = sotnserviceoperation.getService();
- //logger.info("Began to sleep for ");
+ logger.info("Began to sleep for ");
try {
Thread.sleep(1);
} catch (Exception e) {
- // logger.info("sleep Interrupted");
+ logger.info("sleep Interrupted");
}
- // logger.info("wokeup to sleep ");
-
-
+ logger.info("wokeup to sleep ");
return sotnserviceoperation;
- //return null;
}
+
public ServiceOperation createSotnService(E2EServiceInstanceRequest requestBody) {
Operation result = new Operation();
try {
- // logger.info("SO instantiate SOTN service is starting");
- Response<ServiceOperation> sotnserviceresponse = soService.instantiateSOTNService(requestBody).execute();
- // logger.info("SO instantiate SOTN service has finished");
+ logger.info("SO instantiate SOTN service is starting");
+ Response<ServiceOperation> sotnserviceresponse = soService.instantiateSOTNService(requestBody).execute();
+ logger.info("SO instantiate SOTN service has finished");
if (sotnserviceresponse.isSuccessful()) {
- // logger.info("SO instantiate SOTN service is successful");
- //result=sotnserviceresponse.body().getService();
+ logger.info("SO instantiate SOTN service is successful");
+ result=sotnserviceresponse.body().getService();
return sotnserviceresponse.body();
} else {
- // logger.error(String.format("Can not instantiate SOTN service[code=%s, message=%s]", sotnserviceresponse.code(), sotnserviceresponse.message()));
+ logger.error(String.format("Can not instantiate SOTN service[code=%s, message=%s]", sotnserviceresponse.code(), sotnserviceresponse.message()));
throw new SOException("SO instantiate SOTN service failed!");
}
} catch (Exception e) {
@@ -247,113 +230,94 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
public ServiceInstance getServiceInstancesInfo(String customerId, String serviceType, String serviceInstanceId) throws Exception {
- //logger.info("Fire getServiceInstances : Begin");
+ logger.info("Fire getServiceInstances : Begin");
ObjectMapper mapper = new ObjectMapper();
Response<ResponseBody> response = this.aaiService.getServiceInstancesForEdge(customerId, serviceType, serviceInstanceId).execute();
if (response.isSuccessful()) {
- // logger.info("Fire getServiceInstances : End");
+ logger.info("Fire getServiceInstances : End");
String result = new String(response.body().bytes());
ServiceInstance serviceInstance = mapper.readValue(result, ServiceInstance.class);
return serviceInstance;
- //System.out.println("Response received : "+response.body().bytes());
} else {
- // logger.info("Fire getServiceInstances : Failed");
-
+ logger.info("Fire getServiceInstances : Failed");
}
return null;
}
private Connectivity getConnectivityInfo(String connectivityinstanceid) throws IOException {
- //logger.info("Fire getServiceInstancesForEdge : Begin");
+ logger.info("Fire getServiceInstancesForEdge : Begin");
ObjectMapper mapper = new ObjectMapper();
Response<ResponseBody> response = this.aaiService.getConnectivityInformation(connectivityinstanceid).execute();
if (response.isSuccessful()) {
- // logger.info("Fire getServiceInstancesForEdge : End");
+ logger.info("Fire getServiceInstancesForEdge : End");
String result = new String(response.body().bytes());
Connectivity connectivity = mapper.readValue(result, Connectivity.class);
return connectivity;
- //System.out.println("Response received : "+response.body().bytes());
} else {
- // logger.info("Fire getServiceInstancesForEdge : Failed");
-
+ logger.info("Fire getServiceInstancesForEdge : Failed");
}
-
-
return null;
}
public Pinterface getTerminationPoint(String pnfName, String tpId) throws Exception {
- //logger.info("Fire getTerminationPoint : Begin");
+ logger.info("Fire getTerminationPoint : Begin");
ObjectMapper mapper = new ObjectMapper();
- //Response<ResponseBody> response = this.aaiService.getPinterfaceByPnfName(pnfName,tpId).execute();
+ // Response<ResponseBody> response = this.aaiService.getPinterfaceByPnfName(pnfName,tpId).execute();
Response<ResponseBody> response = this.aaiService.getTerminationPoint(pnfName, tpId).execute();
if (response.isSuccessful()) {
- // logger.info("Fire getTerminationPoint : End");
+ logger.info("Fire getTerminationPoint : End");
String result = new String(response.body().bytes());
Pinterface pinterface = mapper.readValue(result, Pinterface.class);
return pinterface;
- //System.out.println("Response received : "+response.body().bytes());
} else {
- //logger.info("Fire getTerminationPoint : Failed");
-
+ logger.info("Fire getTerminationPoint : Failed");
}
-
return null;
}
private AllottedResource getAllottedResource(String globalCustomerId, String serviceType, String siteserviceinstanceid, String allottedResourceId) throws IOException {
- // logger.info("Fire getServiceInstancesForEdge : Begin");
+ logger.info("Fire getServiceInstancesForEdge : Begin");
ObjectMapper mapper = new ObjectMapper();
Response<ResponseBody> response = this.aaiService.getAllotedResourceFor5G(globalCustomerId, serviceType, siteserviceinstanceid, allottedResourceId).execute();
if (response.isSuccessful()) {
- //logger.info("Fire getServiceInstancesForEdge : End");
+ logger.info("Fire getServiceInstancesForEdge : End");
String result = new String(response.body().bytes());
AllottedResource allottedResource = mapper.readValue(result, AllottedResource.class);
return allottedResource;
- //System.out.println("Response received : "+response.body().bytes());
} else {
- //logger.info("Fire getServiceInstancesForEdge : Failed");
-
+ logger.info("Fire getServiceInstancesForEdge : Failed");
}
-
-
return null;
}
private SiteResource getSiteResource(String siteResourceID) throws IOException {
- //logger.info("Fire get site resource : Begin");
+ logger.info("Fire get site resource : Begin");
ObjectMapper mapper = new ObjectMapper();
Response<ResponseBody> response = this.aaiService.getSiteResourceInfo(siteResourceID).execute();
if (response.isSuccessful()) {
- // logger.info("Fire get site resource : End");
+ logger.info("Fire get site resource : End");
String result = new String(response.body().bytes());
SiteResource resource = mapper.readValue(result, SiteResource.class);
return resource;
- //System.out.println("Response received : "+response.body().bytes());
} else {
- // logger.info("Fire get site resource : Failed");
-
+ logger.info("Fire get site resource : Failed");
}
return null;
}
private ComplexObj getComplexData(String complexID) throws IOException {
- // logger.info("Fire get complex Object : Begin");
+ logger.info("Fire get complex Object : Begin");
ObjectMapper mapper = new ObjectMapper();
Response<ResponseBody> response = this.aaiService.getComplexObject(complexID).execute();
if (response.isSuccessful()) {
- // logger.info("Fire get complex Object : End");
+ logger.info("Fire get complex Object : End");
String result = new String(response.body().bytes());
ComplexObj complexObj = mapper.readValue(result, ComplexObj.class);
return complexObj;
- //System.out.println("Response received : "+response.body().bytes());
} else {
- // logger.info("Fire get complex Object : Failed");
-
+ logger.info("Fire get complex Object : Failed");
}
-
-
return null;
}
@@ -381,8 +345,8 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
if (serviceInstance == null)
return null;
} catch (Exception e) {
-// logger.info("Query Service Instance information failed. No service information found for customer "
-// + customerId + " and Service Type " + subscriptionType);
+ logger.info("Query Service Instance information failed. No service information found for customer "
+ + customerId + " and Service Type " + subscriptionType);
return null;
}
@@ -401,7 +365,7 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
Connectivity connectivity = getConnectivityInfo(connectivityinstanceid);
connectivityparams = new ObjectMapper().readValue(connectivity.toString(), HashMap.class);
} catch (IOException e) {
- // logger.info("IO Exception occured " + e.getMessage());
+ logger.info("IO Exception occured " + e.getMessage());
}
//nodeId-10.10.10.10-ltpId-147
allottedpinterfaceid = "nodeId-" + connectivityparams.get("accessNodeId").toString() + "-ltpId-" + connectivityparams.get("accessLtpId").toString();
@@ -412,7 +376,7 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
if (linkstatus.equalsIgnoreCase("overloaded"))
linkstatus = "up";
} catch (Exception e) {
-
+ logger.info("Exception: "+ e.getMessage());
}
List<Relationship> servicerelationList = relationship.stream()
@@ -427,8 +391,8 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
if (siteservice == null)
return null;
} catch (Exception e) {
-// logger.info("Query Service Instance information failed. No service information found for customer "
-// + customerId + " and Service Type " + subscriptionType);
+ logger.info("Query Service Instance information failed. No service information found for customer "
+ + customerId + " and Service Type " + subscriptionType);
return null;
}
List<Relationship> ssrelationship = siteservice.getRelationshipList().getRelationship().stream()
@@ -447,7 +411,7 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
externalltp = allottedResource.getAccessLtpId();
} catch (Exception e) {
- // logger.info("Query Allotted resource for site service" + siteserviceinstanceid + " allotted resource Id " + allottedResourceId);
+ logger.info("Query Allotted resource for site service" + siteserviceinstanceid + " allotted resource Id " + allottedResourceId);
}
@@ -485,8 +449,8 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
site.put("attribute", attr);
sites.add(site);
} catch (Exception e) {
-// logger.info("Query Service Instance information failed. No service information found for customer "
-// + customerId + " and Service Type " + subscriptionType);
+ logger.info("Query Service Instance information failed. No service information found for customer "
+ + customerId + " and Service Type " + subscriptionType);
return null;
}
} else {
@@ -497,6 +461,7 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
e2eserviceRequest = mapper.readValue(requestinput.toString(), new TypeReference<E2EServiceInstanceRequest>() {
});
} catch (IOException e) {
+ logger.info("IOException: "+ e.getMessage());
}
HashMap<String, ?> requestInputs = e2eserviceRequest.getService().getParameters().getRequestInputs();
@@ -535,7 +500,7 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
jsonresponse = new ObjectMapper().writeValueAsString(sites);
System.out.println(jsonresponse);
} catch (IOException e) {
-
+ logger.info("IOException: "+ e.getMessage());
}
}
@@ -557,14 +522,14 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
try {
serviceInstance = getServiceInstancesInfo(customerId, subscriptionType, serviceId);
if (serviceInstance == null) {
-// logger.info("Query Service Instance information failed. No service information found for customer "
-// + customerId + " and Service Type " + subscriptionType);
+ logger.info("Query Service Instance information failed. No service information found for customer "
+ + customerId + " and Service Type " + subscriptionType);
return null;
}
} catch (Exception e) {
-// logger.info("Query Service Instance information failed. No service information found for customer "
-// + customerId + " and Service Type " + subscriptionType);
+ logger.info("Query Service Instance information failed. No service information found for customer "
+ + customerId + " and Service Type " + subscriptionType);
return null;
}
@@ -577,15 +542,15 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
String siteserviceId = siterelation.getRelatedLink().substring(siterelation.getRelatedLink().lastIndexOf("/") + 1);
try {
-// logger.info("so begin terminate site service " + siteserviceId);
+ logger.info("so begin terminate site service " + siteserviceId);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), requestStr);
Response<DeleteOperationRsp> response = soService.terminateService(siteserviceId, requestBody).execute();
-// logger.info("so terminate has finished");
+ logger.info("so terminate has finished");
if (response.isSuccessful()) {
-// logger.info("so terminated site service " + siteserviceId + "successfully...");
+ logger.info("so terminated site service " + siteserviceId + "successfully...");
} else {
-// logger.error(String.format("Can not terminate service " + siteserviceId + " [code=%s, message=%s]", response.code(), response.message()));
+ logger.error(String.format("Can not terminate service " + siteserviceId + " [code=%s, message=%s]", response.code(), response.message()));
throw new SOException("SO terminate service failed!");
}
} catch (IOException e) {
@@ -593,21 +558,21 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
}
}
try {
-// logger.info("Began to sleep for " + sleeptime);
+ logger.info("Began to sleep for " + sleeptime);
Thread.sleep(sleeptime);
} catch (InterruptedException e) {
-// logger.error(String.format("Thread Interruppted from sleep while deleting service subscription"));
+ logger.error(String.format("Thread Interruppted from sleep while deleting service subscription"));
}
try {
-// logger.info("so begin terminate Connectivity service " + serviceId);
+ logger.info("so begin terminate Connectivity service " + serviceId);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), requestStr);
Response<DeleteOperationRsp> response = soService.terminateService(serviceId, requestBody).execute();
-// logger.info("so terminate has finished");
+ logger.info("so terminate has finished");
if (response.isSuccessful()) {
-// logger.info("so terminated connectivity service " + serviceId + "successfully...");
+ logger.info("so terminated connectivity service " + serviceId + "successfully...");
} else {
-// logger.error(String.format("Can not terminate service " + serviceId + " [code=%s, message=%s]", response.code(), response.message()));
+ logger.error(String.format("Can not terminate service " + serviceId + " [code=%s, message=%s]", response.code(), response.message()));
throw new SOException("SO terminate service failed!");
}
return response.body();
@@ -618,74 +583,79 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
public VpnBinding getSOTNPinterfaceByVpnId(String vpnId) throws Exception {
- // logger.info("Fire getSOTNPinterfaceByVpnId : Begin");
+ logger.info("Fire getSOTNPinterfaceByVpnId : Begin");
ObjectMapper mapper = new ObjectMapper();
Response<ResponseBody> response = this.aaiService.getPinterfaceByVpnId(vpnId).execute();
//Response<ResponseBody> response = this.aaiService.getSOTNPinterfaceByVpnId(vpnId).execute();
if (response.isSuccessful()) {
- // logger.info("Fire getSOTNPinterfaceByVpnId : End");
+ logger.info("Fire getSOTNPinterfaceByVpnId : End");
String result = new String(response.body().bytes());
VpnBinding vpnBinding = mapper.readValue(result, VpnBinding.class);
return vpnBinding;
- //System.out.println("Response received : "+response.body().bytes());
} else {
- // logger.info("Fire getSOTNPinterfaceByVpnId : Failed");
-
+ logger.info("Fire getSOTNPinterfaceByVpnId : Failed");
}
return null;
}
public Pnf getSOTNPnf(String pnfname) throws Exception {
+ logger.info("Fire getSOTNPnf : Begin");
ObjectMapper mapper = new ObjectMapper();
Response<ResponseBody> response = this.aaiService.getPnfInfo(pnfname).execute();
if (response.isSuccessful()) {
- // logger.info("Fire getSOTNLinkbyName : End");
+ logger.info("Fire getSOTNPnf : End");
String result = new String(response.body().bytes());
Pnf pnf = mapper.readValue(result, Pnf.class);
return pnf;
- //System.out.println("Response received : "+response.body().bytes());
} else {
- // logger.info("Fire get SOTN PnF by Name : Failed" + pnfname);
+ logger.info("Fire get SOTN PnF by Name : Failed" + pnfname);
}
return null;
}
public LogicalLink getSOTNLinkbyName(String linkName) throws Exception {
- // logger.info("Fire getSOTNLinkbyName : Begin");
+ logger.info("Fire getSOTNLinkbyName : Begin");
ObjectMapper mapper = new ObjectMapper();
Response<ResponseBody> response = this.aaiService.getSpecificLogicalLink(linkName).execute();
if (response.isSuccessful()) {
- // logger.info("Fire getSOTNLinkbyName : End");
+ logger.info("Fire getSOTNLinkbyName : End");
String result = new String(response.body().bytes());
LogicalLink logicalLink = mapper.readValue(result, LogicalLink.class);
return logicalLink;
- //System.out.println("Response received : "+response.body().bytes());
} else {
- // logger.info("Fire getSOTNLinkbyName : Failed");
+ logger.info("Fire getSOTNLinkbyName : Failed");
}
return null;
}
public Uni getUNIInfo(String uniId) throws Exception {
+ logger.info("Fire getUNIInfo : Begin");
ObjectMapper mapper = new ObjectMapper();
Response<ResponseBody> response = this.aaiService.getUNIInfo(uniId).execute();
if (response.isSuccessful()) {
+ logger.info("Fire getUNIInfo : Begin");
String result = new String(response.body().bytes());
Uni uni = mapper.readValue(result, Uni.class);
return uni;
- }
+ } else {
+ logger.info("Fire getUNIInfo : Failed");
+ }
return null;
}
public Vnfs getVnfs(String vnfId) throws Exception {
+ logger.info("Fire getVnfs : Begin");
ObjectMapper mapper = new ObjectMapper();
Response<ResponseBody> response = this.aaiService.getVNFsDetail(vnfId).execute();
if (response.isSuccessful()) {
+ logger.info("Fire getVnfs : End");
String result = new String(response.body().bytes());
Vnfs vnf = mapper.readValue(result, Vnfs.class);
return vnf;
+ } else {
+ logger.info("Fire getVnfs : Failed");
}
return null;
}
@@ -757,6 +727,7 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
edges.add(getEdge(vpn.getId(),vpnpinterface.getId()));
}
} catch (Exception ex) {
+ logger.info("Exception: "+ ex);
}
ResourceResponse resourceResponse = new ResourceResponse();
resourceResponse.setNodes(nodes);
@@ -794,6 +765,7 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
nodes.add(serviceNode);
}
} catch (Exception e) {
+ logger.info("Exception: "+ e);
return null;
}
//----------------------------- GET SERVICE INSTANCE INFORMATION FROM AAI : END ---------------------------------------
@@ -804,7 +776,8 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
.equalsIgnoreCase("generic-vnf")).collect(Collectors.toList());
if (relationship.size() > 0 && relationship != null) {
relationship = serviceInstance.getRelationshipList().getRelationship();
- Vnfs vnf = getVnfs(relationship.get(0).getRelatedTo());
+ String relatedLinkID = relationship.get(0).getRelatedLink();
+ Vnfs vnf = getVnfs(relatedLinkID.substring(relatedLinkID.lastIndexOf("/") + 1));
relationship = vnf.getRelationshipList().getRelationship();
ObjectMapper serviceMapper = new ObjectMapper();
@@ -834,7 +807,7 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
nodes.add(connode);
edges.add(getEdge(vnf.getVnfInstanceId(), connectivityparams.get("connectivityId").toString()));
} catch (IOException e) {
- // logger.info("IO Exception occured " + e.getMessage());
+ logger.info("IO Exception occured " + e.getMessage());
}
//Query Connectivity : End
@@ -843,8 +816,8 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
if (relationship1.size() > 0 && relationship1 != null) {
for (Relationship rel : relationship1) {
try {
- String s = rel.getRelatedLink();
- String uniId = s.substring(s.lastIndexOf("/")+1);
+ String uniLink = rel.getRelatedLink();
+ String uniId = uniLink.substring(uniLink.lastIndexOf("/")+1);
Uni uniInfo = getUNIInfo(uniId);
Node uuinode = getNode(uniInfo.getId(), uniInfo.getId(), "edge.png");
ObjectMapper uuiMapper = new ObjectMapper();
@@ -888,7 +861,7 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
}
} catch (IOException e) {
- // logger.info("IO Exception occured " + e.getMessage());
+ logger.info("IO Exception occured " + e.getMessage());
}
}
//Query UNI : End
@@ -906,6 +879,7 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
vpnBinding = getSOTNPinterfaceByVpnId(vpnid);
vpnInformation = vpnBinding.getVpnBinding().get(0);
} catch (Exception e) {
+ logger.info("Exception:"+e.getMessage());
}
ObjectMapper mapper = new ObjectMapper();
@@ -938,12 +912,14 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
Pinterface pinterface = getTerminationPoint(parentaccessnode, pinterfaceid);
edges.add(getEdge(vpn.getId(), pinterface.getInterfaceName()));
} catch (Exception e) {
+ logger.info("Exception:"+e.getMessage());
}
}
}
ResourceResponse resourceResponse = new ResourceResponse();
resourceResponse.setNodes(nodes);
resourceResponse.setEdges(edges);
+ logger.info("Service Topology:"+resourceResponse.toString());
return resourceResponse.toString();
}
@@ -981,8 +957,8 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
if (serviceInstance == null)
return null;
} catch (Exception e) {
-// logger.info("Query Service Instance information failed. No service information found for customer "
-// + customerId + " and Service Type " + subscriptionType);
+ logger.info("Query Service Instance information failed. No service information found for customer "
+ + customerId + " and Service Type " + subscriptionType);
return null;
}
@@ -1020,7 +996,7 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
nodes.add(connode);
} catch (IOException e) {
- // logger.info("IO Exception occured " + e.getMessage());
+ logger.info("IO Exception occured " + e.getMessage());
}
//Query Connectivity : End
@@ -1037,6 +1013,7 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
vpnBinding = getSOTNPinterfaceByVpnId(vpnid);
vpnInformation = vpnBinding.getVpnBinding().get(0);
} catch (Exception e) {
+ logger.info("Exception occured " + e.getMessage());
}
Node vpn = new Node();
vpn.setId(vpnInformation.getVpnId());
@@ -1164,6 +1141,7 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
}
} catch (Exception e) {
+ logger.info("Exception occured " + e.getMessage());
}
}
//Query logical Link : Begin
@@ -1190,6 +1168,7 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
tptologicallinkedge.setTo(logiclink.getId());
edges.add(tptologicallinkedge);
} catch (Exception e) {
+ logger.info("Exception occured " + e.getMessage());
}
List<Relationship> llrelationlist = logicallink.getRelationshipList().getRelationship().stream().filter(llrelation -> llrelation.getRelatedTo()
@@ -1284,7 +1263,7 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
}
resourceResponse.setNodes(nodes);
resourceResponse.setEdges(edges);
- System.out.println(jsonresponse);
+ logger.info("jsonresponse: "+jsonresponse);
return resourceResponse.toString();
}
@@ -1306,11 +1285,16 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
//----------------------------- GET SERVICE INSTANCE INFORMATION FROM AAI : BEGIN ---------------------------------------
try {
serviceInstance = getServiceInstancesInfo(customerId, subscriptionType, instanceid);
- if (serviceInstance == null)
+ if (serviceInstance == null) {
+ logger.info("Query site Service Instance information failed. No service information found for customer "
+ + customerId + " and Service Type " + subscriptionType);
return null;
+ } else {
+ logger.info("Instance Name is:"+serviceInstance.getServiceInstanceName()+", Instance ID is: "+ serviceInstance.getServiceInstanceId());
+ }
} catch (Exception e) {
-// logger.info("Query Service Instance information failed. No service information found for customer "
-// + customerId + " and Service Type " + subscriptionType);
+ logger.info("Query Service Instance information failed. No service information found for customer "
+ + customerId + " and Service Type " + subscriptionType);
return null;
}
@@ -1329,7 +1313,7 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
connectivityparams = new ObjectMapper().readValue(connectivity.toString(), HashMap.class);
} catch (IOException e) {
- //logger.info("IO Exception occured " + e.getMessage());
+ logger.info("IO Exception occured " + e.getMessage());
}
break;
@@ -1341,13 +1325,13 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
try {
siteservice = getServiceInstancesInfo(customerId, subscriptionType, siteserviceinstanceid);
if (siteservice == null) {
-// logger.info("Query site Service Instance information failed. No service information found for customer "
-// + customerId + " and Service Type " + subscriptionType);
+ logger.info("Query site Service Instance information failed. No service information found for customer "
+ + customerId + " and Service Type " + subscriptionType);
return null;
}
} catch (Exception e) {
-// logger.info("Query site Instance information failed. No service information found for customer "
-// + customerId + " and Service Type " + subscriptionType);
+ logger.info("Query site Instance information failed. No service information found for customer "
+ + customerId + " and Service Type " + subscriptionType);
return null;
}
List<Relationship> ssrelationship = siteservice.getRelationshipList().getRelationship().stream()
@@ -1396,8 +1380,8 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
// site.put("attribute", attr);
sites.add(site);
} catch (Exception e) {
- // logger.info("Query Service Instance information failed. No service information found for customer "
- // + customerId + " and Service Type " + subscriptionType);
+ logger.info("Query Service Instance information failed. No service information found for customer "
+ + customerId + " and Service Type " + subscriptionType);
return null;
}
} else {
@@ -1408,7 +1392,7 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
e2eserviceRequest = mapper.readValue(requestinput.toString(), new TypeReference<E2EServiceInstanceRequest>() {
});
} catch (IOException e) {
- // logger.info("Query remove Service Instance information failed" + e.getMessage());
+ logger.info("Query remove Service Instance information failed" + e.getMessage());
}
HashMap<String, ?> requestInputs = e2eserviceRequest.getService().getParameters().getRequestInputs();
@@ -1535,17 +1519,67 @@ public class SotnServiceTemplateServiceImpl implements SotnServiceTemplateServic
try {
jsonresponse = new ObjectMapper().writeValueAsString(response);
- System.out.println(jsonresponse);
+ logger.info("jsonresponse:"+ jsonresponse);
} catch (IOException e) {
-
+ logger.info("IO Exception occured " + e.getMessage());
}
} else {
//This is DWAN service
+ logger.info("There is no logic for get Service");
}
//----------------------------- GET SERVICE INSTANCE INFORMATION FROM AAI : END -----------------------------------------
return jsonresponse;
}
+ @Override
+ public String getSOTNInstantiationstatus(String instanceid) {
+ ServiceInstantiationResponse serviceInstantiationResponse = new ServiceInstantiationResponse();
+ ServiceInstance infraInstance = null;
+ ServiceInstance siteInstance = null;
+ ModelConfig modelConfig = readFile();
+ String subscriptionType = modelConfig.getSubscriptionType();
+ String customerId = modelConfig.getSubscriberId();
+ int activatedsitecount = 0;
+ try {
+ infraInstance = getServiceInstancesInfo(customerId, subscriptionType, instanceid);
+ if (infraInstance == null)
+ return null;
+ } catch (Exception e) {
+ logger.info("Query Service Instance information failed. No service information found for customer "
+ + customerId + " and Service Type " + subscriptionType);
+ return null;
+ }
+ if (infraInstance.getOrchestrationstatus().equalsIgnoreCase("Assigned") || infraInstance.getOrchestrationstatus().equalsIgnoreCase("Active")) {
+ activatedsitecount = activatedsitecount + 1;
+ List<Relationship> infrarelationlist = infraInstance.getRelationshipList().getRelationship().stream().filter(relation -> relation.getRelatedTo().equalsIgnoreCase("service-instance"))
+ .collect(Collectors.toList());
+ for (Relationship relation : infrarelationlist) {
+ String siteservice = relation.getRelatedLink().substring(relation.getRelatedLink().lastIndexOf("/") + 1);
+ try {
+ siteInstance = getServiceInstancesInfo(customerId, subscriptionType, siteservice);
+ if (infraInstance == null) {
+ serviceInstantiationResponse.setStatus("0");
+ return serviceInstantiationResponse.toString();
+ }
+ } catch (Exception e) {
+ logger.info("Query Service Instance information failed. No service information found for customer "
+ + customerId + " and Service Type " + subscriptionType);
+ serviceInstantiationResponse.setStatus("0");
+ return serviceInstantiationResponse.toString();
+ }
+ if (siteInstance.getOrchestrationstatus().equalsIgnoreCase("Assigned") || siteInstance.getOrchestrationstatus().equalsIgnoreCase("Active")) {
+ activatedsitecount = activatedsitecount + 1;
+ } else {
+ break;
+ }
+ }
+ } else {
+ serviceInstantiationResponse.setStatus("0");
+ }
+ if (activatedsitecount == 3)
+ serviceInstantiationResponse.setStatus("1");
+ return serviceInstantiationResponse.toString();
+ }
}
diff --git a/server/src/test/java/org/onap/usecaseui/server/bean/activeEdge/ServiceInstantiationResponseTest.java b/server/src/test/java/org/onap/usecaseui/server/bean/activeEdge/ServiceInstantiationResponseTest.java
new file mode 100644
index 00000000..0ee96b0c
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/bean/activeEdge/ServiceInstantiationResponseTest.java
@@ -0,0 +1,44 @@
+/**
+ * Copyright (C) 2020 Huawei, Inc. and others. All rights reserved.
+ *
+ * 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.activeEdge;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.server.bean.activateEdge.ServiceInstantiationResponse;
+
+public class ServiceInstantiationResponseTest {
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void getServiceInstantiationResponseTest() throws Exception {
+ ServiceInstantiationResponse sr = new ServiceInstantiationResponse();
+ sr.getStatus();
+ sr.toString();
+ }
+
+ @Test
+ public void setServiceInstantiationResponseTest() throws Exception {
+ ServiceInstantiationResponse sr = new ServiceInstantiationResponse();
+ sr.setStatus("");
+ }
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/bean/lcm/sotne2eservice/PinterfaceTest.java b/server/src/test/java/org/onap/usecaseui/server/bean/lcm/sotne2eservice/PinterfaceTest.java
index c197e6cd..54c4c4fc 100644
--- a/server/src/test/java/org/onap/usecaseui/server/bean/lcm/sotne2eservice/PinterfaceTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/bean/lcm/sotne2eservice/PinterfaceTest.java
@@ -1,4 +1,4 @@
-/**
+ /**
* Copyright (C) 2020 Huawei, Inc. and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,20 +14,16 @@
* limitations under the License.
*/
package org.onap.usecaseui.server.bean.lcm.sotne2eservice;
-
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-
public class PinterfaceTest {
@Before
public void before() throws Exception {
}
-
@After
public void after() throws Exception {
}
-
@Test
public void testGetPinterface() throws Exception {
Pinterface pi = new Pinterface();
@@ -40,8 +36,9 @@ public class PinterfaceTest {
pi.getResourceVersion();
pi.getSpeedValue();
pi.getTransparent();
+ pi.getSpeedUnits();
+ pi.getPortDescription();
}
-
@Test
public void testSetPinterface() throws Exception {
Pinterface pi = new Pinterface();
@@ -54,5 +51,7 @@ public class PinterfaceTest {
pi.setResourceVersion("");
pi.setSpeedValue("");
pi.setTransparent("");
+ pi.setSpeedUnits("");
+ pi.setPortDescription("");
}
}
diff --git a/server/src/test/java/org/onap/usecaseui/server/bean/lcm/sotne2eservice/UniTest.java b/server/src/test/java/org/onap/usecaseui/server/bean/lcm/sotne2eservice/UniTest.java
new file mode 100644
index 00000000..eb67ac8c
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/bean/lcm/sotne2eservice/UniTest.java
@@ -0,0 +1,50 @@
+/**
+ * Copyright (C) 2020 Huawei, Inc. and others. All rights reserved.
+ *
+ * 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.sotne2eservice;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class UniTest {
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testgetUniInfo() throws Exception {
+ Uni uni = new Uni();
+ uni.getId();
+ uni.getOperationalStatus();
+ uni.getRelationshipList();
+ uni.getResourceVersion();
+ uni.getTpId();
+ }
+
+ @Test
+ public void testsetUniInfo() throws Exception {
+ Uni uni = new Uni();
+ uni.setId("");
+ uni.setOperationalStatus("");
+ uni.setRelationshipList(null);
+ uni.setResourceVersion("");
+ uni.setTpId("");
+ }
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/bean/lcm/sotne2eservice/VnfsTest.java b/server/src/test/java/org/onap/usecaseui/server/bean/lcm/sotne2eservice/VnfsTest.java
new file mode 100644
index 00000000..693fe4d4
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/bean/lcm/sotne2eservice/VnfsTest.java
@@ -0,0 +1,56 @@
+/**
+ * Copyright (C) 2020 Huawei, Inc. and others. All rights reserved.
+ *
+ * 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.sotne2eservice;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class VnfsTest {
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void getVnfsInfoTest() throws Exception {
+ Vnfs vnfs = new Vnfs();
+ vnfs.getVnfInstanceId();
+ vnfs.getInMaint();
+ vnfs.getPnfName();
+ vnfs.getRelationshipList();
+ vnfs.getResourceVersion();
+ vnfs.getVnfName();
+ vnfs.getVnfType();
+ vnfs.isClosedLoopDisabled();
+ }
+
+ @Test
+ public void setVnfsInfoTest() throws Exception {
+ Vnfs vnfs = new Vnfs();
+ vnfs.setVnfInstanceId("");
+ vnfs.setInMaint(true);
+ vnfs.setPnfName("");
+ vnfs.setRelationshipList(null);
+ vnfs.setResourceVersion("");
+ vnfs.setVnfName("");
+ vnfs.setVnfType("");
+ vnfs.setClosedLoopDisabled(true);
+ }
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceTemplateServiceImplTest.java b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceTemplateServiceImplTest.java
index defec3e7..ffc63d70 100644
--- a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceTemplateServiceImplTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/SotnServiceTemplateServiceImplTest.java
@@ -15,6 +15,8 @@
*/
package org.onap.usecaseui.server.service.lcm.impl;
+import okhttp3.RequestBody;
+import okhttp3.Response;
import okhttp3.ResponseBody;
import org.junit.Before;
import org.junit.Test;
@@ -136,4 +138,127 @@ public class SotnServiceTemplateServiceImplTest {
when(aaiService.getSpecificLogicalLink("link")).thenReturn(failedCall("Failed to get link info."));
sotnServiceTemplateService.getSOTNLinkbyName("link");
}
+
+
+ @Test
+ public void getUNIInfoTest() throws Exception {
+ ResponseBody result = null;
+ when(aaiService.getUNIInfo("uni-id")).thenReturn(successfulCall(result));
+ sotnServiceTemplateService.getUNIInfo("uni-id");
+ }
+ @Test
+ public void getUNIInfoWithThrowException() throws Exception {
+ when(aaiService.getUNIInfo("uni-id")).thenReturn(failedCall("Failed to get link info."));
+ sotnServiceTemplateService.getUNIInfo("uni-id");
+ }
+ @Test
+ public void getVnfsTest() throws Exception {
+ ResponseBody result = null;
+ when(aaiService.getVNFsDetail("vnf-id")).thenReturn(successfulCall(result));
+ sotnServiceTemplateService.getVnfs("vnf-id");
+ }
+ @Test
+ public void getVnfsWithThrowException() throws Exception {
+ when(aaiService.getVNFsDetail("vnf-id")).thenReturn(failedCall("Failed to get link info."));
+ sotnServiceTemplateService.getVnfs("vnf-id");
+ }
+ @Test
+ public void getReadFile_unniTest() throws Exception {
+ ModelConfig mdl = new ModelConfig();
+ sotnServiceTemplateService.readFile_unni();
+ }
+ @Test
+ public void getReadFileTest() throws Exception {
+ ModelConfig mdl = new ModelConfig();
+ sotnServiceTemplateService.readFile();
+ }
+ @Test
+ public void getSOTNSiteInformationTopologyTest() throws Exception {
+ ResponseBody result = null;
+ when(aaiService.getServiceInstancesForEdge("1","SOTN","ISAAC")).thenReturn(successfulCall(result));
+ sotnServiceTemplateService.getSOTNSiteInformationTopology("SOTN", "ISAAC");
+ }
+ @Test
+ public void getSOTNSiteInformationTopologyWithThrowException() throws Exception {
+ when(aaiService.getServiceInstancesForEdge("1","SOTN","ISAAC")).thenReturn(failedCall("Failed to get connectivity."));
+ sotnServiceTemplateService.getSOTNSiteInformationTopology("SOTN", "ISAAC");
+ }
+ @Test
+ public void getServiceTest() throws Exception {
+ ResponseBody result = null;
+ when(aaiService.getServiceInstancesForEdge("1","SOTN","ISAAC")).thenReturn(successfulCall(result));
+ ResponseBody result1 = null;
+ when(aaiService.getConnectivityInformation("1")).thenReturn(successfulCall(result1));
+ ResponseBody result2 = null;
+ when(aaiService.getAllotedResourceFor5G("1", "SONT", "ISAAC", "2")).thenReturn(successfulCall(result2));
+ sotnServiceTemplateService.getService("SOTN", "ISAAC");
+ }
+ @Test
+ public void getServiceWithThrowException() throws Exception {
+ ResponseBody result = null;
+ when(aaiService.getServiceInstancesForEdge("1","SOTN","ISAAC")).thenReturn(failedCall("failed to get instances"));
+ ResponseBody result1 = null;
+ when(aaiService.getConnectivityInformation("1")).thenReturn(failedCall("Failed to get connectivity"));
+ ResponseBody result2 = null;
+ when(aaiService.getAllotedResourceFor5G("1", "SONT", "ISAAC", "2")).thenReturn(failedCall("failed to get allocated resource"));
+ sotnServiceTemplateService.getService("SOTN", "ISAAC");
+ }
+ @Test
+ public void getSOTNServiceInformationTopologyTest() throws Exception {
+ ResponseBody result = null;
+ when(aaiService.getServiceInstancesForEdge("ISAAC", "example-service-type-val-52265", "NNI-001")).thenReturn(successfulCall(result));
+ sotnServiceTemplateService.getServiceInformationTopology("example-service-type-val-52265", "NNI-001");
+ }
+ @Test
+ public void getSOTNServiceInformationTopologyWithThrowException() throws Exception {
+ when(aaiService.getServiceInstancesForEdge("1","SOTN","ISAAC")).thenReturn(failedCall("Failed to get connectivity."));
+ sotnServiceTemplateService.getServiceInformationTopology("SOTN", "ISAAC");
+ }
+ @Test
+ public void getVPNBindingInformationTopologyTest() throws Exception {
+ ResponseBody result = null;
+ when(aaiService.getServiceInstancesForEdge("ISAAC", "example-service-type-val-52265", "NNI-001")).thenReturn(successfulCall(result));
+ sotnServiceTemplateService.getVPNBindingInformationTopology("example-service-type-val-52265", "NNI-001", "vpn-bind-1");
+ }
+ @Test
+ public void getVPNBindingInformationTopologyWithThrowException() throws Exception {
+ ResponseBody result = null;
+ when(aaiService.getServiceInstancesForEdge("ISAAC", "example-service-type-val-52265", "NNI-001")).thenReturn(failedCall("failed to get vpn binding topology."));
+ sotnServiceTemplateService.getVPNBindingInformationTopology("example-service-type-val-52265", "NNI-001", "vpn-bind-1");
+ }
+ @Test
+ public void deleteServiceTest() throws Exception {
+ Response result = null;
+ RequestBody requestBody = null;
+ when(soService.terminateService("serviceId",requestBody)).thenReturn(successfulCall(null));
+ sotnServiceTemplateService.deleteService("NNI-001", "vpn-bind-1");
+ }
+ @Test
+ public void deleteServiceWithThrowException() throws Exception {
+ Response result = null;
+ RequestBody requestBody = null;
+ when(soService.terminateService("serviceId",requestBody)).thenReturn(failedCall("failed to delete the server."));
+ sotnServiceTemplateService.deleteService("NNI-001", "vpn-bind-1");
+ }
+ @Test
+ public void getNodeTest() throws Exception {
+ sotnServiceTemplateService.getNode("001", "vpn-bind-1","image.png");
+ }
+ @Test
+ public void getEdgeTest() throws Exception {
+ sotnServiceTemplateService.getEdge("fromid", "toId");
+ }
+ @Test
+ public void getSOTNResourceInformationTopologyTest() throws Exception {
+ ResponseBody result = null;
+ when(aaiService.getServiceInstancesForEdge("ISAAC", "example-service-type-val-52265", "NNI-001")).thenReturn(successfulCall(result));
+ sotnServiceTemplateService.getSOTNResourceInformationTopology("example-service-type-val-52265", "NNI-001");
+ }
+ @Test
+ public void getSOTNResourceInformationTopologyWithThrowException() throws Exception {
+ ResponseBody result = null;
+ when(aaiService.getServiceInstancesForEdge("ISAAC", "example-service-type-val-52265", "NNI-001")).thenReturn(failedCall("failed to get sotn resource topology."));
+ sotnServiceTemplateService.getSOTNResourceInformationTopology("example-service-type-val-52265", "NNI-001");
+ }
}
+