diff options
author | sindhu3672 <arcot.sindhuri@huawei.com> | 2019-08-07 15:39:35 +0530 |
---|---|---|
committer | Sindhu A <arcot.sindhuri@huawei.com> | 2019-08-08 05:49:02 +0000 |
commit | c803817f0dedc301adbae9e3a477fe65a44ca1c2 (patch) | |
tree | fe726a6b4f8d6827410c09db543e167f30797b13 /adapters/mso-openstack-adapters | |
parent | 8cfa1b81d64c69c4a78dc5ac2b205418dabcbe91 (diff) |
Replace duplicated String literals
Replace duplicated String literals mso-openstack-adapters files
Issue-ID: SO-2187
Signed-off-by: sindhu3672 <arcot.sindhuri@huawei.com>
Change-Id: I3089f407ffd01afbccaada81c2aef290299dfe32
Diffstat (limited to 'adapters/mso-openstack-adapters')
3 files changed, 22 insertions, 20 deletions
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(), |