Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> @@ -103,4 +104,14 @@ > */ > @Delegate > Optional getSecurityGroupApi(@EndpointParam(parser = > RegionToEndpoint.class) String region); > + > + /** > +* Provides access to LBaaS version 1 features. > +* > +* NOTE > +* This API is an extension that may or may not be present in your > OpenStack cloud. Use the Optional return type > +* to determine if it is present. > +*/ > + @Delegate > + Optional getLBaaSv1Api(@EndpointParam(parser = > RegionToEndpoint.class) String region); You are absolutely right! So I would rename method to Optional getLBaaSApi(@EndpointParam(parser = RegionToEndpoint.class) String region); --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r18032497
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
Dear all, first of all, thanks for your review everybody! I have changed the PR to fix some issues you have pointed. Before merge, I think there is still some points to clarify: - Version in method name: Because in future, 2 versions of LBaaS API will coexist (v1 and v2), I simply decided to put the version in method name (without thinking too much): NeutronApi.getLBaaSv1Api (and NeutronApi.getLBaaSv2Api in another future PR for LBaaS v2). If the rule for extension APIs is to use the alias name in the method signature, I have to rename the method to NeutronApi.getLBaaSApi (and the method name for v2 will be NeutronApi.getLBaaSv2Api), as @jdaggett has suggested it. Let me know if I have to remove the version in method name. - Version in packages: For the same reason, I simply decide to put all classes about LBaaS in a 'v1' packages (domain, extensions, fallbacks, functions). I thought this was the simplest solution to prepare future integration of LBaaS v2. However, it seems more and more unlikely that LBaaS v2 will be part of the next release of OpenStack (Juno due date is october 16 and LBaaS improvements have not yet been reviewed). So maybe it is to early to talk about LBaaS v2 and maybe it is preferable to simply ignore it and remove version in package names and in classnames. What do you think? --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146#issuecomment-56814435
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> + * > + * http://www.apache.org/licenses/LICENSE-2.0 > + * > + * Unless required by applicable law or agreed to in writing, software > + * distributed under the License is distributed on an "AS IS" BASIS, > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > + * See the License for the specific language governing permissions and > + * limitations under the License. > + */ > + > +package org.jclouds.openstack.neutron.v2.domain.lbaas.v1; > + > +/** > + * Enumerates supported Neutron LBaaS v1 resources status. > + */ > +public enum LBaaSStatus { > Question: At some point in the future, would it make sense to drop v1 and > just have v2 as the LBaaS? I read on some forums (I don't remember where) that LBaaS v1 API will be deprecated when LBaaS v2 will be released. Moreover LBaaS v1 will be removed in far future. I think that jclouds should deprecate the LBaaS v1 when LBaaS v2 is released, but not remove it in far future because someone might still need to use it. --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r18027504
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> + * > + * http://www.apache.org/licenses/LICENSE-2.0 > + * > + * Unless required by applicable law or agreed to in writing, software > + * distributed under the License is distributed on an "AS IS" BASIS, > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > + * See the License for the specific language governing permissions and > + * limitations under the License. > + */ > + > +package org.jclouds.openstack.neutron.v2.domain.lbaas.v1; > + > +/** > + * Enumerates supported Neutron LBaaS v1 resources status. > + */ > +public enum LBaaSStatus { Done --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r18024252
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> + * > + * Unless required by applicable law or agreed to in writing, software > + * distributed under the License is distributed on an "AS IS" BASIS, > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > + * See the License for the specific language governing permissions and > + * limitations under the License. > + */ > + > +package org.jclouds.openstack.neutron.v2.domain.lbaas.v1; > + > + > +/** > + * Enumerates supported HTTP methods. > + */ > +public enum HttpMethod { > + GET("GET"), Done --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r18024094
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> + public String getName() { > + return name; > + } > + > + /** > +* @return the description of the Pool. > +*/ > + @Nullable > + public String getDescription() { > + return description; > + } > + > + /** > +* @return the subnet id for this Pool. > +*/ > + public String getSubnetId() { Done --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r18024058
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> + @Path("/health_monitors/{id}") > + @Fallback(FalseOnNotFoundOr404.class) > + boolean deleteHealthMonitor(@PathParam("id") String id); > + > + /** > +* Associate a HealthMonitor to a Pool. > +* > +* @param poolId the id of the Pool to associate. > +* @param healthMonitor the HealthMonitor to associate. > +* @return the newly associated HealthMonitor. > +*/ > + @Named("pool:associate_health_monitor") > + @POST > + @Path("/pools/{pool-id}/health_monitors") > + @SelectJson("health_monitor") > + HealthMonitor associateHealthMonitor(@PathParam("pool-id") String poolId, Good! I tried with the @PayloadParam annotation some days ago, but it did not work. But it was because I had missed the @Payload annotation. So now the new associate method signature is: // Associate a HealthMonitor to a Pool. @Named("pool:associate_health_monitor") @POST @Path("/pools/{pool-id}/health_monitors") @SelectJson("health_monitor") @Payload("%7B\"health_monitor\":%7B\"id\":\"{healthMonitorId}\"%7D%7D") @Produces(MediaType.APPLICATION_JSON) HealthMonitor associateHealthMonitor(@PathParam("pool-id") String poolId, @PayloadParam("healthMonitorId") String healthMonitorId); ... and the AssociateBuilder is removed. Thank you for your help --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r18023998
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> @@ -103,4 +104,14 @@ > */ > @Delegate > Optional getSecurityGroupApi(@EndpointParam(parser = > RegionToEndpoint.class) String region); > + > + /** > +* Provides access to LBaaS version 1 features. > +* > +* NOTE > +* This API is an extension that may or may not be present in your > OpenStack cloud. Use the Optional return type > +* to determine if it is present. > +*/ > + @Delegate > + Optional getLBaaSv1Api(@EndpointParam(parser = > RegionToEndpoint.class) String region); Sorry, but I don't see in the sources where v2 will be lbaasv2. However, if the rule is to use the alias name in the method signature, I'll do it. --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r18023746
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> +package org.jclouds.openstack.neutron.v2.domain.lbaas.v1; > + > +import java.beans.ConstructorProperties; > + > +import javax.inject.Named; > + > +import org.jclouds.javax.annotation.Nullable; > + > +import com.google.common.base.MoreObjects; > +import com.google.common.base.Objects; > +import com.google.common.collect.ImmutableList; > + > +/** > + * A Neutron LBaaS v1 HealthMonitor. > + * > + * @see href="http://docs.openstack.org/api/openstack-network/2.0/content/lbaas_ext_ops_health_monitor.html";>api Done on all domain objects --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r18023382
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> + * > + * http://www.apache.org/licenses/LICENSE-2.0 > + * > + * Unless required by applicable law or agreed to in writing, software > + * distributed under the License is distributed on an "AS IS" BASIS, > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > + * See the License for the specific language governing permissions and > + * limitations under the License. > + */ > + > +package org.jclouds.openstack.neutron.v2.domain.lbaas.v1; > + > +/** > + * Enumerates supported SessionPersistence types. > + */ > +public enum SessionPersistenceType { Done --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r18023342
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> + return expectedCodes; > + } > + > + /** > +* @return the pools for this HealthMonitor. > +*/ > + @Nullable > + public ImmutableList getPools() { > + return pools; > + } > + > + /** > +* @return the administrative state for this HealthMonitor. > +*/ > + @Nullable > + public Boolean getAdminStateUp() { I think isXXX() is only for boolean properties, getXXX() should be used for Boolean. This is because getAdminStateUp() can return 3 values: null, Boolean.TRUE or Boolean.FALSE. http://download.oracle.com/otndocs/jcp/7224-javabeans-1.01-fr-spec-oth-JSpec/ http://blog.950buy.com/article/javabean-specification-on-a-few-you-should-know/ --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r17962110
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> @@ -103,4 +104,14 @@ > */ > @Delegate > Optional getSecurityGroupApi(@EndpointParam(parser = > RegionToEndpoint.class) String region); > + > + /** > +* Provides access to LBaaS version 1 features. > +* > +* NOTE > +* This API is an extension that may or may not be present in your > OpenStack cloud. Use the Optional return type > +* to determine if it is present. > +*/ > + @Delegate > + Optional getLBaaSv1Api(@EndpointParam(parser = > RegionToEndpoint.class) String region); Please, can you tell me where lbaas and lbaasv2 are defined in the OpenStack sources? --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r17959167
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> + /** > + * Provides the administrative state for this HealthMonitor's Builder. > + * > + * @return the Builder. > + * @see HealthMonitor#getAdminStateUp() > + */ > + public ParameterizedBuilderType adminStateUp(Boolean adminStateUp) { > + healthMonitor.adminStateUp = adminStateUp; > + return self(); > + } > + } > + > + /** > +* Create builder (inheriting from Builder). > +*/ > + public static class CreateBuilder extends Builder { Those fields are required only if type is HTTP/HTTPS and to overwrite the default values. CreateBuilder inherits from Builder that exposes the fields. HealthMonitor.CreateBuilder builder = HealthMonitor.createBuilder(ProbeType.HTTP, 10, 5, 2).httpMethod(HttpMethod.POST).urlPath("/path").expectedCodes("201").build(); I could add additional CreateBuilder constructors dedicated to HTTP/HTTPS and with those parameters, but I'm not sure this is a good idea: HealthMonitor.CreateBuilder httpBuilder = HealthMonitor.createHttpBuilder(10, 5, 2, HttpMethod.POST, "/path", "201").build(); HealthMonitor.CreateBuilder httpsBuilder = HealthMonitor.createHttpsBuilder(10, 5, 2, HttpMethod.POST, "/path", "201").build(); Let me know --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r17957618
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> + > + /* > +* Methods to get the builder follow. > +*/ > + > + /** > +* @return the Builder for SessionPersistence. > +*/ > + public static Builder builder() { > + return new Builder(); > + } > + > + /** > +* Gets a Builder configured as this object. > +*/ > + public Builder toBuilder() { I removed the to and from builder methods. --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r17914083
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> +*/ > + public static Builder builder() { > + return new Builder(); > + } > + > + /** > +* Gets a Builder configured as this object. > +*/ > + public Builder toBuilder() { > + return new Builder().fromPoolStatus(this); > + } > + > + /** > +* Builder. > +*/ > + public static class Builder { I removed the builder --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r17914014
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> +{ > +"health_monitor": { > +"status": "PENDING_CREATE", > +"admin_state_up": true, > +"tenant_id": "4fd44f30292945e481c7b8a0c8908869", > +"delay": 1, > +"expected_codes": "200", > +"max_retries": 1, > +"http_method": "GET", > +"timeout": 1, > +"pools": [], > +"url_path": "/", > +"type": "HTTP", > +"id": "b624decf-d5d3-4c66-9a3d-f047e7786181" > +} > +} Done --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r17914138
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> +/** > + * Enumerates supported SessionPersistence types. > + */ > +public enum SessionPersistenceType { > + /** > +* All connections that originate from the same source IP address are > handled by the same member of the pool. > +*/ > + SOURCE_IP, > + /** > +* The load balancing function creates a cookie on the first request from > a client. Subsequent requests that > +* contain the same cookie value are handled by the same member of the > pool. > +*/ > + HTTP_COOKIE, > + /** > +* The load balancing function relies on a cookie established by the > back-end application. All requests with the > +* same cookie value are handled by the same member of the pool. I added the fromValue method --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r17914125
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> +*/ > + public static class CreateBuilder extends Builder { > + /** > + * Supply required properties for creating a HealthMonitor's > CreateBuilder. > + * > + * @param type the probe type. > + * @param delay the delay. > + * @param timeout the timeout. > + * @param maxRetries the max retries. > + */ > + private CreateBuilder(ProbeType type, Integer delay, Integer timeout, > Integer maxRetries) { > + type(type).delay(delay).timeout(timeout).maxRetries(maxRetries); > + } > + > + /** > + * Provide the tenantId for this HealthMonitor's CreateBuilder. > Admin-only. Done --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r17913799
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> + * > + * http://www.apache.org/licenses/LICENSE-2.0 > + * > + * Unless required by applicable law or agreed to in writing, software > + * distributed under the License is distributed on an "AS IS" BASIS, > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > + * See the License for the specific language governing permissions and > + * limitations under the License. > + */ > + > +package org.jclouds.openstack.neutron.v2.domain.lbaas.v1; > + > +/** > + * Enumerates supported HTTP methods. > + */ > +public enum HttpMethod { Done --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r17913906
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> + private Integer timeout; > + @Named("max_retries") > + private Integer maxRetries; > + // Optional attributes that can be updated > + @Named("http_method") > + private HttpMethod httpMethod; > + @Named("url_path") > + private String urlPath; > + @Named("expected_codes") > + private String expectedCodes; > + @Named("admin_state_up") > + private Boolean adminStateUp; > + // Read-only attributes > + @Named("id") > + private String id; > + @Named("pools") I have removed @Named where it is not needed --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r17913785
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> + @Named("address") > + private String address; > + @Named("protocol_port") > + private Integer protocolPort; > + // Mandatory attributes that can be updated > + @Named("pool_id") > + private String poolId; > + // Optional attributes that can be updated > + @Named("weight") > + private Integer weight; > + @Named("admin_state_up") > + private Boolean adminStateUp; > + // Read-only attributes > + private String id; > + @Named("status") > + private Status status; Status renamed to LBaaSStatus --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r17913946
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> +*/ > + public static Builder builder() { > + return new Builder(); > + } > + > + /** > +* Gets a Builder configured as this object. > +*/ > + public Builder toBuilder() { > + return new Builder().fromHealthMonitorStatus(this); > + } > + > + /** > +* Builder. > +*/ > + public static class Builder { You are right. I removed the builder. --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r17913875
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> +package org.jclouds.openstack.neutron.v2.domain.lbaas.v1; > + > +import java.beans.ConstructorProperties; > + > +import javax.inject.Named; > + > +import org.jclouds.javax.annotation.Nullable; > + > +import com.google.common.base.MoreObjects; > +import com.google.common.base.Objects; > +import com.google.common.collect.ImmutableList; > + > +/** > + * A Neutron LBaaS v1 HealthMonitor. > + * > + * @see href="http://docs.openstack.org/api/openstack-network/2.0/content/lbaas_ext_ops_health_monitor.html";>api Done --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r17913732
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
I don't agree with you about putiing LBaaSApi on the same directory level as RouterApi. I would like to do it, but this will be a problem when support of LBaaS v2 will be added. As mentioned previously, LBaaS v1 and LBaaS v2 differ on domain objects and on API. --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146#issuecomment-56525829
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> + @Path("/health_monitors/{id}") > + @Fallback(FalseOnNotFoundOr404.class) > + boolean deleteHealthMonitor(@PathParam("id") String id); > + > + /** > +* Associate a HealthMonitor to a Pool. > +* > +* @param poolId the id of the Pool to associate. > +* @param healthMonitor the HealthMonitor to associate. > +* @return the newly associated HealthMonitor. > +*/ > + @Named("pool:associate_health_monitor") > + @POST > + @Path("/pools/{pool-id}/health_monitors") > + @SelectJson("health_monitor") > + HealthMonitor associateHealthMonitor(@PathParam("pool-id") String poolId, Here are 2 examples to use LBaaS v1 or LBaaS v2. as you can see, it would be difficult to have a common API compatible with LBaaS v1 and LBaaS v2. // Get org.jclouds.openstack.neutron.v2.extensions.lbaas.v1.LBaaSApi extension Optional lbaasV1ApiExtension = neutronApi.getLBaaSv1Api(region); if (lbaasV1ApiExtension.isPresent()) { LBaaSApi lbaasV1Api = lbaasV1ApiExtension.get(); // Create org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Pool Pool.CreatePool createPool = Pool.createBuilder(subnetId, Protocol.HTTP, Pool.ROUND_ROBIN) .name("mypool").provider("HAPROXY").build(); Pool poolV1 = lbaasV1Api.createPool(createPool); // Create org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Member Member.CreateMember createMember = Member.createBuilder(poolV1.getId(), privateIPAddressOfNode, 80).build(); Member memberV1 = lbaasV1Api.createMember(createMember); // Create 2 org.jclouds.openstack.neutron.v2.domain.lbaas.v1.HealthMonitor HealthMonitor.CreateHealthMonitor createHealthMonitor1 = HealthMonitor.createBuilder(ProbeType.HTTP, 60, 5, 2).build(); HealthMonitor firstHealthMonitorV1 = lbaasV1Api.createHealthMonitor(createHealthMonitor1); HealthMonitor.CreateHealthMonitor createHealthMonitor2 = HealthMonitor.createBuilder(ProbeType.PING, 60, 5, 2).build(); HealthMonitor secondHealthMonitorV1 = lbaasV1Api.createHealthMonitor(createHealthMonitor2); // Associate Health Monitors to Pool HealthMonitor.AssociateHealthMonitor associateHealthMonitor1 = HealthMonitor.associateBuilder(firstHealthMonitorV1.getId()).build(); HealthMonitor healthMonitorAssociated1 = lbaasV1Api.associateHealthMonitor(poolV1.getId(), associateHealthMonitor1); HealthMonitor.AssociateHealthMonitor associateHealthMonitor2 = HealthMonitor.associateBuilder(firstHealthMonitorV1.getId()).build(); HealthMonitor healthMonitorAssociated2 = lbaasV1Api.associateHealthMonitor(poolV1.getId(), associateHealthMonitor2); // Create org.jclouds.openstack.neutron.v2.domain.lbaas.v1.VIP VIP.CreateVIP createVIP = VIP.createBuilder(subnetId, Protocol.HTTP, 80, poolV1.getId()) .name("myvip").build(); VIP vipV1 = lbaasV1Api.createVIP(createVIP); } else { logger.info("LBaaS API Version 1 is unavailable"); } // Note: this is my understand of the LBaaS API improvement // see https://blueprints.launchpad.net/neutron/+spec/lbaas-api-and-objmodel-improvement // Note: the OpenStack Networking API V2.0 document (September 9, 2014) describesLBaaS v2, but // it has been reviewed September 23, 2014 and finally, ONLY the LBaaS v1 API is described. // Does it mean next OpenStack release (Juno) will not provide LBaaS v2? I think so. // Get org.jclouds.openstack.neutron.v2.extensions.lbaas.v2.LBaaSApi extension Optional lbaasV2ApiExtension = neutronApi.getLBaaSv2Api(region); if (lbaasV2ApiExtension.isPresent()) { LBaaSApi lbaasV2Api = lbaasV2ApiExtension.get(); // Create org.jclouds.openstack.neutron.v2.domain.lbaas.v2.Pool // Note: vipId, subnetId, protocol and provider are not attributes of Pool anymore in LBaaS v2 Pool.CreatePool createPool = Pool.createBuilder(Pool.ROUND_ROBIN) .name("mypool").build(); Pool poolV2 = lbaasV2Api.createPool(createPool); // Create org.jclouds.openstack.neutron.v2.domain.lbaas.v2.Member // Note: subnetId is new but optional. I think moving subnetId from pool to member allows load balancing between nodes located on different subnets. Member.CreateMember createMember = Member.createBuilder(poolV2.getId(), privateIPAddressOfNode, 80) .subnetId(subnetId).build(); Member memberV2 = lbaasV2Api.createMember(createMember); // Create org.jclouds.openstack.neutron.v2.domain.lbaas.v2.HealthMonitor HealthMonitor.CreateHealthMonitor createHealthMonitor = HealthMonitor.createBuilder(ProbeType.HTTP, 60, 5, 2).build(); HealthMonitor healthMonitorV2 = lbaasV2Api.createHealthMonitor(createHealthMonitor); // Associate Health Monitor to Pool // Note: Only one health monitor can be associated to a
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> +public class Pool { > + > + // Load balancing methods that must be supported by all providers. > + // Not an enum type because any provider may support additional balancing > methods. > + public static String ROUND_ROBIN = "ROUND_ROBIN"; > + public static String LEAST_CONNECTIONS = "LEAST_CONNECTIONS"; > + public static String SOURCE_IP = "SOURCE_IP"; > + > + // Mandatory attributes when creating > + @Named("tenant_id") > + private String tenantId; > + @Named("subnet_id") > + private String subnetId; > + @Named("protocol") > + private Protocol protocol; > + // Mandatory attributes that can be updated No "Mandatory attributes when creating" section is for attributes that are mandatory for creation and that cannot be modified after creation. Maybe I have to review the comments? --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r17899421
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> + public String getName() { > + return name; > + } > + > + /** > +* @return the description of the Pool. > +*/ > + @Nullable > + public String getDescription() { > + return description; > + } > + > + /** > +* @return the subnet id for this Pool. > +*/ > + public String getSubnetId() { - Create: CreateBuilder contructor constrains the developper to specify the subnetId. Do I have to test parameter is not null in CreateBuilder.subnetId()? I prefer let OpenStack reply with the appropriate error message. - Update: subnetId cannot be modified after creation, so UpdateBuilder does not provide method to modify it. The UpdatePool.subnetId is always null, and so subnet_id does not appear in the request's payload (and Neutron does not expect subnet_id in PUT operation). --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r17899346
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> + @Path("/health_monitors/{id}") > + @Fallback(FalseOnNotFoundOr404.class) > + boolean deleteHealthMonitor(@PathParam("id") String id); > + > + /** > +* Associate a HealthMonitor to a Pool. > +* > +* @param poolId the id of the Pool to associate. > +* @param healthMonitor the HealthMonitor to associate. > +* @return the newly associated HealthMonitor. > +*/ > + @Named("pool:associate_health_monitor") > + @POST > + @Path("/pools/{pool-id}/health_monitors") > + @SelectJson("health_monitor") > + HealthMonitor associateHealthMonitor(@PathParam("pool-id") String poolId, As I explained to @demobox , LBaaS v1 association method takes a health_monitor as parameter, not a String. However, only the health monitor's id must be specified. I thought that AssociateBuilder was the more elegant way to map the "associate health monitor" call. However, let me know how to simplify the method signature (without AssociateBuilder) and generate a json payload with health_monitor object in the same time: associateHealthMonitor(String poolId, String healthMonitorId) -> { "health_monitor": { "id":"5d4b5228-33b0-4e60-b225-9b727c1a20e7" } } --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r17898166
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
> + @Path("/vips") > + @SelectJson("vip") > + VIP createVIP(@WrapWith("vip") VIP.CreateVIP vip); > + > + /** > +* Update a VIP. > +* > +* @param id the id of the VIP to update. > +* @param vip the VIP's attributes to update. > +* @return a reference of the updated VIP. > +*/ > + @Named("vip:update") > + @PUT > + @Path("/vips/{id}") > + @SelectJson("vip") > + @Fallback(NullOnNotFoundOr404.class) POST operations don't use 404 fallbacks. Should I have to remove 404 fallbacks on PUT operations? Or is it going to be the subject of a future PR? I mean, a new PR to remove 404 fallbacks on all service operations (RouterApi, NetworkApi, etc.) --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146/files#r17897680
Re: [jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
Thanks for your review @demobox, - should domain objects have private or protected constructors and fields? I wrote the domain objects in order to be coherent with the rest of the code. Others domain objects were written in the same way: e.g. Pool has private fileds and constructors as Subnet and HealthMonitorStatus has protected fiields and constructors as AllocationPool. However I agree to use private visibility for all domain objects. - should we have version numbers in method names and constants (LBaaSv1)? Next version of OpenStack (Juno) will improve LBaaS API and object model (https://blueprints.launchpad.net/neutron/+spec/lbaas-api-and-objmodel-improvement). The new LBaaS will expose a new API (v2) but will also be compatible with the legacy API (v1). This means that a cloud-platform built with OpenStack may have (or not) LBaaS extension, may expose LBaaS API v1 (if Havana or IceHouse is used), or may expose LBaaS API v1 and LBaaS API v2 (if Juno is used). My point of view is that jclouds must support both versions to be able to address all cloud-platforms built with OpenStack (Havana, IceHouse, Juno, etc.). I have tried to define "generic" API and domain objects that would be compatible with LBaaS v1 and LBaaS v2. However, even if LBaaS improvements do not change all, it is not so simple: e.g. VIP is replaced by LoadBalancer and Listener; attribute subnet_id moves from Pool to Member, I think that "generic" domain objects would be confused for developpers that use jclouds: e.g. as a developper, do I have to use the Pool.subnetId or the Member.subnetId? Do I have to use VIP or LoadBalancer? Finally, I decided to explicitly seperate LBaaS v1 and LBaaS v2. I think it is more simple for everyone (contributors an users jclouds) to use either LBaaSv1 API or LBaaSv2 API. This implies having NeutronAPI.getLBaaSv1Api and NeutronAPI.getLBaaSv2Api. And I think that it is the role of the jclouds LoadBlancer abstraction to use either LBaaS v1 or v2 depending on the API exposed by the cloud-platform. However, if you have better idea to create a generic API independant of the version, let's discuss about it. - does the "associate health monitor" call require a domain/parameter object too? Yes, LBaaS v1 association method takes a health_monitor as parameter (even if only the id must be specified), not a String. I thought that AssociateBuilder was the more elegant way to map the "associate health monitor" call. However, if you have a better idea, let me know. --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/146#issuecomment-56264339
[jclouds-labs-openstack] JCLOUDS-611: Neutron LBaaS (version 1) extension request (#146)
https://issues.apache.org/jira/browse/JCLOUDS-611 main: - Added getLBaaSv1Api in NeutronApi interface - Added LBaaS v1 alias in NeutronHttpApiModule class - Added LBaaS v1 extension in ExtensionNamespaces class - Added domain/lbaas/v1 package - Added extensions/lbaas/v1 package - Added fallbacks/lbaas/v1 package - Added functions/lbaas/v1 package tests: - Added extensions/lbaas/v1 package - Added resources/extension_list_with_lbaas_v1_response.json - Added resources/extension_list_without_lbaas_v1_response.json - Added resources/lbaas/v1 package You can merge this Pull Request by running: git pull https://github.com/fbrouille/jclouds-labs-openstack master Or you can view, comment on it, or merge it online at: https://github.com/jclouds/jclouds-labs-openstack/pull/146 -- Commit Summary -- * Support LBaaS v1 -- File Changes -- M openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/NeutronApi.java (11) M openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/config/NeutronHttpApiModule.java (2) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitor.java (519) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitorStatus.java (175) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitors.java (37) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HttpMethod.java (29) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Member.java (373) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Members.java (36) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Pool.java (486) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/PoolStatus.java (175) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Pools.java (36) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/ProbeType.java (29) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Protocol.java (30) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/SessionPersistence.java (148) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/SessionPersistenceType.java (43) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Status.java (29) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/VIP.java (495) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/VIPs.java (36) M openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/ExtensionNamespaces.java (6) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/lbaas/v1/LBaaSApi.java (427) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyHealthMonitorsFallback.java (46) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyMembersFallback.java (46) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyPoolsFallback.java (46) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyVIPsFallback.java (46) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/HealthMonitorsToPagedIterable.java (66) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/MembersToPagedIterable.java (65) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseHealthMonitors.java (38) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseMembers.java (38) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParsePools.java (38) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseVIPs.java (38) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/PoolsToPagedIterable.java (65) A openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/VIPsToPagedIterable.java (65) A openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2/extensions/lbaas/v1/LBaaSApiLiveTest.java (640) A openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2/extensions/lbaas/v1/LBaaSApiMockTest.java (1792) A openstack-neutron/src/test/resources/extension_list_with_lbaas_v1_response.json (140) A openstack-neutron/src/test/resources/extension_list_without_lbaas_v1_response.json (132) A openstack-neutron/src/test/resources/lbaas/v1