<?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: How to import and install third party python modules in an EXOS switch in ExtremeSwitching (EXOS/Switch Engine)</title>
    <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/how-to-import-and-install-third-party-python-modules-in-an-exos/m-p/30724#M5293</link>
    <description>Hi Stephen.&lt;BR /&gt;
&lt;BR /&gt;
Thanks for your help!!&lt;BR /&gt;
&lt;BR /&gt;
It was really usefull!&lt;BR /&gt;
&lt;BR /&gt;
Just in case you can help me... I am starting to use MIBS + Scripts in EXOS. Do you know if it is possible to fill the value of an OID from the own EXOS switch? &lt;BR /&gt;
&lt;BR /&gt;
I mean.. I' found that there are a mib_2 tree called "iso.org.dod.internet.mgmt.mib-2.scriptMIB&lt;BR /&gt;
1.3.6.1.2.1.64"&lt;BR /&gt;
"&lt;BR /&gt;
scriptMIB OBJECT-TYPE&lt;BR /&gt;
SYNTAX Module Identity&lt;BR /&gt;
&lt;UL&gt; 
&lt;LI&gt;DESCRIPTION This MIB module defines a set of objects that allow to 
&lt;/LI&gt;&lt;LI&gt;delegate management scripts to distributed managers.  
&lt;/LI&gt;&lt;/UL&gt;::= { mib-2 64 }"&lt;BR /&gt;
&lt;BR /&gt;
I'd like to fill this OID with values from my scripts, and be able to get these data from an external SNMP TOOL. Do you think this is possible?&lt;BR /&gt;
&lt;BR /&gt;
I am looking for information.. but nothing found yet..&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance!&lt;BR /&gt;
Daniel</description>
    <pubDate>Tue, 18 Dec 2018 23:38:00 GMT</pubDate>
    <dc:creator>DanielDelgado</dc:creator>
    <dc:date>2018-12-18T23:38:00Z</dc:date>
    <item>
      <title>How to import and install third party python modules in an EXOS switch</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/how-to-import-and-install-third-party-python-modules-in-an-exos/m-p/30722#M5291</link>
      <description>Hello everybody.&lt;BR /&gt;
