You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ra...@apache.org on 2014/11/25 16:34:37 UTC
[15/16] stratos git commit: Jclouds openstack-neutron api 1.8.1 clone
with custom changes
http://git-wip-us.apache.org/repos/asf/stratos/blob/ae5425ee/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Network.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Network.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Network.java
new file mode 100644
index 0000000..ac40019
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Network.java
@@ -0,0 +1,646 @@
+/*
+ * 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.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.Objects;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * A Neutron network
+ *
+ * @see <a
+ * href="http://docs.openstack.org/api/openstack-network/2.0/content/Networks.html">api
+ * doc</a>
+ */
+public class Network {
+
+ private String id;
+ private NetworkStatus status;
+ private ImmutableSet<String> subnets;
+
+ private String name;
+ @Named("admin_state_up")
+ private Boolean adminStateUp;
+ private Boolean shared;
+ @Named("tenant_id")
+ private String tenantId;
+
+ // providernet.py: Provider Networks Extension
+ @Named("provider:network_type")
+ private NetworkType networkType;
+ @Named("provider:physical_network")
+ private String physicalNetworkName;
+ @Named("provider:segmentation_id")
+ private Integer segmentationId;
+
+ // external_net.py: Configurable external gateway modes extension
+ @Named("router:external")
+ private Boolean external;
+
+ // portsecurity.py: VMWare port security
+ @Named("port_security_enabled")
+ private Boolean portSecurity;
+
+ // n1kv.py: Cisco plugin extension; admin rights might be needed
+ @Named("n1kv:profile_id")
+ // UUID
+ private String profileId;
+ @Named("n1kv:multicast_ip")
+ private String multicastIp;
+ @Named("n1kv:segment_add")
+ private String segmentAdd;
+ @Named("n1kv:segment_del")
+ private String segmentDel;
+ @Named("n1kv:member_segments")
+ private String memberSegments;
+
+ // multiprovidernet.py: Multiprovider net extension; Segments and provider
+ // values cannot both be set.
+ private ImmutableSet<NetworkSegment> segments;
+
+ // flavor.py: Flavor support for network and router
+ @Named("flavor:network")
+ private String networkFlavor;
+
+ @ConstructorProperties({"id", "status", "subnets", "name", "admin_state_up", "shared", "tenant_id",
+ "provider:network_type", "provider:physical_network", "provider:segmentation_id", "router:external",
+ "port_security_enabled", "n1kv:profile_id", "n1kv:multicast_ip", "n1kv:segment_add", "n1kv:segment_del",
+ "n1kv:member_segments", "segments", "flavor:network"})
+ private Network(String id, NetworkStatus status, ImmutableSet<String> subnets, String name, Boolean adminStateUp,
+ Boolean shared, String tenantId, NetworkType networkType, String physicalNetworkName, Integer segmentationId,
+ Boolean external, Boolean portSecurity, String profileId, String multicastIp, String segmentAdd,
+ String segmentDel, String memberSegments, ImmutableSet<NetworkSegment> segments, String networkFlavor) {
+ // No checkNotNulls. With Neutron, any of these properties can be left null when used in an update.
+ this.id = id;
+ this.status = status;
+ this.subnets = subnets;
+ this.name = name;
+ this.adminStateUp = adminStateUp;
+ this.shared = shared;
+ this.tenantId = tenantId;
+ this.networkType = networkType;
+ this.physicalNetworkName = physicalNetworkName;
+ this.segmentationId = segmentationId;
+ this.external = external;
+ this.portSecurity = portSecurity;
+ this.profileId = profileId;
+ this.multicastIp = multicastIp;
+ this.segmentAdd = segmentAdd;
+ this.segmentDel = segmentDel;
+ this.memberSegments = memberSegments;
+ this.segments = segments;
+ this.networkFlavor = networkFlavor;
+ }
+
+ /**
+ * Default constructor.
+ */
+ private Network() {}
+
+ /**
+ * Copy constructor
+ * @param network
+ */
+ private Network(Network network) {
+ this(network.id,
+ network.status,
+ network.subnets,
+ network.name,
+ network.adminStateUp,
+ network.shared,
+ network.tenantId,
+ network.networkType,
+ network.physicalNetworkName,
+ network.segmentationId,
+ network.external,
+ network.portSecurity,
+ network.profileId,
+ network.multicastIp,
+ network.segmentAdd,
+ network.segmentDel,
+ network.memberSegments,
+ network.segments,
+ network.networkFlavor);
+ }
+
+ /**
+ * @return the id of the Network
+ */
+ @Nullable
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @return the status of the Network
+ */
+ @Nullable
+ public NetworkStatus getStatus() {
+ return status;
+ }
+
+ /**
+ * @return the subnets of the Network
+ */
+ @Nullable
+ public ImmutableSet<String> getSubnets() {
+ return subnets;
+ }
+
+ /**
+ * @return the name of the Network
+ */
+ @Nullable
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return the adminStateUp of the Network
+ */
+ @Nullable
+ public Boolean getAdminStateUp() {
+ return adminStateUp;
+ }
+
+ /**
+ * The shared attribute can be used to create a public network, i.e.: a network which is shared with all other tenants.
+ * Control of the shared attribute could be reserved to particular users only, such as administrators.
+ * In this case, regular users trying to create a shared network will receive a 403 - Forbidden error.
+ * @return true if the network resource can be accessed by any tenant or not, false if not
+ */
+ @Nullable
+ public Boolean getShared() {
+ return shared;
+ }
+
+ /**
+ * @return the tenantId of the Network
+ */
+ @Nullable
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ /**
+ * @return the networkType of the Network
+ */
+ @Nullable
+ public NetworkType getNetworkType() {
+ return networkType;
+ }
+
+ /**
+ * @return the physicalNetworkName of the Network
+ */
+ @Nullable
+ public String getPhysicalNetworkName() {
+ return physicalNetworkName;
+ }
+
+ /**
+ * @return the segmentationId of the Network
+ */
+ @Nullable
+ public Integer getSegmentationId() {
+ return segmentationId;
+ }
+
+ /**
+ * Adds external network attribute to network resource.
+ * @return the external of the Network
+ */
+ @Nullable
+ public Boolean getExternal() {
+ return external;
+ }
+
+ /**
+ * @return the portSecurity of the Network
+ */
+ @Nullable
+ public Boolean getPortSecurity() {
+ return portSecurity;
+ }
+
+ /**
+ * @return the profileId of the Network
+ */
+ @Nullable
+ public String getProfileId() {
+ return profileId;
+ }
+
+ /**
+ * @return the multicastIp of the Network
+ */
+ @Nullable
+ public String getMulticastIp() {
+ return multicastIp;
+ }
+
+ /**
+ * @return the segmentAdd of the Network
+ */
+ @Nullable
+ public String getSegmentAdd() {
+ return segmentAdd;
+ }
+
+ /**
+ * @return the segmentDel of the Network
+ */
+ @Nullable
+ public String getSegmentDel() {
+ return segmentDel;
+ }
+
+ /**
+ * @return the memberSegments of the Network
+ */
+ @Nullable
+ public String getMemberSegments() {
+ return memberSegments;
+ }
+
+ /**
+ * @return the segments of the Network
+ */
+ @Nullable
+ public ImmutableSet<NetworkSegment> getSegments() {
+ return segments;
+ }
+
+ /**
+ * @return the networkFlavor of the Network
+ */
+ @Nullable
+ public String getNetworkFlavor() {
+ return networkFlavor;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, status, subnets, name, adminStateUp, shared, tenantId, networkType,
+ physicalNetworkName, segmentationId, external, portSecurity, profileId, multicastIp, segmentAdd, segmentDel,
+ memberSegments, segments, networkFlavor);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null || getClass() != obj.getClass())
+ return false;
+ Network that = Network.class.cast(obj);
+ return Objects.equal(this.id, that.id)
+ && Objects.equal(this.status, that.status)
+ && Objects.equal(this.subnets, that.subnets)
+ && Objects.equal(this.name, that.name)
+ && Objects.equal(this.adminStateUp, that.adminStateUp)
+ && Objects.equal(this.shared, that.shared)
+ && Objects.equal(this.tenantId, that.tenantId)
+ && Objects.equal(this.networkType, that.networkType)
+ && Objects.equal(this.physicalNetworkName, that.physicalNetworkName)
+ && Objects.equal(this.segmentationId, that.segmentationId)
+ && Objects.equal(this.external, that.external)
+ && Objects.equal(this.portSecurity, that.portSecurity)
+ && Objects.equal(this.profileId, that.profileId)
+ && Objects.equal(this.multicastIp, that.multicastIp)
+ && Objects.equal(this.segmentAdd, that.segmentAdd)
+ && Objects.equal(this.segmentDel, that.segmentDel)
+ && Objects.equal(this.memberSegments, that.memberSegments)
+ && Objects.equal(this.segments, that.segments)
+ && Objects.equal(this.networkFlavor, that.networkFlavor);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("id", id)
+ .add("status", status)
+ .add("subnets", subnets)
+ .add("name", name)
+ .add("adminStateUp", adminStateUp)
+ .add("shared", shared)
+ .add("tenantId", tenantId)
+ .add("networkType", networkType)
+ .add("physicalNetworkName", physicalNetworkName)
+ .add("segmentationId", segmentationId)
+ .add("external", external)
+ .add("portSecurity", portSecurity)
+ .add("profileId", profileId)
+ .add("multicastIp", multicastIp)
+ .add("segmentAdd", segmentAdd)
+ .add("segmentDel", segmentDel)
+ .add("memberSegments", memberSegments)
+ .add("segments", segments)
+ .add("networkFlavor", networkFlavor)
+ .toString();
+ }
+
+ /*
+ * Methods to get the Create and Update builders follow
+ */
+
+ /**
+ * @return the Builder for creating a new Router
+ */
+ public static CreateBuilder createBuilder(String name) {
+ return new CreateBuilder(name);
+ }
+
+ /**
+ * @return the Builder for updating a Router
+ */
+ public static UpdateBuilder updateBuilder() {
+ return new UpdateBuilder();
+ }
+
+ private abstract static class Builder<ParameterizedBuilderType> {
+ protected Network network;
+
+ /**
+ * No-parameters constructor used when updating.
+ * */
+ private Builder() {
+ network = new Network();
+ }
+
+ protected abstract ParameterizedBuilderType self();
+
+ /**
+ * Provide the name to the Network's Builder.
+ *
+ * @return the Builder.
+ * @see Network#getName()
+ */
+ public ParameterizedBuilderType name(String name) {
+ network.name = name;
+ return self();
+ }
+
+ /**
+ * Provide the adminStateUp to the Network's Builder.
+ *
+ * @return the Builder.
+ * @see Network#isAdminStateUp()
+ */
+ public ParameterizedBuilderType adminStateUp(Boolean adminStateUp) {
+ network.adminStateUp = adminStateUp;
+ return self();
+ }
+
+ /**
+ * Provide the shared to the Network's Builder.
+ *
+ * @return the Builder.
+ * @see Network#isShared()
+ */
+ public ParameterizedBuilderType shared(Boolean shared) {
+ network.shared = shared;
+ return self();
+ }
+
+ /**
+ * Provide the tenantId to the Network's Builder.
+ *
+ * @return the Builder.
+ * @see Network#getTenantId()
+ */
+ public ParameterizedBuilderType tenantId(String tenantId) {
+ network.tenantId = tenantId;
+ return self();
+ }
+
+ /**
+ * Provide the networkType to the Network's Builder.
+ *
+ * @return the Builder.
+ * @see Network#getNetworkType()
+ */
+ public ParameterizedBuilderType networkType(NetworkType networkType) {
+ network.networkType = networkType;
+ return self();
+ }
+
+ /**
+ * Provide the physicalNetworkName to the Network's Builder.
+ *
+ * @return the Builder.
+ * @see Network#getPhysicalNetworkName()
+ */
+ public ParameterizedBuilderType physicalNetworkName(String physicalNetworkName) {
+ network.physicalNetworkName = physicalNetworkName;
+ return self();
+ }
+
+ /**
+ * Provide the segmentationId to the Network's Builder.
+ *
+ * @return the Builder.
+ * @see Network#getSegmentationId()
+ */
+ public ParameterizedBuilderType segmentationId(Integer segmentationId) {
+ network.segmentationId = segmentationId;
+ return self();
+ }
+
+ /**
+ * Adds external network attribute to network resource.
+ *
+ * @return the Builder.
+ * @see Network#isExternal()
+ */
+ public ParameterizedBuilderType external(Boolean external) {
+ network.external = external;
+ return self();
+ }
+
+ /**
+ * Provide the portSecurity to the Network's Builder.
+ *
+ * @return the Builder.
+ * @see Network#isPortSecurity()
+ */
+ public ParameterizedBuilderType portSecurity(Boolean portSecurity) {
+ network.portSecurity = portSecurity;
+ return self();
+ }
+
+ /**
+ * Provide the profileId to the Network's Builder.
+ *
+ * @return the Builder.
+ * @see Network#getProfileId()
+ */
+ public ParameterizedBuilderType profileId(String profileId) {
+ network.profileId = profileId;
+ return self();
+ }
+
+ /**
+ * Provide the multicastIp to the Network's Builder.
+ *
+ * @return the Builder.
+ * @see Network#getMulticastIp()
+ */
+ public ParameterizedBuilderType multicastIp(String multicastIp) {
+ network.multicastIp = multicastIp;
+ return self();
+ }
+
+ /**
+ * Provide the segmentAdd to the Network's Builder.
+ * Cisco plugin extension; admin right might be needed to use this.
+ *
+ * @return the Builder.
+ * @see Network#getSegmentAdd()
+ */
+ public ParameterizedBuilderType segmentAdd(String segmentAdd) {
+ network.segmentAdd = segmentAdd;
+ return self();
+ }
+
+ /**
+ * Provide the segmentDel to the Network's Builder.
+ * Cisco plugin extension; admin right might be needed to use this.
+ *
+ * @return the Builder.
+ * @see Network#getSegmentDel()
+ */
+ public ParameterizedBuilderType segmentDel(String segmentDel) {
+ network.segmentDel = segmentDel;
+ return self();
+ }
+
+ /**
+ * Provide the memberSegments to the Network's Builder.
+ * Cisco plugin extension; admin right might be needed to use this.
+ *
+ * @return the Builder.
+ * @see Network#getMemberSegments()
+ */
+ public ParameterizedBuilderType memberSegments(String memberSegments) {
+ network.memberSegments = memberSegments;
+ return self();
+ }
+
+ /**
+ * Provide the segments to the Network's Builder.
+ * Multiprovider extension.
+ *
+ * @return the Builder.
+ * @see Network#getSegments()
+ */
+ public ParameterizedBuilderType segments(ImmutableSet<NetworkSegment> segments) {
+ network.segments = segments;
+ return self();
+ }
+
+ /**
+ * Provide the networkFlavor to the Network's Builder.
+ *
+ * @return the Builder.
+ * @see Network#getNetworkFlavor()
+ */
+ public ParameterizedBuilderType networkFlavor(String networkFlavor) {
+ network.networkFlavor = networkFlavor;
+ return self();
+ }
+ }
+
+ /**
+ * Create and Update builders (inheriting from Builder)
+ */
+ public static class CreateBuilder extends Builder<CreateBuilder> {
+ /**
+ * Supply required properties for creating a Builder
+ */
+ private CreateBuilder(String name) {
+ network.name = name;
+ }
+
+ /**
+ * @return a CreateNetwork constructed with this Builder.
+ */
+ public CreateNetwork build() {
+ return new CreateNetwork(network);
+ }
+
+ protected CreateBuilder self() {
+ return this;
+ }
+ }
+
+ /**
+ * Create and Update builders (inheriting from Builder)
+ */
+ public static class UpdateBuilder extends Builder<UpdateBuilder> {
+ /**
+ * Supply required properties for updating a Builder
+ */
+ private UpdateBuilder() {
+ }
+
+ /**
+ * @return a UpdateNetwork constructed with this Builder.
+ */
+ public UpdateNetwork build() {
+ return new UpdateNetwork(network);
+ }
+
+ protected UpdateBuilder self() {
+ return this;
+ }
+ }
+
+ /**
+ * 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 CreateNetwork extends Network {
+ /**
+ * Copy constructor
+ */
+ private CreateNetwork(Network network) {
+ super(network);
+ checkNotNull(network.name, "name should not be null");
+ }
+ }
+
+ /**
+ * 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 UpdateNetwork extends Network {
+ /**
+ * Copy constructor
+ */
+ private UpdateNetwork(Network network) {
+ super(network);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ae5425ee/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/NetworkSegment.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/NetworkSegment.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/NetworkSegment.java
new file mode 100644
index 0000000..aacd5c1
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/NetworkSegment.java
@@ -0,0 +1,167 @@
+/*
+ * 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.domain;
+
+import com.google.common.base.Objects;
+import org.jclouds.javax.annotation.Nullable;
+
+import javax.inject.Named;
+import java.beans.ConstructorProperties;
+
+/**
+ * A Neutron Network Segment
+ * Segments and provider values cannot both be set.
+ *
+ * @see <a
+ * href="http://docs.openstack.org/api/openstack-network/2.0/content/Subnets.html">api
+ * doc</a>
+ */
+public class NetworkSegment {
+
+ @Named("provider:network_type")
+ protected final NetworkType networkType;
+ @Named("provider:physical_network")
+ protected final String physicalNetwork;
+ @Named("provider:segmentation_id")
+ protected final Integer segmentationId;
+
+ @ConstructorProperties({"provider:network_type", "provider:physical_network", "provider:segmentation_id"})
+ protected NetworkSegment(NetworkType networkType, String physicalNetwork, Integer segmentationId) {
+ this.networkType = networkType;
+ this.physicalNetwork = physicalNetwork;
+ this.segmentationId = segmentationId;
+ }
+
+ /**
+ * @return the networkType of the NetworkSegment
+ */
+ @Nullable
+ public NetworkType getNetworkType() {
+ return networkType;
+ }
+
+ /**
+ * @return the physicalNetwork of the NetworkSegment
+ */
+ @Nullable
+ public String getPhysicalNetwork() {
+ return physicalNetwork;
+ }
+
+ /**
+ * @return the segmentationId of the NetworkSegment
+ */
+ @Nullable
+ public Integer getSegmentationId() {
+ return segmentationId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(networkType, physicalNetwork, segmentationId);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null || getClass() != obj.getClass())
+ return false;
+ NetworkSegment that = NetworkSegment.class.cast(obj);
+ return Objects.equal(this.networkType, that.networkType)
+ && Objects.equal(this.physicalNetwork, that.physicalNetwork)
+ && Objects.equal(this.segmentationId, that.segmentationId);
+ }
+
+ protected Objects.ToStringHelper string() {
+ return Objects.toStringHelper(this).add("networkType", networkType).add("physicalNetwork", physicalNetwork)
+ .add("segmentationId", segmentationId);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+ /**
+ * @return the Builder for NetworkSegment
+ */
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * Gets a Builder configured as this object.
+ */
+ public Builder toBuilder() {
+ return new Builder().fromNetworkSegment(this);
+ }
+
+ public static class Builder {
+ protected NetworkType networkType;
+ protected String physicalNetwork;
+ protected Integer segmentationId;
+
+ /**
+ * Provide the networkType to the NetworkSegment's Builder.
+ *
+ * @return the Builder.
+ * @see NetworkSegment#getNetworkType()
+ */
+ public Builder networkType(NetworkType networkType) {
+ this.networkType = networkType;
+ return this;
+ }
+
+ /**
+ * Provide the physicalNetwork to the NetworkSegment's Builder.
+ *
+ * @return the Builder.
+ * @see NetworkSegment#getPhysicalNetwork()
+ */
+ public Builder physicalNetwork(String physicalNetwork) {
+ this.physicalNetwork = physicalNetwork;
+ return this;
+ }
+
+ /**
+ * Provide the segmentationId to the NetworkSegment's Builder.
+ *
+ * @return the Builder.
+ * @see NetworkSegment#getSegmentationId()
+ */
+ public Builder segmentationId(int segmentationId) {
+ this.segmentationId = segmentationId;
+ return this;
+ }
+
+ /**
+ * @return a NetworkSegment constructed with this Builder.
+ */
+ public NetworkSegment build() {
+ return new NetworkSegment(networkType, physicalNetwork, segmentationId);
+ }
+
+ /**
+ * @return a Builder from another NetworkSegment.
+ */
+ public Builder fromNetworkSegment(NetworkSegment in) {
+ return this.networkType(in.getNetworkType()).physicalNetwork(in.getPhysicalNetwork())
+ .segmentationId(in.getSegmentationId());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ae5425ee/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/NetworkStatus.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/NetworkStatus.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/NetworkStatus.java
new file mode 100644
index 0000000..04334d0
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/NetworkStatus.java
@@ -0,0 +1,60 @@
+/*
+ * 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.domain;
+
+/**
+ * Enumerates Network Status.
+ */
+public enum NetworkStatus {
+ ACTIVE("active"),
+ DOWN("down"),
+ BUILD("build"),
+ ERROR("error"),
+ /**
+ * Used by jclouds when the service returns an unknown value other than null.
+ */
+ UNRECOGNIZED("unrecognized");
+
+ private final String name;
+
+ private NetworkStatus(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String toString() {
+ return name();
+ }
+
+ /*
+ * This provides GSON enum support in jclouds.
+ * @param name The string representation of this enum value.
+ * @return The corresponding enum value.
+ */
+ public static NetworkStatus fromValue(String name) {
+ if (name != null) {
+ for (NetworkStatus value : NetworkStatus.values()) {
+ if (name.equalsIgnoreCase(value.name)) {
+ return value;
+ }
+ }
+ return UNRECOGNIZED;
+ }
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ae5425ee/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/NetworkType.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/NetworkType.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/NetworkType.java
new file mode 100644
index 0000000..89c3e9a
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/NetworkType.java
@@ -0,0 +1,81 @@
+/*
+ * 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.domain;
+
+/**
+ * Enumerates supported Network types.
+ */
+public enum NetworkType {
+ /**
+ * Used to describe a local network.
+ */
+ LOCAL("local"),
+ /**
+ * Used to describe a flat network.
+ */
+ FLAT("flat"),
+ /**
+ * Used to describe a VLAN network. NetworkSegment might have to be set.
+ */
+ VLAN("vlan"),
+ /**
+ * 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
+ * associated by the openvswitch plugin with specific physical networks.
+ */
+ GRE("gre"),
+ /**
+ * Used by jclouds when the service returns an unknown value other than null.
+ */
+ UNRECOGNIZED("unrecognized");
+
+ private String name;
+
+ private NetworkType(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+
+ /*
+ * This provides GSON enum support in jclouds.
+ * @param name The string representation of this enum value.
+ * @return The corresponding enum value.
+ */
+ public static NetworkType fromValue(String name) {
+ if (name != null) {
+ for (NetworkType value : NetworkType.values()) {
+ if (name.equalsIgnoreCase(value.name)) {
+ return value;
+ }
+ }
+ return UNRECOGNIZED;
+ }
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ae5425ee/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Networks.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Networks.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Networks.java
new file mode 100644
index 0000000..9b3bf10
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Networks.java
@@ -0,0 +1,36 @@
+/*
+ * 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.domain;
+
+import java.beans.ConstructorProperties;
+
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * A collection of Networks
+ */
+public class Networks extends PaginatedCollection<Network> {
+ public static final Networks EMPTY = new Networks(ImmutableSet.<Network> of(), ImmutableSet.<Link> of());
+
+ @ConstructorProperties({"networks", "networks_links"})
+ protected Networks(Iterable<Network> networks, Iterable<Link> networksLinks) {
+ super(networks, networksLinks);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ae5425ee/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Port.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Port.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Port.java
new file mode 100644
index 0000000..a9ab61e
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Port.java
@@ -0,0 +1,763 @@
+/*
+ * 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.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.Objects;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * A Neutron port
+ *
+ * @see <a
+ * href="http://docs.openstack.org/api/openstack-network/1.0/content/Ports.html">api
+ * doc</a>
+ */
+public class Port {
+
+ private String id;
+ private NetworkStatus status;
+
+ // Extensions
+
+ // portbindings.py
+ // The service will return the vif type for the specific port.
+ @Named("binding:vif_type")
+ private VIFType vifType;
+ // The service may return a dictionary containing additional
+ // information needed by the interface driver. The set of items
+ // returned may depend on the value of VIF_TYPE.
+ @Named("binding:vif_details")
+ private ImmutableMap<String, Object> vifDetails;
+
+ // Plugins
+
+ // qos.py
+ @Named("queue_id")
+ private String qosQueueId;
+
+ private String name;
+ @Named("network_id")
+ private String networkId;
+ @Named("admin_state_up")
+ private Boolean adminStateUp;
+ @Named("mac_address")
+ private String macAddress;
+ @Named("fixed_ips")
+ private ImmutableSet<IP> fixedIps;
+ @Named("device_id")
+ private String deviceId;
+ @Named("device_owner")
+ private String deviceOwner;
+ @Named("tenant_id")
+ private String tenantId;
+ @Named("security_groups")
+ private ImmutableSet<String> securityGroups;
+
+ // Extensions
+
+ // allowedaddresspairs.py
+ @Named("allowed_address_pairs")
+ private ImmutableSet<AddressPair> allowedAddressPairs;
+
+ // extra_dhcp_opt.py
+ @Named("extra_dhcp_opts")
+ private ImmutableSet<ExtraDhcpOption> extraDhcpOptions;
+
+ // portbindings.py
+ // The type of vnic that this port should be attached to
+ @Named("binding:vnic_type")
+ private VNICType vnicType;
+ // In some cases different implementations may be run on different hosts.
+ // The host on which the port will be allocated.
+ @Named("binding:host_id")
+ private String hostId;
+ // The profile will be a dictionary that enables the application running
+ // on the specific host to pass and receive vif port specific information to
+ // the plugin.
+ @Named("binding:profile")
+ private ImmutableMap<String, Object> profile;
+
+ // portsecurity.py
+ @Named("port_security_enabled")
+ private Boolean portSecurity;
+
+ // Plugins
+
+ // n1kv.py
+ @Named("n1kv:profile_id")
+ private String profileId;
+
+ // maclearning.py
+ @Named("mac_learning_enabled")
+ private Boolean macLearning;
+
+ // qos.py
+ @Named("rxtx_factor")
+ private Integer qosRxtxFactor;
+
+ @ConstructorProperties({"id", "status", "binding:vif_type", "binding:vif_details", "queue_id", "name", "network_id",
+ "admin_state_up", "mac_address", "fixed_ips", "device_id", "device_owner", "tenant_id", "security_groups",
+ "allowed_address_pairs", "extra_dhcp_opts", "binding:vnic_type", "binding:host_id", "binding:profile",
+ "port_security_enabled", "n1kv:profile_id", "mac_learning_enabled", "rxtx_factor"})
+ protected Port(String id, NetworkStatus status, VIFType vifType, ImmutableMap<String, Object> vifDetails, String qosQueueId,
+ String name, String networkId, Boolean adminStateUp, String macAddress, ImmutableSet<IP> fixedIps, String deviceId,
+ String deviceOwner, String tenantId, ImmutableSet<String> securityGroups, ImmutableSet<AddressPair> allowedAddressPairs,
+ ImmutableSet<ExtraDhcpOption> extraDhcpOptions, VNICType vnicType, String hostId, ImmutableMap<String, Object> profile,
+ Boolean portSecurity, String profileId, Boolean macLearning, Integer qosRxtxFactor) {
+ this.id = id;
+ this.status = status;
+ this.vifType = vifType;
+ this.vifDetails = vifDetails;
+ this.qosQueueId = qosQueueId;
+ this.name = name;
+ this.networkId = networkId;
+ this.adminStateUp = adminStateUp;
+ this.macAddress = macAddress;
+ this.fixedIps = fixedIps;
+ this.deviceId = deviceId;
+ this.deviceOwner = deviceOwner;
+ this.tenantId = tenantId;
+ this.securityGroups = securityGroups;
+ this.allowedAddressPairs = allowedAddressPairs;
+ this.extraDhcpOptions = extraDhcpOptions;
+ this.vnicType = vnicType;
+ this.hostId = hostId;
+ this.profile = profile;
+ this.portSecurity = portSecurity;
+ this.profileId = profileId;
+ this.macLearning = macLearning;
+ this.qosRxtxFactor = qosRxtxFactor;
+ }
+
+ /**
+ * Default constructor.
+ */
+ private Port() {}
+
+ /**
+ * Copy constructor
+ * @param port
+ */
+ private Port(Port port) {
+ this(port.id,
+ port.status,
+ port.vifType,
+ port.vifDetails,
+ port.qosQueueId,
+ port.name,
+ port.networkId,
+ port.adminStateUp,
+ port.macAddress,
+ port.fixedIps,
+ port.deviceId,
+ port.deviceOwner,
+ port.tenantId,
+ port.securityGroups,
+ port.allowedAddressPairs,
+ port.extraDhcpOptions,
+ port.vnicType,
+ port.hostId,
+ port.profile,
+ port.portSecurity,
+ port.profileId,
+ port.macLearning,
+ port.qosRxtxFactor);
+ }
+
+ /**
+ * @return the id of the Port
+ */
+ @Nullable
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @return the status of the Port
+ */
+ @Nullable
+ public NetworkStatus getStatus() {
+ return status;
+ }
+
+ /**
+ *
+ * @return the vifType of the Port. Visible to only administrative users.
+ *
+ */
+ @Nullable
+ public VIFType getVifType() {
+ return vifType;
+ }
+
+ /**
+ * @return the vifDetails of the Port. A dictionary that enables the application to pass information about functions
+ * that Networking API v2.0 provides. Specify the following value: port_filter : Boolean to define whether
+ * Networking API v2.0 provides port filtering features such as security group and anti-MAC/IP spoofing. Visible to
+ * only administrative users.
+ */
+ @Nullable
+ public ImmutableMap<String, Object> getVifDetails() {
+ return vifDetails;
+ }
+
+ /**
+ * @return the qosQueueId of the Port
+ */
+ @Nullable
+ public String getQosQueueId() {
+ return qosQueueId;
+ }
+
+ /**
+ * @return the name of the Port
+ */
+ @Nullable
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return the id of the network where this port is associated with.
+ */
+ @Nullable
+ public String getNetworkId() {
+ return networkId;
+ }
+
+ /**
+ * @return the administrative state of port. If false, port does not forward packets.
+ */
+ @Nullable
+ public Boolean getAdminStateUp() {
+ return adminStateUp;
+ }
+
+ /**
+ * @return the macAddress of the Port
+ */
+ @Nullable
+ public String getMacAddress() {
+ return macAddress;
+ }
+
+ /**
+ * @return the set of fixed ips this port has been assigned.
+ */
+ @Nullable
+ public ImmutableSet<IP> getFixedIps() {
+ return fixedIps;
+ }
+
+ /**
+ * @return the id of the device (e.g. server) using this port.
+ */
+ @Nullable
+ public String getDeviceId() {
+ return deviceId;
+ }
+
+ /**
+ * @return the entity (e.g.: dhcp agent) using this port.
+ */
+ @Nullable
+ public String getDeviceOwner() {
+ return deviceOwner;
+ }
+
+ /**
+ * @return the tenantId of the Port
+ */
+ @Nullable
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ /**
+ * @return the set of security groups
+ */
+ @Nullable
+ public ImmutableSet<String> getSecurityGroups() {
+ return securityGroups;
+ }
+
+ /**
+ * @return the allowedAddressPairs of the Port
+ */
+ @Nullable
+ public ImmutableSet<AddressPair> getAllowedAddressPairs() {
+ return allowedAddressPairs;
+ }
+
+ /**
+ * @return the extraDhcpOptions of the Port
+ */
+ @Nullable
+ public ImmutableSet<ExtraDhcpOption> getExtraDhcpOptions() {
+ return extraDhcpOptions;
+ }
+
+ /**
+ * @return the vnicType of the Port. This extended attribute is visible to only port owners and administrative users.
+ * Specifies a value of normal (virtual nic), direct (pci passthrough), or macvtap (virtual interface with a
+ * tap-like software interface). These values support SR-IOV PCI passthrough networking. The ML2 plug-in supports
+ * the vnic_type.
+ */
+ @Nullable
+ public VNICType getVnicType() {
+ return vnicType;
+ }
+
+ /**
+ * @return the hostId of the Port. The ID of the host where the port is allocated. In some cases, different
+ * implementations can run on different hosts. Visible to only administrative users.
+ */
+ @Nullable
+ public String getHostId() {
+ return hostId;
+ }
+
+ /**
+ * @return the profile of the Port. A dictionary that enables the application to pass information about functions
+ * that the Networking API provides. To enable or disable port filtering features such as security group and
+ * anti-MAC/IP spoofing, specify port_filter: True or port_filter: False. Visible to only administrative users.
+ */
+ @Nullable
+ public ImmutableMap<String, Object> getProfile() {
+ return profile;
+ }
+
+ /**
+ * @return the portSecurity of the Port
+ */
+ @Nullable
+ public Boolean getPortSecurity() {
+ return portSecurity;
+ }
+
+ /**
+ * @return the profileId of the Port
+ */
+ @Nullable
+ public String getProfileId() {
+ return profileId;
+ }
+
+ /**
+ * @return the macLearning of the Port
+ */
+ @Nullable
+ public Boolean getMacLearning() {
+ return macLearning;
+ }
+
+ /**
+ * @return the qosRxtxFactor of the Port
+ */
+ @Nullable
+ public Integer getQosRxtxFactor() {
+ return qosRxtxFactor;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ Port that = (Port) o;
+
+ return Objects.equal(this.id, that.id) &&
+ Objects.equal(this.status, that.status) &&
+ Objects.equal(this.vifType, that.vifType) &&
+ Objects.equal(this.vifDetails, that.vifDetails) &&
+ Objects.equal(this.qosQueueId, that.qosQueueId) &&
+ Objects.equal(this.name, that.name) &&
+ Objects.equal(this.networkId, that.networkId) &&
+ Objects.equal(this.adminStateUp, that.adminStateUp) &&
+ Objects.equal(this.macAddress, that.macAddress) &&
+ Objects.equal(this.fixedIps, that.fixedIps) &&
+ Objects.equal(this.deviceId, that.deviceId) &&
+ Objects.equal(this.deviceOwner, that.deviceOwner) &&
+ Objects.equal(this.tenantId, that.tenantId) &&
+ Objects.equal(this.securityGroups, that.securityGroups) &&
+ Objects.equal(this.allowedAddressPairs, that.allowedAddressPairs) &&
+ Objects.equal(this.extraDhcpOptions, that.extraDhcpOptions) &&
+ Objects.equal(this.vnicType, that.vnicType) &&
+ Objects.equal(this.hostId, that.hostId) &&
+ Objects.equal(this.profile, that.profile) &&
+ Objects.equal(this.portSecurity, that.portSecurity) &&
+ Objects.equal(this.profileId, that.profileId) &&
+ Objects.equal(this.macLearning, that.macLearning) &&
+ Objects.equal(this.qosRxtxFactor, that.qosRxtxFactor);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, status, vifType, vifDetails, qosQueueId, name,
+ networkId, adminStateUp, macAddress, fixedIps, deviceId,
+ deviceOwner, tenantId, securityGroups, allowedAddressPairs, extraDhcpOptions,
+ vnicType, hostId, profile, portSecurity, profileId,
+ macLearning, qosRxtxFactor);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("id", id)
+ .add("status", status)
+ .add("vifType", vifType)
+ .add("vifDetails", vifDetails)
+ .add("qosQueueId", qosQueueId)
+ .add("name", name)
+ .add("networkId", networkId)
+ .add("adminStateUp", adminStateUp)
+ .add("macAddress", macAddress)
+ .add("fixedIps", fixedIps)
+ .add("deviceId", deviceId)
+ .add("deviceOwner", deviceOwner)
+ .add("tenantId", tenantId)
+ .add("securityGroups", securityGroups)
+ .add("allowedAddressPairs", allowedAddressPairs)
+ .add("extraDhcpOptions", extraDhcpOptions)
+ .add("vnicType", vnicType)
+ .add("hostId", hostId)
+ .add("profile", profile)
+ .add("portSecurity", portSecurity)
+ .add("profileId", profileId)
+ .add("macLearning", macLearning)
+ .add("qosRxtxFactor", qosRxtxFactor)
+ .toString();
+ }
+
+ /*
+ * Methods to get the Create and Update builders follow
+ */
+
+ /**
+ * @return the Builder for creating a new Router
+ */
+ public static CreateBuilder createBuilder(String networkId) {
+ return new CreateBuilder(networkId);
+ }
+
+ /**
+ * @return the Builder for updating a Router
+ */
+ public static UpdateBuilder updateBuilder() {
+ return new UpdateBuilder();
+ }
+
+ private abstract static class Builder<ParameterizedBuilderType> {
+ protected Port port;
+
+ /**
+ * No-parameters constructor used when updating.
+ */
+ private Builder() {
+ port = new Port();
+ }
+
+ protected abstract ParameterizedBuilderType self();
+
+ /**
+ * Provide the name to the Port's Builder.
+ *
+ * @return the Builder.
+ * @see Port#getName()
+ */
+ public ParameterizedBuilderType name(String name) {
+ port.name = name;
+ return self();
+ }
+
+ /**
+ * Provide the networkId to the Port's Builder.
+ *
+ * @return the Builder.
+ * @see Port#getNetworkId()
+ */
+ public ParameterizedBuilderType networkId(String networkId) {
+ port.networkId = networkId;
+ return self();
+ }
+
+ /**
+ * Provide the adminStateUp to the Port's Builder.
+ *
+ * @return the Builder.
+ * @see Port#getAdminStateUp()
+ */
+ public ParameterizedBuilderType adminStateUp(Boolean adminStateUp) {
+ port.adminStateUp = adminStateUp;
+ return self();
+ }
+
+ /**
+ * Provide the macAddress to the Port's Builder.
+ *
+ * @return the Builder.
+ * @see Port#getMacAddress()
+ */
+ public ParameterizedBuilderType macAddress(String macAddress) {
+ port.macAddress = macAddress;
+ return self();
+ }
+
+ /**
+ * Provide the fixedIps to the Port's Builder.
+ *
+ * @return the Builder.
+ * @see Port#getFixedIps()
+ */
+ public ParameterizedBuilderType fixedIps(ImmutableSet<IP> fixedIps) {
+ port.fixedIps = fixedIps;
+ return self();
+ }
+
+ /**
+ * Provide the deviceId to the Port's Builder.
+ *
+ * @return the Builder.
+ * @see Port#getDeviceId()
+ */
+ public ParameterizedBuilderType deviceId(String deviceId) {
+ port.deviceId = deviceId;
+ return self();
+ }
+
+ /**
+ * Provide the deviceOwner to the Port's Builder.
+ *
+ * @return the Builder.
+ * @see Port#getDeviceOwner()
+ */
+ public ParameterizedBuilderType deviceOwner(String deviceOwner) {
+ port.deviceOwner = deviceOwner;
+ return self();
+ }
+
+ /**
+ * Provide the tenantId to the Port's Builder.
+ *
+ * @return the Builder.
+ * @see Port#getTenantId()
+ */
+ public ParameterizedBuilderType tenantId(String tenantId) {
+ port.tenantId = tenantId;
+ return self();
+ }
+
+ /**
+ * Provide the tenantId to the Port's Builder.
+ *
+ * @return the Builder.
+ * @see Port#getSecurityGroups()
+ */
+ public ParameterizedBuilderType securityGroups(ImmutableSet<String> securityGroups) {
+ port.securityGroups = securityGroups;
+ return self();
+ }
+
+ /**
+ * Provide the allowedAddressPairs to the Port's Builder.
+ *
+ * @return the Builder.
+ * @see Port#getAllowedAddressPairs()
+ */
+ public ParameterizedBuilderType allowedAddressPairs(ImmutableSet<AddressPair> allowedAddressPairs) {
+ port.allowedAddressPairs = allowedAddressPairs;
+ return self();
+ }
+
+ /**
+ * Provide the extraDhcpOptions to the Port's Builder.
+ *
+ * @return the Builder.
+ * @see Port#getExtraDhcpOptions()
+ */
+ public ParameterizedBuilderType extraDhcpOptions(ImmutableSet<ExtraDhcpOption> extraDhcpOptions) {
+ port.extraDhcpOptions = extraDhcpOptions;
+ return self();
+ }
+
+ /**
+ * Provide the vnicType to the Port's Builder.
+ * Specify a value of normal (virtual nic), direct (pci passthrough), or macvtap (virtual interface with a
+ * tap-like software interface). These values support SR-IOV PCI passthrough networking. The ML2 plug-in supports
+ * the vnic_type.
+ *
+ * @return the Builder.
+ * @see Port#getVnicType()
+ */
+ public ParameterizedBuilderType vnicType(VNICType vnicType) {
+ port.vnicType = vnicType;
+ return self();
+ }
+
+ /**
+ * Provide the hostId to the Port's Builder.
+ *
+ * @return the Builder.
+ * @see Port#getHostId()
+ */
+ public ParameterizedBuilderType hostId(String hostId) {
+ port.hostId = hostId;
+ return self();
+ }
+
+ /**
+ * Provide the profile to the Port's Builder.
+ * This attribute is a dictionary that can be used (with admin credentials) to supply information influencing the
+ * binding of the port. This functionality is needed for SR-IOV PCI passthrough.
+ *
+ * @return the Builder.
+ * @see Port#getProfile()
+ */
+ public ParameterizedBuilderType profile(ImmutableMap<String, Object> profile) {
+ port.profile = profile;
+ return self();
+ }
+
+ /**
+ * Provide the portSecurity to the Port's Builder.
+ *
+ * @return the Builder.
+ * @see Port#getPortSecurity()
+ */
+ public ParameterizedBuilderType portSecurity(Boolean portSecurity) {
+ port.portSecurity = portSecurity;
+ return self();
+ }
+
+ /**
+ * Provide the profileId to the Port's Builder.
+ *
+ * @return the Builder.
+ * @see Port#getProfileId()
+ */
+ public ParameterizedBuilderType profileId(String profileId) {
+ port.profileId = profileId;
+ return self();
+ }
+
+ /**
+ * Provide the macLearning to the Port's Builder.
+ *
+ * @return the Builder.
+ * @see Port#getMacLearning()
+ */
+ public ParameterizedBuilderType macLearning(Boolean macLearning) {
+ port.macLearning = macLearning;
+ return self();
+ }
+
+ /**
+ * Provide the qosRxtxFactor to the Port's Builder.
+ *
+ * @return the Builder.
+ * @see Port#getQosRxtxFactor()
+ */
+ public ParameterizedBuilderType qosRxtxFactor(int qosRxtxFactor) {
+ port.qosRxtxFactor = qosRxtxFactor;
+ return self();
+ }
+ }
+
+ /**
+ * Create and Update builders (inheriting from Builder)
+ */
+ public static class CreateBuilder extends Builder<CreateBuilder> {
+ /**
+ *
+ * Supply required properties for creating a Builder
+ */
+ private CreateBuilder(String networkId) {
+ port.networkId = networkId;
+ }
+
+ /**
+ * @return a CreatePort constructed with this Builder.
+ */
+ public CreatePort build() {
+ return new CreatePort(port);
+ }
+
+ protected CreateBuilder self() {
+ return this;
+ }
+ }
+
+ /**
+ * Create and Update builders (inheriting from Builder)
+ */
+ public static class UpdateBuilder extends Builder<UpdateBuilder> {
+ /**
+ * Supply required properties for updating a Builder
+ */
+ private UpdateBuilder() {
+ }
+
+ /**
+ * @return a UpdatePort constructed with this Builder.
+ */
+ public UpdatePort build() {
+ return new UpdatePort(port);
+ }
+
+ protected UpdateBuilder self() {
+ return this;
+ }
+ }
+
+ /**
+ * 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 CreatePort extends Port {
+ /**
+ * Copy constructor
+ */
+ private CreatePort(Port port) {
+ super(port);
+ checkNotNull(port.networkId, "networkId should not be null");
+ }
+ }
+
+ /**
+ * 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 UpdatePort extends Port {
+ /**
+ * Copy constructor
+ */
+ private UpdatePort(Port port) {
+ super(port);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ae5425ee/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Ports.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Ports.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Ports.java
new file mode 100644
index 0000000..8cf449b
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Ports.java
@@ -0,0 +1,36 @@
+/*
+ * 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.domain;
+
+import java.beans.ConstructorProperties;
+
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * A collection of Ports
+ */
+public class Ports extends PaginatedCollection<Port> {
+ public static final Ports EMPTY = new Ports(ImmutableSet.<Port> of(), ImmutableSet.<Link> of());
+
+ @ConstructorProperties({"ports", "ports_links"})
+ protected Ports(Iterable<Port> ports, Iterable<Link> portsLinks) {
+ super(ports, portsLinks);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ae5425ee/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Router.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Router.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Router.java
new file mode 100644
index 0000000..0b06531
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Router.java
@@ -0,0 +1,285 @@
+/*
+ * 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.domain;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+
+/**
+ * A Neutron Router
+ *
+ * @see <a
+ * href="http://docs.openstack.org/api/openstack-network/2.0/content/router_ext_concepts.html">api
+ * doc</a>
+ */
+public class Router {
+
+ private String id;
+ private NetworkStatus status;
+
+ private String name;
+ @Named("tenant_id")
+ private String tenantId;
+ @Named("admin_state_up")
+ private Boolean adminStateUp;
+ @Named("external_gateway_info")
+ private ExternalGatewayInfo externalGatewayInfo;
+
+ /**
+ * @param id
+ * @param status
+ * @param name
+ * @param tenantId
+ * @param adminStateUp
+ * @param externalGatewayInfo
+ */
+ @ConstructorProperties({"id", "status", "name", "tenant_id", "admin_state_up", "external_gateway_info"})
+ private Router(String id, NetworkStatus status, String name, String tenantId, Boolean adminStateUp, ExternalGatewayInfo externalGatewayInfo) {
+ this.id = id;
+ this.status = status;
+ this.name = name;
+ this.tenantId = tenantId;
+ this.adminStateUp = adminStateUp;
+ this.externalGatewayInfo = externalGatewayInfo;
+ }
+
+ /**
+ * Default constructor.
+ */
+ private Router() {}
+
+ /**
+ * Copy constructor
+ * @param router
+ */
+ private Router(Router router) {
+ this(router.id, router.status, router.name, router.tenantId, router.adminStateUp, router.externalGatewayInfo);
+ }
+
+ /**
+ * @return the id of the Router
+ */
+ @Nullable
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @return the status of the Router
+ */
+ @Nullable
+ public NetworkStatus getStatus() {
+ return status;
+ }
+
+ /**
+ * @return the name of the Router
+ */
+ @Nullable
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return the tenantId of the Router
+ */
+ @Nullable
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ /**
+ * @return the adminStateUp of the Router
+ */
+ @Nullable
+ public Boolean getAdminStateUp() {
+ return adminStateUp;
+ }
+
+ /**
+ * @return the externalGatewayInfo of the Router
+ */
+ @Nullable
+ public ExternalGatewayInfo getExternalGatewayInfo() {
+ return externalGatewayInfo;
+ }
+
+ /**
+ * @return the Builder for creating a new Router
+ */
+ public static CreateBuilder createBuilder() {
+ return new CreateBuilder();
+ }
+
+ /**
+ * @return the Builder for updating a Router
+ */
+ public static UpdateBuilder updateBuilder() {
+ return new UpdateBuilder();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ Router that = (Router) o;
+
+ return Objects.equal(this.id, that.id) &&
+ Objects.equal(this.status, that.status) &&
+ Objects.equal(this.name, that.name) &&
+ Objects.equal(this.tenantId, that.tenantId) &&
+ Objects.equal(this.adminStateUp, that.adminStateUp) &&
+ Objects.equal(this.externalGatewayInfo, that.externalGatewayInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, status, name, tenantId, adminStateUp, externalGatewayInfo);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("id", id)
+ .add("status", status)
+ .add("name", name)
+ .add("tenantId", tenantId)
+ .add("adminStateUp", adminStateUp)
+ .add("externalGatewayInfo", externalGatewayInfo)
+ .toString();
+ }
+
+ private abstract static class Builder<ParameterizedBuilderType> {
+ protected Router router;
+
+ /**
+ * No-parameters constructor used when updating.
+ * */
+ private Builder() {
+ router = new Router();
+ }
+
+ protected abstract ParameterizedBuilderType self();
+
+ /**
+ * Provide the name to the Router's Builder.
+ *
+ * @return the Builder.
+ * @see Router#getName()
+ */
+ public ParameterizedBuilderType name(String name) {
+ router.name = name;
+ return self();
+ }
+
+ /**
+ * Provide the tenantId to the Router's Builder.
+ *
+ * @return the Builder.
+ * @see Router#getTenantId()
+ */
+ public ParameterizedBuilderType tenantId(String tenantId) {
+ router.tenantId = tenantId;
+ return self();
+ }
+
+ /**
+ * Provide the adminStateUp to the Router's Builder.
+ *
+ * @return the Builder.
+ * @see Router#getAdminStateUp()
+ */
+ public ParameterizedBuilderType adminStateUp(Boolean adminStateUp) {
+ router.adminStateUp = adminStateUp;
+ return self();
+ }
+
+ /**
+ * Provide the externalGatewayInfo to the Router's Builder.
+ *
+ * @return the Builder.
+ * @see Router#getExternalGatewayInfo()
+ */
+ public ParameterizedBuilderType externalGatewayInfo(ExternalGatewayInfo externalGatewayInfo) {
+ router.externalGatewayInfo = externalGatewayInfo;
+ return self();
+ }
+ }
+
+ public static class CreateBuilder extends Builder<CreateBuilder> {
+ /**
+ * Supply required properties for creating a Builder
+ */
+ private CreateBuilder() {
+ }
+
+ /**
+ * @return a CreateRouter constructed with this Builder.
+ */
+ public CreateRouter build() {
+ return new CreateRouter(router);
+ }
+
+ protected CreateBuilder self() {
+ return this;
+ }
+ }
+
+ public static class UpdateBuilder extends Builder<UpdateBuilder> {
+ /**
+ * Supply required properties for updating a Builder
+ */
+ private UpdateBuilder() {
+ }
+
+ /**
+ * @return a UpdateRouter constructed with this Builder.
+ */
+ public UpdateRouter build() {
+ return new UpdateRouter(router);
+ }
+
+ protected UpdateBuilder self() {
+ return this;
+ }
+ }
+
+ public static class CreateRouter extends Router{
+ /**
+ * Copy constructor
+ */
+ private CreateRouter(Router router) {
+ super(router);
+ }
+ }
+ public static class UpdateRouter extends Router{
+ /**
+ * Copy constructor
+ */
+ private UpdateRouter(Router router) {
+ super(router);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ae5425ee/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/RouterInterface.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/RouterInterface.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/RouterInterface.java
new file mode 100644
index 0000000..3a86612
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/RouterInterface.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.domain;
+
+import com.google.common.base.Objects;
+import org.jclouds.javax.annotation.Nullable;
+
+import javax.inject.Named;
+import java.beans.ConstructorProperties;
+
+/**
+ * A Neutron Router Interface
+ *
+ * @see <a
+ * href="http://docs.openstack.org/api/openstack-network/2.0/content/router_add_interface.html">api
+ * doc</a>
+ */
+public class RouterInterface {
+
+ @Named("subnet_id")
+ protected final String subnetId;
+ @Named("port_id")
+ protected final String portId;
+
+ @ConstructorProperties({"subnet_id", "port_id"})
+ protected RouterInterface(String subnetId, String portId) {
+ this.subnetId = subnetId;
+ this.portId = portId;
+ }
+
+ /**
+ * @return the subnetId of the RouterInterface
+ */
+ @Nullable
+ public String getSubnetId() {
+ return subnetId;
+ }
+
+ /**
+ * @return the portId of the RouterInterface
+ */
+ @Nullable
+ public String getPortId() {
+ return portId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(subnetId, portId);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null || getClass() != obj.getClass())
+ return false;
+ RouterInterface that = RouterInterface.class.cast(obj);
+ return Objects.equal(this.subnetId, that.subnetId) && Objects.equal(this.portId, that.portId);
+ }
+
+ protected Objects.ToStringHelper string() {
+ return Objects.toStringHelper(this).add("subnetId", subnetId).add("portId", portId);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+ /**
+ * @return the Builder for RouterInterface
+ */
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * Gets a Builder configured as this object.
+ */
+ public Builder toBuilder() {
+ return new Builder().fromRouterInterface(this);
+ }
+
+ public static class Builder {
+ protected String subnetId;
+ protected String portId;
+
+ /**
+ * Provide the subnetId to the RouterInterface's Builder.
+ *
+ * @return the Builder.
+ * @see RouterInterface#getSubnetId()
+ */
+ public Builder subnetId(String subnetId) {
+ this.subnetId = subnetId;
+ return this;
+ }
+
+ /**
+ * Provide the portId to the RouterInterface's Builder.
+ *
+ * @return the Builder.
+ * @see RouterInterface#getPortId()
+ */
+ public Builder portId(String portId) {
+ this.portId = portId;
+ return this;
+ }
+
+ /**
+ * @return a RouterInterface constructed with this Builder.
+ */
+ public RouterInterface build() {
+ return new RouterInterface(subnetId, portId);
+ }
+
+ /**
+ * @return a Builder from another RouterInterface.
+ */
+ public Builder fromRouterInterface(RouterInterface in) {
+ return this.subnetId(in.getSubnetId()).portId(in.getPortId());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ae5425ee/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Routers.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Routers.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Routers.java
new file mode 100644
index 0000000..c02c382
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Routers.java
@@ -0,0 +1,36 @@
+/*
+ * 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.domain;
+
+import java.beans.ConstructorProperties;
+
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * A collection of Routers
+ */
+public class Routers extends PaginatedCollection<Router> {
+ public static final Routers EMPTY = new Routers(ImmutableSet.<Router> of(), ImmutableSet.<Link> of());
+
+ @ConstructorProperties({"routers", "routers_links"})
+ protected Routers(Iterable<Router> routers, Iterable<Link> routersLinks) {
+ super(routers, routersLinks);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ae5425ee/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Rule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Rule.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Rule.java
new file mode 100644
index 0000000..89e9d19
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/Rule.java
@@ -0,0 +1,376 @@
+/*
+ * 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.domain;
+
+import static com.google.common.base.Preconditions.checkArgument;
+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.Objects;
+
+/**
+ * Contains a mapping between a MAC address and an IP address.
+ */
+public class Rule {
+
+ private String id;
+ @Named("tenant_id")
+ private String tenantId;
+ private RuleDirection direction;
+ @Named("security_group_id")
+ private String securityGroupId;
+ private RuleEthertype ethertype;
+ @Named("port_range_min")
+ private Integer portRangeMin;
+ @Named("port_range_max")
+ private Integer portRangeMax;
+ private RuleProtocol protocol;
+ @Named("remote_group_id")
+ private String remoteGroupId;
+ @Named("remote_ip_prefix")
+ private String remoteIpPrefix;
+
+ @ConstructorProperties({"id", "tenant_id", "direction", "security_group_id", "ethertype", "port_range_min",
+ "port_range_max", "protocol", "remote_group_id", "remote_ip_prefix"})
+ protected Rule(String id, String tenantId, RuleDirection direction, String securityGroupId,
+ RuleEthertype ethertype, Integer portRangeMin, Integer portRangeMax,
+ RuleProtocol protocol, String remoteGroupId, String remoteIpPrefix) {
+ this.id = id;
+ this.tenantId = tenantId;
+ this.direction = direction;
+ this.securityGroupId = securityGroupId;
+ this.ethertype = ethertype;
+ this.portRangeMin = portRangeMin;
+ this.portRangeMax = portRangeMax;
+ this.protocol = protocol;
+ this.remoteGroupId = remoteGroupId;
+ this.remoteIpPrefix = remoteIpPrefix;
+ }
+
+ private Rule(Rule rule) {
+ this(rule.id,
+ rule.tenantId,
+ rule.direction,
+ rule.securityGroupId,
+ rule.ethertype,
+ rule.portRangeMin,
+ rule.portRangeMax,
+ rule.protocol,
+ rule.remoteGroupId,
+ rule.remoteIpPrefix
+ );
+ }
+
+ private Rule() {}
+
+ /**
+ * @return The identifier for this rule.
+ */
+ @Nullable
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @return The identifier of the tenant for this rule.
+ */
+ @Nullable
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ /**
+ * @return The direction in which the security group rule is applied.
+ */
+ @Nullable
+ public RuleDirection getDirection() {
+ return direction;
+ }
+
+ /**
+ * @return The security group ID to associate with this security group rule.
+ */
+ @Nullable
+ public String getSecurityGroupId() {
+ return securityGroupId;
+ }
+
+ /**
+ * @return The internet protocol version type of this rule.
+ */
+ @Nullable
+ public RuleEthertype getEthertype() {
+ return ethertype;
+ }
+
+ /**
+ * @return The minimum port number in the range that is matched by the security group rule. If the protocol is TCP
+ * or UDP, this value must be less than or equal to the value of the port_range_max attribute. If the protocol is
+ * ICMP, this value must be an ICMP type.
+ */
+ @Nullable
+ public Integer getPortRangeMin() {
+ return portRangeMin;
+ }
+
+ /**
+ * @return The maximum port number in the range that is matched by the security group rule. The port_range_min
+ * attribute constrains the port_range_max attribute. If the protocol is ICMP, this value must be an ICMP type.
+ */
+ @Nullable
+ public Integer getPortRangeMax() {
+ return portRangeMax;
+ }
+
+ /**
+ * @return The protocol that is matched by the security group rule. Valid values are null, tcp, udp, and icmp.
+ */
+ @Nullable
+ public RuleProtocol getProtocol() {
+ return protocol;
+ }
+
+ /**
+ * @return The remote group ID to be associated with this security group rule.
+ */
+ @Nullable
+ public String getRemoteGroupId() {
+ return remoteGroupId;
+ }
+
+ /**
+ * @return The remote IP prefix to be associated with this security group rule. This attribute matches the specified
+ * IP prefix as the source IP address of the IP packet.
+ */
+ @Nullable
+ public String getRemoteIpPrefix() {
+ return remoteIpPrefix;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ Rule that = (Rule) o;
+
+ return Objects.equal(this.id, that.id) &&
+ Objects.equal(this.tenantId, that.tenantId) &&
+ Objects.equal(this.direction, that.direction) &&
+ Objects.equal(this.securityGroupId, that.securityGroupId) &&
+ Objects.equal(this.ethertype, that.ethertype) &&
+ Objects.equal(this.portRangeMin, that.portRangeMin) &&
+ Objects.equal(this.portRangeMax, that.portRangeMax) &&
+ Objects.equal(this.protocol, that.protocol) &&
+ Objects.equal(this.remoteGroupId, that.remoteGroupId) &&
+ Objects.equal(this.remoteIpPrefix, that.remoteIpPrefix);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, tenantId, direction, securityGroupId, ethertype, portRangeMin,
+ portRangeMax, protocol, remoteGroupId, remoteIpPrefix);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("id", id)
+ .add("tenantId", tenantId)
+ .add("direction", direction)
+ .add("securityGroupId", securityGroupId)
+ .add("ethertype", ethertype)
+ .add("portRangeMin", portRangeMin)
+ .add("portRangeMax", portRangeMax)
+ .add("protocol", protocol)
+ .add("remoteGroupId", remoteGroupId)
+ .add("remoteIpPrefix", remoteIpPrefix)
+ .toString();
+ }
+
+
+ /*
+ * Methods to get the Create and Update builders follow
+ */
+
+ /**
+ * @return the Builder for creating a new SecurityGroupRule
+ */
+ public static CreateBuilder createBuilder(RuleDirection direction, String securityGroupId) {
+ return new CreateBuilder(direction, securityGroupId);
+ }
+
+ public abstract static class Builder<ParameterizedBuilderType> {
+ // Keep track of the builder's state.
+ protected Rule rule;
+
+ private Builder() {
+ rule = new Rule();
+ }
+
+ protected abstract ParameterizedBuilderType self();
+
+ /**
+ * The tenant id for this rule. Usually can only be specified by administrators.
+ *
+ * @return the Builder.
+ * @see Rule#getTenantId()
+ */
+ public ParameterizedBuilderType tenantId(String tenantId) {
+ rule.tenantId = tenantId;
+ return self();
+ }
+
+ /**
+ * The direction in which the security group rule is applied.
+ *
+ * @return the Builder.
+ * @see Rule#getDirection()
+ */
+ public ParameterizedBuilderType direction(RuleDirection direction) {
+ rule.direction = direction;
+ return self();
+ }
+
+ /**
+ * The security group ID to associate with this security group rule.
+ *
+ * @return the Builder.
+ * @see Rule#getSecurityGroupId()
+ */
+ public ParameterizedBuilderType securityGroupId(String securityGroupId) {
+ rule.securityGroupId = securityGroupId;
+ return self();
+ }
+
+ /**
+ * The internet protocol version for this rule.
+ *
+ * @return the Builder.
+ * @see Rule#getEthertype()
+ */
+ public ParameterizedBuilderType ethertype(RuleEthertype ethertype) {
+ rule.ethertype = ethertype;
+ return self();
+ }
+
+ /**
+ * The minimum port number in the range that is matched by the security group rule.
+ *
+ * @return the Builder.
+ * @see Rule#getPortRangeMin()
+ */
+ public ParameterizedBuilderType portRangeMin(Integer portRangeMin) {
+ rule.portRangeMin = portRangeMin;
+ return self();
+ }
+
+ /**
+ * The maximum port number in the range that is matched by the security group rule.
+ *
+ * @return the Builder.
+ * @see Rule#getPortRangeMax()
+ */
+ public ParameterizedBuilderType portRangeMax(Integer portRangeMax) {
+ rule.portRangeMax = portRangeMax;
+ return self();
+ }
+
+ /**
+ * The protocol that is matched by the security group rule. Valid values are null, tcp, udp, and icmp.
+ *
+ * @return the Builder.
+ * @see Rule#getProtocol()
+ */
+ public ParameterizedBuilderType protocol(RuleProtocol protocol) {
+ rule.protocol = protocol;
+ return self();
+ }
+
+ /**
+ * The remote group ID to be associated with this security group rule. You can specify either remote_group_id or
+ * remote_ip_prefix in the request body.
+ *
+ * @return the Builder.
+ * @see Rule#getRemoteGroupId()
+ */
+ public ParameterizedBuilderType remoteGroupId(String remoteGroupId) {
+ rule.remoteGroupId = remoteGroupId;
+ return self();
+ }
+
+ /**
+ * The remote IP prefix to be associated with this security group rule. You can specify either remote_group_id
+ * or remote_ip_prefix in the request body. This attribute matches the specified IP prefix as the source IP
+ * address of the IP packet.
+ *
+ * @return the Builder.
+ * @see Rule#getRemoteIpPrefix()
+ */
+ public ParameterizedBuilderType remoteIpPrefix(String remoteIpPrefix) {
+ rule.remoteIpPrefix = remoteIpPrefix;
+ return self();
+ }
+ }
+
+ /**
+ * This is used to build a CreateBuilder object.
+ */
+ public static class CreateBuilder extends Builder<CreateBuilder> {
+ /**
+ * Supply required properties for creating a Builder
+ */
+ private CreateBuilder(RuleDirection direction, String securityGroupId) {
+ rule.direction = direction;
+ rule.securityGroupId = securityGroupId;
+ }
+
+ /**
+ * @return a CreateRule constructed with this Builder.
+ */
+ public CreateRule build() {
+ return new CreateRule(rule);
+ }
+
+ protected CreateBuilder self() {
+ return this;
+ }
+ }
+
+ /**
+ * 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 CreateRule extends Rule {
+ private CreateRule(Rule rule) {
+ super(rule);
+ 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");
+ checkArgument(this.getRemoteGroupId() == null || this.getRemoteIpPrefix() == null,
+ "You can specify either remote_group_id or remote_ip_prefix in the request body.");
+ }
+ }
+}