Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #969 from galasa-dev/iss1956
Browse files Browse the repository at this point in the history
Iss1956 - Add floating IP pool to request to create floating IP
  • Loading branch information
jadecarino authored Aug 5, 2024
2 parents fa2e433 + 1ad1265 commit 3acb820
Show file tree
Hide file tree
Showing 30 changed files with 46 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {

description = 'Galasa Openstack Manager'

version = '0.32.0'
version = '0.36.0'

dependencies {
api project(':galasa-managers-comms-parent:dev.galasa.ipnetwork.manager')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import dev.galasa.openstack.manager.internal.json.User;
import dev.galasa.openstack.manager.internal.properties.OpenStackCredentialsId;
import dev.galasa.openstack.manager.internal.properties.OpenStackDomainName;
import dev.galasa.openstack.manager.internal.properties.OpenStackFloatingIPPool;
import dev.galasa.openstack.manager.internal.properties.OpenStackIdentityUri;
import dev.galasa.openstack.manager.internal.properties.OpenStackProjectName;

Expand Down Expand Up @@ -239,7 +240,7 @@ public Server findServerByName(@NotNull String serverName) throws OpenstackManag
try {
checkToken();

// *** Retrieve a list of the networks available and select one
// *** Retrieve a list of the servers available and select one

HttpGet get = new HttpGet(this.openstackComputeUri + "/servers");
get.addHeader(this.openstackToken.getHeader());
Expand Down Expand Up @@ -578,7 +579,7 @@ protected String getFlavourId(@NotNull String flavour) throws OpenstackManagerEx
try {
checkToken();

// *** Retrieve a list of the images
// *** Retrieve a list of the flavours

HttpGet get = new HttpGet(this.openstackComputeUri + "/flavors");
get.addHeader(this.openstackToken.getHeader());
Expand All @@ -588,7 +589,7 @@ protected String getFlavourId(@NotNull String flavour) throws OpenstackManagerEx
String entity = EntityUtils.toString(response.getEntity());

if (status.getStatusCode() != HttpStatus.SC_OK) {
throw new OpenstackManagerException("OpenStack list image failed - " + status);
throw new OpenstackManagerException("OpenStack list flavour failed - " + status);
}

Flavors flavours = gson.fromJson(entity, Flavors.class);
Expand All @@ -614,9 +615,12 @@ public Floatingip allocateFloatingip(Port port, Network network) throws Openstac
try {
checkToken();

String fipPool = OpenStackFloatingIPPool.get();

Floatingip fip = new Floatingip();
fip.port_id = port.id;
fip.floating_network_id = network.id;
fip.floating_ip_address = fipPool;
fip.description = "galasa_run=" + this.framework.getTestRunName();

FloatingipRequestResponse fipRequest = new FloatingipRequestResponse();
Expand All @@ -633,7 +637,7 @@ public Floatingip allocateFloatingip(Port port, Network network) throws Openstac
String entity = EntityUtils.toString(response.getEntity());

if (status.getStatusCode() != HttpStatus.SC_CREATED) {
throw new OpenstackManagerException("OpenStack list image failed - " + status);
throw new OpenstackManagerException("OpenStack create floating ip failed - " + status);
}

FloatingipRequestResponse fipResponse = this.gson.fromJson(entity, FloatingipRequestResponse.class);
Expand Down Expand Up @@ -684,7 +688,7 @@ public Network findExternalNetwork(String externalNetwork) throws OpenstackManag
} catch (OpenstackManagerException e) {
throw e;
} catch (Exception e) {
throw new OpenstackManagerException("Unable to list floating ips ", e);
throw new OpenstackManagerException("Unable to list networks ", e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
* <p>
* default value is 10 minutes
* </p>
*
*
*
*/
public class BuildTimeout extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
* <p>
* Default is /opt/archives
* </p>
*
*
*
*/
public class LinuxArchivesDirectory extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
* <p>
* The default is nova
* </p>
*
*
*
*/
public class LinuxAvailablityZone extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
* <p>
* The default is OPENSTACKSSH
* </p>
*
*
*
*/
public class LinuxCredentials extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
* <p>
* The default is m1.medium
* </p>
*
*
*
*/
public class LinuxFlavor extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
* <p>
* The default is no capabilities
* </p>
*
*
*
*/
public class LinuxImageCapabilities extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
* <p>
* There are no defaults
* </p>
*
*
*
*/
public class LinuxImages extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
* <p>
* There is no default
* </p>
*
*
*
*/
public class LinuxKeyPair extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
* <p>
* The default is the same as the imagename
* </p>
*
*
*
*/
public class LinuxName extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
* <p>
* There is no default
* </p>
*
*
*
*/
public class LinuxSecurityGroups extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
* <p>
* default value is 2 instaces
* </p>
*
*
*
*/
public class MaximumInstances extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
* <p>
* default value is GALASA{0-9}{0-9}
* </p>
*
*
*
*/
public class NamePool extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
* <p>
* default value is openstack
* </p>
*
*
*
*/
public class OpenStackCredentialsId extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
* <p>
* There is no default
* </p>
*
*
*
*/
public class OpenStackDomainName extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
* <p>
* default value is true
* </p>
*
*
*
*/
public class OpenStackEnabled extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright contributors to the Galasa project
*
* SPDX-License-Identifier: EPL-2.0
*/
package dev.galasa.openstack.manager.internal.properties;

import dev.galasa.framework.spi.ConfigurationPropertyStoreException;
import dev.galasa.framework.spi.cps.CpsProperties;
import dev.galasa.openstack.manager.OpenstackManagerException;

/**
* OpenStack Floating IP Pool
* <p>
* The Openstack Floating IP Pool that the OpenStack Manager will use
* to create a Floating IP address within.
* </p>
* <p>
* The property is:-<br>
* <br>
* openstack.server.floatingip.pool=my_network_name
* </p>
* <p>
* There is no default
* </p>
*
*/
public class OpenStackFloatingIPPool extends CpsProperties {

public static String get()
throws ConfigurationPropertyStoreException, OpenstackManagerException {
return getStringNulled(OpenstackPropertiesSingleton.cps(), "server", "floatingip.pool");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
* <p>
* There is no default
* </p>
*
*
*
*/
public class OpenStackIdentityUri extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
* <p>
* default value is 1
* </p>
*
*
*
*/
public class OpenStackLinuxPriority extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
* <p>
* There is no default
* </p>
*
*
*
*/
public class OpenStackProjectName extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
* <p>
* The default is nova
* </p>
*
*
*
*/
public class WindowsAvailablityZone extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
* <p>
* The default is OPENSTACKSSH
* </p>
*
*
*
*/
public class WindowsCredentials extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
* <p>
* The default is m1.medium
* </p>
*
*
*
*/
public class WindowsFlavor extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
* <p>
* The default is no capabilities
* </p>
*
*
*
*/
public class WindowsImageCapabilities extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
* <p>
* There are no defaults
* </p>
*
*
*
*/
public class WindowsImages extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
* <p>
* There is no default
* </p>
*
*
*
*/
public class WindowsKeyPair extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
* <p>
* The default is the same as the imagename
* </p>
*
*
*
*/
public class WindowsName extends CpsProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
* <p>
* There is no default
* </p>
*
*
*
*/
public class WindowsSecurityGroups extends CpsProperties {
Expand Down
2 changes: 1 addition & 1 deletion release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ managers:
codecoverage: true

- artifact: dev.galasa.openstack.manager
version: 0.32.0
version: 0.36.0
obr: true
mvp: false
bom: true
Expand Down

0 comments on commit 3acb820

Please sign in to comment.