diff options
Diffstat (limited to 'appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main')
3 files changed, 60 insertions, 7 deletions
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/impl/IdentityURL.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/impl/IdentityURL.java index 482e54a9d..327191af2 100644 --- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/impl/IdentityURL.java +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/impl/IdentityURL.java @@ -35,7 +35,7 @@ public class IdentityURL { * The regular expression pattern used to parse the URL. Capturing groups are used to identify and extract the * various component parts of the URL. */ - private static Pattern pattern = Pattern.compile("(\\p{Alnum}+)://([^/:]+)(?::([0-9]+))?/(v[0-9\\.]+)/?"); + private static Pattern pattern = Pattern.compile("(\\p{Alnum}+)://([^/:]+)(?::([0-9]+))?(/.*)?/(v[0-9\\.]+)/?"); /** * The URL scheme or protocol, such as HTTP or HTTPS @@ -48,6 +48,11 @@ public class IdentityURL { private String host; /** + * The path of the service, or null if no path is defined + */ + private String path; + + /** * The port number, or null if no port is defined */ private String port; @@ -83,7 +88,8 @@ public class IdentityURL { obj.scheme = matcher.group(1); obj.host = matcher.group(2); obj.port = matcher.group(3); - obj.version = matcher.group(4); + obj.path = matcher.group(4); + obj.version = matcher.group(5); } } @@ -105,6 +111,13 @@ public class IdentityURL { } /** + * @return The URL path, or null if no path was defined + */ + public String getPath() { + return path; + } + + /** * @return The URL port, or null if no port was defined */ public String getPort() { @@ -117,7 +130,18 @@ public class IdentityURL { @Override public String toString() { - return String.format("%s://%s:%s/%s", scheme, host, port, version); + StringBuilder str = new StringBuilder(); + + str.append(scheme + "://" + host); + if (port != null) { + str.append(":" + port); + } + if (path != null) { + str.append(path); + } + str.append("/" + version); + + return str.toString(); } } diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/impl/VMURL.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/impl/VMURL.java index e591a5616..20b15bb1e 100644 --- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/impl/VMURL.java +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/impl/VMURL.java @@ -37,7 +37,7 @@ public class VMURL { * various component parts of the URL. */ private static Pattern pattern = Pattern - .compile("(\\p{Alnum}+)://([^/:]+)(?::([0-9]+))?/v2/([^/]+)/servers/([^/]+)"); + .compile("(\\p{Alnum}+)://([^/:]+)(?::([0-9]+))?(/.*)?/v2/([^/]+)/servers/([^/]+)"); /** * The URL scheme or protocol, such as HTTP or HTTPS @@ -50,6 +50,11 @@ public class VMURL { private String host; /** + * The path, or null if no path is defined + */ + private String path; + + /** * The port number, or null if no port is defined */ private String port; @@ -90,8 +95,9 @@ public class VMURL { obj.scheme = matcher.group(1); obj.host = matcher.group(2); obj.port = matcher.group(3); - obj.tenantId = matcher.group(4); - obj.serverId = matcher.group(5); + obj.path = matcher.group(4); + obj.tenantId = matcher.group(5); + obj.serverId = matcher.group(6); } } @@ -113,6 +119,13 @@ public class VMURL { } /** + * @return THe URL path, or null if no path was defined + */ + public String getPath() { + return path; + } + + /** * @return The URL port, or null if no port was defined */ public String getPort() { @@ -135,7 +148,16 @@ public class VMURL { @Override public String toString() { - return String.format("%s://%s:%s/%s/servers/%s", scheme, host, port, tenantId, serverId); + StringBuilder str = new StringBuilder(); + str.append(scheme + "://" + host); + if (port != null) { + str.append(":" + port); + } + if (path != null) { + str.append(path); + } + str.append("/v2/" + tenantId + "/servers/" + serverId); + return str.toString(); } } diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/resources/org/openecomp/appc/default.properties b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/resources/org/openecomp/appc/default.properties index 75fc1edf8..21f96d9ee 100644 --- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/resources/org/openecomp/appc/default.properties +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/resources/org/openecomp/appc/default.properties @@ -103,3 +103,10 @@ provider1.identity=appc provider1.tenant1.name=appc provider1.tenant1.userid=appc provider1.tenant1.password=appc + +#Your OpenStack IP +test.ip=192.168.1.2 +# Your OpenStack Platform's Keystone Port (default is 5000) +test.port=5000 +test.tenantid=abcde12345fghijk6789lmnopq123rst +test.vmid=abc12345-1234-5678-890a-abcdefg12345 |