Skip to content

pyntc.errors

pyntc custom exceptions.

pyntc.errors.CommandError

Bases: NTCError

Error for issuing command on device.

__init__(command, message)

Error for issuing command on device.

Parameters:

Name Type Description Default
command str

The command that failed.

required
message str

The error message returned from the device.

required

pyntc.errors.CommandListError

Bases: NTCError

Error for issuing a command from a list of commands on device..

__init__(commands, command, message)

Error for issuing a command from a list of commands on device.

Parameters:

Name Type Description Default
commands list

The list of commands that were to be sent to the device.

required
command str

The command that reported an error on the device.

required
message str

The error emssage returned from the device.

required

pyntc.errors.ConfFileNotFoundError

Bases: NTCError

Error for issues finding the config filename.

__init__(filename)

Error for issues finding the config filename.

Parameters:

Name Type Description Default
filename str

The name of the file used for config settings.

required

pyntc.errors.DeviceNameNotFoundError

Bases: NTCError

Error for issues finding name in inventory file, filename.

__init__(name, filename)

Error for issues finding name in inventory file, filename.

Parameters:

Name Type Description Default
name str

The hostname that failed the lookup.

required
filename str

The name of the file used for inventory.

required

pyntc.errors.DeviceNotActiveError

Bases: NTCError

Error for when the device is part of an HA cluster, and the device is not the active device.

__init__(hostname, redundancy_state, peer_redundancy_state)

Error for when the device is part of an HA cluster, and the device is not the active device.

Parameters:

Name Type Description Default
hostname str

The hostname of the device being validated.

required
redundancy_state str

Current redundancy state.

required
peer_redundancy_state str

Peer State.

required

pyntc.errors.FeatureNotFoundError

Bases: NTCError

Error for trying to use a PyNTC feature for an unsupported device_type.

__init__(feature, device_type)

Error for trying to use a PyNTC feature for an unsupported device_type.

Parameters:

Name Type Description Default
feature str

The PyNTC feature name.

required
device_type str

The PyNTC device_type name.

required

TODO: Remove this Exception when VLAN feature is removed.

pyntc.errors.FileSystemNotFoundError

Bases: NTCError

Error for inability to identify the default file system on network device.

__init__(hostname, command)

Error for inability to identify the default file system on network device.

Parameters:

Name Type Description Default
hostname str

The hostname of the device that failed.

required
command str

The command used to detect the default file system.

required

pyntc.errors.FileTransferError

Bases: NTCError

File Transfer Error.

__init__(message=None)

File Transfer Error.

Parameters:

Name Type Description Default
message str

Error message to pass. Defaults to None.

None

pyntc.errors.NTCError

Bases: Exception

Generic Error class for PyNTC.

__init__(message)

Generic Error class for PyNTC.

Parameters:

Name Type Description Default
message str

The error message associated with the Exception.

required

__repr__()

Representation of NTC error object.

pyntc.errors.NTCFileNotFoundError

Bases: NTCError

Error for not being able to find a file on a device.

__init__(hostname, file, directory)

Error for not being able to find a file on a device.

Parameters:

Name Type Description Default
hostname str

The hostname of the device that did not have the file.

required
file str

The name of the file that could not be found.

required
directory str

The directory on the network device where the file was searched for.

required

TODO: Rename dir arg as that is a reserved name in python.

pyntc.errors.NotEnoughFreeSpaceError

Bases: NTCError

Error for not having enough free space to transfer a file.

__init__(hostname, min_space=None, *, required=None, available=None, file_system=None)

Error for not having enough free space to transfer a file.

Parameters:

Name Type Description Default
hostname str

The hostname of the device being checked.

required
min_space str

The minimum amount of space required. Retained for backward compatibility with callers that only know the required value.

None
required int

Required bytes for the pending transfer.

None
available int

Free bytes currently available on the target filesystem.

None
file_system str

The target filesystem that was checked.

None

pyntc.errors.OSInstallError

Bases: NTCError

Error for failing to install an OS on a device.

__init__(hostname, desired_boot)

Error for failing to install an OS on a device.

Parameters:

Name Type Description Default
hostname str

The hostname of the device that failed to install OS.

required
desired_boot str

The OS that was attempted to be installed.

required

pyntc.errors.PeerFailedToFormError

Bases: NTCError

Error for failing to have High Availability Peer form after state change.

__init__(hostname, desired_state, current_state)

Error for failing to have High Availability Peer form after state change.

Parameters:

Name Type Description Default
hostname str

The hostname of the device that did not peer properly.

required
desired_state str

The peer redundancy state that was expected.

required
current_state str

The current peer redundancy state of the device.

required

pyntc.errors.RebootTimeoutError

Bases: NTCError

Error for inability to log into device after waiting for max time for reboot to complete.

__init__(hostname, wait_time)

Error for inability to log into device after waiting for max time for reboot to complete.

Parameters:

Name Type Description Default
hostname str

The hostname of the device that did not boot back up.

required
wait_time int

The amount of time waiting before considering the reboot failed.

required

pyntc.errors.SocketClosedError

Bases: NTCError

Error for network device closing the socket connection during operation.

__init__(message=None)

Error for network device closing the socket connection during operation.

Parameters:

Name Type Description Default
message str

A custom error message to use instead of the default.

None

pyntc.errors.UnsupportedDeviceError

Bases: NTCError

Error class for Unsupported Devices.

__init__(vendor)

Error class for Unsupported Devices.

Parameters:

Name Type Description Default
vendor str

The name of the deice's vendor to present in the error.

required

pyntc.errors.WLANDisableError

Bases: NTCError

Error for not being able to disable WLAN.

__init__(hostname, desired_wlans, actual_wlans)

Error for not being able to disable WLAN.

Parameters:

Name Type Description Default
hostname str

The hostname of the device that failed to disable all desired_wlans.

required
desired_wlans list

The WLAN IDs that should have been disabled.

required
actual_wlans list

The WLAN IDs that are disabled on the device.

required

pyntc.errors.WLANEnableError

Bases: NTCError

Error for not being able to enable WLAN.

__init__(hostname, desired_wlans, actual_wlans)

Error for not being able to enable WLAN.

Parameters:

Name Type Description Default
hostname str

The hostname of the device that failed to enable all desired_wlans.

required
desired_wlans list

The WLAN IDs that should have been enabled.

required
actual_wlans list

The WLAN IDs that are enabled on the device.

required

pyntc.errors.WaitingRebootTimeoutError

Bases: NTCError

Error for device not rebooting after sending install mode upgrade command.

__init__(hostname, wait_time)

Error for device not rebooting after sending install mode upgrade command.

Parameters:

Name Type Description Default
hostname str

The hostname of the device that did not boot back up.

required
wait_time int

The amount of time waiting before considering the reboot failed.

required