summaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapter-utils/src
diff options
context:
space:
mode:
authorSmokowski, Steven <steve.smokowski@att.com>2020-04-21 15:48:16 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-04-21 15:48:16 -0400
commit87c4b1b30ef478cdcdc7a0b2a5c73223d7fd045a (patch)
tree551400db4e760f8d34b4b1d086100377427c6c7e /adapters/mso-adapter-utils/src
parenteceef88af7a5e13a7840059004116e8b6cbf35ac (diff)
Encode Name parameter passed into client
Encode Name parameter passed into client Remove un-needed test using file that does not exist Issue-ID: SO-2823 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I47cab1b9d429552b0a4cdfccf296d0c31952c320
Diffstat (limited to 'adapters/mso-adapter-utils/src')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java8
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java7
2 files changed, 12 insertions, 3 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java
index 698b605be3..b98811c490 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java
@@ -26,11 +26,11 @@ import org.onap.so.openstack.exceptions.MsoException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
+import org.springframework.web.util.UriUtils;
import com.woorea.openstack.base.client.OpenStackRequest;
import com.woorea.openstack.glance.Glance;
import com.woorea.openstack.glance.model.Images;
-
@Component
public class GlanceClientImpl extends MsoCommonUtils {
@@ -70,10 +70,14 @@ public class GlanceClientImpl extends MsoCommonUtils {
public Images queryImages(String cloudSiteId, String tenantId, int limit, String visibility, String marker,
String name) throws MsoCloudSiteNotFound, GlanceClientException {
try {
+ String encodedName = null;
+ if (name != null) {
+ encodedName = UriUtils.encodeQueryParam(name, "UTF-8");
+ }
Glance glanceClient = getGlanceClient(cloudSiteId, tenantId);
// list is set to false, otherwise an invalid URL is appended
OpenStackRequest<Images> request = glanceClient.images().list(false).queryParam("visibility", visibility)
- .queryParam("limit", limit).queryParam("marker", marker).queryParam("name", name);
+ .queryParam("limit", limit).queryParam("marker", marker).queryParam("name", encodedName);
return executeAndRecordOpenstackRequest(request, false);
} catch (MsoException e) {
logger.error("Error building Glance Client", e);
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java
index 8f9dbd1f5a..27ff86d7f7 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java
@@ -26,6 +26,7 @@ import org.onap.so.openstack.exceptions.MsoException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
+import org.springframework.web.util.UriUtils;
import com.woorea.openstack.base.client.OpenStackRequest;
import com.woorea.openstack.quantum.Quantum;
import com.woorea.openstack.quantum.model.Networks;
@@ -73,9 +74,13 @@ public class NeutronClientImpl extends MsoCommonUtils {
public Networks queryNetworks(String cloudSiteId, String tenantId, int limit, String marker, String name, String id)
throws MsoCloudSiteNotFound, NeutronClientException {
try {
+ String encodedName = null;
+ if (name != null) {
+ encodedName = UriUtils.encodeQueryParam(name, "UTF-8");
+ }
Quantum neutronClient = getNeutronClient(cloudSiteId, tenantId);
OpenStackRequest<Networks> request = neutronClient.networks().list().queryParam("id", id)
- .queryParam("limit", limit).queryParam("marker", marker).queryParam("name", name);
+ .queryParam("limit", limit).queryParam("marker", marker).queryParam("name", encodedName);
return executeAndRecordOpenstackRequest(request, false);
} catch (MsoException e) {
logger.error("Error building Neutron Client", e);