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 |
| 17 | from tempest import test |
| 18 | |
| 19 | CONF = config.CONF |
| 20 | |
| 21 | |
Matthew Treinish | e4184ea | 2015-09-03 21:13:09 -0400 | [diff] [blame] | 22 | class ComputeNetworksTest(base.BaseV2ComputeTest): |
Matt Riedemann | 4a99401 | 2014-08-08 08:25:03 -0700 | [diff] [blame] | 23 | @classmethod |
Rohan Kanade | 60b7309 | 2015-02-04 17:58:19 +0530 | [diff] [blame] | 24 | def skip_checks(cls): |
Matthew Treinish | e4184ea | 2015-09-03 21:13:09 -0400 | [diff] [blame] | 25 | super(ComputeNetworksTest, cls).skip_checks() |
Matt Riedemann | 4a99401 | 2014-08-08 08:25:03 -0700 | [diff] [blame] | 26 | if CONF.service_available.neutron: |
| 27 | raise cls.skipException('nova-network is not available.') |
Rohan Kanade | 60b7309 | 2015-02-04 17:58:19 +0530 | [diff] [blame] | 28 | |
| 29 | @classmethod |
| 30 | def setup_clients(cls): |
Matthew Treinish | e4184ea | 2015-09-03 21:13:09 -0400 | [diff] [blame] | 31 | super(ComputeNetworksTest, cls).setup_clients() |
John Warren | 9487a18 | 2015-09-14 18:12:56 -0400 | [diff] [blame] | 32 | cls.client = cls.os.compute_networks_client |
Matt Riedemann | 4a99401 | 2014-08-08 08:25:03 -0700 | [diff] [blame] | 33 | |
Chris Hoge | 7579c1a | 2015-02-26 14:12:15 -0800 | [diff] [blame] | 34 | @test.idempotent_id('3fe07175-312e-49a5-a623-5f52eeada4c2') |
Matt Riedemann | 4a99401 | 2014-08-08 08:25:03 -0700 | [diff] [blame] | 35 | def test_list_networks(self): |
ghanshyam | f0f7cfc | 2015-08-24 16:21:18 +0900 | [diff] [blame] | 36 | networks = self.client.list_networks()['networks'] |
Matt Riedemann | 4a99401 | 2014-08-08 08:25:03 -0700 | [diff] [blame] | 37 | self.assertNotEmpty(networks, "No networks found.") |