<?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: custom fields when building testbed from CSV in DevNet General Discussions</title>
    <link>https://community.cisco.com/t5/devnet-general-discussions/pyats-custom-fields-when-building-testbed-from-csv/m-p/4927669#M2089</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hey &lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/612432"&gt;@grahamt-sec&lt;/a&gt;&amp;nbsp; i think you need to add a new column to the CSV file with the header 'custom'&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;The value of this column should be a dictionary of custom fields and values.&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;hostname,ip,username,password,protocol,os,enable_password,platform,wan_intf,custom
WANRTR01,192.168.4.5,user1,xx,ssh,iosxe,xx,C8300-2N2S-4T2X,Te0/0/4,{'wan_intf': 'Te0/0/4'}&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;It should create something like this&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;devices:
  WANRTR01:
    connections:
      cli:
        ip: 192.168.4.5
        protocol: ssh
        credentials:
          default:
            password: '%ENC{==}'
            username: user1
        enable:
          password: '%ENC{==}'
        os: iosxe
        platform: C8300-2N2S-4T2X
        type: iosxe
    custom:
      wan_intf: Te0/0/4&lt;/LI-CODE&gt;&lt;P&gt;If you then&amp;nbsp;use the '--add-keys' option into the add the custom field to the testbed you should have the&amp;nbsp;&lt;SPAN&gt;new testbed.yaml file with the custom field added&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;pyats create testbed file --path my_devices.csv --output yaml/my_testbed.yaml --add-keys custom&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;devices:
  WANRTR01:
    connections:
      cli:
        ip: 192.168.4.5
        protocol: ssh
        credentials:
          default:
            password: '%ENC{==}'
            username: user1
        enable:
          password: '%ENC{==}'
        os: iosxe
        platform: C8300-2N2S-4T2X
        type: iosxe
    custom:
      wan_intf: Te0/0/4&lt;/LI-CODE&gt;&lt;P&gt;Here is a link&amp;nbsp;&lt;A href="https://pubhub.devnetcloud.com/media/pyats-getting-started/docs/quickstart/manageconnections.html" target="_blank"&gt;https://pubhub.devnetcloud.com/media/pyats-getting-started/docs/quickstart/manageconnections.html&lt;/A&gt;&amp;nbsp;and this too&amp;nbsp;&lt;A href="https://pubhub.devnetcloud.com/media/pyats/docs/tcl/datastructures.html?highlight=custom" target="_blank"&gt;https://pubhub.devnetcloud.com/media/pyats/docs/tcl/datastructures.html?highlight=custom&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Try this and see if its what you are looking for.&lt;/P&gt;</description>
    <pubDate>Fri, 22 Sep 2023 07:42:53 GMT</pubDate>
    <dc:creator>bigevilbeard</dc:creator>
    <dc:date>2023-09-22T07:42:53Z</dc:date>
    <item>
      <title>pyATS: custom fields when building testbed from CSV</title>
      <link>https://community.cisco.com/t5/devnet-general-discussions/pyats-custom-fields-when-building-testbed-from-csv/m-p/4927354#M2086</link>
      <description>&lt;P&gt;I want to add a custom field of information to my testbed. I am using --add-keys. The file processes fine but validation fails:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;YAML Lint Messages&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;------------------&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;Errors&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;------&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;- ['devices', 'WANRTR01']: Unsupported keys:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;"wan_intf" (my_testbed.yaml line:16 column:5)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;My csv looks like this:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;hostname,ip,username,password,protocol,os,enable_password,platform,wan_intf&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;WANRTR01,192.168.4.5,user1,xx,ssh,iosxe,xx,C8300-2N2S-4T2X,Te0/0/4&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;This does create a dict, but it looks to be in the wrong place. (? should be under custom:)&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;devices:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;ATRTEWPIP1:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;connections:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;cli:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;ip: 192.168.4.5&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;protocol: ssh&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;credentials:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;default:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;password: '%ENC{==}'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;username: user1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;enable:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;password: '%ENC{==}'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;os: iosxe&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;platform: C8300-2N2S-4T2X&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;type: iosxe&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT face="courier new,courier" size="1 2 3 4 5 6 7"&gt;wan_intf: Te0/0/4&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;I also used 'custom' as the column header but that did not work either. The lint came back with expecting dict got string on a couple tries.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How do I add custom fields/data to the CSV file in order to result with at valid testbed.yaml?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 16:31:15 GMT</pubDate>
      <guid>https://community.cisco.com/t5/devnet-general-discussions/pyats-custom-fields-when-building-testbed-from-csv/m-p/4927354#M2086</guid>
      <dc:creator>grahamt-sec</dc:creator>
      <dc:date>2023-09-21T16:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: pyATS: custom fields when building testbed from CSV</title>
      <link>https://community.cisco.com/t5/devnet-general-discussions/pyats-custom-fields-when-building-testbed-from-csv/m-p/4927666#M2088</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;BR /&gt;According to the pyats create doc all unknow key/values will be added to the root of the device (so the behaviour works as designed).&lt;/P&gt;
