pyntc.devices.f5_device
¶
Module for using an F5 TMOS device over the REST / SOAP.
pyntc.devices.f5_device.F5Device
¶
Bases: BaseDevice
F5 LTM Device Implementation.
boot_options
property
¶
Get active volume.
Returns:
| Type | Description |
|---|---|
dict
|
Key is |
fqdn
property
¶
Get fully-qualified domain name.
Returns:
| Type | Description |
|---|---|
str
|
Fully qualified domain name. |
hostname
property
¶
Get hostname of device.
Returns:
| Type | Description |
|---|---|
str
|
Hostname. |
interfaces
property
¶
Get list of images on the device.
Returns:
| Type | Description |
|---|---|
list
|
List of images. |
model
property
¶
Get model of device.
Returns:
| Type | Description |
|---|---|
str
|
Model of device. |
os_version
property
¶
Get version of device.
Returns:
| Type | Description |
|---|---|
str
|
Version on device. |
serial_number
property
¶
Get serial number of device.
Returns:
| Type | Description |
|---|---|
str
|
Serial number of device. |
uptime
property
¶
Get uptime of device in seconds.
Returns:
| Type | Description |
|---|---|
float
|
Uptime of device. |
uptime_string
property
¶
Get uptime of device in format dd:hh:mm:ss.
Returns:
| Type | Description |
|---|---|
str
|
Uptime of device. |
vlans
property
¶
Get list of vlans on device.
Returns:
| Type | Description |
|---|---|
list
|
List of vlans. |
__init__(host, username, password, **kwargs)
¶
PyNTC implementation for F5 device.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
host
|
str
|
The address of the network device. |
required |
username
|
str
|
The username to authenticate with the device. |
required |
password
|
str
|
The password to authenticate with the device. |
required |
kwargs
|
dict
|
Additional keyword arguments. |
{}
|
backup_running_config(filename)
¶
Backup running configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Name of file to save running config to. |
required |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Function currently not implemeneted. |
checkpoint(filename)
¶
Create checkpoint configuration file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Name of file to save running config to. |
required |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Function currently not implemeneted. |
close()
¶
Implement pass.
config(command)
¶
Send command to device.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
str
|
Command. |
required |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Function currently not implemented. |
file_copy(src, dest=None, **kwargs)
¶
Copy file to device.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src
|
str
|
Source of file. |
required |
dest
|
str
|
Destination to save file. Defaults to None. |
None
|
kwargs
|
dict
|
Additional keyword arguments. |
{}
|
Raises:
| Type | Description |
|---|---|
FileTransferError
|
Error in verifying if file existed before transfer. |
file_copy_remote_exists(src, dest=None, **kwargs)
¶
Copy file to device.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src
|
str
|
Source of file. |
required |
dest
|
str
|
Destination to save file. Defaults to None. |
None
|
kwargs
|
dict
|
Additional keyword arguments. |
{}
|
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Destination must be |
Returns:
| Type | Description |
|---|---|
bool
|
True if image specified exists on device. Otherwise, false. |
image_installed(image_name, volume)
¶
Check if image is installed on specified volume.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_name
|
str
|
Name of image. |
required |
volume
|
str
|
Volume to look for image on. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
Either image name or volume were not specified. |
Returns:
| Type | Description |
|---|---|
bool
|
True if file exists on volume. Otherwise, false. |
install_os(image_name, reboot=False, **vendor_specifics)
¶
Install OS on device.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_name
|
str
|
Image name. |
required |
reboot
|
bool
|
Whether to reboot the device after setting the boot options. Defaults to false. |
False
|
vendor_specifics
|
dict
|
Vendor specific arguments. |
{}
|
Raises:
| Type | Description |
|---|---|
NTCFileNotFoundError
|
Error is image is not found on device. |
Returns:
| Type | Description |
|---|---|
bool
|
True if image is installed successfully. Otherwise, false. |
open()
¶
Implement pass.
reboot(wait_for_reload=False, volume=None, **kwargs)
¶
Reload the controller or controller pair.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
volume
|
str
|
Active volume to reboot. Defaults to None. |
None
|
wait_for_reload
|
bool
|
Whether or not reboot method should also run _wait_for_device_reboot(). Defaults to False. |
False
|
kwargs
|
dict
|
Additional keyword arguments. |
{}
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If device is unreachable after timeout period, raise an error. |
Example
device = F5Device(**connection_args) device.reboot()
rollback(checkpoint_file)
¶
Rollback to checkpoint configuration file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
checkpoint_file
|
str
|
Name of checkpoint file. |
required |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Function currently not implemented. |
running_config()
¶
Get running configuration.
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Function currently not implemented. |
save(filename=None)
¶
Save running configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Name of file to save running configuration to. Defaults to None. |
None
|
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Function currently not implemented. |
set_boot_options(image_name, **vendor_specifics)
¶
Set boot option on device.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_name
|
str
|
Name of image. |
required |
vendor_specifics
|
dict
|
Vendor specific arguments. |
{}
|
Raises:
| Type | Description |
|---|---|
NTCFileNotFoundError
|
Error if file is not found on device. |
show(command, raw_text=False)
¶
Run cli command on device.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
str
|
Command to be ran. |
required |
raw_text
|
bool
|
Specifies if you want raw text. Defaults to False. |
False
|
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
[description] |
startup_config()
¶
Get startup configuration.
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Function currently not implemented. |