Пример #1
0
    def setUp(self):
        super(QuantumNovaTestCase, self).setUp()

        # Create an actual project -- with this we will touch more of
        # the code in QuantumManager (related to fetching networks, etc)
        for x in ['fake_project1', 'fake_project2']:
            values = {'id': x, 'name': x}
            project = db.project_create(context.get_admin_context(), values)

        self.net_man = quantum_manager.QuantumManager(
            ipam_lib="nova.network.quantum.nova_ipam_lib",
            q_conn=FakeQuantumClientConnection())

        # Tests seem to create some networks by default, which
        # we don't want.  So we delete them.

        ctx = context.RequestContext('user1', 'fake_project1').elevated()
        for n in db.network_get_all(ctx):
            db.network_delete_safe(ctx, n['id'])

        # Other unit tests (e.g., test_compute.py) have a nasty
        # habit of of creating fixed IPs and not cleaning up, which
        # can confuse these tests, so we remove all existing fixed
        # ips before starting.
        session = get_session()
        result = session.query(models.FixedIp).all()
        with session.begin():
            for fip_ref in result:
                session.delete(fip_ref)
Пример #2
0
    def setUp(self):
        super(QuantumMelangeTestCase, self).setUp()

        fc = fake_client.FakeClient(LOG)
        qc = quantum_connection.QuantumClientConnection(client=fc)

        self.net_man = quantum_manager.QuantumManager(
            ipam_lib="nova.network.quantum.nova_ipam_lib", q_conn=qc)
Пример #3
0
    def setUp(self):
        super(QuantumNovaTestCase, self).setUp()

        self.flags(quantum_use_dhcp=True)
        self.flags(l3_lib="nova.network.l3.LinuxNetL3")
        linuxdrv = "nova.network.linux_net.LinuxOVSInterfaceDriver"
        self.flags(linuxnet_interface_driver=linuxdrv)
        fc = fake_client.FakeClient(LOG)
        qc = quantum_connection.QuantumClientConnection(client=fc)

        self.net_man = quantum_manager.QuantumManager(
                ipam_lib="nova.network.quantum.nova_ipam_lib",
                q_conn=qc)

        def func(arg1, arg2):
            pass

        def func2(arg1, arg2, arg3):
            pass

        def func1(arg1):
            pass

        self.net_man.driver.update_dhcp_hostfile_with_text = func
        self.net_man.driver.restart_dhcp = func2
        self.net_man.driver.kill_dhcp = func1

        # Tests seem to create some networks by default, which
        # we don't want.  So we delete them.

        ctx = context.RequestContext('user1', 'fake_project1').elevated()
        for n in db.network_get_all(ctx):
            db.network_delete_safe(ctx, n['id'])

        # Other unit tests (e.g., test_compute.py) have a nasty
        # habit of of creating fixed IPs and not cleaning up, which
        # can confuse these tests, so we remove all existing fixed
        # ips before starting.
        session = sql_session.get_session()
        result = session.query(models.FixedIp).all()
        with session.begin():
            for fip_ref in result:
                session.delete(fip_ref)

        self.net_man.init_host()
Пример #4
0
    def setUp(self):
        super(QuantumNovaTestCase, self).setUp()

        self.net_man = quantum_manager.QuantumManager(
            ipam_lib="nova.network.quantum.nova_ipam_lib",
            q_conn=FakeQuantumClientConnection())

        # Tests seem to create some networks by default, which
        # we don't want.  So we delete them.

        ctx = context.RequestContext('user1', 'fake_project1').elevated()
        for n in db.network_get_all(ctx):
            db.network_delete_safe(ctx, n['id'])

        # Other unit tests (e.g., test_compute.py) have a nasty
        # habit of of creating fixed IPs and not cleaning up, which
        # can confuse these tests, so we remove all existing fixed
        # ips before starting.
        session = get_session()
        result = session.query(models.FixedIp).all()
        with session.begin():
            for fip_ref in result:
                session.delete(fip_ref)