In the last few weeks I have spent some time creating a small emulator of the DellEMC PowerStore’s REST API. This was done for some educational requirement, but it might benefit other people out there, hence I am making it public
The emulator provides:
- 2 API calls to gather information for the array
- 11 API calls to perform block provisioning, including the host, volume and host_volume_resources
In terms of data, there is some seed data that is run from an external file when it’s started. This data is loaded into memory and will update as we perform provisioning calls. Any changes we make with those will show when we read back the relevant resource. Changes to the data are not persisted between runs
You can interact with the emulator programmatically in your favorite language, or using Postman and even Ansible. The GitHub repo includes a Postman collection and some sample Ansible playbooks.
The playbooks provided are idempotent like the real thing. Another cool thing you will notice while using Ansible is that, as the playbook runs you get to see all the API calls the module is doing under the covers. For one task in Ansible you can sometimes see 6 API calls run in the background to make Ansible’s declarative syntax work and ensure idempotency … pretty cool. I promise not to take again for granted all the extra effort Ansible does for me 🙂
The emulator mimics to a large extent the behavior of a real array for those calls, for example you can use the ‘select’ and ‘order’ parameters to customize the output of GET calls. You can also use the ‘field matching’ capabilities of the real API when querying a collection. However it will only take one field to match and it will only use the “eq” operator
There are some checks that are not implemented, ex: ensuring the new size of a volume is larger than the existing size during a volume extension, or not checking if a volume has mappings before deleting it … At the end of the day this is meant to be an educational tool to teach storage automation.
In order to run the emulator you will need Python3 (I have tried it with Python 3.9.2 and 3.6.8) and the packages specified in the ‘requirements.txt’ file
For Ansible I have tested everything with version 2.9.9 and version 1.1 of the PowerStore Ansible modules
You can download the emulator and all the related content in GitHub.