Class: BigIp

BigIp(optionsopt)

Provides core functionality (CRUD operations, ready, etc) and maintains references to other modules in f5-cloud-libs.

After createing a BigIp with this constructor, you must call the async init() method.

Constructor

new BigIp(optionsopt)

BigIp constructor

Parameters:
Name Type Attributes Description
options Object <optional>

Optional parameters.

Properties
Name Type Attributes Description
logger Object <optional>

Logger to use. Or, pass loggerOptions to get your own logger.

loggerOptions Object <optional>

Options for the logger. See module:logger.getLogger for details.

Methods

active(retryOptionsopt) → {Promise}

Determines if the device status is either active or standby

Parameters:
Name Type Attributes Description
retryOptions Object <optional>

Options for retrying the request.

Properties
Name Type Attributes Description
maxRetries Integer <optional>

Number of times to retry if first try fails. 0 to not retry. Default 60.

retryIntervalMs Integer <optional>

Milliseconds between retries. Default 10000.

Returns:

A promise which is resolved when the status is either active or standby.

Type
Promise

create(path, body, iControlOptionsopt, retryOptionsopt, optionsopt) → {Promise}

Submits a create (POST) request

Parameters:
Name Type Attributes Description
path String

The path to post.

body Object

The body for the POST request.

iControlOptions Object <optional>

Options for IControl.

retryOptions Object <optional>

Options for retrying the request.

Properties
Name Type Attributes Description
maxRetries Integer <optional>

Number of times to retry if first try fails. 0 to not retry. Default 60.

retryIntervalMs Integer <optional>

Milliseconds between retries. Default 10000.

options Object <optional>

Options for this method.

Properties
Name Type Attributes Description
silent Boolen <optional>

Do not log any info (for requests/repsonses that may contain sensitive information).

Returns:

A promise which is resolved when the request is complete or rejected if an error occurs.

Type
Promise

createFolder(folder, optionsopt) → {Promise}

Creates a folder if it does not exists

Parameters:
Name Type Attributes Description
folder String

Name of folder

options Object <optional>

Optional parameters

Properties
Name Type Attributes Description
subPath String <optional>

The folder subPath. Use '/' for top level folders. Default '/Common'

deviceGroup String <optional>

Device group for folder. Default 'none'

trafficGroup String <optional>

Traffic group for folder. Default 'none'

Returns:

A promise which is resolved when the request is complete or rejected if an error occurs.

Type
Promise

createOrModify(path, body, iControlOptionsopt, retryOptionsopt, optionsopt) → {Promise}

Creates or modifies an object

Parameters:
Name Type Attributes Description
path String

The path to patch.

body Object

The body for the patch request.

Properties
Name Type Description
name String

The name used to determine if the object exists.

iControlOptions Object <optional>

Options for IControl.

retryOptions Object <optional>

Options for retrying the request.

Properties
Name Type Attributes Description
maxRetries Integer <optional>

Number of times to retry if first try fails. 0 to not retry. Default 60.

retryIntervalMs Integer <optional>

Milliseconds between retries. Default 10000.

options Object <optional>

Options for this method.

Properties
Name Type Attributes Description
silent Boolen <optional>

Do not log any info (for requests/repsonses that may contain sensitive information).

Returns:

A promise which is resolved when the request is complete or rejected if an error occurs.

Type
Promise

delete(path, body, iControlOptionsopt, retryOptionsopt, optionsopt) → {Promise}

Submits a delete (DELETE) request

Parameters:
Name Type Attributes Description
path String

The path to delete.

body Object

The body for the delete request.

iControlOptions Object <optional>

Options for IControl.

retryOptions Object <optional>

Options for retrying the request.

Properties
Name Type Attributes Description
maxRetries Integer <optional>

Number of times to retry if first try fails. 0 to not retry. Default 60.

retryIntervalMs Integer <optional>

Milliseconds between retries. Default 10000.

options Object <optional>

Options for this method.

Properties
Name Type Attributes Description
silent Boolen <optional>

Do not log any info (for requests/repsonses that may contain sensitive information).

Returns:

A promise which is resolved when the request is complete or rejected if an error occurs.

Type
Promise

deviceInfo(retryOptionsopt) → {Promise}

Gets the => device info

Parameters:
Name Type Attributes Description
retryOptions Object <optional>

Options for retrying the request.

Properties
Name Type Attributes Description
maxRetries Integer <optional>

Number of times to retry if first try fails. 0 to not retry. Default 60.

retryIntervalMs Integer <optional>

Milliseconds between retries. Default 10000.

Returns:

A promise which is resolved when the request is complete or rejected if an error occurs.

Type
Promise

deviceState(hostname, retryOptionsopt) → {Promise}

Gets the Device State for a BIG-IP device by hostname

Parameters:
Name Type Attributes Description
hostname String

Hostname of device

retryOptions Object <optional>

Options for retrying the request.

Properties
Name Type Attributes Description
maxRetries Integer <optional>

Number of times to retry if first try fails. 0 to not retry. Default 60.

retryIntervalMs Integer <optional>

Milliseconds between retries. Default 10000.

Returns:

