How do I retrieve the BIG-IP version using F5-SDK?

I am trying to figure out how to get the running version of a BIG-IP using the F5-sdk. I am able to get it by making a REST request:

restcurl -u admin:admin ‘/mgmt/tm/sys/version?$select=Product,Version,Build,Edition’

{ “entries”: {

"https://localhost/mgmt/tm/sys/version/0": {
  "nestedStats": {
    "entries": {
      "Build": {
        "description": "2.234.1671"
      },
      "Edition": {
        "description": "Engineering Hotfix HF2"
      },
      "Product": {
        "description": "BIG-IP"
      },
      "Version": {
        "description": "13.0.0"

…

I cannot seem to find a way to do this with the SDK.

>>> from f5.bigip import ManagementRoot
>>> mgmt = ManagementRoot('10.97.243.52', 'admin', 'admin')
>>> globalSettings = mgmt.tm.sys.global_settings.load()
>>> print globalSettings.hostname
host1.example.com

>>> mgmt.tm.sys.version
Traceback (most recent call last):
File "", line 1, in 
File "/home/tech1/.local/lib/python2.7/site-packages/f5/bigip/mixins.py", line 102, in  __getattr__
raise AttributeError(error_message)
AttributeError: '' object has no attribute 'version'

Can anyone point in the right direction?

I banged my head against this one for an hour (no experience with this library). In the end I realized that that the interface itself actually has the information you’re looking for:

from f5.bigip import ManagementRoot
f5 = ManagementRoot('f501.domain.local', 'leonardo', 'asthmaticturtlesareslow')
f5.tmos_version

Result:

>>> from f5.bigip import ManagementRoot
>>> f5 = ManagementRoot('f501.domain.local', 'leonardo', 'asthmaticturtlesareslow')
>>> f5.tmos_version
u'12.1.2'

/Patrik

The tmos_version only gives youthe version. What if you want to get all the details like build, product, edition etc?

I looked through the source code and I don’t think you can.

The feature is available in the latest version. Get it from the github. See another DevCentral question How do I retrieve all the BIG-IP version details using F5-SDK? for details.

tmsh show sys version