Ken'ichi Ohmichi | 8f088c1 | 2014-03-28 15:16:11 +0900 | [diff] [blame] | 1 | # 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 | |
Ken'ichi Ohmichi | a7a14f1 | 2014-04-08 22:31:17 +0900 | [diff] [blame] | 15 | import json |
Ken'ichi Ohmichi | 8f088c1 | 2014-03-28 15:16:11 +0900 | [diff] [blame] | 16 | import urllib |
| 17 | |
Marc Koderer | 6fbd74f | 2014-08-04 09:38:19 +0200 | [diff] [blame] | 18 | from tempest.api_schema.response.compute import migrations as schema |
Ken'ichi Ohmichi | 8f088c1 | 2014-03-28 15:16:11 +0900 | [diff] [blame] | 19 | from tempest.common import rest_client |
| 20 | from tempest import config |
| 21 | |
| 22 | CONF = config.CONF |
| 23 | |
| 24 | |
| 25 | class MigrationsV3ClientJSON(rest_client.RestClient): |
| 26 | |
| 27 | def __init__(self, auth_provider): |
| 28 | super(MigrationsV3ClientJSON, self).__init__(auth_provider) |
| 29 | self.service = CONF.compute.catalog_v3_type |
| 30 | |
| 31 | def list_migrations(self, params=None): |
| 32 | """Lists all migrations.""" |
| 33 | |
| 34 | url = 'os-migrations' |
| 35 | if params: |
| 36 | url += '?%s' % urllib.urlencode(params) |
| 37 | |
| 38 | resp, body = self.get(url) |
Ken'ichi Ohmichi | a7a14f1 | 2014-04-08 22:31:17 +0900 | [diff] [blame] | 39 | body = json.loads(body) |
| 40 | self.validate_response(schema.list_migrations, resp, body) |
| 41 | return resp, body['migrations'] |