<?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 Use PyATS to connect to multiple devices in Tools</title>
    <link>https://community.cisco.com/t5/tools/use-pyats-to-connect-to-multiple-devices/m-p/4780271#M699</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;I am using the following python code to connect to a bunch of devices. Right now I am doing it one by one but it takes a lot of time, is there anyway to connec to multible devices at once and have it run the commands on them in parallel?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;testbed = load("empty-testbed.yaml")
for device in allDevices:
  # Helper function to add devices to the testbed
  dev = add_device(device.name, "ios", testbed, ip_addr=device.ip)
  dev.connect(log_stdout=False, connection_timeout=10)
  stp = dev.parse('show spanning-tree detail')
  instances = stp['mstp']['mst_instances']&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead of looping through the list and run the commands one by one, I just want to add all devices to the testbed and have it run the commands on all devices at once.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Feb 2023 08:46:17 GMT</pubDate>
    <dc:creator>rasmus.elmholt</dc:creator>
    <dc:date>2023-02-22T08:46:17Z</dc:date>
    <item>
      <title>Use PyATS to connect to multiple devices</title>
      <link>https://community.cisco.com/t5/tools/use-pyats-to-connect-to-multiple-devices/m-p/4780271#M699</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;I am using the following python code to connect to a bunch of devices. Right now I am doing it one by one but it takes a lot of time, is there anyway to connec to multible devices at once and have it run the commands on them in parallel?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;testbed = load("empty-testbed.yaml")
for device in allDevices:
  # Helper function to add devices to the testbed
  dev = add_device(device.name, "ios", testbed, ip_addr=device.ip)
  dev.connect(log_stdout=False, connection_timeout=10)
  stp = dev.parse('show spanning-tree detail')
  instances = stp['mstp']['mst_instances']&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead of looping through the list and run the commands one by one, I just want to add all devices to the testbed and have it run the commands on all devices at once.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 08:46:17 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/use-pyats-to-connect-to-multiple-devices/m-p/4780271#M699</guid>
      <dc:creator>rasmus.elmholt</dc:creator>
      <dc:date>2023-02-22T08:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: Use PyATS to connect to multiple devices</title>
      <link>https://community.cisco.com/t5/tools/use-pyats-to-connect-to-multiple-devices/m-p/4780303#M700</link>
      <description>&lt;P&gt;you need to use multiprocess example :&lt;/P&gt;
&lt;P&gt;&lt;A href="https://pubhub.devnetcloud.com/media/pyats/docs/async/multiprocessing.html" target="_blank"&gt;https://pubhub.devnetcloud.com/media/pyats/docs/async/multiprocessing.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;make sure you enough process when you run same time multi processs, it may freeze CPU if you overload test with limited multi process.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 09:30:34 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/use-pyats-to-connect-to-multiple-devices/m-p/4780303#M700</guid>
      <dc:creator>balaji.bandi</dc:creator>
      <dc:date>2023-02-22T09:30:34Z</dc:date>
    </item>
  </channel>
</rss>

