You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by de...@apache.org on 2016/02/19 16:33:25 UTC

[15/35] jclouds git commit: Profitbricks IpBlock API

Profitbricks IpBlock API

Conflicts:
	profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksApi.java


Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/af93f3b6
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/af93f3b6
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/af93f3b6

Branch: refs/heads/master
Commit: af93f3b68f9c19ac504719b702d0425eb1583f46
Parents: 36d499b
Author: jasminSPC <ja...@stackpointcloud.com>
Authored: Tue Mar 3 22:46:34 2015 +0100
Committer: Ignasi Barrera <na...@apache.org>
Committed: Sun Mar 8 21:15:43 2015 +0100

----------------------------------------------------------------------
 .../jclouds/profitbricks/ProfitBricksApi.java   |   5 +
 .../jclouds/profitbricks/domain/IpBlock.java    | 125 ++++++++++++
 .../profitbricks/features/IpBlockApi.java       |  80 ++++++++
 .../ipblock/BaseIpBlockResponseHandler.java     |  68 +++++++
 .../ipblock/IpBlockListResponseHandler.java     |  62 ++++++
 .../parser/ipblock/IpBlockResponseHandler.java  |  64 ++++++
 .../publicip/BasePublicIpResponseHandler.java   |  38 ++++
 .../publicip/PublicIpListResponseHandler.java   |  51 +++++
 .../features/IpBlockApiLiveTest.java            |  92 +++++++++
 .../features/IpBlockApiMockTest.java            | 200 +++++++++++++++++++
 .../ipblock/IpBlockListResponseHandlerTest.java |  77 +++++++
 .../ipblock/IpBlockResponseHandlerTest.java     |  63 ++++++
 .../test/resources/ipblock/ipblock-addtonic.xml |  12 ++
 .../test/resources/ipblock/ipblock-release.xml  |  10 +
 .../resources/ipblock/ipblock-removefromnic.xml |  12 ++
 .../test/resources/ipblock/ipblock-reserve.xml  |  13 ++
 .../src/test/resources/ipblock/ipblock.xml      |  18 ++
 .../src/test/resources/ipblock/ipblocks.xml     |  30 +++
 18 files changed, 1020 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/af93f3b6/providers/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksApi.java
----------------------------------------------------------------------
diff --git a/providers/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksApi.java b/providers/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksApi.java
index af7a31d..34309bf 100644
--- a/providers/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksApi.java
+++ b/providers/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksApi.java
@@ -20,6 +20,7 @@ import java.io.Closeable;
 import org.jclouds.profitbricks.features.DataCenterApi;
 import org.jclouds.profitbricks.features.FirewallApi;
 import org.jclouds.profitbricks.features.ImageApi;
+import org.jclouds.profitbricks.features.IpBlockApi;
 import org.jclouds.profitbricks.features.NicApi;
 import org.jclouds.profitbricks.features.ServerApi;
 import org.jclouds.profitbricks.features.SnapshotApi;
