<?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: Getting clean output from Extreme switch CLI using Python in ExtremeSwitching (EXOS/Switch Engine)</title>
    <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/getting-clean-output-from-extreme-switch-cli-using-python/m-p/42073#M9857</link>
    <description>And for what it returns:&lt;BR /&gt;
bash-3.2$ python regex.py Tag:     1:1g&lt;BR /&gt;</description>
    <pubDate>Mon, 09 Oct 2017 23:15:00 GMT</pubDate>
    <dc:creator>BrandonC</dc:creator>
    <dc:date>2017-10-09T23:15:00Z</dc:date>
    <item>
      <title>Getting clean output from Extreme switch CLI using Python</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/getting-clean-output-from-extreme-switch-cli-using-python/m-p/42068#M9852</link>
      <description>I am writing a python script to run some show commands on Extreme switches and storing output in a variable.  I am able to accomplish that but the output is not as I would like.  I am seeing the command and also switch name in my output but I would like to just see the result of my show command and nothing else.&lt;BR /&gt;
&lt;BR /&gt;
This is what I am seeing:&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;print "ISC Port is: ", ISC&lt;/B&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;I&gt;ISC Port is: sh vlan ISC | i Tag:&lt;/I&gt;&lt;BR /&gt;
&lt;I&gt;       Tag:      1:1g&lt;/I&gt;&lt;BR /&gt;
&lt;I&gt;Ext-SW1.com.5 #&lt;/I&gt;&lt;BR /&gt;
&lt;BR /&gt;
This is what I would like to see:&lt;BR /&gt;
&lt;BR /&gt;
&lt;I&gt;ISC Port is: &lt;/I&gt;&lt;I&gt;Tag:      1:1g&lt;BR /&gt;
&lt;BR /&gt;
&lt;/I&gt;Here is my code where I am reading output&lt;I&gt;:&lt;BR /&gt;
&lt;BR /&gt;
&lt;/I&gt;ISC = "sh vlan ISC | i Tag:"&lt;BR /&gt;
&lt;BR /&gt;
tn.write(ISC + "\n")&lt;BR /&gt;
idx, obj, output = tn.expect(["\.\r\n\r\*"], int(timeout))&lt;BR /&gt;
print "ISC Port is: ", outputHow do I get rid of device name and my commands from output to show only output.  I played around with "read_until" but can't seem to get it cleaned up.  Example:&lt;BR /&gt;
&lt;BR /&gt;
tn.write(ISC + "\n")&lt;BR /&gt;
&lt;B&gt;tn.read_until(".2 #")&lt;/B&gt;&lt;BR /&gt;
idx, obj, output = tn.expect(["\.\r\n\r\*"], int(timeout))&lt;BR /&gt;
print "ISC Port is: ", outputAny help will be appropriated.&lt;BR /&gt;
&lt;BR /&gt;</description>
      <pubDate>Fri, 06 Oct 2017 21:35:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/getting-clean-output-from-extreme-switch-cli-using-python/m-p/42068#M9852</guid>
      <dc:creator>Marvel_King</dc:creator>
      <dc:date>2017-10-06T21:35:00Z</dc:date>
    </item>
    <item>
      <title>RE: Getting clean output from Extreme switch CLI using Python</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/getting-clean-output-from-extreme-switch-cli-using-python/m-p/42069#M9853</link>
      <description>If the switch is running EXOS 21.x or later, you could use JSONRPC instead of screen scraping the telnet display. An example script is here: &lt;A href="https://github.com/extremenetworks/ExtremeScripting/tree/master/EXOS/Python/jsoncli" target="_blank" rel="nofollow noreferrer noopener"&gt;https://github.com/extremenetworks/ExtremeScripting/tree/master/EXOS/Python/jsoncli&lt;/A&gt;</description>
      <pubDate>Fri, 06 Oct 2017 21:47:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/getting-clean-output-from-extreme-switch-cli-using-python/m-p/42069#M9853</guid>
      <dc:creator>Dave_Hammers</dc:creator>
      <dc:date>2017-10-06T21:47:00Z</dc:date>
    </item>
    <item>
      <title>RE: Getting clean output from Extreme switch CLI using Python</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/getting-clean-output-from-extreme-switch-cli-using-python/m-p/42070#M9854</link>
      <description>As Dave mentionned, if you are running 21 or later, you really should consider JSONRPC.&lt;BR /&gt;</description>
      <pubDate>Sun, 08 Oct 2017 15:18:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/getting-clean-output-from-extreme-switch-cli-using-python/m-p/42070#M9854</guid>
      <dc:creator>Stephane_Grosj1</dc:creator>
      <dc:date>2017-10-08T15:18:00Z</dc:date>
    </item>
    <item>
      <title>RE: Getting clean output from Extreme switch CLI using Python</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/getting-clean-output-from-extreme-switch-cli-using-python/m-p/42071#M9855</link>
      <description>No, we are running 15.x.&lt;BR /&gt;</description>
      <pubDate>Mon, 09 Oct 2017 19:21:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/getting-clean-output-from-extreme-switch-cli-using-python/m-p/42071#M9855</guid>
      <dc:creator>Marvel_King</dc:creator>
      <dc:date>2017-10-09T19:21:00Z</dc:date>
    </item>
    <item>
      <title>RE: Getting clean output from Extreme switch CLI using Python</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/getting-clean-output-from-extreme-switch-cli-using-python/m-p/42072#M9856</link>
      <description>Since JSONRPC isn't available, I'd probably use regex to pull out the specific part you are looking for. I put together a quick example below:&lt;BR /&gt;
