ptovnetlab

ptovnetlab module/script

Entry-point module for package. Gathers and parses run-state details

from a list of Arista network switches. Then creates a GNS3 virtual- lab project in which the interrogated devices are emulated.

Attributes

kwdict

Functions

read_file(file_to_read)

Open a file and return its contents as a list of strings

list_search(list_to_search, item_to_find)

Search a list for a specified string

predelimiter(string, delimiter)

Returns the section of a string before the first instance of a delimiter.

p_to_v(**kwargs)

Pull switch run-state data, massage it, and turn it into a GNS3 lab

Module Contents

ptovnetlab.read_file(file_to_read)[source]

Open a file and return its contents as a list of strings

Parameters:

file_to_read (str) – The path of the file to be read

Returns:

list of lines – The contents of the file as a list of strings

Return type:

list

Search a list for a specified string

Parameters:
  • list_to_search (list) – The list to be searched

  • item_to_find (str) – The item to search for

Return type:

bool

ptovnetlab.predelimiter(string, delimiter)[source]

Returns the section of a string before the first instance of a delimiter.

ptovnetlab.p_to_v(**kwargs)[source]

Pull switch run-state data, massage it, and turn it into a GNS3 lab

Parameters:
  • username (str) – The username to be used in authenticating eapi calls to the switches

  • passwd (str) – The password to be used in authenticating eapi calls to the switches

  • filename (str) – Name of the file containing the list of switches to be interrogated

  • switchlist (list) – List object of names of switches to be interrogated.

  • servername (str) – The name of the remote GNS3/Docker server

  • prjname (str) – The name of the project to create on the GNS3 server

Returns:

result

Return type:

str

ptovnetlab.kwdict[source]