예제 #1
0
    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
예제 #2
0
    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()
예제 #4
0
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()
예제 #5
0
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()
예제 #6
0
 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
예제 #7
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()
예제 #8
0
파일: dhcp_agent.py 프로젝트: t-lin/quantum
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()
예제 #9
0
    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()
예제 #10
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.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()
예제 #11
0
 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)
예제 #12
0
 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)
예제 #13
0
    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()
예제 #14
0
    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()
예제 #15
0
 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)
예제 #16
0
    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()
예제 #17
0
    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
예제 #18
0
    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()
예제 #19
0
 def test_root_default(self):
     conf = config.setup_conf()
     config.register_root_helper(conf)
     self.assertEqual(config.get_root_helper(conf), 'sudo')
예제 #20
0
def test_setup_conf():
    conf = config.setup_conf()
    assert conf.state_path.endswith('/var/lib/quantum')
예제 #21
0
 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')
예제 #22
0
 def test_root_default(self):
     conf = config.setup_conf()
     config.register_root_helper(conf)
     self.assertEqual(config.get_root_helper(conf), 'sudo')
예제 #23
0
def test_setup_conf():
    conf = config.setup_conf()
    assert conf.state_path.endswith('/var/lib/quantum')
예제 #24
0
 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')