Add os-tenant-networks test

Nova API contains os-tenant-networks API which is one of Neutron
proxy API, but Tempest doesn't test the API now.
This patch adds a test for the API.

* The response of "list tenant-network" API
  {"networks": [
      {
          "cidr": "None",
          "id": "1b64ee34-161c-4889-b8c4-7ebb235647e3",
          "label": "private"
      },
      {
          "cidr": "None",
          "id": "b3aca3f0-2b4b-4687-9acc-66ad82397012",
          "label": "public"
      }
  ]}

* The response of "get tenant-network" API
  {"network": {
      "cidr": "None",
      "id": "1b64ee34-161c-4889-b8c4-7ebb235647e3",
      "label": "private"
  }}

Change-Id: I770b7438821e7924a315fe506838c48ef9bf1bd6
diff --git a/tempest/api/compute/test_tenant_networks.py b/tempest/api/compute/test_tenant_networks.py
new file mode 100644
index 0000000..0591acc
--- /dev/null
+++ b/tempest/api/compute/test_tenant_networks.py
@@ -0,0 +1,33 @@
+# Copyright 2015 NEC Corporation. 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.api.compute import base
+from tempest import test
+
+
+class NetworksTestJSON(base.BaseV2ComputeTest):
+
+    @classmethod
+    def resource_setup(cls):
+        super(NetworksTestJSON, cls).resource_setup()
+        cls.client = cls.os.tenant_networks_client
+
+    @test.attr(type='gate')
+    def test_list_show_tenant_networks(self):
+        tenant_networks = self.client.list_tenant_networks()
+        self.assertNotEmpty(tenant_networks, "No tenant networks found.")
+
+        for net in tenant_networks:
+            tenant_network = self.client.get_tenant_network(net['id'])
+            self.assertEqual(net['id'], tenant_network['id'])
diff --git a/tempest/api_schema/response/compute/v2/tenant_networks.py b/tempest/api_schema/response/compute/v2/tenant_networks.py
new file mode 100644
index 0000000..0b2868a
--- /dev/null
+++ b/tempest/api_schema/response/compute/v2/tenant_networks.py
@@ -0,0 +1,50 @@
+# Copyright 2015 NEC Corporation.  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.
+
+param_network = {
+    'type': 'object',
+    'properties': {
+        'id': {'type': 'string'},
+        'cidr': {'type': ['string', 'null']},
+        'label': {'type': 'string'}
+    },
+    'required': ['id', 'cidr', 'label']
+}
+
+
+list_tenant_networks = {
+    'status_code': [200],
+    'response_body': {
+        'type': 'object',
+        'properties': {
+            'networks': {
+                'type': 'array',
+                'items': param_network
+            }
+        },
+        'required': ['networks']
+    }
+}
+
+
+get_tenant_network = {
+    'status_code': [200],
+    'response_body': {
+        'type': 'object',
+        'properties': {
+            'network': param_network
+        },
+        'required': ['network']
+    }
+}
diff --git a/tempest/clients.py b/tempest/clients.py
index e362ac0..135d74a 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -57,6 +57,8 @@
     SecurityGroupsClientJSON
 from tempest.services.compute.json.servers_client import ServersClientJSON
 from tempest.services.compute.json.services_client import ServicesClientJSON
+from tempest.services.compute.json.tenant_networks_client import \
+    TenantNetworksClientJSON
 from tempest.services.compute.json.tenant_usages_client import \
     TenantUsagesClientJSON
 from tempest.services.compute.json.volumes_extensions_client import \
@@ -261,6 +263,8 @@
                                                       **params)
         self.instance_usages_audit_log_client = \
             InstanceUsagesAuditLogClientJSON(self.auth_provider, **params)
+        self.tenant_networks_client = \
+            TenantNetworksClientJSON(self.auth_provider, **params)
 
         # NOTE: The following client needs special timeout values because
         # the API is a proxy for the other component.
diff --git a/tempest/services/compute/json/tenant_networks_client.py b/tempest/services/compute/json/tenant_networks_client.py
new file mode 100644
index 0000000..c86c817
--- /dev/null
+++ b/tempest/services/compute/json/tenant_networks_client.py
@@ -0,0 +1,33 @@
+# Copyright 2015 NEC Corporation. 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.
+
+import json
+
+from tempest.api_schema.response.compute.v2 import tenant_networks as schema
+from tempest.common import service_client
+
+
+class TenantNetworksClientJSON(service_client.ServiceClient):
+
+    def list_tenant_networks(self):
+        resp, body = self.get("os-tenant-networks")
+        body = json.loads(body)
+        self.validate_response(schema.list_tenant_networks, resp, body)
+        return service_client.ResponseBodyList(resp, body['networks'])
+
+    def get_tenant_network(self, network_id):
+        resp, body = self.get("os-tenant-networks/%s" % str(network_id))
+        body = json.loads(body)
+        self.validate_response(schema.get_tenant_network, resp, body)
+        return service_client.ResponseBody(resp, body['network'])