What's on this page

Resource Lifecycle Management

Create Resource Transition

Requests that the Resource Manager performs a specific transition against a resource.

Request Format

Aspect Value
Endpoint URL /lifecycle/transitions
HTTP Method POST
Parameters None

Example Request Body

{

​    “resourceManagerId”: “default-rm::dev”,

​    “deploymentLocation”: “dev-cloud”,

​    “resourceType”: “resource::openstack-network::1.0”,

​    “transitionName”: “Install”,

​    “resourceName”: “dev-network-c675e0bd”,

​    "metricKey" : "818127b3-1904-4737-a60c-8c7bab73532d"

 

​    “properties”: {

​           “propertyName”: “propertyValue”

​    },

​    “context”: {}

}
Field Description Mandatory
resourceManagerId The id of the Resource Manager instance Yes
deploymentLocation The name of the deployment location where the resource will be created Yes
resourceType The name of the resource type to be created Yes
transitionName The name of the Transition to be enacted against the resource. Allowed values for the transitionName are: Install, Configure, Start, Integrity, Stop, Uninstall and any operation name that is supported by the resources Yes
resourceId The unique id of the resource. This field is mandatory for all non-Install transitions and will not be present during “Install” transitions (as this is allocated by the Resource Manager once it has been created). Yes*
resourceName The name of the resource. The resourceName should NOT be expected to be unique. There are some upgrade/heal scenarios where two resources may have the same name for a short period of time. Yes
metricKey A key provided to manage metrics. Yes
properties A section that will contain a set of key/value pairs for the properties for the resource. These will match those defined in the resource descriptor Yes
context Context is reserved for future use. No

Response Format

Aspect Value
Return Code 202 ACCEPTED

Example Response

{

​    “requestId”: “80fc4a66-7e92-41f8-b4bb-7cb98193f5fa”,

​    “requestState”: “PENDING”,

​    “context”: {

​           “AsynchronousTransitionResponses”: “false”

​    }

}
Field Description Mandatory
requestId The id of the request defined by the Resource Manager. This should be a GUID Yes
requestState A string representing the state of the request. Allowable states for the request state are as follows: PENDING, IN_PROGRESS, COMPLETED, CANCELLED, FAILED Yes
requestStateReason A string giving a human-readable description for the State of the request No
requestFailureCode An optional string to indicate the type of FAILURE (should one occur). The only currently supported code is RESOURCE_NOT_FOUND No
context Context is reserved for future use. No
AsynchronousTransitionResponses Indicates whether this transition will send responses asynchronously via kafka No

Get Resource Transition Status

Returns information about the specified transition or operation request. The ‘id’ passed in is the value that the Resource Manager generated as the ‘requestId’ in the response of the previous call.

Request Format

Aspect Value
Endpoint URL /lifecycle/transitions/{id}/status
HTTP Method GET
Parameters id – Unique identifier for the resource transition

Response Format

Aspect Value
Return Code 200 OK

Example Response

{

​    “requestId”: “80fc4a66-7e92-41f8-b4bb-7cb98193f5fa”,

​    “requestState”: “COMPLETED”,

​    “requestStateReason”: “Transition successfully completed in 324 msecs”,

​    “resourceId”: “e09dbfcf-bb70-42ee-8c32-bdb83a22fb5d”,

​    “startedAt”: “2017-05-01T12:00:00Z”,

​    “finishedAt”: “2017-05-01T12:00:00Z” 

​    “context”: {

​           “AsynchronousTransitionResponses”: “false”

​    }

}

 
Field Description Mandatory
requestId The id of the request defined by the Resource Manager. This should be a GUID Yes
requestState A string representing the state of the request. Allowable states for the request state are as follows: PENDING, IN_PROGRESS, COMPLETED, CANCELLED, FAILED Yes
requestStateReason A string giving a human-readable description for the State of the request No
requestFailureCode An optional string to indicate the type of FAILURE (should one occur). The only currently supported codes are: RESOURCE_NOT_FOUND RESOURCE_ALREADY_EXISTS No
resourceId The id of the resource within the context of the Resource Manager – should be a GUID Yes
startedAt The time the transition was started at Yes
finishedAt The time the transition was completed No
Context Context is reserved for future use. No
AsynchronousTransitionResponses Indicates whether this transition will send responses asynchronously via kafka No

Complex Heal Support

The value returned by the Resource Manager in the requestFailureCode is most significant in the case where a Complex Heal needs to be triggered within Stratoss LM.

The Stratoss LM Complex Heal scenario needs the Resource Manager (RM) to return a certain failure code to Stratoss LM when the underlying resource instance no longer exists. This will then cause Stratoss LM to call the Uninstall and Install of the Complex Heal.

This will entail Stratoss LM calling Uninstall on the resource, even though it knows the underlying resource instance is missing as this call will allow the RM to remove any state it has on the resource instance from its records. The RM is then required to return success from the Uninstall.

