aboutsummaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
authorBOSLET, CORY <cory.boslet@att.com>2021-03-05 12:51:45 -0500
committerAT&T Open Source <g22940@att.com>2021-03-05 12:51:46 -0500
commit8887129f9e0e8dd81058e46fca14d4ae5e15b921 (patch)
treea1085f8455513e2e6ce22c80b4b375f3bfeb9600 /adapters
parent1ae03802fb8d3e29f64dc84e8d5899d60860321b (diff)
Changed to use the host id of server instead of id
Changed to use the host id of server instead of id Update the pserver when it already exist. Only update the host id when updating pserver Issue-ID: SO-3573 Signed-off-by: AT&T Open Source <g22940@att.com> Change-Id: Ide5ab15aa84da950c22dec9079d90ba0133a7789
Diffstat (limited to 'adapters')
-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.java4
2 files changed, 9 insertions, 3 deletions
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 0512912b9f..04c6ea4ff7 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
@@ -488,7 +488,13 @@ public class HeatBridgeImpl implements HeatBridgeApi {
for (Pserver pserver : serverHostnames.values()) {
AAIResourceUri uri = AAIUriFactory
.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().pserver(pserver.getHostname()));
- resourcesClient.createIfNotExists(uri, Optional.of(pserver));
+ if (resourcesClient.exists(uri)) {
+ Pserver updatePserver = new Pserver();
+ updatePserver.setPserverId(pserver.getPserverId());
+ resourcesClient.update(uri, updatePserver);
+ } else {
+ resourcesClient.create(uri, pserver);
+ }
}
}
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 1f6c0df90f..bbdd05bddc 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
@@ -247,8 +247,8 @@ public class AaiHelper {
Pserver pserver = new Pserver();
pserver.setInMaint(false);
pserver.setHostname(server.getHypervisorHostname());
- if (server.getId() != null) {
- pserver.setPserverId(server.getId());
+ if (server.getHostId() != null) {
+ pserver.setPserverId(server.getHostId());
}
if (server.getHost() != null) {
pserver.setPserverName2(server.getHost());