~ubuntu-branches/ubuntu/vivid/ironic/vivid-updates

« back to all changes in this revision

Viewing changes to ironic/tests/test_pxe_utils.py

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2015-01-05 12:21:37 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20150105122137-171bqrdpcxqipunk
Tags: 2015.1~b1-0ubuntu1
* New upstream beta release:
  - d/control: Align version requirements with upstream release.
* d/watch: Update uversionmangle to deal with kilo beta versioning
  changes.
* d/control: Bumped Standards-Version to 3.9.6, no changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
from ironic.common import pxe_utils
23
23
from ironic.conductor import task_manager
24
 
from ironic.db import api as dbapi
25
24
from ironic.tests.conductor import utils as mgr_utils
26
25
from ironic.tests.db import base as db_base
27
26
from ironic.tests.objects import utils as object_utils
34
33
    def setUp(self):
35
34
        super(TestPXEUtils, self).setUp()
36
35
        mgr_utils.mock_the_extension_manager(driver="fake")
37
 
        self.dbapi = dbapi.get_instance()
38
36
        self.pxe_options = {
39
37
            'deployment_key': '0123456789ABCDEFGHIJKLMNOPQRSTUV',
40
38
            'ari_path': u'/tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/'
224
222
        }
225
223
 
226
224
        expected = {
227
 
            'deploy_kernel': ('deploy-kernel',
 
225
            'deploy_kernel': ('glance://deploy-kernel',
228
226
                              expected_dir + '/fake-node/deploy_kernel'),
229
 
            'deploy_ramdisk': ('deploy-ramdisk',
 
227
            'deploy_ramdisk': ('glance://deploy-ramdisk',
230
228
                               expected_dir + '/fake-node/deploy_ramdisk'),
231
229
        }
232
230
 
260
258
        self.config(http_url='http://192.0.3.2:1234', group='pxe')
261
259
        self.config(ipxe_boot_script='/test/boot.ipxe', group='pxe')
262
260
 
 
261
        self.config(dhcp_provider='isc', group='dhcp')
263
262
        expected_boot_script_url = 'http://192.0.3.2:1234/boot.ipxe'
264
263
        expected_info = [{'opt_name': '!175,bootfile-name',
265
264
                          'opt_value': 'fake-bootfile'},
273
272
            self.assertEqual(sorted(expected_info),
274
273
                             sorted(pxe_utils.dhcp_options_for_instance(task)))
275
274
 
 
275
        self.config(dhcp_provider='neutron', group='dhcp')
 
276
        expected_boot_script_url = 'http://192.0.3.2:1234/boot.ipxe'
 
277
        expected_info = [{'opt_name': 'tag:!ipxe,bootfile-name',
 
278
                          'opt_value': 'fake-bootfile'},
 
279
                         {'opt_name': 'server-ip-address',
 
280
                          'opt_value': '192.0.2.1'},
 
281
                         {'opt_name': 'tftp-server',
 
282
                          'opt_value': '192.0.2.1'},
 
283
                         {'opt_name': 'bootfile-name',
 
284
                          'opt_value': expected_boot_script_url}]
 
285
        with task_manager.acquire(self.context, self.node.uuid) as task:
 
286
            self.assertEqual(sorted(expected_info),
 
287
                             sorted(pxe_utils.dhcp_options_for_instance(task)))
 
288
 
276
289
    @mock.patch('ironic.common.utils.rmtree_without_raise', autospec=True)
277
290
    @mock.patch('ironic.common.utils.unlink_without_raise', autospec=True)
278
291
    @mock.patch('ironic.common.dhcp_factory.DHCPFactory.provider')