diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index 231c4bf..afd2d27 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -90,7 +90,7 @@
             cls.client.delete_vpnservice(vpnservice['id'])
         # Clean up floating IPs
         for floating_ip in cls.floating_ips:
-            cls.client.delete_floating_ip(floating_ip['id'])
+            cls.client.delete_floatingip(floating_ip['id'])
         # Clean up routers
         for router in cls.routers:
             resp, body = cls.client.list_router_interfaces(router['id'])
@@ -193,11 +193,10 @@
         return router
 
     @classmethod
-    def create_floating_ip(cls, external_network_id, **kwargs):
+    def create_floatingip(cls, external_network_id):
         """Wrapper utility that returns a test floating IP."""
-        resp, body = cls.client.create_floating_ip(
-            external_network_id,
-            **kwargs)
+        resp, body = cls.client.create_floatingip(
+            floating_network_id=external_network_id)
         fip = body['floatingip']
         cls.floating_ips.append(fip)
         return fip
diff --git a/tempest/api/network/test_floating_ips.py b/tempest/api/network/test_floating_ips.py
index b31c090..06871ad 100644
--- a/tempest/api/network/test_floating_ips.py
+++ b/tempest/api/network/test_floating_ips.py
@@ -65,8 +65,12 @@
     @test.attr(type='smoke')
     def test_create_list_show_update_delete_floating_ip(self):
         # Creates a floating IP
-        created_floating_ip = self.create_floating_ip(
-            self.ext_net_id, port_id=self.ports[0]['id'])
+        resp, body = self.client.create_floatingip(
+            floating_network_id=self.ext_net_id, port_id=self.ports[0]['id'])
+        self.assertEqual('201', resp['status'])
+        created_floating_ip = body['floatingip']
+        self.addCleanup(self.client.delete_floatingip,
+                        created_floating_ip['id'])
         self.assertIsNotNone(created_floating_ip['id'])
         self.assertIsNotNone(created_floating_ip['tenant_id'])
         self.assertIsNotNone(created_floating_ip['floating_ip_address'])
@@ -74,7 +78,7 @@
         self.assertEqual(created_floating_ip['floating_network_id'],
                          self.ext_net_id)
         # Verifies the details of a floating_ip
