示例#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
示例#2
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
示例#3
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
示例#4
0
文件: MacSlot.py 项目: HalasNet/felix
	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
示例#5
0
 def __setEndMac(self, value):
     EthernetUtils.checkValidMac(value)
     self.endMac = value.upper()
     self.autoSave()
示例#6
0
 def __setStartMac(self, value):
     EthernetUtils.checkValidMac(value)
     MAC4Utils.checkValidMac(value)
     self.startMac = value.upper()
     self.autoSave()
示例#7
0
        def __setEndMac(self, value):
		EthernetUtils.checkValidMac(value)
                self.endMac = value.upper()
		self.autoSave()
示例#8
0
        def __setStartMac(self, value):
		EthernetUtils.checkValidMac(value)
		MAC4Utils.checkValidMac(value) 
                self.startMac = value.upper()
		self.autoSave()