+
+ private void getConnectionLinks(DelegateExecution execution, String domainType, ServiceInstance instance) {
+ AllottedResources allottedResources = instance.getAllottedResources()
+ if(allottedResources == null) {
+ String msg = "AllottedResourceFromAAI doesn't exist. " + instance
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ List<AllottedResource> AllottedResourceList = allottedResources.getAllottedResource()
+ for(AllottedResource allottedResource : AllottedResourceList) {
+ List<Relationship> relationshipList = allottedResource.getRelationshipList().getRelationship()
+ for (Relationship relationship : relationshipList) {
+ String relatedTo = relationship.getRelatedTo()
+ if (relatedTo.toLowerCase() == "logical-link") {
+ String relatioshipurl = relationship.getRelatedLink()
+ String logicalLinkId=
+ relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length())
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().logicalLink(logicalLinkId))
+ if (!client.exists(uri)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500,
+ "Resource was not found in aai: ${logicalLinkId}")
+ }
+ AAIResultWrapper wrapper01 = client.get(uri, NotFoundException.class)
+ Optional<org.onap.aai.domain.yang.LogicalLink> resource = wrapper01.asBean(org.onap.aai.domain.yang.LogicalLink.class)
+ if (resource.isPresent()) {
+ org.onap.aai.domain.yang.LogicalLink logicalLinkInstance = resource.get()
+ if(domainType.equalsIgnoreCase("TN-FH"))
+ {
+ execution.setVariable("tranportEp_ID_RU",logicalLinkInstance.getLinkName())
+ execution.setVariable("tranportEp_ID_DUIN",logicalLinkInstance.getLinkName2())
+ }
+ else if(domainType.equalsIgnoreCase("TN-MH"))
+ {
+ execution.setVariable("tranportEp_ID_DUEG",logicalLinkInstance.getLinkName())
+ execution.setVariable("tranportEp_ID_CUIN",logicalLinkInstance.getLinkName2())
+ }
+ }
+ }
+ }
+ }
+ }
+