Revision 3b2984dc snf-cyclades-app/synnefo/logic/tests/callbacks.py

b/snf-cyclades-app/synnefo/logic/tests/callbacks.py
137 137
        # Also create a NIC
138 138
        ip = mfactory.IPv4AddressFactory(nic__machine=vm)
139 139
        nic = ip.nic
140
        nic.network.get_pool().reserve(nic.ipv4_address)
140
        nic.network.get_ip_pools()[0].reserve(nic.ipv4_address)
141 141
        msg = self.create_msg(operation='OP_INSTANCE_REMOVE',
142 142
                              instance=vm.backend_vm_id)
143 143
        with mocked_quotaholder():
......
148 148
        self.assertTrue(db_vm.deleted)
149 149
        # Check that nics are deleted
150 150
        self.assertFalse(db_vm.nics.all())
151
        self.assertTrue(nic.network.get_pool().is_available(ip.address))
151
        self.assertTrue(nic.network.get_ip_pools()[0].is_available(ip.address))
152 152
        vm2 = mfactory.VirtualMachineFactory()
153 153
        fp1 = mfactory.IPv4AddressFactory(nic__machine=vm2, floating_ip=True,
154 154
                                          network__floating_ip_pool=True)
......
156 156
        nic1 = mfactory.NetworkInterfaceFactory(machine=vm2)
157 157
        fp1.nic = nic1
158 158
        fp1.save()
159
        pool = network.get_pool()
159
        pool = network.get_ip_pools()[0]
160 160
        pool.reserve(fp1.address)
161 161
        pool.save()
162 162
        msg = self.create_msg(operation='OP_INSTANCE_REMOVE',
......
168 168
        self.assertEqual(db_vm.operstate, 'DESTROYED')
169 169
        self.assertTrue(db_vm.deleted)
170 170
        self.assertEqual(IPAddress.objects.get(id=fp1.id).nic, None)
171
        pool = network.get_pool()
171
        pool = network.get_ip_pools()[0]
172 172
        # Test that floating ips are not released
173 173
        self.assertFalse(pool.is_available(fp1.address))
174 174

  
......
367 367
        network = ip.network
368 368
        subnet = ip.subnet
369 369
        vm = ip.nic.machine
370
        pool = subnet.get_pool()
370
        pool = subnet.get_ip_pools()[0]
371 371
        pool.reserve("10.0.0.2")
372 372
        pool.save()
373 373

  
......
384 384
        self.assertEqual(nics[0].index, 0)
385 385
        self.assertEqual(nics[0].ipv4_address, '10.0.0.3')
386 386
        self.assertEqual(nics[0].mac, 'aa:bb:cc:00:11:22')
387
        pool = subnet.get_pool()
387
        pool = subnet.get_ip_pools()[0]
388 388
        self.assertTrue(pool.is_available('10.0.0.2'))
389 389
        self.assertFalse(pool.is_available('10.0.0.3'))
390 390
        pool.save()
......
600 600
                                                               "10.0.0.20"]})
601 601
        update_network(client, msg)
602 602
        self.assertTrue(client.basic_ack.called)
603
        pool = network.get_pool()
603
        pool = network.get_ip_pools()[0]
604 604
        self.assertTrue(pool.is_reserved('10.0.0.10'))
605 605
        self.assertTrue(pool.is_reserved('10.0.0.20'))
606 606
        pool.save()
......
613 613
                                                          "10.0.0.20"]})
614 614
        update_network(client, msg)
615 615
        #self.assertTrue(client.basic_ack.called)
616
        pool = network.get_pool()
616
        pool = network.get_ip_pools()[0]
617 617
        self.assertTrue(pool.is_reserved('10.0.0.10'))
618 618
        self.assertTrue(pool.is_reserved('10.0.0.20'))
619 619

  

Also available in: Unified diff