Basic Concepts

Familiarizing yourself with the following underlying basic concepts will help you get up and running with the SDK.

Important

When using the SDK, you’ll notice that collection objects are referenced using the plural version of the Resource objects they contain. When the Resource object’s type is plural (ends in an s), you need to add _s to the name when referring to the collection.

This _s rule applies to all object collections where the object in the collection already ends in s.

Examples:

  • LTM Pool objects are collected in f5.bigip.tm.ltmpool.Pools and are accessible via the path f5.bigip.pools.get_collection().
  • Network Tunnels objects are stored in f5.bip.net.tunnels.Tunnels_s and are accessible via f5.bigip.net.tunnels_s.get_collection().

REST URIs

You can directly infer REST URIs from the python expressions, and vice versa.

Examples

Expression:     mgmt = ManagementRoot('<ip_address>', '<username>', '<password>')
URI Returned:   https://<ip_address>/mgmt/
Expression:     cm = mgmt.cm('<ip_address>', '<username>', '<password>')
URI Returned:   https://<ip_address>/mgmt/cm
Expression:     tm = mgmt.tm('<ip_address>', '<username>', '<password>')
URI Returned:   https://<ip_address>/mgmt/tm
Expression:     ltm = mgmt.tm.ltm('<ip_address>', '<username>', '<password>')
URI Returned:   https://<ip_address>/mgmt/tm/ltm/
Expression:     pools1 = mgmt.tm.ltm.pools
URI Returned:   https://<ip_address>/mgmt/tm/ltm/pool
Expression:     pool_a = pools1.create(partition="Common", name="foo")
URI Returned:   https://<ip_address>/mgmt/tm/ltm/pool/~Common~foo

REST Endpoints

A set of basic REST endpoints can be derived from the object’s URI and kind (listed below).

Dynamic Attributes

The python object’s attribute can be created dynamically based on the JSON returned when querying the REST API.

iControl® REST kind Parameters

Almost all iControl® REST API entries contain a parameter named kind. This parameter provides information about the object that lets you know what you should expect to follow it. The iControl® REST API uses three types of kind: collectionstate, state, and stats.

kind Associated Objects Methods
collectionstate OrganizingCollection, Collection exists()
state Resource create(), update(), refresh(), delete(), load(), exists()
stats Resource refresh(), load(), exists()

Methods

Method HTTP Command Action(s)
create() POST
creates a new resource on the device with its own URI
update() PUT
submits a new configuration to the device resource; sets the
Resource attributes to the state reported by the device
refresh() GET
obtains the state of a device resource; sets the representing
Python Resource Object; tracks device state via its attributes
delete() DELETE
removes the resource from the device, sets self.__dict__
to {'deleted': True}
load() GET
obtains the state of an existing resource on the device; sets
the Resource attributes to match that state
exists() GET
checks for the existence of an object on the BIG-IP®

Note

Available methods are restricted according to the object’s kind.