veritas.configparser.cisco_configparser

Module Contents

Classes

Configparser

configparser for Cisco devices

Functions

get_configparser(→ Configparser)

init configparser for Cisco devices

class veritas.configparser.cisco_configparser.Configparser(config: list, platform: str = 'ios')

Bases: veritas.configparser.abstract_configparser.Configparser

configparser for Cisco devices

Parameters:
  • config (list) – device configuration

  • platform (str) – platform of the device (ios, nxos, iosxr, asa, …)

get_interface_ipaddress(interface: str) dict

get interface IP address

Parameters:

interface (str) – name of the interface

Returns:

interface – interface configuration

Return type:

dict

get_interface_name_by_address(address: str) str | None

get interface name by IP address

Parameters:

address (str) – IP address

Returns:

interface_name – interface name

Return type:

str | None

get_interfaces() dict

get interfaces

Returns:

interfaces – interfaces

Return type:

dict

find_in_global(properties: dict) bool

check if properties are found in global config

Parameters:

properties (dict) – properties to search for

Returns:

found – True if found, False otherwise

Return type:

bool

find_in_interfaces(properties: dict) list

return list of interfaces that match properties

Parameters:

properties (dict) – properties to search for

Returns:

interfaces – list of interfaces that match properties

Return type:

list

get_fqdn() str

return FQDN of device

Returns:

fqdn – fqdn of device

Return type:

str

parse(config: list = None, platform: str = 'ios') bool

parse configuration of device

Parameters:
  • config (list, optional) – device config, by default None

  • platform (str, optional) – platform, by default ‘ios’

Returns:

parsed – true if parsing was successful, false otherwise

Return type:

bool

get_interface(interface: str) dict | None

get interface configuration by name

Parameters:

interface (str) – name of the interface

Returns:

interface – interface configuration or None if not found

Return type:

dict | None

get_vlans() tuple[list, list, list]

get vlans of the device

Returns:

global_vlans, svi, trunk_vlans – global_vlans, svi, trunk_vlans

Return type:

tuple[list, list, list]

get_correct_naming(name: str) str

return the right nameing of a port-channel

nxos and ios uses differnet naming for port-channel ios uses Port-channel, nxos uses port-channel

Parameters:

name (str) – interface name

Returns:

name – either Port-channel or port-channel

Return type:

str

get_device_config() list

return (not parsed) device configuration

Returns:

config – configuration of the device

Return type:

list

get_section(section: str) list

return section of the device configuration by name

Parameters:

section (str) – name of the section

Returns:

section – section of the device configuration

Return type:

list

get_global_config() list

return global configuration of the device

Returns:

global_config – global configuration of the device

Return type:

list

_save_naming()

save the naming of port-channel interface

_get_template(platform: str = 'ios') str | None

return template for the platform

Parameters:

platform (str, optional) – platform of the device, by default ‘ios’

Returns:

template – the template or None if failure or not found

Return type:

str | None

veritas.configparser.cisco_configparser.get_configparser(config: list, platform: str = 'ios') Configparser

init configparser for Cisco devices

Parameters:
  • config (list) – the device configuration

  • platform (str, optional) – the platform, by default ‘ios’

Returns:

the configparser

Return type:

Configparser