&lt;P&gt;Your best option is using a Jinja template with python. Have a look at&amp;nbsp;&lt;A href="https://github.com/maercu/ciscosupportexamples/tree/main/pyatstb" target="_blank"&gt;https://github.com/maercu/ciscosupportexamples/tree/main/pyatstb&lt;/A&gt;&amp;nbsp;as a starting point.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2023 07:41:24 GMT</pubDate>
      <guid>https://community.cisco.com/t5/devnet-general-discussions/pyats-custom-fields-when-building-testbed-from-csv/m-p/4927666#M2088</guid>
      <dc:creator>Marcel Zehnder</dc:creator>
      <dc:date>2023-09-22T07:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: pyATS: custom fields when building testbed from CSV</title>
      <link>https://community.cisco.com/t5/devnet-general-discussions/pyats-custom-fields-when-building-testbed-from-csv/m-p/4927669#M2089</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hey &lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/612432"&gt;@grahamt-sec&lt;/a&gt;&amp;nbsp; i think you need to add a new column to the CSV file with the header 'custom'&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;The value of this column should be a dictionary of custom fields and values.&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;hostname,ip,username,password,protocol,os,enable_password,platform,wan_intf,custom
WANRTR01,192.168.4.5,user1,xx,ssh,iosxe,xx,C8300-2N2S-4T2X,Te0/0/4,{'wan_intf': 'Te0/0/4'}&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;It should create something like this&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;devices:
  WANRTR01:
    connections:
      cli:
        ip: 192.168.4.5
        protocol: ssh
        credentials:
          default:
            password: '%ENC{==}'
            username: user1
        enable:
          password: '%ENC{==}'
        os: iosxe
        platform: C8300-2N2S-4T2X
        type: iosxe
    custom:
      wan_intf: Te0/0/4&lt;/LI-CODE&gt;&lt;P&gt;If you then&amp;nbsp;use the '--add-keys' option into the add the custom field to the testbed you should have the&amp;nbsp;&lt;SPAN&gt;new testbed.yaml file with the custom field added&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;pyats create testbed file --path my_devices.csv --output yaml/my_testbed.yaml --add-keys custom&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;devices:
  WANRTR01:
    connections:
      cli:
        ip: 192.168.4.5
        protocol: ssh
        credentials:
          default:
            password: '%ENC{==}'
            username: user1
        enable:
          password: '%ENC{==}'
        os: iosxe
        platform: C8300-2N2S-4T2X
        type: iosxe
    custom:
      wan_intf: Te0/0/4&lt;/LI-CODE&gt;&lt;P&gt;Here is a link&amp;nbsp;&lt;A href="https://pubhub.devnetcloud.com/media/pyats-getting-started/docs/quickstart/manageconnections.html" target="_blank"&gt;https://pubhub.devnetcloud.com/media/pyats-getting-started/docs/quickstart/manageconnections.html&lt;/A&gt;&amp;nbsp;and this too&amp;nbsp;&lt;A href="https://pubhub.devnetcloud.com/media/pyats/docs/tcl/datastructures.html?highlight=custom" target="_blank"&gt;https://pubhub.devnetcloud.com/media/pyats/docs/tcl/datastructures.html?highlight=custom&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Try this and see if its what you are looking for.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2023 07:42:53 GMT</pubDate>
      <guid>https://community.cisco.com/t5/devnet-general-discussions/pyats-custom-fields-when-building-testbed-from-csv/m-p/4927669#M2089</guid>
      <dc:creator>bigevilbeard</dc:creator>
      <dc:date>2023-09-22T07:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: pyATS: custom fields when building testbed from CSV</title>
      <link>https://community.cisco.com/t5/devnet-general-discussions/pyats-custom-fields-when-building-testbed-from-csv/m-p/5012206#M2235</link>
      <description>&lt;P&gt;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/612432"&gt;@grahamt-sec&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All sorted?&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2024 20:29:30 GMT</pubDate>
      <guid>https://community.cisco.com/t5/devnet-general-discussions/pyats-custom-fields-when-building-testbed-from-csv/m-p/5012206#M2235</guid>
      <dc:creator>Ruben Cocheno</dc:creator>
      <dc:date>2024-02-02T20:29:30Z</dc:date>
    </item>
  </channel>
</rss>

