def __init__(self, ip):
		self.ip = ip
		self._createFuncList()
		if bf.chkValidIP(self.ip):
			self.snmpClient = snmp.eNB_SNMP(self.ip)
			eType = self.snmpCBType()
			self.eType = eType.get('Type')
			if self.eType is None:
				gCfg = main.gCfg
				dbbsc = gCfg.createDBbsc()
				searchPara = [{'Cfg.Debug_IP' : ip}, {'Cfg.Site' : gCfg.labsite}]
				result = dbbsc('query', 'CB.Type', {'$and' : searchPara})
				if result is []:
					pass
				else:
					self.eType = result[0][0]
			else:
				pass
			self.sshClient = ssh.eNB_SSH(self.ip, eType = self.eType)
			if self.sshClient.status:
				self.sshStatus = 'enb0dev'
			else:
				self.sshStatus = 'off'
				print self.eType
				print self.ip
				print 'SSH failed!'
		else:
			self.sshStatus = 'off'
			print 'Wrong IP'
	def sshS1Ip(self):
		ip = self._sshS1IpV4()
		if bf.chkValidIP(ip):
			return {'S1_IP' : ip}
		elif ip == '':
			ip = self._sshS1IpV6()
			if ip != '':
				return {'S1_IP' : ip}
			else:
				return None
		else:
				return None
	def chkDuplItemByCfg(self, pltf_name, ip, site):
		if bf.chkValidIP(ip):
			listPltf_name = {'Cfg.Register_Name' : pltf_name}
			listIP = {'Cfg.Debug_IP' : ip}
			listSite = {'Cfg.Site' : site}
			setContent = {'$and' : [{"$or" : [listPltf_name, listIP]}, listSite]}
			result, resultLen = self.find('pltf_basic_info', setContent)
			if resultLen == 0:
				return True
			else:
				return False
		else:
			return False
Exemple #4
0
 def chkDuplItemByCfg(self, pltf_name, ip, site):
     if bf.chkValidIP(ip):
         listPltf_name = {'Cfg.Register_Name': pltf_name}
         listIP = {'Cfg.Debug_IP': ip}
         listSite = {'Cfg.Site': site}
         setContent = {'$and': [{"$or": [listPltf_name, listIP]}, listSite]}
         result, resultLen = self.find('pltf_basic_info', setContent)
         if resultLen == 0:
             return True
         else:
             return False
     else:
         return False