def resetRoute(self): #TODO, getDefaults() not reasonable, need to restructure db.connect() cursor = db.getDefaults(self) db.disconnect() defaultValue = {} for field in cursor: configName = field[DBApInfoColumns.ConfigName] memberName = db2memberTables[configName] defaultValue[memberName] = field[DBApInfoColumns.ConfigValue] self.__setSecurityMode('5G', defaultValue[ApMemberName.SECURITYMODE5G]) self.__setSecurityMode('2G', defaultValue[ApMemberName.SECURITYMODE2G]) self.__setPassphrase('5G', defaultValue[ApMemberName.PASSPHRASE5G]) self.__setPassphrase('2G', defaultValue[ApMemberName.PASSPHRASE2G]) self.__setWirelessMode('5G', defaultValue[ApMemberName.NETMODE5G]) self.__setWirelessMode('2G', defaultValue[ApMemberName.NETMODE2G]) self.__setChannelWidth('5G', defaultValue[ApMemberName.CHANNELWIDTH5G]) self.__setChannelWidth('2G', defaultValue[ApMemberName.CHANNELWIDTH2G]) self.__setChannel('5G', defaultValue[ApMemberName.CHANNEL5G]) self.__setChannel('2G', defaultValue[ApMemberName.CHANNEL2G]) self.__setSSID('5G', defaultValue[ApMemberName.SSID5G]) self.__setSSID('2G', defaultValue[ApMemberName.SSID2G]) self.__setSsidBroadcast('5G', defaultValue[ApMemberName.SSIDBROADCAST5G]) self.__setSsidBroadcast('2G', defaultValue[ApMemberName.SSIDBROADCAST2G])
def __create(self, vendor, mac): if not self.vendor2constructorTable.has_key(vendor): return None else: if not self.objectDict.has_key(vendor): self.objectDict[vendor] = {} if not self.objectDict[vendor].has_key(mac): constructor = self.vendor2constructorTable[vendor] exec 'self.objectDict["' + vendor + '"]["'+mac+'"]=' + constructor + '(mac)' db.connect() params = db.getDefaults(Factory.objectDict[vendor][mac]) Factory.objectDict[vendor][mac].setDefaults(params) db.disconnect() return self.objectDict[vendor][mac]
def resetRoute(self): db.connect() cursor = db.getDefaults(self) db.disconnect() defaultValue = {} for field in cursor: configName = field[DBApInfoColumns.ConfigName] memberName = db2memberTables[configName] defaultValue[memberName] = field[DBApInfoColumns.ConfigValue] self.__setWirelessMode(defaultValue[ApMemberName.NETMODE2G]) self.__setSSID(defaultValue[ApMemberName.SSID2G]) self.__setSsidBroadcast(defaultValue[ApMemberName.SSIDBROADCAST2G]) self.__setChannel(defaultValue[ApMemberName.CHANNEL2G]) self.__setSecurityMode(defaultValue[ApMemberName.SECURITYMODE2G])
def resetRoute(self): db.connect() cursor = db.getDefaults(self) db.disconnect() defaultValue = {} for field in cursor: configName = field[DBApInfoColumns.ConfigName] memberName = db2memberTables[configName] defaultValue[memberName] = field[DBApInfoColumns.ConfigValue] # reset all transmissonRate under different netMode if self.netMode2g == 'Disabled': self.__setRadio() if self.transmissonRateBGN != defaultValue[ApMemberName.TRANSMISSIONRATEBGN]: if self.netMode2g != 'Mixed 802.11n, 802.11g and 802.11b': self.__setWirelessMode('Mixed 802.11n, 802.11g and 802.11b') self.__setTransmissionRate(defaultValue[ApMemberName.TRANSMISSIONRATEBGN]) if self.transmissonRateGN != defaultValue[ApMemberName.TRANSMISSIONRATEGN]: if self.netMode2g != 'Mixed 802.11n and 802.11g': self.__setWirelessMode('Mixed 802.11n and 802.11g') self.__setTransmissionRate(defaultValue[ApMemberName.TRANSMISSIONRATEGN]) if self.transmissonRateBG != defaultValue[ApMemberName.TRANSMISSIONRATEBG]: if self.netMode2g != 'Mixed 802.11g and 802.11b': self.__setWirelessMode('Mixed 802.11g and 802.11b') self.__setTransmissionRate(defaultValue[ApMemberName.TRANSMISSIONRATEBG]) if self.transmissonRateN != defaultValue[ApMemberName.TRANSMISSIONRATEN]: if self.netMode2g != '802.11n only': self.__setWirelessMode('802.11n only') self.__setTransmissionRate(defaultValue[ApMemberName.TRANSMISSIONRATEN]) if self.transmissonRateN != defaultValue[ApMemberName.TRANSMISSIONRATEG]: if self.netMode2g != '802.11g only': self.__setWirelessMode('802.11g only') self.__setTransmissionRate(defaultValue[ApMemberName.TRANSMISSIONRATEG]) if self.transmissonRateN != defaultValue[ApMemberName.TRANSMISSIONRATEB]: if self.netMode2g != '802.11b only': self.__setWirelessMode('802.11b only') self.__setTransmissionRate(defaultValue[ApMemberName.TRANSMISSIONRATEB]) # reset netMode, ssid, ssidBroadcast, channel, channelWidth if self.netMode2g != defaultValue[ApMemberName.NETMODE2G]: self.__setWirelessMode(defaultValue[ApMemberName.NETMODE2G]) if self.ssid2g != defaultValue[ApMemberName.SSID2G]: self.__setSSID(defaultValue[ApMemberName.SSID2G]) if self.ssidBroadcast2g != defaultValue[ApMemberName.SSIDBROADCAST2G]: self.__setSsidBroadcast(defaultValue[ApMemberName.SSIDBROADCAST2G]) if self.channel2g != defaultValue[ApMemberName.CHANNEL2G] : if self.channelScan2g == 'Enabled': self.__setChannelScan() self.channelScan2g = 'Disabled' self.__setChannel(defaultValue[ApMemberName.CHANNEL2G]) self.__setChannelScan() self.channelScan2g = 'Enabled' if self.channelWidth2g != defaultValue[ApMemberName.CHANNELWIDTH2G]: self.__setChannelWidth(defaultValue[ApMemberName.CHANNELWIDTH2G]) #reset algorithms, keyRenewal, passphrase, securityMode if self.securityMode2g == 'None': self.__setSecurityWPA('WPA-Personal') if self.algorithms2g != defaultValue[ApMemberName.ALGORITHMS2G]: self.__setAlgorithms(defaultValue[ApMemberName.ALGORITHMS2G]) if self.keyRenewal2g != defaultValue[ApMemberName.KEYRENEWAL2G]: self.__setKeyRenewal(defaultValue[ApMemberName.KEYRENEWAL2G]) if self.passphrase2g != defaultValue[ApMemberName.PASSPHRASE2G]: self.__setPassphrase(defaultValue[ApMemberName.PASSPHRASE2G]) if self.securityMode2g != defaultValue[ApMemberName.SECURITYMODE2G]: self.__setSecurityWPA(defaultValue[ApMemberName.SECURITYMODE2G])