blob: 423313cba1d0ae9324adcda3bd5d685671243657 [file] [log] [blame]
Roman Prykhodchenko62b1ed12013-10-16 21:51:47 +03001# vim: tabstop=4 shiftwidth=4 softtabstop=4
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
15from tempest.api.baremetal import base
16from tempest.common.utils import data_utils
17from tempest import exceptions as exc
18from tempest import test
19
20
21class TestPortsNegative(base.BaseBaremetalTest):
22 """Negative tests for ports."""
23
24 def setUp(self):
25 super(TestPortsNegative, self).setUp()
26
27 chassis = self.create_chassis()['chassis']
28 self.node = self.create_node(chassis['uuid'])['node']
29
30 @test.attr(type='negative')
31 def test_create_port_invalid_mac(self):
32 node_id = self.node['uuid']
33 address = 'not an uuid'
34
35 self.assertRaises(exc.BadRequest,
36 self.create_port, node_id=node_id, address=address)
37
38 @test.attr(type='negative')
39 def test_create_port_wrong_node_id(self):
40 node_id = str(data_utils.rand_uuid())
41
42 self.assertRaises(exc.BadRequest, self.create_port, node_id=node_id)