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

Markus_Nikulski
Extreme Employee

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
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

 

StephanH
Valued Contributor III

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

Regards Stephan

dmertz
New Contributor

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

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

GTM-P2G8KFN