cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

XMC python modules used in example scripts

XMC python modules used in example scripts

StephanH
Valued Contributor III
Hello,

often in the XMC example scripts functions from the module "xmclib" or "device" are used.
Is there a documentation what functions are included, what parameters can be send and what returnvalues can be used?

If there is no documentation, is there a way to access the source code to find out what the functions can do?

It would be helpfule to use the existing code and not do reinvent the access to functions like "logger"

Here an example from XMC:

#@MetaDataEnd
from xmclib import emc_vars
from xmclib import logger
from xmclib import cli
from device import api

Best regards
Stephan

Regards Stephan
22 REPLIES 22

James_A
Valued Contributor
It's a bit weird - all the scripts import from xmclib, but /usr/local/Extreme_Networks/NetSight/appdata/scripting/system/xmclib/__init__.py imports logger, nbi and emc_vars from xmcbase, which I can't find anywhere.

/usr/local/Extreme_Networks/NetSight/appdata/scripting/system/device/base/baseapi.py has actual methods in it, although in the end they are just cli calls and some are unimplemented.

StephanH
Valued Contributor III
Hello Bharathiraja,

thank you for your answer. I am familiar with the XMC scripting tool and tasks and I know the content of the example scripts.

My question concerns the modules used in these examples. Especially the xmclib and the device module (the post above). In modules you can wrap function and classes to reuse these in other scripts.

The example scripts use these modules and I would like to use these, too. Therefore I have to know what functions are available and how can I use these functions (parameters and return values).

Best regards
Stephan
Regards Stephan

Bharathiraja__S
Extreme Employee
Hi Sh,

I am not sure if this is your question.

1) select the script from task and if you go to content tab where we can see the complete code of script.

2) Some of the basic scripts are available in github under Netsight.

3) XMC help tab has steps for scripting and how to create and run.

Thanks,
Suresh.B
GTM-P2G8KFN