def classic_in_out_func(username, password, hostname, applid, ssid, security=True): em = Emulator(hostname, model=2, oversize=(24, 80)) d = em.display try: welcome = d.find('===> Ex.: LOGON <userid>, TSO <userid>') if welcome: welcome.shift((1, 0))(f"L {applid} DATA='LROWS=9999,DB2={ssid}'", keys.ENTER, 240) if security: d(username, keys.NEWLINE) d(password, keys.ENTER) else: d(key=keys.ENTER, timeout=30) assert d.find('ZMENU VTM') yield d d(key=keys.PF3) d('X', key=keys.ENTER) finally: em.disconnect() em.close()
def classic_in_out(request): user = username if hasattr(request, 'param'): user = request.param em = Emulator(hostname, model=2, oversize=(24, 80)) try: d = em.display welcome = d.find('===> Ex.: LOGON <userid>, TSO <userid>') if welcome: logger.info(f"Logging to Classic applid {applid}") welcome.shift((1, 0))(f"L {applid} DATA='LROWS=9999'", keys.ENTER, 240) d(user, keys.NEWLINE) d(password, keys.ENTER) assert d.find('ZMENU VTM OM/DEX') yield d d(key=keys.PF3) d('X', key=keys.ENTER) finally: em.disconnect() em.close()
def classic_in_out(request): user = username if hasattr(request, 'param'): user = request.param em = Emulator(hostname, model=2, oversize=(24, 80)) d = em.display try: welcome = d.find('===> Ex.: LOGON <userid>, TSO <userid>') if welcome: logger.info(f"Logging to Classic applid {applid}") welcome.shift((1, 0))(f"L {applid}", keys.ENTER, 240) # welcome.shift((1, 0))(f"L {applid} DATA='cics={cics_job},LROWS=9999'", keys.ENTER, 30) #welcome(key=Keys.ENTER, wait_for="Please press ENTER to begin") d.find('ENTER USERID') d(user, keys.NEWLINE) d(password, keys.ENTER) assert d.find('ZMENU VTM OI-II') yield d d(key=keys.PF3) d('X', key=keys.ENTER) finally: em.disconnect() em.close()
def close_beacon(emulator: Emulator): logger.info("exiting applid") try: emulator.display(key=keys.HOME) emulator.display('=x', key=keys.ENTER, timeout=1000) finally: emulator.disconnect() emulator.close() logger.info("emulator was closed successfully")
def logon(self): if self.ispf is None: emulator = Emulator(self.exec_host, model=2, oversize=(62, 160)) try: self.ispf = ISPF(emulator=emulator, target=self.exec_host, model=2, username=self.username, password=self.password) display = self.ispf.em.display except: emulator.close() raise ParmException('LOGON problem') display.wait(10, 'ISPF Primary Option Menu') display.find_by_label('===>')('3.4').enter() gbl_hlq = '' try: gbl_hlq = rtes[self.rte.lower()]['gbl_hlq'] except: gbl_hlq = self.hlq tkancus = f'{gbl_hlq}.TKANCUS'.upper() display.find_by_label('Dsname Level . . .')( '', keys.ERASEEOF)(tkancus).enter() display.find(f' {tkancus}')('ex').enter() display.find_by_label('===>')('3').enter() if display.find('KCIP@TLV'): display.find_by_label('GBL_TARGET_HILEV:')( '', keys.ERASEEOF)(gbl_hlq).enter() # there are 2 3270 fields for GBL_USER_JCL (no idea why), so find_by_label doesn't work display.find('GBL_USER_JCL:')('') display.cursor = display.cursor[0], display.cursor[1] + 16 display('', keys.ERASEEOF)(f'{self.hlq}.PARMGEN.JCL') display.find_by_label('RTE_PLIB_HILEV:')('', keys.ERASEEOF)(self.hlq) display.find_by_label('RTE_NAME:')('', keys.ERASEEOF)( self.rte).enter() if self.is_new: # if not display.find('You have asked to configure a new RTE profile.'): # raise ParmException('Incorrect panel') display('').enter() if not display.find('KCIPQPGB'): raise ParmException('Incorrect panel') else: self.d = display
def classic_in_out(request): user = username if hasattr(request, 'param'): user = request.param em = Emulator(hostname, model=2, oversize=(24, 80)) d = em.display try: welcome = d.find('===> Ex.: LOGON <userid>, TSO <userid>') if welcome: welcome.shift((1, 0))(f"L {applid} DATA='LROWS=9999,DB2={ssid}'", keys.ENTER, 240) d(user, keys.NEWLINE) d(password, keys.ENTER) yield d finally: em.disconnect() em.close()