mirror of https://github.com/apache/jclouds.git
Cleans up neutron code
This commit is contained in:
parent
994a169ac4
commit
0485a564a0
|
@ -166,14 +166,14 @@ public class FloatingIP {
|
|||
/**
|
||||
* @return the Builder for creating a new floating IP
|
||||
*/
|
||||
public static CreateBuilder createOptions(String floatingNetworkId) {
|
||||
public static CreateBuilder createBuilder(String floatingNetworkId) {
|
||||
return new CreateBuilder(floatingNetworkId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Builder for updating a floating IP
|
||||
*/
|
||||
public static UpdateBuilder updateOptions() {
|
||||
public static UpdateBuilder updateBuilder() {
|
||||
return new UpdateBuilder();
|
||||
}
|
||||
|
||||
|
@ -260,8 +260,8 @@ public class FloatingIP {
|
|||
/**
|
||||
* @return a CreateOptions constructed with this Builder.
|
||||
*/
|
||||
public CreateOptions build() {
|
||||
return new CreateOptions(floatingIP);
|
||||
public CreateFloatingIP build() {
|
||||
return new CreateFloatingIP(floatingIP);
|
||||
}
|
||||
|
||||
protected CreateBuilder self() {
|
||||
|
@ -294,8 +294,8 @@ public class FloatingIP {
|
|||
/**
|
||||
* @return a UpdateOptions constructed with this Builder.
|
||||
*/
|
||||
public UpdateOptions build() {
|
||||
return new UpdateOptions(floatingIP);
|
||||
public UpdateFloatingIP build() {
|
||||
return new UpdateFloatingIP(floatingIP);
|
||||
}
|
||||
|
||||
protected UpdateBuilder self() {
|
||||
|
@ -303,13 +303,13 @@ public class FloatingIP {
|
|||
}
|
||||
}
|
||||
|
||||
public static class CreateOptions extends FloatingIP {
|
||||
private CreateOptions(FloatingIP floatingIP) {
|
||||
public static class CreateFloatingIP extends FloatingIP {
|
||||
private CreateFloatingIP(FloatingIP floatingIP) {
|
||||
super(floatingIP);
|
||||
}
|
||||
}
|
||||
public static class UpdateOptions extends FloatingIP {
|
||||
private UpdateOptions(FloatingIP floatingIP) {
|
||||
public static class UpdateFloatingIP extends FloatingIP {
|
||||
private UpdateFloatingIP(FloatingIP floatingIP) {
|
||||
super(floatingIP);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public enum IPv6DHCPMode {
|
|||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* This provides GSON enum support in jclouds.
|
||||
* */
|
||||
public static IPv6DHCPMode fromValue(String name){
|
||||
|
|
|
@ -16,15 +16,17 @@
|
|||
*/
|
||||
package org.jclouds.openstack.neutron.v2.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
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.ImmutableSet;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import javax.inject.Named;
|
||||
import java.beans.ConstructorProperties;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* A Neutron network
|
||||
|
@ -367,14 +369,14 @@ public class Network {
|
|||
/**
|
||||
* @return the Builder for creating a new Router
|
||||
*/
|
||||
public static CreateBuilder createOptions(String name) {
|
||||
public static CreateBuilder createBuilder(String name) {
|
||||
return new CreateBuilder(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Builder for updating a Router
|
||||
*/
|
||||
public static UpdateBuilder updateOptions() {
|
||||
public static UpdateBuilder updateBuilder() {
|
||||
return new UpdateBuilder();
|
||||
}
|
||||
|
||||
|
@ -585,8 +587,8 @@ public class Network {
|
|||
/**
|
||||
* @return a CreateOptions constructed with this Builder.
|
||||
*/
|
||||
public CreateOptions build() {
|
||||
return new CreateOptions(network);
|
||||
public CreateNetwork build() {
|
||||
return new CreateNetwork(network);
|
||||
}
|
||||
|
||||
protected CreateBuilder self() {
|
||||
|
@ -607,8 +609,8 @@ public class Network {
|
|||
/**
|
||||
* @return a UpdateOptions constructed with this Builder.
|
||||
*/
|
||||
public UpdateOptions build() {
|
||||
return new UpdateOptions(network);
|
||||
public UpdateNetwork build() {
|
||||
return new UpdateNetwork(network);
|
||||
}
|
||||
|
||||
protected UpdateBuilder self() {
|
||||
|
@ -620,11 +622,11 @@ public class Network {
|
|||
* Create and Update options - extend the domain class, passed to API update and create calls.
|
||||
* Essentially the same as the domain class. Ensure validation and safe typing.
|
||||
*/
|
||||
public static class CreateOptions extends Network {
|
||||
public static class CreateNetwork extends Network {
|
||||
/**
|
||||
* Copy constructor
|
||||
*/
|
||||
private CreateOptions(Network network) {
|
||||
private CreateNetwork(Network network) {
|
||||
super(network);
|
||||
checkNotNull(network.name, "name should not be null");
|
||||
}
|
||||
|
@ -634,11 +636,11 @@ public class Network {
|
|||
* Create and Update options - extend the domain class, passed to API update and create calls.
|
||||
* Essentially the same as the domain class. Ensure validation and safe typing.
|
||||
*/
|
||||
public static class UpdateOptions extends Network {
|
||||
public static class UpdateNetwork extends Network {
|
||||
/**
|
||||
* Copy constructor
|
||||
*/
|
||||
private UpdateOptions(Network network) {
|
||||
private UpdateNetwork(Network network) {
|
||||
super(network);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
|
||||
package org.jclouds.openstack.neutron.v2.domain;
|
||||
|
||||
/**
|
||||
* Enumerates Network Status.
|
||||
*/
|
||||
public enum NetworkStatus {
|
||||
ACTIVE("active"),
|
||||
DOWN("down"),
|
||||
|
@ -38,7 +41,7 @@ public enum NetworkStatus {
|
|||
return name();
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* This provides GSON enum support in jclouds.
|
||||
* @param name The string representation of this enum value.
|
||||
* @return The corresponding enum value.
|
||||
|
|
|
@ -18,10 +18,7 @@
|
|||
package org.jclouds.openstack.neutron.v2.domain;
|
||||
|
||||
/**
|
||||
* Enumerates supported Network types.
|
||||
*
|
||||
* @see <a href=
|
||||
* "http://docs.openstack.org/api/openstack-network/2.0/content/provider_ext.html">api doc</a>
|
||||
* Enumerates supported Network types.
|
||||
*/
|
||||
public enum NetworkType {
|
||||
/**
|
||||
|
@ -37,15 +34,15 @@ public enum NetworkType {
|
|||
*/
|
||||
VLAN("vlan"),
|
||||
/**
|
||||
* Used to describe a Virtual Extensible LAN (VXLAN) network.
|
||||
* It uses a VLAN-like encapsulation technique to encapsulate MAC-based
|
||||
* Used to describe a Virtual Extensible LAN (VXLAN) network.
|
||||
* It uses a VLAN-like encapsulation technique to encapsulate MAC-based
|
||||
* OSI layer 2 Ethernet frames within layer 4 UDP packets.
|
||||
*/
|
||||
VXLAN("vxlan"),
|
||||
/**
|
||||
* Used to describe a GRE tunnel network. A virtual network realized as
|
||||
* packets encapsulated using Generic Routing Encapsulation. GRE tunnel
|
||||
* packets are routed by the compute node hosts, so GRE tunnels are not
|
||||
* Used to describe a GRE tunnel network. A virtual network realized as
|
||||
* packets encapsulated using Generic Routing Encapsulation. GRE tunnel
|
||||
* packets are routed by the compute node hosts, so GRE tunnels are not
|
||||
* associated by the openvswitch plugin with specific physical networks.
|
||||
*/
|
||||
GRE("gre"),
|
||||
|
@ -65,7 +62,7 @@ public enum NetworkType {
|
|||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* This provides GSON enum support in jclouds.
|
||||
* @param name The string representation of this enum value.
|
||||
* @return The corresponding enum value.
|
||||
|
|
|
@ -16,16 +16,18 @@
|
|||
*/
|
||||
package org.jclouds.openstack.neutron.v2.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
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.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import javax.inject.Named;
|
||||
import java.beans.ConstructorProperties;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* A Neutron port
|
||||
|
@ -460,14 +462,14 @@ public class Port {
|
|||
/**
|
||||
* @return the Builder for creating a new Router
|
||||
*/
|
||||
public static CreateBuilder createOptions(String networkId) {
|
||||
public static CreateBuilder createBuilder(String networkId) {
|
||||
return new CreateBuilder(networkId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Builder for updating a Router
|
||||
*/
|
||||
public static UpdateBuilder updateOptions() {
|
||||
public static UpdateBuilder updateBuilder() {
|
||||
return new UpdateBuilder();
|
||||
}
|
||||
|
||||
|
@ -702,8 +704,8 @@ public class Port {
|
|||
/**
|
||||
* @return a CreateOptions constructed with this Builder.
|
||||
*/
|
||||
public CreateOptions build() {
|
||||
return new CreateOptions(port);
|
||||
public CreatePort build() {
|
||||
return new CreatePort(port);
|
||||
}
|
||||
|
||||
protected CreateBuilder self() {
|
||||
|
@ -724,8 +726,8 @@ public class Port {
|
|||
/**
|
||||
* @return a UpdateOptions constructed with this Builder.
|
||||
*/
|
||||
public UpdateOptions build() {
|
||||
return new UpdateOptions(port);
|
||||
public UpdatePort build() {
|
||||
return new UpdatePort(port);
|
||||
}
|
||||
|
||||
protected UpdateBuilder self() {
|
||||
|
@ -737,11 +739,11 @@ public class Port {
|
|||
* Create and Update options - extend the domain class, passed to API update and create calls.
|
||||
* Essentially the same as the domain class. Ensure validation and safe typing.
|
||||
*/
|
||||
public static class CreateOptions extends Port {
|
||||
public static class CreatePort extends Port {
|
||||
/**
|
||||
* Copy constructor
|
||||
*/
|
||||
private CreateOptions(Port port) {
|
||||
private CreatePort(Port port) {
|
||||
super(port);
|
||||
checkNotNull(port.networkId, "networkId should not be null");
|
||||
}
|
||||
|
@ -751,11 +753,11 @@ public class Port {
|
|||
* Create and Update options - extend the domain class, passed to API update and create calls.
|
||||
* Essentially the same as the domain class. Ensure validation and safe typing.
|
||||
*/
|
||||
public static class UpdateOptions extends Port {
|
||||
public static class UpdatePort extends Port {
|
||||
/**
|
||||
* Copy constructor
|
||||
*/
|
||||
private UpdateOptions(Port port) {
|
||||
private UpdatePort(Port port) {
|
||||
super(port);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,12 +16,14 @@
|
|||
*/
|
||||
package org.jclouds.openstack.neutron.v2.domain;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.common.base.Objects;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import java.beans.ConstructorProperties;
|
||||
|
||||
import javax.inject.Named;
|
||||
import java.beans.ConstructorProperties;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* A Neutron Router
|
||||
|
@ -125,14 +127,14 @@ public class Router {
|
|||
/**
|
||||
* @return the Builder for creating a new Router
|
||||
*/
|
||||
public static CreateBuilder createOptions() {
|
||||
public static CreateBuilder createBuilder() {
|
||||
return new CreateBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Builder for updating a Router
|
||||
*/
|
||||
public static UpdateBuilder updateOptions() {
|
||||
public static UpdateBuilder updateBuilder() {
|
||||
return new UpdateBuilder();
|
||||
}
|
||||
|
||||
|
@ -237,8 +239,8 @@ public class Router {
|
|||
/**
|
||||
* @return a CreateOptions constructed with this Builder.
|
||||
*/
|
||||
public CreateOptions build() {
|
||||
return new CreateOptions(router);
|
||||
public CreateRouter build() {
|
||||
return new CreateRouter(router);
|
||||
}
|
||||
|
||||
protected CreateBuilder self() {
|
||||
|
@ -256,8 +258,8 @@ public class Router {
|
|||
/**
|
||||
* @return a UpdateOptions constructed with this Builder.
|
||||
*/
|
||||
public UpdateOptions build() {
|
||||
return new UpdateOptions(router);
|
||||
public UpdateRouter build() {
|
||||
return new UpdateRouter(router);
|
||||
}
|
||||
|
||||
protected UpdateBuilder self() {
|
||||
|
@ -265,19 +267,19 @@ public class Router {
|
|||
}
|
||||
}
|
||||
|
||||
public static class CreateOptions extends Router{
|
||||
public static class CreateRouter extends Router{
|
||||
/**
|
||||
* Copy constructor
|
||||
*/
|
||||
private CreateOptions(Router router) {
|
||||
private CreateRouter(Router router) {
|
||||
super(router);
|
||||
}
|
||||
}
|
||||
public static class UpdateOptions extends Router{
|
||||
public static class UpdateRouter extends Router{
|
||||
/**
|
||||
* Copy constructor
|
||||
*/
|
||||
private UpdateOptions(Router router) {
|
||||
private UpdateRouter(Router router) {
|
||||
super(router);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,13 +16,15 @@
|
|||
*/
|
||||
package org.jclouds.openstack.neutron.v2.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
|
||||
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;
|
||||
|
||||
|
@ -216,7 +218,7 @@ public class Rule {
|
|||
/**
|
||||
* @return the Builder for creating a new SecurityGroupRule
|
||||
*/
|
||||
public static CreateBuilder createOptions(RuleDirection direction, String securityGroupId) {
|
||||
public static CreateBuilder createBuilder(RuleDirection direction, String securityGroupId) {
|
||||
return new CreateBuilder(direction, securityGroupId);
|
||||
}
|
||||
|
||||
|
@ -348,8 +350,8 @@ public class Rule {
|
|||
/**
|
||||
* @return a CreateOptions constructed with this Builder.
|
||||
*/
|
||||
public CreateOptions build() {
|
||||
return new CreateOptions(rule);
|
||||
public CreateRule build() {
|
||||
return new CreateRule(rule);
|
||||
}
|
||||
|
||||
protected CreateBuilder self() {
|
||||
|
@ -361,14 +363,14 @@ public class Rule {
|
|||
* Create and Update options - extend the domain class, passed to API update and create calls.
|
||||
* Essentially the same as the domain class. Ensure validation and safe typing.
|
||||
*/
|
||||
public static class CreateOptions extends Rule {
|
||||
private CreateOptions(Rule rule) {
|
||||
public static class CreateRule extends Rule {
|
||||
private CreateRule(Rule rule) {
|
||||
super(rule);
|
||||
checkNotNull(rule.getDirection(), "direction should not be null");
|
||||
checkNotNull(rule.getSecurityGroupId(), "security group id should not be null");
|
||||
checkState(rule.getPortRangeMax()>= rule.getPortRangeMin(),
|
||||
checkNotNull(this.getDirection(), "direction should not be null");
|
||||
checkNotNull(this.getSecurityGroupId(), "security group id should not be null");
|
||||
checkArgument(this.getPortRangeMax() >= this.getPortRangeMin(),
|
||||
"port range max should be greater than or equal to port range min");
|
||||
checkState(rule.getRemoteGroupId()==null || rule.getRemoteIpPrefix()==null,
|
||||
checkArgument(this.getRemoteGroupId() == null || this.getRemoteIpPrefix() == null,
|
||||
"You can specify either remote_group_id or remote_ip_prefix in the request body.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public enum RuleDirection {
|
|||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* This provides GSON enum support in jclouds.
|
||||
* */
|
||||
public static RuleDirection fromValue(String name){
|
||||
|
|
|
@ -44,7 +44,7 @@ public enum RuleEthertype {
|
|||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* This provides GSON enum support in jclouds.
|
||||
* */
|
||||
public static RuleEthertype fromValue(String name){
|
||||
|
|
|
@ -48,7 +48,7 @@ public enum RuleProtocol {
|
|||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* This provides GSON enum support in jclouds.
|
||||
* */
|
||||
public static RuleProtocol fromValue(String name){
|
||||
|
|
|
@ -95,7 +95,7 @@ public class SecurityGroup {
|
|||
* @return The collection of rules for this Security Group.
|
||||
*/
|
||||
public ImmutableList<Rule> getRules() {
|
||||
return rules!=null ? rules : ImmutableList.<Rule>of();
|
||||
return rules != null ? rules : ImmutableList.<Rule>of();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -137,7 +137,7 @@ public class SecurityGroup {
|
|||
/**
|
||||
* @return the Builder for creating a new SecurityGroup
|
||||
*/
|
||||
public static CreateBuilder createOptions() {
|
||||
public static CreateBuilder createBuilder() {
|
||||
return new CreateBuilder();
|
||||
}
|
||||
|
||||
|
@ -198,8 +198,8 @@ public class SecurityGroup {
|
|||
/**
|
||||
* @return a CreateOptions constructed with this Builder.
|
||||
*/
|
||||
public CreateOptions build() {
|
||||
return new CreateOptions(securityGroup);
|
||||
public CreateSecurityGroup build() {
|
||||
return new CreateSecurityGroup(securityGroup);
|
||||
}
|
||||
|
||||
protected CreateBuilder self() {
|
||||
|
@ -211,8 +211,8 @@ public class SecurityGroup {
|
|||
* Create and Update options - extend the domain class, passed to API update and create calls.
|
||||
* Essentially the same as the domain class. Ensure validation and safe typing.
|
||||
*/
|
||||
public static class CreateOptions extends SecurityGroup {
|
||||
private CreateOptions(SecurityGroup securityGroup) {
|
||||
public static class CreateSecurityGroup extends SecurityGroup {
|
||||
private CreateSecurityGroup(SecurityGroup securityGroup) {
|
||||
super(securityGroup);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,16 +16,18 @@
|
|||
*/
|
||||
package org.jclouds.openstack.neutron.v2.domain;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import javax.inject.Named;
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.util.Collection;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
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.ImmutableSet;
|
||||
|
||||
/**
|
||||
* A Neutron subnet
|
||||
|
@ -266,14 +268,14 @@ public class Subnet {
|
|||
/**
|
||||
* @return the Builder for creating a new Router
|
||||
*/
|
||||
public static CreateBuilder createOptions(String networkId, String cidr) {
|
||||
public static CreateBuilder createBuilder(String networkId, String cidr) {
|
||||
return new CreateBuilder(networkId, cidr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Builder for updating a Router
|
||||
*/
|
||||
public static UpdateBuilder updateOptions() {
|
||||
public static UpdateBuilder updateBuilder() {
|
||||
return new UpdateBuilder();
|
||||
}
|
||||
|
||||
|
@ -404,8 +406,8 @@ public class Subnet {
|
|||
/**
|
||||
* @return a CreateOptions constructed with this Builder.
|
||||
*/
|
||||
public CreateOptions build() {
|
||||
return new CreateOptions(subnet);
|
||||
public CreateSubnet build() {
|
||||
return new CreateSubnet(subnet);
|
||||
}
|
||||
|
||||
protected CreateBuilder self() {
|
||||
|
@ -426,8 +428,8 @@ public class Subnet {
|
|||
/**
|
||||
* @return a UpdateOptions constructed with this Builder.
|
||||
*/
|
||||
public UpdateOptions build() {
|
||||
return new UpdateOptions(subnet);
|
||||
public UpdateSubnet build() {
|
||||
return new UpdateSubnet(subnet);
|
||||
}
|
||||
|
||||
protected UpdateBuilder self() {
|
||||
|
@ -439,11 +441,11 @@ public class Subnet {
|
|||
* Create and Update options - extend the domain class, passed to API update and create calls.
|
||||
* Essentially the same as the domain class. Ensure validation and safe typing.
|
||||
*/
|
||||
public static class CreateOptions extends Subnet {
|
||||
public static class CreateSubnet extends Subnet {
|
||||
/**
|
||||
* Copy constructor
|
||||
*/
|
||||
private CreateOptions(Subnet subnet) {
|
||||
private CreateSubnet(Subnet subnet) {
|
||||
super(subnet);
|
||||
checkNotNull(subnet.networkId, "networkId should not be null");
|
||||
checkNotNull(subnet.cidr, "cidr should not be null");
|
||||
|
@ -454,11 +456,11 @@ public class Subnet {
|
|||
* Create and Update options - extend the domain class, passed to API update and create calls.
|
||||
* Essentially the same as the domain class. Ensure validation and safe typing.
|
||||
*/
|
||||
public static class UpdateOptions extends Subnet {
|
||||
public static class UpdateSubnet extends Subnet {
|
||||
/**
|
||||
* Copy constructor
|
||||
*/
|
||||
private UpdateOptions(Subnet subnet) {
|
||||
private UpdateSubnet(Subnet subnet) {
|
||||
super(subnet);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public enum VIFType {
|
|||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* This provides GSON enum support in jclouds.
|
||||
* */
|
||||
public static VIFType fromValue(String name){
|
||||
|
|
|
@ -39,7 +39,7 @@ public enum VNICType {
|
|||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* This provides GSON enum support in jclouds.
|
||||
* */
|
||||
public static VNICType fromValue(String name){
|
||||
|
|
|
@ -101,19 +101,19 @@ public interface FloatingIPApi {
|
|||
/**
|
||||
* Creates a floating IP.
|
||||
*
|
||||
* @param createOptions Options for creating a Floating IP
|
||||
* @param createFloatingIP Options for creating a Floating IP
|
||||
* @return the newly created Floating IP
|
||||
*/
|
||||
@Named("floatingip:create")
|
||||
@POST
|
||||
@SelectJson("floatingip")
|
||||
FloatingIP create(@WrapWith("floatingip") FloatingIP.CreateOptions createOptions);
|
||||
FloatingIP create(@WrapWith("floatingip") FloatingIP.CreateFloatingIP createFloatingIP);
|
||||
|
||||
/**
|
||||
* Update a Floating IP
|
||||
*
|
||||
* @param id the id of the Floating IP to update
|
||||
* @param updateOptions Contains only the attributes to update
|
||||
* @param updateFloatingIP Contains only the attributes to update
|
||||
* @return The modified Floating IP
|
||||
*/
|
||||
@Named("floatingip:update")
|
||||
|
@ -122,7 +122,7 @@ public interface FloatingIPApi {
|
|||
@SelectJson("floatingip")
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@Nullable
|
||||
FloatingIP update(@PathParam("id") String id, @WrapWith("floatingip") FloatingIP.UpdateOptions updateOptions);
|
||||
FloatingIP update(@PathParam("id") String id, @WrapWith("floatingip") FloatingIP.UpdateFloatingIP updateFloatingIP);
|
||||
|
||||
/**
|
||||
* Deletes the specified floatingIP
|
||||
|
|
|
@ -111,7 +111,7 @@ public interface RouterApi {
|
|||
@Named("router:create")
|
||||
@POST
|
||||
@SelectJson("router")
|
||||
Router create(@WrapWith("router") Router.CreateOptions router);
|
||||
Router create(@WrapWith("router") Router.CreateRouter router);
|
||||
|
||||
/**
|
||||
* Update a router
|
||||
|
@ -126,7 +126,7 @@ public interface RouterApi {
|
|||
@SelectJson("router")
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@Nullable
|
||||
Router update(@PathParam("id") String id, @WrapWith("router") Router.UpdateOptions router);
|
||||
Router update(@PathParam("id") String id, @WrapWith("router") Router.UpdateRouter router);
|
||||
|
||||
/**
|
||||
* Deletes the specified router
|
||||
|
|
|
@ -100,7 +100,7 @@ public interface SecurityGroupApi {
|
|||
SecurityGroup getSecurityGroup(@PathParam("id") String id);
|
||||
|
||||
/**
|
||||
* Create a new SecurityGroup.
|
||||
* Creates a new SecurityGroup.
|
||||
*
|
||||
* @param securityGroup Describes the security group to be created.
|
||||
* @return a reference of the newly-created security group
|
||||
|
@ -109,7 +109,7 @@ public interface SecurityGroupApi {
|
|||
@Named("secuity-group:create")
|
||||
@POST
|
||||
@SelectJson("security_group")
|
||||
SecurityGroup create(@WrapWith("security_group") SecurityGroup.CreateOptions securityGroup);
|
||||
SecurityGroup create(@WrapWith("security_group") SecurityGroup.CreateSecurityGroup securityGroup);
|
||||
|
||||
/**
|
||||
* Deletes the specified Security Group.
|
||||
|
@ -161,7 +161,7 @@ public interface SecurityGroupApi {
|
|||
Rule get(@PathParam("id") String id);
|
||||
|
||||
/**
|
||||
* Create a new Security Group Rule.
|
||||
* Creates a new Security Group Rule.
|
||||
*
|
||||
* @param securityGroupRule Describes the security group rule to be created.
|
||||
* @return a reference of the newly-created security group rule.
|
||||
|
@ -170,7 +170,7 @@ public interface SecurityGroupApi {
|
|||
@Named("security-group-rule:create")
|
||||
@POST
|
||||
@SelectJson("security_group_rule")
|
||||
Rule create(@WrapWith("security_group_rule") Rule.CreateOptions securityGroupRule);
|
||||
Rule create(@WrapWith("security_group_rule") Rule.CreateRule securityGroupRule);
|
||||
|
||||
/**
|
||||
* Deletes the specified Security Group Rule.
|
||||
|
|
|
@ -16,9 +16,17 @@
|
|||
*/
|
||||
package org.jclouds.openstack.neutron.v2.features;
|
||||
|
||||
import com.google.common.annotations.Beta;
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import javax.inject.Named;
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.Fallbacks;
|
||||
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
|
||||
import org.jclouds.collect.PagedIterable;
|
||||
|
@ -37,16 +45,9 @@ import org.jclouds.rest.annotations.SelectJson;
|
|||
import org.jclouds.rest.annotations.Transform;
|
||||
import org.jclouds.rest.annotations.WrapWith;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import com.google.common.annotations.Beta;
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
/**
|
||||
* Provides access to Network operations for the OpenStack Networking (Neutron) v2 API.
|
||||
|
@ -108,7 +109,7 @@ public interface NetworkApi {
|
|||
@Named("network:create")
|
||||
@POST
|
||||
@SelectJson("network")
|
||||
Network create(@WrapWith("network") Network.CreateOptions network);
|
||||
Network create(@WrapWith("network") Network.CreateNetwork network);
|
||||
|
||||
/**
|
||||
* Create multiple networks
|
||||
|
@ -119,7 +120,7 @@ public interface NetworkApi {
|
|||
@Named("network:createBulk")
|
||||
@POST
|
||||
@SelectJson("networks")
|
||||
FluentIterable<Network> createBulk(@WrapWith("networks") ImmutableList<Network.CreateOptions> networks);
|
||||
FluentIterable<Network> createBulk(@WrapWith("networks") ImmutableList<Network.CreateNetwork> networks);
|
||||
|
||||
/**
|
||||
* Update a network
|
||||
|
@ -134,7 +135,7 @@ public interface NetworkApi {
|
|||
@SelectJson("network")
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
@Nullable
|
||||
Network update(@PathParam("id") String id, @WrapWith("network") Network.UpdateOptions network);
|
||||
Network update(@PathParam("id") String id, @WrapWith("network") Network.UpdateNetwork network);
|
||||
|
||||
/**
|
||||
* Deletes the specified network
|
||||
|
|
|
@ -107,7 +107,7 @@ public interface PortApi {
|
|||
@Named("port:create")
|
||||
@POST
|
||||
@SelectJson("port")
|
||||
Port create(@WrapWith("port") Port.CreateOptions port);
|
||||
Port create(@WrapWith("port") Port.CreatePort port);
|
||||
|
||||
/**
|
||||
* Create multiple ports
|
||||
|
@ -118,7 +118,7 @@ public interface PortApi {
|
|||
@Named("port:createBulk")
|
||||
@POST
|
||||
@SelectJson("ports")
|
||||
FluentIterable<Port> createBulk(@WrapWith("ports") List<Port.CreateOptions> ports);
|
||||
FluentIterable<Port> createBulk(@WrapWith("ports") List<Port.CreatePort> ports);
|
||||
|
||||
/**
|
||||
* Update a port
|
||||
|
@ -132,7 +132,7 @@ public interface PortApi {
|
|||
@Path("/{id}")
|
||||
@SelectJson("port")
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
Port update(@PathParam("id") String id, @WrapWith("port") Port.UpdateOptions port);
|
||||
Port update(@PathParam("id") String id, @WrapWith("port") Port.UpdatePort port);
|
||||
|
||||
/**
|
||||
* Delete a port
|
||||
|
|
|
@ -104,7 +104,7 @@ public interface SubnetApi {
|
|||
@Named("subnet:create")
|
||||
@POST
|
||||
@SelectJson("subnet")
|
||||
Subnet create(@WrapWith("subnet") Subnet.CreateOptions subnet);
|
||||
Subnet create(@WrapWith("subnet") Subnet.CreateSubnet subnet);
|
||||
|
||||
/**
|
||||
* Create multiple subnets
|
||||
|
@ -115,7 +115,7 @@ public interface SubnetApi {
|
|||
@Named("subnet:createBulk")
|
||||
@POST
|
||||
@SelectJson("subnets")
|
||||
FluentIterable<Subnet> createBulk(@WrapWith("subnets") List<Subnet.CreateOptions> subnets);
|
||||
FluentIterable<Subnet> createBulk(@WrapWith("subnets") List<Subnet.CreateSubnet> subnets);
|
||||
|
||||
/**
|
||||
* Update a subnet
|
||||
|
@ -128,7 +128,7 @@ public interface SubnetApi {
|
|||
@Path("/{id}")
|
||||
@SelectJson("subnet")
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
Subnet update(@PathParam("id") String id, @WrapWith("subnet") Subnet.UpdateOptions subnet);
|
||||
Subnet update(@PathParam("id") String id, @WrapWith("subnet") Subnet.UpdateSubnet subnet);
|
||||
|
||||
/**
|
||||
* Delete a subnet
|
||||
|
|
|
@ -16,15 +16,15 @@
|
|||
*/
|
||||
package org.jclouds.openstack.neutron.v2.functions;
|
||||
|
||||
import com.google.inject.TypeLiteral;
|
||||
import org.jclouds.http.functions.ParseJson;
|
||||
import org.jclouds.json.Json;
|
||||
import org.jclouds.openstack.neutron.v2.domain.SecurityGroup;
|
||||
import org.jclouds.openstack.neutron.v2.domain.SecurityGroups;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.http.functions.ParseJson;
|
||||
import org.jclouds.json.Json;
|
||||
import org.jclouds.openstack.neutron.v2.domain.SecurityGroups;
|
||||
|
||||
import com.google.inject.TypeLiteral;
|
||||
|
||||
/**
|
||||
* Used by jclouds to provide more specific collections and fallbacks.
|
||||
*/
|
||||
|
|
|
@ -54,13 +54,13 @@ public class FloatingIPApiLiveTest extends BaseNeutronApiLiveTest {
|
|||
|
||||
try {
|
||||
network = networkApi.create(
|
||||
Network.createOptions("jclouds-network-test").external(true).networkType(NetworkType.LOCAL).build());
|
||||
Network.createBuilder("jclouds-network-test").external(true).networkType(NetworkType.LOCAL).build());
|
||||
assertNotNull(network);
|
||||
|
||||
ipv4SubnetId = subnetApi.create(Subnet.createOptions(network.getId(), "198.51.100.0/24").ipVersion(4)
|
||||
ipv4SubnetId = subnetApi.create(Subnet.createBuilder(network.getId(), "198.51.100.0/24").ipVersion(4)
|
||||
.name("JClouds-Live-IPv4-Subnet").build()).getId();
|
||||
|
||||
floatingIPApi.create(FloatingIP.createOptions(network.getId()).build());
|
||||
floatingIPApi.create(FloatingIP.createBuilder(network.getId()).build());
|
||||
|
||||
/* List and Get test */
|
||||
Set<FloatingIP> floatingIPs = floatingIPApi.list().concat().toSet();
|
||||
|
|
|
@ -54,7 +54,7 @@ public class FloatingIPApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
FloatingIPApi api = neutronApi.getFloatingIPApi("RegionOne").get();
|
||||
|
||||
FloatingIP.CreateOptions createFip = FloatingIP.createOptions("376da547-b977-4cfe-9cba-275c80debf57")
|
||||
FloatingIP.CreateFloatingIP createFip = FloatingIP.createBuilder("376da547-b977-4cfe-9cba-275c80debf57")
|
||||
.portId("ce705c24-c1ef-408a-bda3-7bbd946164ab")
|
||||
.build();
|
||||
|
||||
|
@ -94,7 +94,7 @@ public class FloatingIPApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
FloatingIPApi api = neutronApi.getFloatingIPApi("RegionOne").get();
|
||||
|
||||
FloatingIP.CreateOptions createFip = FloatingIP.createOptions("376da547-b977-4cfe-9cba-275c80debf57")
|
||||
FloatingIP.CreateFloatingIP createFip = FloatingIP.createBuilder("376da547-b977-4cfe-9cba-275c80debf57")
|
||||
.portId("ce705c24-c1ef-408a-bda3-7bbd946164ab")
|
||||
.build();
|
||||
|
||||
|
@ -295,11 +295,11 @@ public class FloatingIPApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
FloatingIPApi api = neutronApi.getFloatingIPApi("RegionOne").get();
|
||||
|
||||
FloatingIP.UpdateOptions updateOptions = FloatingIP.updateOptions()
|
||||
FloatingIP.UpdateFloatingIP updateFloatingIP = FloatingIP.updateBuilder()
|
||||
.portId("fc861431-0e6c-4842-a0ed-e2363f9bc3a8")
|
||||
.build();
|
||||
|
||||
FloatingIP floatingIP = api.update("12345", updateOptions);
|
||||
FloatingIP floatingIP = api.update("12345", updateFloatingIP);
|
||||
|
||||
/*
|
||||
* Check request
|
||||
|
@ -328,9 +328,9 @@ public class FloatingIPApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
FloatingIPApi api = neutronApi.getFloatingIPApi("RegionOne").get();
|
||||
|
||||
FloatingIP.UpdateOptions updateOptions = FloatingIP.updateOptions().build();
|
||||
FloatingIP.UpdateFloatingIP updateFloatingIP = FloatingIP.updateBuilder().build();
|
||||
|
||||
FloatingIP floatingIP = api.update("12345", updateOptions);
|
||||
FloatingIP floatingIP = api.update("12345", updateFloatingIP);
|
||||
|
||||
/*
|
||||
* Check request
|
||||
|
@ -359,11 +359,11 @@ public class FloatingIPApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
FloatingIPApi api = neutronApi.getFloatingIPApi("RegionOne").get();
|
||||
|
||||
FloatingIP.UpdateOptions updateOptions = FloatingIP.updateOptions()
|
||||
FloatingIP.UpdateFloatingIP updateFloatingIP = FloatingIP.updateBuilder()
|
||||
.portId("fc861431-0e6c-4842-a0ed-e2363f9bc3a8")
|
||||
.build();
|
||||
|
||||
FloatingIP floatingIP = api.update("12345", updateOptions);
|
||||
FloatingIP floatingIP = api.update("12345", updateFloatingIP);
|
||||
|
||||
/*
|
||||
* Check request
|
||||
|
|
|
@ -23,12 +23,6 @@ import static org.testng.Assert.assertTrue;
|
|||
|
||||
import java.util.Set;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.openstack.neutron.v2.domain.ExternalGatewayInfo;
|
||||
import org.jclouds.openstack.neutron.v2.domain.Network;
|
||||
import org.jclouds.openstack.neutron.v2.domain.NetworkType;
|
||||
|
@ -55,13 +49,13 @@ public class RouterApiLiveTest extends BaseNeutronApiLiveTest {
|
|||
SubnetApi subnetApi = api.getSubnetApi(region);
|
||||
|
||||
Network network = networkApi.create(
|
||||
Network.createOptions("jclouds-network-test").external(true).networkType(NetworkType.LOCAL).build());
|
||||
Network.createBuilder("jclouds-network-test").external(true).networkType(NetworkType.LOCAL).build());
|
||||
assertNotNull(network);
|
||||
|
||||
Subnet subnet = subnetApi.create(Subnet.createOptions(network.getId(), "192.168.0.0/16").ipVersion(4).build());
|
||||
Subnet subnet = subnetApi.create(Subnet.createBuilder(network.getId(), "192.168.0.0/16").ipVersion(4).build());
|
||||
assertNotNull(subnet);
|
||||
|
||||
Router router = routerApi.create(Router.createOptions().name("jclouds-router-test")
|
||||
Router router = routerApi.create(Router.createBuilder().name("jclouds-router-test")
|
||||
.externalGatewayInfo(ExternalGatewayInfo.builder().networkId(network.getId()).build()).build());
|
||||
assertNotNull(router);
|
||||
|
||||
|
@ -80,7 +74,7 @@ public class RouterApiLiveTest extends BaseNeutronApiLiveTest {
|
|||
assertEquals(routerGet.getId(), router.getId());
|
||||
assertEquals(routerGet.getExternalGatewayInfo(), router.getExternalGatewayInfo());
|
||||
|
||||
Router routerUpdate = routerApi.update(router.getId(), Router.updateOptions().name("jclouds-router-test-rename").build());
|
||||
Router routerUpdate = routerApi.update(router.getId(), Router.updateBuilder().name("jclouds-router-test-rename").build());
|
||||
assertNotNull(routerUpdate);
|
||||
assertEquals(routerUpdate.getName(), "jclouds-router-test-rename");
|
||||
|
||||
|
@ -101,19 +95,19 @@ public class RouterApiLiveTest extends BaseNeutronApiLiveTest {
|
|||
NetworkApi networkApi = api.getNetworkApi(region);
|
||||
SubnetApi subnetApi = api.getSubnetApi(region);
|
||||
|
||||
Network network = networkApi.create(Network.createOptions("jclouds-network-test").external(true).networkType(NetworkType.LOCAL).build());
|
||||
Network network = networkApi.create(Network.createBuilder("jclouds-network-test").external(true).networkType(NetworkType.LOCAL).build());
|
||||
assertNotNull(network);
|
||||
|
||||
Subnet subnet = subnetApi.create(Subnet.createOptions(network.getId(), "192.168.0.0/16").ipVersion(4).build());
|
||||
Subnet subnet = subnetApi.create(Subnet.createBuilder(network.getId(), "192.168.0.0/16").ipVersion(4).build());
|
||||
assertNotNull(subnet);
|
||||
|
||||
Network network2 = networkApi.create(Network.createOptions("jclouds-network-test2").external(true).networkType(NetworkType.LOCAL).build());
|
||||
Network network2 = networkApi.create(Network.createBuilder("jclouds-network-test2").external(true).networkType(NetworkType.LOCAL).build());
|
||||
assertNotNull(network2);
|
||||
|
||||
Subnet subnet2 = subnetApi.create(Subnet.createOptions(network2.getId(), "192.169.0.0/16").ipVersion(4).build());
|
||||
Subnet subnet2 = subnetApi.create(Subnet.createBuilder(network2.getId(), "192.169.0.0/16").ipVersion(4).build());
|
||||
assertNotNull(subnet2);
|
||||
|
||||
Router router = routerApi.create(Router.createOptions().name("jclouds-router-test").build());
|
||||
Router router = routerApi.create(Router.createBuilder().name("jclouds-router-test").build());
|
||||
assertNotNull(router);
|
||||
|
||||
RouterInterface routerInterface = routerApi.addInterfaceForSubnet(router.getId(), subnet.getId());
|
||||
|
@ -139,25 +133,25 @@ public class RouterApiLiveTest extends BaseNeutronApiLiveTest {
|
|||
SubnetApi subnetApi = api.getSubnetApi(region);
|
||||
PortApi portApi = api.getPortApi(region);
|
||||
|
||||
Network network = networkApi.create(Network.createOptions("jclouds-network-test").external(true).networkType(NetworkType.LOCAL).build());
|
||||
Network network = networkApi.create(Network.createBuilder("jclouds-network-test").external(true).networkType(NetworkType.LOCAL).build());
|
||||
assertNotNull(network);
|
||||
|
||||
Subnet subnet = subnetApi.create(Subnet.createOptions(network.getId(), "192.168.0.0/16").ipVersion(4).build());
|
||||
Subnet subnet = subnetApi.create(Subnet.createBuilder(network.getId(), "192.168.0.0/16").ipVersion(4).build());
|
||||
assertNotNull(subnet);
|
||||
|
||||
Network network2 = networkApi.create(Network.createOptions("jclouds-network-test2").external(true).networkType(NetworkType.LOCAL).build());
|
||||
Network network2 = networkApi.create(Network.createBuilder("jclouds-network-test2").external(true).networkType(NetworkType.LOCAL).build());
|
||||
assertNotNull(network2);
|
||||
|
||||
Subnet subnet2 = subnetApi.create(Subnet.createOptions(network2.getId(), "192.169.0.0/16").ipVersion(4).build());
|
||||
Subnet subnet2 = subnetApi.create(Subnet.createBuilder(network2.getId(), "192.169.0.0/16").ipVersion(4).build());
|
||||
assertNotNull(subnet2);
|
||||
|
||||
Port port = portApi.create(Port.createOptions(network.getId()).build());
|
||||
Port port = portApi.create(Port.createBuilder(network.getId()).build());
|
||||
assertNotNull(port);
|
||||
|
||||
Port port2 = portApi.create(Port.createOptions(network2.getId()).build());
|
||||
Port port2 = portApi.create(Port.createBuilder(network2.getId()).build());
|
||||
assertNotNull(port2);
|
||||
|
||||
Router router = routerApi.create(Router.createOptions().name("jclouds-router-test").build());
|
||||
Router router = routerApi.create(Router.createBuilder().name("jclouds-router-test").build());
|
||||
assertNotNull(router);
|
||||
|
||||
RouterInterface routerInterface = routerApi.addInterfaceForPort(router.getId(), port.getId());
|
||||
|
|
|
@ -27,17 +27,6 @@ import java.io.IOException;
|
|||
import java.net.URISyntaxException;
|
||||
import java.util.List;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
import static org.testng.Assert.fail;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.List;
|
||||
|
||||
import org.jclouds.openstack.neutron.v2.NeutronApi;
|
||||
import org.jclouds.openstack.neutron.v2.domain.ExternalGatewayInfo;
|
||||
import org.jclouds.openstack.neutron.v2.domain.NetworkStatus;
|
||||
|
@ -69,7 +58,7 @@ public class RouterApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
RouterApi api = neutronApi.getRouterApi("RegionOne").get();
|
||||
|
||||
Router.CreateOptions createRouter = Router.createOptions().name("another_router").adminStateUp(true)
|
||||
Router.CreateRouter createRouter = Router.createBuilder().name("another_router").adminStateUp(true)
|
||||
.externalGatewayInfo(ExternalGatewayInfo.builder().networkId("8ca37218-28ff-41cb-9b10-039601ea7e6b").build())
|
||||
.build();
|
||||
|
||||
|
@ -107,11 +96,11 @@ public class RouterApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
RouterApi api = neutronApi.getRouterApi("RegionOne").get();
|
||||
|
||||
Router.CreateOptions createRouter = Router.createOptions().name("another_router").adminStateUp(true)
|
||||
Router.CreateRouter createRouter = Router.createBuilder().name("another_router").adminStateUp(true)
|
||||
.externalGatewayInfo(ExternalGatewayInfo.builder().networkId("8ca37218-28ff-41cb-9b10-039601ea7e6b").build())
|
||||
.build();
|
||||
|
||||
Router router = api.create(createRouter);
|
||||
api.create(createRouter);
|
||||
fail("Should have failed with not found exception");
|
||||
|
||||
} finally {
|
||||
|
@ -306,12 +295,12 @@ public class RouterApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
RouterApi api = neutronApi.getRouterApi("RegionOne").get();
|
||||
|
||||
Router.UpdateOptions updateOptions = Router.updateOptions()
|
||||
Router.UpdateRouter updateRouter = Router.updateBuilder()
|
||||
.externalGatewayInfo(
|
||||
ExternalGatewayInfo.builder().networkId("8ca37218-28ff-41cb-9b10-039601ea7e6b").build())
|
||||
.build();
|
||||
|
||||
Router router = api.update("12345", updateOptions);
|
||||
Router router = api.update("12345", updateRouter);
|
||||
|
||||
/*
|
||||
* Check request
|
||||
|
@ -344,12 +333,12 @@ public class RouterApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
RouterApi api = neutronApi.getRouterApi("RegionOne").get();
|
||||
|
||||
Router.UpdateOptions updateOptions = Router.updateOptions()
|
||||
Router.UpdateRouter updateRouter = Router.updateBuilder()
|
||||
.externalGatewayInfo(
|
||||
ExternalGatewayInfo.builder().networkId("8ca37218-28ff-41cb-9b10-039601ea7e6b").build())
|
||||
.build();
|
||||
|
||||
Router router = api.update("12345", updateOptions);
|
||||
Router router = api.update("12345", updateRouter);
|
||||
|
||||
/*
|
||||
* Check request
|
||||
|
|
|
@ -40,49 +40,60 @@ public class SecurityGroupApiLiveTest extends BaseNeutronApiLiveTest {
|
|||
*/
|
||||
public void testCreateUpdateAndDeleteSecurityGroup() {
|
||||
for (String region : api.getConfiguredRegions()) {
|
||||
SecurityGroupApi sgApi = api.getSecurityGroupApi(region).get();
|
||||
SecurityGroupApi sgApi = null;
|
||||
Rule rule = null;
|
||||
SecurityGroup securityGroup = null;
|
||||
|
||||
SecurityGroup securityGroup = sgApi.create(
|
||||
SecurityGroup.createOptions().name("jclouds-test").description("jclouds test security group").build());
|
||||
assertNotNull(securityGroup);
|
||||
try {
|
||||
sgApi = api.getSecurityGroupApi(region).get();
|
||||
|
||||
Rule rule = sgApi.create(
|
||||
Rule.createOptions(RuleDirection.EGRESS, securityGroup.getId())
|
||||
.ethertype(RuleEthertype.IPV6)
|
||||
.portRangeMax(90)
|
||||
.portRangeMin(80)
|
||||
.protocol(RuleProtocol.TCP)
|
||||
.build());
|
||||
securityGroup = sgApi.create(
|
||||
SecurityGroup.createBuilder().name("jclouds-test").description("jclouds test security group")
|
||||
.build());
|
||||
assertNotNull(securityGroup);
|
||||
|
||||
assertNotNull(rule);
|
||||
rule = sgApi.create(
|
||||
Rule.createBuilder(RuleDirection.EGRESS, securityGroup.getId())
|
||||
.ethertype(RuleEthertype.IPV6)
|
||||
.portRangeMax(90)
|
||||
.portRangeMin(80)
|
||||
.protocol(RuleProtocol.TCP)
|
||||
.build());
|
||||
|
||||
// Refresh
|
||||
securityGroup = sgApi.getSecurityGroup(securityGroup.getId());
|
||||
assertNotNull(rule);
|
||||
|
||||
assertEquals(securityGroup.getName(), "jclouds-test");
|
||||
assertEquals(securityGroup.getDescription(), "jclouds test security group");
|
||||
// Refresh
|
||||
securityGroup = sgApi.getSecurityGroup(securityGroup.getId());
|
||||
|
||||
assertEquals(securityGroup.getRules().size(), 3, "Expected 2 default rules");
|
||||
assertEquals(securityGroup.getName(), "jclouds-test");
|
||||
assertEquals(securityGroup.getDescription(), "jclouds test security group");
|
||||
|
||||
Rule newSecGroupRule = null;
|
||||
for(Rule sgr : securityGroup.getRules()) {
|
||||
if(sgr.getId().equals(rule.getId())) {
|
||||
newSecGroupRule = sgr;
|
||||
break;
|
||||
assertEquals(securityGroup.getRules().size(), 3);
|
||||
|
||||
Rule newSecGroupRule = null;
|
||||
|
||||
for (Rule sgr : securityGroup.getRules()) {
|
||||
if (sgr.getId().equals(rule.getId())) {
|
||||
newSecGroupRule = sgr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assertNotNull(newSecGroupRule, "Did not find the new rule in the group.");
|
||||
|
||||
assertEquals(rule, newSecGroupRule);
|
||||
|
||||
assertEquals(rule.getEthertype(), RuleEthertype.IPV6);
|
||||
assertEquals(rule.getProtocol(), RuleProtocol.TCP);
|
||||
assertEquals(rule.getPortRangeMax().intValue(), 90);
|
||||
assertEquals(rule.getPortRangeMin().intValue(), 80);
|
||||
assertEquals(rule.getDirection(), RuleDirection.EGRESS);
|
||||
} finally {
|
||||
try {
|
||||
assertTrue(sgApi.deleteRule(rule.getId()));
|
||||
} finally {
|
||||
assertTrue(sgApi.deleteSecurityGroup(securityGroup.getId()));
|
||||
}
|
||||
}
|
||||
assertNotNull(newSecGroupRule, "Did not find the new rule in the group.");
|
||||
|
||||
assertEquals(rule, newSecGroupRule);
|
||||
|
||||
assertEquals(rule.getEthertype(), RuleEthertype.IPV6);
|
||||
assertEquals(rule.getProtocol(), RuleProtocol.TCP);
|
||||
assertEquals(rule.getPortRangeMax().intValue(), 90);
|
||||
assertEquals(rule.getPortRangeMin().intValue(), 80);
|
||||
assertEquals(rule.getDirection(), RuleDirection.EGRESS);
|
||||
|
||||
assertTrue(sgApi.deleteRule(rule.getId()));
|
||||
assertTrue(sgApi.deleteSecurityGroup(securityGroup.getId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public class SecurityGroupApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
SecurityGroupApi api = neutronApi.getSecurityGroupApi("RegionOne").get();
|
||||
|
||||
SecurityGroup.CreateOptions createSecurityGroup = SecurityGroup.createOptions().name("new-webservers")
|
||||
SecurityGroup.CreateSecurityGroup createSecurityGroup = SecurityGroup.createBuilder().name("new-webservers")
|
||||
.description("security group for webservers")
|
||||
.build();
|
||||
|
||||
|
@ -101,7 +101,7 @@ public class SecurityGroupApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
SecurityGroupApi api = neutronApi.getSecurityGroupApi("RegionOne").get();
|
||||
|
||||
SecurityGroup.CreateOptions createSecurityGroup = SecurityGroup.createOptions().name("new-webservers")
|
||||
SecurityGroup.CreateSecurityGroup createSecurityGroup = SecurityGroup.createBuilder().name("new-webservers")
|
||||
.description("security group for webservers")
|
||||
.build();
|
||||
|
||||
|
@ -121,7 +121,7 @@ public class SecurityGroupApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
SecurityGroupApi api = neutronApi.getSecurityGroupApi("RegionOne").get();
|
||||
|
||||
Rule.CreateOptions createSecurityGroupRule = Rule.createOptions(
|
||||
Rule.CreateRule createSecurityGroupRule = Rule.createBuilder(
|
||||
RuleDirection.INGRESS, "a7734e61-b545-452d-a3cd-0189cbd9747a")
|
||||
.portRangeMin(80)
|
||||
.portRangeMax(80)
|
||||
|
@ -168,7 +168,7 @@ public class SecurityGroupApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
SecurityGroupApi api = neutronApi.getSecurityGroupApi("RegionOne").get();
|
||||
|
||||
Rule.CreateOptions createSecurityGroupRule = Rule.createOptions(
|
||||
Rule.CreateRule createSecurityGroupRule = Rule.createBuilder(
|
||||
RuleDirection.INGRESS, "a7734e61-b545-452d-a3cd-0189cbd9747a")
|
||||
.portRangeMin(80)
|
||||
.portRangeMax(80)
|
||||
|
@ -205,6 +205,7 @@ public class SecurityGroupApiMockTest extends BaseNeutronApiMockTest {
|
|||
*/
|
||||
assertNotNull(securityGroups);
|
||||
assertEquals(securityGroups.size(), 2);
|
||||
// Ensures the full collection is parsed and ordering is preserved.
|
||||
assertEquals(securityGroups.first().get().getId(), "85cc3048-abc3-43cc-89b3-377341426ac5");
|
||||
assertEquals(securityGroups.get(1).getId(), "85cc3048-abc3-43cc-89b3-377341426ac52");
|
||||
} finally {
|
||||
|
@ -261,6 +262,7 @@ public class SecurityGroupApiMockTest extends BaseNeutronApiMockTest {
|
|||
*/
|
||||
assertNotNull(rules);
|
||||
assertEquals(rules.size(), 4);
|
||||
// Ensures the full collection is parsed and ordering is preserved.
|
||||
assertEquals(rules.first().get().getId(), "3c0e45ff-adaf-4124-b083-bf390e5482ff");
|
||||
assertEquals(rules.get(3).getId(), "f7d45c89-008e-4bab-88ad-d6811724c51c");
|
||||
} finally {
|
||||
|
@ -321,6 +323,7 @@ public class SecurityGroupApiMockTest extends BaseNeutronApiMockTest {
|
|||
*/
|
||||
assertNotNull(securityGroups);
|
||||
assertEquals(securityGroups.size(), 4);
|
||||
// Ensures ordering is preserved and both pages are parsed.
|
||||
assertEquals(securityGroups.get(0).getId(), "85cc3048-abc3-43cc-89b3-377341426ac5");
|
||||
assertEquals(securityGroups.get(3).getId(), "85cc3048-abc3-43cc-89b3-377341426ac524");
|
||||
|
||||
|
@ -385,6 +388,7 @@ public class SecurityGroupApiMockTest extends BaseNeutronApiMockTest {
|
|||
*/
|
||||
assertNotNull(rules);
|
||||
assertEquals(rules.size(), 8);
|
||||
// Ensures both pages are tested and ordering is preserved.
|
||||
assertEquals(rules.get(0).getId(), "3c0e45ff-adaf-4124-b083-bf390e5482ff");
|
||||
assertEquals(rules.get(7).getId(), "f7d45c89-008e-4bab-88ad-d6811724c51c2");
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@ public class NetworkApiLiveTest extends BaseNeutronApiLiveTest {
|
|||
public void testCreateUpdateAndDeleteNetwork() {
|
||||
for (String region : api.getConfiguredRegions()) {
|
||||
NetworkApi networkApi = api.getNetworkApi(region);
|
||||
Network net = networkApi.create(Network.createOptions("jclouds-test").networkType(NetworkType.LOCAL).build());
|
||||
Network test = networkApi.create(Network.createOptions("jclouds-test").build());
|
||||
Network net = networkApi.create(Network.createBuilder("jclouds-test").networkType(NetworkType.LOCAL).build());
|
||||
Network test = networkApi.create(Network.createBuilder("jclouds-test").build());
|
||||
assertNotNull(net);
|
||||
|
||||
/* List and get tests */
|
||||
|
@ -57,7 +57,7 @@ public class NetworkApiLiveTest extends BaseNeutronApiLiveTest {
|
|||
assertEquals(network.getName(), "jclouds-test");
|
||||
assertEquals(network.getNetworkType(), NetworkType.LOCAL);
|
||||
assertTrue(network.getSubnets().isEmpty());
|
||||
assertNotNull(networkApi.update(net.getId(), Network.updateOptions().name("jclouds-live-test").build()));
|
||||
assertNotNull(networkApi.update(net.getId(), Network.updateBuilder().name("jclouds-live-test").build()));
|
||||
|
||||
network = networkApi.get(net.getId());
|
||||
|
||||
|
@ -65,7 +65,7 @@ public class NetworkApiLiveTest extends BaseNeutronApiLiveTest {
|
|||
assertEquals(network.getName(), "jclouds-live-test");
|
||||
assertTrue(network.getSubnets().isEmpty());
|
||||
|
||||
Network net2 = networkApi.create(Network.createOptions("jclouds-test2").networkType(NetworkType.LOCAL).build());
|
||||
Network net2 = networkApi.create(Network.createBuilder("jclouds-test2").networkType(NetworkType.LOCAL).build());
|
||||
assertNotNull(net2);
|
||||
|
||||
assertTrue(networkApi.delete(net.getId()));
|
||||
|
@ -79,9 +79,9 @@ public class NetworkApiLiveTest extends BaseNeutronApiLiveTest {
|
|||
NetworkApi networkApi = api.getNetworkApi(region);
|
||||
Set<Network> nets = networkApi.createBulk(
|
||||
ImmutableList.of(
|
||||
Network.createOptions("jclouds-live-test-1").networkType(NetworkType.LOCAL).adminStateUp(true).build(),
|
||||
Network.createOptions("jclouds-live-test-2").networkType(NetworkType.LOCAL).adminStateUp(false).build(),
|
||||
Network.createOptions("jclouds-live-test-3").networkType(NetworkType.LOCAL).adminStateUp(false).build()
|
||||
Network.createBuilder("jclouds-live-test-1").networkType(NetworkType.LOCAL).adminStateUp(true).build(),
|
||||
Network.createBuilder("jclouds-live-test-2").networkType(NetworkType.LOCAL).adminStateUp(false).build(),
|
||||
Network.createBuilder("jclouds-live-test-3").networkType(NetworkType.LOCAL).adminStateUp(false).build()
|
||||
)
|
||||
).toSet();
|
||||
Set<Network> existingNets = networkApi.list().concat().toSet();
|
||||
|
|
|
@ -56,7 +56,7 @@ public class NetworkApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
NetworkApi api = neutronApi.getNetworkApi("RegionOne");
|
||||
|
||||
Network.CreateOptions createNetwork = Network.createOptions("jclouds-wibble")
|
||||
Network.CreateNetwork createNetwork = Network.createBuilder("jclouds-wibble")
|
||||
.networkType(NetworkType.LOCAL)
|
||||
.build();
|
||||
|
||||
|
@ -92,7 +92,7 @@ public class NetworkApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
NetworkApi api = neutronApi.getNetworkApi("RegionOne");
|
||||
|
||||
Network.CreateOptions createNetwork = Network.createOptions("jclouds-wibble")
|
||||
Network.CreateNetwork createNetwork = Network.createBuilder("jclouds-wibble")
|
||||
.networkType(NetworkType.LOCAL)
|
||||
.build();
|
||||
|
||||
|
@ -285,11 +285,11 @@ public class NetworkApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
NetworkApi api = neutronApi.getNetworkApi("RegionOne");
|
||||
|
||||
Network.CreateOptions createNetwork1 = Network.createOptions("jclouds-wibble")
|
||||
Network.CreateNetwork createNetwork1 = Network.createBuilder("jclouds-wibble")
|
||||
.networkType(NetworkType.LOCAL)
|
||||
.build();
|
||||
|
||||
Network.CreateOptions createNetwork2 = Network.createOptions("jclouds-wibble2")
|
||||
Network.CreateNetwork createNetwork2 = Network.createBuilder("jclouds-wibble2")
|
||||
.networkType(NetworkType.LOCAL)
|
||||
.build();
|
||||
|
||||
|
@ -332,11 +332,11 @@ public class NetworkApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
NetworkApi api = neutronApi.getNetworkApi("RegionOne");
|
||||
|
||||
Network.CreateOptions createNetwork1 = Network.createOptions("jclouds-wibble")
|
||||
Network.CreateNetwork createNetwork1 = Network.createBuilder("jclouds-wibble")
|
||||
.networkType(NetworkType.LOCAL)
|
||||
.build();
|
||||
|
||||
Network.CreateOptions createNetwork2 = Network.createOptions("jclouds-wibble2")
|
||||
Network.CreateNetwork createNetwork2 = Network.createBuilder("jclouds-wibble2")
|
||||
.networkType(NetworkType.LOCAL)
|
||||
.build();
|
||||
|
||||
|
@ -355,7 +355,7 @@ public class NetworkApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
NetworkApi api = neutronApi.getNetworkApi("RegionOne");
|
||||
|
||||
Network.UpdateOptions updateNetwork = Network.updateOptions()
|
||||
Network.UpdateNetwork updateNetwork = Network.updateBuilder()
|
||||
.name("jclouds-wibble-updated")
|
||||
.networkType(NetworkType.LOCAL)
|
||||
.build();
|
||||
|
@ -388,7 +388,7 @@ public class NetworkApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
NetworkApi api = neutronApi.getNetworkApi("RegionOne");
|
||||
|
||||
Network.UpdateOptions updateNetwork = Network.updateOptions()
|
||||
Network.UpdateNetwork updateNetwork = Network.updateBuilder()
|
||||
.name("jclouds-wibble-updated")
|
||||
.networkType(NetworkType.LOCAL)
|
||||
.build();
|
||||
|
|
|
@ -48,19 +48,19 @@ public class PortApiLiveTest extends BaseNeutronApiLiveTest {
|
|||
SubnetApi subnetApi = api.getSubnetApi(region);
|
||||
PortApi portApi = api.getPortApi(region);
|
||||
String networkId = networkApi.create(
|
||||
Network.createOptions("JClouds-Live-Network").networkType(NetworkType.LOCAL).build()).getId();
|
||||
String ipv4SubnetId = subnetApi.create(Subnet.createOptions(networkId, "198.51.100.0/24").ipVersion(4)
|
||||
Network.createBuilder("JClouds-Live-Network").networkType(NetworkType.LOCAL).build()).getId();
|
||||
String ipv4SubnetId = subnetApi.create(Subnet.createBuilder(networkId, "198.51.100.0/24").ipVersion(4)
|
||||
.name("JClouds-Live-IPv4-Subnet").build()).getId();
|
||||
String ipv6SubnetId = subnetApi.create(Subnet.createOptions(networkId, "a1ca:1e1:c:107d::/96").ipVersion(6)
|
||||
String ipv6SubnetId = subnetApi.create(Subnet.createBuilder(networkId, "a1ca:1e1:c:107d::/96").ipVersion(6)
|
||||
.name("JClouds-Live-IPv6-Subnet").build()).getId();
|
||||
|
||||
assertNotNull(networkId);
|
||||
assertNotNull(ipv4SubnetId);
|
||||
assertNotNull(ipv6SubnetId);
|
||||
|
||||
String ipv4PortId = portApi.create(Port.createOptions(networkId).name("JClouds-Live-IPv4-Port")
|
||||
String ipv4PortId = portApi.create(Port.createBuilder(networkId).name("JClouds-Live-IPv4-Port")
|
||||
.fixedIps(ImmutableSet.copyOf(getFixedAddresses(ipv4SubnetId))).build()).getId();
|
||||
String ipv6PortId = portApi.create(Port.createOptions(networkId).name("JClouds-Live-IPv6-Port")
|
||||
String ipv6PortId = portApi.create(Port.createBuilder(networkId).name("JClouds-Live-IPv6-Port")
|
||||
.fixedIps(ImmutableSet.copyOf(getFixedAddresses(ipv6SubnetId))).build()).getId();
|
||||
|
||||
/* List and get test */
|
||||
|
@ -83,7 +83,7 @@ public class PortApiLiveTest extends BaseNeutronApiLiveTest {
|
|||
assertEquals(ipv6Port.getId(), ipv6PortId);
|
||||
assertEquals(ipv6Port.getName(), "JClouds-Live-IPv6-Port");
|
||||
|
||||
assertNotNull(portApi.update(ipv4PortId, Port.updateOptions().name("Updated").build()));
|
||||
assertNotNull(portApi.update(ipv4PortId, Port.updateBuilder().name("Updated").build()));
|
||||
Port updatedIpv4Port = portApi.get(ipv4PortId);
|
||||
assertEquals(updatedIpv4Port.getName(), "Updated");
|
||||
|
||||
|
@ -102,10 +102,10 @@ public class PortApiLiveTest extends BaseNeutronApiLiveTest {
|
|||
PortApi portApi = api.getPortApi(region);
|
||||
|
||||
String networkId = networkApi.create(
|
||||
Network.createOptions("JClouds-Live-Network").networkType(NetworkType.LOCAL).build()).getId();
|
||||
String ipv4SubnetId = subnetApi.create(Subnet.createOptions(networkId, "198.51.100.0/24").ipVersion(4)
|
||||
Network.createBuilder("JClouds-Live-Network").networkType(NetworkType.LOCAL).build()).getId();
|
||||
String ipv4SubnetId = subnetApi.create(Subnet.createBuilder(networkId, "198.51.100.0/24").ipVersion(4)
|
||||
.name("JClouds-Live-IPv4-Subnet").build()).getId();
|
||||
String ipv6SubnetId = subnetApi.create(Subnet.createOptions(networkId, "a1ca:1e1:c:107d::/96").ipVersion(6)
|
||||
String ipv6SubnetId = subnetApi.create(Subnet.createBuilder(networkId, "a1ca:1e1:c:107d::/96").ipVersion(6)
|
||||
.name("JClouds-Live-IPv6-Subnet").build()).getId();
|
||||
|
||||
assertNotNull(networkId);
|
||||
|
@ -114,13 +114,13 @@ public class PortApiLiveTest extends BaseNeutronApiLiveTest {
|
|||
|
||||
Set<? extends Port> ports = portApi.createBulk(
|
||||
ImmutableList.of(
|
||||
Port.createOptions(networkId).name("JClouds-Live-IPv4-Subnet-1")
|
||||
Port.createBuilder(networkId).name("JClouds-Live-IPv4-Subnet-1")
|
||||
.fixedIps(ImmutableSet.copyOf(getFixedAddresses(ipv4SubnetId))).build(),
|
||||
Port.createOptions(networkId).name("JClouds-Live-IPv4-Subnet-2")
|
||||
Port.createBuilder(networkId).name("JClouds-Live-IPv4-Subnet-2")
|
||||
.fixedIps(ImmutableSet.copyOf(getFixedAddresses(ipv4SubnetId))).build(),
|
||||
Port.createOptions(networkId).name("JClouds-Live-IPv6-Subnet-1")
|
||||
Port.createBuilder(networkId).name("JClouds-Live-IPv6-Subnet-1")
|
||||
.fixedIps(ImmutableSet.copyOf(getFixedAddresses(ipv6SubnetId))).build(),
|
||||
Port.createOptions(networkId).name("JClouds-Live-IPv6-Subnet-2")
|
||||
Port.createBuilder(networkId).name("JClouds-Live-IPv6-Subnet-2")
|
||||
.fixedIps(ImmutableSet.copyOf(getFixedAddresses(ipv6SubnetId))).build()
|
||||
)
|
||||
).toSet();
|
||||
|
|
|
@ -61,7 +61,7 @@ public class PortApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
PortApi api = neutronApi.getPortApi("RegionOne");
|
||||
|
||||
Port.CreateOptions createPort = Port.createOptions("6aeaf34a-c482-4bd3-9dc3-7faf36412f12")
|
||||
Port.CreatePort createPort = Port.createBuilder("6aeaf34a-c482-4bd3-9dc3-7faf36412f12")
|
||||
.name("port1")
|
||||
.adminStateUp(true)
|
||||
.deviceId("d6b4d3a5-c700-476f-b609-1493dd9dadc0")
|
||||
|
@ -108,7 +108,7 @@ public class PortApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
PortApi api = neutronApi.getPortApi("RegionOne");
|
||||
|
||||
Port.CreateOptions createPort = Port.createOptions("6aeaf34a-c482-4bd3-9dc3-7faf36412f12")
|
||||
Port.CreatePort createPort = Port.createBuilder("6aeaf34a-c482-4bd3-9dc3-7faf36412f12")
|
||||
.name("port1")
|
||||
.adminStateUp(true)
|
||||
.deviceId("d6b4d3a5-c700-476f-b609-1493dd9dadc0")
|
||||
|
@ -246,14 +246,14 @@ public class PortApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
PortApi api = neutronApi.getPortApi("RegionOne");
|
||||
|
||||
Port.CreateOptions createPort1 = Port.createOptions("64239a54-dcc4-4b39-920b-b37c2144effa")
|
||||
Port.CreatePort createPort1 = Port.createBuilder("64239a54-dcc4-4b39-920b-b37c2144effa")
|
||||
.name("port1")
|
||||
.adminStateUp(true)
|
||||
.deviceId("24df1d04-d5cb-41e1-8de5-61ed77c558df")
|
||||
.securityGroups(ImmutableSet.of("dbc107f4-afcd-4d5a-9352-f68f82241d5b"))
|
||||
.build();
|
||||
|
||||
Port.CreateOptions createPort2 = Port.createOptions("e6031bc2-901a-4c66-82da-f4c32ed89406")
|
||||
Port.CreatePort createPort2 = Port.createBuilder("e6031bc2-901a-4c66-82da-f4c32ed89406")
|
||||
.name("port2")
|
||||
.adminStateUp(false)
|
||||
.securityGroups(
|
||||
|
@ -291,14 +291,14 @@ public class PortApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
PortApi api = neutronApi.getPortApi("RegionOne");
|
||||
|
||||
Port.CreateOptions createPort1 = Port.createOptions("64239a54-dcc4-4b39-920b-b37c2144effa")
|
||||
Port.CreatePort createPort1 = Port.createBuilder("64239a54-dcc4-4b39-920b-b37c2144effa")
|
||||
.name("port1")
|
||||
.adminStateUp(true)
|
||||
.deviceId("24df1d04-d5cb-41e1-8de5-61ed77c558df")
|
||||
.securityGroups(ImmutableSet.of("dbc107f4-afcd-4d5a-9352-f68f82241d5b"))
|
||||
.build();
|
||||
|
||||
Port.CreateOptions createPort2 = Port.createOptions("e6031bc2-901a-4c66-82da-f4c32ed89406")
|
||||
Port.CreatePort createPort2 = Port.createBuilder("e6031bc2-901a-4c66-82da-f4c32ed89406")
|
||||
.name("port2")
|
||||
.adminStateUp(false)
|
||||
.securityGroups(
|
||||
|
@ -384,7 +384,7 @@ public class PortApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
PortApi api = neutronApi.getPortApi("RegionOne");
|
||||
|
||||
Port.UpdateOptions updatePort = Port.updateOptions()
|
||||
Port.UpdatePort updatePort = Port.updateBuilder()
|
||||
.securityGroups(
|
||||
ImmutableSet.of("85cc3048-abc3-43cc-89b3-377341426ac5", "c5ab5c29-2c99-44cb-a4b8-e70a88b77799"))
|
||||
.build();
|
||||
|
@ -417,7 +417,7 @@ public class PortApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
PortApi api = neutronApi.getPortApi("RegionOne");
|
||||
|
||||
Port.UpdateOptions updatePort = Port.updateOptions()
|
||||
Port.UpdatePort updatePort = Port.updateBuilder()
|
||||
.securityGroups(ImmutableSet.of("85cc3048-abc3-43cc-89b3-377341426ac5", "c5ab5c29-2c99-44cb-a4b8-e70a88b77799"))
|
||||
.build();
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public class SubnetApiLiveTest extends BaseNeutronApiLiveTest {
|
|||
public void testCreateUpdateAndDeleteSubnet() {
|
||||
for (String region : api.getConfiguredRegions()) {
|
||||
NetworkApi networkApi = api.getNetworkApi(region);
|
||||
String networkId = networkApi.create(Network.createOptions("jclouds-live-test").networkType(NetworkType.LOCAL).build()).getId();
|
||||
String networkId = networkApi.create(Network.createBuilder("jclouds-live-test").networkType(NetworkType.LOCAL).build()).getId();
|
||||
|
||||
SubnetApi subnetApi = api.getSubnetApi(region);
|
||||
ImmutableSet<AllocationPool> allocationPools = ImmutableSet.of(
|
||||
|
@ -54,7 +54,7 @@ public class SubnetApiLiveTest extends BaseNeutronApiLiveTest {
|
|||
ImmutableSet<HostRoute> hostRoutes = ImmutableSet.of(
|
||||
HostRoute.builder().destinationCidr("a3:bc00::/48").nextHop("a3:bc00::0004").build()
|
||||
);
|
||||
Subnet subnet = subnetApi.create(Subnet.createOptions(networkId, "a3:bc00::/48").ipVersion(6).allocationPools(allocationPools).hostRoutes(hostRoutes).build());
|
||||
Subnet subnet = subnetApi.create(Subnet.createBuilder(networkId, "a3:bc00::/48").ipVersion(6).allocationPools(allocationPools).hostRoutes(hostRoutes).build());
|
||||
assertNotNull(subnet);
|
||||
|
||||
/* Test list and get */
|
||||
|
@ -71,7 +71,7 @@ public class SubnetApiLiveTest extends BaseNeutronApiLiveTest {
|
|||
assertTrue(retrievedSubnet.getDnsNameservers().isEmpty());
|
||||
assertEquals(retrievedSubnet.getAllocationPools().size(), 2);
|
||||
assertEquals(retrievedSubnet.getHostRoutes().size(), 1);
|
||||
assertNotNull(subnetApi.update(retrievedSubnet.getId(), Subnet.updateOptions().name("jclouds-live-test-update").build()));
|
||||
assertNotNull(subnetApi.update(retrievedSubnet.getId(), Subnet.updateBuilder().name("jclouds-live-test-update").build()));
|
||||
|
||||
retrievedSubnet = subnetApi.get(retrievedSubnet.getId());
|
||||
|
||||
|
@ -79,7 +79,7 @@ public class SubnetApiLiveTest extends BaseNeutronApiLiveTest {
|
|||
assertEquals(retrievedSubnet.getName(), "jclouds-live-test-update");
|
||||
assertTrue(retrievedSubnet.getDnsNameservers().isEmpty());
|
||||
|
||||
Subnet subnet2 = subnetApi.create(Subnet.createOptions(networkId, "a3:bd01::/48").ipVersion(6).build());
|
||||
Subnet subnet2 = subnetApi.create(Subnet.createBuilder(networkId, "a3:bd01::/48").ipVersion(6).build());
|
||||
assertNotNull(subnet2);
|
||||
|
||||
assertTrue(subnetApi.delete(subnet.getId()));
|
||||
|
@ -91,14 +91,14 @@ public class SubnetApiLiveTest extends BaseNeutronApiLiveTest {
|
|||
public void testBulkCreateSubnet() {
|
||||
for (String region : api.getConfiguredRegions()) {
|
||||
NetworkApi networkApi = api.getNetworkApi(region);
|
||||
String networkId = networkApi.create(Network.createOptions("jclouds-live-test").networkType(NetworkType.LOCAL).build()).getId();
|
||||
String networkId = networkApi.create(Network.createBuilder("jclouds-live-test").networkType(NetworkType.LOCAL).build()).getId();
|
||||
|
||||
SubnetApi subnetApi = api.getSubnetApi(region);
|
||||
Set<? extends Subnet> subnets = subnetApi.createBulk(
|
||||
ImmutableList.of(
|
||||
Subnet.createOptions("jclouds-live-test-1", "a3:bd01::/48").ipVersion(6).networkId(networkId).build(),
|
||||
Subnet.createOptions("jclouds-live-test-2", "a3:bd02::/48").ipVersion(6).networkId(networkId).build(),
|
||||
Subnet.createOptions("jclouds-live-test-3", "a3:bd03::/48").ipVersion(6).networkId(networkId).build()
|
||||
Subnet.createBuilder("jclouds-live-test-1", "a3:bd01::/48").ipVersion(6).networkId(networkId).build(),
|
||||
Subnet.createBuilder("jclouds-live-test-2", "a3:bd02::/48").ipVersion(6).networkId(networkId).build(),
|
||||
Subnet.createBuilder("jclouds-live-test-3", "a3:bd03::/48").ipVersion(6).networkId(networkId).build()
|
||||
)
|
||||
).toSet();
|
||||
Set<Subnet> existingSubnets = subnetApi.list().concat().toSet();
|
||||
|
|
|
@ -55,7 +55,7 @@ public class SubnetApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
SubnetApi api = neutronApi.getSubnetApi("RegionOne");
|
||||
|
||||
Subnet.CreateOptions createSubnet = Subnet.createOptions("1234567890", "10.0.3.0/24")
|
||||
Subnet.CreateSubnet createSubnet = Subnet.createBuilder("1234567890", "10.0.3.0/24")
|
||||
.name("jclouds-wibble")
|
||||
.ipVersion(4)
|
||||
.build();
|
||||
|
@ -92,7 +92,7 @@ public class SubnetApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
SubnetApi api = neutronApi.getSubnetApi("RegionOne");
|
||||
|
||||
Subnet.CreateOptions createSubnet = Subnet.createOptions("1234567890", "cidr")
|
||||
Subnet.CreateSubnet createSubnet = Subnet.createBuilder("1234567890", "cidr")
|
||||
.name("jclouds-wibble")
|
||||
.ipVersion(4)
|
||||
.build();
|
||||
|
@ -284,12 +284,12 @@ public class SubnetApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
SubnetApi api = neutronApi.getSubnetApi("RegionOne");
|
||||
|
||||
Subnet.CreateOptions createSubnet1 = Subnet.createOptions("e6031bc2-901a-4c66-82da-f4c32ed89406",
|
||||
Subnet.CreateSubnet createSubnet1 = Subnet.createBuilder("e6031bc2-901a-4c66-82da-f4c32ed89406",
|
||||
"192.168.199.0/24")
|
||||
.ipVersion(4)
|
||||
.build();
|
||||
|
||||
Subnet.CreateOptions createSubnet2 = Subnet.createOptions("64239a54-dcc4-4b39-920b-b37c2144effa",
|
||||
Subnet.CreateSubnet createSubnet2 = Subnet.createBuilder("64239a54-dcc4-4b39-920b-b37c2144effa",
|
||||
"10.56.4.0/22")
|
||||
.ipVersion(4)
|
||||
.build();
|
||||
|
@ -333,12 +333,12 @@ public class SubnetApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
SubnetApi api = neutronApi.getSubnetApi("RegionOne");
|
||||
|
||||
Subnet.CreateOptions createSubnet1 = Subnet.createOptions("e6031bc2-901a-4c66-82da-f4c32ed89406",
|
||||
Subnet.CreateSubnet createSubnet1 = Subnet.createBuilder("e6031bc2-901a-4c66-82da-f4c32ed89406",
|
||||
"192.168.199.0/24")
|
||||
.ipVersion(4)
|
||||
.build();
|
||||
|
||||
Subnet.CreateOptions createSubnet2 = Subnet.createOptions("64239a54-dcc4-4b39-920b-b37c2144effa",
|
||||
Subnet.CreateSubnet createSubnet2 = Subnet.createBuilder("64239a54-dcc4-4b39-920b-b37c2144effa",
|
||||
"10.56.4.0/22")
|
||||
.ipVersion(4)
|
||||
.build();
|
||||
|
@ -358,7 +358,7 @@ public class SubnetApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
SubnetApi api = neutronApi.getSubnetApi("RegionOne");
|
||||
|
||||
Subnet.UpdateOptions updateSubnet = Subnet.updateOptions()
|
||||
Subnet.UpdateSubnet updateSubnet = Subnet.updateBuilder()
|
||||
.name("new_name")
|
||||
.gatewayIp("10.0.3.254")
|
||||
.build();
|
||||
|
@ -393,7 +393,7 @@ public class SubnetApiMockTest extends BaseNeutronApiMockTest {
|
|||
NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
|
||||
SubnetApi api = neutronApi.getSubnetApi("RegionOne");
|
||||
|
||||
Subnet.UpdateOptions updateSubnet = Subnet.updateOptions()
|
||||
Subnet.UpdateSubnet updateSubnet = Subnet.updateBuilder()
|
||||
.name("new_name")
|
||||
.gatewayIp("10.0.3.254")
|
||||
.build();
|
||||
|
|
Loading…
Reference in New Issue