def removeExcludedMac(self, macObj): ''' Deletes an Mac from the exclusion list (but it does not destroy the object!!) ''' with MutexStore.getObjectLock(self.getLockIdentifier()): macStr = macObj.getMac() if (not self.macs.get(mac=macStr).isExcludedMac()): raise Exception( "Cannot release Mac. Reason may be is unallocated or is not excluded Mac" ) self.macs.remove(macObj) #Determine new available Mac if not self.nextAvailableMac == None: if EthernetUtils.compareMacs(macStr, self.nextAvailableMac) > 0: #Do nothing pass else: self.nextAvailableMac = macStr else: #No more gaps self.nextAvailableMac = macStr self.autoSave()
def removeExcludedMac(self,macObj): ''' Deletes an Mac from the exclusion list (but it does not destroy the object!!) ''' with MutexStore.getObjectLock(self.getLockIdentifier()): macStr = macObj.getMac() if (not self.macs.get(mac=macStr).isExcludedMac()): raise Exception("Cannot release Mac. Reason may be is unallocated or is not excluded Mac") self.macs.remove(macObj) #Determine new available Mac if not self.nextAvailableMac == None: if EthernetUtils.compareMacs(macStr,self.nextAvailableMac) > 0: #Do nothing pass else: self.nextAvailableMac = macStr else: #No more gaps self.nextAvailableMac = macStr self.autoSave()
def releaseMac(self, macObj): ''' Releases an MAC address of the range (but it does not destroy the object!!) ''' with MutexStore.getObjectLock(self.getLockIdentifier()): macStr = macObj.getMac() if not self.macs.filter(mac=macStr).count() > 0: raise Exception( "Cannot release Mac %s. Reason may be is unallocated or is an excluded Mac", macStr) self.macs.remove(macObj) #Determine new available Mac if not self.nextAvailableMac == None: if EthernetUtils.compareMacs(macStr, self.nextAvailableMac) > 0: #Do nothing pass else: self.nextAvailableMac = macStr else: #No more gaps self.nextAvailableMac = macStr self.autoSave()
def releaseMac(self,macObj): ''' Releases an MAC address of the range (but it does not destroy the object!!) ''' with MutexStore.getObjectLock(self.getLockIdentifier()): macStr = macObj.getMac() if not self.macs.filter(mac=macStr).count() > 0: raise Exception("Cannot release Mac %s. Reason may be is unallocated or is an excluded Mac",macStr) self.macs.remove(macObj) #Determine new available Mac if not self.nextAvailableMac == None: if EthernetUtils.compareMacs(macStr,self.nextAvailableMac) > 0: #Do nothing pass else: self.nextAvailableMac = macStr else: #No more gaps self.nextAvailableMac = macStr self.autoSave()