summaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java30
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java8
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java17
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java17
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java2
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java9
7 files changed, 44 insertions, 41 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java b/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java
index 469a7ad7e4..354c3d07f7 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java
@@ -9,9 +9,9 @@
* 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.
@@ -67,35 +67,35 @@ public class R__CloudConfigMigration implements JdbcMigration, MigrationInfoProv
public void migrate(Connection connection) throws Exception {
logger.debug("Starting migration for CloudConfig");
- CloudConfig cloudConfig = null;
+ CloudConfig cloudConfiguration = null;
// Try the override file
String configLocation = System.getProperty("spring.config.additional-location");
if (configLocation != null) {
try (InputStream stream = new FileInputStream(Paths.get(configLocation).normalize().toString())) {
- cloudConfig = loadCloudConfig(stream);
+ cloudConfiguration = loadCloudConfig(stream);
} catch (Exception e) {
logger.warn("Error Loading override.yaml", e);
}
}
- if (cloudConfig == null) {
+ if (cloudConfiguration == null) {
logger.debug("No CloudConfig defined in {}", configLocation);
// Try the application.yaml file
try (InputStream stream = R__CloudConfigMigration.class.getResourceAsStream(getApplicationYamlName())) {
- cloudConfig = loadCloudConfig(stream);
+ cloudConfiguration = loadCloudConfig(stream);
}
- if (cloudConfig == null) {
+ if (cloudConfiguration == null) {
logger.debug("No CloudConfig defined in {}", getApplicationYamlName());
}
}
- if (cloudConfig != null) {
- migrateCloudIdentity(cloudConfig.getIdentityServices().values(), connection);
- migrateCloudSite(cloudConfig.getCloudSites().values(), connection);
- migrateCloudifyManagers(cloudConfig.getCloudifyManagers().values(), connection);
+ if (cloudConfiguration != null) {
+ migrateCloudIdentity(cloudConfiguration.getIdentityServices().values(), connection);
+ migrateCloudSite(cloudConfiguration.getCloudSites().values(), connection);
+ migrateCloudifyManagers(cloudConfiguration.getCloudifyManagers().values(), connection);
}
}
@@ -110,13 +110,13 @@ public class R__CloudConfigMigration implements JdbcMigration, MigrationInfoProv
private CloudConfig loadCloudConfig(InputStream stream) throws IOException {
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
R__CloudConfigMigration cloudConfigMigration = mapper.readValue(stream, R__CloudConfigMigration.class);
- CloudConfig cloudConfig = cloudConfigMigration.getCloudConfig();
+ CloudConfig cloudConfiguration = cloudConfigMigration.getCloudConfig();
- if (cloudConfig != null) {
- cloudConfig.populateId();
+ if (cloudConfiguration != null) {
+ cloudConfiguration.populateId();
}
- return cloudConfig;
+ return cloudConfiguration;
}
private String getApplicationYamlName() {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
index a9af3683f5..e95e9a3a83 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
@@ -11,9 +11,9 @@
* 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.
@@ -370,8 +370,8 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl);
notifyPort.deleteNetworkNotification(messageId, false, exCat, eMsg, null);
} catch (Exception e1) {
- logger.error("{} {} Error sending createNetwork notification {} ",
- MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, ErrorCode.DataError.getValue(), e1.getMessage(), e1);
+ logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
+ ErrorCode.DataError.getValue(), e1.getMessage(), e1);
}
return;
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 c934291246..4c115271f0 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
@@ -90,6 +90,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
private static final String NETWORK_FQDN = "network_fqdn";
private static final String CREATE_NETWORK_CONTEXT = "CreateNetwork";
private static final String NEUTRON_MODE = "NEUTRON";
+ private static final String CLOUD_OWNER = "CloudOwner";
private static final Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterImpl.class);
@@ -310,7 +311,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
StackInfo heatStack = null;
long queryNetworkStarttime = System.currentTimeMillis();
try {
- heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkName);
+ heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName);
} catch (MsoException me) {
me.addContext(CREATE_NETWORK_CONTEXT);
logger.error("{} {} Create Network (heat): query network {} in {}/{}: ",
@@ -424,7 +425,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
try {
if (backout == null)
backout = true;
- heatStack = heat.createStack(cloudSiteId, "CloudOwner", tenantId, networkName, null, template,
+ heatStack = heat.createStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName, null, template,
stackParams, true, heatTemplate.getTimeoutMinutes(), null, null, null, backout.booleanValue());
} catch (MsoException me) {
me.addContext(CREATE_NETWORK_CONTEXT);
@@ -607,7 +608,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
StackInfo heatStack = null;
long queryStackStarttime = System.currentTimeMillis();
try {
- heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkName);
+ heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName);
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
logger.error("{} {} Exception - QueryStack query {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC,
@@ -727,7 +728,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Ignore MsoStackNotFound exception because we already checked.
long updateStackStarttime = System.currentTimeMillis();
try {
- heatStack = heatWithUpdate.updateStack(cloudSiteId, "CloudOwner", tenantId, networkId, template,
+ heatStack = heatWithUpdate.updateStack(cloudSiteId, CLOUD_OWNER, tenantId, networkId, template,
stackParams, true, heatTemplate.getTimeoutMinutes());
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
@@ -919,7 +920,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
StackInfo heatStack = null;
long queryStackStarttime = System.currentTimeMillis();
try {
- heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkNameOrId);
+ heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkNameOrId);
} catch (MsoException me) {
me.addContext("QueryNetwork");
logger.error("{} {} Exception - Query Network (heat): {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC,
@@ -1072,9 +1073,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// was deleted.
// So query first to report back if stack WAS deleted or just NOTOFUND
StackInfo heatStack = null;
- heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkId);
+ heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkId);
if (heatStack != null && heatStack.getStatus() != HeatStatus.NOTFOUND) {
- heat.deleteStack(tenantId, "CloudOwner", cloudSiteId, networkId, true);
+ heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true);
networkDeleted.value = true;
} else {
networkDeleted.value = false;
@@ -1157,7 +1158,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
try {
// The deleteStack function in MsoHeatUtils returns success if the stack
// was not found. So don't bother to query first.
- heat.deleteStack(tenantId, "CloudOwner", cloudSiteId, networkId, true);
+ heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true);
} catch (MsoException me) {
me.addContext("RollbackNetwork");
logger.error("{} {} Exception - Rollback Network (heat): {} in {}/{} ",
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 df2c3a2973..4eb5d5637f 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
@@ -90,6 +90,7 @@ public class NetworkAdapterRest {
private static final String TESTING_KEYWORD = "___TESTING___";
private String exceptionMsg = "Exception:";
private static final String SHARED = "shared";
+ private static final String EXTERNAL = "external";
@Autowired
private MsoNetworkAdapterImpl adapter;
@@ -207,8 +208,8 @@ public class NetworkAdapterRest {
shared = ctn.getShared();
}
}
- if (params.containsKey("external")) {
- external = params.get("external");
+ if (params.containsKey(EXTERNAL)) {
+ external = params.get(EXTERNAL);
} else {
if (ctn.getExternal() != null) {
external = ctn.getExternal();
@@ -228,8 +229,8 @@ public class NetworkAdapterRest {
}
if (params.containsKey(SHARED))
shared = params.get(SHARED);
- if (params.containsKey("external"))
- external = params.get("external");
+ if (params.containsKey(EXTERNAL))
+ external = params.get(EXTERNAL);
adapter.createNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(),
req.getModelCustomizationUuid(), req.getNetworkName(),
req.getProviderVlanNetwork().getPhysicalNetworkName(),
@@ -603,8 +604,8 @@ public class NetworkAdapterRest {
shared = ctn.getShared();
}
}
- if (params.containsKey("external")) {
- external = params.get("external");
+ if (params.containsKey(EXTERNAL)) {
+ external = params.get(EXTERNAL);
} else {
if (ctn.getExternal() != null) {
external = ctn.getExternal();
@@ -624,8 +625,8 @@ public class NetworkAdapterRest {
if (params.containsKey(SHARED)) {
shared = params.get(SHARED);
}
- if (params.containsKey("external")) {
- external = params.get("external");
+ if (params.containsKey(EXTERNAL)) {
+ external = params.get(EXTERNAL);
}
adapter.updateNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(),
req.getModelCustomizationUuid(), req.getNetworkStackId(), req.getNetworkName(),
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
index 96e5db7ce7..f09fa34cb9 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
@@ -854,7 +854,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// Include aliases.
String alias = htp.getParamAlias();
- if (alias != null && !alias.equals("") && !params.containsKey(alias)) {
+ if (alias != null && !"".equals(alias) && !params.containsKey(alias)) {
params.put(alias, htp);
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
index d5fe285274..41bcc8c481 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
@@ -323,7 +323,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
String type = templateParam.getParamType();
logger.debug("Parameter: {} is of type ", templateParam.getParamName(), type);
- if (type.equalsIgnoreCase("number")) {
+ if ("number".equalsIgnoreCase(type)) {
try {
return Integer.valueOf(inputValue.toString());
} catch (Exception e) {
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java
index d01e5b186c..68fdb79444 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java
@@ -126,15 +126,16 @@ public class JobManager {
private OperationStateEnum getOperationState(final VnfmOperation vnfmOperation,
final InlineResponse200 operationResponse) {
switch (vnfmOperation.getNotificationStatus()) {
- case NOTIFICATION_PROCESSING_NOT_REQUIRED:
- default:
- return OperationStateEnum.fromValue(operationResponse.getOperationState().getValue());
case NOTIFICATION_PROCESSING_PENDING:
return org.onap.vnfmadapter.v1.model.OperationStateEnum.PROCESSING;
case NOTIFICATION_PROCEESING_SUCCESSFUL:
return org.onap.vnfmadapter.v1.model.OperationStateEnum.COMPLETED;
case NOTIFICATION_PROCESSING_FAILED:
return org.onap.vnfmadapter.v1.model.OperationStateEnum.FAILED;
+ default:
+ if (operationResponse == null || operationResponse.getOperationState() == null)
+ return null;
+ return OperationStateEnum.fromValue(operationResponse.getOperationState().getValue());
}
}
@@ -157,7 +158,7 @@ public class JobManager {
final java.util.Optional<VnfmOperation> relatedOperation = mapOfJobIdToVnfmOperation.values().stream()
.filter(operation -> operation.getOperationId().equals(operationId)).findFirst();
if (relatedOperation.isPresent()) {
- relatedOperation.get().setVnfDeleted();;
+ relatedOperation.get().setVnfDeleted();
} else {
logger.debug("No operation found for operation ID {} ", operationId);
}