You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ni...@apache.org on 2014/03/18 04:00:04 UTC

[12/21] fixing https://issues.apache.org/jira/browse/STRATOS-520 - adding Openstack-nova module to dependencies

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseServerDetails.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseServerDetails.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseServerDetails.java
new file mode 100644
index 0000000..4af2cea
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseServerDetails.java
@@ -0,0 +1,94 @@
+/*
+ * 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.nova.v2_0.functions.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import com.google.common.base.Optional;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.Arg0ToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.jclouds.openstack.nova.v2_0.features.ServerApi;
+import org.jclouds.openstack.nova.v2_0.functions.internal.ParseServerDetails.Servers;
+import org.jclouds.openstack.v2_0.domain.Link;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.inject.TypeLiteral;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+
+/**
+ * boiler plate until we determine a better way
+ * 
+ * @author Adrian Cole
+ */
+@Beta
+@Singleton
+public class ParseServerDetails extends ParseJson<Servers> {
+   static class Servers extends PaginatedCollection<Server> {
+
+      @ConstructorProperties({ "servers", "servers_links" })
+      protected Servers(Iterable<Server> servers, Iterable<Link> servers_links) {
+         super(servers, servers_links);
+      }
+
+   }
+
+   @Inject
+   public ParseServerDetails(Json json) {
+      super(json, TypeLiteral.get(Servers.class));
+   }
+
+   public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<Server, ToPagedIterable> {
+
+      private final NovaApi api;
+
+      @Inject
+      protected ToPagedIterable(NovaApi api) {
+         this.api = checkNotNull(api, "api");
+      }
+
+      @Override
+      protected Function<Object, IterableWithMarker<Server>> markerToNextForArg0(Optional<Object> arg0) {
+         String zone = arg0.get().toString();
+         final ServerApi serverApi = api.getServerApiForZone(zone);
+         return new Function<Object, IterableWithMarker<Server>>() {
+
+            @SuppressWarnings("unchecked")
+            @Override
+            public IterableWithMarker<Server> apply(Object input) {
+               PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+               return IterableWithMarker.class.cast(serverApi.listInDetail(paginationOptions));
+            }
+
+            @Override
+            public String toString() {
+               return "listInDetail()";
+            }
+         };
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseServers.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseServers.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseServers.java
new file mode 100644
index 0000000..2de8c76
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/functions/internal/ParseServers.java
@@ -0,0 +1,96 @@
+/*
+ * 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.nova.v2_0.functions.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import com.google.common.base.Optional;
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.Arg0ToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.features.ServerApi;
+import org.jclouds.openstack.nova.v2_0.functions.internal.ParseServers.Servers;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.Resource;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.inject.TypeLiteral;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+
+/**
+ * boiler plate until we determine a better way
+ * 
+ * @author Adrian Cole
+ */
+@Beta
+@Singleton
+public class ParseServers extends ParseJson<Servers> {
+   static class Servers extends PaginatedCollection<Resource> {
+
+      @ConstructorProperties({ "servers", "servers_links" })
+      protected Servers(Iterable<Resource> servers, Iterable<Link> servers_links) {
+         super(servers, servers_links);
+      }
+
+   }
+
+   @Inject
+   public ParseServers(Json json) {
+      super(json, TypeLiteral.get(Servers.class));
+   }
+
+   public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<Resource, ToPagedIterable> {
+
+      private final NovaApi api;
+
+      @Inject
+      protected ToPagedIterable(NovaApi api) {
+         this.api = checkNotNull(api, "api");
+      }
+
+      @Override
+      protected Function<Object, IterableWithMarker<Resource>> markerToNextForArg0(Optional<Object> arg0) {
+         String zone = arg0.get().toString();
+         final ServerApi serverApi = api.getServerApiForZone(zone);
+         return new Function<Object, IterableWithMarker<Resource>>() {
+
+            @SuppressWarnings("unchecked")
+            @Override
+            public IterableWithMarker<Resource> apply(Object input) {
+               PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+               return IterableWithMarker.class.cast(serverApi.list(paginationOptions));
+            }
+
+            @Override
+            public String toString() {
+               return "list()";
+            }
+         };
+      }
+
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/handlers/NovaErrorHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/handlers/NovaErrorHandler.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/handlers/NovaErrorHandler.java
new file mode 100644
index 0000000..4bfb51b
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/handlers/NovaErrorHandler.java
@@ -0,0 +1,129 @@
+/*
+ * 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.nova.v2_0.handlers;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Predicates.in;
+import static com.google.common.base.Strings.emptyToNull;
+import static com.google.common.collect.Maps.filterKeys;
+import static org.jclouds.http.HttpUtils.closeClientButKeepContentStream;
+
+import java.util.Set;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.date.DateCodecFactory;
+import org.jclouds.fallbacks.HeaderToRetryAfterException;
+import org.jclouds.http.HttpCommand;
+import org.jclouds.http.HttpErrorHandler;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.HttpResponseException;
+import org.jclouds.logging.Logger;
+import org.jclouds.openstack.nova.v2_0.functions.OverLimitParser;
+import org.jclouds.rest.AuthorizationException;
+import org.jclouds.rest.InsufficientResourcesException;
+import org.jclouds.rest.ResourceNotFoundException;
+import org.jclouds.rest.RetryAfterException;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Ticker;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * This will parse and set an appropriate exception on the command object.
+ * 
+ * @author Adrian Cole, Steve Loughran
+ * 
+ */
+// TODO: is there error spec someplace? let's type errors, etc.
+@Singleton
+public class NovaErrorHandler implements HttpErrorHandler {
+
+   @Resource
+   protected Logger logger = Logger.NULL;
+   protected final HeaderToRetryAfterException retryAfterParser;
+   protected final OverLimitParser overLimitParser;
+
+   protected NovaErrorHandler(HeaderToRetryAfterException retryAfterParser, OverLimitParser overLimitParser) {
+      this.retryAfterParser = checkNotNull(retryAfterParser, "retryAfterParser");
+      this.overLimitParser = checkNotNull(overLimitParser, "overLimitParser");
+   }
+
+   /**
+    * in current format, retryAt has a value of {@code 2012-11-14T21:51:28UTC}, which is an ISO-8601 seconds (not milliseconds) format.
+    */
+   @Inject
+   public NovaErrorHandler(DateCodecFactory factory, OverLimitParser overLimitParser) {
+      this(HeaderToRetryAfterException.create(Ticker.systemTicker(), factory.iso8601Seconds()), overLimitParser);
+   }
+
+   public void handleError(HttpCommand command, HttpResponse response) {
+      // it is important to always read fully and close streams
+      byte[] data = closeClientButKeepContentStream(response);
+      String content = data != null ? emptyToNull(new String(data)) : null;
+
+      Exception exception = content != null ? new HttpResponseException(command, response, content)
+            : new HttpResponseException(command, response);
+      String requestLine = command.getCurrentRequest().getRequestLine();
+      String message = content != null ? content : String.format("%s -> %s", requestLine, response.getStatusLine());
+      switch (response.getStatusCode()) {
+         case 400:
+            if (message.indexOf("quota exceeded") != -1)
+               exception = new InsufficientResourcesException(message, exception);
+            else if (message.indexOf("has no fixed_ips") != -1)
+               exception = new IllegalStateException(message, exception);
+            else if (message.indexOf("already exists") != -1)
+               exception = new IllegalStateException(message, exception);
+            break;
+         case 401:
+         case 403:
+            exception = new AuthorizationException(message, exception);
+            break;
+         case 404:
+            if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
+               exception = new ResourceNotFoundException(message, exception);
+            }
+            break;
+         case 413:
+            if (content == null) {
+               exception = new InsufficientResourcesException(message, exception);
+               break;
+            }
+            exception = parseAndBuildRetryException(content, message, exception);
+      }
+      command.setException(exception);
+   }
+
+   /**
+    * Build an exception from the response. If it contains the JSON payload then
+    * that is parsed to create a {@link RetryAfterException}, otherwise a
+    * {@link InsufficientResourcesException} is returned
+    * 
+    */
+   private Exception parseAndBuildRetryException(String json, String message, Exception exception) {
+      Set<String> retryFields = ImmutableSet.of("retryAfter", "retryAt");
+      for (String value : filterKeys(overLimitParser.apply(json), in(retryFields)).values()) {
+         Optional<RetryAfterException> retryException = retryAfterParser.tryCreateRetryAfterException(exception, value);
+         if (retryException.isPresent())
+            return retryException.get();
+      }
+      return new InsufficientResourcesException(message, exception);
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateBackupOfServerOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateBackupOfServerOptions.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateBackupOfServerOptions.java
new file mode 100644
index 0000000..e6002e5
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateBackupOfServerOptions.java
@@ -0,0 +1,105 @@
+/*
+ * 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.nova.v2_0.options;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Objects.toStringHelper;
+
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+
+/**
+ * @author Adam Lowe
+ */
+public class CreateBackupOfServerOptions implements MapBinder {
+   public static final CreateBackupOfServerOptions NONE = new CreateBackupOfServerOptions();
+
+   @Inject
+   protected BindToJsonPayload jsonBinder;
+
+   private Map<String, String> metadata = ImmutableMap.of();
+
+   @Override
+   public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+      Map<String, Object> data = Maps.newHashMap();
+      data.putAll(postParams);
+      data.put("metadata", metadata);
+      return jsonBinder.bindToRequest(request, ImmutableMap.of("createBackup", data));
+   }
+
+   @Override
+   public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
+      throw new IllegalStateException("createBackup is a POST operation");
+   }
+
+   @Override
+   public boolean equals(Object object) {
+      if (this == object) {
+         return true;
+      }
+      if (!(object instanceof CreateBackupOfServerOptions)) return false;
+      final CreateBackupOfServerOptions other = CreateBackupOfServerOptions.class.cast(object);
+      return equal(metadata, other.metadata);
+   }
+
+   @Override
+   public int hashCode() {
+      return Objects.hashCode(metadata);
+   }
+
+   protected ToStringHelper string() {
+      return toStringHelper("").add("metadata", metadata);
+   }
+
+   @Override
+   public String toString() {
+      return string().toString();
+   }
+
+   /** @see #getMetadata() */
+   public CreateBackupOfServerOptions metadata(Map<String, String> metadata) {
+      this.metadata = metadata;
+      return this;
+   }
+
+   /**
+    * Extra image properties to include
+    */
+   public Map<String, String> getMetadata() {
+      return metadata;
+   }
+
+   public static class Builder {
+      /**
+       * @see CreateBackupOfServerOptions#getMetadata()
+       */
+      public static CreateBackupOfServerOptions metadata(Map<String, String> metadata) {
+         return new CreateBackupOfServerOptions().metadata(metadata);
+      }
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateServerOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateServerOptions.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateServerOptions.java
new file mode 100644
index 0000000..b135e19
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateServerOptions.java
@@ -0,0 +1,557 @@
+/*
+ * 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.nova.v2_0.options;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Objects.toStringHelper;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+import static com.google.common.base.Strings.emptyToNull;
+import static com.google.common.io.BaseEncoding.base64;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.domain.Network;
+import org.jclouds.openstack.nova.v2_0.domain.Server;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.base.Optional;
+import com.google.common.collect.ForwardingObject;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+/**
+ * @author Adrian Cole
+ * @author Inbar Stolberg
+ * @author Zack Shoylev
+ */
+public class CreateServerOptions implements MapBinder {
+   @Inject
+   private BindToJsonPayload jsonBinder;
+
+   static class File {
+      private final String path;
+      private final String contents;
+
+      public File(String path, byte[] contents) {
+         this.path = checkNotNull(path, "path");
+         this.contents = base64().encode(checkNotNull(contents, "contents"));
+         checkArgument(
+               path.getBytes().length < 255,
+               String.format("maximum length of path is 255 bytes.  Path specified %s is %d bytes", path,
+                     path.getBytes().length));
+         checkArgument(contents.length < 10 * 1024,
+               String.format("maximum size of the file is 10KB.  Contents specified is %d bytes", contents.length));
+      }
+
+      public String getContents() {
+         return contents;
+      }
+
+      public String getPath() {
+         return path;
+      }
+
+      @Override
+      public boolean equals(Object object) {
+         if (this == object) {
+            return true;
+         }
+         if (object instanceof File) {
+            final File other = File.class.cast(object);
+            return equal(path, other.path);
+         } else {
+            return false;
+         }
+      }
+
+      @Override
+      public int hashCode() {
+         return Objects.hashCode(path);
+      }
+
+      @Override
+      public String toString() {
+         return toStringHelper("file").add("path", path).toString();
+      }
+
+   }
+
+   private String keyName;
+   private String adminPass;
+   private Set<String> securityGroupNames = ImmutableSet.of();
+   private Map<String, String> metadata = ImmutableMap.of();
+   private List<File> personality = Lists.newArrayList();
+   private byte[] userData;
+   private String diskConfig;
+   private Set<String> networks = ImmutableSet.of();
+   private Set<Network> novaNetworks = ImmutableSet.of();
+   private String availabilityZone;
+   private boolean configDrive;
+
+   @Override
+   public boolean equals(Object object) {
+      if (this == object) {
+         return true;
+      }
+      if (object instanceof CreateServerOptions) {
+         final CreateServerOptions other = CreateServerOptions.class.cast(object);
+         return equal(keyName, other.keyName) && equal(securityGroupNames, other.securityGroupNames)
+               && equal(metadata, other.metadata) && equal(personality, other.personality)
+               && equal(adminPass, other.adminPass) && equal(diskConfig, other.diskConfig)
+               && equal(adminPass, other.adminPass) && equal(networks, other.networks)
+               && equal(availabilityZone, other.availabilityZone);
+      } else {
+         return false;
+      }
+   }
+
+   @Override
+   public int hashCode() {
+      return Objects.hashCode(keyName, securityGroupNames, metadata, personality, adminPass, networks, availabilityZone);
+   }
+
+   protected ToStringHelper string() {
+      ToStringHelper toString = Objects.toStringHelper("").omitNullValues();
+      toString.add("keyName", keyName);
+      if (securityGroupNames.size() > 0)
+         toString.add("securityGroupNames", securityGroupNames);
+      if (metadata.size() > 0)
+         toString.add("metadata", metadata);
+      if (personality.size() > 0)
+         toString.add("personality", personality);
+      if (adminPass != null)
+         toString.add("adminPassPresent", true);
+      if (diskConfig != null)
+         toString.add("diskConfig", diskConfig);
+      toString.add("userData", userData == null ? null : new String(userData));
+      if (!networks.isEmpty())
+         toString.add("networks", networks);
+      toString.add("availability_zone", availabilityZone == null ? null : availabilityZone);
+      return toString;
+   }
+
+   @Override
+   public String toString() {
+      return string().toString();
+   }
+
+   static class ServerRequest {
+      final String name;
+      final String imageRef;
+      final String flavorRef;
+      @Named("availability_zone")
+      String availabilityZone;
+      String adminPass;
+      Map<String, String> metadata;
+      List<File> personality;
+      String key_name;
+      @Named("security_groups")
+      Set<NamedThingy> securityGroupNames;
+      String user_data;
+      @Named("OS-DCF:diskConfig")
+      String diskConfig;
+      Set<Map<String, String>> networks;
+
+      private ServerRequest(String name, String imageRef, String flavorRef) {
+         this.name = name;
+         this.imageRef = imageRef;
+         this.flavorRef = flavorRef;
+      }
+
+   }
+
+   @Override
+   public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+      ServerRequest server = new ServerRequest(checkNotNull(postParams.get("name"), "name parameter not present").toString(),
+            checkNotNull(postParams.get("imageRef"), "imageRef parameter not present").toString(),
+            checkNotNull(postParams.get("flavorRef"), "flavorRef parameter not present").toString());
+      if (metadata.size() > 0)
+         server.metadata = metadata;
+      if (personality.size() > 0)
+         server.personality = personality;
+      if (keyName != null)
+         server.key_name = keyName;
+      if (availabilityZone != null)
+         server.availabilityZone = availabilityZone;
+      if (userData != null)
+         server.user_data = base64().encode(userData);
+      if (securityGroupNames.size() > 0) {
+         server.securityGroupNames = Sets.newLinkedHashSet();
+         for (String groupName : securityGroupNames) {
+            server.securityGroupNames.add(new NamedThingy(groupName));
+         }
+      }
+      if (adminPass != null) {
+         server.adminPass = adminPass;
+      }
+
+      if (diskConfig != null) {
+         server.diskConfig = diskConfig;
+      }
+
+      if (!networks.isEmpty() || !novaNetworks.isEmpty()) {
+         server.networks = Sets.newLinkedHashSet(); // ensures ordering is preserved - helps testing and more intuitive for users.
+         for (Network network : novaNetworks) {
+            // Avoid serializing null values, which are common here.
+            ImmutableMap.Builder<String, String> networkMap = new ImmutableMap.Builder<String, String>();
+            if(network.getNetworkUuid() != null) {
+               networkMap.put("uuid", network.getNetworkUuid());
+            }
+            if(network.getPortUuid() != null) {
+               networkMap.put("port", network.getPortUuid());
+            }
+            if(network.getFixedIp() != null) {
+               networkMap.put("fixed_ip", network.getFixedIp());
+            }
+            server.networks.add(networkMap.build());
+         }
+         for (String network : networks) {
+            server.networks.add(ImmutableMap.of("uuid", network));
+         }
+      }
+
+      return bindToRequest(request, ImmutableMap.of("server", server));
+   }
+
+   private static class NamedThingy extends ForwardingObject {
+      private String name;
+
+      private NamedThingy(String name) {
+         this.name = name;
+      }
+
+      @Override
+      protected Object delegate() {
+         return name;
+      }
+   }
+
+   /**
+    * You may further customize a cloud server by injecting data into the file
+    * system of the cloud server itself. This is useful, for example, for
+    * inserting ssh keys, setting configuration files, or storing data that you
+    * want to retrieve from within the instance itself. It is intended to
+    * provide a minimal amount of launch-time personalization. If significant
+    * customization is required, a custom image should be created. The max size
+    * of the file path data is 255 bytes while the max size of the file contents
+    * is 10KB. Note that the file contents should be encoded as a Base64 string
+    * and the 10KB limit refers to the number of bytes in the decoded data not
+    * the number of characters in the encoded data. The maximum number of file
+    * path/content pairs that can be supplied is 5. Any existing files that
+    * match the specified file will be renamed to include the extension bak
+    * followed by a time stamp. For example, the file /etc/passwd will be backed
+    * up as /etc/passwd.bak.1246036261.5785. All files will have root and the
+    * root group as owner and group owner, respectively and will allow user and
+    * group read access only (-r--r-----).
+    */
+   public CreateServerOptions writeFileToPath(byte[] contents, String path) {
+      checkState(personality.size() < 5, "maximum number of files allowed is 5");
+      personality.add(new File(path, contents));
+      return this;
+   }
+
+   public CreateServerOptions adminPass(String adminPass) {
+      checkNotNull(adminPass, "adminPass");
+      this.adminPass = adminPass;
+      return this;
+   }
+
+   /**
+    * Custom cloud server metadata can also be supplied at launch time. This
+    * metadata is stored in the API system where it is retrievable by querying
+    * the API for server status. The maximum size of the metadata key and value
+    * is each 255 bytes and the maximum number of key-value pairs that can be
+    * supplied per server is 5.
+    */
+   public CreateServerOptions metadata(Map<String, String> metadata) {
+      checkNotNull(metadata, "metadata");
+      checkArgument(metadata.size() <= 5,
+            "you cannot have more then 5 metadata values.  You specified: " + metadata.size());
+      for (Entry<String, String> entry : metadata.entrySet()) {
+         checkArgument(
+               entry.getKey().getBytes().length < 255,
+               String.format("maximum length of metadata key is 255 bytes.  Key specified %s is %d bytes",
+                     entry.getKey(), entry.getKey().getBytes().length));
+         checkArgument(entry.getKey().getBytes().length < 255, String.format(
+               "maximum length of metadata value is 255 bytes.  Value specified for %s (%s) is %d bytes",
+               entry.getKey(), entry.getValue(), entry.getValue().getBytes().length));
+      }
+      this.metadata = ImmutableMap.copyOf(metadata);
+      return this;
+   }
+
+   /**
+    * Custom user-data can be also be supplied at launch time.
+    * It is retrievable by the instance and is often used for launch-time configuration
+    * by instance scripts.
+    */
+   public CreateServerOptions userData(byte[] userData) {
+      this.userData = userData;
+      return this;
+   }
+
+   /**
+    * Set to true to use a config drive for metadata.
+    * This is a separate configuration drive that can be used separately from the metadata service.
+    * This needs to be set to "true" when trying to use user data for cloud-init.
+    * @see http://docs.openstack.org/grizzly/openstack-compute/admin/content/config-drive.html
+    */
+   public CreateServerOptions configDrive(boolean configDrive) {
+      this.configDrive = configDrive;
+      return this;
+   }
+
+   /**
+    * A keypair name can be defined when creating a server. This key will be
+    * linked to the server and used to SSH connect to the machine
+    */
+   public String getKeyPairName() {
+      return keyName;
+   }
+
+   public String getAvailabilityZone() {
+      return availabilityZone;
+   }
+
+   /**
+    * @see #getKeyPairName()
+    */
+   public CreateServerOptions keyPairName(String keyName) {
+      this.keyName = keyName;
+      return this;
+   }
+
+   /**
+    * @see #getAvailabilityZone()
+    */
+   public CreateServerOptions availabilityZone(String availabilityZone) {
+      this.availabilityZone = availabilityZone;
+      return this;
+   }
+
+   /**
+    * Security groups the user specified to run servers with.
+    * <p/>
+    * <h3>Note</h3>
+    * <p/>
+    * This requires that {@link NovaApi#getSecurityGroupExtensionForZone(String)} to return
+    * {@link Optional#isPresent present}
+    */
+   public Set<String> getSecurityGroupNames() {
+      return securityGroupNames;
+   }
+
+   /**
+    * Get custom networks specified for the server.
+    *
+    * @return A set of uuids defined by Neutron (previously Quantum)
+    * @see <a href="https://wiki.openstack.org/wiki/Neutron/APIv2-specification#Network">Neutron Networks<a/>
+    */
+   public Set<String> getNetworks() {
+      return networks;
+   }
+   
+   /**
+    * Get custom networks specified for the server.
+    *
+    * @return A set of uuids defined by Neutron (previously Quantum)
+    * @see <a href="https://wiki.openstack.org/wiki/Neutron/APIv2-specification#Network">Neutron Networks<a/>
+    */
+   public Set<Network> getNovaNetworks() {
+      return novaNetworks;
+   }
+
+   /**
+    * @see #getSecurityGroupNames
+    */
+   public CreateServerOptions securityGroupNames(String... securityGroupNames) {
+      return securityGroupNames(ImmutableSet.copyOf(checkNotNull(securityGroupNames, "securityGroupNames")));
+   }
+
+   /**
+    * @see #getSecurityGroupNames
+    */
+   public CreateServerOptions securityGroupNames(Iterable<String> securityGroupNames) {
+      for (String groupName : checkNotNull(securityGroupNames, "securityGroupNames"))
+         checkNotNull(emptyToNull(groupName), "all security groups must be non-empty");
+      this.securityGroupNames = ImmutableSet.copyOf(securityGroupNames);
+      return this;
+   }
+
+   /**
+    * When you create a server from an image with the diskConfig value set to
+    * {@link Server#DISK_CONFIG_AUTO}, the server is built with a single partition that is expanded to
+    * the disk size of the flavor selected. When you set the diskConfig attribute to
+    * {@link Server#DISK_CONFIG_MANUAL}, the server is built by using the partition scheme and file
+    * system that is in the source image.
+    * <p/>
+    * If the target flavor disk is larger, remaining disk space is left unpartitioned. A server inherits the diskConfig
+    * attribute from the image from which it is created. However, you can override the diskConfig value when you create
+    * a server. This field is only present if the Disk Config extension is installed in your OpenStack deployment.
+    */
+   public String getDiskConfig() {
+      return diskConfig;
+   }
+
+   /**
+    * @see #getDiskConfig
+    */
+   public CreateServerOptions diskConfig(String diskConfig) {
+      this.diskConfig = diskConfig;
+      return this;
+   }
+
+   /**
+    * Determines if a configuration drive will be attached to the server or not.
+    * This can be used for cloud-init or other configuration purposes.  
+    */
+   public boolean getConfigDrive() {
+      return configDrive;
+   }
+
+   /**
+    * @see #getNetworks
+    */
+   public CreateServerOptions networks(Iterable<String> networks) {
+      this.networks = ImmutableSet.copyOf(networks);
+      return this;
+   }
+
+   /**
+    * @see #getNetworks
+    * Overwrites networks supplied by {@link #networks(Iterable)}
+    */
+   public CreateServerOptions novaNetworks(Iterable<Network> networks) {
+      this.novaNetworks = ImmutableSet.copyOf(networks);
+      return this;
+   }
+
+   /**
+    * @see #getNetworks
+    */
+   public CreateServerOptions networks(String... networks) {
+      return networks(ImmutableSet.copyOf(networks));
+   }
+
+   public static class Builder {
+
+      /**
+       * @see CreateServerOptions#writeFileToPath
+       */
+      public static CreateServerOptions writeFileToPath(byte[] contents, String path) {
+         CreateServerOptions options = new CreateServerOptions();
+         return options.writeFileToPath(contents, path);
+      }
+
+      public static CreateServerOptions adminPass(String adminPass) {
+         CreateServerOptions options = new CreateServerOptions();
+         return options.adminPass(adminPass);
+      }
+
+      /**
+       * @see CreateServerOptions#metadata(Map<String, String>)
+       */
+      public static CreateServerOptions metadata(Map<String, String> metadata) {
+         CreateServerOptions options = new CreateServerOptions();
+         return options.metadata(metadata);
+      }
+
+      /**
+       * @see #getKeyPairName()
+       */
+      public static CreateServerOptions keyPairName(String keyName) {
+         CreateServerOptions options = new CreateServerOptions();
+         return options.keyPairName(keyName);
+      }
+
+      /**
+       * @see CreateServerOptions#getSecurityGroupNames
+       */
+      public static CreateServerOptions securityGroupNames(String... groupNames) {
+         CreateServerOptions options = new CreateServerOptions();
+         return CreateServerOptions.class.cast(options.securityGroupNames(groupNames));
+      }
+
+      /**
+       * @see CreateServerOptions#getSecurityGroupNames
+       */
+      public static CreateServerOptions securityGroupNames(Iterable<String> groupNames) {
+         CreateServerOptions options = new CreateServerOptions();
+         return CreateServerOptions.class.cast(options.securityGroupNames(groupNames));
+      }
+
+      /**
+       * @see CreateServerOptions#getDiskConfig
+       */
+      public static CreateServerOptions diskConfig(String diskConfig) {
+         CreateServerOptions options = new CreateServerOptions();
+         return CreateServerOptions.class.cast(options.diskConfig(diskConfig));
+      }
+
+      /**
+       * @see CreateServerOptions#getNetworks
+       */
+      public static CreateServerOptions networks(String... networks) {
+         CreateServerOptions options = new CreateServerOptions();
+         return CreateServerOptions.class.cast(options.networks(networks));
+      }
+
+      /**
+       * @see CreateServerOptions#getNetworks
+       */
+      public static CreateServerOptions networks(Iterable<String> networks) {
+         CreateServerOptions options = new CreateServerOptions();
+         return CreateServerOptions.class.cast(options.networks(networks));
+      }
+
+      /**
+       * @see CreateServerOptions#getNetworks
+       */
+      public static CreateServerOptions novaNetworks(Iterable<Network> networks) {
+         CreateServerOptions options = new CreateServerOptions();
+         return CreateServerOptions.class.cast(options.novaNetworks(networks));
+      }
+
+      /**
+       * @see org.jclouds.openstack.nova.v2_0.options.CreateServerOptions#getAvailabilityZone()
+       */
+      public static CreateServerOptions availabilityZone(String availabilityZone) {
+         CreateServerOptions options = new CreateServerOptions();
+         return options.availabilityZone(availabilityZone);
+      }
+   }
+
+   @Override
+   public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+      return jsonBinder.bindToRequest(request, input);
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeOptions.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeOptions.java
new file mode 100644
index 0000000..921a4c8
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeOptions.java
@@ -0,0 +1,220 @@
+/*
+ * 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.nova.v2_0.options;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Objects.toStringHelper;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+
+/**
+ * @author Adam Lowe
+ */
+public class CreateVolumeOptions implements MapBinder {
+   public static final CreateVolumeOptions NONE = new CreateVolumeOptions();
+
+   @Inject
+   private BindToJsonPayload jsonBinder;
+
+   protected String name;
+   protected String description;
+   protected String volumeType;
+   protected String availabilityZone;
+   protected String snapshotId;
+   protected Map<String, String> metadata = ImmutableMap.of();
+
+   @Override
+   public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+      Map<String, Object> image = Maps.newHashMap();
+      image.putAll(postParams);
+      if (name != null)
+         image.put("display_name", name);
+      if (description != null)
+         image.put("display_description", description);
+      if (volumeType != null)
+         image.put("volume_type", volumeType);
+      if (availabilityZone != null)
+         image.put("availability_zone", availabilityZone);
+      if (snapshotId != null)
+         image.put("snapshot_id", snapshotId);
+      if (!metadata.isEmpty())
+         image.put("metadata", metadata);
+      return jsonBinder.bindToRequest(request, ImmutableMap.of("volume", image));
+   }
+
+   @Override
+   public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
+      throw new IllegalStateException("CreateVolume is a POST operation");
+   }
+
+   @Override
+   public boolean equals(Object object) {
+      if (this == object) {
+         return true;
+      }
+      if (!(object instanceof CreateVolumeOptions)) return false;
+      final CreateVolumeOptions other = CreateVolumeOptions.class.cast(object);
+      return equal(volumeType, other.volumeType) && equal(availabilityZone, other.availabilityZone) && equal(snapshotId, other.snapshotId)
+            && equal(name, other.name) && equal(description, other.description) && equal(metadata, other.metadata);
+   }
+
+   @Override
+   public int hashCode() {
+      return Objects.hashCode(volumeType, availabilityZone, snapshotId, name, description, metadata);
+   }
+
+   protected ToStringHelper string() {
+      return toStringHelper("").add("volumeType", volumeType).add("availabilityZone", availabilityZone)
+            .add("snapshotId", snapshotId).add("name", name).add("description", description).add("metadata", metadata);
+   }
+
+   @Override
+   public String toString() {
+      return string().toString();
+   }
+
+   /**
+    * Custom cloud server metadata can also be supplied at launch time. This
+    * metadata is stored in the API system where it is retrievable by querying
+    * the API for server status. The maximum size of the metadata key and value
+    * is each 255 bytes and the maximum number of key-value pairs that can be
+    * supplied per volume is 5.
+    */
+   public CreateVolumeOptions metadata(Map<String, String> metadata) {
+      checkNotNull(metadata, "metadata");
+      checkArgument(metadata.size() <= 5,
+            "you cannot have more then 5 metadata values.  You specified: " + metadata.size());
+      for (Entry<String, String> entry : metadata.entrySet()) {
+         checkArgument(
+               entry.getKey().getBytes().length < 255,
+               String.format("maximum length of metadata key is 255 bytes.  Key specified %s is %d bytes",
+                     entry.getKey(), entry.getKey().getBytes().length));
+         checkArgument(entry.getKey().getBytes().length < 255, String.format(
+               "maximum length of metadata value is 255 bytes.  Value specified for %s (%s) is %d bytes",
+               entry.getKey(), entry.getValue(), entry.getValue().getBytes().length));
+      }
+      this.metadata = ImmutableMap.copyOf(metadata);
+      return this;
+   }
+
+   public CreateVolumeOptions name(String name) {
+      this.name = name;
+      return this;
+   }
+
+   public CreateVolumeOptions description(String description) {
+      this.description = description;
+      return this;
+   }
+
+   public CreateVolumeOptions volumeType(String volumeType) {
+      this.volumeType = volumeType;
+      return this;
+   }
+
+   public CreateVolumeOptions availabilityZone(String availabilityZone) {
+      this.availabilityZone = availabilityZone;
+      return this;
+   }
+
+   public CreateVolumeOptions snapshotId(String snapshotId) {
+      this.snapshotId = snapshotId;
+      return this;
+   }
+
+   public String getVolumeType() {
+      return volumeType;
+   }
+
+   public String getAvailabilityZone() {
+      return availabilityZone;
+   }
+
+   public String getSnapshotId() {
+      return snapshotId;
+   }
+
+   public String getName() {
+      return name;
+   }
+
+   public String getDescription() {
+      return description;
+   }
+
+   public Map<String, String> getMetadata() {
+      return metadata;
+   }
+
+   public static class Builder {
+      /**
+       * @see CreateVolumeOptions#getName()
+       */
+      public static CreateVolumeOptions name(String name) {
+         return new CreateVolumeOptions().name(name);
+      }
+      /**
+       * @see CreateVolumeOptions#getDescription()
+       */
+      public static CreateVolumeOptions description(String description) {
+         return new CreateVolumeOptions().description(description);
+      }
+
+      /**
+       * @see CreateVolumeOptions#getVolumeType()
+       */
+      public static CreateVolumeOptions volumeType(String volumeType) {
+         return new CreateVolumeOptions().volumeType(volumeType);
+      }
+
+      /**
+       * @see CreateVolumeOptions#getAvailabilityZone()
+       */
+      public static CreateVolumeOptions availabilityZone(String availabilityZone) {
+         return new CreateVolumeOptions().availabilityZone(availabilityZone);
+      }
+
+      /**
+       * @see CreateVolumeOptions#getSnapshotId()
+       */
+      public static CreateVolumeOptions snapshotId(String snapshotId) {
+         return new CreateVolumeOptions().snapshotId(snapshotId);
+      }
+
+      /**
+       * @see CreateVolumeOptions#getMetadata()
+       */
+      public static CreateVolumeOptions metadata(Map<String, String> metadata) {
+         return new CreateVolumeOptions().metadata(metadata);
+      }
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeSnapshotOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeSnapshotOptions.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeSnapshotOptions.java
new file mode 100644
index 0000000..b159367
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeSnapshotOptions.java
@@ -0,0 +1,138 @@
+/*
+ * 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.nova.v2_0.options;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Objects.toStringHelper;
+
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+
+/**
+ * @author Adam Lowe
+ */
+public class CreateVolumeSnapshotOptions implements MapBinder {
+   public static final CreateVolumeSnapshotOptions NONE = new CreateVolumeSnapshotOptions();
+
+   @Inject
+   private BindToJsonPayload jsonBinder;
+
+   private String name;
+   private String description;
+   private boolean force = false;
+
+   @Override
+   public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+      Map<String, Object> data = Maps.newHashMap(postParams);
+      if (name != null)
+         data.put("display_name", name);
+      if (description != null)
+         data.put("display_description", description);
+      if (force)
+         data.put("force", "true");
+      return jsonBinder.bindToRequest(request, ImmutableMap.of("snapshot", data));
+   }
+
+   @Override
+   public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
+      throw new IllegalStateException("CreateSnapshot is a POST operation");
+   }
+
+   @Override
+   public boolean equals(Object object) {
+      if (this == object) {
+         return true;
+      }
+      if (!(object instanceof CreateVolumeSnapshotOptions)) return false;
+      final CreateVolumeSnapshotOptions other = CreateVolumeSnapshotOptions.class.cast(object);
+      return equal(name, other.name) && equal(description, other.description);
+   }
+
+   @Override
+   public int hashCode() {
+      return Objects.hashCode(name, description);
+   }
+
+   protected ToStringHelper string() {
+      return toStringHelper("").add("name", name).add("description", description);
+   }
+
+   @Override
+   public String toString() {
+      return string().toString();
+   }
+
+   public CreateVolumeSnapshotOptions name(String name) {
+      this.name = name;
+      return this;
+   }
+
+   public CreateVolumeSnapshotOptions description(String description) {
+      this.description = description;
+      return this;
+   }
+
+   public CreateVolumeSnapshotOptions force() {
+      this.force = true;
+      return this;
+   }
+   
+   public String getName() {
+      return name;
+   }
+
+   public String getDescription() {
+      return description;
+   }
+
+   public boolean isForce() {
+      return force;
+   }
+
+   public static class Builder {
+      /**
+       * @see CreateVolumeSnapshotOptions#getName()
+       */
+      public static CreateVolumeSnapshotOptions name(String name) {
+         return new CreateVolumeSnapshotOptions().name(name);
+      }
+      /**
+       * @see CreateVolumeSnapshotOptions#getDescription()
+       */
+      public static CreateVolumeSnapshotOptions description(String description) {
+         return new CreateVolumeSnapshotOptions().description(description);
+      }
+
+      /**
+       * @see CreateVolumeSnapshotOptions#isForce()
+       */
+      public static CreateVolumeSnapshotOptions force() {
+         return new CreateVolumeSnapshotOptions().force();
+      }
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeTypeOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeTypeOptions.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeTypeOptions.java
new file mode 100644
index 0000000..7ab6460
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateVolumeTypeOptions.java
@@ -0,0 +1,101 @@
+/*
+ * 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.nova.v2_0.options;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Objects.toStringHelper;
+
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+
+/**
+ * @author Adam Lowe
+ */
+public class CreateVolumeTypeOptions implements MapBinder {
+   public static final CreateVolumeTypeOptions NONE = new CreateVolumeTypeOptions();
+
+   @Inject
+   protected BindToJsonPayload jsonBinder;
+
+   protected Map<String, String> specs = ImmutableMap.of();
+
+   @Override
+   public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+      Map<String, Object> data = Maps.newHashMap();
+      data.putAll(postParams);
+      data.put("extra_specs", specs);
+      return jsonBinder.bindToRequest(request, ImmutableMap.of("volume_type", data));
+   }
+
+   @Override
+   public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
+      throw new IllegalStateException("CreateWithExtraSpecs are POST operations");
+   }
+
+   @Override
+   public boolean equals(Object object) {
+      if (this == object) {
+         return true;
+      }
+      if (!(object instanceof CreateVolumeTypeOptions)) return false;
+      final CreateVolumeTypeOptions other = CreateVolumeTypeOptions.class.cast(object);
+      return equal(specs, other.specs);
+   }
+
+   @Override
+   public int hashCode() {
+      return Objects.hashCode(specs);
+   }
+
+   protected ToStringHelper string() {
+      return toStringHelper("").add("specs", specs);
+   }
+
+   @Override
+   public String toString() {
+      return string().toString();
+   }
+
+   public CreateVolumeTypeOptions specs(Map<String, String> specs) {
+      this.specs = specs;
+      return this;
+   }
+
+   public Map<String, String> getSpecs() {
+      return specs;
+   }
+
+   public static class Builder {
+      /**
+       * @see CreateVolumeTypeOptions#getSpecs()
+       */
+      public static CreateVolumeTypeOptions specs(Map<String, String> specs) {
+         return new CreateVolumeTypeOptions().specs(specs);
+      }
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/ListOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/ListOptions.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/ListOptions.java
new file mode 100644
index 0000000..23eb5f3
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/ListOptions.java
@@ -0,0 +1,107 @@
+/*
+ * 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.nova.v2_0.options;
+
+import java.util.Date;
+
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+
+/**
+ * Options used to control the amount of detail in the request.
+ * 
+ * @see PaginationOptions
+ * @see <a href="http://wiki.openstack.org/OpenStackAPI_1-1" />
+ * @author Adrian Cole
+ */
+public class ListOptions extends PaginationOptions {
+
+   public static final ListOptions NONE = new ListOptions();
+
+   /**
+    * unless used, only the name and id will be returned per row.
+    * 
+    * @return
+    */
+   public ListOptions withDetails() {
+      this.pathSuffix = "/detail";
+      return this;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public ListOptions changesSince(Date ifModifiedSince) {
+      super.changesSince(ifModifiedSince);
+      return this;
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public ListOptions limit(int limit) {
+      super.limit(limit);
+      return this;
+
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public ListOptions marker(String marker) {
+      super.marker(marker);
+      return this;
+   }
+
+   public static class Builder {
+
+      /**
+       * @see ListOptions#withDetails()
+       */
+      public static ListOptions withDetails() {
+         ListOptions options = new ListOptions();
+         return options.withDetails();
+      }
+
+      /**
+       * @see PaginationOptions#marker(String)
+       */
+      public static ListOptions marker(String marker) {
+         ListOptions options = new ListOptions();
+         return options.marker(marker);
+      }
+
+      /**
+       * @see PaginationOptions#limit(long)
+       */
+      public static ListOptions maxResults(int maxKeys) {
+         ListOptions options = new ListOptions();
+         return options.limit(maxKeys);
+      }
+
+      /**
+       * @see PaginationOptions#changesSince(Date)
+       */
+      public static ListOptions changesSince(Date since) {
+         ListOptions options = new ListOptions();
+         return options.changesSince(since);
+      }
+
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/RebuildServerOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/RebuildServerOptions.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/RebuildServerOptions.java
new file mode 100644
index 0000000..e1f0d08
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/options/RebuildServerOptions.java
@@ -0,0 +1,142 @@
+/*
+ * 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.nova.v2_0.options;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+
+/**
+ * @author Adrian Cole
+ * @author Inbar Stolberg
+ */
+public class RebuildServerOptions implements MapBinder {
+   @Inject
+   private BindToJsonPayload jsonBinder;
+   String imageRef;
+   String name;
+   String adminPass;
+   String accessIPv4;
+   String accessIPv6;
+
+   @Override
+   public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+      Map<String, String> image = Maps.newHashMap();
+      if (imageRef != null)
+         image.put("imageRef", imageRef);
+      if (name != null)
+         image.put("name", name);
+      if (adminPass != null)
+         image.put("adminPass", adminPass);
+      if (accessIPv4 != null)
+         image.put("accessIPv4", accessIPv4);
+      if (accessIPv6 != null)
+         image.put("accessIPv6", accessIPv6);
+
+
+      return jsonBinder.bindToRequest(request, ImmutableMap.of("rebuild", image));
+   }
+
+   @Override
+   public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
+      throw new IllegalStateException("RebuildServer is a POST operation");
+   }
+
+   /**
+    * @param ref
+    *           - reference of the image to rebuild the server with.
+    */
+   public RebuildServerOptions withImage(String ref) {
+      checkNotNull(ref, "image reference should not be null");
+      checkArgument(!ref.isEmpty(), "image reference should not be empty");
+      this.imageRef = ref;
+      return this;
+   }
+
+   public RebuildServerOptions name(String name) {
+      this.name = name;
+      return this;
+   }
+
+   public RebuildServerOptions adminPass(String adminPass) {
+      this.adminPass = adminPass;
+      return this;
+   }
+
+   public RebuildServerOptions ipv4Address(String ipv4Address) {
+      this.accessIPv4 = ipv4Address;
+      return this;
+   }
+
+   public RebuildServerOptions ipv6Address(String iPv6Address) {
+      this.accessIPv6 = iPv6Address;
+      return this;
+   }
+
+   public static class Builder {
+
+      /**
+       * @see RebuildServerOptions#withImage(String)
+       */
+      public static RebuildServerOptions withImage(String ref) {
+         RebuildServerOptions options = new RebuildServerOptions();
+         return options.withImage(ref);
+      }
+
+      /**
+       * @see RebuildServerOptions#name(String)
+       */
+      public static RebuildServerOptions name(String name) {
+         RebuildServerOptions options = new RebuildServerOptions();
+         return options.name(name);
+      }
+
+      /**
+       * @see RebuildServerOptions#adminPass(String)
+       */
+      public static RebuildServerOptions adminPass(String adminPass) {
+         RebuildServerOptions options = new RebuildServerOptions();
+         return options.adminPass(adminPass);
+      }
+
+      /**
+       * @see RebuildServerOptions#ipv4Address(String)
+       */
+      public static RebuildServerOptions ipv4Address(String ipv4Address) {
+         RebuildServerOptions options = new RebuildServerOptions();
+         return options.ipv4Address(ipv4Address);
+      }
+
+      /**
+       * @see RebuildServerOptions#ipv6Address(String)
+       */
+      public static RebuildServerOptions ipv6Address(String ipv6Address) {
+         RebuildServerOptions options = new RebuildServerOptions();
+         return options.ipv6Address(ipv6Address);
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/FindSecurityGroupWithNameAndReturnTrue.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/FindSecurityGroupWithNameAndReturnTrue.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/FindSecurityGroupWithNameAndReturnTrue.java
new file mode 100644
index 0000000..a44b502
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/FindSecurityGroupWithNameAndReturnTrue.java
@@ -0,0 +1,84 @@
+/*
+ * 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.nova.v2_0.predicates;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.NoSuchElementException;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.annotation.Resource;
+import javax.inject.Singleton;
+
+import org.jclouds.logging.Logger;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
+import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi;
+import org.jclouds.rest.ResourceNotFoundException;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+import com.google.inject.Inject;
+
+/**
+ * AtomicReference is so that we can return the securityGroup that matched.
+ * 
+ * @author Adrian Cole
+ */
+@Singleton
+public class FindSecurityGroupWithNameAndReturnTrue implements Predicate<AtomicReference<ZoneAndName>> {
+
+   private final NovaApi novaApi;
+
+   @Resource
+   protected Logger logger = Logger.NULL;
+
+   @Inject
+   public FindSecurityGroupWithNameAndReturnTrue(NovaApi novaApi) {
+      this.novaApi = checkNotNull(novaApi, "novaApi");
+   }
+
+   public boolean apply(AtomicReference<ZoneAndName> securityGroupInZoneRef) {
+      checkNotNull(securityGroupInZoneRef, "securityGroupRef");
+      final ZoneAndName securityGroupInZone = checkNotNull(securityGroupInZoneRef.get(), "securityGroupInZone");
+
+      Optional<? extends SecurityGroupApi> api = novaApi.getSecurityGroupExtensionForZone(securityGroupInZone.getZone());
+      checkArgument(api.isPresent(), "Security groups are required, but the extension is not available!");
+
+      logger.trace("looking for security group %s", securityGroupInZone.slashEncode());
+      try {
+         SecurityGroup returnVal = Iterables.find(api.get().list(), new Predicate<SecurityGroup>() {
+
+            @Override
+            public boolean apply(SecurityGroup input) {
+               return input.getName().equals(securityGroupInZone.getName());
+            }
+
+         });
+         securityGroupInZoneRef.set(new SecurityGroupInZone(returnVal, securityGroupInZone.getZone()));
+         return true;
+      } catch (ResourceNotFoundException e) {
+         return false;
+      } catch (NoSuchElementException e) {
+         return false;
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/ImagePredicates.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/ImagePredicates.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/ImagePredicates.java
new file mode 100644
index 0000000..aa8cad7
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/ImagePredicates.java
@@ -0,0 +1,55 @@
+/*
+ * 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.nova.v2_0.predicates;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.openstack.nova.v2_0.domain.Image;
+import org.jclouds.openstack.nova.v2_0.domain.Image.Status;
+
+import com.google.common.base.Predicate;
+
+/**
+ * Predicates handy when working with Images
+ * 
+ * @author Adrian Cole
+ */
+
+public class ImagePredicates {
+
+   /**
+    * matches status of the given image
+    * 
+    * @param status
+    * @return predicate that matches status
+    */
+   public static Predicate<Image> statusEquals(final Status status) {
+      checkNotNull(status, "status must be defined");
+
+      return new Predicate<Image>() {
+         @Override
+         public boolean apply(Image image) {
+            return status.equals(image.getStatus());
+         }
+
+         @Override
+         public String toString() {
+            return "statusEquals(" + status + ")";
+         }
+      };
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/KeyPairPredicates.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/KeyPairPredicates.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/KeyPairPredicates.java
new file mode 100644
index 0000000..ec511bb
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/KeyPairPredicates.java
@@ -0,0 +1,77 @@
+/*
+ * 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.nova.v2_0.predicates;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
+
+import com.google.common.base.Predicate;
+
+/**
+ * Predicates handy when working with KeyPairs
+ * 
+ * @author Adam Lowe
+ */
+
+public class KeyPairPredicates {
+
+
+   /**
+    * matches name of the given key pair
+    * 
+    * @param name
+    * @return predicate that matches name
+    */
+   public static Predicate<KeyPair> nameMatches(final Predicate<String> name) {
+      checkNotNull(name, "name must be defined");
+
+      return new Predicate<KeyPair>() {
+         @Override
+         public boolean apply(KeyPair ext) {
+            return name.apply(ext.getName());
+         }
+
+         @Override
+         public String toString() {
+            return "nameMatches(" + name + ")";
+         }
+      };
+   }
+   
+   /**
+    * matches name of the given keypair starts with the specified prefix
+    *
+    * @param name the prefix you are looking for
+    * @return the predicate
+    */
+   public static Predicate<KeyPair> nameEquals(final String name) {
+      checkNotNull(name, "name must be defined");
+
+      return new Predicate<KeyPair>() {
+         @Override
+         public boolean apply(KeyPair ext) {
+            return ext.getName() != null && ext.getName().equals(name);
+         }
+
+         @Override
+         public String toString() {
+            return "nameEquals(" + name + ")";
+         }
+      };
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/SecurityGroupPredicates.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/SecurityGroupPredicates.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/SecurityGroupPredicates.java
new file mode 100644
index 0000000..412e37f
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/SecurityGroupPredicates.java
@@ -0,0 +1,213 @@
+/*
+ * 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.nova.v2_0.predicates;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Set;
+
+import org.jclouds.net.domain.IpProtocol;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
+import org.jclouds.openstack.nova.v2_0.domain.SecurityGroupRule;
+
+import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
+
+/**
+ * Predicates handy when working with SecurityGroups
+ * 
+ * @author Adrian Cole
+ */
+
+public class SecurityGroupPredicates {
+
+   /**
+    * matches name of the given security group
+    *
+    * @param name
+    * @return predicate that matches name
+    */
+   public static Predicate<SecurityGroup> nameEquals(final String name) {
+      checkNotNull(name, "name must be defined");
+
+      return new Predicate<SecurityGroup>() {
+         @Override
+         public boolean apply(SecurityGroup ext) {
+            return name.equals(ext.getName());
+         }
+
+         @Override
+         public String toString() {
+            return "nameEquals(" + name + ")";
+         }
+      };
+   }
+
+   /**
+    * matches name of the given security group against a list
+    *
+    * @param names
+    * @return predicate that matches one of the names
+    */
+   public static Predicate<SecurityGroup> nameIn(final Set<String> names) {
+      checkNotNull(names, "names must be defined");
+
+      return new Predicate<SecurityGroup>() {
+         @Override
+         public boolean apply(SecurityGroup ext) {
+            return Predicates.in(names).apply(ext.getName());
+         }
+
+         @Override
+         public String toString() {
+            return "nameIn(" + names + ")";
+         }
+      };
+   }
+
+   /**
+    * matches name of the given security group
+    * 
+    * @param name
+    * @return predicate that matches name
+    */
+   public static Predicate<SecurityGroup> nameMatches(final Predicate<String> name) {
+      checkNotNull(name, "name must be defined");
+
+      return new Predicate<SecurityGroup>() {
+         @Override
+         public boolean apply(SecurityGroup ext) {
+            return name.apply(ext.getName());
+         }
+
+         @Override
+         public String toString() {
+            return "nameMatches(" + name + ")";
+         }
+      };
+   }
+
+   /**
+    * matches a security group rule by its cidr
+    *
+    * @param cidr
+    * @return predicate that matches cidr
+    */
+   public static Predicate<SecurityGroupRule> ruleCidr(final String cidr) {
+      checkNotNull(cidr, "cidr must be defined");
+
+      return new Predicate<SecurityGroupRule>() {
+         @Override
+         public boolean apply(SecurityGroupRule ext) {
+            return cidr.equals(ext.getIpRange());
+         }
+
+         @Override
+         public String toString() {
+            return "cidr(" + cidr + ")";
+         }
+      };
+   }
+
+   /**
+    * matches a security group rule by the security group it allows
+    *
+    * @param groupName
+    * @return predicate that matches group
+    */
+   public static Predicate<SecurityGroupRule> ruleGroup(final String groupName) {
+      checkNotNull(groupName, "groupName must be defined");
+
+      return new Predicate<SecurityGroupRule>() {
+         @Override
+         public boolean apply(SecurityGroupRule ext) {
+            return ext.getGroup() != null && groupName.equals(ext.getGroup().getName());
+         }
+
+         @Override
+         public String toString() {
+            return "ruleGroup(" + groupName + ")";
+         }
+      };
+   }
+
+   /**
+    * matches a security group rule by the protocol
+    *
+    * @param protocol
+    * @return predicate that matches protocol
+    */
+   public static Predicate<SecurityGroupRule> ruleProtocol(final IpProtocol protocol) {
+      checkNotNull(protocol, "protocol must be defined");
+
+      return new Predicate<SecurityGroupRule>() {
+         @Override
+         public boolean apply(SecurityGroupRule ext) {
+            return protocol.equals(ext.getIpProtocol());
+         }
+
+         @Override
+         public String toString() {
+            return "ruleProtocol(" + protocol + ")";
+         }
+      };
+   }
+
+   /**
+    * matches a security group rule by the start port
+    *
+    * @param startPort
+    * @return predicate that matches startPort
+    */
+   public static Predicate<SecurityGroupRule> ruleStartPort(final int startPort) {
+      checkNotNull(startPort, "startPort must be defined");
+
+      return new Predicate<SecurityGroupRule>() {
+         @Override
+         public boolean apply(SecurityGroupRule ext) {
+            return startPort == ext.getFromPort();
+         }
+
+         @Override
+         public String toString() {
+            return "ruleStartPort(" + startPort + ")";
+         }
+      };
+   }
+
+   /**
+    * matches a security group rule by the end port
+    *
+    * @param endPort
+    * @return predicate that matches endPort
+    */
+   public static Predicate<SecurityGroupRule> ruleEndPort(final int endPort) {
+      checkNotNull(endPort, "endPort must be defined");
+
+      return new Predicate<SecurityGroupRule>() {
+         @Override
+         public boolean apply(SecurityGroupRule ext) {
+            return endPort == ext.getToPort();
+         }
+
+         @Override
+         public String toString() {
+            return "ruleEndPort(" + endPort + ")";
+         }
+      };
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
new file mode 100644
index 0000000..67c3d34
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
@@ -0,0 +1 @@
+org.jclouds.openstack.nova.v2_0.NovaApiMetadata
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/d4243b7e/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest.java b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest.java
new file mode 100644
index 0000000..9e6c46b
--- /dev/null
+++ b/dependencies/jclouds/openstack-nova/1.7.1-stratos/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest.java
@@ -0,0 +1,75 @@
+/*
+ * 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.nova.v2_0;
+
+import static org.testng.Assert.assertEquals;
+
+import java.util.Properties;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.keystone.v2_0.internal.KeystoneFixture;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseServerListTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * 
+ * @see KeystoneProperties#CREDENTIAL_TYPE
+ * @author Adrian Cole
+ */
+@Test(groups = "unit", testName = "AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest")
+public class AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest extends BaseNovaApiExpectTest {
+   public AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest() {
+      identity = identityWithTenantId;
+   }
+
+   /**
+    * this reflects the properties that a user would pass to createContext
+    */
+   @Override
+   protected Properties setupProperties() {
+      Properties contextProperties = super.setupProperties();
+      contextProperties.setProperty("jclouds.keystone.credential-type", "apiAccessKeyCredentials");
+      contextProperties.setProperty("jclouds.keystone.tenant-id", KeystoneFixture.INSTANCE.getTenantId());
+      return contextProperties;
+   }
+
+   public void testListServersWhenResponseIs2xx() throws Exception {
+      HttpRequest listServers = HttpRequest
+            .builder()
+            .method("GET")
+            .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers")
+            .addHeader("Accept", "application/json")
+            .addHeader("X-Auth-Token", authToken).build();
+
+      HttpResponse listServersResponse = HttpResponse.builder().statusCode(200)
+            .payload(payloadFromResource("/server_list.json")).build();
+
+      NovaApi apiWhenServersExist = requestsSendResponses(keystoneAuthWithAccessKeyAndSecretKeyAndTenantId,
+            responseWithKeystoneAccess, listServers, listServersResponse);
+
+      assertEquals(apiWhenServersExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
+
+      assertEquals(apiWhenServersExist.getServerApiForZone("az-1.region-a.geo-1").list().concat().toString(),
+            new ParseServerListTest().expected().toString());
+   }
+
+}
+