diff --git a/neutron_tempest_plugin/api/clients.py b/neutron_tempest_plugin/api/clients.py
index 272f5be..875992e 100644
--- a/neutron_tempest_plugin/api/clients.py
+++ b/neutron_tempest_plugin/api/clients.py
@@ -13,6 +13,8 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+from tempest.lib.services.compute import availability_zone_client
+from tempest.lib.services.compute import hypervisor_client
 from tempest.lib.services.compute import keypairs_client
 from tempest.lib.services.compute import servers_client
 from tempest.lib.services.identity.v2 import tenants_client
@@ -74,6 +76,10 @@
             **params)
         self.keypairs_client = keypairs_client.KeyPairsClient(
             self.auth_provider, **params)
+        self.hv_client = hypervisor_client.HypervisorClient(
+            self.auth_provider, **params)
+        self.az_client = availability_zone_client.AvailabilityZoneClient(
+            self.auth_provider, **params)
 
     def _set_identity_clients(self):
         params = {
diff --git a/neutron_tempest_plugin/scenario/admin/__init__.py b/neutron_tempest_plugin/scenario/admin/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/neutron_tempest_plugin/scenario/admin/__init__.py
diff --git a/neutron_tempest_plugin/scenario/admin/test_floatingip.py b/neutron_tempest_plugin/scenario/admin/test_floatingip.py
new file mode 100644
index 0000000..e58be83
--- /dev/null
+++ b/neutron_tempest_plugin/scenario/admin/test_floatingip.py
@@ -0,0 +1,109 @@
+# Copyright 2017 Red Hat, Inc.
+# All Rights Reserved.
+#
+#    Licensed 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.
+from tempest.common import utils
+from tempest.common import waiters
+from tempest.lib.common.utils import data_utils
+from tempest.lib import decorators
+
+from neutron_tempest_plugin.common import ssh
+from neutron_tempest_plugin import config
+from neutron_tempest_plugin.scenario import base
+from neutron_tempest_plugin.scenario import constants as const
+
+CONF = config.CONF
+
+
+class FloatingIpTestCasesAdmin(base.BaseTempestTestCase):
+    credentials = ['primary', 'admin']
+
+    @classmethod
+    @utils.requires_ext(extension="router", service="network")
+    def resource_setup(cls):
+        super(FloatingIpTestCasesAdmin, cls).resource_setup()
+        cls.network = cls.create_network()
+        cls.create_subnet(cls.network)
+        router = cls.create_router_by_client()
+        cls.create_router_interface(router['id'], cls.subnets[0]['id'])
+        # Create keypair with admin privileges
+        cls.keypair = cls.create_keypair(client=cls.os_admin.keypairs_client)
+        # Create security group with admin privileges
+        cls.secgroup = cls.os_admin.network_client.create_security_group(
+            name=data_utils.rand_name('secgroup'))['security_group']
+        # Execute funcs to achieve ssh and ICMP capabilities
+        funcs = [cls.create_loginable_secgroup_rule,
+                 cls.create_pingable_secgroup_rule]
+        for func in funcs:
+            func(secgroup_id=cls.secgroup['id'],
+                 client=cls.os_admin.network_client)
+
+    @classmethod
+    def resource_cleanup(cls):
+        # Cleanup for security group
+        cls.os_admin.network_client.delete_security_group(
+            security_group_id=cls.secgroup['id'])
+        super(FloatingIpTestCasesAdmin, cls).resource_cleanup()
+
+    def _list_hypervisors(self):
+        # List of hypervisors
+        return self.os_admin.hv_client.list_hypervisors()['hypervisors']
+
+    def _list_availability_zones(self):
+        # List of availability zones
+        func = self.os_admin.az_client.list_availability_zones
+        return func()['availabilityZoneInfo']
+
+    def _create_vms(self, hyper, avail_zone, num_servers=2):
+        servers, fips, server_ssh_clients = ([], [], [])
+        # Create the availability zone with default zone and
+        # a specific mentioned hypervisor.
+        az = avail_zone + ':' + hyper
+        for i in range(num_servers):
+            servers.append(self.create_server(
+                flavor_ref=CONF.compute.flavor_ref,
+                image_ref=CONF.compute.image_ref,
+                key_name=self.keypair['name'],
+                networks=[{'uuid': self.network['id']}],
+                security_groups=[{'name': self.secgroup['name']}],
+                availability_zone=az))
+        for i, server in enumerate(servers):
+            waiters.wait_for_server_status(
+                self.os_admin.servers_client, server['server']['id'],
+                const.SERVER_STATUS_ACTIVE)
+            port = self.client.list_ports(
+                network_id=self.network['id'],
+                device_id=server['server']['id']
+            )['ports'][0]
+            fips.append(self.create_and_associate_floatingip(
+                port['id'], client=self.os_admin.network_client))
+            server_ssh_clients.append(ssh.Client(
+                fips[i]['floating_ip_address'], CONF.validation.image_ssh_user,
+                pkey=self.keypair['private_key']))
+            self.addCleanup(self.os_admin.network_client.delete_floatingip,
+                            fips[i]['id'])
+        return server_ssh_clients, fips
+
+    @decorators.idempotent_id('6bba729b-3fb6-494b-9e1e-82bbd89a1045')
+    def test_two_vms_fips(self):
+        """This test verifies the ability of two instances
+        that were created in the same compute node and same availability zone
+        to reach each other.
+        """
+        # Get hypervisor list to pass it for vm creation
+        hyper = self._list_hypervisors()[0]['hypervisor_hostname']
+        # Get availability zone list to pass it for vm creation
+        avail_zone = self._list_availability_zones()[0]['zoneName']
+        server_ssh_clients, fips = self._create_vms(hyper, avail_zone)
+        self.check_remote_connectivity(
+            server_ssh_clients[0], fips[1]['floating_ip_address'])
diff --git a/neutron_tempest_plugin/scenario/base.py b/neutron_tempest_plugin/scenario/base.py
index 5cc085f..9fe6a94 100644
--- a/neutron_tempest_plugin/scenario/base.py
+++ b/neutron_tempest_plugin/scenario/base.py
@@ -42,15 +42,17 @@
     @classmethod
     def resource_cleanup(cls):
         for keypair in cls.keypairs:
-            cls.os_primary.keypairs_client.delete_keypair(
-                keypair_name=keypair['name'])
+            client = keypair['client']
+            client.delete_keypair(
+                keypair_name=keypair['keypair']['name'])
 
         super(BaseTempestTestCase, cls).resource_cleanup()
 
     def create_server(self, flavor_ref, image_ref, key_name, networks,
-                      name=None, security_groups=None):
+                      **kwargs):
         """Create a server using tempest lib
         All the parameters are the ones used in Compute API
+        * - Kwargs that require admin privileges
 
         Args:
            flavor_ref(str): The flavor of the server to be provisioned.
@@ -61,30 +63,47 @@
                an interface to be attached to the server. For network
                it should be {'uuid': network_uuid} and for port it should
                be {'port': port_uuid}
+        kwargs:
            name(str): Name of the server to be provisioned.
            security_groups(list): List of dictionaries where
                 the keys is 'name' and the value is the name of
                 the security group. If it's not passed the default
                 security group will be used.
+           availability_zone(str)*: The availability zone that
+                the instance will be in.
+                You can request a specific az without actually creating one,
+                Just pass 'X:Y' where X is the default availability
+                zone, and Y is the compute host name.
         """
 
