Ejemplo n.º 1
0
	def constructor(name,startMac,endMac,isGlobal=True,save=True):
		self = MacRange()
		try:
			#Default constructor
			EthernetUtils.checkValidMac(startMac)
			EthernetUtils.checkValidMac(endMac)
			
			self.startMac = startMac.upper()
			self.endMac = endMac.upper()
			
			self.name = name
			self.isGlobal= isGlobal
			
			#Create an iterator
			it= EthernetUtils.getMacIterator(self.startMac,self.endMac)
			self.nextAvailableMac = it.getNextMac()
			
			#Number of Slots
			try:
				self.numberOfSlots = EthernetUtils.getNumberOfSlotsInRange(startMac,endMac)		
			except Exception as e:	
				print "Exception doing slot calculation"+str(e)	
				self.numberOfSlots = -1		
		
			self.doSave = save
			if save:
				self.save()
		except Exception as e:
			print e
			raise e
		return self
Ejemplo n.º 2
0
	def constructor(macRange,mac,excluded,comment="",save=True):
		self = MacSlot()

		#Check MAC
		if not mac == "":
			EthernetUtils.checkValidMac(mac)

		self.mac = mac
		self.isExcluded = excluded 
		self.macRange = macRange
		self.comment = comment
		self.doSave = save

		if save:
			self.save()
		
		return self
Ejemplo n.º 3
0
	def __setEndMac(self, value):
		EthernetUtils.checkValidMac(value)
		self.endMac = value.upper()
		self.autoSave()
Ejemplo n.º 4
0
	def __setStartMac(self, value):
		EthernetUtils.checkValidMac(value)
		#MAC4Utils.checkValidMac(value) 
		self.startMac = value.upper()
		self.autoSave()