&lt;BR /&gt;
I am trying to do an script to write in an OID mib a value. I don`t know if this is possible from an EXOS switch.I did not found any command to do this, so I thought to write an script to make an snmp set in an "free" OID and consult it periodically with an SNMP TOOL( not the XMC..).&lt;BR /&gt;
&lt;BR /&gt;
I wish to know is it is possible to install easysnmp python module in an EXOS switch, or if it is possible to install a third party python module. I found in the  "Python Getting Started  Guide" that it can be imported modules like this:&lt;BR /&gt;
&lt;BR /&gt;
"Adding Third-Party Modules&lt;BR /&gt;
One very nice thing about Python is its large community of programmers that have been around for many years. Because of this, many Python libraries and documentation exist, from Scientific Calculation to Game Programming.&lt;BR /&gt;
For your need, you may have to install new libraries on EXOS to use them for your code. This can be easily accomplished by TFTP-ing the files in the /config directory. Python will automatically search that directory. This is the default directory where files are sent when you do a tftp.&lt;BR /&gt;
As an example, if you need the eventd.py program and its configuration file eventd.conf, you simply tftp both files to the switch. You need a TFTP server on your PC, pointing to the directory where the files are located, and you type the tftp command on the switch.&lt;BR /&gt;
tftp 192.168.56.1 –g –r eventd.py&lt;BR /&gt;
tftp 192.168.56.1 –g –r eventd.conf&lt;BR /&gt;
You can now use the library in your Python script."&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
But I can not make it run with importing easysnmp.&lt;BR /&gt;
&lt;BR /&gt;
Any advise?&lt;BR /&gt;
&lt;BR /&gt;
Thanks a lot.&lt;BR /&gt;
Daniel.</description>
      <pubDate>Tue, 18 Dec 2018 19:46:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/how-to-import-and-install-third-party-python-modules-in-an-exos/m-p/30722#M5291</guid>
      <dc:creator>DanielDelgado</dc:creator>
      <dc:date>2018-12-18T19:46:00Z</dc:date>
    </item>
    <item>
      <title>RE: How to import and install third party python modules in an EXOS switch</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/how-to-import-and-install-third-party-python-modules-in-an-exos/m-p/30723#M5292</link>
      <description>I don't think you can import new libraries.  &lt;BR /&gt;
&lt;BR /&gt;
But you can do a SNMP set with the below python code.  This code changes the snmp sysname.&lt;BR /&gt;
&lt;BR /&gt;
&lt;DIV class="threadCode"&gt;&lt;B&gt;code:&lt;/B&gt;&lt;PRE spellcheck="false"&gt;from pysnmp.entity.rfc3413.oneliner import cmdgen&lt;BR /&gt;&lt;BR /&gt;cmdGen = cmdgen.CommandGenerator()&lt;BR /&gt;&lt;BR /&gt;errorIndication, errorStatus, errorIndex, varBinds = cmdGen.setCmd(&lt;BR /&gt;    cmdgen.CommunityData('private'),&lt;BR /&gt;    cmdgen.UdpTransportTarget(('192.168.1.66', 161)),&lt;BR /&gt;    ('1.3.6.1.2.1.1.5.0', rfc1902.OctetString('Testing123'))&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;# Check for errors and print out results&lt;BR /&gt;if errorIndication:&lt;BR /&gt;    print(errorIndication)&lt;BR /&gt;else:&lt;BR /&gt;    if errorStatus:&lt;BR /&gt;        print('%s at %s' % (&lt;BR /&gt;            errorStatus.prettyPrint(),&lt;BR /&gt;            errorIndex and varBinds[int(errorIndex)-1] or '?'&lt;BR /&gt;            )&lt;BR /&gt;        )&lt;BR /&gt;    else:&lt;BR /&gt;        for name, val in varBinds:&lt;BR /&gt;            print('%s = %s' % (name.prettyPrint(), val.prettyPrint()))&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
The CLI ouput looks like this &lt;BR /&gt;
&lt;BR /&gt;
&lt;DIV class="threadCode"&gt;&lt;B&gt;code:&lt;/B&gt;&lt;PRE spellcheck="false"&gt;SW02.10 # load sc snmp.py&lt;BR /&gt;1.3.6.1.2.1.1.5.0 = Testing123&lt;BR /&gt;SW02.11 # &lt;BR /&gt;&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 18 Dec 2018 21:32:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/how-to-import-and-install-third-party-python-modules-in-an-exos/m-p/30723#M5292</guid>
      <dc:creator>StephenW</dc:creator>
      <dc:date>2018-12-18T21:32:00Z</dc:date>
    </item>
    <item>
      <title>RE: How to import and install third party python modules in an EXOS switch</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/how-to-import-and-install-third-party-python-modules-in-an-exos/m-p/30724#M5293</link>
      <description>Hi Stephen.&lt;BR /&gt;
&lt;BR /&gt;
Thanks for your help!!&lt;BR /&gt;
&lt;BR /&gt;
It was really usefull!&lt;BR /&gt;
&lt;BR /&gt;
Just in case you can help me... I am starting to use MIBS + Scripts in EXOS. Do you know if it is possible to fill the value of an OID from the own EXOS switch? &lt;BR /&gt;
&lt;BR /&gt;
I mean.. I' found that there are a mib_2 tree called "iso.org.dod.internet.mgmt.mib-2.scriptMIB&lt;BR /&gt;
1.3.6.1.2.1.64"&lt;BR /&gt;
"&lt;BR /&gt;
scriptMIB OBJECT-TYPE&lt;BR /&gt;
SYNTAX Module Identity&lt;BR /&gt;
&lt;UL&gt; 
&lt;LI&gt;DESCRIPTION This MIB module defines a set of objects that allow to 
&lt;/LI&gt;&lt;LI&gt;delegate management scripts to distributed managers.  
&lt;/LI&gt;&lt;/UL&gt;::= { mib-2 64 }"&lt;BR /&gt;
&lt;BR /&gt;
I'd like to fill this OID with values from my scripts, and be able to get these data from an external SNMP TOOL. Do you think this is possible?&lt;BR /&gt;
&lt;BR /&gt;
I am looking for information.. but nothing found yet..&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance!&lt;BR /&gt;
Daniel</description>
      <pubDate>Tue, 18 Dec 2018 23:38:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/how-to-import-and-install-third-party-python-modules-in-an-exos/m-p/30724#M5293</guid>
      <dc:creator>DanielDelgado</dc:creator>
      <dc:date>2018-12-18T23:38:00Z</dc:date>
    </item>
    <item>
      <title>RE: How to import and install third party python modules in an EXOS switch</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/how-to-import-and-install-third-party-python-modules-in-an-exos/m-p/30725#M5294</link>
      <description>Hi Daniel,&lt;BR /&gt;
&lt;BR /&gt;
Theoretically you can use your scripts or NMS FlexViews or 3rd party tool to modify any R/W OIDs, and you can use your scripts or NMS FlexViews or 3rd party tool to view those OIDs. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
Hope that helps,&lt;BR /&gt;
Tomasz</description>
      <pubDate>Wed, 19 Dec 2018 05:34:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/how-to-import-and-install-third-party-python-modules-in-an-exos/m-p/30725#M5294</guid>
      <dc:creator>Tomasz</dc:creator>
      <dc:date>2018-12-19T05:34:00Z</dc:date>
    </item>
    <item>
      <title>RE: How to import and install third party python modules in an EXOS switch</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/how-to-import-and-install-third-party-python-modules-in-an-exos/m-p/30726#M5295</link>
      <description>It is possible to import third party python libraries, assuming they are pure Python2. All you need to do is copy the directory and all .py files inside it (including __init__.py) to the config directory of the switch. You can then import the library as normal inside your Python script, since /usr/local/cfg/ is included in the path.&lt;BR /&gt;
&lt;BR /&gt;
For example, assuming a library directory 'foo', with .py files '__init__.py', 'bar.py', 'baz.py', and 'bat.py' inside it, first create the directory 'foo' with 'mkdir foo'. Then, 'cd foo' and copy the .py files in to it.&lt;BR /&gt;
&lt;BR /&gt;
Once you've done this, 'cd' back to /usr/local/cfg/, and create your python script. You will be able to 'import foo'.&lt;BR /&gt;
&lt;BR /&gt;
As for 'easysnmp' specifically, this library is not able to be used because it includes some C code that must be compiled first (You can see that in the &lt;A href="https://github.com/kamakazikamikaze/easysnmp" target="_blank" rel="nofollow noreferrer noopener"&gt;easysnmp GitHub repo&lt;/A&gt;). EXOS does not allow the user to compile C code, so the we can't easily use easysnmp in EXOS. Stephen's example above is probably the easiest option in this case.&lt;BR /&gt;
&lt;BR /&gt;
Hope that didn't confuse things too much.</description>
      <pubDate>Wed, 19 Dec 2018 06:58:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/how-to-import-and-install-third-party-python-modules-in-an-exos/m-p/30726#M5295</guid>
      <dc:creator>BrandonC</dc:creator>
      <dc:date>2018-12-19T06:58:00Z</dc:date>
    </item>
  </channel>
</rss>

