Well, I remembered somewhere seeing a resize script for EXOS... the
Python Getting Started Guide (February 2015) from Extreme shows a file named "TermSize.py" on page 22, but no code for this. Thus I hacked up the following:
# source for terminal_size() function: # http://stackoverflow.com/questions/566746/how-to-get-console-window-width-in-python/3010495#3010495 def terminal_size(): import fcntl, termios, struct h, w, hp, wp = struct.unpack('HHHH', fcntl.ioctl(1, termios.TIOCGWINSZ, struct.pack('HHHH', 0, 0, 0, 0))) return w, h columns, lines = terminal_size() # columns must be in the range [80, 256] if columns < 80: columns = 80 elif columns > 256: columns = 256 # lines must be in the range [24, 128] if lines < 24: lines = 24 elif lines > 128: lines = 128 import exsh exsh.clicmd("configure cli columns {0}".format(columns)) exsh.clicmd("configure cli lines {0}".format(lines))
I suggest to save the script as
resize.py on the switch.
You can use it after resizing the terminal window:
- log into switch
- check terminal size used by EXOS
- resize terminal window
- run Python script from above
- check terminal size used by EXOS
Example:
~$ ssh admin@192.168.42.3 ExtremeXOS Copyright (C) 1996-2016 Extreme Networks. All rights reserved. This product is protected by one or more US patents listed at http://www.extremenetworks.com/patents along with their foreign counterparts. ============================================================================== Press the
or '?' key at any time for completions. Remember to save your configuration changes. * SW2.1 # show management | include size CLI screen size : 24 Lines 80 Columns (this session only) * SW2.2 # # ... resizing terminal window ... * SW2.2 # show management | include size CLI screen size : 24 Lines 80 Columns (this session only) * SW2.2 # run script resize * SW2.3 # show management | include size CLI screen size : 47 Lines 100 Columns (this session only)
Erik