def config_target(IP_Entered, license, version, speed, solid_args): obj_msg_out = solid_args[0] s.msg_out(obj_msg_out, '0. Connecting to Engine %s \n' % IP_Entered) objEngine = Action(IP_Entered, telnet_port, passwd, FTP_port, version, solid_args) s.msg_out(obj_msg_out, '0. Connected to Engine %s \n' % IP_Entered) s.msg_out(obj_msg_out, ' 1. Start to Change FW\n') objEngine.change_FW(firmware_file_name) s.msg_out(obj_msg_out, ' 1. Change FW Done, Rebooting...\n') s.sand_glass(45) solid_args[0].insert('insert', ' 2. Start Restor Factory Default\n') objEngine.factory_default() solid_args[0].insert('insert', ' 2. Restor Factory Default Done, Rebooting...\n') sandglass(20) solid_args[0].insert('insert', ' 3. Start Changing IP Address\n') objEngine.change_ip_address(ip_engine_target) solid_args[0].insert('insert', ' 3. Change IP Address Done, Rebooting...\n') sandglass(15) del objEngine s.msg_out(obj_msg_out, '0. Connecting to Engine %s' % ip_engine_target) objEngine = Action(ip_engine_target, telnet_port, passwd, FTP_port, version, solid_args) s.msg_out(obj_msg_out, ' 4. Start to Install License\n') objEngine.install_license(license) s.msg_out(obj_msg_out, ' 4. Install License Done\n')
def change_ip_address(self, new_ip_address): if self._TN_Conn.go_to_main_menu(): # self._TN_Conn.change_ip_address(new_ip_address) # def change_ip_address(self, new_ip_address): # if self.go_to_main_menu(): self._TN_Conn.Connection.write('6'.encode(encoding="utf-8")) self._TN_Conn.Connection.read_until(s.encode_utf8('interface'), timeout=2) time.sleep(0.2) self._telnet_write('e', 0.1) self._telnet_write('a', 0.1) self._TN_Conn.Connection.read_until(s.encode_utf8('new IP'), timeout=2) time.sleep(0.2) self._TN_Conn.Connection.write(s.encode_utf8('new_ip_address')) self._TN_Conn.Connection.write('\r'.encode(encoding="utf-8")) time.sleep(0.2) self._TN_Conn.Connection.write(s.encode_utf8('\r')) time.sleep(0.2) self._TN_Conn.Connection.read_until( '<Enter> = done'.encode(encoding="utf-8"), timeout=2) self._TN_Conn.Connection.write('\r'.encode(encoding="utf-8")) time.sleep(0.5) # try: self._TN_Conn.Connection.read_until(s.encode_utf8('Coredump'), timeout=2) self._TN_Conn.Connection.write(s.encode_utf8('b')) self._TN_Conn.Connection.read_until(s.encode_utf8('Reboot'), timeout=1) time.sleep(0.4) self._TN_Conn.Connection.write(s.encode_utf8('y')) print('Rebooting engine, Please waiting...\n') s.sand_glass(45, self.message_output)
def change_FW(self, strFWFile): connFTP = self._ftp() time.sleep(0.25) connFTP.PutFile('/mbflash', './', 'fwimage', strFWFile) print('FW upgrade completed for {}, waiting for reboot...'.format( self._host)) s.msg_out(self.message_output, ' 0.1 Finish changing firmware, Rebooting...\n') s.chg_light_to_red(self.obj_light_telnet, self.instance_light_telnet) s.chg_light_to_red(self.obj_light_FTP, self.instance_light_FTP) s.sand_glass(45, self.message_output)
def change_UID(self, mode): if mode == 'target': str_uid = '0000006022112250' elif mode == 'initiator': str_uid = '0000006022112251' else: s.msg_out(self.message_output, 'failed ,check') sys.exit() uid_cmd = 'uid %s' % str_uid output = self._executeCMD(uid_cmd) if 'take full effect!' in output: self._executeCMD('boot') s.msg_out(self.message_output, ' 0.4 Finish changeing UID, Rebooting...\n') s.sand_glass(20, self.message_output)
def factory_default(self): if self._TN_Conn.go_to_main_menu(): self._telnet_write('f') self._TN_Conn.Connection.read_until(s.encode_utf8('Reset'), timeout=1) time.sleep(0.25) self._telnet_write('y') self._telnet_write('y') self._telnet_write('y') print('Finish restoring factory default, Reboot...\n') s.msg_out( self.message_output, ' 0.2 Finish restoring factory default, Rebooting...\n') s.chg_light_to_red(self.obj_light_telnet, self.instance_light_telnet) s.sand_glass(20, self.message_output)
def change_ip_address(self, new_ip_address): s.msg_out( self.message_output, ' 0.3.1 changing IP from "%s" to "%s" ...\n' % (self._host, new_ip_address)) print('changing IP from "%s" to "%s" ...\n' % (self._host, new_ip_address)) if self._TN_Conn.go_to_main_menu(): self._telnet_write('6') self._TN_Conn.Connection.read_until(s.encode_utf8('interface'), timeout=2) time.sleep(0.2) self._telnet_write('e') self._telnet_write('a') self._TN_Conn.Connection.read_until(s.encode_utf8('new IP'), timeout=2) self._telnet_write(new_ip_address) self._telnet_write('\r') self._telnet_write('\r') self._TN_Conn.Connection.read_until( '<Enter> = done'.encode(encoding="utf-8"), timeout=2) self._telnet_write('\r') # try: self._TN_Conn.Connection.read_until(s.encode_utf8('Coredump'), timeout=2) self._TN_Conn.Connection.write(s.encode_utf8('b')) self._TN_Conn.Connection.read_until(s.encode_utf8('Reboot'), timeout=1) time.sleep(0.4) self._TN_Conn.Connection.write(s.encode_utf8('y')) s.msg_out(self.message_output, ' 0.3 Finish changing IP address, Rebooting...\n') s.chg_light_to_red(self.obj_light_telnet, self.instance_light_telnet) s.sand_glass(20, self.message_output)