diff options
| author | Aaron Lee <aaron.lee@rackspace.com> | 2012-02-15 17:45:31 -0600 |
|---|---|---|
| committer | Aaron Lee <aaron.lee@rackspace.com> | 2012-02-17 13:07:01 -0600 |
| commit | 1dcf149bb3567f84c87c7eb2d6cf539a3b713727 (patch) | |
| tree | 1483d0e27685eb0c021aefdaee171e4cbb83aef4 /nova/tests | |
| parent | 00d2781b50031c01550192e3bbd8e43b491a17ee (diff) | |
Pulls the main components out of deallocate.
deallocate_for_instances is basically deallocate
the port, then delete the vif. This separates
them.
update one: hacking within the lines
update two: another hacking fix
update three: rebase
update four: rebase and detrailingslashify
Change-Id: I01e06a9225d7825af5d404d5815f5084c7660799
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/test_quantum.py | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/nova/tests/test_quantum.py b/nova/tests/test_quantum.py index 7a2dc07d2..2bda2e303 100644 --- a/nova/tests/test_quantum.py +++ b/nova/tests/test_quantum.py @@ -25,11 +25,12 @@ from nova import log as logging from nova.network.quantum import client as quantum_client from nova.network.quantum import fake_client from nova.network.quantum import manager as quantum_manager -from nova.network.quantum import melange_connection from nova.network.quantum import quantum_connection +from nova.network.quantum import melange_connection +from nova.network.quantum import melange_ipam_lib + from nova import test from nova import utils -from nova.network import manager LOG = logging.getLogger(__name__) FLAGS = flags.FLAGS @@ -219,6 +220,30 @@ class QuantumNovaTestCase(test.TestCase): n['uuid'] = nwks[0]['uuid'] +class QuantumDeallocationTestCase(QuantumNovaTestCase): + def test_deallocate_port(self): + quantum = self.mox.CreateMock(quantum_connection\ + .QuantumClientConnection) + quantum.get_port_by_attachment('q_tenant_id', 'net_id', + 'interface_id').AndReturn('port_id') + quantum.detach_and_delete_port('q_tenant_id', 'net_id', 'port_id') + self.net_man.q_conn = quantum + + self.mox.ReplayAll() + + self.net_man.deallocate_port('interface_id', 'net_id', 'q_tenant_id', + 'instance_id') + + def test_deallocate_ip_address(self): + ipam = self.mox.CreateMock(melange_ipam_lib.QuantumMelangeIPAMLib) + ipam.get_tenant_id_by_net_id('context', 'net_id', {'uuid': 1}, + 'project_id').AndReturn('ipam_tenant_id') + self.net_man.ipam = ipam + self.mox.ReplayAll() + self.net_man.deallocate_ip_address('context', 'net_id', 'project_id', + {'uuid': 1}, 'instance_id') + + class QuantumManagerTestCase(QuantumNovaTestCase): def test_create_and_delete_nets(self): self._create_nets() |