-        resp, floating_ip = self.client.show_floating_ip(
+        resp, floating_ip = self.client.show_floatingip(
             created_floating_ip['id'])
         self.assertEqual('200', resp['status'])
         shown_floating_ip = floating_ip['floatingip']
@@ -95,7 +99,7 @@
             floatingip_id_list.append(f['id'])
         self.assertIn(created_floating_ip['id'], floatingip_id_list)
         # Associate floating IP to the other port
-        resp, floating_ip = self.client.update_floating_ip(
+        resp, floating_ip = self.client.update_floatingip(
             created_floating_ip['id'], port_id=self.ports[1]['id'])
         self.assertEqual('200', resp['status'])
         updated_floating_ip = floating_ip['floatingip']
@@ -105,7 +109,7 @@
         self.assertEqual(updated_floating_ip['router_id'], self.router['id'])
 
         # Disassociate floating IP from the port
-        resp, floating_ip = self.client.update_floating_ip(
+        resp, floating_ip = self.client.update_floatingip(
             created_floating_ip['id'], port_id=None)
         self.assertEqual('200', resp['status'])
         updated_floating_ip = floating_ip['floatingip']
@@ -116,17 +120,22 @@
     @test.attr(type='smoke')
     def test_floating_ip_delete_port(self):
         # Create a floating IP
-        created_floating_ip = self.create_floating_ip(self.ext_net_id)
+        resp, body = self.client.create_floatingip(
+            floating_network_id=self.ext_net_id)
+        self.assertEqual('201', resp['status'])
+        created_floating_ip = body['floatingip']
+        self.addCleanup(self.client.delete_floatingip,
+                        created_floating_ip['id'])
         # Create a port
         resp, port = self.client.create_port(network_id=self.network['id'])
         created_port = port['port']
-        resp, floating_ip = self.client.update_floating_ip(
+        resp, floating_ip = self.client.update_floatingip(
             created_floating_ip['id'], port_id=created_port['id'])
         self.assertEqual('200', resp['status'])
         # Delete port
         self.client.delete_port(created_port['id'])
         # Verifies the details of the floating_ip
-        resp, floating_ip = self.client.show_floating_ip(
+        resp, floating_ip = self.client.show_floatingip(
             created_floating_ip['id'])
         self.assertEqual('200', resp['status'])
         shown_floating_ip = floating_ip['floatingip']
@@ -139,8 +148,12 @@
     @test.attr(type='smoke')
     def test_floating_ip_update_different_router(self):
         # Associate a floating IP to a port on a router
-        created_floating_ip = self.create_floating_ip(
-            self.ext_net_id, port_id=self.ports[1]['id'])
+        resp, body = self.client.create_floatingip(
+            floating_network_id=self.ext_net_id, port_id=self.ports[1]['id'])
+        self.assertEqual('201', resp['status'])
+        created_floating_ip = body['floatingip']
+        self.addCleanup(self.client.delete_floatingip,
+                        created_floating_ip['id'])
         self.assertEqual(created_floating_ip['router_id'], self.router['id'])
         network2 = self.create_network()
         subnet2 = self.create_subnet(network2)
@@ -149,7 +162,7 @@
         self.create_router_interface(router2['id'], subnet2['id'])
         port_other_router = self.create_port(network2)
         # Associate floating IP to the other port on another router
-        resp, floating_ip = self.client.update_floating_ip(
+        resp, floating_ip = self.client.update_floatingip(
             created_floating_ip['id'], port_id=port_other_router['id'])
         self.assertEqual('200', resp['status'])
         updated_floating_ip = floating_ip['floatingip']
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index a804e8e..27f4655 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -144,25 +144,6 @@
         body = json.loads(body)
         return resp, body
 
-    def create_floating_ip(self, ext_network_id, **kwargs):
-        post_body = {
-            'floatingip': kwargs}
-        post_body['floatingip']['floating_network_id'] = ext_network_id
-        body = json.dumps(post_body)
-        uri = '%s/floatingips' % (self.uri_prefix)
-        resp, body = self.post(uri, body=body)
-        body = json.loads(body)
-        return resp, body
-
-    def update_floating_ip(self, floating_ip_id, **kwargs):
-        post_body = {
-            'floatingip': kwargs}
-        body = json.dumps(post_body)
-        uri = '%s/floatingips/%s' % (self.uri_prefix, floating_ip_id)
-        resp, body = self.put(uri, body)
-        body = json.loads(body)
-        return resp, body
-
     def associate_health_monitor_with_pool(self, health_monitor_id,
                                            pool_id):
         post_body = {
diff --git a/tempest/services/network/network_client_base.py b/tempest/services/network/network_client_base.py
index 41a7aa4..e21abe1 100644
--- a/tempest/services/network/network_client_base.py
+++ b/tempest/services/network/network_client_base.py
@@ -44,7 +44,6 @@
     'security_groups': 'security_groups',
     'security_group_rules': 'security_group_rules',
     'ikepolicy': 'ikepolicies',
-    'floating_ip': 'floatingips',
     'quotas': 'quotas'
 }
 
diff --git a/tempest/services/network/xml/network_client.py b/tempest/services/network/xml/network_client.py
index 2a5083c..68bc424 100644
--- a/tempest/services/network/xml/network_client.py
+++ b/tempest/services/network/xml/network_client.py
@@ -166,33 +166,6 @@
         body = _root_tag_fetcher_and_xml_to_json_parse(body)
         return resp, body
 
-    def create_floating_ip(self, ext_network_id, **kwargs):
-        uri = '%s/floatingips' % (self.uri_prefix)
-        floatingip = common.Element('floatingip')
-        floatingip.append(common.Element("floating_network_id",
-                                         ext_network_id))
-        for element, content in kwargs.iteritems():
-            floatingip.append(common.Element(element, content))
-        resp, body = self.post(uri, str(common.Document(floatingip)))
-        body = _root_tag_fetcher_and_xml_to_json_parse(body)
-        return resp, body
-
-    def update_floating_ip(self, floating_ip_id, **kwargs):
-        uri = '%s/floatingips/%s' % (self.uri_prefix, floating_ip_id)
-        floatingip = common.Element('floatingip')
-        floatingip.add_attr('xmlns:xsi',
-                            'http://www.w3.org/2001/XMLSchema-instance')
-        for element, content in kwargs.iteritems():
-            if content is None:
-                xml_elem = common.Element(element)
-                xml_elem.add_attr("xsi:nil", "true")
-                floatingip.append(xml_elem)
-            else:
-                floatingip.append(common.Element(element, content))
-        resp, body = self.put(uri, str(common.Document(floatingip)))
-        body = _root_tag_fetcher_and_xml_to_json_parse(body)
-        return resp, body
-
     def list_router_interfaces(self, uuid):
         uri = '%s/ports?device_id=%s' % (self.uri_prefix, uuid)
         resp, body = self.get(uri)
