summaryrefslogtreecommitdiffstats
path: root/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src
diff options
context:
space:
mode:
authorburdziak <olaf.burdziakowski@nokia.com>2018-01-29 13:30:19 +0100
committerPatrick Brady <pb071s@att.com>2018-01-30 18:27:39 +0000
commit8305cfca6e719a0e8486d5718a74b5be81ef9a47 (patch)
tree19b146be40a185d6918ed8516baec9326e465a1b /appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src
parent7af45b899aaa83357e49f0870cdab6574a16256f (diff)
Fixes in ServiceCatalogV2
Change-Id: I8cd58acc8db233f08a10bcb88123c802fa952e87 Issue-ID: APPC-548 Signed-off-by: burdziak <olaf.burdziakowski@nokia.com>
Diffstat (limited to 'appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src')
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/impl/ServiceCatalogV2.java39
1 files changed, 19 insertions, 20 deletions
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/impl/ServiceCatalogV2.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/impl/ServiceCatalogV2.java
index 846eca2f5..72b033276 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/impl/ServiceCatalogV2.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/impl/ServiceCatalogV2.java
@@ -30,6 +30,8 @@ import com.att.cdp.openstack.util.ExceptionMapper;
import com.att.cdp.pal.util.Time;
import com.att.cdp.zones.ContextFactory;
import com.att.cdp.zones.spi.RequestState;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import com.woorea.openstack.base.client.OpenStackBaseException;
import com.woorea.openstack.base.client.OpenStackClientConnector;
import com.woorea.openstack.base.client.OpenStackSimpleTokenProvider;
@@ -41,8 +43,6 @@ import com.woorea.openstack.keystone.model.Access.Service.Endpoint;
import com.woorea.openstack.keystone.model.Authentication;
import com.woorea.openstack.keystone.model.Tenant;
import com.woorea.openstack.keystone.model.authentication.UsernamePassword;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Calendar;
@@ -84,7 +84,7 @@ import java.util.regex.Pattern;
*/
public class ServiceCatalogV2 extends ServiceCatalog {
- private final static Logger logger = LoggerFactory.getLogger(ServiceCatalogV2.class);
+ protected static final EELFLogger loggerV2 = EELFManager.getInstance().getLogger(ServiceCatalogV2.class);
/**
* The Openstack Access object that manages the authenticated token and access control
@@ -126,7 +126,7 @@ public class ServiceCatalogV2 extends ServiceCatalog {
connectorClass = Class.forName(CLIENT_CONNECTOR_CLASS);
connector = (OpenStackClientConnector) connectorClass.newInstance();
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
- logger.error(e.getMessage());
+ loggerV2.error(e.getMessage());
return;
}
Keystone keystone = new Keystone(identityURL, connector);
@@ -252,26 +252,25 @@ public class ServiceCatalogV2 extends ServiceCatalog {
@Override
public String getVMRegion(VMURL url) {
String region = null;
+ if (url == null) {
+ return region;
+ }
+
Pattern urlPattern = Pattern.compile("[^:]+://([^:/]+)(?::([0-9]+)).*");
- if (url != null) {
- for (Endpoint endpoint : getEndpoints(ServiceCatalog.COMPUTE_SERVICE)) {
- String endpointUrl = endpoint.getPublicURL();
- Matcher matcher = urlPattern.matcher(endpointUrl);
- if (matcher.matches()) {
- if (url.getHost().equals(matcher.group(1))) {
- if (url.getPort() != null) {
- if (!url.getPort().equals(matcher.group(2))) {
- continue;
- }
- }
-
- region = endpoint.getRegion();
- break;
- }
- }
+ for (Endpoint endpoint : getEndpoints(ServiceCatalog.COMPUTE_SERVICE)) {
+ String endpointUrl = endpoint.getPublicURL();
+ Matcher matcher = urlPattern.matcher(endpointUrl);
+ if (!matcher.matches() ||
+ !url.getHost().equals(matcher.group(1)) ||
+ (url.getPort() != null && url.getPort().equals(matcher.group(2))) ) {
+ continue;
}
+
+ region = endpoint.getRegion();
+ break;
}
+
return region;
}