def config_target(IP_Entered, license, version, speed, solid_args): obj_msg_out = solid_args[0] obj_light_telnet = solid_args[1] instance_light_telnet = solid_args[2] # obj_light_FTP = solid_args[3] # instance_light_FTP = solid_args[4] _config_universal('target', IP_Entered, license, version, speed, solid_args) objEngine = Action(ip_engine_target, telnet_port, passwd, FTP_port, version, solid_args) s.msg_out(obj_msg_out, ' 1.1 Start creating fake drives.\n') objEngine.create_fake_drive() s.msg_out(obj_msg_out, ' 1.2 Start creating mirror and mapping.\n') objEngine.mirror_and_mapping() s.msg_out(obj_msg_out, ' 1.3 Start registering initiators.\n') objEngine.register_initiator() # show info -- mirror and mapping. objEngine.show_mirror_and_mappting() # show info -- conmgr status. objEngine.show_conmgr_status() s.msg_out(obj_msg_out, ' 1. Finish configuring target engine.\n') time.sleep(0.25) del objEngine s.chg_light_to_red(obj_light_telnet, instance_light_telnet)
def _put_burn_in_file(self, file_name_remote, file_name_local): obj_FTP = self._ftp() time.sleep(0.1) obj_FTP.PutFile('/pmt', './IOG-3', file_name_remote, file_name_local, 'asc') time.sleep(2) del obj_FTP s.chg_light_to_red(self.obj_light_FTP, self.instance_light_FTP)
def _get_result_file(self): s.make_dir(strResultFolder) self.get_trace(strResultFolder, 1) obj_FTP = self._ftp() time.sleep(0.1) obj_FTP.GetFile('/pmt', strResultFolder, 'result', 'result') obj_FTP.GetFile('/pmt', strResultFolder, 'result.txt', 'result.txt') time.sleep(0.5) del obj_FTP s.chg_light_to_red(self.obj_light_FTP, self.instance_light_FTP)
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 _reset_engine(ip_engine): s.msg_out(obj_msg_out, ' 6.x Start resetting engine %s.\n' % ip_engine) objEngine = Action(ip_engine, telnet_port, passwd, FTP_port, version, solid_args) objEngine.reset_engine() time.sleep(1) s.msg_out(obj_msg_out, ' 6.x Finish resetting engine %s.\n' % ip_engine) del objEngine s.chg_light_to_red(obj_light_FTP, instance_light_FTP)
def start_test(version, solid_args): obj_msg_out = solid_args[0] obj_light_FTP = solid_args[3] instance_light_FTP = solid_args[4] objEngine = Action(ip_engine_initiator, telnet_port, passwd, FTP_port, version, solid_args) s.msg_out(obj_msg_out, ' 3. Start testing.\n') objEngine.start_test() time.sleep(1) del objEngine s.chg_light_to_red(obj_light_FTP, instance_light_FTP)
def get_test_result(version, solid_args): obj_msg_out = solid_args[0] # obj_light_telnet = solid_args[1] # instance_light_telnet = solid_args[2] obj_light_FTP = solid_args[3] instance_light_FTP = solid_args[4] objEngine = Action(ip_engine_initiator, telnet_port, passwd, FTP_port, version, solid_args) s.msg_out(obj_msg_out, ' 5. Start getting result.\n') objEngine.get_result() time.sleep(1) del objEngine s.chg_light_to_red(obj_light_FTP, instance_light_FTP)
def get_status(self): obj_FTP = self._ftp() obj_FTP.GetFile('/pmt', './IOG-3', 'status', 'status_file', 'asc') with open('./IOG-3/status_file') as f: status = f.read(10) print(status) # try: # print('------begin open file') # with open('./IOG-3/status_file') as f: # status = f.read(10) # print(status) # except Exception: # print('Can not get status') s.chg_light_to_red(self.obj_light_FTP, self.instance_light_FTP) return status
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 config_initiator(IP_Entered, license, version, speed, solid_args): obj_msg_out = solid_args[0] obj_light_telnet = solid_args[1] instance_light_telnet = solid_args[2] # obj_light_FTP = solid_args[3] # instance_light_FTP = solid_args[4] _config_universal('initiator', IP_Entered, license, version, speed, solid_args) objEngine = Action(ip_engine_initiator, telnet_port, passwd, FTP_port, version, solid_args) s.msg_out(obj_msg_out, ' 2.1 Start registering drives.\n') objEngine.register_drives() # show info -- conmgr status. objEngine.show_conmgr_status() s.msg_out(obj_msg_out, ' 2. Finish configuring initiator engine.\n') time.sleep(0.25) del objEngine s.chg_light_to_red(obj_light_telnet, instance_light_telnet)
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)