diff options
author | Tao Shen <shentao@chinamobile.com> | 2020-02-19 10:06:53 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-02-19 10:06:53 +0000 |
commit | 4aef0071882951d7c59de91f575783a9b4fc86c9 (patch) | |
tree | 23f3a0d94a3b37939a95e28e1316ba0027cdef95 | |
parent | afa1b045ee250bfc5dc918ad7a69c8e5a62b67af (diff) | |
parent | 25b043fce2ca93b55c49178981887ed72b25ff8b (diff) |
Merge "þChanges for MDONS usecase Added changes for MDONS USECASE and to fetch UNNI List"
13 files changed, 531 insertions, 4 deletions
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 2cba0a06..7591c396 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 @@ -16,7 +16,9 @@ package org.onap.usecaseui.server.controller.lcm; 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.CustomerService; 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,6 +30,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; +import java.util.ArrayList; @Controller @org.springframework.context.annotation.Configuration @@ -39,6 +42,9 @@ public class ServiceTemplateController { @Resource(name="ServiceTemplateService") private ServiceTemplateService serviceTemplateService; + @Resource(name="CustomerService") + private CustomerService customerService; + public void setServiceTemplateService(ServiceTemplateService serviceTemplateService) { this.serviceTemplateService = serviceTemplateService; } @@ -52,8 +58,7 @@ public class ServiceTemplateController { @ResponseBody @RequestMapping(value = {"/uui-lcm/service-templates/{uuid}"}, method = RequestMethod.GET , produces = "application/json") public ServiceTemplateInput getServiceTemplateInput(@PathVariable("uuid") String uuid, @RequestParam("toscaModelPath") String toscaModelPath){ - ServiceTemplateInput serviceTemplateInput = serviceTemplateService.fetchServiceTemplateInput(uuid, "/api"+toscaModelPath); - logger.info("returned template content :"+serviceTemplateInput); + ServiceTemplateInput serviceTemplateInput = serviceTemplateService.fetchServiceTemplateInput(uuid, "/api"+toscaModelPath); return serviceTemplateInput; } @@ -63,6 +68,14 @@ public class ServiceTemplateController { return serviceTemplateService.listVim(); } + @ResponseBody + @RequestMapping(value = {"/uui-lcm/getAllNI/{networkId}"}, method = RequestMethod.GET , produces = "application/json") + public List<String> getAllNetworkInterface(@PathVariable("networkId") String networkId){ + List<String> nIList = customerService.fetchNIList(networkId); + + return nIList; + } + @ResponseBody @RequestMapping(value = {"/uui-lcm/sdnc-controllers/"}, method = RequestMethod.GET , produces = "application/json") public List<SDNCController> getSDNCControllers(){ diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/CustomerService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/CustomerService.java index 62f8d4a6..3f54718e 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/CustomerService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/CustomerService.java @@ -41,4 +41,6 @@ public interface CustomerService { JSONObject deleteServiceType(String customerId,String serviceType,String resourceVersion); JSONObject getServiceTypeById(String customerId,String serviceType); + + List<String> fetchNIList(String networkInterfaceType); } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java index e4a0b014..c0811471 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java @@ -51,4 +51,6 @@ public interface ServiceLcmService { void updateServiceInstanceOperation(String serviceInstanceId,String operationType,String progress,String operationResult); ServiceInstanceOperations getServiceInstanceOperationById(String serviceId); + + List<ServiceBean>getAllServiceBean(); } 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 01640360..460f7f0a 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 @@ -18,6 +18,7 @@ package org.onap.usecaseui.server.service.lcm.domain.aai; import org.onap.usecaseui.server.bean.sotn.PinterfaceRsp; 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.bean.AAINetworkInterfaceResponse; import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAIOrchestratorRsp; import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAIServiceSubscription; import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAISingleOrchestratorRsp; @@ -26,6 +27,7 @@ import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceInstanceRsp; import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceSubscriptionRsp; import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfoRsp; + import okhttp3.RequestBody; import okhttp3.ResponseBody; import retrofit2.Call; @@ -101,7 +103,7 @@ public interface AAIService { "Accept: application/json" }) // @GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances") - @GET("/api/aai-business/v13/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances") + @GET("/api/aai-business/v16/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances") Call<ResponseBody> listServiceInstances(@Path("global-customer-id") String customerId, @Path("service-type") String serviceType); @Headers({ @@ -342,4 +344,16 @@ public interface AAIService { }) @DELETE("/api/aai-network/v14/ext-aai-networks/ext-aai-network/{aai-id}") Call<ResponseBody> deleteExtNetwork(@Path("aai-id") String aaiId,@Query("resource-version") String resourceVersion); + + + @Headers({ + "X-TransactionId: 7777", + "X-FromAppId: uui", + "Authorization: Basic QUFJOkFBSQ==", + "Accept: application/json" + }) + @PUT("/api/aai-query/v16?format=resource") + Call<ResponseBody> querynNetworkResourceList(@Body RequestBody body); + + } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAINetworkInterfaceResponse.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAINetworkInterfaceResponse.java new file mode 100644 index 00000000..4c4fea7d --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAINetworkInterfaceResponse.java @@ -0,0 +1,31 @@ +/** + * * Copyright 2019-2020 Fujitsu 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; + +public class AAINetworkInterfaceResponse { + + private Results[] results; + + public Results[] getResults() { + return results; + } + + public void setResults(Results[] results) { + this.results = results; + } + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/PInterface.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/PInterface.java new file mode 100644 index 00000000..7e5fd773 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/PInterface.java @@ -0,0 +1,146 @@ +/** + * * Copyright 2019-2020 Fujitsu. + * * + * * 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 com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class PInterface { + + private String speedValue; + + private RelationshipList relationshipList; + + private String inMaint; + + private String interfaceType; + + private String portDescription; + + private String resourceVersion; + + private String networkRef; + + private String interfaceName; + + private String speedUnits; + + private String operationalStatus; + + private String networkInterfaceType; + + @JsonProperty("speed-value") + public String getSpeedValue() { + return speedValue; + } + + public void setSpeedValue(String speedValue) { + this.speedValue = speedValue; + } + + @JsonProperty("relationship-list") + public RelationshipList getRelationshipList() { + return relationshipList; + } + + public void setRelationshipList(RelationshipList relationshipList) { + this.relationshipList = relationshipList; + } + + @JsonProperty("in-maint") + public String getInMaint() { + return inMaint; + } + + public void setInMaint(String inMaint) { + this.inMaint = inMaint; + } + + @JsonProperty("interface-type") + public String getInterfaceType() { + return interfaceType; + } + + public void setInterfaceType(String interfaceType) { + this.interfaceType = interfaceType; + } + + @JsonProperty("port-description") + public String getPortDescription() { + return portDescription; + } + + public void setPortDescription(String portDescription) { + this.portDescription = portDescription; + } + + @JsonProperty("resource-version") + public String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } + + @JsonProperty("network-ref") + public String getNetworkRef() { + return networkRef; + } + + public void setNetworkRef(String networkRef) { + this.networkRef = networkRef; + } + + @JsonProperty("interface-name") + public String getInterfaceName() { + return interfaceName; + } + + public void setInterfaceName(String interfaceName) { + this.interfaceName = interfaceName; + } + + @JsonProperty("speed-units") + public String getSpeedUnits() { + return speedUnits; + } + + public void setSpeedUnits(String speedUnits) { + this.speedUnits = speedUnits; + } + + @JsonProperty("operational-status") + public String getOperationalStatus() { + return operationalStatus; + } + + public void setOperationalStatus(String operationalStatus) { + this.operationalStatus = operationalStatus; + } + + @JsonProperty("network-interface-type") + public String getNetworkInterfaceType() { + return networkInterfaceType; + } + + public void setNetworkInterfaceType(String networkInterfaceType) { + this.networkInterfaceType = networkInterfaceType; + } + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/Relationship.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/Relationship.java new file mode 100644 index 00000000..74ee8307 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/Relationship.java @@ -0,0 +1,69 @@ +/** + * * Copyright 2019-2020 Fujitsu. + * * + * * 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 Relationship { + + private String relatedTo; + + private RelationshipData[] relationshipData; + + private String relatedLink; + + private String relationshipLabel; + + @JsonProperty("related-to") + public String getRelatedTo() { + return relatedTo; + } + + public void setRelatedTo(String relatedTo) { + this.relatedTo = relatedTo; + } + + @JsonProperty("relationship-data") + public RelationshipData[] getRelationshipData() { + return relationshipData; + } + + public void setRelationshipData(RelationshipData[] relationshipData) { + this.relationshipData = relationshipData; + } + + @JsonProperty("related-link") + public String getRelatedLink() { + return relatedLink; + } + + public void setRelatedLink(String relatedLink) { + this.relatedLink = relatedLink; + } + + @JsonProperty("relationship-label") + public String getRelationshipLabel() { + return relationshipLabel; + } + + public void setRelationshipLabel(String relationshipLabel) { + this.relationshipLabel = relationshipLabel; + } + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/RelationshipData.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/RelationshipData.java new file mode 100644 index 00000000..d302f2cc --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/RelationshipData.java @@ -0,0 +1,47 @@ +/** + * * Copyright 2019-2020 Fujitsu. + * * + * * 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 com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class RelationshipData { + + private String relationshipValue; + + private String relationshipKey; + + @JsonProperty("relationship-key") + public String getRelationshipValue() { + return relationshipValue; + } + + public void setRelationshipValue(String relationshipValue) { + this.relationshipValue = relationshipValue; + } + + @JsonProperty("relationship-value") + public String getRelationshipKey() { + return relationshipKey; + } + + public void setRelationshipKey(String relationshipKey) { + this.relationshipKey = relationshipKey; + } + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/RelationshipList.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/RelationshipList.java new file mode 100644 index 00000000..f15cd7f1 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/RelationshipList.java @@ -0,0 +1,36 @@ +/** + * * Copyright 2019-2020 Fujitsu. + * * + * * 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 RelationshipList { + + private Relationship[] relationship; + + @JsonProperty("relationship-list") + public Relationship[] getRelationship() { + return relationship; + } + + public void setRelationship(Relationship[] relationship) { + this.relationship = relationship; + } + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/Results.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/Results.java new file mode 100644 index 00000000..246b7bb2 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/Results.java @@ -0,0 +1,33 @@ +/** + * * Copyright 2019-2020 Fujitsu. + * * + * * 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; + +public class Results { + + private PInterface pinterface; + + @JsonProperty("p-interface") + public PInterface getPinterface() { + return pinterface; + } + + public void setPinterface(PInterface pinterface) { + this.pinterface = pinterface; + } + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java index 641aa8c5..07d3e64a 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java @@ -21,6 +21,10 @@ 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.bean.AAIServiceSubscription; import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceSubscriptionRsp; +import org.onap.usecaseui.server.service.lcm.domain.aai.bean.PInterface; +import org.onap.usecaseui.server.service.lcm.domain.aai.bean.Results; +import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAINetworkInterfaceResponse; + import org.onap.usecaseui.server.service.lcm.domain.aai.exceptions.AAIException; import org.onap.usecaseui.server.util.RestfulServices; import org.slf4j.Logger; @@ -29,7 +33,9 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; import com.alibaba.fastjson.JSONObject; +import com.fasterxml.jackson.databind.ObjectMapper; +import okhttp3.MediaType; import okhttp3.RequestBody; import okhttp3.ResponseBody; import retrofit2.Response; @@ -39,6 +45,7 @@ import static org.onap.usecaseui.server.util.RestfulServices.extractBody; import java.io.IOException; import java.util.Collections; import java.util.List; +import java.util.ArrayList; import javax.servlet.http.HttpServletRequest; @@ -220,4 +227,105 @@ public class DefaultCustomerService implements CustomerService { } return result; } + + @Override + public List<String> fetchNIList(String networkInterfaceType) { + List<String> niList = new ArrayList<String>(); + AAINetworkInterfaceResponse niResponse = null; + ObjectMapper mapper = new ObjectMapper(); + Results[] interfaceList = null; + try { + logger.info("aai fetchNIList is starting!"); + String body = "{\r\n" + "\"start\" : [\"network\"],\r\n" + "\"query\" : \"query/getInterfaceTypes?porttype=" + + networkInterfaceType + "\"\r\n" + "}"; + logger.info("request body" + body + " for Interface type " + networkInterfaceType); + RequestBody request = RequestBody.create(MediaType.parse("application/json"), body); + Response<ResponseBody> response = this.aaiService.querynNetworkResourceList(request).execute(); + if (response.isSuccessful()) { + String jsonResponse = response.body().string(); + logger.info("response json returned" + jsonResponse); + try { + niResponse = mapper.readValue(jsonResponse, AAINetworkInterfaceResponse.class); + } catch (IOException ex) { + ex.printStackTrace(); + } + if (niResponse != null) { + interfaceList = niResponse.getResults(); + } + for (Results result : interfaceList) { + PInterface pInterface = result.getPinterface(); + niList.add(pInterface.getInterfaceName()+" ("+pInterface.getPortDescription()+")"); + } + } else { + logger.error("Request to AAI Fails dues to " + response.errorBody()); + throw new IOException(response.errorBody().toString()); + } + } catch (Exception e) { + niResponse = null; + logger.info("Request to AAI Fails dues to " + e); + logger.info("Mocking Response Data"); + + String jsonMock = "{\r\n" + " \"results\": [\r\n" + " {\r\n" + + " \"p-interface\": {\r\n" + + " \"interface-name\": \"nodeId-11.11.11.12-ltpId-2\",\r\n" + + " \"speed-value\": \"100\",\r\n" + " \"speed-units\": \"Gbps\",\r\n" + + " \"port-description\": \"\",\r\n" + + " \"interface-type\": \"XPONDER-NETWORK\",\r\n" + + " \"network-interface-type\": \"ENNI\",\r\n" + + " \"resource-version\": \"1572522050145\",\r\n" + + " \"in-maint\": true,\r\n" + + " \"network-ref\": \"otn-topology\",\r\n" + + " \"operational-status\": \"up\",\r\n" + + " \"relationship-list\": {\r\n" + " \"relationship\": [\r\n" + + " {\r\n" + + " \"related-to\": \"logical-link\",\r\n" + + " \"relationship-label\": \"tosca.relationships.network.LinksTo\",\r\n" + + " \"related-link\": \"/aai/v16/network/logical-links/logical-link/nodeId-11.11.11.12-ltpId-2_nodeId-12.12.12.12-ltpId-1\",\r\n" + + " \"relationship-data\": [\r\n" + + " {\r\n" + + " \"relationship-key\": \"logical-link.link-name\",\r\n" + + " \"relationship-value\": \"nodeId-11.11.11.12-ltpId-2_nodeId-12.12.12.12-ltpId-1\"\r\n" + + " }\r\n" + " ]\r\n" + + " }\r\n" + " ]\r\n" + " }\r\n" + + " }\r\n" + " },\r\n" + " {\r\n" + " \"p-interface\": {\r\n" + + " \"interface-name\": \"nodeId-12.12.12.12-ltpId-1\",\r\n" + + " \"speed-value\": \"100\",\r\n" + " \"speed-units\": \"Gbps\",\r\n" + + " \"port-description\": \"\",\r\n" + + " \"interface-type\": \"XPONDER-NETWORK\",\r\n" + + " \"network-interface-type\": \"ENNI\",\r\n" + + " \"resource-version\": \"1572522469912\",\r\n" + + " \"in-maint\": true,\r\n" + + " \"network-ref\": \"tapi-topology\",\r\n" + + " \"operational-status\": \"up\",\r\n" + + " \"relationship-list\": {\r\n" + " \"relationship\": [\r\n" + + " {\r\n" + + " \"related-to\": \"logical-link\",\r\n" + + " \"relationship-label\": \"tosca.relationships.network.LinksTo\",\r\n" + + " \"related-link\": \"/aai/v16/network/logical-links/logical-link/nodeId-11.11.11.12-ltpId-2_nodeId-12.12.12.12-ltpId-1\",\r\n" + + " \"relationship-data\": [\r\n" + + " {\r\n" + + " \"relationship-key\": \"logical-link.link-name\",\r\n" + + " \"relationship-value\": \"nodeId-11.11.11.12-ltpId-2_nodeId-12.12.12.12-ltpId-1\"\r\n" + + " }\r\n" + " ]\r\n" + + " }\r\n" + " ]\r\n" + " }\r\n" + + " }\r\n" + " }\r\n" + " ]\r\n" + "}\r\n" + ""; + + try { + niResponse = mapper.readValue(jsonMock, AAINetworkInterfaceResponse.class); + } catch (IOException ex) { + ex.printStackTrace(); + } + + if (niResponse != null) { + interfaceList = niResponse.getResults(); + } + for (Results result : interfaceList) { + PInterface pInterface = result.getPinterface(); + niList.add(pInterface.getInterfaceName()); + } + } + + return niList; + } + } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java index 30f7d2fc..e302ccb3 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java @@ -21,7 +21,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; - +import java.util.Iterator; import javax.annotation.Resource; import org.onap.usecaseui.server.bean.ServiceBean; @@ -102,6 +102,7 @@ public class DefaultServiceInstanceService implements ServiceInstanceService { } } + private List<String> parseServiceInstance(JSONObject objects,String customerId,String serviceType) throws JsonProcessingException{ List<String> result = new ArrayList<>(); JSONArray serviceInstances=objects.getJSONArray("service-instance"); diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java index d1b41c27..ef5875cc 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java @@ -312,5 +312,30 @@ public class DefaultServiceLcmService implements ServiceLcmService { + e.getMessage()); } return serviceOperation; + + } + + + @Override + public List<ServiceBean> getAllServiceBean() { + List<ServiceBean> list = new ArrayList<ServiceBean>(); + try (Session session = getSession()) { + + String string = "from ServiceBean"; + Query q = session.createQuery(string); + list = q.list(); + session.flush(); + } catch (Exception e) { + list = new ArrayList<>(); + logger.error( + "exception occurred while performing DefaultServiceLcmService updateServiceInstanceStatusByIdDetail." + + e.getMessage()); + } + return list; + + } + + + } |