This integration is a REST based web service.
I am beginning to hear more and more about OpenStack, and personally, I like their software. It is an open source software solution for creating and managing public and private clouds.
If you want to use ServiceNow Orchestration, and leverage the OpenStack framework for cloud management, the steps below should help you get things going. This is a very easy process with ServiceNow. We will be making outbound REST based web service calls to the OpenStack server, using the API they have available. There are many examples using curl and a variety of other languages to help you out as well as a very active community of OpenStack gurus.
I like to set up a series of REST API definitions, using the REST Message module in ServiceNow. Once we define these I will be able to reuse them within a ServiceNow workflow.
OpenStack requires a login token on most of their server request, so we will set up this call first.
The URL used will be the address to your OpenStack server and a post will be made.
The Content-Type header value needs to be supplied as well as the content with your authentication credentials.
What you get back is an HTTP status code of 200 and a token in the response. I have not shown my response here as it describes secure data elements I do not want to share on the Internet. I did show the example from the OpenStack documentation of what the response looks like. You are interested in the token id from the “id” field. The token can be a quite large series of characters.
In handling the response you will want to parse the id value form the token object.
As far as creating a server goes, it will require a valid tenant id. You can make a call to the server to get this or just hard code this value as a property. I decided to call the server. The URL changes a bit to get a list of valid tenant ids.
For this call you need to include the authentication token retrieved on the previous step as a header value.
When you get a successful return a http status code of 200 is return along with a JSON object that includes the id of valid tenants.
Now we are ready to define the good stuff. We will create a VM using the OpenStack create server method. The URL for this is (click URL) the tenant_id is the id retrieved from the previous step. As you can see in the screenshot below several header values need to be defined. The project_id will be supplied when a self service user makes the request from the catalog. They will need to select which project and which instance (or image) to apply to the this call.
The content body will dictate which flavor reference and image reference to use, as well as network specific uuid’s and security groups should be applied to the creation of the server.
The return will include a http code of 202 and have the newly created server specifics (including server url and admin password).
That is it. At this point you will want to build out your catalog request item and a workflow that uses the REST activity to call these methods. After this configuration is done it is pretty much drag an drop from here. The hard part is over. You can implement other OpenStack API calls in a similar fashion. The more REST messages you build out the greater flexibility you will have to integrate with the various parts of OpenStack.