You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2015/08/20 11:36:12 UTC
[26/51] [abbrv] [partial] stratos git commit: Revert "Upgrading to
jclouds 1.9.1"
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreateNetworkOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreateNetworkOptions.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreateNetworkOptions.java
new file mode 100644
index 0000000..f4237f5
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreateNetworkOptions.java
@@ -0,0 +1,240 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * 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_0.options;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.gson.annotations.SerializedName;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.openstack.neutron.v2_0.domain.NetworkType;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import javax.inject.Inject;
+import java.util.Map;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+public class CreateNetworkOptions implements MapBinder {
+
+ @Inject
+ private BindToJsonPayload jsonBinder;
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromCreateNetworkOptions(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String name;
+ protected Boolean adminStateUp;
+ protected Boolean external;
+ protected NetworkType networkType;
+ protected String physicalNetworkName;
+ protected Integer segmentationId;
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.CreateNetworkOptions#getName()
+ */
+ public T name(String name) {
+ this.name = name;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.CreateNetworkOptions#getAdminStateUp()
+ */
+ public T adminStateUp(Boolean adminStateUp) {
+ this.adminStateUp = adminStateUp;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.CreateNetworkOptions#getExternal()
+ */
+ public T external(Boolean external) {
+ this.external = external;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.CreateNetworkOptions#getNetworkType()
+ */
+ public T networkType(NetworkType networkType) {
+ this.networkType = networkType;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.CreateNetworkOptions#getPhysicalNetworkName()
+ */
+ public T physicalNetworkName(String physicalNetworkName) {
+ this.physicalNetworkName = physicalNetworkName;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.CreateNetworkOptions#getSegmentationId()
+ */
+ public T segmentationId(Integer segmentationId) {
+ this.segmentationId = segmentationId;
+ return self();
+ }
+
+ public CreateNetworkOptions build() {
+ return new CreateNetworkOptions(name, adminStateUp, external, networkType, physicalNetworkName, segmentationId);
+ }
+
+ public T fromCreateNetworkOptions(CreateNetworkOptions in) {
+ return this.name(in.getName())
+ .adminStateUp(in.getAdminStateUp())
+ .external(in.getExternal())
+ .networkType(in.getNetworkType())
+ .physicalNetworkName(in.getPhysicalNetworkName())
+ .segmentationId(in.getSegmentationId());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ protected static class CreateNetworkRequest {
+ protected String name;
+ protected Boolean admin_state_up;
+ @SerializedName("router:external")
+ protected Boolean external;
+ @SerializedName("provider:network_type")
+ protected String networkType;
+ @SerializedName("provider:physical_network")
+ protected String physicalNetworkName;
+ @SerializedName("provider:segmentation_id")
+ protected Integer segmentationId;
+ }
+
+ private final String name;
+ private final Boolean adminStateUp;
+ private final Boolean external;
+ private final NetworkType networkType;
+ private final String physicalNetworkName;
+ private final Integer segmentationId;
+
+ protected CreateNetworkOptions() {
+ this.name = null;
+ this.adminStateUp = null;
+ this.external = null;
+ this.networkType = null;
+ this.physicalNetworkName = null;
+ this.segmentationId = null;
+ }
+
+ public CreateNetworkOptions(String name, Boolean adminStateUp, Boolean external, NetworkType networkType, String physicalNetworkName, Integer segmentationId) {
+ this.name = name;
+ this.adminStateUp = adminStateUp;
+ this.external = external;
+ this.networkType = networkType;
+ this.physicalNetworkName = physicalNetworkName;
+ this.segmentationId = segmentationId;
+ }
+
+ /**
+ * @return the name of the network
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return the administrative state of network. If false, the network does not forward packets.
+ */
+ public Boolean getAdminStateUp() {
+ return adminStateUp;
+ }
+
+ /**
+ * @return true if network is external, false if not
+ */
+ public Boolean getExternal() {
+ return external;
+ }
+
+ /**
+ * @return the type of the network
+ */
+ public NetworkType getNetworkType() {
+ return networkType;
+ }
+
+ /**
+ * @return the physical network name
+ */
+ public String getPhysicalNetworkName() {
+ return physicalNetworkName;
+ }
+
+ /**
+ * @return the segmentation id of the network
+ */
+ public Integer getSegmentationId() {
+ return segmentationId;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ if (this.networkType != null) {
+ //Validations for each NetworkType
+ if (this.networkType == NetworkType.FLAT) {
+ checkNotNull(this.physicalNetworkName, "physicalNetworkName must be present when networkType=FLAT");
+ } else if (this.networkType == NetworkType.VLAN) {
+ checkNotNull(this.physicalNetworkName, "physicalNetworkName must be present when networkType=VLAN");
+ checkNotNull(this.segmentationId, "segmentationId must be present when networkType=VLAN");
+ } else if (this.networkType == NetworkType.GRE) {
+ checkNotNull(this.segmentationId, "segmentationId must be present when NetworkType=GRE");
+ }
+ }
+
+ CreateNetworkRequest createNetworkRequest = new CreateNetworkRequest();
+ if (this.name != null)
+ createNetworkRequest.name = this.name;
+ if (this.adminStateUp != null)
+ createNetworkRequest.admin_state_up = this.adminStateUp;
+ if (this.external != null)
+ createNetworkRequest.external = this.external;
+ if (this.networkType != null)
+ createNetworkRequest.networkType = this.networkType.getValue();
+ if (this.physicalNetworkName != null && (networkType == NetworkType.FLAT || networkType == NetworkType.VLAN))
+ createNetworkRequest.physicalNetworkName = this.physicalNetworkName;
+ if (this.segmentationId != null && (networkType == NetworkType.VLAN || networkType == NetworkType.GRE))
+ createNetworkRequest.segmentationId = this.segmentationId;
+
+ return bindToRequest(request, ImmutableMap.of("network", createNetworkRequest));
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ return jsonBinder.bindToRequest(request, input);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreatePortBulkOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreatePortBulkOptions.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreatePortBulkOptions.java
new file mode 100644
index 0000000..bbe473d
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreatePortBulkOptions.java
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * 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_0.options;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.openstack.neutron.v2_0.domain.BulkPort;
+import org.jclouds.openstack.neutron.v2_0.domain.IP;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import javax.inject.Inject;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+public class CreatePortBulkOptions implements MapBinder {
+
+ @Inject
+ private BindToJsonPayload jsonBinder;
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromCreatePortBulkOptions(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected List<BulkPort> ports;
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.CreatePortBulkOptions#getPorts()
+ */
+ public T ports(Collection<BulkPort> ports) {
+ this.ports = ImmutableList.copyOf(ports);
+ return self();
+ }
+
+ public CreatePortBulkOptions build() {
+ return new CreatePortBulkOptions(this.ports);
+ }
+
+ public T fromCreatePortBulkOptions(CreatePortBulkOptions in) {
+ return this.ports(in.getPorts());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final List<BulkPort> ports;
+
+ protected CreatePortBulkOptions() {
+ this.ports = Lists.newArrayList();
+ }
+
+ public CreatePortBulkOptions(List<BulkPort> ports) {
+ this.ports = ports;
+ }
+
+ /**
+ * @return the list of ports to create
+ */
+ public List<BulkPort> getPorts() {
+ return ports;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ List<CreatePortOptions.CreatePortRequest> createPortRequests = Lists.newArrayList();
+
+ for (BulkPort port : this.ports) {
+ CreatePortOptions.CreatePortRequest createPortRequest = new CreatePortOptions.CreatePortRequest(checkNotNull(port.getNetworkId(), "network id parameter not present"));
+
+ if (port.getName() != null)
+ createPortRequest.name = port.getName();
+ if (port.getAdminStateUp() != null)
+ createPortRequest.admin_state_up = port.getAdminStateUp();
+ if (port.getDeviceId() != null)
+ createPortRequest.device_id = port.getDeviceId();
+ if (port.getDeviceOwner() != null)
+ createPortRequest.device_owner = port.getDeviceOwner();
+ if (port.getMacAddress() != null)
+ createPortRequest.mac_address = port.getMacAddress();
+ if (!port.getFixedIps().isEmpty()) {
+ createPortRequest.fixed_ips = Sets.newHashSet();
+ for (IP fixedIp : port.getFixedIps()) {
+ CreatePortOptions.CreatePortRequest.IP requestIp = new CreatePortOptions.CreatePortRequest.IP();
+ requestIp.subnet_id = fixedIp.getSubnetId();
+ requestIp.ip_address = fixedIp.getIpAddress();
+ createPortRequest.fixed_ips.add(requestIp);
+ }
+ }
+
+ createPortRequests.add(createPortRequest);
+ }
+
+ return bindToRequest(request, ImmutableMap.of("ports", createPortRequests));
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ return jsonBinder.bindToRequest(request, input);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreatePortOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreatePortOptions.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreatePortOptions.java
new file mode 100644
index 0000000..1903da2
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreatePortOptions.java
@@ -0,0 +1,241 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * 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_0.options;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.openstack.neutron.v2_0.domain.IP;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import javax.inject.Inject;
+import java.util.Map;
+import java.util.Set;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+public class CreatePortOptions implements MapBinder {
+
+ @Inject
+ private BindToJsonPayload jsonBinder;
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromCreatePortOptions(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String name;
+ protected String deviceId;
+ protected String deviceOwner;
+ protected String macAddress;
+ protected Set<IP> fixedIps;
+ protected Boolean adminStateUp;
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.CreatePortOptions#getName()
+ */
+ public T name(String name) {
+ this.name = name;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.CreatePortOptions#getDeviceId()
+ */
+ public T deviceId(String deviceId) {
+ this.deviceId = deviceId;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.CreatePortOptions#getDeviceOwner()
+ */
+ public T deviceOwner(String deviceOwner) {
+ this.deviceOwner = deviceOwner;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.CreatePortOptions#getMacAddress()
+ */
+ public T macAddress(String macAddress) {
+ this.macAddress = macAddress;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.CreatePortOptions#getFixedIps()
+ */
+ public T fixedIps(Set<IP> fixedIps) {
+ this.fixedIps = fixedIps;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.CreatePortOptions#getAdminStateUp()
+ */
+ public T adminStateUp(Boolean adminStateUp) {
+ this.adminStateUp = adminStateUp;
+ return self();
+ }
+
+ public CreatePortOptions build() {
+ return new CreatePortOptions(name, deviceId, deviceOwner, macAddress, fixedIps, adminStateUp);
+ }
+
+ public T fromCreatePortOptions(CreatePortOptions options) {
+ return this.name(options.getName())
+ .deviceId(options.getDeviceId())
+ .deviceOwner(options.getDeviceOwner())
+ .macAddress(options.getMacAddress())
+ .fixedIps(options.getFixedIps())
+ .adminStateUp(options.getAdminStateUp());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ protected static class CreatePortRequest {
+ protected String network_id;
+ protected String name;
+ protected String device_id;
+ protected String device_owner;
+ protected String mac_address;
+ protected Set<IP> fixed_ips;
+ protected Boolean admin_state_up;
+
+ protected CreatePortRequest(String networkId) {
+ this.network_id = networkId;
+ }
+
+ protected static final class IP {
+ protected String ip_address;
+ protected String subnet_id;
+ }
+ }
+
+ private final String name;
+ private final String deviceId;
+ private final String deviceOwner;
+ private final String macAddress;
+ private final Set<IP> fixedIps;
+ private final Boolean adminStateUp;
+
+ protected CreatePortOptions() {
+ this.name = null;
+ this.deviceId = null;
+ this.deviceOwner = null;
+ this.macAddress = null;
+ this.fixedIps = Sets.newHashSet();
+ this.adminStateUp = null;
+ }
+
+ public CreatePortOptions(String name, String deviceId, String deviceOwner, String macAddress,
+ Set<IP> fixedIps, Boolean adminStateUp) {
+ this.name = name;
+ this.deviceId = deviceId;
+ this.deviceOwner = deviceOwner;
+ this.macAddress = macAddress;
+ this.fixedIps = fixedIps != null ? ImmutableSet.copyOf(fixedIps) : Sets.<IP>newHashSet();
+ this.adminStateUp = adminStateUp;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return the id of the device (e.g. server) which will use this port.
+ */
+ public String getDeviceId() {
+ return deviceId;
+ }
+
+ /**
+ * @return the entity (e.g.: dhcp agent) who will be using this port.
+ */
+ public String getDeviceOwner() {
+ return deviceOwner;
+ }
+
+ /**
+ * @return the mac address of this port
+ */
+ public String getMacAddress() {
+ return macAddress;
+ }
+
+ /**
+ * @return the set of fixed ips this port will get assigned
+ */
+ public Set<IP> getFixedIps() {
+ return fixedIps;
+ }
+
+ /**
+ * @return the administrative state of port. If false, port does not forward packets.
+ */
+ public Boolean getAdminStateUp() {
+ return adminStateUp;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ CreatePortRequest createPortRequest = new CreatePortRequest(checkNotNull(postParams.get("network_id"), "networkId not present").toString());
+
+ if (this.name != null)
+ createPortRequest.name = this.name;
+ if (this.deviceId != null)
+ createPortRequest.device_id = this.deviceId;
+ if (this.deviceOwner != null)
+ createPortRequest.device_owner = this.deviceOwner;
+ if (this.macAddress != null)
+ createPortRequest.mac_address = this.macAddress;
+ if (!this.fixedIps.isEmpty()) {
+ createPortRequest.fixed_ips = Sets.newHashSet();
+ for (IP ip : this.fixedIps) {
+ CreatePortRequest.IP requestIp = new CreatePortRequest.IP();
+ requestIp.subnet_id = ip.getSubnetId();
+ requestIp.ip_address = ip.getIpAddress();
+ createPortRequest.fixed_ips.add(requestIp);
+ }
+ }
+ if (this.adminStateUp != null)
+ createPortRequest.admin_state_up = this.adminStateUp;
+
+ return bindToRequest(request, ImmutableMap.of("port", createPortRequest));
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ return jsonBinder.bindToRequest(request, input);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreateRouterOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreateRouterOptions.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreateRouterOptions.java
new file mode 100644
index 0000000..7834953
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreateRouterOptions.java
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * 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_0.options;
+
+import com.google.common.collect.ImmutableMap;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.openstack.neutron.v2_0.domain.ExternalGatewayInfo;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import javax.inject.Inject;
+import java.util.Map;
+
+public class CreateRouterOptions implements MapBinder {
+
+ @Inject
+ private BindToJsonPayload jsonBinder;
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromCreateRouterOptions(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String name;
+ protected Boolean adminStateUp;
+ protected ExternalGatewayInfo externalGatewayInfo;
+
+ /**
+ * @see CreateRouterOptions#getName()
+ */
+ public T name(String name) {
+ this.name = name;
+ return self();
+ }
+
+ /**
+ * @see CreateRouterOptions#getAdminStateUp()
+ */
+ public T adminStateUp(Boolean adminStateUp) {
+ this.adminStateUp = adminStateUp;
+ return self();
+ }
+
+ /**
+ * @see CreateRouterOptions#getExternalGatewayInfo()
+ */
+ public T externalGatewayInfo(ExternalGatewayInfo externalGatewayInfo) {
+ this.externalGatewayInfo = externalGatewayInfo;
+ return self();
+ }
+
+ public CreateRouterOptions build() {
+ return new CreateRouterOptions(name, adminStateUp, externalGatewayInfo);
+ }
+
+ public T fromCreateRouterOptions(CreateRouterOptions options) {
+ return this.name(options.getName())
+ .adminStateUp(options.getAdminStateUp())
+ .externalGatewayInfo(options.getExternalGatewayInfo());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ protected static class CreateRouterRequest {
+ protected String name;
+ protected Boolean admin_state_up;
+ protected ExternalGatewayInfo external_gateway_info;
+
+ protected CreateRouterRequest() {
+ }
+
+ protected static final class ExternalGatewayInfo {
+ protected String network_id;
+
+ protected ExternalGatewayInfo(String network_id) {
+ this.network_id = network_id;
+ }
+ }
+ }
+
+ protected String name;
+ protected Boolean adminStateUp;
+ protected ExternalGatewayInfo externalGatewayInfo;
+
+ protected CreateRouterOptions() {
+ this.name = null;
+ this.adminStateUp = null;
+ this.externalGatewayInfo = null;
+ }
+
+ public CreateRouterOptions(String name, Boolean adminStateUp, ExternalGatewayInfo externalGatewayInfo) {
+ this.name = name;
+ this.adminStateUp = adminStateUp;
+ this.externalGatewayInfo = externalGatewayInfo;
+ }
+
+ /**
+ * @return the name for the router
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return the administrative state of the router
+ */
+ public Boolean getAdminStateUp() {
+ return adminStateUp;
+ }
+
+ /**
+ * @return the external gateway info for the router
+ */
+ public ExternalGatewayInfo getExternalGatewayInfo() {
+ return externalGatewayInfo;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ CreateRouterRequest createRouterRequest = new CreateRouterRequest();
+
+ if (this.name != null)
+ createRouterRequest.name = this.name;
+ if (this.adminStateUp != null)
+ createRouterRequest.admin_state_up = this.adminStateUp;
+ if (this.externalGatewayInfo != null)
+ createRouterRequest.external_gateway_info = new CreateRouterRequest.ExternalGatewayInfo(this.externalGatewayInfo.getNetworkId());
+
+ return bindToRequest(request, ImmutableMap.of("router", createRouterRequest));
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ return jsonBinder.bindToRequest(request, input);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreateSubnetBulkOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreateSubnetBulkOptions.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreateSubnetBulkOptions.java
new file mode 100644
index 0000000..ae85ad1
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreateSubnetBulkOptions.java
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * 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_0.options;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.openstack.neutron.v2_0.domain.BulkSubnet;
+import org.jclouds.openstack.neutron.v2_0.domain.HostRoute;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import javax.inject.Inject;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+public class CreateSubnetBulkOptions implements MapBinder {
+
+ @Inject
+ private BindToJsonPayload jsonBinder;
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromCreateSubnetBulkOptions(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected List<BulkSubnet> subnets;
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.CreateSubnetBulkOptions#getSubnets()
+ */
+ public T subnets(Collection<BulkSubnet> subnets) {
+ this.subnets = ImmutableList.copyOf(subnets);
+ return self();
+ }
+
+ public CreateSubnetBulkOptions build() {
+ return new CreateSubnetBulkOptions(this.subnets);
+ }
+
+ public T fromCreateSubnetBulkOptions(CreateSubnetBulkOptions in) {
+ return this.subnets(in.getSubnets());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final List<BulkSubnet> subnets;
+
+ protected CreateSubnetBulkOptions() {
+ this.subnets = Lists.newArrayList();
+ }
+
+ public CreateSubnetBulkOptions(List<BulkSubnet> subnets) {
+ this.subnets = subnets != null ? ImmutableList.copyOf(subnets) : Lists.<BulkSubnet>newArrayList();
+ }
+
+ /**
+ * @return The list of subnets to create
+ */
+ public List<BulkSubnet> getSubnets() {
+ return subnets;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ List<CreateSubnetOptions.CreateSubnetRequest> createSubnetRequests = Lists.newArrayList();
+
+ for (BulkSubnet subnet : subnets) {
+ CreateSubnetOptions.CreateSubnetRequest createSubnetRequest =
+ new CreateSubnetOptions.CreateSubnetRequest(
+ checkNotNull(subnet.getNetworkId(), "network id parameter not present"),
+ checkNotNull(subnet.getIpVersion(), "ip version parameter not present"),
+ checkNotNull(subnet.getCidr(), "cidr parameter not present")
+ );
+
+ if (subnet.getName() != null)
+ createSubnetRequest.name = subnet.getName();
+ if (!subnet.getAllocationPools().isEmpty())
+ createSubnetRequest.allocation_pools = subnet.getAllocationPools();
+ if (subnet.getGatewayIp() != null)
+ createSubnetRequest.gateway_ip = subnet.getGatewayIp();
+ if (subnet.getEnableDhcp() != null)
+ createSubnetRequest.enable_dhcp = subnet.getEnableDhcp();
+ if (!subnet.getDnsNameServers().isEmpty())
+ createSubnetRequest.dns_nameservers = subnet.getDnsNameServers();
+ if (!subnet.getHostRoutes().isEmpty()) {
+ createSubnetRequest.host_routes = Sets.newHashSet();
+ for (HostRoute hostRoute : subnet.getHostRoutes()) {
+ CreateSubnetOptions.CreateSubnetRequest.HostRoute requestHostRoute = new CreateSubnetOptions.CreateSubnetRequest.HostRoute();
+ requestHostRoute.destination = hostRoute.getDestinationCidr();
+ requestHostRoute.nexthop = hostRoute.getNextHop();
+ createSubnetRequest.host_routes.add(requestHostRoute);
+ }
+ }
+
+ createSubnetRequests.add(createSubnetRequest);
+ }
+
+ return bindToRequest(request, ImmutableMap.of("subnets", createSubnetRequests));
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ return jsonBinder.bindToRequest(request, input);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreateSubnetOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreateSubnetOptions.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreateSubnetOptions.java
new file mode 100644
index 0000000..c562e06
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreateSubnetOptions.java
@@ -0,0 +1,256 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * 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_0.options;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.openstack.neutron.v2_0.domain.AllocationPool;
+import org.jclouds.openstack.neutron.v2_0.domain.HostRoute;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import javax.inject.Inject;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+public class CreateSubnetOptions implements MapBinder {
+
+ @Inject
+ private BindToJsonPayload jsonBinder;
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromCreateSubnetOptions(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String name;
+ protected Set<AllocationPool> allocationPools;
+ protected String gatewayIp;
+ protected Boolean enableDhcp;
+ protected Set<String> dnsNameServers;
+ protected Set<HostRoute> hostRoutes;
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.CreateSubnetOptions#getName()
+ */
+ public T name(String name) {
+ this.name = name;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.CreateSubnetOptions#getAllocationPools()
+ */
+ public T allocationPools(Collection<AllocationPool> allocationPools) {
+ this.allocationPools = ImmutableSet.copyOf(allocationPools);
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.CreateSubnetOptions#getGatewayIp()
+ */
+ public T gatewayIp(String gatewayIp) {
+ this.gatewayIp = gatewayIp;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.CreateSubnetOptions#getEnableDhcp()
+ */
+ public T enableDhcp(Boolean enableDhcp) {
+ this.enableDhcp = enableDhcp;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.CreateSubnetOptions#getDnsNameServers()
+ */
+ public T dnsNameServers(Collection<String> dnsNameServers) {
+ this.dnsNameServers = ImmutableSet.copyOf(dnsNameServers);
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.CreateSubnetOptions#getHostRoutes()
+ */
+ public T hostRoutes(Collection<HostRoute> hostRoutes) {
+ this.hostRoutes = ImmutableSet.copyOf(hostRoutes);
+ return self();
+ }
+
+ public CreateSubnetOptions build() {
+ return new CreateSubnetOptions(name, allocationPools, gatewayIp, enableDhcp, dnsNameServers, hostRoutes);
+ }
+
+ public T fromCreateSubnetOptions(CreateSubnetOptions in) {
+ return this.name(in.getName())
+ .allocationPools(in.getAllocationPools())
+ .gatewayIp(in.getGatewayIp())
+ .enableDhcp(in.getEnableDhcp())
+ .dnsNameServers(in.getDnsNameServers())
+ .hostRoutes(in.getHostRoutes());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ protected static class CreateSubnetRequest {
+ protected String network_id;
+ protected Integer ip_version;
+ protected String cidr;
+ protected String name;
+ protected Set<AllocationPool> allocation_pools;
+ protected String gateway_ip;
+ protected Boolean enable_dhcp;
+ protected Set<String> dns_nameservers;
+ protected Set<HostRoute> host_routes;
+
+ protected CreateSubnetRequest(String networkId, Integer ipVersion, String cidr) {
+ this.network_id = networkId;
+ this.ip_version = ipVersion;
+ this.cidr = cidr;
+ }
+
+ protected static class HostRoute {
+ protected String destination;
+ protected String nexthop;
+ }
+ }
+
+ private final String name;
+ private final Set<AllocationPool> allocationPools;
+ private final String gatewayIp;
+ private final Boolean enableDhcp;
+ private final Set<String> dnsNameServers;
+ private final Set<HostRoute> hostRoutes;
+
+ protected CreateSubnetOptions() {
+ this.name = null;
+ this.allocationPools = Sets.newHashSet();
+ this.gatewayIp = null;
+ this.enableDhcp = null;
+ this.dnsNameServers = Sets.newHashSet();
+ this.hostRoutes = Sets.newHashSet();
+ }
+
+ public CreateSubnetOptions(String name, Set<AllocationPool> allocationPools, String gatewayIp,
+ Boolean enableDhcp, Set<String> dnsNameServers, Set<HostRoute> hostRoutes) {
+ this.name = name;
+ this.allocationPools = allocationPools != null ? ImmutableSet.copyOf(allocationPools) : Sets.<AllocationPool>newHashSet();
+ this.gatewayIp = gatewayIp;
+ this.enableDhcp = enableDhcp;
+ this.dnsNameServers = dnsNameServers != null ? ImmutableSet.copyOf(dnsNameServers) : Sets.<String>newHashSet();
+ this.hostRoutes = hostRoutes != null ? ImmutableSet.copyOf(hostRoutes) : Sets.<HostRoute>newHashSet();
+ }
+
+ /**
+ * @return the name for the subnet
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return the sub-ranges of cidr which will be available for dynamic allocation to ports
+ */
+ public Set<AllocationPool> getAllocationPools() {
+ return allocationPools;
+ }
+
+ /**
+ * @return the default gateway which will be used by devices in this subnet
+ */
+ public String getGatewayIp() {
+ return gatewayIp;
+ }
+
+ /**
+ * @return true to enable DHCP, false to disable
+ */
+ public Boolean getEnableDhcp() {
+ return enableDhcp;
+ }
+
+ /**
+ * @return the set of DNS name servers to be used by hosts in this subnet.
+ */
+ public Set<String> getDnsNameServers() {
+ return dnsNameServers;
+ }
+
+ /**
+ * @return the set of routes that should be used by devices with IPs from this subnet
+ */
+ public Set<HostRoute> getHostRoutes() {
+ return hostRoutes;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ CreateSubnetRequest createSubnetRequest =
+ new CreateSubnetRequest(
+ checkNotNull(postParams.get("network_id"), "networkId not present").toString(),
+ Integer.parseInt(checkNotNull(postParams.get("ip_version"), "ipVersion not present").toString()),
+ checkNotNull(postParams.get("cidr"), "cidr not present").toString()
+ );
+
+ if (this.name != null)
+ createSubnetRequest.name = this.name;
+ if (!this.allocationPools.isEmpty())
+ createSubnetRequest.allocation_pools = this.allocationPools;
+ if (this.gatewayIp != null)
+ createSubnetRequest.gateway_ip = this.gatewayIp;
+ if (this.enableDhcp != null)
+ createSubnetRequest.enable_dhcp = this.enableDhcp;
+ if (!this.dnsNameServers.isEmpty())
+ createSubnetRequest.dns_nameservers = this.dnsNameServers;
+ if (!this.hostRoutes.isEmpty()) {
+ createSubnetRequest.host_routes = Sets.newHashSet();
+ for (HostRoute hostRoute : this.hostRoutes) {
+ CreateSubnetRequest.HostRoute requestHostRoute = new CreateSubnetRequest.HostRoute();
+ requestHostRoute.destination = hostRoute.getDestinationCidr();
+ requestHostRoute.nexthop = hostRoute.getNextHop();
+ createSubnetRequest.host_routes.add(requestHostRoute);
+ }
+ }
+
+ return bindToRequest(request, ImmutableMap.of("subnet", createSubnetRequest));
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ return jsonBinder.bindToRequest(request, input);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/EmptyOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/EmptyOptions.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/EmptyOptions.java
new file mode 100644
index 0000000..b5a3d9d
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/EmptyOptions.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * 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_0.options;
+
+import com.google.inject.Inject;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import java.util.Map;
+
+/**
+ * This class is used for methods who don't need a wrapper around their JSON body
+ */
+public class EmptyOptions implements MapBinder {
+
+ @Inject
+ private BindToJsonPayload jsonBinder;
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ return bindToRequest(request, (Object) postParams);
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ return jsonBinder.bindToRequest(request, input);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/UpdateNetworkOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/UpdateNetworkOptions.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/UpdateNetworkOptions.java
new file mode 100644
index 0000000..e794acf
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/UpdateNetworkOptions.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * 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_0.options;
+
+import com.google.common.collect.ImmutableMap;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import javax.inject.Inject;
+import java.util.Map;
+
+public class UpdateNetworkOptions implements MapBinder {
+
+ @Inject
+ private BindToJsonPayload jsonBinder;
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromUpdateNetworkOptions(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String name;
+ protected Boolean adminStateUp;
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.UpdateNetworkOptions#getName()
+ */
+ public T name(String name) {
+ this.name = name;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.UpdateNetworkOptions#getAdminStateUp()
+ */
+ public T adminStateUp(Boolean adminStateUp) {
+ this.adminStateUp = adminStateUp;
+ return self();
+ }
+
+ public UpdateNetworkOptions build() {
+ return new UpdateNetworkOptions(name, adminStateUp);
+ }
+
+ public T fromUpdateNetworkOptions(UpdateNetworkOptions options) {
+ return this.name(options.getName()).adminStateUp(options.getAdminStateUp());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private static class UpdateNetworkRequest {
+ protected String name;
+ protected Boolean admin_state_up;
+ }
+
+ private final String name;
+ private final Boolean adminStateUp;
+
+ protected UpdateNetworkOptions() {
+ this.name = null;
+ this.adminStateUp = null;
+ }
+
+ public UpdateNetworkOptions(String name, Boolean adminStateUp) {
+ this.name = name;
+ this.adminStateUp = adminStateUp;
+ }
+
+ /**
+ * @return the new name for the network
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return the new administrative state for the network. If false, the network does not forward packets.
+ */
+ public boolean getAdminStateUp() {
+ return adminStateUp;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ UpdateNetworkRequest updateNetworkRequest = new UpdateNetworkRequest();
+
+ if (this.name != null)
+ updateNetworkRequest.name = this.name;
+ if (this.adminStateUp != null)
+ updateNetworkRequest.admin_state_up = this.adminStateUp;
+
+ return bindToRequest(request, ImmutableMap.of("network", updateNetworkRequest));
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ return jsonBinder.bindToRequest(request, input);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/UpdatePortOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/UpdatePortOptions.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/UpdatePortOptions.java
new file mode 100644
index 0000000..dfbc820
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/UpdatePortOptions.java
@@ -0,0 +1,215 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * 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_0.options;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.openstack.neutron.v2_0.domain.IP;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import javax.inject.Inject;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+public class UpdatePortOptions implements MapBinder {
+
+ @Inject
+ private BindToJsonPayload jsonBinder;
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromUpdatePortOptions(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String name;
+ protected Boolean adminStateUp;
+ protected String deviceId;
+ protected String deviceOwner;
+ protected Set<IP> fixedIps;
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.UpdatePortOptions#getName()
+ */
+ public T name(String name) {
+ this.name = name;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.UpdatePortOptions#getAdminStateUp()
+ */
+ public T adminStateUp(Boolean adminStateUp) {
+ this.adminStateUp = adminStateUp;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.UpdatePortOptions#getDeviceId()
+ */
+ public T deviceId(String deviceId) {
+ this.deviceId = deviceId;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.UpdatePortOptions#getDeviceOwner()
+ */
+ public T deviceOwner(String deviceOwner) {
+ this.deviceOwner = deviceOwner;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.UpdatePortOptions#getFixedIps()
+ */
+ public T fixedIps(Collection<IP> fixedIps) {
+ this.fixedIps = ImmutableSet.copyOf(fixedIps);
+ return self();
+ }
+
+ public UpdatePortOptions build() {
+ return new UpdatePortOptions(name, adminStateUp, deviceId, deviceOwner, fixedIps);
+ }
+
+ public T fromUpdatePortOptions(UpdatePortOptions options) {
+ return this.name(options.getName())
+ .adminStateUp(options.getAdminStateUp())
+ .deviceId(options.getDeviceId())
+ .deviceOwner(options.getDeviceOwner())
+ .fixedIps(options.getFixedIps());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private static class UpdatePortRequest {
+ protected String name;
+ protected Boolean admin_state_up;
+ protected String device_id;
+ protected String device_owner;
+ protected Set<IP> fixed_ips;
+
+ private static class IP {
+ protected String ip_address;
+ protected String subnet_id;
+ }
+ }
+
+ private final String name;
+ private final Boolean adminStateUp;
+ private final String deviceId;
+ private final String deviceOwner;
+ private final Set<IP> fixedIps;
+
+ protected UpdatePortOptions() {
+ this.name = null;
+ this.adminStateUp = null;
+ this.deviceId = null;
+ this.deviceOwner = null;
+ this.fixedIps = Sets.newHashSet();
+ }
+
+ public UpdatePortOptions(String name, Boolean adminStateUp, String deviceId, String deviceOwner, Set<IP> fixedIps) {
+ this.name = name;
+ this.adminStateUp = adminStateUp;
+ this.deviceId = deviceId;
+ this.deviceOwner = deviceOwner;
+ this.fixedIps = fixedIps != null ? ImmutableSet.copyOf(fixedIps) : Sets.<IP>newHashSet();
+ }
+
+ /**
+ * @return the new name for the port
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return the new administrative state for the port. If false, port does not forward packets.
+ */
+ public Boolean getAdminStateUp() {
+ return adminStateUp;
+ }
+
+ /**
+ * @return the new device id for the port
+ */
+ public String getDeviceId() {
+ return deviceId;
+ }
+
+ /**
+ * @return the new device owner for the port
+ */
+ public String getDeviceOwner() {
+ return deviceOwner;
+ }
+
+ /**
+ * @return a new set of fixed ips this port will get assigned
+ */
+ public Set<IP> getFixedIps() {
+ return fixedIps;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ UpdatePortRequest updatePortRequest = new UpdatePortRequest();
+
+ if (this.name != null)
+ updatePortRequest.name = this.name;
+ if (this.adminStateUp != null)
+ updatePortRequest.admin_state_up = this.adminStateUp;
+ if (this.deviceId != null)
+ updatePortRequest.device_id = this.deviceId;
+ if (this.deviceOwner != null)
+ updatePortRequest.device_owner = this.deviceOwner;
+ if (!this.fixedIps.isEmpty()) {
+ updatePortRequest.fixed_ips = Sets.newHashSet();
+ for (IP fixedIp : this.fixedIps) {
+ UpdatePortRequest.IP requestIp = new UpdatePortRequest.IP();
+ requestIp.ip_address = fixedIp.getIpAddress();
+ requestIp.subnet_id = fixedIp.getSubnetId();
+ updatePortRequest.fixed_ips.add(requestIp);
+ }
+ }
+
+ return bindToRequest(request, ImmutableMap.of("port", updatePortRequest));
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ return jsonBinder.bindToRequest(request, input);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/UpdateRouterOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/UpdateRouterOptions.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/UpdateRouterOptions.java
new file mode 100644
index 0000000..c614e91
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/UpdateRouterOptions.java
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * 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_0.options;
+
+import com.google.common.collect.ImmutableMap;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.openstack.neutron.v2_0.domain.ExternalGatewayInfo;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import javax.inject.Inject;
+import java.util.Map;
+
+public class UpdateRouterOptions implements MapBinder {
+
+ @Inject
+ private BindToJsonPayload jsonBinder;
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromUpdateRouterOptions(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String name;
+ protected Boolean adminStateUp;
+ protected ExternalGatewayInfo externalGatewayInfo;
+
+ /**
+ * @see UpdateRouterOptions#getName()
+ */
+ public T name(String name) {
+ this.name = name;
+ return self();
+ }
+
+ /**
+ * @see UpdateRouterOptions#getAdminStateUp()
+ */
+ public T adminStateUp(Boolean adminStateUp) {
+ this.adminStateUp = adminStateUp;
+ return self();
+ }
+
+ /**
+ * @see UpdateRouterOptions#getExternalGatewayInfo()
+ */
+ public T externalGatewayInfo(ExternalGatewayInfo externalGatewayInfo) {
+ this.externalGatewayInfo = externalGatewayInfo;
+ return self();
+ }
+
+ public UpdateRouterOptions build() {
+ return new UpdateRouterOptions(name, adminStateUp, externalGatewayInfo);
+ }
+
+ public T fromUpdateRouterOptions(UpdateRouterOptions options) {
+ return this.name(options.getName())
+ .adminStateUp(options.getAdminStateUp())
+ .externalGatewayInfo(options.getExternalGatewayInfo());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ protected static class UpdateRouterRequest {
+ protected String name;
+ protected Boolean admin_state_up;
+ protected ExternalGatewayInfo external_gateway_info;
+
+ protected UpdateRouterRequest() {
+ }
+
+ protected static final class ExternalGatewayInfo {
+ protected String network_id;
+
+ protected ExternalGatewayInfo(String network_id) {
+ this.network_id = network_id;
+ }
+ }
+ }
+
+ protected String name;
+ protected Boolean adminStateUp;
+ protected ExternalGatewayInfo externalGatewayInfo;
+
+ protected UpdateRouterOptions() {
+ this.name = null;
+ this.adminStateUp = null;
+ this.externalGatewayInfo = null;
+ }
+
+ public UpdateRouterOptions(String name, Boolean adminStateUp, ExternalGatewayInfo externalGatewayInfo) {
+ this.name = name;
+ this.adminStateUp = adminStateUp;
+ this.externalGatewayInfo = externalGatewayInfo;
+ }
+
+ /**
+ * @return the new name for the router
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return the new administrative state for the router
+ */
+ public Boolean getAdminStateUp() {
+ return adminStateUp;
+ }
+
+ /**
+ * @return the new information on external gateway for the router
+ */
+ public ExternalGatewayInfo getExternalGatewayInfo() {
+ return externalGatewayInfo;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ UpdateRouterRequest updateRouterRequest = new UpdateRouterRequest();
+
+ if (this.name != null)
+ updateRouterRequest.name = this.name;
+ if (this.adminStateUp != null)
+ updateRouterRequest.admin_state_up = this.adminStateUp;
+ if (this.externalGatewayInfo != null)
+ updateRouterRequest.external_gateway_info = new UpdateRouterRequest.ExternalGatewayInfo(this.externalGatewayInfo.getNetworkId());
+
+ return bindToRequest(request, ImmutableMap.of("router", updateRouterRequest));
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ return jsonBinder.bindToRequest(request, input);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/UpdateSubnetOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/UpdateSubnetOptions.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/UpdateSubnetOptions.java
new file mode 100644
index 0000000..3f2ec26
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/UpdateSubnetOptions.java
@@ -0,0 +1,215 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * 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_0.options;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.openstack.neutron.v2_0.domain.HostRoute;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import javax.inject.Inject;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+public class UpdateSubnetOptions implements MapBinder {
+
+ @Inject
+ private BindToJsonPayload jsonBinder;
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromUpdateSubnetOptions(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected String name;
+ protected String gatewayIp;
+ protected Boolean enableDhcp;
+ protected Set<String> dnsNameServers;
+ protected Set<HostRoute> hostRoutes;
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.UpdateSubnetOptions#getName()
+ */
+ public T name(String name) {
+ this.name = name;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.UpdateSubnetOptions#getGatewayIp()
+ */
+ public T gatewayIp(String gatewayIp) {
+ this.gatewayIp = gatewayIp;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.UpdateSubnetOptions#getEnableDhcp()
+ */
+ public T enableDhcp(Boolean enableDhcp) {
+ this.enableDhcp = enableDhcp;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.UpdateSubnetOptions#getDnsNameServers()
+ */
+ public T dnsNameServers(Collection<String> dnsNameServers) {
+ this.dnsNameServers = ImmutableSet.copyOf(dnsNameServers);
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.UpdateSubnetOptions#getHostRoutes()
+ */
+ public T hostRoutes(Collection<HostRoute> hostRoutes) {
+ this.hostRoutes = ImmutableSet.copyOf(hostRoutes);
+ return self();
+ }
+
+ public UpdateSubnetOptions build() {
+ return new UpdateSubnetOptions(name, gatewayIp, enableDhcp, dnsNameServers, hostRoutes);
+ }
+
+ public T fromUpdateSubnetOptions(UpdateSubnetOptions in) {
+ return this.name(in.getName())
+ .gatewayIp(in.getGatewayIp())
+ .enableDhcp(in.getEnableDhcp())
+ .dnsNameServers(in.getDnsNameServers())
+ .hostRoutes(in.getHostRoutes());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private static class UpdateSubnetRequest {
+ protected String name;
+ protected String gateway_ip;
+ protected Boolean enable_dhcp;
+ protected Set<String> dns_nameservers;
+ protected Set<HostRoute> host_routes;
+
+ private static class HostRoute {
+ protected String destination;
+ protected String nexthop;
+ }
+ }
+
+ private final String name;
+ private final String gatewayIp;
+ private final Boolean enableDhcp;
+ private final Set<String> dnsNameServers;
+ private final Set<HostRoute> hostRoutes;
+
+ protected UpdateSubnetOptions() {
+ this.name = null;
+ this.gatewayIp = null;
+ this.enableDhcp = null;
+ this.dnsNameServers = Sets.newHashSet();
+ this.hostRoutes = Sets.newHashSet();
+ }
+
+ public UpdateSubnetOptions(String name, String gatewayIp, Boolean enableDhcp, Set<String> dnsNameServers, Set<HostRoute> hostRoutes) {
+ this.name = name;
+ this.gatewayIp = gatewayIp;
+ this.enableDhcp = enableDhcp;
+ this.dnsNameServers = dnsNameServers != null ? ImmutableSet.copyOf(dnsNameServers) : Sets.<String>newHashSet();
+ this.hostRoutes = hostRoutes != null ? ImmutableSet.copyOf(hostRoutes) : Sets.<HostRoute>newHashSet();
+ }
+
+ /**
+ * @return the new name for the subnet
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return the new default gateway used by devices in this subnet
+ */
+ public String getGatewayIp() {
+ return gatewayIp;
+ }
+
+ /**
+ * @return true if DHCP is enabled for this subnet, false if not
+ */
+ public Boolean getEnableDhcp() {
+ return enableDhcp;
+ }
+
+ /**
+ * @return the new set of DNS name servers used by hosts in this subnet
+ */
+ public Set<String> getDnsNameServers() {
+ return dnsNameServers;
+ }
+
+ /**
+ * @return the new set of routes that should be used by devices with IPs from this subnet
+ */
+ public Set<HostRoute> getHostRoutes() {
+ return hostRoutes;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ UpdateSubnetRequest updateSubnetRequest = new UpdateSubnetRequest();
+
+ if (this.name != null)
+ updateSubnetRequest.name = this.name;
+ if (this.gatewayIp != null)
+ updateSubnetRequest.gateway_ip = this.gatewayIp;
+ if (this.enableDhcp != null)
+ updateSubnetRequest.enable_dhcp = this.enableDhcp;
+ if (!this.dnsNameServers.isEmpty())
+ updateSubnetRequest.dns_nameservers = this.dnsNameServers;
+ if (!this.hostRoutes.isEmpty()) {
+ updateSubnetRequest.host_routes = Sets.newHashSet();
+ for (HostRoute hostRoute : this.hostRoutes) {
+ UpdateSubnetRequest.HostRoute requestHostRoute = new UpdateSubnetRequest.HostRoute();
+ requestHostRoute.destination = hostRoute.getDestinationCidr();
+ requestHostRoute.nexthop = hostRoute.getNextHop();
+ updateSubnetRequest.host_routes.add(requestHostRoute);
+ }
+ }
+
+ return bindToRequest(request, ImmutableMap.of("subnet", updateSubnetRequest));
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ return jsonBinder.bindToRequest(request, input);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
new file mode 100644
index 0000000..2365644
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# 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.
+#
+
+org.jclouds.openstack.neutron.v2_0.NeutronApiMetadata
+org.jclouds.openstack.neutron.v2.NeutronApiMetadata
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2/NeutronApiMetadataTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2/NeutronApiMetadataTest.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2/NeutronApiMetadataTest.java
new file mode 100644
index 0000000..f38136a
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2/NeutronApiMetadataTest.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * 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;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.reflect.TypeToken;
+import org.jclouds.View;
+import org.jclouds.apis.internal.BaseApiMetadataTest;
+import org.testng.annotations.Test;
+
+/**
+ * The Neutron metadata test.
+ */
+@Test(groups = "unit", testName = "NeutronApiMetadataTest")
+public class NeutronApiMetadataTest extends BaseApiMetadataTest {
+ public NeutronApiMetadataTest() {
+ super(new NeutronApiMetadata(), ImmutableSet.<TypeToken<? extends View>>of());
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2/extensions/FloatingIPApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2/extensions/FloatingIPApiLiveTest.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2/extensions/FloatingIPApiLiveTest.java
new file mode 100644
index 0000000..a3d5f3d
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2/extensions/FloatingIPApiLiveTest.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * 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.extensions;
+
+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.FloatingIP;
+import org.jclouds.openstack.neutron.v2.domain.IP;
+import org.jclouds.openstack.neutron.v2.domain.Network;
+import org.jclouds.openstack.neutron.v2.domain.NetworkType;
+import org.jclouds.openstack.neutron.v2.domain.Subnet;
+import org.jclouds.openstack.neutron.v2.features.NetworkApi;
+import org.jclouds.openstack.neutron.v2.features.SubnetApi;
+import org.jclouds.openstack.neutron.v2.internal.BaseNeutronApiLiveTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests parsing and Guice wiring of RouterApi
+ */
+@Test(groups = "live", testName = "FloatingIPApiLiveTest")
+public class FloatingIPApiLiveTest extends BaseNeutronApiLiveTest {
+
+ public void testCreateUpdateAndDeleteFloatingIP() {
+ for (String region : api.getConfiguredRegions()) {
+
+ SubnetApi subnetApi = api.getSubnetApi(region);
+ FloatingIPApi floatingIPApi = api.getFloatingIPApi(region).get();
+ NetworkApi networkApi = api.getNetworkApi(region);
+
+ FloatingIP floatingIPGet = null;
+ String ipv4SubnetId = null;
+ Network network = null;
+
+ try {
+ network = networkApi.create(
+ Network.createBuilder("jclouds-network-test").external(true).networkType(NetworkType.LOCAL).build());
+ assertNotNull(network);
+
+ ipv4SubnetId = subnetApi.create(Subnet.createBuilder(network.getId(), "198.51.100.0/24").ipVersion(4)
+ .name("JClouds-Live-IPv4-Subnet").build()).getId();
+
+ floatingIPApi.create(FloatingIP.createBuilder(network.getId()).build());
+
+ /* List and Get test */
+ Set<FloatingIP> floatingIPs = floatingIPApi.list().concat().toSet();
+ FloatingIP floatingIPList = floatingIPs.iterator().next();
+ floatingIPGet = floatingIPApi.get(floatingIPList.getId());
+
+ assertNotNull(floatingIPGet);
+ assertEquals(floatingIPGet, floatingIPList);
+ }
+ finally {
+ try {
+ assertTrue(floatingIPApi.delete(floatingIPGet.getId()));
+ }
+ finally {
+ try {
+ assertTrue(subnetApi.delete(ipv4SubnetId));
+ }
+ finally {
+ assertTrue(networkApi.delete(network.getId()));
+ }
+ }
+ }
+ }
+ }
+
+ public Set<IP> getFixedAddresses(String subnetId) {
+ return ImmutableSet.of(IP.builder().subnetId(subnetId).build());
+ }
+}