A promise which is resolved when the request is complete or rejected if an error occurs.

Type
Promise

getPassword() → {Promise}

Returns this intance's password

Returns:

A promise that is resolved with this instances password or rejected if an error occurs

Type
Promise

getPrivateKeyFilePath(folder, name) → {Promise}

Gets the path to the latest private key

Parameters:
Name Type Description
folder String

Folder in which to search for the key

name String

Name of the key

Returns:

A promise which is resolved when the request is complete or rejected if an error occurs.

Type
Promise

getPrivateKeyMetadata() → {Promise}

Get the metadata for the cloud libs private key

Returns:

A promise which is resolved when the request is complete or rejected if an error occurs.

Type
Promise

init(host, user, password, optionsopt) → {Promise}

Initialize this instance w/ host user password

Parameters:
Name Type Attributes Description
host String

Host to connect to.

user String

User (with admin rights).

password String

Password for user or URI (file, http, https, ARN, etc.) to location containing password.

options Object <optional>

Optional parameters.

Properties
Name Type Attributes Description
port Number <optional>

Port to connect to. Default 443.

passwordIsUrl Boolean <optional>

Indicates that password is a URL for the password

passwordIsToken Boolean <optional>

Indicates that the password is an auth token.

passwordEncrypted Boolean <optional>

Indicates that the password is encrypted (with the local cloud public key)

product String <optional>

The product we are running on (BIG-IP | BIG-IQ). Default is to determine the product programmatically.

clOptions Object <optional>

Command line options

Returns:

A promise which is resolved when initialization is complete or rejected if an error occurs.

Type
Promise

installPrivateKey(privateKeyFile, folder, name, optionsopt) → {Promise}

Installs a private key and then deletes the original private key file.

Parameters:
Name Type Attributes Description
privateKeyFile String

Full path to private key file. This file must be on the BIG-IP disk and will be deleted upon successful installation to MCP

folder String

Folder in which to put key

name String

Name for key

options Object <optional>

Optional parameters

Properties
Name Type Attributes Description
passphrase String <optional>

Optional passphrase for key

Returns:

A promise which is resolved when the request is complete or rejected if an error occurs.

Type
Promise

isBigIp() → {Boolean}

Returns whether or not the device is a BIG-IP

Returns:

Whether or not this device is a BIG-IP

Type
Boolean

isBigIq() → {Boolean}

Returns whether or not the device is a BIG-IQ

Returns:

Whether or not this device is a BIG-IQ

Type
Boolean

list(path, iControlOptionsopt, retryOptionsopt, optionsopt) → {Promise}

Submits a list (GET) request

Parameters:
Name Type Attributes Description
path String

The path to get.

iControlOptions Object <optional>

Options for IControl.

retryOptions Object <optional>

Options for retrying the request.

Properties
Name Type Attributes Description
maxRetries Integer <optional>

Number of times to retry if first try fails. 0 to not retry. Default 60.

retryIntervalMs Integer <optional>

Milliseconds between retries. Default 10000.

options Object <optional>

Options for this method.

Properties
Name Type Attributes Description
silent Boolen <optional>

Do not log any info (for requests/repsonses that may contain sensitive information).

Returns:

A promise which is resolved when the request is complete or rejected if an error occurs.

Type
Promise

loadConfig(fileopt, optionsopt, retryOptionsopt) → {Promise}

Loads sys config

Parameters:
Name Type Attributes Description
file String <optional>

Full path on device of file to load. Default is to load the default config.

options Object <optional>

Object map of load options (for example, {merge: true})

retryOptions Object <optional>

Options for retrying the request.

Properties
Name Type Attributes Description
maxRetries Integer <optional>

Number of times to retry if first try fails. 0 to not retry. Default 60.

retryIntervalMs Integer <optional>

Milliseconds between retries. Default 10000.

Returns:

A promise which is resolved when the config has been loaded or rejected if an error occurs.

Type
Promise

loadUcs(file, loadOptionsopt, optionsopt, retryOptionsopt) → {Promise}

Loads sys UCS

Parameters:
Name Type Attributes Description
file String

Full path on device of file to load.

loadOptions Object <optional>

Options for the load ucs task (for example, {noLicense: true, resetTrust: true})

options Object <optional>

Options for this command (not the load task itself)

Properties
Name Type Attributes Description
initLocalKeys Boolean <optional>

Re-create and install local public/private key pair used for password encryption

restoreUser Boolean <optional>

Restore the current user after loading

retryOptions Object <optional>

Options for retrying the request.

Properties
Name Type Attributes Description
maxRetries Integer <optional>

Number of times to retry if first try fails. 0 to not retry. Default 60.

retryIntervalMs Integer <optional>

Milliseconds between retries. Default 10000.

Returns:

A promise which is resolved when the config has been loaded or rejected if an error occurs.

Type
Promise

modify(path, body, iControlOptionsopt, retryOptionsopt, optionsopt) → {Promise}

Submits a modify (PATCH) request

Parameters:
Name Type Attributes Description
path String

The path to patch.

body Object

The body for the patch request.

iControlOptions Object <optional>

Options for IControl.

