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

« back to all changes in this revision

Viewing changes to neutron/tests/tempest/api/network/admin/test_load_balancer_admin_actions.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 Mirantis.inc
 
2
# All Rights Reserved.
 
3
#
 
4
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
 
5
#    not use this file except in compliance with the License. You may obtain
 
6
#    a copy of the License at
 
7
#
 
8
#         http://www.apache.org/licenses/LICENSE-2.0
 
9
#
 
10
#    Unless required by applicable law or agreed to in writing, software
 
11
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 
12
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 
13
#    License for the specific language governing permissions and limitations
 
14
#    under the License.
 
15
 
 
16
from tempest_lib.common.utils import data_utils
 
17
 
 
18
from neutron.tests.tempest.api.network import base
 
19
from neutron.tests.tempest import test
 
20
 
 
21
 
 
22
class LoadBalancerAdminTestJSON(base.BaseAdminNetworkTest):
 
23
 
 
24
    """
 
25
    Test admin actions for load balancer.
 
26
 
 
27
    Create VIP for another tenant
 
28
    Create health monitor for another tenant
 
29
    """
 
30
 
 
31
    @classmethod
 
32
    def resource_setup(cls):
 
33
        super(LoadBalancerAdminTestJSON, cls).resource_setup()
 
34
        if not test.is_extension_enabled('lbaas', 'network'):
 
35
            msg = "lbaas extension not enabled."
 
36
            raise cls.skipException(msg)
 
37
        cls.force_tenant_isolation = True
 
38
        manager = cls.get_client_manager()
 
39
        cls.client = manager.network_client
 
40
        cls.tenant_id = cls.isolated_creds.get_primary_creds().tenant_id
 
41
        cls.network = cls.create_network()
 
42
        cls.subnet = cls.create_subnet(cls.network)
 
43
        cls.pool = cls.create_pool(data_utils.rand_name('pool-'),
 
44
                                   "ROUND_ROBIN", "HTTP", cls.subnet)
 
45
 
 
46
    @test.attr(type='smoke')
 
47
    @test.idempotent_id('6b0a20d8-4fcd-455e-b54f-ec4db5199518')
 
48
    def test_create_vip_as_admin_for_another_tenant(self):
 
49
        name = data_utils.rand_name('vip-')
 
50
        body = self.admin_client.create_pool(
 
51
            name=data_utils.rand_name('pool-'),
 
52
            lb_method="ROUND_ROBIN",
 
53
            protocol="HTTP",
 
54
            subnet_id=self.subnet['id'],
 
55
            tenant_id=self.tenant_id)
 
56
        pool = body['pool']
 
57
        self.addCleanup(self.admin_client.delete_pool, pool['id'])
 
58
        body = self.admin_client.create_vip(name=name,
 
59
                                            protocol="HTTP",
 
60
                                            protocol_port=80,
 
61
                                            subnet_id=self.subnet['id'],
 
62
                                            pool_id=pool['id'],
 
63
                                            tenant_id=self.tenant_id)
 
64
        vip = body['vip']
 
65
        self.addCleanup(self.admin_client.delete_vip, vip['id'])
 
66
        self.assertIsNotNone(vip['id'])
 
67
        self.assertEqual(self.tenant_id, vip['tenant_id'])
 
68
        body = self.client.show_vip(vip['id'])
 
69
        show_vip = body['vip']
 
70
        self.assertEqual(vip['id'], show_vip['id'])
 
71
        self.assertEqual(vip['name'], show_vip['name'])
 
72
 
 
73
    @test.attr(type='smoke')
 
74
    @test.idempotent_id('74552cfc-ab78-4fb6-825b-f67bca379921')
 
75
    def test_create_health_monitor_as_admin_for_another_tenant(self):
 
76
        body = (
 
77
            self.admin_client.create_health_monitor(delay=4,
 
78
                                                    max_retries=3,
 
79
                                                    type="TCP",
 
80
                                                    timeout=1,
 
81
                                                    tenant_id=self.tenant_id))
 
82
        health_monitor = body['health_monitor']
 
83
        self.addCleanup(self.admin_client.delete_health_monitor,
 
84
                        health_monitor['id'])
 
85
        self.assertIsNotNone(health_monitor['id'])
 
86
        self.assertEqual(self.tenant_id, health_monitor['tenant_id'])
 
87
        body = self.client.show_health_monitor(health_monitor['id'])
 
88
        show_health_monitor = body['health_monitor']
 
89
        self.assertEqual(health_monitor['id'], show_health_monitor['id'])
 
90
 
 
91
    @test.attr(type='smoke')
 
92
    @test.idempotent_id('266a192d-3c22-46c4-a8fb-802450301e82')
 
93
    def test_create_pool_from_admin_user_other_tenant(self):
 
94
        body = self.admin_client.create_pool(
 
95
            name=data_utils.rand_name('pool-'),
 
96
            lb_method="ROUND_ROBIN",
 
97
            protocol="HTTP",
 
98
            subnet_id=self.subnet['id'],
 
99
            tenant_id=self.tenant_id)
 
100
        pool = body['pool']
 
101
        self.addCleanup(self.admin_client.delete_pool, pool['id'])
 
102
        self.assertIsNotNone(pool['id'])
 
103
        self.assertEqual(self.tenant_id, pool['tenant_id'])
 
104
 
 
105
    @test.attr(type='smoke')
 
106
    @test.idempotent_id('158bb272-b9ed-4cfc-803c-661dac46f783')
 
107
    def test_create_member_from_admin_user_other_tenant(self):
 
108
        body = self.admin_client.create_member(address="10.0.9.47",
 
109
                                               protocol_port=80,
 
110
                                               pool_id=self.pool['id'],
 
111
                                               tenant_id=self.tenant_id)
 
112
        member = body['member']
 
113
        self.addCleanup(self.admin_client.delete_member, member['id'])
 
114
        self.assertIsNotNone(member['id'])
 
115
        self.assertEqual(self.tenant_id, member['tenant_id'])