aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);