def test__dhcp_options_for_instance(self): self.config(pxe_bootfile_name="test_pxe_bootfile", group="pxe") self.config(tftp_server="192.0.2.1", group="pxe") expected_info = [ {"opt_name": "bootfile-name", "opt_value": "test_pxe_bootfile"}, {"opt_name": "server-ip-address", "opt_value": "192.0.2.1"}, {"opt_name": "tftp-server", "opt_value": "192.0.2.1"}, ] self.assertEqual(expected_info, pxe._dhcp_options_for_instance())
def test__update_neutron(self): opts = pxe._dhcp_options_for_instance() with mock.patch.object(pxe, '_get_node_vif_ids') as mock_gnvi: mock_gnvi.return_value = {'port-uuid': 'vif-uuid'} with mock.patch.object(neutron.NeutronAPI, 'update_port_dhcp_opts') as mock_updo: with task_manager.acquire(self.context, self.node.uuid) as task: pxe._update_neutron(task, self.node) mock_updo.assertCalleOnceWith('vif-uuid', opts)
def test__update_neutron(self): opts = pxe._dhcp_options_for_instance() with mock.patch.object(pxe, '_get_node_vif_ids') as mock_gnvi: mock_gnvi.return_value = {'port-uuid': 'vif-uuid'} with mock.patch.object(neutron.NeutronAPI, 'update_port_dhcp_opts') as mock_updo: with task_manager.acquire(self.context, self.node.uuid) as task: pxe._update_neutron(task, self.node) mock_updo.assertCalleOnceWith('vif-uuid', opts)
def test__dhcp_options_for_instance(self): self.config(pxe_bootfile_name='test_pxe_bootfile', group='pxe') self.config(tftp_server='192.0.2.1', group='pxe') expected_info = [{'opt_name': 'bootfile-name', 'opt_value': 'test_pxe_bootfile'}, {'opt_name': 'server-ip-address', 'opt_value': '192.0.2.1'}, {'opt_name': 'tftp-server', 'opt_value': '192.0.2.1'} ] self.assertEqual(expected_info, pxe._dhcp_options_for_instance())
def test__dhcp_options_for_instance(self): self.config(pxe_bootfile_name='test_pxe_bootfile', group='pxe') self.config(tftp_server='192.0.2.1', group='pxe') expected_info = [{ 'opt_name': 'bootfile-name', 'opt_value': 'test_pxe_bootfile' }, { 'opt_name': 'server-ip-address', 'opt_value': '192.0.2.1' }, { 'opt_name': 'tftp-server', 'opt_value': '192.0.2.1' }] self.assertEqual(expected_info, pxe._dhcp_options_for_instance())
def test__update_neutron(self, mock_updo, mock_gnvi): opts = pxe._dhcp_options_for_instance() mock_gnvi.return_value = {"port-uuid": "vif-uuid"} with task_manager.acquire(self.context, self.node.uuid) as task: pxe._update_neutron(task) mock_updo.assert_called_once_with("vif-uuid", opts)