aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-openstack-adapters/src/main')
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java15
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java1
3 files changed, 24 insertions, 12 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
index ac33a5269e..4b6bd09144 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
@@ -42,6 +42,8 @@ import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.HeatTemplate;
import org.onap.so.db.catalog.beans.NetworkResource;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
+import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
+import org.onap.so.db.catalog.data.repository.CollectionNetworkResourceCustomizationRepository;
import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository;
import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
import org.onap.so.db.catalog.utils.MavenLikeVersioning;
@@ -108,6 +110,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
private NetworkResourceCustomizationRepository networkCustomRepo;
@Autowired
+ private CollectionNetworkResourceCustomizationRepository collectionNetworkCustomRepo;
+
+ @Autowired
private NetworkResourceRepository networkResourceRepo;
/**
* Health Check web method. Does nothing but return to show the adapter is deployed.
@@ -1124,18 +1129,26 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Retrieve the Network Resource definition
NetworkResource networkResource = null;
NetworkResourceCustomization networkCust = null;
+ CollectionNetworkResourceCustomization collectionNetworkCust = null;
if (commonUtils.isNullOrEmpty(modelCustomizationUuid)) {
if (!commonUtils.isNullOrEmpty(networkType)) {
- networkResource = networkResourceRepo.findOneByModelName(networkType);
+ networkResource = networkResourceRepo.findFirstByModelNameOrderByModelVersionDesc(networkType);
}
} else {
networkCust = networkCustomRepo.findOneByModelCustomizationUUID(modelCustomizationUuid);
+ if (networkCust == null) {
+ collectionNetworkCust = collectionNetworkCustomRepo.findOneByModelCustomizationUUID(modelCustomizationUuid);
+ }
}
if(networkCust != null){
LOGGER.debug("Got Network Customization definition from Catalog: "
+ networkCust.toString());
networkResource = networkCust.getNetworkResource();
+ } else if (collectionNetworkCust != null) {
+ LOGGER.debug("Retrieved Collection Network Resource Customization from Catalog: "
+ + collectionNetworkCust.toString());
+ networkResource = collectionNetworkCust.getNetworkResource();
}
if (networkResource == null) {
String error = "Create/UpdateNetwork: Unable to get network resource with NetworkType:"
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
index 465fb6d866..effe7a8c61 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
@@ -84,8 +84,8 @@ import io.swagger.annotations.ApiResponses;
public class NetworkAdapterRest {
private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,NetworkAdapterRest.class);
private static final String TESTING_KEYWORD = "___TESTING___";
-
-
+ private String APPEND_RESPONSE = ", resp=";
+ private String EXCEPTION = "Exception:";
@Autowired
private MsoNetworkAdapterImpl adapter;
@@ -239,7 +239,7 @@ public class NetworkAdapterRest {
rollback.value,
req.getMessageId());
} catch (NetworkException e) {
- LOGGER.debug ("Exception:", e);
+ LOGGER.debug (EXCEPTION, e);
eresp = new CreateNetworkError(
e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
}
@@ -248,7 +248,7 @@ public class NetworkAdapterRest {
BpelRestClient bpelClient = bpelRestClientProvider.get();
bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
}
- LOGGER.debug ("CreateNetworkTask exit: code=" + getStatusCode() + ", resp="+ getResponse());
+ LOGGER.debug ("CreateNetworkTask exit: code=" + getStatusCode() + APPEND_RESPONSE+ getResponse());
}
}
@@ -345,7 +345,7 @@ public class NetworkAdapterRest {
}
response = new DeleteNetworkResponse(req.getNetworkId(), networkDeleted.value, req.getMessageId());
} catch (NetworkException e) {
- LOGGER.debug ("Exception:", e);
+ LOGGER.debug (EXCEPTION, e);
eresp = new DeleteNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
}
if (!req.isSynchronous()) {
@@ -353,7 +353,7 @@ public class NetworkAdapterRest {
BpelRestClient bpelClient = bpelRestClientProvider.get();
bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
}
- LOGGER.debug("DeleteNetworkTask exit: code=" + getStatusCode() + ", resp="+ getResponse());
+ LOGGER.debug("DeleteNetworkTask exit: code=" + getStatusCode() + APPEND_RESPONSE+ getResponse());
}
}
@@ -501,7 +501,7 @@ public class NetworkAdapterRest {
adapter.rollbackNetwork(nwr);
response = new RollbackNetworkResponse(true, req.getMessageId());
} catch (NetworkException e) {
- LOGGER.debug ("Exception:", e);
+ LOGGER.debug (EXCEPTION, e);
eresp = new RollbackNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
}
if (!req.isSynchronous()) {
@@ -509,7 +509,7 @@ public class NetworkAdapterRest {
BpelRestClient bpelClient = bpelRestClientProvider.get();
bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
}
- LOGGER.debug("RollbackNetworkTask exit: code=" + getStatusCode() + ", resp="+ getResponse());
+ LOGGER.debug("RollbackNetworkTask exit: code=" + getStatusCode() + APPEND_RESPONSE+ getResponse());
}
}
@@ -649,7 +649,7 @@ public class NetworkAdapterRest {
subnetIdMap.value,
req.getMessageId());
} catch (NetworkException e) {
- LOGGER.debug ("Exception:", e);
+ LOGGER.debug (EXCEPTION, e);
eresp = new UpdateNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
}
if (!req.isSynchronous()) {
@@ -657,7 +657,7 @@ public class NetworkAdapterRest {
BpelRestClient bpelClient = bpelRestClientProvider.get();
bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
}
- LOGGER.debug("UpdateNetworkTask exit: code=" + getStatusCode() + ", resp="+ getResponse());
+ LOGGER.debug("UpdateNetworkTask exit: code=" + getStatusCode() + APPEND_RESPONSE+ getResponse());
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java
index d65cdc4638..f2238fce78 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java
@@ -4,7 +4,6 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
- * Modifications Copyright 2018 IBM.
* 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