XMC python modules used in example scripts

  • 16 October 2018
  • 13 replies
  • 1075 views

Userlevel 5
  • Contributor
  • 270 replies
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[/code]

Best regards
Stephan

13 replies

Userlevel 4
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
Userlevel 5
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
Userlevel 6
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
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.
Userlevel 7
Hi Stephan,

I cannot give you a definitive answer, but you may be able to find the source on an XMC appliance. Python modules are most often implemented in Python, and sometimes delivered as source. Thus you may just need to find the relevant files (brute force: find / -iname xmclib\*) to be able to read them.

Useful documentation is preferable, of course. :-)

Thanks,
Erik
Userlevel 5
Hello Erik, hello James,

I have come as far as James. Therefore, the question how do I get to the information. I resolved the way till xmcbase, but I can't find it. Therefore this post.

I can't find any sources.

Best regards
Stephan
Userlevel 3
Hi, all.

We're actually in the process of creating a more comprehensive scripting and workflows guide that should answer most of these questions. I'll provide a link to the resource online once it is published.

Thanks,

John
Userlevel 5
Hello John,

thank you for feedback and good to hear. If you have a draft to read, I'm here 😉.

Regards
Stephan
Hello John,

thank you for feedback and good to hear. If you have a draft to read, I'm here 😉.

Regards
Stephan
Hi all,
Any idea about when this scripting guide will be available ?
Because there's a real lack of documentation.
Regards

Patrick
Userlevel 3
Hello John,

thank you for feedback and good to hear. If you have a draft to read, I'm here 😉.

Regards
Stephan
Hi, Patrick. We're working with development now, but we're also focusing on getting ready for the next release, so I can't give you a definitive time. Aside from the documentation for the 8.2 release though, this is the top priority.

Thanks again,

John
Userlevel 2

Hello John,

thank you for feedback and good to hear. If you have a draft to read, I'm here 😉.

Regards
Stephan
Hi, Patrick. We're working with development now, but we're also focusing on getting ready for the next release, so I can't give you a definitive time. Aside from the documentation for the 8.2 release though, this is the top priority.

Thanks again,

John


Hi,

Any update on XMC python scripting documentation?

Regards,

Rahman
Userlevel 1
Still waiting,.....
Any update? Really would be nice to have these modules documented.
Userlevel 1
Is there any update on it ? I'd love to have some documentation on the modules.

Reply