04-08-2021 04:22 PM
Hi All,
I have been reading up on pyats and would like to know how to create a topology file as a dict like {'hostname':'ip"} instead of the yaml file shown in the examples. The reason why I want to go with that method is becuase I am trying to connect to a few hundred devices to run specific show commands and store the output in a server.
Any help is appreciated!.
Thanks in advance!
07-16-2021 01:00 PM
Hello @SreekaanthGanesan3775,
Here's a very simple example of a topology file from the pyats documentation:
# Example # ------- # # creating a simple testbed topology from scratch # import testbed objects from pyats.topology import Testbed, Device, Interface, Link # create your testbed testbed = Testbed('manuallyCreatedTestbed', alias = 'iWishThisWasYaml', passwords = { 'tacacs': 'lab', 'enable': 'lab', }, servers = { 'tftp': { 'name': 'my-tftp-server', 'address': '10.1.1.1', }, }) # create your devices device = Device('tediousProcess', alias = 'gimmyYaml', connections = { 'a': { 'protocol': 'telnet', 'ip': '192.168.1.1', 'port': 80 } }) # create your interfaces interface_a = Interface('Ethernet1/1', type = 'ethernet', ipv4 = '1.1.1.1') interface_b = Interface('Ethernet1/2', type = 'ethernet', ipv4 = '1.1.1.2') # create your links link = Link('ethernet-1') # now let's hook up everything together # define the relationship. device.testbed = testbed device.add_interface(interface_a) device.add_interface(interface_b) interface_a.link = link interface_b.link = link
Here's the link to the documentation: https://pubhub.devnetcloud.com/media/pyats/docs/topology/creation.html#manual-creation
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide