def _writeCommand(self, prompt, cmd, timeout=30): engine = self.createEngine() logger = self.getLogger() logger.writeRaw(cmd) mac = self.getMacAddress() print("the writeRwa cmd is:",cmd) if "bosa_set" in cmd: print("the mac is ",mac) url = MgrUtils.getParameter(UtilsConfig.S_MES, UtilsConfig.K_URL, "") client = Client("{}?WSDL".format(url)) sponse = client.service.GetBOSAImportData_Ex('GPONStation-SZ', 'NP1257G-test', mac) ls = json.loads(sponse) bosa_cmd="serialization --bosa_sn="+ls['BosaData'][0]['bosa_sn']+" --bosa_type="+ls['BosaData'][0]['bosa_type']+" --bosa_pn="+ls['BosaData'][0]['bosa_pn']\ +" --bosa_vapd=" + ls['BosaData'][0]['bosa_vapd'] \ + " --bosa_impd=" + ls['BosaData'][0]['bosa_impd'] \ + " --bosa_apd_resp=" + ls['BosaData'][0]['bosa_apd_resp'] \ + " --darkcurrent_vapd10=" + ls['BosaData'][0]['darkcurrent_vapd10'] \ + " --darkcurrent_vop=" + ls['BosaData'][0]['darkcurrent_vop'] cmd=bosa_cmd print("the bosa_cmd is :",cmd) #print("the response is :",sponse) if not cmd.endswith("\n"): cmd = "{}\n".format(cmd) engine.write(self._encode(cmd)) response = self._decode(engine.read_until(self._encode(prompt), timeout)) #print("the write command is :",response,"end") #print("the prompt is :", prompt) logger.writeRaw(response) if not re.search(prompt, response): raise Exception(MgrUtils.getString("timeoutText")) return response
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)