Skip to content

Commit 4bb48c0

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Add subnet pool functional tests"
2 parents c6e46aa + 87d90f3 commit 4bb48c0

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
2+
# not use this file except in compliance with the License. You may obtain
3+
# a copy of the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
# License for the specific language governing permissions and limitations
11+
# under the License.
12+
13+
import uuid
14+
15+
from functional.common import test
16+
17+
18+
class SubnetPoolTests(test.TestCase):
19+
"""Functional tests for subnet pool. """
20+
NAME = uuid.uuid4().hex
21+
CREATE_POOL_PREFIX = '10.100.0.0/24'
22+
SET_POOL_PREFIX = '10.100.0.0/16'
23+
HEADERS = ['Name']
24+
FIELDS = ['name']
25+
26+
@classmethod
27+
def setUpClass(cls):
28+
opts = cls.get_show_opts(cls.FIELDS)
29+
raw_output = cls.openstack('subnet pool create --pool-prefix ' +
30+
cls.CREATE_POOL_PREFIX + ' ' +
31+
cls.NAME + opts)
32+
cls.assertOutput(cls.NAME + '\n', raw_output)
33+
34+
@classmethod
35+
def tearDownClass(cls):
36+
raw_output = cls.openstack('subnet pool delete ' + cls.NAME)
37+
cls.assertOutput('', raw_output)
38+
39+
def test_subnet_list(self):
40+
opts = self.get_list_opts(self.HEADERS)
41+
raw_output = self.openstack('subnet pool list' + opts)
42+
self.assertIn(self.NAME, raw_output)
43+
44+
def test_subnet_set(self):
45+
self.openstack('subnet pool set --pool-prefix ' +
46+
self.SET_POOL_PREFIX + ' ' + self.NAME)
47+
opts = self.get_show_opts(['prefixes', 'name'])
48+
raw_output = self.openstack('subnet pool show ' + self.NAME + opts)
49+
self.assertEqual(self.NAME + '\n' + self.SET_POOL_PREFIX + '\n',
50+
raw_output)
51+
52+
def test_subnet_show(self):
53+
opts = self.get_show_opts(self.FIELDS)
54+
raw_output = self.openstack('subnet pool show ' + self.NAME + opts)
55+
self.assertEqual(self.NAME + '\n', raw_output)

0 commit comments

Comments
 (0)