File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828"""
2929
3030from f5 .bigip .resource import OrganizingCollection
31+ from f5 .bigip .resource import Stats
3132from f5 .bigip .resource import UnnamedResource
3233
3334
@@ -37,7 +38,7 @@ def __init__(self, sys):
3738 super (Cluster , self ).__init__ (sys )
3839 self ._meta_data ['required_json_kind' ] = \
3940 "tm:sys:cluster:clustercollectionstate"
40- self ._meta_data ['allowed_lazy_attributes' ] = [Default ]
41+ self ._meta_data ['allowed_lazy_attributes' ] = [Default , Stats ]
4142
4243
4344class Default (UnnamedResource ):
@@ -46,3 +47,4 @@ def __init__(self, settings):
4647 super (Default , self ).__init__ (settings )
4748 self ._meta_data ['required_json_kind' ] = \
4849 'tm:sys:cluster:clusterstate'
50+ self ._meta_data ['allowed_lazy_attributes' ] = [Stats ]
Original file line number Diff line number Diff line change 1717
1818
1919def test_cluster_load (request , mgmt_root ):
20- # Load will produce exception on non-cluster BIGIP.l
20+ # Load will produce exception on non-cluster BIGIP.
2121 # iControlUnexpectedHTTPError: 404 Unexpected Error: Not Found for uri:
2222 try :
2323 assert str (mgmt_root .tm .sys .cluster .default .load ().kind ) == 'tm:sys:cluster:clusterstate'
2424 except iControlUnexpectedHTTPError as err :
25- assert ('01020036:3: The requested cluster (default) was not found.' in err .message )
25+ assert ('01020036:3: The requested cluster (default) was not found.' in str (err ))
26+
27+
28+ def test_cluster_stats_load (request , mgmt_root ):
29+ # Load will give the result even on non-cluster BIGIP. However, the payload will be almost empty
30+ assert str (mgmt_root .tm .sys .cluster .stats .load ().kind ) == 'tm:sys:cluster:clustercollectionstats'
31+
32+
33+ def test_cluster_default_stats_load (request , mgmt_root ):
34+ # Load will produce exception on non-cluster BIGIP.
35+ # iControlUnexpectedHTTPError: 404 Unexpected Error: Not Found for uri:
36+ try :
37+ assert str (mgmt_root .tm .sys .cluster .default .stats .load ().kind ) == 'tm:sys:cluster:clusterstats'
38+ except iControlUnexpectedHTTPError as err :
39+ assert ('01020036:3: The requested cluster (default) was not found.' in str (err ))
You can’t perform that action at this time.
0 commit comments