ExtremeCloud IQ- Site Engine & Extreme Management Center

Expand all | Collapse all

XMC python modules used in example scripts

  • 1.  XMC python modules used in example scripts

    Posted 10-16-2018 17:36
    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



  • 2.  RE: XMC python modules used in example scripts

    Posted 10-18-2018 02:29
    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


  • 3.  RE: XMC python modules used in example scripts

    Posted 10-18-2018 03:43
    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


  • 4.  RE: XMC python modules used in example scripts

    Posted 11-06-2018 21:05
    Hello John,

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

    Regards
    Stephan


  • 5.  RE: XMC python modules used in example scripts

    Posted 10-18-2018 06:38
    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


  • 6.  RE: XMC python modules used in example scripts

    Posted 10-18-2018 11:50
    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



  • 7.  RE: XMC python modules used in example scripts

    Posted 11-06-2018 21:05
    Hi all,
    Any idea about when this scripting guide will be available ?
    Because there's a real lack of documentation.
    Regards

    Patrick


  • 8.  RE: XMC python modules used in example scripts

    Posted 11-06-2018 21:05
    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


  • 9.  RE: XMC python modules used in example scripts

    Posted 03-05-2019 13:36


    Hi,

    Any update on XMC python scripting documentation?

    Regards,

    Rahman


  • 10.  RE: XMC python modules used in example scripts

    Posted 04-26-2019 22:08
    Still waiting,.....


  • 11.  RE: XMC python modules used in example scripts

    Posted 06-03-2019 17:09
    Any update? Really would be nice to have these modules documented.


  • 12.  RE: XMC python modules used in example scripts

    Posted 10-18-2018 03:43
    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.


  • 13.  RE: XMC python modules used in example scripts

    Posted 11-13-2019 20:13

    I had this same question about module documentation. Is there any update on this?



  • 14.  RE: XMC python modules used in example scripts

    Posted 01-27-2020 13:04

    +1. Come on guys, can’t be that hard to provide documentation (which should already be available internally)...



  • 15.  RE: XMC python modules used in example scripts

    Posted 08-19-2019 08:32
    Is there any update on it ? I'd love to have some documentation on the modules.


  • 16.  RE: XMC python modules used in example scripts

    Posted 01-27-2020 15:59

    *crickets*



  • 17.  RE: XMC python modules used in example scripts

    Posted 01-29-2020 12:10

    FYI: I have reached out to Mgmt, which lead to an Extreme-internal request to check if some sort of releasable documentation is available and can be provided.



  • 18.  RE: XMC python modules used in example scripts

    Posted 02-14-2020 20:53

    Has there been any news on documentation. The mysterious xmcbase import is troublesome. Perhaps someone might be able to elaborate on what the contents of the library is and why it seems to be hidden?



  • 19.  RE: XMC python modules used in example scripts

    Posted 03-18-2020 11:35

    Hi everybody,

     

    i get in the queue fo people welcoming some more documentation on imports and how to properly re-use them for example. In the meanwhile to improve my ability i am importing and reverse engineering the amount of workflows written by Zdenek Pala. You all can do it if you wish

    https://github.com/extremenetworks/ExtremeScripting/tree/master/Netsight/oneview_workflows

    Thank you



  • 20.  RE: XMC python modules used in example scripts

    Posted 03-24-2020 15:02

    Also looking for

    Mig



  • 21.  RE: XMC python modules used in example scripts

    Posted 03-26-2020 07:12

    Hello,

     

    After several discussions with colleagues from Extreme, it turns out that the modules I mentioned
    are not intended for external parties (i.e. partners and customers).

     

    There are many dependencies in the source code and many changes (for example during an update) that are not documented. Using the modules (for example through reverse engineering) can cause problems.

     

    Extreme aims to do the work with the options in the GUI by using the scripts, workflows and emc_vars.

     

    In my opinion it is unfortunate that these modules are used in some system workflows and scripts.

     

    But that's the way it is. However, there will be no further documentation for these modules.

     

    Best regards

    Stephan



  • 22.  RE: XMC python modules used in example scripts

    Posted 03-27-2020 10:03

    Hi all,

    I like to bring some light in to the darkness. First you have to understand that XMC using Jython! This means that Python code get compiled to a Java class first and then becomes executed. This also mean that this Java call can use API call provided by the Java application serer you will never be found as a Python class.

    Now to the lines you often see in our per default provided scrips and Workflows

    from xmclib import emc_vars
    The “emc_vars” are injected doesn’t matter if you have the line in place or not. Why this line exists have to do with the Integrated Developer Environment (IDE) your developer use to satisfy the IDE.

    from xmclib import logger
    This LOG facility is the XMC one you get access via server.log you will find under Administration – Server – Server Log. By default, are only the ERROR message level visible. Changing the LOG level should be only mad during a short time period if debugging needed. If you write a scrip and like to see your non-ERROR level message is not clever to change the LOG level. I strongly recommend NOT to use this way of logging! Python itself have a LOG facility called “logging” which you can much better use for your needs.

    from xmclib import cli
    This method called “cli” is not the same than “emc_cli” you should use. Official supported are only “emc_cli”. In case you are using “cli” you cannot open any GTAC ticket!!!!

    from device import api[/code]
    Here is a direct access to the Java application server API. We will not expose any documentation about this internal API calls. Reverse engineering or guessing is not a good option to start using it!

    Best regard
    Markus

     



  • 23.  RE: XMC python modules used in example scripts

    Posted 11-06-2018 19:36
    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