def setUp(self): self.conf = config.setup_conf() self.conf.register_opts(l3_agent.L3NATAgent.OPTS) self.conf.register_opts(interface.OPTS) self.conf.set_override('interface_driver', 'quantum.agent.linux.interface.NullDriver') self.conf.root_helper = 'sudo' self.device_exists_p = mock.patch( 'quantum.agent.linux.ip_lib.device_exists') self.device_exists = self.device_exists_p.start() self.utils_exec_p = mock.patch( 'quantum.agent.linux.utils.execute') self.utils_exec = self.utils_exec_p.start() self.dvr_cls_p = mock.patch('quantum.agent.linux.interface.NullDriver') driver_cls = self.dvr_cls_p.start() self.mock_driver = mock.MagicMock() self.mock_driver.DEV_NAME_LEN = ( interface.LinuxInterfaceDriver.DEV_NAME_LEN) driver_cls.return_value = self.mock_driver self.ip_cls_p = mock.patch('quantum.agent.linux.ip_lib.IPWrapper') ip_cls = self.ip_cls_p.start() self.mock_ip = mock.MagicMock() ip_cls.return_value = self.mock_ip self.client_cls_p = mock.patch('quantumclient.v2_0.client.Client') client_cls = self.client_cls_p.start() self.client_inst = mock.Mock() client_cls.return_value = self.client_inst
def main(): conf = config.setup_conf() conf.register_opts(MetadataRouteAgent.OPTS) conf(sys.argv) config.setup_logging(conf) mgr = MetadataRouteAgent(conf) mgr.daemon_loop()
def main(): conf = config.setup_conf() conf.register_opts(L3NATAgent.OPTS) conf.register_opts(interface.OPTS) conf(sys.argv) config.setup_logging(conf) mgr = L3NATAgent(conf) mgr.daemon_loop()
def setUp(self): self.conf = config.setup_conf() self.conf.register_opts(dhcp_agent.DhcpAgent.OPTS) self.driver_cls_p = mock.patch( 'quantum.agent.dhcp_agent.importutils.import_class') self.driver = mock.Mock(name='driver') self.driver_cls = self.driver_cls_p.start() self.driver_cls.return_value = self.driver self.dhcp = dhcp_agent.DhcpAgent(self.conf) self.dhcp.polling_interval = 0
def setUp(self): root_helper_opt = [ cfg.StrOpt('root_helper', default='sudo'), ] self.conf = config.setup_conf() self.conf.register_opts(interface.OPTS) self.conf.register_opts(root_helper_opt) self.ip_dev_p = mock.patch.object(ip_lib, 'IPDevice') self.ip_dev = self.ip_dev_p.start() self.device_exists_p = mock.patch.object(ip_lib, 'device_exists') self.device_exists = self.device_exists_p.start()
def main(): conf = config.setup_conf() conf.register_opts(DhcpAgent.OPTS) conf.register_opts(DeviceManager.OPTS) conf.register_opts(dhcp.OPTS) conf.register_opts(interface.OPTS) conf(sys.argv) config.setup_logging(conf) mgr = DhcpAgent(conf) mgr.daemon_loop()
def setUp(self): root = os.path.dirname(os.path.dirname(__file__)) args = ['--config-file', os.path.join(root, 'etc', 'quantum.conf.test')] self.conf = config.setup_conf() self.conf.register_opts(dhcp.OPTS) self.conf(args=args) self.conf.set_override('state_path', '') self.replace_p = mock.patch('quantum.agent.linux.dhcp.replace_file') self.execute_p = mock.patch('quantum.agent.linux.utils.execute') self.safe = self.replace_p.start() self.execute = self.execute_p.start()
def setUp(self): root_helper_opt = [ cfg.StrOpt('root_helper', default='sudo'), ] self.conf = config.setup_conf() self.conf.register_opts(interface.OPTS) self.conf.register_opts(root_helper_opt) self.ip_dev_p = mock.patch.object(ip_lib, 'IPDevice') self.ip_dev = self.ip_dev_p.start() self.ip_p = mock.patch.object(ip_lib, 'IPWrapper') self.ip = self.ip_p.start() self.device_exists_p = mock.patch.object(ip_lib, 'device_exists') self.device_exists = self.device_exists_p.start()
def setUp(self): super(TestBase, self).setUp() self.conf = config.setup_conf() self.conf.register_opts(interface.OPTS) config.register_root_helper(self.conf) self.ip_dev_p = mock.patch.object(ip_lib, "IPDevice") self.ip_dev = self.ip_dev_p.start() self.addCleanup(self.ip_dev_p.stop) self.ip_p = mock.patch.object(ip_lib, "IPWrapper") self.ip = self.ip_p.start() self.addCleanup(self.ip_p.stop) self.device_exists_p = mock.patch.object(ip_lib, "device_exists") self.device_exists = self.device_exists_p.start() self.addCleanup(self.device_exists_p.stop)
def setUp(self): super(TestBase, self).setUp() self.conf = config.setup_conf() self.conf.register_opts(interface.OPTS) config.register_root_helper(self.conf) self.ip_dev_p = mock.patch.object(ip_lib, 'IPDevice') self.ip_dev = self.ip_dev_p.start() self.addCleanup(self.ip_dev_p.stop) self.ip_p = mock.patch.object(ip_lib, 'IPWrapper') self.ip = self.ip_p.start() self.addCleanup(self.ip_p.stop) self.device_exists_p = mock.patch.object(ip_lib, 'device_exists') self.device_exists = self.device_exists_p.start() self.addCleanup(self.device_exists_p.stop)
def setUp(self): root = os.path.dirname(os.path.dirname(__file__)) args = ['--config-file', os.path.join(root, 'etc', 'quantum.conf.test')] self.conf = config.setup_conf() self.conf.register_opts(dhcp.OPTS) self.conf.register_opt(cfg.StrOpt('dhcp_lease_relay_socket', default='$state_path/dhcp/lease_relay')) self.conf(args=args) self.conf.set_override('state_path', '') self.conf.use_namespaces = True self.replace_p = mock.patch('quantum.agent.linux.dhcp.replace_file') self.execute_p = mock.patch('quantum.agent.linux.utils.execute') self.safe = self.replace_p.start() self.execute = self.execute_p.start()
def setUp(self): super(TestBase, self).setUp() root_helper_opt = [ cfg.StrOpt('root_helper', default='sudo'), ] self.conf = config.setup_conf() self.conf.register_opts(interface.OPTS) config.register_root_helper(self.conf) self.ip_dev_p = mock.patch.object(ip_lib, 'IPDevice') self.ip_dev = self.ip_dev_p.start() self.addCleanup(self.ip_dev_p.stop) self.ip_p = mock.patch.object(ip_lib, 'IPWrapper') self.ip = self.ip_p.start() self.addCleanup(self.ip_p.stop) self.device_exists_p = mock.patch.object(ip_lib, 'device_exists') self.device_exists = self.device_exists_p.start() self.addCleanup(self.device_exists_p.stop)
def setUp(self): super(TestBase, self).setUp() root = os.path.dirname(os.path.dirname(__file__)) args = ["--config-file", os.path.join(root, "etc", "quantum.conf.test")] self.conf = config.setup_conf() self.conf.register_opts(dhcp.OPTS) self.conf.register_opt(cfg.StrOpt("dhcp_lease_relay_socket", default="$state_path/dhcp/lease_relay")) self.conf.register_opt(cfg.BoolOpt("enable_isolated_metadata", default=True)) self.conf(args=args) self.conf.set_override("state_path", "") self.conf.use_namespaces = True self.replace_p = mock.patch("quantum.agent.linux.utils.replace_file") self.execute_p = mock.patch("quantum.agent.linux.utils.execute") self.addCleanup(self.execute_p.stop) self.safe = self.replace_p.start() self.addCleanup(self.replace_p.stop) self.execute = self.execute_p.start()
def setUp(self): self.conf = config.setup_conf() self.conf.register_opts(dhcp_agent.DeviceManager.OPTS) self.conf.set_override('interface_driver', 'quantum.agent.linux.interface.NullDriver') self.client_cls_p = mock.patch('quantumclient.v2_0.client.Client') client_cls = self.client_cls_p.start() self.client_inst = mock.Mock() client_cls.return_value = self.client_inst self.device_exists_p = mock.patch( 'quantum.agent.linux.ip_lib.device_exists') self.device_exists = self.device_exists_p.start() self.dvr_cls_p = mock.patch('quantum.agent.linux.interface.NullDriver') driver_cls = self.dvr_cls_p.start() self.mock_driver = mock.MagicMock() self.mock_driver.DEV_NAME_LEN = ( interface.LinuxInterfaceDriver.DEV_NAME_LEN) driver_cls.return_value = self.mock_driver
def setUp(self): super(TestBase, self).setUp() root = os.path.dirname(os.path.dirname(__file__)) args = ['--config-file', os.path.join(root, 'etc', 'quantum.conf.test')] self.conf = config.setup_conf() self.conf.register_opts(base_config.core_opts) self.conf.register_opts(dhcp.OPTS) self.conf.register_opt( cfg.StrOpt('dhcp_lease_relay_socket', default='$state_path/dhcp/lease_relay')) self.conf.register_opt(cfg.BoolOpt('enable_isolated_metadata', default=True)) self.conf(args=args) self.conf.set_override('state_path', '') self.conf.use_namespaces = True self.replace_p = mock.patch('quantum.agent.linux.utils.replace_file') self.execute_p = mock.patch('quantum.agent.linux.utils.execute') self.addCleanup(self.execute_p.stop) self.safe = self.replace_p.start() self.addCleanup(self.replace_p.stop) self.execute = self.execute_p.start()
def test_root_default(self): conf = config.setup_conf() config.register_root_helper(conf) self.assertEqual(config.get_root_helper(conf), 'sudo')
def test_setup_conf(): conf = config.setup_conf() assert conf.state_path.endswith('/var/lib/quantum')
def test_root_helper(self): conf = config.setup_conf() config.register_root_helper(conf) conf.set_override('root_helper', 'my_root_helper') self.assertEqual(config.get_root_helper(conf), 'my_root_helper')