blob: 1b095130730aec507f809e2f829d653edcc0d094 [file] [log] [blame]
Jay Pipesf4dad392012-06-05 16:03:58 -04001# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
3# Copyright 2012 OpenStack, LLC
4# All Rights Reserved.
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17
Jay Pipesf4dad392012-06-05 16:03:58 -040018
Matthew Treinish481466b2012-12-20 17:16:01 -050019from tempest import clients
Matthew Treinisha83a16e2012-12-07 13:44:02 -050020from tempest.common.utils.data_utils import rand_name
Attila Fazekasdc216422013-01-29 15:12:14 +010021import tempest.test
Jay Pipesf4dad392012-06-05 16:03:58 -040022
23
Attila Fazekasdc216422013-01-29 15:12:14 +010024class BaseNetworkTest(tempest.test.BaseTestCase):
Jay Pipesf4dad392012-06-05 16:03:58 -040025
Jay Pipesf4dad392012-06-05 16:03:58 -040026 @classmethod
27 def setUpClass(cls):
Matthew Treinish481466b2012-12-20 17:16:01 -050028 os = clients.Manager()
Jay Pipesf38eaac2012-06-21 13:37:35 -040029
Dan Smithd6c1f882013-02-26 15:50:11 -050030 if not os.config.network.quantum_available:
31 raise cls.skipException("Quantum support is required")
Jay Pipesf4dad392012-06-05 16:03:58 -040032
33 @classmethod
34 def tearDownClass(cls):
35 for network in cls.networks:
36 cls.client.delete_network(network['id'])
37
38 def create_network(self, network_name=None):
Sean Daguef237ccb2013-01-04 15:19:14 -050039 """Wrapper utility that returns a test network."""
Jay Pipesf4dad392012-06-05 16:03:58 -040040 network_name = network_name or rand_name('test-network')
41
42 resp, body = self.client.create_network(network_name)
43 network = body['network']
44 self.networks.append(network)
45 return network