aboutsummaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java25
-rw-r--r--adapters/mso-catalog-db-adapter/pom.xml2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java7
-rw-r--r--adapters/mso-openstack-adapters/pom.xml2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java8
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java30
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java87
-rw-r--r--adapters/mso-requests-db-adapter/pom.xml2
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapter.java7
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java21
-rw-r--r--adapters/mso-sdnc-adapter/pom.xml2
-rw-r--r--adapters/so-appc-orchestrator/pom.xml2
13 files changed, 163 insertions, 34 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java
index 687afeda40..b614a92177 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java
@@ -20,8 +20,6 @@
package org.onap.so.openstack.utils;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
import org.onap.so.cloud.authentication.KeystoneAuthHolder;
import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.onap.so.openstack.exceptions.MsoException;
@@ -30,6 +28,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import com.woorea.openstack.base.client.OpenStackRequest;
import com.woorea.openstack.glance.Glance;
+import com.woorea.openstack.glance.model.Image;
import com.woorea.openstack.glance.model.Images;
@Component
@@ -73,14 +72,7 @@ public class GlanceClientImpl extends MsoCommonUtils {
try {
String encodedName = null;
if (name != null) {
- try {
- encodedName =
- "in:\"" + URLEncoder.encode(name, "UTF-8").replace("+", "%20").replace("%3A", ":") + "\"";
- } catch (UnsupportedEncodingException e) {
- logger.error("Error Encoding Image Name", e);
- throw new GlanceClientException("Error Endcoding Name", e);
- }
-
+ encodedName = "in:\"" + name + "\"";
}
Glance glanceClient = getGlanceClient(cloudSiteId, tenantId);
// list is set to false, otherwise an invalid URL is appended
@@ -93,4 +85,17 @@ public class GlanceClientImpl extends MsoCommonUtils {
}
}
+ public Image queryImage(String cloudSiteId, String tenantId, String imageId)
+ throws MsoCloudSiteNotFound, GlanceClientException {
+ try {
+ Glance glanceClient = getGlanceClient(cloudSiteId, tenantId);
+ // list is set to false, otherwise an invalid URL is appended
+ OpenStackRequest<Image> request = glanceClient.images().show(imageId);
+ return executeAndRecordOpenstackRequest(request, false);
+ } catch (MsoException e) {
+ logger.error("Error building Glance Client", e);
+ throw new GlanceClientException("Error building Glance Client", e);
+ }
+ }
+
}
diff --git a/adapters/mso-catalog-db-adapter/pom.xml b/adapters/mso-catalog-db-adapter/pom.xml
index bcc523ab98..b1cf8b14be 100644
--- a/adapters/mso-catalog-db-adapter/pom.xml
+++ b/adapters/mso-catalog-db-adapter/pom.xml
@@ -44,7 +44,7 @@
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
- <artifactId>fabric8-maven-plugin</artifactId>
+ <artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>start</id>
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java
index e74663dbba..09c790cc6a 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java
@@ -68,7 +68,7 @@ public class ServiceMapper {
private List<Vnf> mapVnfs(org.onap.so.db.catalog.beans.Service service, int depth) {
List<Vnf> vnfs = new ArrayList<>();
logger.info("Vnf Count : {}", service.getVnfCustomizations().size());
- service.getVnfCustomizations().parallelStream().forEach(vnf -> vnfs.add(mapVnf(vnf, depth)));
+ service.getVnfCustomizations().stream().forEach(vnf -> vnfs.add(mapVnf(vnf, depth)));
return vnfs;
}
@@ -104,7 +104,7 @@ public class ServiceMapper {
private List<VfModule> mapVfModules(VnfResourceCustomization vnfResourceCustomization, int depth) {
List<VfModule> vfModules = new ArrayList<>();
- vnfResourceCustomization.getVfModuleCustomizations().parallelStream()
+ vnfResourceCustomization.getVfModuleCustomizations().stream()
.forEach(vfModule -> vfModules.add(mapVfModule(vfModule, depth)));
return vfModules;
}
@@ -133,8 +133,7 @@ public class ServiceMapper {
private List<Cvnfc> mapCvnfcs(VfModuleCustomization vfModuleCustomization) {
List<Cvnfc> cvnfcs = new ArrayList<>();
- vfModuleCustomization.getCvnfcCustomization().parallelStream()
- .forEach(cvnfcCust -> cvnfcs.add(mapCvnfcCus(cvnfcCust)));
+ vfModuleCustomization.getCvnfcCustomization().stream().forEach(cvnfcCust -> cvnfcs.add(mapCvnfcCus(cvnfcCust)));
return cvnfcs;
}
diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml
index a668b42106..4cf7d6f09b 100644
--- a/adapters/mso-openstack-adapters/pom.xml
+++ b/adapters/mso-openstack-adapters/pom.xml
@@ -140,7 +140,7 @@
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
- <artifactId>fabric8-maven-plugin</artifactId>
+ <artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>start</id>
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java
index ed45346131..3ff15ffe2f 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java
@@ -288,7 +288,7 @@ public class HeatStackAudit {
*/
protected List<Optional<Port>> retrieveNeutronPortDetails(Resources resources, String cloudSiteId,
String tenantId) {
- return resources.getList().parallelStream().filter(resource -> "OS::Neutron::Port".equals(resource.getType()))
+ return resources.getList().stream().filter(resource -> "OS::Neutron::Port".equals(resource.getType()))
.map(resource -> neutron.getNeutronPort(resource.getPhysicalResourceId(), tenantId, cloudSiteId))
.collect(Collectors.toList());
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
index dcf33da128..a00b9f9002 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
@@ -272,6 +272,14 @@ public class HeatBridgeImpl implements HeatBridgeApi {
} else {
lIf.setInterfaceRole(port.getvNicType());
}
+ boolean isL2Multicast = false;
+ if (port.getProfile().get("trusted") != null) {
+ String trusted = port.getProfile().get("trusted").toString();
+ if (Boolean.parseBoolean(trusted)) {
+ isL2Multicast = true;
+ }
+ }
+ lIf.setL2Multicasting(isL2Multicast);
updateLInterfaceIps(port, lIf);
updateLInterfaceVlan(port, lIf);
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
index e9e25db376..6817be8c49 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
@@ -39,6 +39,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
import org.onap.aai.domain.yang.Flavor;
import org.onap.aai.domain.yang.Image;
import org.onap.aai.domain.yang.PInterface;
@@ -77,9 +78,11 @@ public class AaiHelper {
List<Relationship> relationships = relationshipList.getRelationship();
// vserver to pserver relationship
- Relationship pserverRelationship = buildRelationship(
- AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, server.getHypervisorHostname()));
- relationships.add(pserverRelationship);
+ if (!StringUtils.isEmpty(server.getHypervisorHostname())) {
+ Relationship pserverRelationship = buildRelationship(
+ AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, server.getHypervisorHostname()));
+ relationships.add(pserverRelationship);
+ }
// vserver to generic-vnf relationship
Relationship genericVnfRelationship =
@@ -87,10 +90,11 @@ public class AaiHelper {
relationships.add(genericVnfRelationship);
// vserver to vnfc relationship
- Relationship vnfcRelationship =
- buildRelationship(AAIUriFactory.createResourceUri(AAIObjectType.VNFC, server.getName()));
- relationships.add(vnfcRelationship);
-
+ if (!StringUtils.isEmpty(server.getName())) {
+ Relationship vnfcRelationship =
+ buildRelationship(AAIUriFactory.createResourceUri(AAIObjectType.VNFC, server.getName()));
+ relationships.add(vnfcRelationship);
+ }
// vserver to vf-module relationship
Relationship vfModuleRelationship =
@@ -105,9 +109,12 @@ public class AaiHelper {
}
// vserver to flavor relationship
- Relationship flavorRel = buildRelationship(AAIUriFactory.createResourceUri(AAIObjectType.FLAVOR, cloudOwner,
- cloudRegionId, server.getFlavor().getId()));
- relationships.add(flavorRel);
+ if (server.getFlavor() != null) {
+ Relationship flavorRel = buildRelationship(AAIUriFactory.createResourceUri(AAIObjectType.FLAVOR, cloudOwner,
+ cloudRegionId, server.getFlavor().getId()));
+ relationships.add(flavorRel);
+ }
+
return relationshipList;
}
@@ -163,9 +170,6 @@ public class AaiHelper {
if (server.getHost() != null) {
pserver.setPserverName2(server.getHost());
}
- if (server.getStatus() != null && server.getStatus().value() != null) {
- pserver.setProvStatus(server.getStatus().value());
- }
return pserver;
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
index 8ce537bb97..464a17d2a5 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
@@ -72,6 +72,7 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.aaiclient.client.graphinventory.exceptions.BulkProcessFailed;
import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.heatbridge.constants.HeatBridgeConstants;
+import org.onap.so.heatbridge.helpers.AaiHelper;
import org.onap.so.heatbridge.openstack.api.OpenstackClient;
import org.onap.so.heatbridge.openstack.api.OpenstackClientException;
import org.openstack4j.model.compute.Flavor;
@@ -228,7 +229,7 @@ public class HeatBridgeImplTest {
Server server2 = mock(Server.class);
when(server2.getId()).thenReturn("test-server2-id");
- when(server2.getHypervisorHostname()).thenReturn("test-hypervisor");
+ when(server2.getHypervisorHostname()).thenReturn("");
when(server2.getName()).thenReturn("test-server2-name");
when(server2.getStatus()).thenReturn(Status.ACTIVE);
when(server2.getLinks()).thenReturn(new ArrayList<>());
@@ -262,6 +263,90 @@ public class HeatBridgeImplTest {
}
@Test
+ public void testUpdateVserversToAaiNoHypervisorName() throws HeatBridgeException {
+ // Arrange
+ Server server1 = mock(Server.class);
+
+ when(server1.getId()).thenReturn("test-server1-id");
+ when(server1.getHypervisorHostname()).thenReturn("");
+ when(server1.getName()).thenReturn("test-server1-name");
+ when(server1.getStatus()).thenReturn(Status.ACTIVE);
+ when(server1.getLinks()).thenReturn(new ArrayList<>());
+
+ Server server2 = mock(Server.class);
+ when(server2.getId()).thenReturn("test-server2-id");
+ when(server2.getName()).thenReturn("test-server2-name");
+ when(server2.getStatus()).thenReturn(Status.ACTIVE);
+ when(server2.getLinks()).thenReturn(new ArrayList<>());
+
+ List<Server> servers = Arrays.asList(server1, server2);
+
+ Image image = mock(Image.class);
+ when(server1.getImage()).thenReturn(image);
+ when(server2.getImage()).thenReturn(image);
+ when(image.getId()).thenReturn("test-image-id");
+
+ Flavor flavor = mock(Flavor.class);
+ when(server1.getFlavor()).thenReturn(flavor);
+ when(server2.getFlavor()).thenReturn(flavor);
+ when(flavor.getId()).thenReturn("test-flavor-id");
+
+ // Act
+ heatbridge.buildAddVserversToAaiAction("test-genericVnf-id", "test-vfModule-id", servers);
+
+ // Assert
+ ArgumentCaptor<AAIResourceUri> captor = ArgumentCaptor.forClass(AAIResourceUri.class);
+ verify(transaction, times(2)).create(captor.capture(), any(Vserver.class));
+
+ List<AAIResourceUri> uris = captor.getAllValues();
+ assertEquals(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, CLOUD_OWNER, REGION_ID, TENANT_ID,
+ server1.getId()), uris.get(0));
+ assertEquals(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, CLOUD_OWNER, REGION_ID, TENANT_ID,
+ server2.getId()), uris.get(1));
+ }
+
+ @Test
+ public void testCreateRelationships() throws HeatBridgeException {
+ AaiHelper aaiHelper = new AaiHelper();
+ // Arrange
+ Server server1 = mock(Server.class);
+
+ when(server1.getId()).thenReturn("test-server1-id");
+ when(server1.getHypervisorHostname()).thenReturn("test-hypervisor");
+ when(server1.getName()).thenReturn("test-server1-name");
+ when(server1.getStatus()).thenReturn(Status.ACTIVE);
+ when(server1.getLinks()).thenReturn(new ArrayList<>());
+
+ // HypervisorHostname is not set
+ Server server2 = mock(Server.class);
+ when(server2.getId()).thenReturn("test-server1-id");
+ when(server2.getName()).thenReturn("test-server1-name");
+ when(server2.getStatus()).thenReturn(Status.ACTIVE);
+ when(server2.getLinks()).thenReturn(new ArrayList<>());
+
+ // HypervisorHostname is empty string
+ Server server3 = mock(Server.class);
+ when(server3.getId()).thenReturn("test-server1-id");
+ when(server3.getHypervisorHostname()).thenReturn("");
+ when(server3.getName()).thenReturn("test-server1-name");
+ when(server3.getStatus()).thenReturn(Status.ACTIVE);
+ when(server3.getLinks()).thenReturn(new ArrayList<>());
+
+ org.onap.aai.domain.yang.RelationshipList relList = aaiHelper.getVserverRelationshipList(CLOUD_OWNER, REGION_ID,
+ "test-genericVnf-id", "test-vfModule-id", server1);
+ assertEquals(4, relList.getRelationship().size());
+
+ org.onap.aai.domain.yang.RelationshipList relList2 = aaiHelper.getVserverRelationshipList(CLOUD_OWNER,
+ REGION_ID, "test-genericVnf-id", "test-vfModule-id", server2);
+ assertEquals(3, relList2.getRelationship().size());
+
+ org.onap.aai.domain.yang.RelationshipList relList3 = aaiHelper.getVserverRelationshipList(CLOUD_OWNER,
+ REGION_ID, "test-genericVnf-id", "test-vfModule-id", server3);
+ assertEquals(3, relList3.getRelationship().size());
+ }
+
+
+ @Test
public void testUpdateImagesToAai() throws HeatBridgeException {
// Arrange
Image image1 = mock(Image.class);
diff --git a/adapters/mso-requests-db-adapter/pom.xml b/adapters/mso-requests-db-adapter/pom.xml
index 2354272756..3f62fe2420 100644
--- a/adapters/mso-requests-db-adapter/pom.xml
+++ b/adapters/mso-requests-db-adapter/pom.xml
@@ -186,7 +186,7 @@
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
- <artifactId>fabric8-maven-plugin</artifactId>
+ <artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>start</id>
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapter.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapter.java
index 84ff054a7c..7feaa9c4c3 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapter.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapter.java
@@ -27,6 +27,7 @@ import javax.xml.bind.annotation.XmlElement;
import org.onap.so.adapters.requestsdb.exceptions.MsoRequestsDbException;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.beans.InstanceNfvoMapping;
+import org.onap.so.db.request.beans.OperationStatus;
import org.onap.so.db.request.beans.ResourceOperationStatus;
/**
@@ -77,6 +78,12 @@ public interface MsoRequestsDbAdapter {
public boolean getSiteStatus(@WebParam(name = "siteName") @XmlElement(required = true) String siteName);
@WebMethod
+ public OperationStatus getServiceOperationStatus(
+ @WebParam(name = "serviceId") @XmlElement(required = true) String serviceId,
+ @WebParam(name = "operationId") @XmlElement(required = false) String operationId)
+ throws MsoRequestsDbException;
+
+ @WebMethod
public void updateServiceOperationStatus(
@WebParam(name = "serviceId") @XmlElement(required = true) String serviceId,
@WebParam(name = "operationId") @XmlElement(required = false) String operationId,
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
index b262cb21cb..8782cce34a 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
@@ -222,6 +222,27 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
}
/**
+ * get the operation status
+ *
+ * @param serviceId
+ * @param operationId
+ * @return operationStatus
+ * @throws MsoRequestsDbException
+ */
+ @Override
+ @Transactional
+ public OperationStatus getServiceOperationStatus(String serviceId, String operationId)
+ throws MsoRequestsDbException {
+ OperationStatus operationStatus;
+ if (operationId.isEmpty()) {
+ operationStatus = operationStatusRepository.findOneByServiceId(serviceId);
+ } else {
+ operationStatus = operationStatusRepository.findOneByServiceIdAndOperationId(serviceId, operationId);
+ }
+ return operationStatus;
+ }
+
+ /**
* update operation status <br>
*
* @param serviceId
diff --git a/adapters/mso-sdnc-adapter/pom.xml b/adapters/mso-sdnc-adapter/pom.xml
index 7fd1aa62d4..5001665779 100644
--- a/adapters/mso-sdnc-adapter/pom.xml
+++ b/adapters/mso-sdnc-adapter/pom.xml
@@ -63,7 +63,7 @@
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
- <artifactId>fabric8-maven-plugin</artifactId>
+ <artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>start</id>
diff --git a/adapters/so-appc-orchestrator/pom.xml b/adapters/so-appc-orchestrator/pom.xml
index 64eefaa151..0491dd9d56 100644
--- a/adapters/so-appc-orchestrator/pom.xml
+++ b/adapters/so-appc-orchestrator/pom.xml
@@ -45,7 +45,7 @@
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
- <artifactId>fabric8-maven-plugin</artifactId>
+ <artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>start</id>