Esempio n. 1
0
    def deallocate(self, address):
        # This is almost a no-op because the Neutron DB IPAM driver does not
        # delete IPAllocation objects at every deallocation. The only
        # operation it performs is to delete an IPRequest entry.
        count = self.subnet_manager.delete_allocation(
            self._context, address)
        # count can hardly be greater than 1, but it can be 0...
        if not count:
            raise ipam_exc.IpAddressAllocationNotFound(
                subnet_id=self.subnet_manager.neutron_id,
                ip_address=address)

        ipObj = netaddr.IPAddress(address)
        
        # BlueCat additions
        LOG.info("BCN: Deallocating IP address %s" % (address))
        
        paramsBAM = getBCNConfig(BC_configFileName, "BAM")
        soap_client = _bam_login(paramsBAM)
        configID = _get_bam_configid(paramsBAM, soap_client)
    
        LOG.info("BCN: Deleting host %s from BAM ..." % (address))
        if ipObj.version == 4:
                delBCIP4Obj(address, configID, soap_client)
        else:
                delBCIP6Obj(address, configID, soap_client)
    
        _bam_logout(paramsBAM, soap_client)
Esempio n. 2
0
 def deallocate(self, address):
     # This is almost a no-op because the Neutron DB IPAM driver does not
     # delete IPAllocation objects at every deallocation. The only
     # operation it performs is to delete an IPRequest entry.
     count = self.subnet_manager.delete_allocation(self._context, address)
     # count can hardly be greater than 1, but it can be 0...
     if not count:
         raise ipam_exc.IpAddressAllocationNotFound(
             subnet_id=self.subnet_manager.neutron_id, ip_address=address)
Esempio n. 3
0
 def backend_deallocate(self, address):
     try:
         self._vcns.release_ipam_ip_to_pool(self._nsx_pool_id, address)
     except vc_exc.VcnsApiException as e:
         LOG.error("NSX IPAM failed to free ip %(ip)s of subnet %(id)s:"
                   " %(e)s",
                   {'e': e.response,
                    'ip': address,
                    'id': self._subnet_id})
         raise ipam_exc.IpAddressAllocationNotFound(
             subnet_id=self._subnet_id,
             ip_address=address)