-        name = name or data_utils.rand_name('server-test')
-        if not security_groups:
-            security_groups = [{'name': 'default'}]
+        name = kwargs.get('name', data_utils.rand_name('server-test'))
+        security_groups = kwargs.get(
+            'security_groups', [{'name': 'default'}])
+        availability_zone = kwargs.get('availability_zone')
 
-        server = self.os_primary.servers_client.create_server(
-            name=name,
-            flavorRef=flavor_ref,
-            imageRef=image_ref,
-            key_name=key_name,
-            networks=networks,
-            security_groups=security_groups)
+        server_args = {
+            'name': name,
+            'flavorRef': flavor_ref,
+            'imageRef': image_ref,
+            'key_name': key_name,
+            'networks': networks,
+            'security_groups': security_groups
+        }
+
+        if availability_zone:
+            server_args['availability_zone'] = availability_zone
+            client = self.os_admin.servers_client
+        else:
+            client = self.os_primary.servers_client
+
+        server = client.create_server(**server_args)
 
         self.addCleanup(test_utils.call_and_ignore_notfound_exc,
-            waiters.wait_for_server_termination,
-            self.os_primary.servers_client, server['server']['id'])
+                        waiters.wait_for_server_termination,
+                        client,
+                        server['server']['id'])
         self.addCleanup(test_utils.call_and_ignore_notfound_exc,
-                        self.os_primary.servers_client.delete_server,
+                        client.delete_server,
                         server['server']['id'])
         return server
 
