Python Scripting

Introduced in ExtremeXOS 15.6, Python scripting provides the ability to customize your switch and add functionality quickly by downloading and running scripts without the need for engineering expertise. Python scripting is extended using the synonymous load script and run script commands.



To use Python scripting, FIPS mode must be off (configure security fips-mode [on | off] and you need to ensure that Python support is enabled (configure security python [on | off]).

Expect Functionality

It may be necessary to interact with ExtremeXOS using Expect scripting functionality. The Python community offers a module that can provide this capability. ExtremeXOS uses version 3.2. For documentation, see

The provides interfaces to run interactive shell commands and to process the results through expect like functions. The challenge with exsh.clicmd() is that it is a synchronous call and not a separate process. The module was developed to provide a wrapper for that interfaces to exsh.clicmd().

Below is an example of using pexect together with the exshexpect module.

import pexpect

import exshexpect

Create a prompt for expect that will not match any command output.

exosPrompt = '::--:--::'

Create an expect object. Pass in the prompt and the back end function to call:

p = exshexpect.exshspawn(exosPrompt, exsh.clicmd)

Use sendline to send commands to the backend function (in this case exsh.clicmd) :

p.sendline('show fan') <-

idx = p.expect([exosPrompt, pexpect.EOF, pexpect.TIMEOUT])

print 'idx=',idx

print 'before->',p.before

print 'after->',p.after

Special case for passing in a command with an additional argument described in exsh.clicmd():

p.send('enable debug-mode\nC211-6BB4-E6F5-B579\n')

In the line above, use send() and include ‘newline‘ terminations for the command and the additional parameter.

This is the same as calling:

exsh.clicmd('enable debug-mode', True, args=‘C211-6BB4-E6F5-B579‘)

but using expect to process any response.

idx = p.expect([exosPrompt, pexpect.EOF, pexpect.TIMEOUT])