~ubuntu-branches/ubuntu/vivid/neutron/vivid-proposed

« 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): Chuck Short
  • Date: 2015-04-15 13:59:07 UTC
  • mfrom: (1.1.22)
  • Revision ID: package-import@ubuntu.com-20150415135907-z10fr18evag1ozq3
Tags: 1:2015.1~rc1-0ubuntu1
* New upstream milestone release:
  - debian/control: Update dependencies. 
  - debian/patches/disable-udev-tests.patch: Dropped no longer needed.
  - debian/patches/fixup-driver-test-execution.patch: Dropped no longer needed.
  - debian/patches/skip-iptest.patch: Skip failing test
  - debian/neutron-plugin-openvswitch-agent.install: Added neutron-ovsvapp-agent binary.
  - debian/neutron-plugin-cisco.install: Added neutron-cisco-apic-service-agent and 
    neutron-cisco-apic-host-agent

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'])