~ubuntu-branches/ubuntu/raring/nova/raring-proposed

« back to all changes in this revision

Viewing changes to nova/tests/network/test_rpcapi.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Adam Gandelman, Yolanda Robla, James Page
  • Date: 2013-01-11 13:06:56 UTC
  • mfrom: (1.1.67)
  • Revision ID: package-import@ubuntu.com-20130111130656-7n7fkevy03stm3mv
Tags: 2013.1~g2-0ubuntu1
[ Chuck Short ]
* New upstream release.
* debian/patches/ubuntu-show-tests.patch: Dropped no longer needed.
* debian/nova-xcp-plugins.install: Fix xcp-plugins empty packages
* debian/control: Drop python-nose in favor or testrepository
* debian/control: Add python-coverage as a build dep.
* debian/rules, debian/control: Run pep8 tests.
* debian/*.init: Remove they are not needed and take up space
* debian/control, debian/nova-cells.{install, logrotate, upstart}: Add
  cells support.
* debian/patches/fix-ubuntu-tests.patch: temporarily disable failing tests.
* debian/control, debian/nova-baremetal.{install, logrotate, upstart}: Add
  nova baremetal support.
* debian/control: Remove python-support.

[ Adam Gandelman ]
* debian/*.manpages: Install Sphinx-generated manpages instead of
  our own.
* debian/nova-compute-*.conf: Specify the newly required compute_driver
  flag in addition to libvirt_type.
* debian/control:  Specify required python-webob and python-stevedore
  versions.

[ Yolanda Robla ]
* debian/*.upstart: Use start-stop-daemon instead of su for chuid
  (LP: #1086833).
* debian/rules: Remove override of dh_installinit for discriminating
  between Debian and Ubuntu.
* debian/nova-common.docs: Installing changelogs from rules
* debian/rules: Replacing perms in /etc/nova/logging.conf for 0644
* debian/control: adduser dependency on nova-compute.
* debian/control: added section oldlibs and priority extra on
  nova-ajax-console-proxy.
* debian/nova-xvpvncproxy.postrm: removing because of duplicates.

[ James Page ]
* d/control: Add ~ to python-sqlalchemy-ext versioned dependencies to
  make backporting easier.
* d/control: Updated nova-volume description and depdendencies to
  mark it as a transitional package, moved to oldlibs/extra.
* d/p/fix-libvirt-tests.patch: Dropped; accepted upstream.
* d/control: Added python-stevedore to BD's.
* d/*.postrm: Dropped postrm's that just run update-rc.d; this is not
  required when deploying upstart configurations only.
* d/nova-scheduler.manpages: Add man page for nova-rpc-zmq-receiver.
* d/rules: Install upstream changelog with a policy compliant name.
* d/control: Mark nova-compute-xcp as virtual package.
* d/control: nova-api-os-volume; Depend on cinder-api and mark as
  transitional package.
* d/nova-api-os-volume.lintian-overrides: Dropped - no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
Unit Tests for nova.network.rpcapi
19
19
"""
20
20
 
21
 
from oslo.config import cfg
22
 
 
23
21
from nova import context
24
22
from nova.network import rpcapi as network_rpcapi
 
23
from nova.openstack.common import cfg
25
24
from nova.openstack.common import rpc
26
25
from nova import test
27
26
 
29
28
 
30
29
 
31
30
class NetworkRpcAPITestCase(test.TestCase):
32
 
    def setUp(self):
33
 
        super(NetworkRpcAPITestCase, self).setUp()
34
 
        self.flags(multi_host=True)
35
 
 
36
31
    def _test_network_api(self, method, rpc_method, **kwargs):
37
32
        ctxt = context.RequestContext('fake_user', 'fake_project')
38
33
        rpcapi = network_rpcapi.NetworkAPI()
50
45
            '_rpc_allocate_fixed_ip', 'deallocate_fixed_ip', 'update_dns',
51
46
            '_associate_floating_ip', '_disassociate_floating_ip',
52
47
            'lease_fixed_ip', 'release_fixed_ip', 'migrate_instance_start',
53
 
            'migrate_instance_finish', 'get_backdoor_port',
54
 
            'allocate_for_instance', 'deallocate_for_instance',
 
48
            'migrate_instance_finish', 'get_backdoor_port'
55
49
        ]
56
50
        if method in targeted_methods and 'host' in kwargs:
57
 
            if method not in ['allocate_for_instance',
58
 
                              'deallocate_for_instance',
59
 
                              'deallocate_fixed_ip']:
 
51
            if method != 'deallocate_fixed_ip':
60
52
                del expected_msg['args']['host']
61
53
            host = kwargs['host']
62
 
            if CONF.multi_host:
63
 
                expected_topic = rpc.queue_get_for(ctxt, CONF.network_topic,
64
 
                                                   host)
 
54
            expected_topic = rpc.queue_get_for(ctxt, CONF.network_topic, host)
65
55
        expected_msg['version'] = expected_version
66
56
 
67
57
        self.fake_args = None
118
108
    def test_get_floating_ip(self):
119
109
        self._test_network_api('get_floating_ip', rpc_method='call', id='id')
120
110
 
121
 
    def test_get_floating_ip_pools(self):
122
 
        self._test_network_api('get_floating_ip_pools', rpc_method='call',
123
 
                               version="1.7")
 
111
    def test_get_floating_pools(self):
 
112
        self._test_network_api('get_floating_pools', rpc_method='call')
124
113
 
125
114
    def test_get_floating_ip_by_address(self):
126
115
        self._test_network_api('get_floating_ip_by_address', rpc_method='call',
158
147
        self._test_network_api('deallocate_floating_ip', rpc_method='call',
159
148
                address='addr', affect_auto_assigned=True)
160
149
 
161
 
    def test_allocate_floating_ip_no_multi(self):
162
 
        self.flags(multi_host=False)
163
 
        self._test_network_api('allocate_floating_ip', rpc_method='call',
164
 
                project_id='fake_id', pool='fake_pool', auto_assigned=False)
165
 
 
166
 
    def test_deallocate_floating_ip_no_multi(self):
167
 
        self.flags(multi_host=False)
168
 
        self._test_network_api('deallocate_floating_ip', rpc_method='call',
169
 
                address='addr', affect_auto_assigned=True)
170
 
 
171
150
    def test_associate_floating_ip(self):
172
151
        self._test_network_api('associate_floating_ip', rpc_method='call',
173
152
                floating_address='blah', fixed_address='foo',
179
158
 
180
159
    def test_allocate_for_instance(self):
181
160
        self._test_network_api('allocate_for_instance', rpc_method='call',
182
 
                instance_id='fake_id', project_id='fake_id', host='fake_host',
183
 
                rxtx_factor='fake_factor', vpn=False, requested_networks={},
184
 
                macs=[], version='1.9')
 
161
                instance_id='fake_id', instance_uuid='fake_uuid',
 
162
                project_id='fake_id', host='fake_host',
 
163
                rxtx_factor='fake_factor', vpn=False, requested_networks={})
185
164
 
186
165
    def test_deallocate_for_instance(self):
187
166
        self._test_network_api('deallocate_for_instance', rpc_method='call',
189
168
 
190
169
    def test_add_fixed_ip_to_instance(self):
191
170
        self._test_network_api('add_fixed_ip_to_instance', rpc_method='call',
192
 
                instance_id='fake_id', rxtx_factor='fake_factor',
193
 
                host='fake_host', network_id='fake_id', version='1.9')
 
171
                instance_id='fake_id', host='fake_host', network_id='fake_id')
194
172
 
195
173
    def test_remove_fixed_ip_from_instance(self):
196
174
        self._test_network_api('remove_fixed_ip_from_instance',
197
 
                rpc_method='call', instance_id='fake_id',
198
 
                rxtx_factor='fake_factor', host='fake_host',
199
 
                address='fake_address', version='1.9')
 
175
                rpc_method='call', instance_id='fake_id', host='fake_host',
 
176
                address='fake_address')
200
177
 
201
178
    def test_add_network_to_project(self):
202
179
        self._test_network_api('add_network_to_project', rpc_method='call',
204
181
 
205
182
    def test_get_instance_nw_info(self):
206
183
        self._test_network_api('get_instance_nw_info', rpc_method='call',
207
 
                instance_id='fake_id', rxtx_factor='fake_factor',
208
 
                host='fake_host', project_id='fake_id', version='1.9')
 
184
                instance_id='fake_id', instance_uuid='fake_uuid',
 
185
                rxtx_factor='fake_factor', host='fake_host',
 
186
                project_id='fake_id')
209
187
 
210
188
    def test_validate_networks(self):
211
189
        self._test_network_api('validate_networks', rpc_method='call',