<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: XMC Python System Variables and api commands in Scripting</title>
    <link>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78167#M461</link>
    <description>&lt;P&gt;On the Engage portal there is a very nice recorded webinar from&amp;nbsp;Markus:&amp;nbsp;&lt;A href="https://extremenetworks.webinfinity.com/content/1103069" target="_blank" rel="nofollow noreferrer noopener"&gt;https://extremenetworks.webinfinity.com/content/1103069&lt;/A&gt;&lt;/P&gt;&lt;P&gt;To check if you have access&lt;/P&gt;&lt;P&gt;Mig&lt;/P&gt;</description>
    <pubDate>Thu, 01 Oct 2020 02:58:12 GMT</pubDate>
    <dc:creator>Miguel-Angel_RO</dc:creator>
    <dc:date>2020-10-01T02:58:12Z</dc:date>
    <item>
      <title>XMC Python System Variables and api commands</title>
      <link>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78166#M460</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am starting to create our own scripts/macros for certain tasks in Python and been looking at some of the built in one, so a simple one is disable a port:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;from device import api&lt;BR /&gt;&lt;BR /&gt;print "selected ports = " + emc_vars["port"]&lt;BR /&gt;api.perform_port_operation("disable", emc_vars["port"])&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I can see from above there is a system variable of emc_vars[“ports”] and an api command to perform a port operation….&lt;/P&gt;&lt;P&gt;Where do I get a list of all variables and all the api commands so I can create my own stuff?&lt;/P&gt;&lt;P&gt;The alternative is to send SNMP commands, but this is simpler. I am looking to do one for example to enable/disable 802.1X mac or dot1x or mode.&lt;/P&gt;&lt;P&gt;Thanks for any references,&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2020 02:30:52 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78166#M460</guid>
      <dc:creator>Chad5</dc:creator>
      <dc:date>2020-10-01T02:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: XMC Python System Variables and api commands</title>
      <link>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78167#M461</link>
      <description>&lt;P&gt;On the Engage portal there is a very nice recorded webinar from&amp;nbsp;Markus:&amp;nbsp;&lt;A href="https://extremenetworks.webinfinity.com/content/1103069" target="_blank" rel="nofollow noreferrer noopener"&gt;https://extremenetworks.webinfinity.com/content/1103069&lt;/A&gt;&lt;/P&gt;&lt;P&gt;To check if you have access&lt;/P&gt;&lt;P&gt;Mig&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2020 02:58:12 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78167#M461</guid>
      <dc:creator>Miguel-Angel_RO</dc:creator>
      <dc:date>2020-10-01T02:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: XMC Python System Variables and api commands</title>
      <link>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78168#M462</link>
      <description>&lt;P&gt;Chad,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is also this great reference site with a lot of contributions from &lt;USER-MENTION data-id="6370292"&gt;@Zdenek Pala&lt;/USER-MENTION&gt;&amp;nbsp;:&amp;nbsp;&lt;A href="https://github.com/extremenetworks/ExtremeScripting/tree/master/Netsight" target="_blank" rel="nofollow noreferrer noopener"&gt;https://github.com/extremenetworks/ExtremeScripting/tree/master/Netsight&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Mig&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2020 22:51:41 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78168#M462</guid>
      <dc:creator>Miguel-Angel_RO</dc:creator>
      <dc:date>2020-10-01T22:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: XMC Python System Variables and api commands</title>
      <link>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78169#M463</link>
      <description>&lt;P&gt;Thank you, unfortunately, I don’t have access to the webinar. I checked the github site but doesn’t have the api. calls.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for all attempts to help.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Oct 2020 00:02:59 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78169#M463</guid>
      <dc:creator>Chad5</dc:creator>
      <dc:date>2020-10-07T00:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: XMC Python System Variables and api commands</title>
      <link>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78170#M464</link>
      <description>&lt;P&gt;Hello Chad,&lt;/P&gt;&lt;P&gt;to get all emc_vars with values for a device, you ca create a python script like:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;EM&gt;for key, value in emc_vars.iteritems():&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print(key + " =&amp;gt; " + value)&lt;/EM&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;run this script again a device and you will receive all key and the values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 02:03:54 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78170#M464</guid>
      <dc:creator>StephanH</dc:creator>
      <dc:date>2020-10-08T02:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: XMC Python System Variables and api commands</title>
      <link>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78171#M465</link>
      <description>&lt;P&gt;If you want to see the available emc_vars run this XMC script&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;import json&lt;BR /&gt;json_out = json.dumps(emc_vars, sort_keys=True, indent=4)&lt;BR /&gt;print json_out&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Oct 2020 02:12:59 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78171#M465</guid>
      <dc:creator>Ludovico_Steven</dc:creator>
      <dc:date>2020-10-10T02:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: XMC Python System Variables and api commands</title>
      <link>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78172#M466</link>
      <description>&lt;P&gt;Hello Chad,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is your problem solved&amp;nbsp; or can we help you even further?&lt;BR /&gt;If it is solved it would be great if you click on "Best answer", so that everyone can see that the question is solved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Stephan&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2020 05:05:41 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78172#M466</guid>
      <dc:creator>StephanH</dc:creator>
      <dc:date>2020-10-14T05:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: XMC Python System Variables and api commands</title>
      <link>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78173#M467</link>
      <description>&lt;P&gt;Hello together,&lt;/P&gt;&lt;P&gt;This document &lt;A href="https://api.extremenetworks.com/XMC/Scripting/Python_with_XMC_8.1_v0.94.pdf" target="_blank" rel="nofollow noreferrer noopener"&gt;https://api.extremenetworks.com/XMC/Scripting/Python_with_XMC_8.1_v0.94.pdf&lt;/A&gt; has helped me to get in touch with python and XMC. On page 5 there are some emc_vars listed too. Perhaps there are some further information for you.&lt;/P&gt;&lt;P&gt;Best regards&lt;BR /&gt;Yannick&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 20:58:58 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78173#M467</guid>
      <dc:creator>yas1</dc:creator>
      <dc:date>2020-10-20T20:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: XMC Python System Variables and api commands</title>
      <link>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78174#M468</link>
      <description>&lt;P&gt;Thank you all, I will be testing this and getting back to you…&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Jan 2021 02:17:38 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78174#M468</guid>
      <dc:creator>Chad5</dc:creator>
      <dc:date>2021-01-23T02:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: XMC Python System Variables and api commands</title>
      <link>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78175#M469</link>
      <description>&lt;P&gt;This is great info and I was able to progress so much further than before after reading the pdf document and your suggestions.&lt;/P&gt;&lt;P&gt;One last thing I wonder if there is a document that discribed the various calls that I see in the included XMC example scripts. I see them import:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;from device import api&lt;BR /&gt;&lt;BR /&gt;from device.deviceutils import DeviceUtils&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color:#222222;"&gt;&lt;SPAN style="background-color:#ffffff;"&gt;then there are calls that are not using the global objects like “emc_cli or emc_nbi”…&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color:#222222;"&gt;&lt;SPAN style="background-color:#ffffff;"&gt;so I see calls like:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DeviceUtils.get_device_family ...... (I am guessing there are a lot&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;api.vlan.config_switchport_trunk ......&lt;BR /&gt;&lt;BR /&gt;api.perform_port_operations .....&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Seems there is a lot more we can also do with the api.xxxxxxxx&lt;/P&gt;&lt;P&gt;the emc_cli is very good but it’s nice to know about the other methods using api to do device functions.&lt;/P&gt;&lt;P&gt;something I was looking how to do is after I send a emc_cli command, to send a refresh command on the device I was working with to update it’s new status. I know I can probably use nbi for that, but there might be an easier way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you all...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Jan 2021 04:57:33 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78175#M469</guid>
      <dc:creator>Chad5</dc:creator>
      <dc:date>2021-01-23T04:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: XMC Python System Variables and api commands</title>
      <link>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78176#M470</link>
      <description>&lt;P&gt;Hello Chad,&lt;/P&gt;&lt;P&gt;the official statement is (on my request). Do not use any of these modules (like device, xmclib, api, … ). These modules are not documented nor can you relay the modules are available in future. Typically these modules are linked to Java classes.&amp;nbsp;It makes little sense here to try to use the included functions by reverse engineering.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Jan 2021 23:25:28 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78176#M470</guid>
      <dc:creator>StephanH</dc:creator>
      <dc:date>2021-01-23T23:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: XMC Python System Variables and api commands</title>
      <link>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78177#M471</link>
      <description>&lt;P&gt;ohhh. ok. Didn’t know that. So I will refrain from trying to use those and stick to the document shared above.&lt;/P&gt;&lt;P&gt;so, I guess the only way to then send a refresh (rediscover to update ports)&amp;nbsp;command in a pythen script is figure out how to send a nbi command using emc_nbi.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2021 02:06:50 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78177#M471</guid>
      <dc:creator>Chad5</dc:creator>
      <dc:date>2021-01-26T02:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: XMC Python System Variables and api commands</title>
      <link>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78178#M472</link>
      <description>&lt;P&gt;Hello Chad,&lt;/P&gt;&lt;P&gt;do I understand you correctly that you want to display the current values from the switches and other devices in the XMC without clicking "Rediscover"?&lt;/P&gt;&lt;P&gt;Or is it about having current values in your script?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2021 03:22:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78178#M472</guid>
      <dc:creator>StephanH</dc:creator>
      <dc:date>2021-01-26T03:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: XMC Python System Variables and api commands</title>
      <link>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78179#M473</link>
      <description>&lt;P&gt;Hi Stephan,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am going to run a script, which uses emc_cli to perform some tasks, which may change the current status of ports, vlans…&amp;nbsp;whatever.&lt;/P&gt;&lt;P&gt;At the end at the script, I would like to tell XMC to initiate a rediscover of that switch/port to get the new status.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2021 23:08:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78179#M473</guid>
      <dc:creator>Chad5</dc:creator>
      <dc:date>2021-01-26T23:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: XMC Python System Variables and api commands</title>
      <link>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78180#M474</link>
      <description>&lt;P&gt;Hello Chad,&lt;/P&gt;&lt;P&gt;as far as I know, you can't trigger rediscover in the NBI or via the old Rest/SOAP API.&lt;BR /&gt;You can only optimize the Discover settings under Administration-&amp;gt;Options-&amp;gt;Management Center Collector. However, this does not really help you I thnil&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 03:01:40 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78180#M474</guid>
      <dc:creator>StephanH</dc:creator>
      <dc:date>2021-01-27T03:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: XMC Python System Variables and api commands</title>
      <link>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78181#M475</link>
      <description>&lt;P&gt;You can, I use this mutation query for it:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;        mutation {&lt;BR /&gt;          network {&lt;BR /&gt;            rediscoverDevices(input: {devices: {ipAddress: "&amp;lt;IP&amp;gt;"}}) {&lt;BR /&gt;              status&lt;BR /&gt;              message&lt;BR /&gt;            }&lt;BR /&gt;          }&lt;BR /&gt;        }&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Replace &amp;lt;IP&amp;gt; with your switch IP address.&lt;/P&gt;&lt;P&gt;Do you need the Python code to interact with XMC NBI ?&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 23:29:54 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78181#M475</guid>
      <dc:creator>Ludovico_Steven</dc:creator>
      <dc:date>2021-01-27T23:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: XMC Python System Variables and api commands</title>
      <link>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78182#M476</link>
      <description>&lt;P&gt;It would be so kind of you if you can send me the code, as I am new to this… it would give me a good example to learn all of this and then change it as needed for other tasks.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 00:17:06 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78182#M476</guid>
      <dc:creator>Chad5</dc:creator>
      <dc:date>2021-01-28T00:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: XMC Python System Variables and api commands</title>
      <link>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78183#M477</link>
      <description>&lt;P&gt;This is what I use in my scripts:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    if nbiMutation(NBI_Query['rediscover_device'].replace('&amp;lt;IP&amp;gt;', emc_vars['deviceIP'])):&lt;BR /&gt;        print "Initiated XMC rediscovery of switch"&lt;BR /&gt;    else:&lt;BR /&gt;        print "Failed to trigger XMC rediscovery of switch; perform manually"&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I attached a file which has all my the methods I use; you can pluck the methods you need from it.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 16:52:29 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/xmc-python-system-variables-and-api-commands/m-p/78183#M477</guid>
      <dc:creator>Ludovico_Steven</dc:creator>
      <dc:date>2021-01-28T16:52:29Z</dc:date>
    </item>
  </channel>
</rss>

