~ubuntu-branches/ubuntu/vivid/neutron/vivid-updates

« back to all changes in this revision

Viewing changes to neutron/tests/tempest/api/network/test_floating_ips_negative.py

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2015-03-30 11:17:19 UTC
  • mfrom: (1.1.21)
  • Revision ID: package-import@ubuntu.com-20150330111719-h0gx7233p4jkkgfh
Tags: 1:2015.1~b3-0ubuntu1
* New upstream milestone release:
  - d/control: Align version requirements with upstream.
  - d/control: Add new dependency on oslo-log.
  - d/p/*: Rebase.
  - d/control,d/neutron-plugin-hyperv*: Dropped, decomposed into
    separate project upstream.
  - d/control,d/neutron-plugin-openflow*: Dropped, decomposed into
    separate project upstream.
  - d/neutron-common.install: Add neutron-rootwrap-daemon and 
    neutron-keepalived-state-change binaries.
  - d/rules: Ignore neutron-hyperv-agent when installing; only for Windows.
  - d/neutron-plugin-cisco.install: Drop neutron-cisco-cfg-agent as
    decomposed into separate project upstream.
  - d/neutron-plugin-vmware.install: Drop neutron-check-nsx-config and
    neutron-nsx-manage as decomposed into separate project upstream.
  - d/control: Add dependency on python-neutron-fwaas to neutron-l3-agent.
* d/pydist-overrides: Add overrides for oslo packages.
* d/control: Fixup type in package description (LP: #1263539).
* d/p/fixup-driver-test-execution.patch: Cherry pick fix from upstream VCS
  to support unit test exection in out-of-tree vendor drivers.
* d/neutron-common.postinst: Allow general access to /etc/neutron but limit
  access to root/neutron to /etc/neutron/neutron.conf to support execution
  of unit tests in decomposed vendor drivers.
* d/control: Add dependency on python-neutron-fwaas to neutron-l3-agent
  package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2014 Hewlett-Packard Development Company, L.P.
 
2
# Copyright 2014 OpenStack Foundation
 
3
# All Rights Reserved.
 
4
#
 
5
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
 
6
#    not use this file except in compliance with the License. You may obtain
 
7
#    a copy of the License at
 
8
#
 
9
#         http://www.apache.org/licenses/LICENSE-2.0
 
10
#
 
11
#    Unless required by applicable law or agreed to in writing, software
 
12
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 
13
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 
14
#    License for the specific language governing permissions and limitations
 
15
#    under the License.
 
16
 
 
17
from tempest_lib.common.utils import data_utils
 
18
from tempest_lib import exceptions as lib_exc
 
19
 
 
20
from neutron.tests.tempest.api.network import base
 
21
from neutron.tests.tempest import config
 
22
from neutron.tests.tempest import test
 
23
 
 
24
CONF = config.CONF
 
25
 
 
26
 
 
27
class FloatingIPNegativeTestJSON(base.BaseNetworkTest):
 
28
 
 
29
    """
 
30
    Test the following negative  operations for floating ips:
 
31
 
 
32
        Create floatingip with a port that is unreachable to external network
 
33
        Create floatingip in private network
 
34
        Associate floatingip with port that is unreachable to external network
 
35
    """
 
36
 
 
37
    @classmethod
 
38
    def resource_setup(cls):
 
39
        super(FloatingIPNegativeTestJSON, cls).resource_setup()
 
40
        if not test.is_extension_enabled('router', 'network'):
 
41
            msg = "router extension not enabled."
 
42
            raise cls.skipException(msg)
 
43
        cls.ext_net_id = CONF.network.public_network_id
 
44
        # Create a network with a subnet connected to a router.
 
45
        cls.network = cls.create_network()
 
46
        cls.subnet = cls.create_subnet(cls.network)
 
47
        cls.router = cls.create_router(data_utils.rand_name('router'))
 
48
        cls.create_router_interface(cls.router['id'], cls.subnet['id'])
 
49
        cls.port = cls.create_port(cls.network)
 
50
 
 
51
    @test.attr(type=['negative', 'smoke'])
 
52
    @test.idempotent_id('22996ea8-4a81-4b27-b6e1-fa5df92fa5e8')
 
53
    def test_create_floatingip_with_port_ext_net_unreachable(self):
 
54
        self.assertRaises(lib_exc.NotFound, self.client.create_floatingip,
 
55
                          floating_network_id=self.ext_net_id,
 
56
                          port_id=self.port['id'],
 
57
                          fixed_ip_address=self.port['fixed_ips'][0]
 
58
                                                    ['ip_address'])
 
59
 
 
60
    @test.attr(type=['negative', 'smoke'])
 
61
    @test.idempotent_id('50b9aeb4-9f0b-48ee-aa31-fa955a48ff54')
 
62
    def test_create_floatingip_in_private_network(self):
 
63
        self.assertRaises(lib_exc.BadRequest,
 
64
                          self.client.create_floatingip,
 
65
                          floating_network_id=self.network['id'],
 
66
                          port_id=self.port['id'],
 
67
                          fixed_ip_address=self.port['fixed_ips'][0]
 
68
                                                    ['ip_address'])
 
69
 
 
70
    @test.attr(type=['negative', 'smoke'])
 
71
    @test.idempotent_id('6b3b8797-6d43-4191-985c-c48b773eb429')
 
72
    def test_associate_floatingip_port_ext_net_unreachable(self):
 
73
        # Create floating ip
 
74
        body = self.client.create_floatingip(
 
75
            floating_network_id=self.ext_net_id)
 
76
        floating_ip = body['floatingip']
 
77
        self.addCleanup(self.client.delete_floatingip, floating_ip['id'])
 
78
        # Associate floating IP to the other port
 
79
        self.assertRaises(lib_exc.NotFound, self.client.update_floatingip,
 
80
                          floating_ip['id'], port_id=self.port['id'],
 
81
                          fixed_ip_address=self.port['fixed_ips'][0]
 
82
                          ['ip_address'])