retryOptions Object <optional>

Options for retrying the request.

Properties
Name Type Attributes Description
maxRetries Integer <optional>

Number of times to retry if first try fails. 0 to not retry. Default 60.

retryIntervalMs Integer <optional>

Milliseconds between retries. Default 10000.

options Object <optional>

Options for this method.

Properties
Name Type Attributes Description
silent Boolen <optional>

Do not log any info (for requests/repsonses that may contain sensitive information).

Returns:

A promise which is resolved when the request is complete or rejected if an error occurs.

Type
Promise

ping(address, retryOptionsopt) → {Promise}

Pings a given address once

Parameters:
Name Type Attributes Description
address String

IP address or hostname to ping.

retryOptions Object <optional>

Options for retrying the request.

Properties
Name Type Attributes Description
maxRetries Integer <optional>

Number of times to retry if first try fails. 0 to not retry. Default 60.

retryIntervalMs Integer <optional>

Milliseconds between retries. Default 10000.

Returns:

A promise which is resolved if the ping succeeds or rejected if an error occurs.

Type
Promise

ready(retryOptionsopt) → {Promise}

Resolves when device is ready.

Device is determined to be ready when the nodejs echo-js worker is ready.

Parameters:
Name Type Attributes Description
retryOptions Object <optional>

Options for retrying the request.

Properties
Name Type Attributes Description
maxRetries Integer <optional>

Number of times to retry if first try fails. 0 to not retry. Default 60.

retryIntervalMs Integer <optional>

Milliseconds between retries. Default 10000.

Returns:

A Promise which is resolved when device is ready or rejected after trying a fixed number of times.

Type
Promise

reboot()

Reboots the device

rebootRequired(retryOptionsopt) → {Promise}

Checks to see if the device needs to be rebooted

Parameters:
Name Type Attributes Description
retryOptions Object <optional>

Options for retrying the request.

Properties
Name Type Attributes Description
maxRetries Integer <optional>

Number of times to retry if first try fails. 0 to not retry. Default 60.

retryIntervalMs Integer <optional>

Milliseconds between retries. Default 10000.

Returns:

A promise which is resolved with 'true' if reboot is required and resolved with 'false' otherwise.

Type
Promise

replace(path, body, iControlOptionsopt, retryOptionsopt, optionsopt) → {Promise}

Submits a replace (PUT) request

Parameters:
Name Type Attributes Description
path String

The path to put.

body Object

The body for the patch request.

iControlOptions Object <optional>

Options for IControl.

retryOptions Object <optional>

Options for retrying the request.

Properties
Name Type Attributes Description
maxRetries Integer <optional>

Number of times to retry if first try fails. 0 to not retry. Default 60.

retryIntervalMs Integer <optional>

Milliseconds between retries. Default 10000.

options Object <optional>

Options for this method.

Properties
Name Type Attributes Description
silent Boolen <optional>

Do not log any info (for requests/repsonses that may contain sensitive information).

Returns:

A promise which is resolved when the request is complete or rejected if an error occurs.

Type
Promise

runTask(taskPath, taskConfig, optionsopt) → {Promise}

Executes an iControl REST task

Parameters:
Name Type Attributes Description
taskPath String

URL that created the task.

taskConfig String

Body of the task request, typically JSON.

options Object <optional>

Options controlling the task request.

Properties
Name Type Attributes Description
idAttribute String <optional>

Name of the Task ID attribute in the task create response. Default: '_taskId'

validate Boolean <optional>

Whether to send a VALIDATING task request. Default: true.

statusAttribute String <optional>

Name of the Task Status attribute in the result response. Default: '_taskState'

Returns:

A promise which is resolved with true if the task completes successfully, resolved with false if task goes to error state or rejected if some other error occurs.

Type
Promise

save(fileopt, retryOptionsopt) → {Promise}

Saves sys config

Parameters:
Name Type Attributes Description
file String <optional>

File to save to. Default is bigip.conf

retryOptions Object <optional>

Options for retrying the request.

Properties
Name Type Attributes Description
maxRetries Integer <optional>

Number of times to retry if first try fails. 0 to not retry. Default 60.

retryIntervalMs Integer <optional>

Milliseconds between retries. Default 10000.

Returns:

A promise which is resolved when the licensing is complete or rejected if an error occurs.

Type
Promise

saveUcs(file) → {Promise}

Save a ucs file in /var/local/ucs

Parameters:
Name Type Description
file String

Base name of ucs file

Returns:
  • A promise which is resolve when the ucs is saved
                   or rejected if an error occurs
Type
Promise

setPort(port) → {Promise}

Sets the management ip port

Parameters:
Name Type Description
port Number

port to use for management IP

Returns:

A promise which is resolved when the operation is complete or rejected if an error occurs.

Type
Promise

transaction(commands) → {Promise}

Submits commands in a transaction

Parameters:
Name Type Description
commands Array.<Object>

Array of command definitions. Each command should be: { method: 'list' | 'create' | 'modify' | 'delete', path: path for command, body: optional body for command }

Returns:

A promise which is resolved when the transaction is complete or rejected if an error occurs.

Type
Promise