Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions PyPowerFlex/base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ class EntityRequest(Request):
managed_device_url = '/V1/ManagedDevice'
deployment_url = '/V1/Deployment'
firmware_repository_url = '/V1/FirmwareRepository'
pfmp_version_url = '/v1/corelcm/status'
entity_name = None

@property
Expand Down
18 changes: 18 additions & 0 deletions PyPowerFlex/objects/common/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class System(base_client.EntityRequest):
"""Client for system operations"""
def __init__(self, token, configuration):
self.__api_version = None
self.__pfmp_version = None
super().__init__(token, configuration)

def api_version(self, cached=True):
Expand Down Expand Up @@ -87,6 +88,23 @@ def api_version(self, cached=True):
self.__api_version = response
return self.__api_version

def pfmp_version(self, cached=True):
"""
Get PowerFlex Management Platform version.
:param cached: get PFMP version from cache or send API response
:type cached: bool
:rtype: str
"""

if not self.__pfmp_version or not cached:
r, response = self.send_get_request(self.pfmp_version_url)
if r.status_code != requests.codes.ok:
exc = exceptions.PowerFlexFailQuerying('PFMP version')
LOG.error(exc.message)
raise exc
self.__pfmp_version = response.get('clusterVersion')
return self.__pfmp_version

def remove_cg_snapshots(self, system_id, cg_id, allow_ext_managed=None):
"""Remove PowerFlex ConsistencyGroup snapshots.

Expand Down
23 changes: 23 additions & 0 deletions tests/gen1/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class TestSystemClient(PyPowerFlexTestCase):
"""
Test class for the SystemClient.
"""

def setUp(self):
"""
Set up the test environment.
Expand Down Expand Up @@ -83,6 +84,11 @@ def setUp(self):
'/instances/action/querySelectedStatistics': {
'rplTransmitBwc': {'numSeconds': 0, 'totalWeightInKb': 0, 'numOccured': 0}
},
'/v1/corelcm/status': {
"lcmStatus": "READY",
"clusterVersion": "4.8.0.0",
"clusterBuild": "1262"
},
},
self.RESPONSE_MODE.Invalid: {
'/version': 'invalid_version_format'
Expand Down Expand Up @@ -334,3 +340,20 @@ def test_system_query_selected_statistics_bad_status(self):
self.client.system.query_selected_statistics,
properties=["rplTransmitBwc"],
)

def test_pfmp_version(self):
"""
Test the pfmp_version method.
"""
version = self.client.system.pfmp_version()
self.assertEqual(version, "4.8.0.0")

def test_pfmp_version_bad_status(self):
"""
Test the pfmp_version method with a bad status.
"""
with self.http_response_mode(self.RESPONSE_MODE.BadStatus):
self.assertRaises(
exceptions.PowerFlexFailQuerying,
self.client.system.pfmp_version,
)