blob: b41abc8d38bcd18bf26948fa86a75daa90de4434 [file] [log] [blame]
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +09001# Copyright 2014 NEC Corporation.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15import json
16import urllib
17
Marc Koderer6fbd74f2014-08-04 09:38:19 +020018from tempest.api_schema.response.compute import migrations as schema
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +000019from tempest.common import service_client
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +090020
21
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +000022class MigrationsClientJSON(service_client.ServiceClient):
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +090023
24 def list_migrations(self, params=None):
25 """Lists all migrations."""
26
27 url = 'os-migrations'
28 if params:
29 url += '?%s' % urllib.urlencode(params)
30
31 resp, body = self.get(url)
32 body = json.loads(body)
Ken'ichi Ohmichia7a14f12014-04-08 22:31:17 +090033 self.validate_response(schema.list_migrations, resp, body)
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +090034 return resp, body['migrations']