It is entirely the responsibility of the Resource Manager to return the correct combination of “requestState” and “requestFailureCode” using this logic:

Install:

​    if resource already exists:

​        return requestState = FAILED,

​        requestFailureCode = RESOURCE_ALREADY_EXISTS

 

integrity/configure/start/stop:

​    if resource not found:

​        do not remove resource instance from persistence layer

​        return requestState = FAILED,

​        requestFailureCode = RESOURCE_NOT_FOUND

 

run operation:

​    if resource not found:

​        do not remove resource instance from persistence layer

​        return requestState = FAILED,

​        requestFailureCode = RESOURCE_NOT_FOUND

 

uninstall:

​    if resource not found:

​        clean up any persistence for resource instance

​        return requestState = COMPLETED

 


Resource Lifecycle Management (Asynchronous)

Optionally, a Resource Manager can choose to emit responses when transitions are completed (either successfully or not). It is highly recommended that this method is used to avoid Stratoss LM needing to poll for the status periodically.

The Resource Manager informs Stratoss LM that this method can be used alongside the polling interface by setting “asnychronousTransitionsReponses” to true in the response to the Resource Transition Status request (see 2.4.2 above) and Get Resource Manager Configuration (see 2.1.1 above) . If the Resource Manager supports the asynchronous response mechanism it must also support the polling update method as well (i.e. the polling update method is mandatory).

Resource Transition Response Message Example

{

   "requestId": "80fc4a66-7e92-41f8-b4bb-7cb98193f5fa",

   "resourceManagerId": "default-rm::dev",

   "deploymentLocation": "dev-cloud",

   "resourceType": "resource::openstack-network::1.0",

   "transitionName": "Install",

   "resourceInstance": {

​      "resourceId": "default-rm://c675e0bd-9c6c-43ca-84bf-2c061d439c6b",

​      "metricKey": "2530c175-541e-43df-89ae-6c34bc351d9b",

​      "resourceName": "dev-network",

​      "resourceType": "resource::openstack-network::1.0",

​      "resourceManagerId": "default-rm::dev",

​      "deploymentLocation": "dev-cloud",

​      "properties": {

​         "*propertyName*": "*propertyValue*"

​      },

​      "createdAt": "2017-05-01T12:00:00Z",

​      "lastModifiedAt": "2017-05-01T12:00:00Z",

​      "internalResourceInstances ": [

​         {

​            "id": "3cb7822b-fc44-46ab-8072-9c65cd778d1f",

​            "name": "MGMT-NETWORK",

​            "type": "OpenDaylight::PrivateNetwork"

​         }

​      ]

   },

   "context": {},

   "requestState": "COMPLETED",

   "requestStateReason": "Transition successfully completed in 324 msecs",

   "startedAt": "2017-05-01T12:00:00Z",

   "finishedAt": "2017-05-01T12:00:00Z"

}
Field Description Mandatory
requestId The id of the request Yes
resourceManagerId The id of the Resource Manager Yes
deploymentLocation The name of the location associated with the resource Yes
resourceType The type of the resource Yes
transitionName The name of the transition associated with this response
resourceInstance A section that contains the details of the resource instance
resourceId The id of the instance of a resource Yes
resourceName The name of the resource Yes
resourceType The name of the resource type Yes
resourceManagerId The id of the Resource Manager instance Yes
deploymentLocation The name of the deployment location where the instance exists Yes
properties A set of key value pair with properties describing key behaviour No
propertyName A name of a property relating to the resource instance. No
propertyValue The value associated with the propertyName No
createdAt The date the resource instance was created. XML Date time format Yes
lastModifiedAt The date the resource instance was last changed. XML Date time format Yes
internalResourceInstances Contains details of the underlying instances created by the Resource manager in response to the intent request. This is a list and may contain many sets of Id, name and type fields Yes – the underlying resource does not match the information otherwise used by the RM
Context Reserved for future use No
requestState The state of the transition Yes
requestStateReason A string giving a human-readable description for the request state – i.e. possible error message No
requestFailureCode An optional string to indicate the type of FAILURE (should one occur). The only currently supported code is RESOURCE_NOT_FOUND No
startedAt The time the Transition was started at Yes
finishedAt The time the transition was completed No

NOTE: Some companion products (e.g. ASM a Stratoss LM Observer) must have the “internalResourceInstances” field populated so that they can function correctly. Any Resource Manager implementing this API must ensure that this field is populated correctly.

NOTE: Stratoss LM versions up to and including R2.0 do not support asynchronous responses from a Resource Manager. However, all Resource Managers should support this aspect of the RM API so that as soon as support for asynchronous responses is added to Stratoss LM it can be used immediately without the need to update existing Resource Manager implementations.