import re    output = 'sh vlan ISC | i Tag:\nTag:     1:1g\nExt-SW1.com.5 #'  p = re.compile('(Tag:\s*\d:\dg?)')  m = p.search(output)  output = m.group(1)  print output  &lt;BR /&gt;
This won't work for non-stacks, but it should give you an idea.&lt;BR /&gt;
&lt;BR /&gt;</description>
      <pubDate>Mon, 09 Oct 2017 23:15:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/getting-clean-output-from-extreme-switch-cli-using-python/m-p/42072#M9856</guid>
      <dc:creator>BrandonC</dc:creator>
      <dc:date>2017-10-09T23:15:00Z</dc:date>
    </item>
    <item>
      <title>RE: Getting clean output from Extreme switch CLI using Python</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/getting-clean-output-from-extreme-switch-cli-using-python/m-p/42073#M9857</link>
      <description>And for what it returns:&lt;BR /&gt;
bash-3.2$ python regex.py Tag:     1:1g&lt;BR /&gt;</description>
      <pubDate>Mon, 09 Oct 2017 23:15:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/getting-clean-output-from-extreme-switch-cli-using-python/m-p/42073#M9857</guid>
      <dc:creator>BrandonC</dc:creator>
      <dc:date>2017-10-09T23:15:00Z</dc:date>
    </item>
    <item>
      <title>RE: Getting clean output from Extreme switch CLI using Python</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/getting-clean-output-from-extreme-switch-cli-using-python/m-p/42074#M9858</link>
      <description>I am already using regex to extract what I need but I was hoping there is a cleaner way.  My regex is not pretty due to all extra junk I am scrapping. &lt;BR /&gt;</description>
      <pubDate>Mon, 09 Oct 2017 23:30:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/getting-clean-output-from-extreme-switch-cli-using-python/m-p/42074#M9858</guid>
      <dc:creator>Marvel_King</dc:creator>
      <dc:date>2017-10-09T23:30:00Z</dc:date>
    </item>
    <item>
      <title>RE: Getting clean output from Extreme switch CLI using Python</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/getting-clean-output-from-extreme-switch-cli-using-python/m-p/42075#M9859</link>
      <description>It's important to be using a good regex tool to cut down time on developing the right regex. There are lot's of good tools out there. I paid for an app regexbuddy but there is also &lt;A href="https://regex101.com/" target="_blank" rel="nofollow noreferrer noopener"&gt;https://regex101.com/&lt;/A&gt; that has python support and a very nice interface.</description>
      <pubDate>Mon, 30 Oct 2017 23:10:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/getting-clean-output-from-extreme-switch-cli-using-python/m-p/42075#M9859</guid>
      <dc:creator>Ed_McGuigan1</dc:creator>
      <dc:date>2017-10-30T23:10:00Z</dc:date>
    </item>
  </channel>
</rss>

