Beispiel #1
0
    def test_can_delete_ip_without_active_port(self):

        with self._stubs(self.network, self.subnet, self.ports_info2) as (net, sub, ports):
            device_ids = [ports[0]["device_id"], ports[1]["device_id"]]
            shared_ip = {"ip_address": dict(device_ids=device_ids, network_id=net["id"], version=4)}
            ip = ip_api.create_ip_address(self.context, shared_ip)
            ip_api.delete_ip_address(self.context, ip["id"])
            with self.assertRaises(q_exc.IpAddressNotFound):
                ip_api.get_ip_address(self.context, ip["id"])
Beispiel #2
0
    def test_cannot_delete_ip_with_active_port(self):

        with self._stubs(self.network, self.subnet, self.ports_info2) as (net, sub, ports):
            device_ids = [ports[0]["device_id"], ports[1]["device_id"]]
            shared_ip = {"ip_address": dict(device_ids=device_ids, network_id=net["id"], version=4)}
            ip = ip_api.create_ip_address(self.context, shared_ip)
            port_ip_update = ip_api.update_port_for_ip_address
            port_ip_update(self.context, ip["id"], ports[0]["id"], self._make_port_body("derp"))

            with self.assertRaises(self.disassociate_exception):
                ip_api.delete_ip_address(self.context, ip["id"])
Beispiel #3
0
    def test_can_delete_ip_without_active_port(self):

        with self._stubs(self.network, self.subnet,
                         self.ports_info2) as (net, sub, ports):
            device_ids = [ports[0]['device_id'], ports[1]['device_id']]
            shared_ip = {
                'ip_address':
                dict(device_ids=device_ids, network_id=net['id'], version=4)
            }
            ip = ip_api.create_ip_address(self.context, shared_ip)
            ip_api.delete_ip_address(self.context, ip['id'])
            with self.assertRaises(q_exc.IpAddressNotFound):
                ip_api.get_ip_address(self.context, ip['id'])
Beispiel #4
0
    def test_cannot_delete_ip_with_active_port(self):

        with self._stubs(self.network, self.subnet,
                         self.ports_info2) as (net, sub, ports):
            device_ids = [ports[0]['device_id'], ports[1]['device_id']]
            shared_ip = {
                'ip_address':
                dict(device_ids=device_ids, network_id=net['id'], version=4)
            }
            ip = ip_api.create_ip_address(self.context, shared_ip)
            port_ip_update = ip_api.update_port_for_ip_address
            port_ip_update(self.context, ip['id'], ports[0]['id'],
                           self._make_port_body('derp'))

            with self.assertRaises(self.disassociate_exception):
                ip_api.delete_ip_address(self.context, ip['id'])
Beispiel #5
0
    def test_delete_ip_with_shared_owner_error(self):

        with self._stubs(self.network, self.subnet, self.ports_info2) as (
                net, sub, ports):

            port_ids = [ports[0]['id'], ports[1]['id']]
            p_id = ports[0]['id']
            shared_ip = {'ip_address': dict(port_ids=port_ids,
                                            network_id=net['id'],
                                            version=4)}
            ip = ip_api.create_ip_address(self.context, shared_ip)
            port_ip_update = ip_api.update_port_for_ip_address
            port_ip_update(self.context, ip['id'], p_id,
                           self._make_port_body('derp'))

            with self.assertRaises(self.disassociate_exception):
                ip_api.delete_ip_address(self.context, ip['id'])
Beispiel #6
0
 def delete_ip_address(self, context, id):
     return ip_addresses.delete_ip_address(context, id)
Beispiel #7
0
 def delete_ip_address(self, context, id):
     return ip_addresses.delete_ip_address(context, id)