Best Python code snippet using tempest_python
test_utils.py
Source:test_utils.py
1# Copyright 2013: Mirantis Inc.2# All Rights Reserved.3#4# Licensed under the Apache License, Version 2.0 (the "License"); you may5# not use this file except in compliance with the License. You may obtain6# a copy of the License at7#8# http://www.apache.org/licenses/LICENSE-2.09#10# Unless required by applicable law or agreed to in writing, software11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the13# License for the specific language governing permissions and limitations14# under the License.15from unittest import mock16import ddt17from rally.common import cfg18from rally import exceptions as rally_exceptions19from rally_openstack.task.scenarios.nova import utils20from tests.unit import fakes21from tests.unit import test22BM_UTILS = "rally.task.utils"23NOVA_UTILS = "rally_openstack.task.scenarios.nova.utils"24CONF = cfg.CONF25@ddt.ddt26class NovaScenarioTestCase(test.ScenarioTestCase):27 def setUp(self):28 super(NovaScenarioTestCase, self).setUp()29 self.server = mock.Mock()30 self.server1 = mock.Mock()31 self.volume = mock.Mock()32 self.floating_ip = mock.Mock()33 self.image = mock.Mock()34 self.context.update(35 {"user": {"id": "fake_user_id", "credential": mock.MagicMock()},36 "tenant": {"id": "fake_tenant"}})37 def _context_with_secgroup(self, secgroup):38 retval = {"user": {"secgroup": secgroup,39 "credential": mock.MagicMock()}}40 retval.update(self.context)41 return retval42 def test__list_servers(self):43 servers_list = []44 self.clients("nova").servers.list.return_value = servers_list45 nova_scenario = utils.NovaScenario(self.context)46 return_servers_list = nova_scenario._list_servers(True)47 self.assertEqual(servers_list, return_servers_list)48 self._test_atomic_action_timer(nova_scenario.atomic_actions(),49 "nova.list_servers")50 def test__pick_random_nic(self):51 context = {"tenant": {"networks": [{"id": "net_id_1"},52 {"id": "net_id_2"}]},53 "iteration": 0}54 nova_scenario = utils.NovaScenario(context=context)55 nic1 = nova_scenario._pick_random_nic()56 self.assertEqual(nic1, [{"net-id": "net_id_1"}])57 context["iteration"] = 158 nova_scenario = utils.NovaScenario(context=context)59 nic2 = nova_scenario._pick_random_nic()60 # balance to net 261 self.assertEqual(nic2, [{"net-id": "net_id_2"}])62 context["iteration"] = 263 nova_scenario = utils.NovaScenario(context=context)64 nic3 = nova_scenario._pick_random_nic()65 # balance again, get net 166 self.assertEqual(nic3, [{"net-id": "net_id_1"}])67 def test__get_network_id(self):68 networks = {"networks": [{"name": "foo1", "id": 1},69 {"name": "foo2", "id": 2}]}70 self.clients("neutron").list_networks.return_value = networks71 scenario = utils.NovaScenario(self.context)72 self.assertEqual(1, scenario._get_network_id("foo1"))73 self.assertEqual(2, scenario._get_network_id("foo2"))74 self.clients("neutron").list_networks.assert_called_once_with()75 self.assertRaises(rally_exceptions.NotFoundException,76 scenario._get_network_id, "foo")77 @ddt.data(78 {},79 {"kwargs": {"auto_assign_nic": True}},80 {"kwargs": {"auto_assign_nic": True, "nics": [{"net-id": "baz_id"}]}},81 {"context": {"user": {"secgroup": {"name": "test"}}}},82 {"context": {"user": {"secgroup": {"name": "new8"}}},83 "kwargs": {"security_groups": ["test8"]}},84 {"context": {"user": {"secgroup": {"name": "test1"}}},85 "kwargs": {"security_groups": ["test1"]}},86 {"kwargs": {"auto_assign_nic": False,87 "nics": [{"net-name": "foo_name"}]}}88 )89 @ddt.unpack90 def test__boot_server(self, context=None, kwargs=None):91 self.clients("nova").servers.create.return_value = self.server92 if context is None:93 context = self.context94 context.setdefault("user", {}).setdefault("credential",95 mock.MagicMock())96 context.setdefault("config", {})97 nova_scenario = utils.NovaScenario(context=context)98 nova_scenario.generate_random_name = mock.Mock()99 nova_scenario._pick_random_nic = mock.Mock(100 return_value=[{"net-id": "foo"}])101 nova_scenario._get_network_id = mock.Mock(return_value="foo")102 if kwargs is None:103 kwargs = {}104 kwargs["fakearg"] = "fakearg"105 return_server = nova_scenario._boot_server("image_id", "flavor_id",106 **kwargs)107 self.mock_wait_for_status.mock.assert_called_once_with(108 self.server,109 ready_statuses=["ACTIVE"],110 update_resource=self.mock_get_from_manager.mock.return_value,111 check_interval=CONF.openstack.nova_server_boot_poll_interval,112 timeout=CONF.openstack.nova_server_boot_timeout)113 self.mock_get_from_manager.mock.assert_called_once_with()114 self.assertEqual(self.mock_wait_for_status.mock.return_value,115 return_server)116 expected_kwargs = {"fakearg": "fakearg"}117 if "nics" in kwargs:118 expected_kwargs["nics"] = kwargs["nics"]119 elif "auto_assign_nic" in kwargs:120 expected_kwargs["nics"] = (nova_scenario._pick_random_nic.121 return_value)122 expected_secgroups = set()123 if "security_groups" in kwargs:124 expected_secgroups.update(kwargs["security_groups"])125 if "secgroup" in context["user"]:126 expected_secgroups.add(context["user"]["secgroup"]["name"])127 if expected_secgroups:128 expected_kwargs["security_groups"] = list(expected_secgroups)129 self.clients("nova").servers.create.assert_called_once_with(130 nova_scenario.generate_random_name.return_value,131 "image_id", "flavor_id", **expected_kwargs)132 self._test_atomic_action_timer(nova_scenario.atomic_actions(),133 "nova.boot_server")134 def test__boot_server_with_network_exception(self):135 self.context.update({"tenant": {"networks": None}})136 self.clients("nova").servers.create.return_value = self.server137 nova_scenario = utils.NovaScenario(138 context=self.context)139 self.assertRaises(TypeError, nova_scenario._boot_server,140 "image_id", "flavor_id",141 auto_assign_nic=True)142 def test__suspend_server(self):143 nova_scenario = utils.NovaScenario(context=self.context)144 nova_scenario._suspend_server(self.server)145 self.server.suspend.assert_called_once_with()146 self.mock_wait_for_status.mock.assert_called_once_with(147 self.server,148 ready_statuses=["SUSPENDED"],149 update_resource=self.mock_get_from_manager.mock.return_value,150 check_interval=CONF.openstack.nova_server_suspend_poll_interval,151 timeout=CONF.openstack.nova_server_suspend_timeout)152 self.mock_get_from_manager.mock.assert_called_once_with()153 self._test_atomic_action_timer(nova_scenario.atomic_actions(),154 "nova.suspend_server")155 def test__resume_server(self):156 nova_scenario = utils.NovaScenario(context=self.context)157 nova_scenario._resume_server(self.server)158 self.server.resume.assert_called_once_with()159 self.mock_wait_for_status.mock.assert_called_once_with(160 self.server,161 ready_statuses=["ACTIVE"],162 update_resource=self.mock_get_from_manager.mock.return_value,163 check_interval=CONF.openstack.nova_server_resume_poll_interval,164 timeout=CONF.openstack.nova_server_resume_timeout)165 self.mock_get_from_manager.mock.assert_called_once_with()166 self._test_atomic_action_timer(nova_scenario.atomic_actions(),167 "nova.resume_server")168 def test__pause_server(self):169 nova_scenario = utils.NovaScenario(context=self.context)170 nova_scenario._pause_server(self.server)171 self.server.pause.assert_called_once_with()172 self.mock_wait_for_status.mock.assert_called_once_with(173 self.server,174 ready_statuses=["PAUSED"],175 update_resource=self.mock_get_from_manager.mock.return_value,176 check_interval=CONF.openstack.nova_server_pause_poll_interval,177 timeout=CONF.openstack.nova_server_pause_timeout)178 self.mock_get_from_manager.mock.assert_called_once_with()179 self._test_atomic_action_timer(nova_scenario.atomic_actions(),180 "nova.pause_server")181 def test__unpause_server(self):182 nova_scenario = utils.NovaScenario(context=self.context)183 nova_scenario._unpause_server(self.server)184 self.server.unpause.assert_called_once_with()185 self.mock_wait_for_status.mock.assert_called_once_with(186 self.server,187 ready_statuses=["ACTIVE"],188 update_resource=self.mock_get_from_manager.mock.return_value,189 check_interval=CONF.openstack.nova_server_unpause_poll_interval,190 timeout=CONF.openstack.nova_server_unpause_timeout)191 self.mock_get_from_manager.mock.assert_called_once_with()192 self._test_atomic_action_timer(nova_scenario.atomic_actions(),193 "nova.unpause_server")194 def test__shelve_server(self):195 nova_scenario = utils.NovaScenario(context=self.context)196 nova_scenario._shelve_server(self.server)197 self.server.shelve.assert_called_once_with()198 self.mock_wait_for_status.mock.assert_called_once_with(199 self.server,200 ready_statuses=["SHELVED_OFFLOADED"],201 update_resource=self.mock_get_from_manager.mock.return_value,202 check_interval=CONF.openstack.nova_server_shelve_poll_interval,203 timeout=CONF.openstack.nova_server_shelve_timeout)204 self.mock_get_from_manager.mock.assert_called_once_with()205 self._test_atomic_action_timer(nova_scenario.atomic_actions(),206 "nova.shelve_server")207 def test__unshelve_server(self):208 nova_scenario = utils.NovaScenario(context=self.context)209 nova_scenario._unshelve_server(self.server)210 self.server.unshelve.assert_called_once_with()211 self.mock_wait_for_status.mock.assert_called_once_with(212 self.server,213 ready_statuses=["ACTIVE"],214 update_resource=self.mock_get_from_manager.mock.return_value,215 check_interval=CONF.openstack.nova_server_unshelve_poll_interval,216 timeout=CONF.openstack.nova_server_unshelve_timeout)217 self.mock_get_from_manager.mock.assert_called_once_with()218 self._test_atomic_action_timer(nova_scenario.atomic_actions(),219 "nova.unshelve_server")220 @mock.patch("rally_openstack.task.scenarios.nova.utils.image_service")221 def test__create_image(self, mock_image_service):222 glance = mock_image_service.Image.return_value223 glance.get_image.return_value = self.image224 nova_scenario = utils.NovaScenario(context=self.context)225 return_image = nova_scenario._create_image(self.server)226 self.mock_wait_for_status.mock.assert_has_calls([227 mock.call(228 self.image,229 ready_statuses=["ACTIVE"],230 update_resource=glance.get_image,231 check_interval=CONF.openstack.232 nova_server_image_create_poll_interval,233 timeout=CONF.openstack.nova_server_image_create_timeout),234 mock.call(235 self.server,236 ready_statuses=["None"],237 status_attr="OS-EXT-STS:task_state",238 update_resource=self.mock_get_from_manager.mock.return_value,239 check_interval=CONF.openstack.240 nova_server_image_create_poll_interval,241 timeout=CONF.openstack.nova_server_image_create_timeout)242 ])243 self.assertEqual(self.mock_wait_for_status.mock.return_value,244 return_image)245 self._test_atomic_action_timer(nova_scenario.atomic_actions(),246 "nova.snapshot_server")247 def test__default_delete_server(self):248 nova_scenario = utils.NovaScenario(context=self.context)249 nova_scenario._delete_server(self.server)250 self.server.delete.assert_called_once_with()251 self.mock_wait_for_status.mock.assert_called_once_with(252 self.server,253 ready_statuses=["deleted"],254 check_deletion=True,255 update_resource=self.mock_get_from_manager.mock.return_value,256 check_interval=CONF.openstack.nova_server_delete_poll_interval,257 timeout=CONF.openstack.nova_server_delete_timeout)258 self.mock_get_from_manager.mock.assert_called_once_with()259 self._test_atomic_action_timer(nova_scenario.atomic_actions(),260 "nova.delete_server")261 def test__force_delete_server(self):262 nova_scenario = utils.NovaScenario(context=self.context)263 nova_scenario._delete_server(self.server, force=True)264 self.server.force_delete.assert_called_once_with()265 self.mock_wait_for_status.mock.assert_called_once_with(266 self.server,267 ready_statuses=["deleted"],268 check_deletion=True,269 update_resource=self.mock_get_from_manager.mock.return_value,270 check_interval=CONF.openstack.nova_server_delete_poll_interval,271 timeout=CONF.openstack.nova_server_delete_timeout)272 self.mock_get_from_manager.mock.assert_called_once_with()273 self._test_atomic_action_timer(nova_scenario.atomic_actions(),274 "nova.force_delete_server")275 def test__reboot_server(self):276 nova_scenario = utils.NovaScenario(context=self.context)277 nova_scenario._reboot_server(self.server)278 self.server.reboot.assert_called_once_with(reboot_type="HARD")279 self.mock_wait_for_status.mock.assert_called_once_with(280 self.server,281 ready_statuses=["ACTIVE"],282 update_resource=self.mock_get_from_manager.mock.return_value,283 check_interval=CONF.openstack.nova_server_reboot_poll_interval,284 timeout=CONF.openstack.nova_server_reboot_timeout)285 self.mock_get_from_manager.mock.assert_called_once_with()286 self._test_atomic_action_timer(nova_scenario.atomic_actions(),287 "nova.reboot_server")288 def test__soft_reboot_server(self):289 nova_scenario = utils.NovaScenario(context=self.context)290 nova_scenario._soft_reboot_server(self.server)291 self.server.reboot.assert_called_once_with(reboot_type="SOFT")292 self.mock_wait_for_status.mock.assert_called_once_with(293 self.server,294 ready_statuses=["ACTIVE"],295 update_resource=self.mock_get_from_manager.mock.return_value,296 check_interval=CONF.openstack.nova_server_reboot_poll_interval,297 timeout=CONF.openstack.nova_server_reboot_timeout)298 self.mock_get_from_manager.mock.assert_called_once_with()299 self._test_atomic_action_timer(nova_scenario.atomic_actions(),300 "nova.soft_reboot_server")301 def test__rebuild_server(self):302 nova_scenario = utils.NovaScenario(context=self.context)303 nova_scenario._rebuild_server(self.server, "img", fakearg="fakearg")304 self.server.rebuild.assert_called_once_with("img", fakearg="fakearg")305 self.mock_wait_for_status.mock.assert_called_once_with(306 self.server,307 ready_statuses=["ACTIVE"],308 update_resource=self.mock_get_from_manager.mock.return_value,309 check_interval=CONF.openstack.nova_server_rebuild_poll_interval,310 timeout=CONF.openstack.nova_server_rebuild_timeout)311 self.mock_get_from_manager.mock.assert_called_once_with()312 self._test_atomic_action_timer(nova_scenario.atomic_actions(),313 "nova.rebuild_server")314 def test__start_server(self):315 nova_scenario = utils.NovaScenario(context=self.context)316 nova_scenario._start_server(self.server)317 self.server.start.assert_called_once_with()318 self.mock_wait_for_status.mock.assert_called_once_with(319 self.server,320 ready_statuses=["ACTIVE"],321 update_resource=self.mock_get_from_manager.mock.return_value,322 check_interval=CONF.openstack.nova_server_start_poll_interval,323 timeout=CONF.openstack.nova_server_start_timeout)324 self.mock_get_from_manager.mock.assert_called_once_with()325 self._test_atomic_action_timer(nova_scenario.atomic_actions(),326 "nova.start_server")327 def test__stop_server(self):328 nova_scenario = utils.NovaScenario(context=self.context)329 nova_scenario._stop_server(self.server)330 self.server.stop.assert_called_once_with()331 self.mock_wait_for_status.mock.assert_called_once_with(332 self.server,333 ready_statuses=["SHUTOFF"],334 update_resource=self.mock_get_from_manager.mock.return_value,335 check_interval=CONF.openstack.nova_server_stop_poll_interval,336 timeout=CONF.openstack.nova_server_stop_timeout)337 self.mock_get_from_manager.mock.assert_called_once_with()338 self._test_atomic_action_timer(nova_scenario.atomic_actions(),339 "nova.stop_server")340 def test__rescue_server(self):341 nova_scenario = utils.NovaScenario(context=self.context)342 nova_scenario._rescue_server(self.server)343 self.server.rescue.assert_called_once_with()344 self.mock_wait_for_status.mock.assert_called_once_with(345 self.server,346 ready_statuses=["RESCUE"],347 update_resource=self.mock_get_from_manager.mock.return_value,348 check_interval=CONF.openstack.nova_server_rescue_poll_interval,349 timeout=CONF.openstack.nova_server_rescue_timeout)350 self.mock_get_from_manager.mock.assert_called_once_with()351 self._test_atomic_action_timer(nova_scenario.atomic_actions(),352 "nova.rescue_server")353 def test__unrescue_server(self):354 nova_scenario = utils.NovaScenario(context=self.context)355 nova_scenario._unrescue_server(self.server)356 self.server.unrescue.assert_called_once_with()357 self.mock_wait_for_status.mock.assert_called_once_with(358 self.server,359 ready_statuses=["ACTIVE"],360 update_resource=self.mock_get_from_manager.mock.return_value,361 check_interval=CONF.openstack.nova_server_unrescue_poll_interval,362 timeout=CONF.openstack.nova_server_unrescue_timeout)363 self.mock_get_from_manager.mock.assert_called_once_with()364 self._test_atomic_action_timer(nova_scenario.atomic_actions(),365 "nova.unrescue_server")366 def _test_delete_servers(self, force=False):367 servers = [self.server, self.server1]368 nova_scenario = utils.NovaScenario(context=self.context)369 nova_scenario._delete_servers(servers, force=force)370 check_interval = CONF.openstack.nova_server_delete_poll_interval371 expected = []372 for server in servers:373 expected.append(mock.call(374 server,375 ready_statuses=["deleted"],376 check_deletion=True,377 update_resource=self.mock_get_from_manager.mock.return_value,378 check_interval=check_interval,379 timeout=CONF.openstack.nova_server_delete_timeout))380 if force:381 server.force_delete.assert_called_once_with()382 self.assertFalse(server.delete.called)383 else:384 server.delete.assert_called_once_with()385 self.assertFalse(server.force_delete.called)386 self.mock_wait_for_status.mock.assert_has_calls(expected)387 timer_name = "nova.%sdelete_servers" % ("force_" if force else "")388 self._test_atomic_action_timer(nova_scenario.atomic_actions(),389 timer_name)390 def test__default_delete_servers(self):391 self._test_delete_servers()392 def test__force_delete_servers(self):393 self._test_delete_servers(force=True)394 @mock.patch("rally_openstack.task.scenarios.nova.utils.image_service")395 def test__delete_image(self, mock_image_service):396 glance = mock_image_service.Image.return_value397 nova_scenario = utils.NovaScenario(context=self.context,398 clients=mock.Mock())399 nova_scenario._delete_image(self.image)400 glance.delete_image.assert_called_once_with(self.image.id)401 self.mock_wait_for_status.mock.assert_called_once_with(402 self.image,403 ready_statuses=["deleted", "pending_delete"],404 check_deletion=True,405 update_resource=glance.get_image,406 check_interval=CONF.openstack.407 nova_server_image_delete_poll_interval,408 timeout=CONF.openstack.nova_server_image_delete_timeout)409 self._test_atomic_action_timer(nova_scenario.atomic_actions(),410 "nova.delete_image")411 @ddt.data(412 {"requests": 1},413 {"requests": 25},414 {"requests": 2, "instances_amount": 100, "auto_assign_nic": True,415 "fakearg": "fake"},416 {"auto_assign_nic": True, "nics": [{"net-id": "foo"}]},417 {"auto_assign_nic": False, "nics": [{"net-id": "foo"}]},418 {"auto_assign_nic": False, "nics": [{"net-name": "foo_name"}]})419 @ddt.unpack420 def test__boot_servers(self, image_id="image", flavor_id="flavor",421 requests=1, instances_amount=1,422 auto_assign_nic=False, **kwargs):423 servers = [mock.Mock() for i in range(instances_amount)]424 self.clients("nova").servers.list.return_value = servers425 scenario = utils.NovaScenario(context=self.context)426 scenario.generate_random_name = mock.Mock()427 scenario._pick_random_nic = mock.Mock(428 return_value=[{"net-id": "foo"}])429 scenario._get_network_id = mock.Mock(return_value="foo")430 scenario._boot_servers(image_id, flavor_id, requests,431 instances_amount=instances_amount,432 auto_assign_nic=auto_assign_nic,433 **kwargs)434 expected_kwargs = dict(kwargs)435 if auto_assign_nic and "nics" not in kwargs:436 expected_kwargs["nics"] = scenario._pick_random_nic.return_value437 create_calls = [438 mock.call(439 "%s_%d" % (scenario.generate_random_name.return_value, i),440 image_id, flavor_id,441 min_count=instances_amount, max_count=instances_amount,442 **expected_kwargs)443 for i in range(requests)]444 self.clients("nova").servers.create.assert_has_calls(create_calls)445 wait_for_status_calls = [446 mock.call(447 servers[i],448 ready_statuses=["ACTIVE"],449 update_resource=self.mock_get_from_manager.mock.return_value,450 check_interval=CONF.openstack.nova_server_boot_poll_interval,451 timeout=CONF.openstack.nova_server_boot_timeout)452 for i in range(instances_amount)]453 self.mock_wait_for_status.mock.assert_has_calls(wait_for_status_calls)454 self.mock_get_from_manager.mock.assert_has_calls(455 [mock.call() for i in range(instances_amount)])456 self._test_atomic_action_timer(scenario.atomic_actions(),457 "nova.boot_servers")458 def test__show_server(self):459 nova_scenario = utils.NovaScenario(context=self.context)460 nova_scenario._show_server(self.server)461 self.clients("nova").servers.get.assert_called_once_with(462 self.server463 )464 self._test_atomic_action_timer(nova_scenario.atomic_actions(),465 "nova.show_server")466 def test__get_console_server(self):467 nova_scenario = utils.NovaScenario(context=self.context)468 nova_scenario._get_server_console_output(self.server)469 self.clients(470 "nova").servers.get_console_output.assert_called_once_with(471 self.server, length=None)472 self._test_atomic_action_timer(nova_scenario.atomic_actions(),473 "nova.get_console_output_server")474 def test__get_console_url(self):475 nova_scenario = utils.NovaScenario(context=self.context)476 nova_scenario._get_console_url_server(self.server, "foo")477 self.clients(478 "nova").servers.get_console_url.assert_called_once_with(479 self.server, "foo")480 self._test_atomic_action_timer(nova_scenario.atomic_actions(),481 "nova.get_console_url_server")482 def test__associate_floating_ip(self):483 clients = mock.MagicMock()484 nova_scenario = utils.NovaScenario(context=self.context,485 clients=clients)486 neutronclient = clients.neutron.return_value487 neutronclient.list_ports.return_value = {"ports": [{"id": "p1"},488 {"id": "p2"}]}489 fip_ip = "172.168.0.1"490 fip_id = "some"491 # case #1- an object from neutronclient492 floating_ip = {"floating_ip_address": fip_ip, "id": fip_id}493 nova_scenario._associate_floating_ip(self.server, floating_ip)494 neutronclient.update_floatingip.assert_called_once_with(495 fip_id, {"floatingip": {"port_id": "p1"}}496 )497 # case #2 - an object from network wrapper498 neutronclient.update_floatingip.reset_mock()499 floating_ip = {"ip": fip_ip, "id": fip_id}500 nova_scenario._associate_floating_ip(self.server, floating_ip)501 neutronclient.update_floatingip.assert_called_once_with(502 fip_id, {"floatingip": {"port_id": "p1"}}503 )504 # these should not be called in both cases505 self.assertFalse(neutronclient.list_floatingips.called)506 # it is an old behavior. let's check that it was not called507 self.assertFalse(self.server.add_floating_ip.called)508 self._test_atomic_action_timer(nova_scenario.atomic_actions(),509 "nova.associate_floating_ip", count=2)510 def test__associate_floating_ip_deprecated_behavior(self):511 clients = mock.MagicMock()512 nova_scenario = utils.NovaScenario(context=self.context,513 clients=clients)514 neutronclient = clients.neutron.return_value515 neutronclient.list_ports.return_value = {"ports": [{"id": "p1"},516 {"id": "p2"}]}517 fip_id = "fip1"518 fip_ip = "172.168.0.1"519 neutronclient.list_floatingips.return_value = {520 "floatingips": [521 {"id": fip_id, "floating_ip_address": fip_ip},522 {"id": "fip2", "floating_ip_address": "127.0.0.1"}]}523 nova_scenario._associate_floating_ip(self.server, fip_ip)524 neutronclient.update_floatingip.assert_called_once_with(525 fip_id, {"floatingip": {"port_id": "p1"}}526 )527 neutronclient.list_floatingips.assert_called_once_with(528 floating_ip_address=fip_ip)529 # it is an old behavior. let's check that it was not called530 self.assertFalse(self.server.add_floating_ip.called)531 self._test_atomic_action_timer(nova_scenario.atomic_actions(),532 "nova.associate_floating_ip")533 def test__dissociate_floating_ip(self):534 clients = mock.MagicMock()535 nova_scenario = utils.NovaScenario(context=self.context,536 clients=clients)537 neutronclient = clients.neutron.return_value538 fip_ip = "172.168.0.1"539 fip_id = "some"540 # case #1- an object from neutronclient541 floating_ip = {"floating_ip_address": fip_ip, "id": fip_id}542 nova_scenario._dissociate_floating_ip(self.server, floating_ip)543 neutronclient.update_floatingip.assert_called_once_with(544 fip_id, {"floatingip": {"port_id": None}}545 )546 # case #2 - an object from network wrapper547 neutronclient.update_floatingip.reset_mock()548 floating_ip = {"ip": fip_ip, "id": fip_id}549 nova_scenario._dissociate_floating_ip(self.server, floating_ip)550 neutronclient.update_floatingip.assert_called_once_with(551 fip_id, {"floatingip": {"port_id": None}}552 )553 # these should not be called in both cases554 self.assertFalse(neutronclient.list_floatingips.called)555 # it is an old behavior. let's check that it was not called556 self.assertFalse(self.server.add_floating_ip.called)557 self._test_atomic_action_timer(nova_scenario.atomic_actions(),558 "nova.dissociate_floating_ip", count=2)559 def test__disassociate_floating_ip_deprecated_behavior(self):560 clients = mock.MagicMock()561 nova_scenario = utils.NovaScenario(context=self.context,562 clients=clients)563 neutronclient = clients.neutron.return_value564 fip_id = "fip1"565 fip_ip = "172.168.0.1"566 neutronclient.list_floatingips.return_value = {567 "floatingips": [568 {"id": fip_id, "floating_ip_address": fip_ip},569 {"id": "fip2", "floating_ip_address": "127.0.0.1"}]}570 nova_scenario._dissociate_floating_ip(self.server, fip_ip)571 neutronclient.update_floatingip.assert_called_once_with(572 fip_id, {"floatingip": {"port_id": None}}573 )574 neutronclient.list_floatingips.assert_called_once_with(575 floating_ip_address=fip_ip)576 self._test_atomic_action_timer(nova_scenario.atomic_actions(),577 "nova.dissociate_floating_ip")578 def test__check_ip_address(self):579 nova_scenario = utils.NovaScenario(context=self.context)580 fake_server = fakes.FakeServerManager().create("test_server",581 "image_id_01",582 "flavor_id_01")583 fake_server.addresses = {584 "private": [585 {"version": 4, "addr": "1.2.3.4"},586 ]}587 floating_ip = fakes.FakeFloatingIP()588 floating_ip.ip = "10.20.30.40"589 # Also test function check_ip_address accept a string as attr590 self.assertFalse(591 nova_scenario.check_ip_address(floating_ip.ip)(fake_server))592 self.assertTrue(593 nova_scenario.check_ip_address(floating_ip.ip, must_exist=False)594 (fake_server))595 fake_server.addresses["private"].append(596 {"version": 4, "addr": floating_ip.ip}597 )598 # Also test function check_ip_address accept an object with attr ip599 self.assertTrue(600 nova_scenario.check_ip_address(floating_ip)601 (fake_server))602 self.assertFalse(603 nova_scenario.check_ip_address(floating_ip, must_exist=False)604 (fake_server))605 def test__resize(self):606 nova_scenario = utils.NovaScenario(context=self.context)607 to_flavor = mock.Mock()608 nova_scenario._resize(self.server, to_flavor)609 self._test_atomic_action_timer(nova_scenario.atomic_actions(),610 "nova.resize")611 def test__resize_confirm(self):612 nova_scenario = utils.NovaScenario(context=self.context)613 nova_scenario._resize_confirm(self.server)614 self._test_atomic_action_timer(nova_scenario.atomic_actions(),615 "nova.resize_confirm")616 @ddt.data({},617 {"status": "SHUTOFF"})618 @ddt.unpack619 def test__resize_revert(self, status=None):620 nova_scenario = utils.NovaScenario(context=self.context)621 if status is None:622 nova_scenario._resize_revert(self.server)623 status = "ACTIVE"624 else:625 nova_scenario._resize_revert(self.server, status=status)626 self.mock_wait_for_status.mock.assert_called_once_with(627 self.server,628 ready_statuses=[status],629 update_resource=self.mock_get_from_manager.mock.return_value,630 check_interval=CONF.openstack.631 nova_server_resize_revert_poll_interval,632 timeout=CONF.openstack.nova_server_resize_revert_timeout)633 self._test_atomic_action_timer(nova_scenario.atomic_actions(),634 "nova.resize_revert")635 @mock.patch("rally_openstack.common.services.storage.block.BlockStorage")636 def test__update_volume_resource(self, mock_block_storage):637 volume = fakes.FakeVolume(id=1)638 cinder = mock_block_storage.return_value639 cinder.get_volume = mock.MagicMock()640 nova_scenario = utils.NovaScenario(context=self.context)641 self.assertEqual(cinder.get_volume.return_value,642 nova_scenario._update_volume_resource(volume))643 def test__attach_volume(self):644 expect_attach = mock.MagicMock()645 device = None646 (self.clients("nova").volumes.create_server_volume647 .return_value) = expect_attach648 nova_scenario = utils.NovaScenario(context=self.context)649 attach = nova_scenario._attach_volume(self.server, self.volume, device)650 (self.clients("nova").volumes.create_server_volume651 .assert_called_once_with(self.server.id, self.volume.id, device))652 self.assertEqual(expect_attach, attach)653 self._test_atomic_action_timer(nova_scenario.atomic_actions(),654 "nova.attach_volume")655 def test__list_attachments(self):656 expect_attachments = [mock.MagicMock()]657 (self.clients("nova").volumes.get_server_volumes658 .return_value) = expect_attachments659 nova_scenario = utils.NovaScenario(context=self.context)660 list_attachments = nova_scenario._list_attachments(self.server.id)661 self.assertEqual(expect_attachments, list_attachments)662 (self.clients("nova").volumes.get_server_volumes663 .assert_called_once_with(self.server.id))664 self._test_atomic_action_timer(nova_scenario.atomic_actions(),665 "nova.list_attachments")666 def test__detach_volume(self):667 attach = mock.MagicMock(id="attach_id")668 self.clients("nova").volumes.delete_server_volume.return_value = None669 nova_scenario = utils.NovaScenario(context=self.context)670 nova_scenario._detach_volume(self.server, self.volume, attach)671 (self.clients("nova").volumes.delete_server_volume672 .assert_called_once_with(self.server.id, self.volume.id))673 self._test_atomic_action_timer(nova_scenario.atomic_actions(),674 "nova.detach_volume")675 def test__detach_volume_no_attach(self):676 self.clients("nova").volumes.delete_server_volume.return_value = None677 nova_scenario = utils.NovaScenario(context=self.context)678 nova_scenario._detach_volume(self.server, self.volume, None)679 (self.clients("nova").volumes.delete_server_volume680 .assert_called_once_with(self.server.id, self.volume.id))681 self._test_atomic_action_timer(nova_scenario.atomic_actions(),682 "nova.detach_volume")683 def test__live_migrate_server(self):684 self.admin_clients("nova").servers.get(return_value=self.server)685 nova_scenario = utils.NovaScenario(context=self.context)686 nova_scenario._live_migrate(self.server,687 block_migration=False,688 disk_over_commit=False,689 skip_compute_nodes_check=True,690 skip_host_check=True)691 self.mock_wait_for_status.mock.assert_called_once_with(692 self.server,693 ready_statuses=["ACTIVE"],694 update_resource=self.mock_get_from_manager.mock.return_value,695 check_interval=CONF.openstack.696 nova_server_live_migrate_poll_interval,697 timeout=CONF.openstack.nova_server_live_migrate_timeout)698 self.mock_get_from_manager.mock.assert_called_once_with()699 self._test_atomic_action_timer(nova_scenario.atomic_actions(),700 "nova.live_migrate")701 def test__migrate_server(self):702 fake_server = self.server703 setattr(fake_server, "OS-EXT-SRV-ATTR:host", "a1")704 self.clients("nova").servers.get(return_value=fake_server)705 nova_scenario = utils.NovaScenario(context=self.context)706 nova_scenario._migrate(fake_server, skip_compute_nodes_check=True,707 skip_host_check=True)708 self.mock_wait_for_status.mock.assert_called_once_with(709 fake_server,710 ready_statuses=["VERIFY_RESIZE"],711 update_resource=self.mock_get_from_manager.mock.return_value,712 check_interval=CONF.openstack.nova_server_migrate_poll_interval,713 timeout=CONF.openstack.nova_server_migrate_timeout)714 self.mock_get_from_manager.mock.assert_called_once_with()715 self._test_atomic_action_timer(nova_scenario.atomic_actions(),716 "nova.migrate")717 self.assertRaises(rally_exceptions.RallyException,718 nova_scenario._migrate,719 fake_server, skip_compute_nodes_check=True,720 skip_host_check=False)721 self.assertRaises(rally_exceptions.RallyException,722 nova_scenario._migrate,723 fake_server, skip_compute_nodes_check=False,724 skip_host_check=True)725 def test__add_server_secgroups(self):726 server = mock.Mock()727 fake_secgroups = [fakes.FakeSecurityGroup(None, None, 1, "uuid1")]728 nova_scenario = utils.NovaScenario()729 security_group = fake_secgroups[0]730 result = nova_scenario._add_server_secgroups(server,731 security_group.name)732 self.assertEqual(733 self.clients("nova").servers.add_security_group.return_value,734 result)735 (self.clients("nova").servers.add_security_group.736 assert_called_once_with(server, security_group.name))737 self._test_atomic_action_timer(nova_scenario.atomic_actions(),738 "nova.add_server_secgroups")739 def test__list_keypairs(self):740 nova_scenario = utils.NovaScenario()741 result = nova_scenario._list_keypairs()742 self.assertEqual(self.clients("nova").keypairs.list.return_value,743 result)744 self.clients("nova").keypairs.list.assert_called_once_with()745 self._test_atomic_action_timer(nova_scenario.atomic_actions(),746 "nova.list_keypairs")747 def test__create_keypair(self):748 nova_scenario = utils.NovaScenario()749 nova_scenario.generate_random_name = mock.Mock(750 return_value="rally_nova_keypair_fake")751 result = nova_scenario._create_keypair(fakeargs="fakeargs")752 self.assertEqual(753 self.clients("nova").keypairs.create.return_value.name,754 result)755 self.clients("nova").keypairs.create.assert_called_once_with(756 "rally_nova_keypair_fake", fakeargs="fakeargs")757 self._test_atomic_action_timer(nova_scenario.atomic_actions(),758 "nova.create_keypair")759 def test__get_server_group(self):760 nova_scenario = utils.NovaScenario()761 fakeid = 12345762 result = nova_scenario._get_server_group(fakeid)763 self.assertEqual(764 self.clients("nova").server_groups.get.return_value,765 result)766 self.clients("nova").server_groups.get.assert_called_once_with(767 fakeid)768 self._test_atomic_action_timer(nova_scenario.atomic_actions(),769 "nova.get_server_group")770 def test__create_server_group(self):771 nova_scenario = utils.NovaScenario()772 nova_scenario.generate_random_name = mock.Mock(773 return_value="random_name")774 result = nova_scenario._create_server_group(fakeargs="fakeargs")775 self.assertEqual(776 self.clients("nova").server_groups.create.return_value,777 result)778 self.clients("nova").server_groups.create.assert_called_once_with(779 name="random_name", fakeargs="fakeargs")780 self._test_atomic_action_timer(nova_scenario.atomic_actions(),781 "nova.create_server_group")782 def test__delete_server_group(self):783 nova_scenario = utils.NovaScenario()784 fakeid = 12345785 result = nova_scenario._delete_server_group(fakeid)786 self.assertEqual(787 self.clients("nova").server_groups.delete.return_value,788 result)789 self.clients("nova").server_groups.delete.assert_called_once_with(790 fakeid)791 self._test_atomic_action_timer(nova_scenario.atomic_actions(),792 "nova.delete_server_group")793 def test__list_server_groups(self):794 nova_scenario = utils.NovaScenario()795 result1 = nova_scenario._list_server_groups(all_projects=False)796 result2 = nova_scenario._list_server_groups(all_projects=True)797 self.assertEqual(self.clients("nova").server_groups.list.return_value,798 result1)799 admcli = self.admin_clients("nova")800 self.assertEqual(admcli.server_groups.list.return_value, result2)801 self.clients("nova").server_groups.list.assert_called_once_with(802 False)803 self.admin_clients("nova").server_groups.list.assert_called_once_with(804 True)805 self._test_atomic_action_timer(nova_scenario.atomic_actions(),806 "nova.list_server_groups", count=2)807 def test__delete_keypair(self):808 nova_scenario = utils.NovaScenario()809 nova_scenario._delete_keypair("fake_keypair")810 self.clients("nova").keypairs.delete.assert_called_once_with(811 "fake_keypair")812 self._test_atomic_action_timer(nova_scenario.atomic_actions(),813 "nova.delete_keypair")814 def test__get_keypair(self):815 nova_scenario = utils.NovaScenario()816 nova_scenario._get_keypair("fake_keypair")817 self.clients("nova").keypairs.get.assert_called_once_with(818 "fake_keypair")819 self._test_atomic_action_timer(nova_scenario.atomic_actions(),820 "nova.get_keypair")821 def test__list_hypervisors(self):822 nova_scenario = utils.NovaScenario()823 result = nova_scenario._list_hypervisors(detailed=False)824 self.assertEqual(825 self.admin_clients("nova").hypervisors.list.return_value, result)826 self.admin_clients("nova").hypervisors.list.assert_called_once_with(827 False)828 self._test_atomic_action_timer(nova_scenario.atomic_actions(),829 "nova.list_hypervisors")830 def test__statistics_hypervisors(self):831 nova_scenario = utils.NovaScenario()832 result = nova_scenario._statistics_hypervisors()833 self.assertEqual(834 self.admin_clients("nova").hypervisors.statistics.return_value,835 result)836 (self.admin_clients("nova").hypervisors.statistics.837 assert_called_once_with())838 self._test_atomic_action_timer(nova_scenario.atomic_actions(),839 "nova.statistics_hypervisors")840 def test__get_hypervisor(self):841 hypervisor = mock.Mock()842 nova_scenario = utils.NovaScenario()843 result = nova_scenario._get_hypervisor(hypervisor)844 self.assertEqual(845 self.admin_clients("nova").hypervisors.get.return_value,846 result)847 self.admin_clients("nova").hypervisors.get.assert_called_once_with(848 hypervisor)849 self._test_atomic_action_timer(nova_scenario.atomic_actions(),850 "nova.get_hypervisor")851 def test__search_hypervisors(self):852 nova_scenario = utils.NovaScenario()853 nova_scenario._search_hypervisors("fake_hostname", servers=False)854 self.admin_clients("nova").hypervisors.search.assert_called_once_with(855 "fake_hostname", servers=False)856 self._test_atomic_action_timer(nova_scenario.atomic_actions(),857 "nova.search_hypervisors")858 def test__list_interfaces(self):859 nova_scenario = utils.NovaScenario()860 result = nova_scenario._list_interfaces("server")861 self.assertEqual(862 self.clients("nova").servers.interface_list.return_value,863 result)864 self.clients("nova").servers.interface_list.assert_called_once_with(865 "server")866 self._test_atomic_action_timer(nova_scenario.atomic_actions(),867 "nova.list_interfaces")868 def test__lock_server(self):869 server = mock.Mock()870 nova_scenario = utils.NovaScenario(context=self.context)871 nova_scenario._lock_server(server)872 server.lock.assert_called_once_with()873 self._test_atomic_action_timer(nova_scenario.atomic_actions(),874 "nova.lock_server")875 def test__unlock_server(self):876 server = mock.Mock()877 nova_scenario = utils.NovaScenario(context=self.context)878 nova_scenario._unlock_server(server)879 server.unlock.assert_called_once_with()880 self._test_atomic_action_timer(nova_scenario.atomic_actions(),881 "nova.unlock_server")882 def test__delete_network(self):883 nova_scenario = utils.NovaScenario()884 result = nova_scenario._delete_network("fake_net_id")885 self.assertEqual(886 self.admin_clients("nova").networks.delete.return_value,887 result)888 self.admin_clients("nova").networks.delete.assert_called_once_with(889 "fake_net_id")890 self._test_atomic_action_timer(nova_scenario.atomic_actions(),891 "nova.delete_network")892 def test__list_flavors(self):893 nova_scenario = utils.NovaScenario()894 result = nova_scenario._list_flavors(detailed=True, fakearg="fakearg")895 self.assertEqual(self.clients("nova").flavors.list.return_value,896 result)897 self.clients("nova").flavors.list.assert_called_once_with(898 True, fakearg="fakearg")899 self._test_atomic_action_timer(nova_scenario.atomic_actions(),900 "nova.list_flavors")901 def test__set_flavor_keys(self):902 flavor = mock.MagicMock()903 nova_scenario = utils.NovaScenario()904 extra_specs = {"fakeargs": "foo"}905 flavor.set_keys = mock.MagicMock()906 result = nova_scenario._set_flavor_keys(flavor, extra_specs)907 self.assertEqual(flavor.set_keys.return_value, result)908 flavor.set_keys.assert_called_once_with(extra_specs)909 self._test_atomic_action_timer(nova_scenario.atomic_actions(),910 "nova.set_flavor_keys")911 @ddt.data({},912 {"hypervisor": "foo_hypervisor"})913 @ddt.unpack914 def test__list_agents(self, hypervisor=None):915 nova_scenario = utils.NovaScenario()916 result = nova_scenario._list_agents(hypervisor)917 self.assertEqual(918 self.admin_clients("nova").agents.list.return_value, result)919 self.admin_clients("nova").agents.list.assert_called_once_with(920 hypervisor)921 self._test_atomic_action_timer(nova_scenario.atomic_actions(),922 "nova.list_agents")923 def test__list_aggregates(self):924 nova_scenario = utils.NovaScenario()925 result = nova_scenario._list_aggregates()926 self.assertEqual(927 self.admin_clients("nova").aggregates.list.return_value, result)928 self.admin_clients("nova").aggregates.list.assert_called_once_with()929 self._test_atomic_action_timer(nova_scenario.atomic_actions(),930 "nova.list_aggregates")931 def test__list_availability_zones(self):932 nova_scenario = utils.NovaScenario()933 result = nova_scenario._list_availability_zones(detailed=True)934 self.assertEqual(935 self.admin_clients("nova").availability_zones.list.return_value,936 result)937 avail_zones_client = self.admin_clients("nova").availability_zones938 avail_zones_client.list.assert_called_once_with(True)939 self._test_atomic_action_timer(nova_scenario.atomic_actions(),940 "nova.list_availability_zones")941 @ddt.data({},942 {"host": "foo_host"},943 {"binary": "foo_binary"},944 {"host": "foo_host", "binary": "foo_binary"})945 @ddt.unpack946 def test__list_services(self, host=None, binary=None):947 nova_scenario = utils.NovaScenario()948 result = nova_scenario._list_services(host=host, binary=binary)949 self.assertEqual(self.admin_clients("nova").services.list.return_value,950 result)951 self.admin_clients("nova").services.list.assert_called_once_with(952 host, binary)953 self._test_atomic_action_timer(nova_scenario.atomic_actions(),954 "nova.list_services")955 def test__list_flavor_access(self):956 nova_scenario = utils.NovaScenario()957 result = nova_scenario._list_flavor_access("foo_id")958 self.assertEqual(959 self.admin_clients("nova").flavor_access.list.return_value,960 result)961 self.admin_clients("nova").flavor_access.list.assert_called_once_with(962 flavor="foo_id")963 self._test_atomic_action_timer(nova_scenario.atomic_actions(),964 "nova.list_flavor_access")965 def test__add_tenant_access(self):966 tenant = mock.Mock()967 flavor = mock.Mock()968 nova_scenario = utils.NovaScenario()969 admin_clients = self.admin_clients("nova")970 result = nova_scenario._add_tenant_access(flavor.id, tenant.id)971 self.assertEqual(972 admin_clients.flavor_access.add_tenant_access.return_value,973 result)974 admin_clients.flavor_access.add_tenant_access.assert_called_once_with(975 flavor.id, tenant.id)976 self._test_atomic_action_timer(nova_scenario.atomic_actions(),977 "nova.add_tenant_access")978 def test__create_flavor(self):979 nova_scenario = utils.NovaScenario()980 random_name = "random_name"981 nova_scenario.generate_random_name = mock.Mock(982 return_value=random_name)983 result = nova_scenario._create_flavor(500, 1, 1,984 fakearg="fakearg")985 self.assertEqual(986 self.admin_clients("nova").flavors.create.return_value,987 result)988 self.admin_clients("nova").flavors.create.assert_called_once_with(989 random_name, 500, 1, 1, fakearg="fakearg")990 self._test_atomic_action_timer(nova_scenario.atomic_actions(),991 "nova.create_flavor")992 def test__get_flavor(self):993 nova_scenario = utils.NovaScenario()994 result = nova_scenario._get_flavor("foo_flavor_id")995 self.assertEqual(996 self.admin_clients("nova").flavors.get.return_value,997 result)998 self.admin_clients("nova").flavors.get.assert_called_once_with(999 "foo_flavor_id")1000 self._test_atomic_action_timer(nova_scenario.atomic_actions(),1001 "nova.get_flavor")1002 def test__delete_flavor(self):1003 nova_scenario = utils.NovaScenario()1004 result = nova_scenario._delete_flavor("foo_flavor_id")1005 self.assertEqual(1006 self.admin_clients("nova").flavors.delete.return_value,1007 result)1008 self.admin_clients("nova").flavors.delete.assert_called_once_with(1009 "foo_flavor_id")1010 self._test_atomic_action_timer(nova_scenario.atomic_actions(),1011 "nova.delete_flavor")1012 def test__update_server(self):1013 server = mock.Mock()1014 nova_scenario = utils.NovaScenario()1015 nova_scenario.generate_random_name = mock.Mock(1016 return_value="new_name")1017 server.update = mock.Mock()1018 result = nova_scenario._update_server(server)1019 self.assertEqual(result, server.update.return_value)1020 nova_scenario.generate_random_name.assert_called_once_with()1021 server.update.assert_called_once_with(name="new_name")1022 nova_scenario.generate_random_name.reset_mock()1023 server.update.reset_mock()1024 result = nova_scenario._update_server(server,1025 description="desp")1026 self.assertEqual(result, server.update.return_value)1027 nova_scenario.generate_random_name.assert_called_once_with()1028 server.update.assert_called_once_with(name="new_name",1029 description="desp")1030 self._test_atomic_action_timer(nova_scenario.atomic_actions(),1031 "nova.update_server", count=2)1032 def test_create_aggregate(self):1033 nova_scenario = utils.NovaScenario(context=self.context)1034 random_name = "random_name"1035 nova_scenario.generate_random_name = mock.Mock(1036 return_value=random_name)1037 result = nova_scenario._create_aggregate("nova")1038 self.assertEqual(1039 self.admin_clients("nova").aggregates.create.return_value,1040 result)1041 self.admin_clients("nova").aggregates.create.assert_called_once_with(1042 random_name, "nova")1043 self._test_atomic_action_timer(nova_scenario.atomic_actions(),1044 "nova.create_aggregate")1045 def test_delete_aggregate(self):1046 nova_scenario = utils.NovaScenario(context=self.context)1047 result = nova_scenario._delete_aggregate("fake_aggregate")1048 self.assertEqual(1049 self.admin_clients("nova").aggregates.delete.return_value,1050 result)1051 self.admin_clients("nova").aggregates.delete.assert_called_once_with(1052 "fake_aggregate")1053 self._test_atomic_action_timer(nova_scenario.atomic_actions(),1054 "nova.delete_aggregate")1055 def test_get_aggregate_details(self):1056 nova_scenario = utils.NovaScenario(context=self.context)1057 result = nova_scenario._get_aggregate_details("fake_aggregate")1058 self.assertEqual(1059 self.admin_clients("nova").aggregates.get_details.return_value,1060 result)1061 self.admin_clients(1062 "nova").aggregates.get_details.assert_called_once_with(1063 "fake_aggregate")1064 self._test_atomic_action_timer(nova_scenario.atomic_actions(),1065 "nova.get_aggregate_details")1066 def test_update_aggregate(self):1067 aggregate = mock.Mock()1068 nova_scenario = utils.NovaScenario(context=self.context)1069 nova_scenario.generate_random_name = mock.Mock(1070 return_value="random_name")1071 values = {"name": "random_name",1072 "availability_zone": "random_name"}1073 result = nova_scenario._update_aggregate(aggregate=aggregate)1074 self.assertEqual(1075 self.admin_clients("nova").aggregates.update.return_value,1076 result)1077 self.admin_clients("nova").aggregates.update.assert_called_once_with(1078 aggregate, values)1079 self._test_atomic_action_timer(nova_scenario.atomic_actions(),1080 "nova.update_aggregate")1081 def test_aggregate_add_host(self):1082 nova_scenario = utils.NovaScenario(context=self.context)1083 result = nova_scenario._aggregate_add_host("fake_agg", "fake_host")1084 self.assertEqual(1085 self.admin_clients("nova").aggregates.add_host.return_value,1086 result)1087 self.admin_clients("nova").aggregates.add_host.assert_called_once_with(1088 "fake_agg", "fake_host")1089 self._test_atomic_action_timer(nova_scenario.atomic_actions(),1090 "nova.aggregate_add_host")1091 def test_aggregate_remove_host(self):1092 nova_scenario = utils.NovaScenario(context=self.context)1093 result = nova_scenario._aggregate_remove_host("fake_agg", "fake_host")1094 self.assertEqual(1095 self.admin_clients("nova").aggregates.remove_host.return_value,1096 result)1097 self.admin_clients(1098 "nova").aggregates.remove_host.assert_called_once_with(1099 "fake_agg", "fake_host")1100 self._test_atomic_action_timer(nova_scenario.atomic_actions(),1101 "nova.aggregate_remove_host")1102 def test__uptime_hypervisor(self):1103 nova_scenario = utils.NovaScenario()1104 nova_scenario._uptime_hypervisor("fake_hostname")1105 self.admin_clients("nova").hypervisors.uptime.assert_called_once_with(1106 "fake_hostname")1107 self._test_atomic_action_timer(nova_scenario.atomic_actions(),1108 "nova.uptime_hypervisor")1109 def test__attach_interface(self):1110 fake_server = mock.Mock()1111 nova_scenario = utils.NovaScenario()1112 result = nova_scenario._attach_interface(fake_server, net_id="id")1113 self.assertEqual(1114 self.clients("nova").servers.interface_attach.return_value,1115 result)1116 self.clients("nova").servers.interface_attach.assert_called_once_with(1117 fake_server, None, "id", None)1118 self._test_atomic_action_timer(nova_scenario.atomic_actions(),1119 "nova.attach_interface")1120 def test_aggregate_set_metadata(self):1121 nova_scenario = utils.NovaScenario(context=self.context)1122 fake_metadata = {"test_metadata": "true"}1123 result = nova_scenario._aggregate_set_metadata("fake_aggregate",1124 fake_metadata)1125 self.assertEqual(1126 self.admin_clients("nova").aggregates.set_metadata.return_value,1127 result)1128 self.admin_clients(1129 "nova").aggregates.set_metadata.assert_called_once_with(1130 "fake_aggregate", fake_metadata)1131 self._test_atomic_action_timer(nova_scenario.atomic_actions(),...
compareResults.py
Source:compareResults.py
1import ROOT2import numpy3alex_prefix="/home/coradam/anu_sim_supera/alex_net/"4nova_prefix="/home/coradam/anu_sim_supera/nova_net/"5alex_files = [6"genie_anu_mc_12650850_131_supera_alex_cnn.root",7"genie_anu_mc_12650850_132_supera_alex_cnn.root",8"genie_anu_mc_12650850_133_supera_alex_cnn.root",9"genie_anu_mc_12650850_134_supera_alex_cnn.root",10"genie_anu_mc_12650850_135_supera_alex_cnn.root",11"genie_anu_mc_12650850_136_supera_alex_cnn.root",12"genie_anu_mc_12650850_138_supera_alex_cnn.root",13"genie_anu_mc_12650850_13_supera_alex_cnn.root",14"genie_anu_mc_12650850_141_supera_alex_cnn.root",15"genie_anu_mc_12650850_144_supera_alex_cnn.root",16"genie_anu_mc_12650850_145_supera_alex_cnn.root",17"genie_anu_mc_12650850_146_supera_alex_cnn.root",18"genie_anu_mc_12650850_147_supera_alex_cnn.root",19"genie_anu_mc_12650850_14_supera_alex_cnn.root",20"genie_anu_mc_12650850_150_supera_alex_cnn.root",21"genie_anu_mc_12650850_151_supera_alex_cnn.root",22"genie_anu_mc_12650850_153_supera_alex_cnn.root",23"genie_anu_mc_12650850_154_supera_alex_cnn.root",24"genie_anu_mc_12650850_156_supera_alex_cnn.root",25"genie_anu_mc_12650850_157_supera_alex_cnn.root",26"genie_anu_mc_12650850_158_supera_alex_cnn.root",27"genie_anu_mc_12650850_159_supera_alex_cnn.root",28"genie_anu_mc_12650850_15_supera_alex_cnn.root",29"genie_anu_mc_12650850_161_supera_alex_cnn.root",30"genie_anu_mc_12650850_163_supera_alex_cnn.root",31"genie_anu_mc_12650850_165_supera_alex_cnn.root",32"genie_anu_mc_12650850_166_supera_alex_cnn.root",33"genie_anu_mc_12650850_168_supera_alex_cnn.root",34"genie_anu_mc_12650850_169_supera_alex_cnn.root",35"genie_anu_mc_12650850_170_supera_alex_cnn.root",36"genie_anu_mc_12650850_171_supera_alex_cnn.root",37"genie_anu_mc_12650850_172_supera_alex_cnn.root",38"genie_anu_mc_12650850_174_supera_alex_cnn.root",39"genie_anu_mc_12650850_175_supera_alex_cnn.root",40"genie_anu_mc_12650850_176_supera_alex_cnn.root",41"genie_anu_mc_12650850_177_supera_alex_cnn.root",42"genie_anu_mc_12650850_179_supera_alex_cnn.root",43"genie_anu_mc_12650850_17_supera_alex_cnn.root",44"genie_anu_mc_12650850_180_supera_alex_cnn.root",45"genie_anu_mc_12650850_181_supera_alex_cnn.root",46"genie_anu_mc_12650850_183_supera_alex_cnn.root",47"genie_anu_mc_12650850_185_supera_alex_cnn.root",48"genie_anu_mc_12650850_186_supera_alex_cnn.root",49"genie_anu_mc_12650850_189_supera_alex_cnn.root",50"genie_anu_mc_12650850_190_supera_alex_cnn.root",51"genie_anu_mc_12650850_191_supera_alex_cnn.root",52"genie_anu_mc_12650850_192_supera_alex_cnn.root",53"genie_anu_mc_12650850_194_supera_alex_cnn.root",54"genie_anu_mc_12650850_195_supera_alex_cnn.root",55"genie_anu_mc_12650850_196_supera_alex_cnn.root",56"genie_anu_mc_12650850_197_supera_alex_cnn.root",57"genie_anu_mc_12650850_198_supera_alex_cnn.root",58"genie_anu_mc_12650850_199_supera_alex_cnn.root",59"genie_anu_mc_12650850_19_supera_alex_cnn.root",60"genie_anu_mc_12650850_1_supera_alex_cnn.root",61"genie_anu_mc_12650850_200_supera_alex_cnn.root",62"genie_anu_mc_12650850_201_supera_alex_cnn.root",63"genie_anu_mc_12650850_202_supera_alex_cnn.root",64"genie_anu_mc_12650850_204_supera_alex_cnn.root",65"genie_anu_mc_12650850_205_supera_alex_cnn.root",66"genie_anu_mc_12650850_207_supera_alex_cnn.root",67"genie_anu_mc_12650850_209_supera_alex_cnn.root",68"genie_anu_mc_12650850_211_supera_alex_cnn.root",69"genie_anu_mc_12650850_212_supera_alex_cnn.root",70"genie_anu_mc_12650850_213_supera_alex_cnn.root",71"genie_anu_mc_12650850_214_supera_alex_cnn.root",72"genie_anu_mc_12650850_215_supera_alex_cnn.root",73"genie_anu_mc_12650850_217_supera_alex_cnn.root",74"genie_anu_mc_12650850_219_supera_alex_cnn.root",75"genie_anu_mc_12650850_21_supera_alex_cnn.root",76"genie_anu_mc_12650850_220_supera_alex_cnn.root",77"genie_anu_mc_12650850_221_supera_alex_cnn.root",78"genie_anu_mc_12650850_222_supera_alex_cnn.root",79"genie_anu_mc_12650850_223_supera_alex_cnn.root",80"genie_anu_mc_12650850_224_supera_alex_cnn.root",81"genie_anu_mc_12650850_225_supera_alex_cnn.root",82"genie_anu_mc_12650850_22_supera_alex_cnn.root",83"genie_anu_mc_12650850_230_supera_alex_cnn.root",84"genie_anu_mc_12650850_231_supera_alex_cnn.root",85"genie_anu_mc_12650850_232_supera_alex_cnn.root",86"genie_anu_mc_12650850_233_supera_alex_cnn.root",87"genie_anu_mc_12650850_234_supera_alex_cnn.root",88"genie_anu_mc_12650850_236_supera_alex_cnn.root",89"genie_anu_mc_12650850_237_supera_alex_cnn.root",90"genie_anu_mc_12650850_238_supera_alex_cnn.root",91"genie_anu_mc_12650850_239_supera_alex_cnn.root",92"genie_anu_mc_12650850_23_supera_alex_cnn.root",93"genie_anu_mc_12650850_240_supera_alex_cnn.root",94"genie_anu_mc_12650850_244_supera_alex_cnn.root",95"genie_anu_mc_12650850_245_supera_alex_cnn.root",96"genie_anu_mc_12650850_246_supera_alex_cnn.root",97"genie_anu_mc_12650850_247_supera_alex_cnn.root",98"genie_anu_mc_12650850_24_supera_alex_cnn.root",99"genie_anu_mc_12650850_251_supera_alex_cnn.root",100"genie_anu_mc_12650850_252_supera_alex_cnn.root",101"genie_anu_mc_12650850_253_supera_alex_cnn.root",102"genie_anu_mc_12650850_254_supera_alex_cnn.root",103"genie_anu_mc_12650850_257_supera_alex_cnn.root",104"genie_anu_mc_12650850_258_supera_alex_cnn.root",105"genie_anu_mc_12650850_259_supera_alex_cnn.root",106"genie_anu_mc_12650850_25_supera_alex_cnn.root",107"genie_anu_mc_12650850_260_supera_alex_cnn.root",108"genie_anu_mc_12650850_261_supera_alex_cnn.root",109"genie_anu_mc_12650850_263_supera_alex_cnn.root",110"genie_anu_mc_12650850_264_supera_alex_cnn.root",111"genie_anu_mc_12650850_265_supera_alex_cnn.root",112"genie_anu_mc_12650850_268_supera_alex_cnn.root",113"genie_anu_mc_12650850_269_supera_alex_cnn.root",114"genie_anu_mc_12650850_270_supera_alex_cnn.root",115"genie_anu_mc_12650850_271_supera_alex_cnn.root",116"genie_anu_mc_12650850_272_supera_alex_cnn.root",117"genie_anu_mc_12650850_276_supera_alex_cnn.root",118"genie_anu_mc_12650850_278_supera_alex_cnn.root",119"genie_anu_mc_12650850_279_supera_alex_cnn.root",120"genie_anu_mc_12650850_27_supera_alex_cnn.root",121"genie_anu_mc_12650850_280_supera_alex_cnn.root",122"genie_anu_mc_12650850_281_supera_alex_cnn.root",123"genie_anu_mc_12650850_282_supera_alex_cnn.root",124"genie_anu_mc_12650850_283_supera_alex_cnn.root",125"genie_anu_mc_12650850_284_supera_alex_cnn.root",126"genie_anu_mc_12650850_285_supera_alex_cnn.root",127"genie_anu_mc_12650850_286_supera_alex_cnn.root",128"genie_anu_mc_12650850_287_supera_alex_cnn.root",129"genie_anu_mc_12650850_288_supera_alex_cnn.root",130"genie_anu_mc_12650850_289_supera_alex_cnn.root",131"genie_anu_mc_12650850_28_supera_alex_cnn.root",132"genie_anu_mc_12650850_291_supera_alex_cnn.root",133"genie_anu_mc_12650850_293_supera_alex_cnn.root",134"genie_anu_mc_12650850_295_supera_alex_cnn.root",135"genie_anu_mc_12650850_296_supera_alex_cnn.root",136"genie_anu_mc_12650850_2_supera_alex_cnn.root",137"genie_anu_mc_12650850_300_supera_alex_cnn.root",138"genie_anu_mc_12650850_301_supera_alex_cnn.root",139"genie_anu_mc_12650850_303_supera_alex_cnn.root",140"genie_anu_mc_12650850_304_supera_alex_cnn.root",141"genie_anu_mc_12650850_306_supera_alex_cnn.root",142"genie_anu_mc_12650850_308_supera_alex_cnn.root",143"genie_anu_mc_12650850_311_supera_alex_cnn.root",144"genie_anu_mc_12650850_312_supera_alex_cnn.root",145"genie_anu_mc_12650850_313_supera_alex_cnn.root",146"genie_anu_mc_12650850_314_supera_alex_cnn.root",147"genie_anu_mc_12650850_315_supera_alex_cnn.root",148"genie_anu_mc_12650850_317_supera_alex_cnn.root",149"genie_anu_mc_12650850_318_supera_alex_cnn.root",150"genie_anu_mc_12650850_31_supera_alex_cnn.root",151"genie_anu_mc_12650850_320_supera_alex_cnn.root",152"genie_anu_mc_12650850_321_supera_alex_cnn.root",153"genie_anu_mc_12650850_322_supera_alex_cnn.root",154"genie_anu_mc_12650850_323_supera_alex_cnn.root",155"genie_anu_mc_12650850_325_supera_alex_cnn.root",156"genie_anu_mc_12650850_326_supera_alex_cnn.root",157"genie_anu_mc_12650850_327_supera_alex_cnn.root",158"genie_anu_mc_12650850_328_supera_alex_cnn.root",159"genie_anu_mc_12650850_332_supera_alex_cnn.root",160"genie_anu_mc_12650850_333_supera_alex_cnn.root",161"genie_anu_mc_12650850_335_supera_alex_cnn.root",162"genie_anu_mc_12650850_336_supera_alex_cnn.root",163"genie_anu_mc_12650850_337_supera_alex_cnn.root",164"genie_anu_mc_12650850_338_supera_alex_cnn.root",165"genie_anu_mc_12650850_339_supera_alex_cnn.root",166"genie_anu_mc_12650850_33_supera_alex_cnn.root",167"genie_anu_mc_12650850_342_supera_alex_cnn.root",168"genie_anu_mc_12650850_345_supera_alex_cnn.root",169"genie_anu_mc_12650850_346_supera_alex_cnn.root",170"genie_anu_mc_12650850_348_supera_alex_cnn.root",171"genie_anu_mc_12650850_34_supera_alex_cnn.root",172"genie_anu_mc_12650850_350_supera_alex_cnn.root",173"genie_anu_mc_12650850_351_supera_alex_cnn.root",174"genie_anu_mc_12650850_352_supera_alex_cnn.root",175"genie_anu_mc_12650850_353_supera_alex_cnn.root",176"genie_anu_mc_12650850_354_supera_alex_cnn.root",177"genie_anu_mc_12650850_355_supera_alex_cnn.root",178"genie_anu_mc_12650850_356_supera_alex_cnn.root",179"genie_anu_mc_12650850_358_supera_alex_cnn.root",180"genie_anu_mc_12650850_359_supera_alex_cnn.root",181"genie_anu_mc_12650850_361_supera_alex_cnn.root",182"genie_anu_mc_12650850_362_supera_alex_cnn.root",183"genie_anu_mc_12650850_363_supera_alex_cnn.root",184"genie_anu_mc_12650850_364_supera_alex_cnn.root",185"genie_anu_mc_12650850_365_supera_alex_cnn.root",186"genie_anu_mc_12650850_366_supera_alex_cnn.root",187"genie_anu_mc_12650850_367_supera_alex_cnn.root",188"genie_anu_mc_12650850_369_supera_alex_cnn.root",189"genie_anu_mc_12650850_370_supera_alex_cnn.root",190"genie_anu_mc_12650850_371_supera_alex_cnn.root",191"genie_anu_mc_12650850_372_supera_alex_cnn.root",192"genie_anu_mc_12650850_374_supera_alex_cnn.root",193"genie_anu_mc_12650850_375_supera_alex_cnn.root",194"genie_anu_mc_12650850_376_supera_alex_cnn.root",195"genie_anu_mc_12650850_377_supera_alex_cnn.root",196"genie_anu_mc_12650850_379_supera_alex_cnn.root",197"genie_anu_mc_12650850_381_supera_alex_cnn.root",198"genie_anu_mc_12650850_383_supera_alex_cnn.root",199"genie_anu_mc_12650850_385_supera_alex_cnn.root",200"genie_anu_mc_12650850_386_supera_alex_cnn.root",201"genie_anu_mc_12650850_387_supera_alex_cnn.root",202"genie_anu_mc_12650850_388_supera_alex_cnn.root",203"genie_anu_mc_12650850_389_supera_alex_cnn.root",204"genie_anu_mc_12650850_390_supera_alex_cnn.root",205"genie_anu_mc_12650850_391_supera_alex_cnn.root",206"genie_anu_mc_12650850_394_supera_alex_cnn.root",207"genie_anu_mc_12650850_395_supera_alex_cnn.root",208"genie_anu_mc_12650850_396_supera_alex_cnn.root",209"genie_anu_mc_12650850_397_supera_alex_cnn.root",210"genie_anu_mc_12650850_398_supera_alex_cnn.root",211"genie_anu_mc_12650850_39_supera_alex_cnn.root",212"genie_anu_mc_12650850_3_supera_alex_cnn.root",213"genie_anu_mc_12650850_400_supera_alex_cnn.root",214"genie_anu_mc_12650850_401_supera_alex_cnn.root",215"genie_anu_mc_12650850_405_supera_alex_cnn.root",216"genie_anu_mc_12650850_409_supera_alex_cnn.root",217"genie_anu_mc_12650850_410_supera_alex_cnn.root",218"genie_anu_mc_12650850_414_supera_alex_cnn.root",219"genie_anu_mc_12650850_415_supera_alex_cnn.root",220"genie_anu_mc_12650850_416_supera_alex_cnn.root",221"genie_anu_mc_12650850_417_supera_alex_cnn.root",222"genie_anu_mc_12650850_419_supera_alex_cnn.root",223"genie_anu_mc_12650850_41_supera_alex_cnn.root",224"genie_anu_mc_12650850_420_supera_alex_cnn.root",225"genie_anu_mc_12650850_421_supera_alex_cnn.root",226"genie_anu_mc_12650850_422_supera_alex_cnn.root",227"genie_anu_mc_12650850_423_supera_alex_cnn.root",228"genie_anu_mc_12650850_428_supera_alex_cnn.root",229"genie_anu_mc_12650850_42_supera_alex_cnn.root",230"genie_anu_mc_12650850_430_supera_alex_cnn.root",231"genie_anu_mc_12650850_431_supera_alex_cnn.root",232"genie_anu_mc_12650850_432_supera_alex_cnn.root",233"genie_anu_mc_12650850_433_supera_alex_cnn.root",234"genie_anu_mc_12650850_434_supera_alex_cnn.root",235"genie_anu_mc_12650850_436_supera_alex_cnn.root",236"genie_anu_mc_12650850_437_supera_alex_cnn.root",237"genie_anu_mc_12650850_438_supera_alex_cnn.root",238"genie_anu_mc_12650850_442_supera_alex_cnn.root",239"genie_anu_mc_12650850_444_supera_alex_cnn.root",240"genie_anu_mc_12650850_445_supera_alex_cnn.root",241"genie_anu_mc_12650850_446_supera_alex_cnn.root",242"genie_anu_mc_12650850_447_supera_alex_cnn.root",243"genie_anu_mc_12650850_448_supera_alex_cnn.root",244"genie_anu_mc_12650850_449_supera_alex_cnn.root",245"genie_anu_mc_12650850_451_supera_alex_cnn.root",246"genie_anu_mc_12650850_452_supera_alex_cnn.root",247"genie_anu_mc_12650850_453_supera_alex_cnn.root",248"genie_anu_mc_12650850_454_supera_alex_cnn.root",249"genie_anu_mc_12650850_455_supera_alex_cnn.root",250"genie_anu_mc_12650850_456_supera_alex_cnn.root",251"genie_anu_mc_12650850_457_supera_alex_cnn.root",252"genie_anu_mc_12650850_458_supera_alex_cnn.root",253"genie_anu_mc_12650850_461_supera_alex_cnn.root",254"genie_anu_mc_12650850_463_supera_alex_cnn.root",255"genie_anu_mc_12650850_465_supera_alex_cnn.root",256"genie_anu_mc_12650850_466_supera_alex_cnn.root",257"genie_anu_mc_12650850_471_supera_alex_cnn.root",258"genie_anu_mc_12650850_472_supera_alex_cnn.root",259"genie_anu_mc_12650850_473_supera_alex_cnn.root",260"genie_anu_mc_12650850_475_supera_alex_cnn.root",261"genie_anu_mc_12650850_477_supera_alex_cnn.root",262"genie_anu_mc_12650850_478_supera_alex_cnn.root",263"genie_anu_mc_12650850_481_supera_alex_cnn.root",264"genie_anu_mc_12650850_482_supera_alex_cnn.root",265"genie_anu_mc_12650850_484_supera_alex_cnn.root",266"genie_anu_mc_12650850_485_supera_alex_cnn.root",267"genie_anu_mc_12650850_486_supera_alex_cnn.root",268"genie_anu_mc_12650850_48_supera_alex_cnn.root",269"genie_anu_mc_12650850_491_supera_alex_cnn.root",270"genie_anu_mc_12650850_493_supera_alex_cnn.root",271"genie_anu_mc_12650850_496_supera_alex_cnn.root",272"genie_anu_mc_12650850_497_supera_alex_cnn.root",273"genie_anu_mc_12650850_498_supera_alex_cnn.root",274"genie_anu_mc_12650850_499_supera_alex_cnn.root",275"genie_anu_mc_12650850_49_supera_alex_cnn.root",276"genie_anu_mc_12650850_4_supera_alex_cnn.root",277"genie_anu_mc_12650850_50_supera_alex_cnn.root",278"genie_anu_mc_12650850_51_supera_alex_cnn.root",279"genie_anu_mc_12650850_52_supera_alex_cnn.root",280"genie_anu_mc_12650850_53_supera_alex_cnn.root",281"genie_anu_mc_12650850_54_supera_alex_cnn.root",282"genie_anu_mc_12650850_55_supera_alex_cnn.root",283"genie_anu_mc_12650850_56_supera_alex_cnn.root",284"genie_anu_mc_12650850_57_supera_alex_cnn.root",285"genie_anu_mc_12650850_58_supera_alex_cnn.root",286"genie_anu_mc_12650850_60_supera_alex_cnn.root",287"genie_anu_mc_12650850_66_supera_alex_cnn.root",288"genie_anu_mc_12650850_67_supera_alex_cnn.root",289"genie_anu_mc_12650850_6_supera_alex_cnn.root",290"genie_anu_mc_12650850_70_supera_alex_cnn.root",291"genie_anu_mc_12650850_71_supera_alex_cnn.root",292"genie_anu_mc_12650850_73_supera_alex_cnn.root",293"genie_anu_mc_12650850_74_supera_alex_cnn.root",294"genie_anu_mc_12650850_76_supera_alex_cnn.root",295"genie_anu_mc_12650850_7_supera_alex_cnn.root",296"genie_anu_mc_12650850_80_supera_alex_cnn.root",297"genie_anu_mc_12650850_81_supera_alex_cnn.root",298"genie_anu_mc_12650850_83_supera_alex_cnn.root",299"genie_anu_mc_12650850_84_supera_alex_cnn.root",300"genie_anu_mc_12650850_85_supera_alex_cnn.root",301"genie_anu_mc_12650850_87_supera_alex_cnn.root",302"genie_anu_mc_12650850_88_supera_alex_cnn.root",303"genie_anu_mc_12650850_8_supera_alex_cnn.root",304"genie_anu_mc_12650850_90_supera_alex_cnn.root",305"genie_anu_mc_12650850_91_supera_alex_cnn.root",306"genie_anu_mc_12650850_92_supera_alex_cnn.root",307"genie_anu_mc_12650850_93_supera_alex_cnn.root",308"genie_anu_mc_12650850_94_supera_alex_cnn.root",309"genie_anu_mc_12650850_99_supera_alex_cnn.root",310"genie_anu_mc_12650850_9_supera_alex_cnn.root",311"genie_anu_mc_9557491_0_supera_alex_cnn.root",312]313# alex_file = "/home/coradam/anu_sim_supera/alex_net/genie_anu_mc_12650850_101_supera_alex_cnn.root"314nova_files = [315"genie_anu_mc_12650850_131_supera_nova_cnn.root",316"genie_anu_mc_12650850_132_supera_nova_cnn.root",317"genie_anu_mc_12650850_133_supera_nova_cnn.root",318"genie_anu_mc_12650850_134_supera_nova_cnn.root",319"genie_anu_mc_12650850_135_supera_nova_cnn.root",320"genie_anu_mc_12650850_136_supera_nova_cnn.root",321"genie_anu_mc_12650850_138_supera_nova_cnn.root",322"genie_anu_mc_12650850_13_supera_nova_cnn.root",323"genie_anu_mc_12650850_141_supera_nova_cnn.root",324"genie_anu_mc_12650850_144_supera_nova_cnn.root",325"genie_anu_mc_12650850_145_supera_nova_cnn.root",326"genie_anu_mc_12650850_146_supera_nova_cnn.root",327"genie_anu_mc_12650850_147_supera_nova_cnn.root",328"genie_anu_mc_12650850_14_supera_nova_cnn.root",329"genie_anu_mc_12650850_150_supera_nova_cnn.root",330"genie_anu_mc_12650850_151_supera_nova_cnn.root",331"genie_anu_mc_12650850_153_supera_nova_cnn.root",332"genie_anu_mc_12650850_154_supera_nova_cnn.root",333"genie_anu_mc_12650850_156_supera_nova_cnn.root",334"genie_anu_mc_12650850_157_supera_nova_cnn.root",335"genie_anu_mc_12650850_158_supera_nova_cnn.root",336"genie_anu_mc_12650850_159_supera_nova_cnn.root",337"genie_anu_mc_12650850_15_supera_nova_cnn.root",338"genie_anu_mc_12650850_161_supera_nova_cnn.root",339"genie_anu_mc_12650850_163_supera_nova_cnn.root",340"genie_anu_mc_12650850_165_supera_nova_cnn.root",341"genie_anu_mc_12650850_166_supera_nova_cnn.root",342"genie_anu_mc_12650850_168_supera_nova_cnn.root",343"genie_anu_mc_12650850_169_supera_nova_cnn.root",344"genie_anu_mc_12650850_170_supera_nova_cnn.root",345"genie_anu_mc_12650850_171_supera_nova_cnn.root",346"genie_anu_mc_12650850_172_supera_nova_cnn.root",347"genie_anu_mc_12650850_174_supera_nova_cnn.root",348"genie_anu_mc_12650850_175_supera_nova_cnn.root",349"genie_anu_mc_12650850_176_supera_nova_cnn.root",350"genie_anu_mc_12650850_177_supera_nova_cnn.root",351"genie_anu_mc_12650850_179_supera_nova_cnn.root",352"genie_anu_mc_12650850_17_supera_nova_cnn.root",353"genie_anu_mc_12650850_180_supera_nova_cnn.root",354"genie_anu_mc_12650850_181_supera_nova_cnn.root",355"genie_anu_mc_12650850_183_supera_nova_cnn.root",356"genie_anu_mc_12650850_185_supera_nova_cnn.root",357"genie_anu_mc_12650850_186_supera_nova_cnn.root",358"genie_anu_mc_12650850_189_supera_nova_cnn.root",359"genie_anu_mc_12650850_190_supera_nova_cnn.root",360"genie_anu_mc_12650850_191_supera_nova_cnn.root",361"genie_anu_mc_12650850_192_supera_nova_cnn.root",362"genie_anu_mc_12650850_194_supera_nova_cnn.root",363"genie_anu_mc_12650850_195_supera_nova_cnn.root",364"genie_anu_mc_12650850_196_supera_nova_cnn.root",365"genie_anu_mc_12650850_197_supera_nova_cnn.root",366"genie_anu_mc_12650850_198_supera_nova_cnn.root",367"genie_anu_mc_12650850_199_supera_nova_cnn.root",368"genie_anu_mc_12650850_19_supera_nova_cnn.root",369"genie_anu_mc_12650850_1_supera_nova_cnn.root",370"genie_anu_mc_12650850_200_supera_nova_cnn.root",371"genie_anu_mc_12650850_201_supera_nova_cnn.root",372"genie_anu_mc_12650850_202_supera_nova_cnn.root",373"genie_anu_mc_12650850_204_supera_nova_cnn.root",374"genie_anu_mc_12650850_205_supera_nova_cnn.root",375"genie_anu_mc_12650850_207_supera_nova_cnn.root",376"genie_anu_mc_12650850_209_supera_nova_cnn.root",377"genie_anu_mc_12650850_211_supera_nova_cnn.root",378"genie_anu_mc_12650850_212_supera_nova_cnn.root",379"genie_anu_mc_12650850_213_supera_nova_cnn.root",380"genie_anu_mc_12650850_214_supera_nova_cnn.root",381"genie_anu_mc_12650850_215_supera_nova_cnn.root",382"genie_anu_mc_12650850_217_supera_nova_cnn.root",383"genie_anu_mc_12650850_219_supera_nova_cnn.root",384"genie_anu_mc_12650850_21_supera_nova_cnn.root",385"genie_anu_mc_12650850_220_supera_nova_cnn.root",386"genie_anu_mc_12650850_221_supera_nova_cnn.root",387"genie_anu_mc_12650850_222_supera_nova_cnn.root",388"genie_anu_mc_12650850_223_supera_nova_cnn.root",389"genie_anu_mc_12650850_224_supera_nova_cnn.root",390"genie_anu_mc_12650850_225_supera_nova_cnn.root",391"genie_anu_mc_12650850_22_supera_nova_cnn.root",392"genie_anu_mc_12650850_230_supera_nova_cnn.root",393"genie_anu_mc_12650850_231_supera_nova_cnn.root",394"genie_anu_mc_12650850_232_supera_nova_cnn.root",395"genie_anu_mc_12650850_233_supera_nova_cnn.root",396"genie_anu_mc_12650850_234_supera_nova_cnn.root",397"genie_anu_mc_12650850_236_supera_nova_cnn.root",398"genie_anu_mc_12650850_237_supera_nova_cnn.root",399"genie_anu_mc_12650850_238_supera_nova_cnn.root",400"genie_anu_mc_12650850_239_supera_nova_cnn.root",401"genie_anu_mc_12650850_23_supera_nova_cnn.root",402"genie_anu_mc_12650850_240_supera_nova_cnn.root",403"genie_anu_mc_12650850_244_supera_nova_cnn.root",404"genie_anu_mc_12650850_245_supera_nova_cnn.root",405"genie_anu_mc_12650850_246_supera_nova_cnn.root",406"genie_anu_mc_12650850_247_supera_nova_cnn.root",407"genie_anu_mc_12650850_24_supera_nova_cnn.root",408"genie_anu_mc_12650850_251_supera_nova_cnn.root",409"genie_anu_mc_12650850_252_supera_nova_cnn.root",410"genie_anu_mc_12650850_253_supera_nova_cnn.root",411"genie_anu_mc_12650850_254_supera_nova_cnn.root",412"genie_anu_mc_12650850_257_supera_nova_cnn.root",413"genie_anu_mc_12650850_258_supera_nova_cnn.root",414"genie_anu_mc_12650850_259_supera_nova_cnn.root",415"genie_anu_mc_12650850_25_supera_nova_cnn.root",416"genie_anu_mc_12650850_260_supera_nova_cnn.root",417"genie_anu_mc_12650850_261_supera_nova_cnn.root",418"genie_anu_mc_12650850_263_supera_nova_cnn.root",419"genie_anu_mc_12650850_264_supera_nova_cnn.root",420"genie_anu_mc_12650850_265_supera_nova_cnn.root",421"genie_anu_mc_12650850_268_supera_nova_cnn.root",422"genie_anu_mc_12650850_269_supera_nova_cnn.root",423"genie_anu_mc_12650850_270_supera_nova_cnn.root",424"genie_anu_mc_12650850_271_supera_nova_cnn.root",425"genie_anu_mc_12650850_272_supera_nova_cnn.root",426"genie_anu_mc_12650850_276_supera_nova_cnn.root",427"genie_anu_mc_12650850_278_supera_nova_cnn.root",428"genie_anu_mc_12650850_279_supera_nova_cnn.root",429"genie_anu_mc_12650850_27_supera_nova_cnn.root",430"genie_anu_mc_12650850_280_supera_nova_cnn.root",431"genie_anu_mc_12650850_281_supera_nova_cnn.root",432"genie_anu_mc_12650850_282_supera_nova_cnn.root",433"genie_anu_mc_12650850_283_supera_nova_cnn.root",434"genie_anu_mc_12650850_284_supera_nova_cnn.root",435"genie_anu_mc_12650850_285_supera_nova_cnn.root",436"genie_anu_mc_12650850_286_supera_nova_cnn.root",437"genie_anu_mc_12650850_287_supera_nova_cnn.root",438"genie_anu_mc_12650850_288_supera_nova_cnn.root",439"genie_anu_mc_12650850_289_supera_nova_cnn.root",440"genie_anu_mc_12650850_28_supera_nova_cnn.root",441"genie_anu_mc_12650850_291_supera_nova_cnn.root",442"genie_anu_mc_12650850_293_supera_nova_cnn.root",443"genie_anu_mc_12650850_295_supera_nova_cnn.root",444"genie_anu_mc_12650850_296_supera_nova_cnn.root",445"genie_anu_mc_12650850_2_supera_nova_cnn.root",446"genie_anu_mc_12650850_300_supera_nova_cnn.root",447"genie_anu_mc_12650850_301_supera_nova_cnn.root",448"genie_anu_mc_12650850_303_supera_nova_cnn.root",449"genie_anu_mc_12650850_304_supera_nova_cnn.root",450"genie_anu_mc_12650850_306_supera_nova_cnn.root",451"genie_anu_mc_12650850_308_supera_nova_cnn.root",452"genie_anu_mc_12650850_311_supera_nova_cnn.root",453"genie_anu_mc_12650850_312_supera_nova_cnn.root",454"genie_anu_mc_12650850_313_supera_nova_cnn.root",455"genie_anu_mc_12650850_314_supera_nova_cnn.root",456"genie_anu_mc_12650850_315_supera_nova_cnn.root",457"genie_anu_mc_12650850_317_supera_nova_cnn.root",458"genie_anu_mc_12650850_318_supera_nova_cnn.root",459"genie_anu_mc_12650850_31_supera_nova_cnn.root",460"genie_anu_mc_12650850_320_supera_nova_cnn.root",461"genie_anu_mc_12650850_321_supera_nova_cnn.root",462"genie_anu_mc_12650850_322_supera_nova_cnn.root",463"genie_anu_mc_12650850_323_supera_nova_cnn.root",464"genie_anu_mc_12650850_325_supera_nova_cnn.root",465"genie_anu_mc_12650850_326_supera_nova_cnn.root",466"genie_anu_mc_12650850_327_supera_nova_cnn.root",467"genie_anu_mc_12650850_328_supera_nova_cnn.root",468"genie_anu_mc_12650850_332_supera_nova_cnn.root",469"genie_anu_mc_12650850_333_supera_nova_cnn.root",470"genie_anu_mc_12650850_335_supera_nova_cnn.root",471"genie_anu_mc_12650850_336_supera_nova_cnn.root",472"genie_anu_mc_12650850_337_supera_nova_cnn.root",473"genie_anu_mc_12650850_338_supera_nova_cnn.root",474"genie_anu_mc_12650850_339_supera_nova_cnn.root",475"genie_anu_mc_12650850_33_supera_nova_cnn.root",476"genie_anu_mc_12650850_342_supera_nova_cnn.root",477"genie_anu_mc_12650850_345_supera_nova_cnn.root",478"genie_anu_mc_12650850_346_supera_nova_cnn.root",479"genie_anu_mc_12650850_348_supera_nova_cnn.root",480"genie_anu_mc_12650850_34_supera_nova_cnn.root",481"genie_anu_mc_12650850_350_supera_nova_cnn.root",482"genie_anu_mc_12650850_351_supera_nova_cnn.root",483"genie_anu_mc_12650850_352_supera_nova_cnn.root",484"genie_anu_mc_12650850_353_supera_nova_cnn.root",485"genie_anu_mc_12650850_354_supera_nova_cnn.root",486"genie_anu_mc_12650850_355_supera_nova_cnn.root",487"genie_anu_mc_12650850_356_supera_nova_cnn.root",488"genie_anu_mc_12650850_358_supera_nova_cnn.root",489"genie_anu_mc_12650850_359_supera_nova_cnn.root",490"genie_anu_mc_12650850_361_supera_nova_cnn.root",491"genie_anu_mc_12650850_362_supera_nova_cnn.root",492"genie_anu_mc_12650850_363_supera_nova_cnn.root",493"genie_anu_mc_12650850_364_supera_nova_cnn.root",494"genie_anu_mc_12650850_365_supera_nova_cnn.root",495"genie_anu_mc_12650850_366_supera_nova_cnn.root",496"genie_anu_mc_12650850_367_supera_nova_cnn.root",497"genie_anu_mc_12650850_369_supera_nova_cnn.root",498"genie_anu_mc_12650850_370_supera_nova_cnn.root",499"genie_anu_mc_12650850_371_supera_nova_cnn.root",500"genie_anu_mc_12650850_372_supera_nova_cnn.root",501"genie_anu_mc_12650850_374_supera_nova_cnn.root",502"genie_anu_mc_12650850_375_supera_nova_cnn.root",503"genie_anu_mc_12650850_376_supera_nova_cnn.root",504"genie_anu_mc_12650850_377_supera_nova_cnn.root",505"genie_anu_mc_12650850_379_supera_nova_cnn.root",506"genie_anu_mc_12650850_381_supera_nova_cnn.root",507"genie_anu_mc_12650850_383_supera_nova_cnn.root",508"genie_anu_mc_12650850_385_supera_nova_cnn.root",509"genie_anu_mc_12650850_386_supera_nova_cnn.root",510"genie_anu_mc_12650850_387_supera_nova_cnn.root",511"genie_anu_mc_12650850_388_supera_nova_cnn.root",512"genie_anu_mc_12650850_389_supera_nova_cnn.root",513"genie_anu_mc_12650850_390_supera_nova_cnn.root",514"genie_anu_mc_12650850_391_supera_nova_cnn.root",515"genie_anu_mc_12650850_394_supera_nova_cnn.root",516"genie_anu_mc_12650850_395_supera_nova_cnn.root",517"genie_anu_mc_12650850_396_supera_nova_cnn.root",518"genie_anu_mc_12650850_397_supera_nova_cnn.root",519"genie_anu_mc_12650850_398_supera_nova_cnn.root",520"genie_anu_mc_12650850_39_supera_nova_cnn.root",521"genie_anu_mc_12650850_3_supera_nova_cnn.root",522"genie_anu_mc_12650850_400_supera_nova_cnn.root",523"genie_anu_mc_12650850_401_supera_nova_cnn.root",524"genie_anu_mc_12650850_405_supera_nova_cnn.root",525"genie_anu_mc_12650850_409_supera_nova_cnn.root",526"genie_anu_mc_12650850_410_supera_nova_cnn.root",527"genie_anu_mc_12650850_414_supera_nova_cnn.root",528"genie_anu_mc_12650850_415_supera_nova_cnn.root",529"genie_anu_mc_12650850_416_supera_nova_cnn.root",530"genie_anu_mc_12650850_417_supera_nova_cnn.root",531"genie_anu_mc_12650850_419_supera_nova_cnn.root",532"genie_anu_mc_12650850_41_supera_nova_cnn.root",533"genie_anu_mc_12650850_420_supera_nova_cnn.root",534"genie_anu_mc_12650850_421_supera_nova_cnn.root",535"genie_anu_mc_12650850_422_supera_nova_cnn.root",536"genie_anu_mc_12650850_423_supera_nova_cnn.root",537"genie_anu_mc_12650850_428_supera_nova_cnn.root",538"genie_anu_mc_12650850_42_supera_nova_cnn.root",539"genie_anu_mc_12650850_430_supera_nova_cnn.root",540"genie_anu_mc_12650850_431_supera_nova_cnn.root",541"genie_anu_mc_12650850_432_supera_nova_cnn.root",542"genie_anu_mc_12650850_433_supera_nova_cnn.root",543"genie_anu_mc_12650850_434_supera_nova_cnn.root",544"genie_anu_mc_12650850_436_supera_nova_cnn.root",545"genie_anu_mc_12650850_437_supera_nova_cnn.root",546"genie_anu_mc_12650850_438_supera_nova_cnn.root",547"genie_anu_mc_12650850_442_supera_nova_cnn.root",548"genie_anu_mc_12650850_444_supera_nova_cnn.root",549"genie_anu_mc_12650850_445_supera_nova_cnn.root",550"genie_anu_mc_12650850_446_supera_nova_cnn.root",551"genie_anu_mc_12650850_447_supera_nova_cnn.root",552"genie_anu_mc_12650850_448_supera_nova_cnn.root",553"genie_anu_mc_12650850_449_supera_nova_cnn.root",554"genie_anu_mc_12650850_451_supera_nova_cnn.root",555"genie_anu_mc_12650850_452_supera_nova_cnn.root",556"genie_anu_mc_12650850_453_supera_nova_cnn.root",557"genie_anu_mc_12650850_454_supera_nova_cnn.root",558"genie_anu_mc_12650850_455_supera_nova_cnn.root",559"genie_anu_mc_12650850_456_supera_nova_cnn.root",560"genie_anu_mc_12650850_457_supera_nova_cnn.root",561"genie_anu_mc_12650850_458_supera_nova_cnn.root",562"genie_anu_mc_12650850_461_supera_nova_cnn.root",563"genie_anu_mc_12650850_463_supera_nova_cnn.root",564"genie_anu_mc_12650850_465_supera_nova_cnn.root",565"genie_anu_mc_12650850_466_supera_nova_cnn.root",566"genie_anu_mc_12650850_471_supera_nova_cnn.root",567"genie_anu_mc_12650850_472_supera_nova_cnn.root",568"genie_anu_mc_12650850_473_supera_nova_cnn.root",569"genie_anu_mc_12650850_475_supera_nova_cnn.root",570"genie_anu_mc_12650850_477_supera_nova_cnn.root",571"genie_anu_mc_12650850_478_supera_nova_cnn.root",572"genie_anu_mc_12650850_481_supera_nova_cnn.root",573"genie_anu_mc_12650850_482_supera_nova_cnn.root",574"genie_anu_mc_12650850_484_supera_nova_cnn.root",575"genie_anu_mc_12650850_485_supera_nova_cnn.root",576"genie_anu_mc_12650850_486_supera_nova_cnn.root",577"genie_anu_mc_12650850_48_supera_nova_cnn.root",578"genie_anu_mc_12650850_491_supera_nova_cnn.root",579"genie_anu_mc_12650850_493_supera_nova_cnn.root",580"genie_anu_mc_12650850_496_supera_nova_cnn.root",581"genie_anu_mc_12650850_497_supera_nova_cnn.root",582"genie_anu_mc_12650850_498_supera_nova_cnn.root",583"genie_anu_mc_12650850_499_supera_nova_cnn.root",584"genie_anu_mc_12650850_49_supera_nova_cnn.root",585"genie_anu_mc_12650850_4_supera_nova_cnn.root",586"genie_anu_mc_12650850_50_supera_nova_cnn.root",587"genie_anu_mc_12650850_51_supera_nova_cnn.root",588"genie_anu_mc_12650850_52_supera_nova_cnn.root",589"genie_anu_mc_12650850_53_supera_nova_cnn.root",590"genie_anu_mc_12650850_54_supera_nova_cnn.root",591"genie_anu_mc_12650850_55_supera_nova_cnn.root",592"genie_anu_mc_12650850_56_supera_nova_cnn.root",593"genie_anu_mc_12650850_57_supera_nova_cnn.root",594"genie_anu_mc_12650850_58_supera_nova_cnn.root",595"genie_anu_mc_12650850_60_supera_nova_cnn.root",596"genie_anu_mc_12650850_66_supera_nova_cnn.root",597"genie_anu_mc_12650850_67_supera_nova_cnn.root",598"genie_anu_mc_12650850_6_supera_nova_cnn.root",599"genie_anu_mc_12650850_70_supera_nova_cnn.root",600"genie_anu_mc_12650850_71_supera_nova_cnn.root",601"genie_anu_mc_12650850_73_supera_nova_cnn.root",602"genie_anu_mc_12650850_74_supera_nova_cnn.root",603"genie_anu_mc_12650850_76_supera_nova_cnn.root",604"genie_anu_mc_12650850_7_supera_nova_cnn.root",605"genie_anu_mc_12650850_80_supera_nova_cnn.root",606"genie_anu_mc_12650850_81_supera_nova_cnn.root",607"genie_anu_mc_12650850_83_supera_nova_cnn.root",608"genie_anu_mc_12650850_84_supera_nova_cnn.root",609"genie_anu_mc_12650850_85_supera_nova_cnn.root",610"genie_anu_mc_12650850_87_supera_nova_cnn.root",611"genie_anu_mc_12650850_88_supera_nova_cnn.root",612"genie_anu_mc_12650850_8_supera_nova_cnn.root",613"genie_anu_mc_12650850_90_supera_nova_cnn.root",614"genie_anu_mc_12650850_91_supera_nova_cnn.root",615"genie_anu_mc_12650850_92_supera_nova_cnn.root",616"genie_anu_mc_12650850_93_supera_nova_cnn.root",617"genie_anu_mc_12650850_94_supera_nova_cnn.root",618"genie_anu_mc_12650850_99_supera_nova_cnn.root",619"genie_anu_mc_12650850_9_supera_nova_cnn.root",620"genie_anu_mc_9557491_0_supera_nova_cnn.root",621]622# nova_file = "/home/coradam/anu_sim_supera/nova_net/genie_anu_mc_12650850_101_supera_nova_cnn.root"623alex_nue_scores = []624nova_nue_scores = []625for af, nf in zip(alex_files, nova_files):626 f_nova = ROOT.TFile.Open(nova_prefix + nf)627 f_alex = ROOT.TFile.Open(alex_prefix + af)628 # retrieve the ntuple of interest629 alex_chain = f_alex.Get('alex_net_cnn_tree')630 nova_chain = f_nova.Get('nova_net_cnn_tree')631 entries = alex_chain.GetEntriesFast()632 for jentry in xrange(entries):633 # get the next tree in the chain and verify634 ientry = alex_chain.LoadTree(jentry)635 if ientry < 0:636 break637 ientry = nova_chain.LoadTree(jentry)638 if ientry < 0:639 break640 # copy next entry into memory and verify641 nb = alex_chain.GetEntry(jentry)642 if nb <= 0:643 continue644 # copy next entry into memory and verify645 nb = nova_chain.GetEntry(jentry)646 if nb <= 0:647 continue648 # # use the values directly from the tree649 # nEvent = int(alex_chain.Event)650 # if nEvent < 0:651 # continue652 alex_nue_scores.append(alex_chain.NueScore)653 nova_nue_scores.append(nova_chain.NueScore)654from matplotlib import pyplot as plt655bins = numpy.arange(0, 1, 0.01)656numpy.histogram(alex_nue_scores)657plt.hist2d(alex_nue_scores, nova_nue_scores, bins=bins, cmin=0.01)658plt.xlabel("Alex Net Score")659plt.ylabel("Nova Net Score")660plt.grid(True)...
compute.py
Source:compute.py
1# vim: tabstop=4 shiftwidth=4 softtabstop=42# Copyright (c) 2011 OpenStack, LLC.3# All Rights Reserved.4#5# Licensed under the Apache License, Version 2.0 (the "License"); you may6# not use this file except in compliance with the License. You may obtain7# a copy of the License at8#9# http://www.apache.org/licenses/LICENSE-2.010#11# Unless required by applicable law or agreed to in writing, software12# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the14# License for the specific language governing permissions and limitations15# under the License.16from nova.rootwrap import filters17filterlist = [18 # This line was patched by Puppet19 filters.CommandFilter("/usr/bin/virsh", "root"),20 # nova/virt/disk/mount.py: 'kpartx', '-a', device21 # nova/virt/disk/mount.py: 'kpartx', '-d', device22 filters.CommandFilter("/sbin/kpartx", "root"),23 # nova/virt/disk/mount.py: 'tune2fs', '-c', 0, '-i', 0, mapped_device24 # nova/virt/xenapi/vm_utils.py: "tune2fs", "-O ^has_journal", part_path25 # nova/virt/xenapi/vm_utils.py: "tune2fs", "-j", partition_path26 filters.CommandFilter("/sbin/tune2fs", "root"),27 # nova/virt/disk/mount.py: 'mount', mapped_device, mount_dir28 # nova/virt/xenapi/vm_utils.py: 'mount', '-t', 'ext2,ext3,ext4,reiserfs'..29 filters.CommandFilter("/bin/mount", "root"),30 # nova/virt/disk/mount.py: 'umount', mapped_device31 # nova/virt/xenapi/vm_utils.py: 'umount', dev_path32 filters.CommandFilter("/bin/umount", "root"),33 # nova/virt/disk/nbd.py: 'qemu-nbd', '-c', device, image34 # nova/virt/disk/nbd.py: 'qemu-nbd', '-d', device35 filters.CommandFilter("/usr/bin/qemu-nbd", "root"),36 # nova/virt/disk/loop.py: 'losetup', '--find', '--show', image37 # nova/virt/disk/loop.py: 'losetup', '--detach', device38 filters.CommandFilter("/sbin/losetup", "root"),39 # nova/virt/disk/guestfs.py: 'guestmount', '--rw', '-a', image, '-i'40 # nova/virt/disk/guestfs.py: 'guestmount', '--rw', '-a', image, '-m' dev41 filters.CommandFilter("/usr/bin/guestmount", "root"),42 # nova/virt/disk/guestfs.py: 'fusermount', 'u', mount_dir43 filters.CommandFilter("/bin/fusermount", "root"),44 filters.CommandFilter("/usr/bin/fusermount", "root"),45 # nova/virt/disk/api.py: 'tee', metadata_path46 # nova/virt/disk/api.py: 'tee', '-a', keyfile47 # nova/virt/disk/api.py: 'tee', netfile48 filters.CommandFilter("/usr/bin/tee", "root"),49 # nova/virt/disk/api.py: 'mkdir', '-p', sshdir50 # nova/virt/disk/api.py: 'mkdir', '-p', netdir51 filters.CommandFilter("/bin/mkdir", "root"),52 # nova/virt/disk/api.py: 'chown', 'root', sshdir53 # nova/virt/disk/api.py: 'chown', 'root:root', netdir54 # nova/virt/libvirt/connection.py: 'chown', os.getuid(), console_log55 # nova/virt/libvirt/connection.py: 'chown', os.getuid(), console_log56 # nova/virt/libvirt/connection.py: 'chown', 'root', basepath('disk')57 # nova/utils.py: 'chown', owner_uid, path58 filters.CommandFilter("/bin/chown", "root"),59 # nova/virt/disk/api.py: 'chmod', '700', sshdir60 # nova/virt/disk/api.py: 'chmod', 755, netdir61 filters.CommandFilter("/bin/chmod", "root"),62 # nova/virt/disk/api.py: 'cp', os.path.join(fs...63 filters.CommandFilter("/bin/cp", "root"),64 # nova/virt/libvirt/vif.py: 'ip', 'tuntap', 'add', dev, 'mode', 'tap'65 # nova/virt/libvirt/vif.py: 'ip', 'link', 'set', dev, 'up'66 # nova/virt/libvirt/vif.py: 'ip', 'link', 'delete', dev67 # nova/network/linux_net.py: 'ip', 'addr', 'add', str(floating_ip)+'/32'i..68 # nova/network/linux_net.py: 'ip', 'addr', 'del', str(floating_ip)+'/32'..69 # nova/network/linux_net.py: 'ip', 'addr', 'add', '169.254.169.254/32',..70 # nova/network/linux_net.py: 'ip', 'addr', 'show', 'dev', dev, 'scope',..71 # nova/network/linux_net.py: 'ip', 'addr', 'del/add', ip_params, dev)72 # nova/network/linux_net.py: 'ip', 'addr', 'del', params, fields[-1]73 # nova/network/linux_net.py: 'ip', 'addr', 'add', params, bridge74 # nova/network/linux_net.py: 'ip', '-f', 'inet6', 'addr', 'change', ..75 # nova/network/linux_net.py: 'ip', 'link', 'set', 'dev', dev, 'promisc',..76 # nova/network/linux_net.py: 'ip', 'link', 'add', 'link', bridge_if ...77 # nova/network/linux_net.py: 'ip', 'link', 'set', interface, "address",..78 # nova/network/linux_net.py: 'ip', 'link', 'set', interface, 'up'79 # nova/network/linux_net.py: 'ip', 'link', 'set', bridge, 'up'80 # nova/network/linux_net.py: 'ip', 'addr', 'show', 'dev', interface, ..81 # nova/network/linux_net.py: 'ip', 'link', 'set', dev, "address", ..82 # nova/network/linux_net.py: 'ip', 'link', 'set', dev, 'up'83 filters.CommandFilter("/sbin/ip", "root"),84 # nova/virt/libvirt/vif.py: 'tunctl', '-b', '-t', dev85 # nova/network/linux_net.py: 'tunctl', '-b', '-t', dev86 filters.CommandFilter("/usr/sbin/tunctl", "root"),87 # nova/virt/libvirt/vif.py: 'ovs-vsctl', ...88 # nova/virt/libvirt/vif.py: 'ovs-vsctl', 'del-port', ...89 # nova/network/linux_net.py: 'ovs-vsctl', ....90 filters.CommandFilter("/usr/bin/ovs-vsctl", "root"),91 # nova/network/linux_net.py: 'ovs-ofctl', ....92 filters.CommandFilter("/usr/bin/ovs-ofctl", "root"),93 # nova/virt/libvirt/connection.py: 'dd', "if=%s" % virsh_output, ...94 filters.CommandFilter("/bin/dd", "root"),95 # nova/virt/xenapi/volume_utils.py: 'iscsiadm', '-m', ...96 filters.CommandFilter("/sbin/iscsiadm", "root"),97 # nova/virt/xenapi/vm_utils.py: "parted", "--script", ...98 # nova/virt/xenapi/vm_utils.py: 'parted', '--script', dev_path, ..*.99 filters.CommandFilter("/sbin/parted", "root"),100 # nova/virt/xenapi/vm_utils.py: fdisk %(dev_path)s101 filters.CommandFilter("/sbin/fdisk", "root"),102 # nova/virt/xenapi/vm_utils.py: "e2fsck", "-f", "-p", partition_path103 filters.CommandFilter("/sbin/e2fsck", "root"),104 # nova/virt/xenapi/vm_utils.py: "resize2fs", partition_path105 filters.CommandFilter("/sbin/resize2fs", "root"),106 # nova/network/linux_net.py: 'ip[6]tables-save' % (cmd,), '-t', ...107 filters.CommandFilter("/sbin/iptables-save", "root"),108 filters.CommandFilter("/sbin/ip6tables-save", "root"),109 # nova/network/linux_net.py: 'ip[6]tables-restore' % (cmd,)110 filters.CommandFilter("/sbin/iptables-restore", "root"),111 filters.CommandFilter("/sbin/ip6tables-restore", "root"),112 # nova/network/linux_net.py: 'arping', '-U', floating_ip, '-A', '-I', ...113 # nova/network/linux_net.py: 'arping', '-U', network_ref['dhcp_server'],..114 filters.CommandFilter("/usr/bin/arping", "root"),115 # nova/network/linux_net.py: 'route', '-n'116 # nova/network/linux_net.py: 'route', 'del', 'default', 'gw'117 # nova/network/linux_net.py: 'route', 'add', 'default', 'gw'118 # nova/network/linux_net.py: 'route', '-n'119 # nova/network/linux_net.py: 'route', 'del', 'default', 'gw', old_gw, ..120 # nova/network/linux_net.py: 'route', 'add', 'default', 'gw', old_gateway121 filters.CommandFilter("/sbin/route", "root"),122 # nova/network/linux_net.py: 'dhcp_release', dev, address, mac_address123 filters.CommandFilter("/usr/bin/dhcp_release", "root"),124 # nova/network/linux_net.py: 'kill', '-9', pid125 # nova/network/linux_net.py: 'kill', '-HUP', pid126 filters.KillFilter("/bin/kill", "root",127 ['-9', '-HUP'], ['/usr/sbin/dnsmasq']),128 # nova/network/linux_net.py: 'kill', pid129 filters.KillFilter("/bin/kill", "root", [''], ['/usr/sbin/radvd']),130 # nova/network/linux_net.py: dnsmasq call131 filters.DnsmasqFilter("/usr/sbin/dnsmasq", "root"),132 # nova/network/linux_net.py: 'radvd', '-C', '%s' % _ra_file(dev, 'conf'),..133 filters.CommandFilter("/usr/sbin/radvd", "root"),134 # nova/network/linux_net.py: 'brctl', 'addbr', bridge135 # nova/network/linux_net.py: 'brctl', 'setfd', bridge, 0136 # nova/network/linux_net.py: 'brctl', 'stp', bridge, 'off'137 # nova/network/linux_net.py: 'brctl', 'addif', bridge, interface138 filters.CommandFilter("/sbin/brctl", "root"),139 filters.CommandFilter("/usr/sbin/brctl", "root"),140 # nova/virt/libvirt/utils.py: 'mkswap'141 # nova/virt/xenapi/vm_utils.py: 'mkswap'142 filters.CommandFilter("/sbin/mkswap", "root"),143 # nova/virt/xenapi/vm_utils.py: 'mkfs'144 filters.CommandFilter("/sbin/mkfs", "root"),145 # nova/virt/libvirt/utils.py: 'qemu-img'146 filters.CommandFilter("/usr/bin/qemu-img", "root"),147 # nova/virt/disk/api.py: 'touch', target148 filters.CommandFilter("/usr/bin/touch", "root"),149 # nova/virt/libvirt/connection.py:150 filters.ReadFileFilter("/etc/iscsi/initiatorname.iscsi"),...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!