@@ -93,12 +112,16 @@
         client = client or cls.os_primary.keypairs_client
         name = data_utils.rand_name('keypair-test')
         body = client.create_keypair(name=name)
-        cls.keypairs.append(body['keypair'])
+        body.update(client=client)
+        if client is cls.os_primary.keypairs_client:
+            cls.keypairs.append(body)
+
         return body['keypair']
 
     @classmethod
-    def create_secgroup_rules(cls, rule_list, secgroup_id=None):
-        client = cls.os_primary.network_client
+    def create_secgroup_rules(cls, rule_list, client=None,
+                              secgroup_id=None):
+        client = client or cls.os_primary.network_client
         if not secgroup_id:
             sgs = client.list_security_groups()['security_groups']
             for sg in sgs:
@@ -114,7 +137,8 @@
                 **rule)
 
     @classmethod
-    def create_loginable_secgroup_rule(cls, secgroup_id=None):
+    def create_loginable_secgroup_rule(cls, secgroup_id=None,
+                                       client=None):
         """This rule is intended to permit inbound ssh
 
         Allowing ssh traffic traffic from all sources, so no group_id is
@@ -128,10 +152,13 @@
                       'port_range_min': 22,
                       'port_range_max': 22,
                       'remote_ip_prefix': '0.0.0.0/0'}]
-        cls.create_secgroup_rules(rule_list, secgroup_id=secgroup_id)
+        client = client or cls.os_primary.network_client
+        cls.create_secgroup_rules(rule_list, client,
+                                  secgroup_id=secgroup_id)
 
     @classmethod
-    def create_pingable_secgroup_rule(cls, secgroup_id=None):
+    def create_pingable_secgroup_rule(cls, secgroup_id=None,
+                                      client=None):
         """This rule is intended to permit inbound ping
         """
 
@@ -140,7 +167,9 @@
                       'port_range_min': 8,  # type
                       'port_range_max': 0,  # code
                       'remote_ip_prefix': '0.0.0.0/0'}]
-        cls.create_secgroup_rules(rule_list, secgroup_id=secgroup_id)
+        client = client or cls.os_primary.network_client
+        cls.create_secgroup_rules(rule_list, client,
+                                  secgroup_id=secgroup_id)
 
     @classmethod
     def create_router_by_client(cls, is_admin=False, **kwargs):
@@ -155,11 +184,13 @@
         cls.routers.append(router)
         return router
 
-    def create_and_associate_floatingip(self, port_id):
-        fip = self.os_primary.network_client.create_floatingip(
+    def create_and_associate_floatingip(self, port_id, client=None):
+        client = client or self.os_primary.network_client
+        fip = client.create_floatingip(
             CONF.network.public_network_id,
             port_id=port_id)['floatingip']
-        self.floating_ips.append(fip)
+        if client is self.os_primary.network_client:
+            self.floating_ips.append(fip)
         return fip
 
     def setup_network_and_server(self, router=None, **kwargs):
