Thank you for your help and patience! Much appreciated...
Not sure if there is a difference in the data structures between our versions:
F5 SDK v2.0.2
BIGIP 12.1.1
Python 3.3.2
When I run the stats.entries.get method you outlined above, I get a return of 'None'. However there is a value for status.availibilityState buried in nested dicts for stats.entries.
Here's a test I ran in interactive shell (I have a module that obtains a token and base object of 'mgmt'):
>>> virtuals = mgmt.tm.ltm.virtuals.virtual.load(name='my_virtual_name')
>>> stats = virtuals.stats.load()
>>> state = stats.entries.get('status.availabilityState')['description']
Traceback (most recent call last):
File "", line 1, in
TypeError: 'NoneType' object is not subscriptable
>>> stats.entries
{'https://localhost/mgmt/tm/ltm/virtual/my_virtual_name/~Common~my_virtual_name/stats': {'nestedStats': {'selfLink': 'https://localhost/mgmt/tm/ltm/virtual/my_virtual_name/~Common~my_virtual_name/stats?ver=12.1.1', 'kind': 'tm:ltm:virtual:virtualstats', 'entries': {'totRequests': {'value': 0}, 'status.statusReason': {'description': 'The virtual server is available'}, 'csMinConnDur': {'value': 0}, 'fiveMinAvgUsageRatio': {'value': 0}, 'syncookie.syncookies': {'value': 0}, 'csMeanConnDur': {'value': 0}, 'tmName': {'description': '/Common/my_virtual_name'}, 'clientside.slowKilled': {'value': 0}, 'syncookie.hwSyncookies': {'value': 0}, 'ephemeral.bitsOut': {'value': 0}, 'syncookie.rejects': {'value': 0}, 'ephemeral.curConns': {'value': 0}, 'clientside.pktsOut': {'value': 0}, 'syncookie.syncacheCurr': {'value': 0}, 'clientside.bitsIn': {'value': 0}, 'ephemeral.pktsOut': {'value': 0}, 'destination': {'description': '192.168.1.1:443'}, 'syncookieStatus': {'description': 'not-activated'}, 'syncookie.hwsyncookieInstance': {'value': 0}, 'syncookie.swsyncookieInstance': {'value': 0}, 'clientside.evictedConns': {'value': 0}, 'clientside.curConns': {'value': 0}, 'clientside.totConns': {'value': 0}, 'clientside.bitsOut': {'value': 0}, 'oneMinAvgUsageRatio': {'value': 0}, 'ephemeral.totConns': {'value': 0}, 'syncookie.accepts': {'value': 0}, 'status.availabilityState': {'description': 'available'}, 'syncookie.syncacheOver': {'value': 0}, 'syncookie.hwAccepts': {'value': 0}, 'ephemeral.bitsIn': {'value': 0}, 'status.enabledState': {'description': 'enabled'}, 'ephemeral.evictedConns': {'value': 0}, 'fiveSecAvgUsageRatio': {'value': 0}, 'clientside.maxConns': {'value': 0}, 'csMaxConnDur': {'value': 0}, 'ephemeral.pktsIn': {'value': 0}, 'ephemeral.slowKilled': {'value': 0}, 'clientside.pktsIn': {'value': 0}, 'ephemeral.maxConns': {'value': 0}, 'cmpEnabled': {'description': 'enabled'}, 'cmpEnableMode': {'description': 'all-cpus'}}}}}
I'm not sure if your version is the same, but it appears the stats are nested three levels deep, first key being a link, second 'nestedStats', then 'entries'. If I follow the entire path I do get the value:
>>> print(stats.entries.get('https://localhost/mgmt/tm/ltm/virtual/my_virtual_name/~Common~my_virtual_name/stats')['nestedStats']['entries']['status.availabilityState']['description'])
available
Am I running something incorrectly or are the returned structures different between our versions? I can run through the nest like you mentioned and get the value, though the first key (formatted as a URL) throws me off as I'm not sure if there is an elegant way to reference it. I could get it by listing the keys for that level of dict but that seems kludge-y.