@@ -48,4 +49,8 @@ public interface ProfitBricksApi extends Closeable {
 
    @Delegate
    SnapshotApi snapshotApi();
+
+   @Delegate
+   IpBlockApi ipBlockApi();
+
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/af93f3b6/providers/profitbricks/src/main/java/org/jclouds/profitbricks/domain/IpBlock.java
----------------------------------------------------------------------
diff --git a/providers/profitbricks/src/main/java/org/jclouds/profitbricks/domain/IpBlock.java b/providers/profitbricks/src/main/java/org/jclouds/profitbricks/domain/IpBlock.java
new file mode 100644
index 0000000..47741ff
--- /dev/null
+++ b/providers/profitbricks/src/main/java/org/jclouds/profitbricks/domain/IpBlock.java
@@ -0,0 +1,125 @@
+/*
+ * 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.profitbricks.domain;
+
+import com.google.auto.value.AutoValue;
+import com.google.common.collect.ImmutableList;
+import java.util.List;
+import org.jclouds.javax.annotation.Nullable;
+
+@AutoValue
+public abstract class IpBlock {
+
+   public abstract String id();
+
+   public abstract Location location();
+
+   public abstract List<PublicIp> publicIps();
+
+   public abstract List<String> ips();
+
+   public static IpBlock create(String id, Location location, List<PublicIp> publicIps, List<String> ips) {
+      return new AutoValue_IpBlock(id, location, publicIps, ips != null ? ImmutableList.copyOf(ips) : ImmutableList.<String>of());
+   }
+
+   public static Builder builder() {
+      return new Builder();
+   }
+
+   public static final class Builder {
+
+      private String id;
+      private Location location;
+      private List<PublicIp> publicIps;
+      private List<String> ips;
+
+      public Builder id(String id) {
+         this.id = id;
+         return this;
+      }
+
+      public Builder location(Location location) {
+         this.location = location;
+         return this;
+      }
+
+      public Builder publicIps(List<PublicIp> publicIps) {
+         this.publicIps = publicIps;
+         return this;
+      }
+
+      public Builder ips(List<String> ips) {
+         this.ips = ips;
+         return this;
+      }
+
+      public IpBlock build() {
+         return IpBlock.create(id, location, publicIps, ips);
+      }
+
+      public Builder fromIpBlock(IpBlock in) {
+         return this.id(in.id()).location(in.location()).publicIps(in.publicIps()).ips(in.ips());
+      }
+
+   }
+
+   @AutoValue
+   public abstract static class PublicIp {
+
+      public abstract String ip();
+
+      @Nullable
+      public abstract String nicId();
+
+      public static PublicIp create(String ip, String nicId) {
+         return new AutoValue_IpBlock_PublicIp(ip, nicId);
+      }
+
+      public static Builder builder() {
+         return new Builder();
+      }
+
+      public Builder toBuilder() {
+         return builder().fromPublicIp(this);
+      }
+
+      public static final class Builder {
+
+         private String ip;
+         private String nicId;
+
+         public Builder ip(String ip) {
+            this.ip = ip;
+            return this;
+         }
+
+         public Builder nicId(String nicId) {
+            this.nicId = nicId;
+            return this;
+         }
+
+         public PublicIp build() {
+            return PublicIp.create(ip, nicId);
+         }
+
+         public Builder fromPublicIp(PublicIp in) {
+            return this.ip(in.ip()).nicId(in.nicId());
+         }
+      }
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/af93f3b6/providers/profitbricks/src/main/java/org/jclouds/profitbricks/features/IpBlockApi.java
----------------------------------------------------------------------
diff --git a/providers/profitbricks/src/main/java/org/jclouds/profitbricks/features/IpBlockApi.java b/providers/profitbricks/src/main/java/org/jclouds/profitbricks/features/IpBlockApi.java
new file mode 100644
index 0000000..a81293e
--- /dev/null
+++ b/providers/profitbricks/src/main/java/org/jclouds/profitbricks/features/IpBlockApi.java
@@ -0,0 +1,80 @@
+/*
+ * 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.profitbricks.features;
+
+import java.util.List;
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import org.jclouds.Fallbacks;
+import org.jclouds.http.filters.BasicAuthentication;
+import org.jclouds.profitbricks.domain.IpBlock;
+import org.jclouds.profitbricks.http.filters.ProfitBricksSoapMessageEnvelope;
+import org.jclouds.profitbricks.http.parser.RequestIdOnlyResponseHandler;
+import org.jclouds.profitbricks.http.parser.ipblock.IpBlockListResponseHandler;
+import org.jclouds.profitbricks.http.parser.ipblock.IpBlockResponseHandler;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.Payload;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.XMLResponseParser;
+
+@RequestFilters({BasicAuthentication.class, ProfitBricksSoapMessageEnvelope.class})
+@Consumes(MediaType.TEXT_XML)
+@Produces(MediaType.TEXT_XML)
+public interface IpBlockApi {
+
+   @POST
+   @Named("publicipblock:get")
+   @Payload("<ws:getPublicIpBlock><blockId>{id}</blockId></ws:getPublicIpBlock>")
+   @XMLResponseParser(IpBlockResponseHandler.class)
+   @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+   IpBlock getIpBlock(@PayloadParam("id") String identifier);
+
+   @POST
+   @Named("publicipblock:getall")
+   @Payload("<ws:getAllPublicIpBlocks />")
+   @XMLResponseParser(IpBlockListResponseHandler.class)
+   @Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
+   List<IpBlock> getAllIpBlock();
+
+   @POST
+   @Named("publicipblock:reserve")
+   @Payload("<ws:reservePublicIpBlock><request><blockSize>{blockSize}</blockSize><location>{location}</location></request></ws:reservePublicIpBlock>")
+   @XMLResponseParser(IpBlockResponseHandler.class)
+   IpBlock reservePublicIpBlock(@PayloadParam("blockSize") String blockSize, @PayloadParam("location") String location);
+
+   @POST
+   @Named("publicipblock:addip")
+   @Payload("<ws:addPublicIpToNic><ip>{ip}</ip><nicId>{nicid}</nicId></ws:addPublicIpToNic>")
+   @XMLResponseParser(RequestIdOnlyResponseHandler.class)
+   String addPublicIpToNic(@PayloadParam("ip") String ip, @PayloadParam("nicid") String nicid);
+
+   @POST
+   @Named("publicipblock:removeip")
+   @Payload("<ws:removePublicIpFromNic><ip>{ip}</ip><nicId>{nicid}</nicId></ws:removePublicIpFromNic>")
+   @XMLResponseParser(RequestIdOnlyResponseHandler.class)
+   String removePublicIpFromNic(@PayloadParam("ip") String ip, @PayloadParam("nicid") String nicid);
+
+   @POST
+   @Named("publicipblock:releaseblock")
+   @Payload("<ws:releasePublicIpBlock><blockId>{blockid}</blockId></ws:releasePublicIpBlock>")
+   @XMLResponseParser(RequestIdOnlyResponseHandler.class)
+   String releasePublicIpBlock(@PayloadParam("blockid") String blockid);
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/af93f3b6/providers/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ipblock/BaseIpBlockResponseHandler.java
----------------------------------------------------------------------
diff --git a/providers/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ipblock/BaseIpBlockResponseHandler.java b/providers/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ipblock/BaseIpBlockResponseHandler.java
new file mode 100644
index 0000000..a4af29f
--- /dev/null
+++ b/providers/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ipblock/BaseIpBlockResponseHandler.java
@@ -0,0 +1,68 @@
+/*
+ * 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.profitbricks.http.parser.ipblock;
+
+import com.google.common.collect.Lists;
+import java.util.List;
+import org.jclouds.profitbricks.domain.IpBlock;
+import org.jclouds.profitbricks.domain.Location;
+import org.jclouds.profitbricks.http.parser.BaseProfitBricksResponseHandler;
+import org.jclouds.profitbricks.http.parser.publicip.PublicIpListResponseHandler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public abstract class BaseIpBlockResponseHandler<T> extends BaseProfitBricksResponseHandler<T> {
+
+   protected final PublicIpListResponseHandler publicIpListResponseHandler;
+   protected final List<IpBlock.PublicIp> publicIps = Lists.newArrayList();
+   protected List<String> ips;
+
+   protected IpBlock.Builder builder;
+   protected boolean usePublicIpListParser = false;
+
+   BaseIpBlockResponseHandler(PublicIpListResponseHandler publicIpListResponseHandler) {
+      this.builder = IpBlock.builder();
+      this.publicIpListResponseHandler = publicIpListResponseHandler;
+      ips = Lists.newArrayList();
+   }
+
+   @Override
+   public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+      if ("publicIps".equals(qName))
+         usePublicIpListParser = true;
+      if (usePublicIpListParser)
+         publicIpListResponseHandler.startElement(uri, localName, qName, attributes);
+   }
+
+   @Override
+   public void characters(char[] ch, int start, int length) {
+      if (usePublicIpListParser)
+         publicIpListResponseHandler.characters(ch, start, length);
+      else
+         super.characters(ch, start, length);
+   }
+
+   @Override
+   protected void setPropertyOnEndTag(String qName) {
+      if ("blockId".equals(qName))
+         builder.id(textToStringValue());
+      else if ("location".equals(qName))
+         builder.location(Location.fromId(textToStringValue()));
+      else if ("ips".equals(qName))
+         ips.add(textToStringValue());
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/af93f3b6/providers/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockListResponseHandler.java
----------------------------------------------------------------------
diff --git a/providers/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockListResponseHandler.java b/providers/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockListResponseHandler.java
new file mode 100644
index 0000000..c56f0ea
--- /dev/null
+++ b/providers/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockListResponseHandler.java
@@ -0,0 +1,62 @@
+/*
+ * 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.profitbricks.http.parser.ipblock;
+
+import autovalue.shaded.com.google.common.common.collect.Lists;
+import com.google.inject.Inject;
+import java.util.List;
+import org.jclouds.profitbricks.domain.IpBlock;
+import org.jclouds.profitbricks.http.parser.publicip.PublicIpListResponseHandler;
+import org.xml.sax.SAXException;
+
+public class IpBlockListResponseHandler extends BaseIpBlockResponseHandler<List<IpBlock>> {
+
+   private final List<IpBlock> ipBlocks;
+
+   @Inject
+   IpBlockListResponseHandler(PublicIpListResponseHandler publicIpListResponseHandler) {
+      super(publicIpListResponseHandler);
+      ipBlocks = Lists.newArrayList();
+   }
+
+   @Override
+   public void endElement(String uri, String localName, String qName) throws SAXException {
+      if (usePublicIpListParser)
+         publicIpListResponseHandler.endElement(uri, localName, qName);
+      else {
+         setPropertyOnEndTag(qName);
+         if ("return".equals(qName)) {
+            ipBlocks.add(builder
+                    .publicIps(publicIpListResponseHandler.getResult())
+                    .build());
+            publicIpListResponseHandler.reset();
+            builder = IpBlock.builder();
+         }
+         clearTextBuffer();
+      }
+
+      if ("publicIps".equals(qName))
+         usePublicIpListParser = false;
+
+   }
+
+   @Override
+   public List<IpBlock> getResult() {
+      return ipBlocks;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/af93f3b6/providers/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockResponseHandler.java
----------------------------------------------------------------------
diff --git a/providers/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockResponseHandler.java b/providers/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockResponseHandler.java
new file mode 100644
index 0000000..307db14
--- /dev/null
+++ b/providers/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockResponseHandler.java
@@ -0,0 +1,64 @@
+/*
+ * 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.profitbricks.http.parser.ipblock;
+
+import com.google.inject.Inject;
+import org.jclouds.profitbricks.domain.IpBlock;
+import org.jclouds.profitbricks.http.parser.publicip.PublicIpListResponseHandler;
+import org.xml.sax.SAXException;
+
+public class IpBlockResponseHandler extends BaseIpBlockResponseHandler<IpBlock> {
+
+   private boolean done = false;
+
+   @Inject
+   IpBlockResponseHandler(PublicIpListResponseHandler publicIpListResponseHandler) {
+      super(publicIpListResponseHandler);
+   }
+
+   @Override
+   public void endElement(String uri, String localName, String qName) throws SAXException {
+      if (done)
+         return;
+
+      if (usePublicIpListParser)
+         publicIpListResponseHandler.endElement(uri, localName, qName);
+      else {
+         setPropertyOnEndTag(qName);
+         if ("return".equals(qName)) {
+            done = true;
+            builder.publicIps(publicIpListResponseHandler.getResult());
+            builder.ips(ips);
+         }
+         clearTextBuffer();
+      }
+
+      if ("publicIps".equals(qName))
+         usePublicIpListParser = false;
+   }
+
+   @Override
+   public void reset() {
+      this.builder = IpBlock.builder();
+   }
+
+   @Override
+   public IpBlock getResult() {
+      return builder.build();
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/af93f3b6/providers/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/publicip/BasePublicIpResponseHandler.java
----------------------------------------------------------------------
diff --git a/providers/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/publicip/BasePublicIpResponseHandler.java b/providers/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/publicip/BasePublicIpResponseHandler.java
new file mode 100644
index 0000000..8561aad
--- /dev/null
+++ b/providers/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/publicip/BasePublicIpResponseHandler.java
@@ -0,0 +1,38 @@
+/*
+ * 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.profitbricks.http.parser.publicip;
+
+import org.jclouds.profitbricks.domain.IpBlock;
+import org.jclouds.profitbricks.http.parser.BaseProfitBricksResponseHandler;
+
+public abstract class BasePublicIpResponseHandler<T> extends BaseProfitBricksResponseHandler<T> {
+
+   protected IpBlock.PublicIp.Builder builder;
+
+   BasePublicIpResponseHandler() {
+      this.builder = IpBlock.PublicIp.builder();
+   }
+
+   @Override
+   protected void setPropertyOnEndTag(String qName) {
+      if ("ip".equals(qName))
+         builder.ip(textToStringValue());
+      else if ("nicId".equals(qName))
+         builder.nicId(textToStringValue());
+
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/af93f3b6/providers/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/publicip/PublicIpListResponseHandler.java
----------------------------------------------------------------------
diff --git a/providers/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/publicip/PublicIpListResponseHandler.java b/providers/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/publicip/PublicIpListResponseHandler.java
new file mode 100644
index 0000000..c68e7e6
--- /dev/null
+++ b/providers/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/publicip/PublicIpListResponseHandler.java
@@ -0,0 +1,51 @@
+/*
+ * 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.profitbricks.http.parser.publicip;
+
+import com.google.common.collect.Lists;
+import java.util.List;
+import org.jclouds.profitbricks.domain.IpBlock.PublicIp;
+import org.xml.sax.SAXException;
+
+public class PublicIpListResponseHandler extends BasePublicIpResponseHandler<List<PublicIp>> {
+
+   private List<PublicIp> publicIps;
+
+   PublicIpListResponseHandler() {
+      this.publicIps = Lists.newArrayList();
+   }
+
+   @Override
+   public void endElement(String uri, String localName, String qName) throws SAXException {
+      setPropertyOnEndTag(qName);
+
+      if ("publicIps".equals(qName))
+         publicIps.add(builder.build());
+      clearTextBuffer();
+   }
+
+   @Override
+   public void reset() {
+      this.publicIps = Lists.newArrayList();
+   }
+
+   @Override
+   public List<PublicIp> getResult() {
+      return publicIps;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/af93f3b6/providers/profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiLiveTest.java b/providers/profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiLiveTest.java
new file mode 100644
index 0000000..227cfc7
--- /dev/null
+++ b/providers/profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiLiveTest.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.profitbricks.features;
+
+import com.google.common.collect.Iterables;
+import java.util.List;
+import org.jclouds.profitbricks.BaseProfitBricksLiveTest;
+import org.jclouds.profitbricks.domain.IpBlock;
+import org.jclouds.profitbricks.domain.Location;
+import org.jclouds.profitbricks.domain.Nic;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+import org.testng.annotations.Test;
+
+@Test(groups = "live", testName = "IpBlockApiLiveTest", singleThreaded = true)
+public class IpBlockApiLiveTest extends BaseProfitBricksLiveTest {
+
+   private String nicid;
+   private IpBlock newIpBlock;
+
+   @Override
+   public void initialize() {
+      super.initialize();
+
+      List<Nic> nics = api.nicApi().getAllNics();
+
+      assertFalse(nics.isEmpty(), "At least one NIC is requred to test IpBlocks");
+
+      Nic nic = Iterables.getFirst(nics, null);
+
+      nicid = nic.id();
+   }
+
+   @Test
+   public void testReservePublicIpBlock() {
+      newIpBlock = api.ipBlockApi().reservePublicIpBlock("2", Location.US_LAS.value());
+
+      assertNotNull(newIpBlock);
+      assertNotNull(newIpBlock.ips());
+      assertFalse(newIpBlock.ips().isEmpty());
+   }
+
+   @Test
+   public void testGetAllIpBlocks() {
+      List<IpBlock> ipBlocks = api.ipBlockApi().getAllIpBlock();
+
+      assertNotNull(ipBlocks);
+      assertFalse(ipBlocks.isEmpty());
+   }
+
+   @Test(dependsOnMethods = "testReservePublicIpBlock")
+   public void testGetOneIpBlock() {
+      IpBlock ipBlock = api.ipBlockApi().getIpBlock(newIpBlock.id());
+
+      assertNotNull(ipBlock);
+   }
+
+   @Test(dependsOnMethods = "testReservePublicIpBlock")
+   public void testAddPublicIpToNic() {
+      String requestId = api.ipBlockApi().addPublicIpToNic(newIpBlock.ips().get(0), nicid);
+
+      assertNotNull(requestId);
+   }
+
+   @Test(dependsOnMethods = "testAddPublicIpToNic")
+   public void testRemovePublicIpFromNic() {
+      String requestId = api.ipBlockApi().removePublicIpFromNic(newIpBlock.ips().get(0), nicid);
+
+      assertNotNull(requestId);
+   }
+
+   @Test(dependsOnMethods = "testRemovePublicIpFromNic")
+   public void testReleasePublicIpBlock() {
+      String requestId = api.ipBlockApi().releasePublicIpBlock(newIpBlock.id());
+
+      assertNotNull(requestId);
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/af93f3b6/providers/profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiMockTest.java b/providers/profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiMockTest.java
new file mode 100644
index 0000000..b0d3356
--- /dev/null
+++ b/providers/profitbricks/src/test/java/org/jclouds/profitbricks/features/IpBlockApiMockTest.java
@@ -0,0 +1,200 @@
+/*
+ * 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.profitbricks.features;
+
+import com.squareup.okhttp.mockwebserver.MockResponse;
+import com.squareup.okhttp.mockwebserver.MockWebServer;
+import java.util.List;
+import org.jclouds.profitbricks.ProfitBricksApi;
+import org.jclouds.profitbricks.domain.IpBlock;
+import org.jclouds.profitbricks.domain.Location;
+import org.jclouds.profitbricks.internal.BaseProfitBricksMockTest;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "IpBlockApiMockTest")
+public class IpBlockApiMockTest extends BaseProfitBricksMockTest {
+
+   @Test
+   public void testGetOneIpBlock() throws Exception {
+      MockWebServer server = mockWebServer();
+      server.enqueue(new MockResponse().setBody(payloadFromResource("/ipblock/ipblock.xml")));
+
+      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
+      IpBlockApi api = pbApi.ipBlockApi();
+
+      String id = "qwertyui-qwer-qwer-qwer-qwertyyuiiop";
+
+      String content = "<ws:getPublicIpBlock><blockId>" + id + "</blockId></ws:getPublicIpBlock>";
+
+      try {
+         IpBlock ipBlock = api.getIpBlock(id);
+         assertRequestHasCommonProperties(server.takeRequest(), content);
+         assertNotNull(ipBlock);
+         assertEquals(ipBlock.id(), id);
+      } finally {
+         pbApi.close();
+         server.shutdown();
+      }
+   }
+
+   @Test
+   public void testGetNonExisingIpBlock() throws Exception {
+      MockWebServer server = mockWebServer();
+      server.enqueue(new MockResponse().setResponseCode(404));
+
+      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
+      IpBlockApi api = pbApi.ipBlockApi();
+
+      String id = "qwertyui-qwer-qwer-qwer-qwertyyuiiop";
+
+      try {
+         IpBlock ipBlock = api.getIpBlock(id);
+         assertRequestHasCommonProperties(server.takeRequest());
+         assertNull(ipBlock);
+      } finally {
+         pbApi.close();
+         server.shutdown();
+      }
+   }
+
+   @Test
+   public void testGetAllIpBlock() throws Exception {
+      MockWebServer server = mockWebServer();
+      server.enqueue(new MockResponse().setBody(payloadFromResource("/ipblock/ipblocks.xml")));
+
+      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
+      IpBlockApi api = pbApi.ipBlockApi();
+
+      try {
+         List<IpBlock> ipBlocks = api.getAllIpBlock();
+         assertRequestHasCommonProperties(server.takeRequest());
+         assertNotNull(ipBlocks);
+      } finally {
+         pbApi.close();
+         server.shutdown();
+      }
+   }
+
+   @Test
+   public void testGetAllIpBlockReturning404() throws Exception {
+      MockWebServer server = mockWebServer();
+      server.enqueue(new MockResponse().setResponseCode(404));
+
+      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
+      IpBlockApi api = pbApi.ipBlockApi();
+
+      try {
+         List<IpBlock> ipBlocks = api.getAllIpBlock();
+         assertRequestHasCommonProperties(server.takeRequest());
+         assertTrue(ipBlocks.isEmpty());
+      } finally {
+         pbApi.close();
+         server.shutdown();
+      }
+   }
+
+   @Test
+   public void testReservePublicIpBlock() throws Exception {
+      MockWebServer server = mockWebServer();
+      server.enqueue(new MockResponse().setBody(payloadFromResource("/ipblock/ipblock-reserve.xml")));
+
+      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
+      IpBlockApi api = pbApi.ipBlockApi();
+
+      String blockSize = "2";
+      Location location = Location.US_LAS;
+
+      String content = "<ws:reservePublicIpBlock><request><blockSize>" + blockSize + "</blockSize><location>" + location.value() + "</location></request></ws:reservePublicIpBlock>";
+      try {
+         IpBlock ipBlock = api.reservePublicIpBlock(blockSize, location.value());
+         assertRequestHasCommonProperties(server.takeRequest(), content);
+         assertNotNull(ipBlock);
+      } finally {
+         pbApi.close();
+         server.shutdown();
+      }
+   }
+
+   @Test
+   public void testAddPublicIpToNic() throws Exception {
+      MockWebServer server = mockWebServer();
+      server.enqueue(new MockResponse().setBody(payloadFromResource("/ipblock/ipblock-addtonic.xml")));
+
+      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
+      IpBlockApi api = pbApi.ipBlockApi();
+
+      String ip = "2";
+      String nicid = "nicid";
+
+      String content = "<ws:addPublicIpToNic><ip>" + ip + "</ip><nicId>" + nicid + "</nicId></ws:addPublicIpToNic>";
+      try {
+         String requestId = api.addPublicIpToNic(ip, nicid);
+         assertRequestHasCommonProperties(server.takeRequest(), content);
+         assertNotNull(requestId);
+      } finally {
+         pbApi.close();
+         server.shutdown();
+      }
+   }
+
+   @Test
+   public void testRemovePublicIpFromNic() throws Exception {
+      MockWebServer server = mockWebServer();
+      server.enqueue(new MockResponse().setBody(payloadFromResource("/ipblock/ipblock-removefromnic.xml")));
+
+      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
+      IpBlockApi api = pbApi.ipBlockApi();
+
+      String ip = "2";
+      String nicid = "nicid";
+
+      String content = "<ws:removePublicIpFromNic><ip>" + ip + "</ip><nicId>" + nicid + "</nicId></ws:removePublicIpFromNic>";
+      try {
+         String requestId = api.removePublicIpFromNic(ip, nicid);
+         assertRequestHasCommonProperties(server.takeRequest(), content);
+         assertNotNull(requestId);
+      } finally {
+         pbApi.close();
+         server.shutdown();
+      }
+   }
+
+   @Test
+   public void testReleasePublicIpBlock() throws Exception {
+      MockWebServer server = mockWebServer();
+      server.enqueue(new MockResponse().setBody(payloadFromResource("/ipblock/ipblock-release.xml")));
+
+      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
+      IpBlockApi api = pbApi.ipBlockApi();
+
+      String blockid = "2";
+
+      String content = "<ws:releasePublicIpBlock><blockId>" + blockid + "</blockId></ws:releasePublicIpBlock>";
+      try {
+         String requestId = api.releasePublicIpBlock(blockid);
+         assertRequestHasCommonProperties(server.takeRequest(), content);
+         assertNotNull(requestId);
+      } finally {
+         pbApi.close();
+         server.shutdown();
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/af93f3b6/providers/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockListResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/providers/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockListResponseHandlerTest.java b/providers/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockListResponseHandlerTest.java
new file mode 100644
index 0000000..49dbaba
--- /dev/null
+++ b/providers/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockListResponseHandlerTest.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.profitbricks.http.parser.ipblock;
+
+import com.google.common.collect.ImmutableList;
+import java.util.List;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.profitbricks.domain.IpBlock;
+import org.jclouds.profitbricks.domain.Location;
+import org.jclouds.profitbricks.domain.IpBlock.PublicIp;
+import org.jclouds.profitbricks.http.parser.BaseResponseHandlerTest;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "IpBlockListResponseHandlerTest")
+public class IpBlockListResponseHandlerTest extends BaseResponseHandlerTest<List<IpBlock>> {
+
+   @Override
+   protected ParseSax<List<IpBlock>> createParser() {
+      return factory.create(injector.getInstance(IpBlockListResponseHandler.class));
+   }
+
+   @Test
+   public void testParseResponseFromGetAllIpBlock() {
+      ParseSax<List<IpBlock>> parser = createParser();
+
+      List<IpBlock> actual = parser.parse(payloadFromResource("/ipblock/ipblocks.xml"));
+      assertNotNull(actual, "Parsed content returned null");
+
+      List<IpBlock> expected = ImmutableList.<IpBlock>of(
+              IpBlock.builder()
+              .id("block-id")
+              .location(Location.US_LAS)
+              .publicIps(ImmutableList.<PublicIp>of(
+                              PublicIp.builder()
+                              .ip("1.1")
+                              .nicId("nic-id")
+                              .build(),
+                              PublicIp.builder()
+                              .ip("1.2")
+                              .nicId("nic-id")
+                              .build()))
+              .build(),
+              IpBlock.builder()
+              .id("block-id")
+              .location(Location.US_LAS)
+              .publicIps(ImmutableList.<PublicIp>of(
+                              PublicIp.builder()
+                              .ip("2.1")
+                              .nicId("nic-id")
+                              .build(),
+                              PublicIp.builder()
+                              .ip("2.2")
+                              .nicId("nic-id")
+                              .build()))
+              .build()
+      );
+
+      assertEquals(actual, expected);
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/af93f3b6/providers/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/providers/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockResponseHandlerTest.java b/providers/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockResponseHandlerTest.java
new file mode 100644
index 0000000..54f48dc
--- /dev/null
+++ b/providers/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/ipblock/IpBlockResponseHandlerTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.profitbricks.http.parser.ipblock;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import java.util.List;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.profitbricks.domain.IpBlock;
+import org.jclouds.profitbricks.domain.Location;
+import org.jclouds.profitbricks.domain.IpBlock.PublicIp;
+import org.jclouds.profitbricks.http.parser.BaseResponseHandlerTest;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "IpBlockResponseHandlerTest")
+public class IpBlockResponseHandlerTest extends BaseResponseHandlerTest<IpBlock> {
+
+   @Override
+   protected ParseSax<IpBlock> createParser() {
+      return factory.create(injector.getInstance(IpBlockResponseHandler.class));
+   }
+
+   @Test
+   public void testParseResponseFromGetIpBlock() {
+      ParseSax<IpBlock> parser = createParser();
+
+      IpBlock actual = parser.parse(payloadFromResource("/ipblock/ipblock.xml"));
+      assertNotNull(actual, "Parsed content returned null");
+      List<String> emptyIpList = Lists.newArrayList();
+
+      IpBlock expected = IpBlock.builder()
+              .id("qwertyui-qwer-qwer-qwer-qwertyyuiiop")
+              .location(Location.US_LAS)
+              .publicIps(ImmutableList.<PublicIp>of(
+                              PublicIp.builder()
+                              .ip("ip")
+                              .nicId("nic-id")
+                              .build(),
+                              PublicIp.builder()
+                              .ip("ip")
+                              .nicId("nic-id")
+                              .build()))
+              .ips(emptyIpList)
+              .build();
+      assertEquals(actual, expected);
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/af93f3b6/providers/profitbricks/src/test/resources/ipblock/ipblock-addtonic.xml
----------------------------------------------------------------------
diff --git a/providers/profitbricks/src/test/resources/ipblock/ipblock-addtonic.xml b/providers/profitbricks/src/test/resources/ipblock/ipblock-addtonic.xml
new file mode 100644
index 0000000..a9c1974
--- /dev/null
+++ b/providers/profitbricks/src/test/resources/ipblock/ipblock-addtonic.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
+  <S:Body>
+    <ns2:addPublicIpToNicResponse xmlns:ns2="http://ws.api.profitbricks.com/">
+      <return>
+        <requestId>request-id</requestId>
+        <dataCenterId>datacenter-id</dataCenterId>
+        <dataCenterVersion>datacenter-version</dataCenterVersion>
+      </return>
+    </ns2:addPublicIpToNicResponse>
+  </S:Body>
+</S:Envelope>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/af93f3b6/providers/profitbricks/src/test/resources/ipblock/ipblock-release.xml
----------------------------------------------------------------------
diff --git a/providers/profitbricks/src/test/resources/ipblock/ipblock-release.xml b/providers/profitbricks/src/test/resources/ipblock/ipblock-release.xml
new file mode 100644
index 0000000..a9f22bf
--- /dev/null
+++ b/providers/profitbricks/src/test/resources/ipblock/ipblock-release.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
+  <S:Body>
+    <ns2:releasePublicIpBlockResponse xmlns:ns2="http://ws.api.profitbricks.com/">
+      <return>
+        <requestId>request-id</requestId>
+      </return>
+    </ns2:releasePublicIpBlockResponse>
+  </S:Body>
+</S:Envelope>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/af93f3b6/providers/profitbricks/src/test/resources/ipblock/ipblock-removefromnic.xml
----------------------------------------------------------------------
diff --git a/providers/profitbricks/src/test/resources/ipblock/ipblock-removefromnic.xml b/providers/profitbricks/src/test/resources/ipblock/ipblock-removefromnic.xml
new file mode 100644
index 0000000..a9c1974
--- /dev/null
+++ b/providers/profitbricks/src/test/resources/ipblock/ipblock-removefromnic.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
+  <S:Body>
+    <ns2:addPublicIpToNicResponse xmlns:ns2="http://ws.api.profitbricks.com/">
+      <return>
+        <requestId>request-id</requestId>
+        <dataCenterId>datacenter-id</dataCenterId>
+        <dataCenterVersion>datacenter-version</dataCenterVersion>
+      </return>
+    </ns2:addPublicIpToNicResponse>
+  </S:Body>
+</S:Envelope>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/af93f3b6/providers/profitbricks/src/test/resources/ipblock/ipblock-reserve.xml
----------------------------------------------------------------------
diff --git a/providers/profitbricks/src/test/resources/ipblock/ipblock-reserve.xml b/providers/profitbricks/src/test/resources/ipblock/ipblock-reserve.xml
new file mode 100644
index 0000000..863e9ff
--- /dev/null
+++ b/providers/profitbricks/src/test/resources/ipblock/ipblock-reserve.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
+  <S:Body>
+    <ns2:reservePublicIpBlockResponse xmlns:ns2="http://ws.api.profitbricks.com/">
+      <return>
+        <requestId>request-id</requestId>
+        <blockId>block-id</blockId>
+        <location>us/las</location>
+        <ips>ip</ips>
+      </return>
+    </ns2:reservePublicIpBlockResponse>
+  </S:Body>
+</S:Envelope>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/af93f3b6/providers/profitbricks/src/test/resources/ipblock/ipblock.xml
----------------------------------------------------------------------
diff --git a/providers/profitbricks/src/test/resources/ipblock/ipblock.xml b/providers/profitbricks/src/test/resources/ipblock/ipblock.xml
new file mode 100644
index 0000000..2dd54f2
--- /dev/null
+++ b/providers/profitbricks/src/test/resources/ipblock/ipblock.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
+  <S:Body>
+    <ns2:getAllPublicIpBlocksResponse xmlns:ns2="http://ws.api.profitbricks.com/">
+      <return>
+        <blockId>qwertyui-qwer-qwer-qwer-qwertyyuiiop</blockId>
+        <location>us/las</location>
+        <publicIps>
+          <ip>ip</ip>
+		  <nicId>nic-id</nicId>
+        </publicIps>
+        <publicIps>
+          <ip>ip</ip>
+        </publicIps>
+      </return>
+    </ns2:getAllPublicIpBlocksResponse>
+  </S:Body>
+</S:Envelope>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/af93f3b6/providers/profitbricks/src/test/resources/ipblock/ipblocks.xml
----------------------------------------------------------------------
diff --git a/providers/profitbricks/src/test/resources/ipblock/ipblocks.xml b/providers/profitbricks/src/test/resources/ipblock/ipblocks.xml
new file mode 100644
index 0000000..4e436e1
--- /dev/null
+++ b/providers/profitbricks/src/test/resources/ipblock/ipblocks.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
+    <S:Body>
+        <ns2:getAllPublicIpBlocksResponse xmlns:ns2="http://ws.api.profitbricks.com/">
+            <return>
+                <blockId>block-id</blockId>
+                <location>us/las</location>
+                <publicIps>
+                    <ip>1.1</ip>
+                    <nicId>nic-id</nicId>      
+                </publicIps>
+                <publicIps>
+                    <ip>1.2</ip>
+                    <nicId>nic-id</nicId>
+                </publicIps>
+            </return>
+            <return>
+                <blockId>block-id</blockId>
+                <location>us/las</location>
+                <publicIps>
+                    <ip>2.1</ip>
+                </publicIps>
+                <publicIps>
+                    <ip>2.2</ip>
+                    <nicId>nic-id</nicId>
+                </publicIps>
+            </return>
+        </ns2:getAllPublicIpBlocksResponse>
+    </S:Body>
+</S:Envelope>
\ No newline at end of file