pyntc.errors
¶
pyntc custom exceptions.
pyntc.errors.CommandError
¶
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
¶
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
¶
pyntc.errors.MaintModeProfileError
¶
Bases: NTCError
Error if selected maintenance mode profile does not exist.
__init__(hostname, profile, message=None)
¶
Error if selected maintenance mode profile does not exist.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hostname
|
str
|
The hostname of the device. |
required |
profile
|
str
|
The name of the missing maint-mode profile/unit. |
required |
message
|
str | None
|
Optional custom message which overrides the default_message. |
None
|
pyntc.errors.NTCError
¶
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 |
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.
The byte counts are kept as attributes so callers can render their own message
(or compute the shortfall) without parsing message. They are None when the
error is raised in the legacy min_space form.
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
|
Attributes:
| Name | Type | Description |
|---|---|---|
hostname |
str
|
The hostname of the device being checked. |
min_space |
str
|
The minimum amount of space required, legacy form only. |
required |
int
|
Required bytes for the pending transfer. |
available |
int
|
Free bytes currently available on the target filesystem. |
file_system |
str
|
The target filesystem that was checked. |
shortfall |
int
|
Bytes still needed for the transfer to succeed. |
pyntc.errors.OSInstallError
¶
Bases: NTCError
Error for failing to install an OS on a device.
__init__(hostname, desired_boot, detail=None)
¶
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 |
detail
|
str
|
The error output reported by the device. |
None
|
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
¶
pyntc.errors.UnsupportedDeviceError
¶
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 |
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 |
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 |