blob: 361258a95af892e9d17620af9dbd20ab950fe511 [file] [log] [blame]
Andrea Frittolie258cd72014-07-17 04:47:26 +01001# Copyright 2012 OpenStack Foundation
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16import json
17
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +000018from tempest.common import service_client
Andrea Frittolie258cd72014-07-17 04:47:26 +010019
20
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +000021class NetworksClientJSON(service_client.ServiceClient):
Andrea Frittolie258cd72014-07-17 04:47:26 +010022
23 def list_networks(self):
24 resp, body = self.get("os-networks")
25 body = json.loads(body)
26 self.expected_success(200, resp.status)
27 return resp, body['networks']
28
29 def get_network(self, network_id):
30 resp, body = self.get("os-networks/%s" % str(network_id))
31 body = json.loads(body)
32 self.expected_success(200, resp.status)
33 return resp, body['network']