<?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: pyATS Learning &amp;quot;config&amp;quot; feature in Code Exchange</title>
    <link>https://community.cisco.com/t5/code-exchange/pyats-learning-quot-config-quot-feature/m-p/5364313#M205</link>
    <description>&lt;BLOCKQUOTE&gt;what is the use case of get all information.&lt;/BLOCKQUOTE&gt;&lt;P&gt;One reason to learn all would be to create a mock device.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;But I used the code below get information it works.&amp;nbsp;&lt;/P&gt;&lt;P&gt;device.learn("interface")&lt;BR /&gt;device.learn("routing")&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Yes, device.learn("all") and device.learn("config") both work and get the information, it's just weird how the data is parsed.&lt;BR /&gt;I did notice if you do the following, it seems to parse fine.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;device.execute("terminal length 0")
device.execute("terminal width 200")
config = device.learn("config") # or config = device.learn("all").config 
print(config)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;Alternatively you can try below :&lt;/P&gt;&lt;P&gt;device.execute("terminal length 0")&lt;BR /&gt;cfg = device.execute("show running-config")&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thanks. I was just trying to use&amp;nbsp;&lt;STRONG&gt;.learn()&lt;/STRONG&gt;&amp;nbsp;instead of executing the command myself because of what &lt;A title="Learn Devices" href="https://pubhub.devnetcloud.com/media/pyats-getting-started/docs/quickstart/learndevices.html" target="_blank" rel="noopener"&gt;the docs&lt;/A&gt; mention:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-center"&gt;&lt;SPAN&gt;Why use&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;learn&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;instead of a&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://pubhub.devnetcloud.com/media/pyats-getting-started/docs/quickstart/keyconcepts.html#term-Parser" target="_blank" rel="noopener"&gt;&lt;SPAN class=""&gt;parser&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;? The parsed output for different devices can result in different data structures. The&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;learn&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;function, by contrast, results in a&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;consistent&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;set of keys, which means that you can write&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;one&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;script that works on different devices.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 22 Jan 2026 17:00:26 GMT</pubDate>
    <dc:creator>toeknee2120</dc:creator>
    <dc:date>2026-01-22T17:00:26Z</dc:date>
    <item>
      <title>pyATS Learning "config" feature</title>
      <link>https://community.cisco.com/t5/code-exchange/pyats-learning-quot-config-quot-feature/m-p/5364282#M203</link>
      <description>&lt;P&gt;I noticed that when you do a&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;device.learn("all")&lt;/STRONG&gt; or &lt;STRONG&gt;device.learn("config")&lt;/STRONG&gt;, the config dictionary seems to be built strangely. It seems if a value has over 80 characters, its string is carried over to the next key. My guess is it has something to do with terminal width, but it's a little annoying. Has anyone noticed this, or is there a way around it?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;{
"some setting": "...some long value ov"
"er 80 characters": {}
}&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Jan 2026 15:29:24 GMT</pubDate>
      <guid>https://community.cisco.com/t5/code-exchange/pyats-learning-quot-config-quot-feature/m-p/5364282#M203</guid>
      <dc:creator>toeknee2120</dc:creator>
      <dc:date>2026-01-22T15:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: pyATS Learning "config" feature</title>
      <link>https://community.cisco.com/t5/code-exchange/pyats-learning-quot-config-quot-feature/m-p/5364294#M204</link>
      <description>&lt;P&gt;never tried all - may be when i get access to Lab will try.&lt;/P&gt;
&lt;P&gt;But I used the code below get information it works. what is the use case of get all information.&lt;/P&gt;
&lt;P&gt;device.learn("interface")&lt;BR /&gt;device.learn("routing")&lt;/P&gt;
&lt;P&gt;Alternatively you can try below :&lt;/P&gt;
&lt;P&gt;device.execute("terminal length 0")&lt;BR /&gt;cfg = device.execute("show running-config")&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jan 2026 16:08:58 GMT</pubDate>
      <guid>https://community.cisco.com/t5/code-exchange/pyats-learning-quot-config-quot-feature/m-p/5364294#M204</guid>
      <dc:creator>balaji.bandi</dc:creator>
      <dc:date>2026-01-22T16:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: pyATS Learning "config" feature</title>
      <link>https://community.cisco.com/t5/code-exchange/pyats-learning-quot-config-quot-feature/m-p/5364313#M205</link>
      <description>&lt;BLOCKQUOTE&gt;what is the use case of get all information.&lt;/BLOCKQUOTE&gt;&lt;P&gt;One reason to learn all would be to create a mock device.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;But I used the code below get information it works.&amp;nbsp;&lt;/P&gt;&lt;P&gt;device.learn("interface")&lt;BR /&gt;device.learn("routing")&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Yes, device.learn("all") and device.learn("config") both work and get the information, it's just weird how the data is parsed.&lt;BR /&gt;I did notice if you do the following, it seems to parse fine.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;device.execute("terminal length 0")
device.execute("terminal width 200")
config = device.learn("config") # or config = device.learn("all").config 
print(config)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;Alternatively you can try below :&lt;/P&gt;&lt;P&gt;device.execute("terminal length 0")&lt;BR /&gt;cfg = device.execute("show running-config")&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thanks. I was just trying to use&amp;nbsp;&lt;STRONG&gt;.learn()&lt;/STRONG&gt;&amp;nbsp;instead of executing the command myself because of what &lt;A title="Learn Devices" href="https://pubhub.devnetcloud.com/media/pyats-getting-started/docs/quickstart/learndevices.html" target="_blank" rel="noopener"&gt;the docs&lt;/A&gt; mention:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-center"&gt;&lt;SPAN&gt;Why use&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;learn&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;instead of a&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://pubhub.devnetcloud.com/media/pyats-getting-started/docs/quickstart/keyconcepts.html#term-Parser" target="_blank" rel="noopener"&gt;&lt;SPAN class=""&gt;parser&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;? The parsed output for different devices can result in different data structures. The&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;learn&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;function, by contrast, results in a&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;consistent&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;set of keys, which means that you can write&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;one&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;script that works on different devices.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jan 2026 17:00:26 GMT</pubDate>
      <guid>https://community.cisco.com/t5/code-exchange/pyats-learning-quot-config-quot-feature/m-p/5364313#M205</guid>
      <dc:creator>toeknee2120</dc:creator>
      <dc:date>2026-01-22T17:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: pyATS Learning "config" feature</title>
      <link>https://community.cisco.com/t5/code-exchange/pyats-learning-quot-config-quot-feature/m-p/5364336#M206</link>
      <description>&lt;P&gt;ok, on what device are you trying?&amp;nbsp;Nexus or IOS XE?&lt;/P&gt;
&lt;P&gt;Let me test when I get a chance on my Lab,&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jan 2026 18:12:32 GMT</pubDate>
      <guid>https://community.cisco.com/t5/code-exchange/pyats-learning-quot-config-quot-feature/m-p/5364336#M206</guid>
      <dc:creator>balaji.bandi</dc:creator>
      <dc:date>2026-01-22T18:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: pyATS Learning "config" feature</title>
      <link>https://community.cisco.com/t5/code-exchange/pyats-learning-quot-config-quot-feature/m-p/5364338#M207</link>
      <description>&lt;P&gt;NXOS&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jan 2026 18:18:26 GMT</pubDate>
      <guid>https://community.cisco.com/t5/code-exchange/pyats-learning-quot-config-quot-feature/m-p/5364338#M207</guid>
      <dc:creator>toeknee2120</dc:creator>
      <dc:date>2026-01-22T18:18:26Z</dc:date>
    </item>
  </channel>
</rss>

