netcrawl.devices package

Submodules

netcrawl.devices.base module

class netcrawl.devices.base.Interface(**kwargs)[source]

Bases: object

Generic network device interface

get_network_ip()[source]
class netcrawl.devices.base.NetworkDevice(**kwargs)[source]

Bases: object

Generic network device

add_ip(ip)[source]

Adds an IP address to the list of other IPs

Parameters:ip (string) – An IP address
alert(msg, proc, failed=False, v=2, ip=None)[source]

Populates the failed messages variable for the device

all_neighbors()[source]
credentials(username=None, password=None, cred_type=None)[source]

Gets or sets the last successful credential used to log in to the device

first_serial_str()[source]
get_ips()[source]

Returns a list of IP addresses aggregated from interfaces.

get_serials()[source]
interfaces_to_string()[source]
merge_interfaces(new_interfaces)[source]

Merges a list of interfaces with the ones currently in the device. If the interface name matches, then the new interface will overwrite any old data it has new entries for.

Parameters:new_interfaces (List of interface objects) – One or more interface objects
neighbor_table(sh_src=True, sh_name=True, sh_ip=True, sh_platform=True)[source]

Create a formatted table of neighbors.

Keyword Arguments:
 
  • sh_src (bool) – When true, show the source interface for each entry
  • sh_name (bool) – When true, show the hostname for each entry
  • sh_ip (bool) – When true, show the IP address for each entry
  • sh_platform (bool) – When true, show the system platform for each entry
Returns:

A string representation of the PrettyTable containing this device’s neighbors.

Return type:

str

process_device()[source]

Main method which fully populates the network_device

save_config()[source]
short_pass()[source]
unique_name

Returns a unique identifier for this device

netcrawl.devices.cisco_device module

Created on Feb 19, 2017

@author: Wyko

class netcrawl.devices.cisco_device.CiscoDevice(*args, **kwargs)[source]

Bases: netcrawl.devices.base.NetworkDevice

get_serials()[source]
match_partial_to_full_interface(partial)[source]

Given a partial MAC address, iterate through all of this device’s interfaces and match the address to an interface. Return the interface.

  1. Split the partial interface by name and number
  2. For each interface, check if the interface name starts with the partial name
  3. If so, check if the interface number matches the partial interface number
  4. Return the full interface name
parse_neighbor(cdp_input)[source]

Accepts a single CDP neighbor entry and parses it into a dictionary.

parse_netmiko_platform(cdp_input)[source]
split_interface_name(interface_name)[source]

Returns a tuple containing (interface_type, interface_number)

netcrawl.devices.ios_device module

Created on Feb 19, 2017

@author: Wyko

class netcrawl.devices.ios_device.IosDevice(*args, **kwargs)[source]

Bases: netcrawl.devices.cisco_device.CiscoDevice

netcrawl.devices.nxos_device module

Created on Feb 18, 2017

@author: Wyko

class netcrawl.devices.nxos_device.NxosDevice(*args, **kwargs)[source]

Bases: netcrawl.devices.cisco_device.CiscoDevice

get_interfaces_config()[source]
get_interfaces_xml()[source]
get_serials()[source]

Returns serials based on XML output

Module contents