Matt Riedemann | 4a99401 | 2014-08-08 08:25:03 -0700 | [diff] [blame] | 1 | # Copyright 2014 IBM Corp. |
| 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 | |
| 15 | from tempest.api.compute import base |
| 16 | from tempest import config |
Ken'ichi Ohmichi | 6c92edf | 2017-01-27 17:32:10 -0800 | [diff] [blame] | 17 | from tempest.lib import decorators |
Matt Riedemann | 4a99401 | 2014-08-08 08:25:03 -0700 | [diff] [blame] | 18 | |
| 19 | CONF = config.CONF |
| 20 | |
| 21 | |
Matthew Treinish | e4184ea | 2015-09-03 21:13:09 -0400 | [diff] [blame] | 22 | class ComputeNetworksTest(base.BaseV2ComputeTest): |
zhufl | 36ef089 | 2020-08-12 13:47:21 +0800 | [diff] [blame] | 23 | """Test compute networks API with compute microversion less than 2.36""" |
zhufl | daba94f | 2018-03-29 14:36:15 +0800 | [diff] [blame] | 24 | max_microversion = '2.35' |
| 25 | |
Matt Riedemann | 4a99401 | 2014-08-08 08:25:03 -0700 | [diff] [blame] | 26 | @classmethod |
Rohan Kanade | 60b7309 | 2015-02-04 17:58:19 +0530 | [diff] [blame] | 27 | def skip_checks(cls): |
Matthew Treinish | e4184ea | 2015-09-03 21:13:09 -0400 | [diff] [blame] | 28 | super(ComputeNetworksTest, cls).skip_checks() |
Matt Riedemann | 4a99401 | 2014-08-08 08:25:03 -0700 | [diff] [blame] | 29 | if CONF.service_available.neutron: |
| 30 | raise cls.skipException('nova-network is not available.') |
Rohan Kanade | 60b7309 | 2015-02-04 17:58:19 +0530 | [diff] [blame] | 31 | |
| 32 | @classmethod |
| 33 | def setup_clients(cls): |
Matthew Treinish | e4184ea | 2015-09-03 21:13:09 -0400 | [diff] [blame] | 34 | super(ComputeNetworksTest, cls).setup_clients() |
Jordan Pittier | 8160d31 | 2017-04-18 11:52:23 +0200 | [diff] [blame] | 35 | cls.client = cls.os_primary.compute_networks_client |
Matt Riedemann | 4a99401 | 2014-08-08 08:25:03 -0700 | [diff] [blame] | 36 | |
Ken'ichi Ohmichi | 6c92edf | 2017-01-27 17:32:10 -0800 | [diff] [blame] | 37 | @decorators.idempotent_id('3fe07175-312e-49a5-a623-5f52eeada4c2') |
Matt Riedemann | 4a99401 | 2014-08-08 08:25:03 -0700 | [diff] [blame] | 38 | def test_list_networks(self): |
zhufl | 36ef089 | 2020-08-12 13:47:21 +0800 | [diff] [blame] | 39 | """Test listing networks using compute networks API""" |
ghanshyam | f0f7cfc | 2015-08-24 16:21:18 +0900 | [diff] [blame] | 40 | networks = self.client.list_networks()['networks'] |
Matt Riedemann | 4a99401 | 2014-08-08 08:25:03 -0700 | [diff] [blame] | 41 | self.assertNotEmpty(networks, "No networks found.") |