Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Clear all filters
Answers

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 "<stdin>", line 1, in <module>
File "/home/tech1/.local/lib/python2.7/site-packages/f5/bigip/mixins.py", line 102, in  __getattr__
raise AttributeError(error_message)
AttributeError: '<class 'f5.bigip.tm.sys.Sys'>' object has no attribute 'version'

Can anyone point in the right direction?

0
Rate this Question
Comments on this Question
Comment made 5 months ago by Amit 55

tmsh show sys version

0

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

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

1
Comments on this Answer
Comment made 16-Dec-2017 by Patrik Jonsson 3523

Worth noting is that you can check the properties of an object in python by using the dir command:

>>> for prop in dir(f5):
...     print prop
...
__class__
__delattr__
__dict__
__doc__
__format__
__getattr__
__getattribute__
__hash__
__init__
__module__
__new__
__reduce__
__reduce_ex__
__repr__
__setattr__
__sizeof__
__str__
__subclasshook__
__weakref__
_build_final_uri
_check_command_parameters
_check_exclusive_parameters
_check_force_arg
_check_generation
_check_supported_versions
_format_collection_name
_format_resource_name
_get_base_uri
_get_icr_session
_get_tmos_version
_handle_requests_params
_is_version_supported_method
_meta_data
_set_meta_data_uri
args
configure_meta_data
hostname
icontrol_version
icrs
parse_arguments
post_configuration_setup
raw
set_icr_metadata
set_metadata_uri
tmos_version
transform_attr_names

Maybe you knew, but it might help someone else one day. :)

2
Comment made 16-Dec-2017 by Tim 255

Thank you Patrik! It was right under my nose :). That is very helpful.

0
Comment made 16-Dec-2017 by Patrik Jonsson 3523

No problem. Don't forget to mark it as the correct answer (if you feel that it is).

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

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.

1
Comments on this Answer
Comment made 13-Feb-2018 by Patrik Jonsson 3523

Nice, thanks for updating!

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

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

0
Comments on this Answer
Comment made 06-Feb-2018 by Patrik Jonsson 3523

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

0