A mockup is a demonstration model to simulate something, e.g. a REST Application Programming Interfaces (API). It is an ideal prerequisite for developing and testing applications with realistic data and configurations, without having access to an actual installation. The VCF Orchestrator offers a REST API. This blog post explains how easy it is to mock the REST API of the VCF Orchestrator.
Mockup Orchestrator API
To mockup the VCF Orchestrator REST API it is necessary to use a tool that makes it possible. There are many good tools available, and
Mockoon is used here. Mockoon is easy to use, easy to handle and can be used easily in air gapped environments. It is free and open-source and available on the
Mockoon GitHub presence. In air gap environments it is recommended to use the portable variant for Windows and the AppImage variant for Linux. Both can be used without any installation process or dependencies downloads.
To simulate the REST API it is necessary to obtain the OpenAPI specification of the VCF Orchestrator. This is available in the Swagger documentation and can be easily downloaded. Directly below the heading is a small reference to Swagger OpenAPI.json. The linked JSON file must be downloaded.
To simulate the Orchestrator API, the OpenAPI specification must be imported into Mockoon.
After importing, the simulated VCF Orchestrator API is available and can be used like a real one.
In the local environment settings the port can now be changed to 8280, this allowing API calls to be used as in VCF programming. Each response can be customized to simulate realistic returns.
Conclusion
It is simple to simulate a VCF Orchestrator API via a mockup tool like Mockoon. On this way any result of an API call can be generated and the behavior of the code to be tested can be checked. This is possible locally without any dependencies and without any connection to other servers or the Internet. The desired return values of the functions must be defined. But this can be simplified with the help of templates and fake values. A great approach to testing.
References