Adds test_list_XX_fields cases to list some fields

This change adds test_list_XX_fields cases to test
if listing some fields works well. A related url
example is 'v2.0/networks.json?fields=id'.

Change-Id: Ic41d83ec394b6bd7767d0523a8b21614468e0f6a
diff --git a/tempest/api/network/test_networks.py b/tempest/api/network/test_networks.py
index 68ca66a..849d62e 100644
--- a/tempest/api/network/test_networks.py
+++ b/tempest/api/network/test_networks.py
@@ -127,6 +127,21 @@
         self.assertIsNotNone(found, msg)
 
     @attr(type='smoke')
+    def test_list_networks_fields(self):
+        # Verify listing some fields of the networks
+        resp, body = self.client.list_networks(fields='id')
+        self.assertEqual('200', resp['status'])
+        networks = body['networks']
+        found = None
+        for n in networks:
+            self.assertEqual(len(n), 1)
+            self.assertIn('id', n)
+            if (n['id'] == self.network['id']):
+                found = n['id']
+        self.assertIsNotNone(found,
+                             "Created network id not found in the list")
+
+    @attr(type='smoke')
     def test_show_subnet(self):
         # Verifies the details of a subnet
         resp, body = self.client.show_subnet(self.subnet['id'])
@@ -149,6 +164,21 @@
         self.assertIsNotNone(found, msg)
 
     @attr(type='smoke')
+    def test_list_subnets_fields(self):
+        # Verify listing some fields of the subnets
+        resp, body = self.client.list_subnets(fields='id')
+        self.assertEqual('200', resp['status'])
+        subnets = body['subnets']
+        found = None
+        for n in subnets:
+            self.assertEqual(len(n), 1)
+            self.assertIn('id', n)
+            if (n['id'] == self.subnet['id']):
+                found = n['id']
+        self.assertIsNotNone(found,
+                             "Created subnet id not found in the list")
+
+    @attr(type='smoke')
     def test_create_update_delete_port(self):
         # Verify that successful port creation, update & deletion
         resp, body = self.client.create_port(self.network['id'])
@@ -184,6 +214,21 @@
                 found = n['id']
         self.assertIsNotNone(found, "Port list doesn't contain created port")
 
+    @attr(type='smoke')
+    def test_list_ports_fields(self):
+        # Verify listing some fields of the ports
+        resp, body = self.client.list_ports(fields='id')
+        self.assertEqual('200', resp['status'])
+        ports_list = body['ports']
+        found = None
+        for n in ports_list:
+            self.assertEqual(len(n), 1)
+            self.assertIn('id', n)
+            if (n['id'] == self.port['id']):
+                found = n['id']
+        self.assertIsNotNone(found,
+                             "Created port id not found in the list")
+
 
 class NetworksTestXML(NetworksTestJSON):
     _interface = 'xml'