Creating an assembly instance

You create a new assembly instance when you need to deploy a new service described in an assembly descriptor.

Before you begin

IBM® Telco Network Cloud Manager - Orchestration must be installed, with all included resources and test assemblies deployed to the catalog.

About this task

A new instance of an assembly is created by using the API for Daytona (Orchestrator) service.

This task installs a new instance of a t_bta assembly called test_1, and then configures and starts it.

This example uses the basic test assembly assembly::t_bta::1.0. This assembly is composed of two resources named A and B, both of type resource::t_simple::1.0. It references three external resource instances, two networks of type resource::openstack_neutron_network::1.0 and one image of type resource::openstack_glance_image::1.0. It has one relationship from A to B that is created when A and B are active. Resource B is in a cluster which on installation includes a single instance of B.

Procedure

  1. Identify the assembly properties requiring a value when creating a new assembly instance. To do so, explore the corresponding assembly descriptor (in this example assembly::t_bta::1.0).
    Retrieve the descriptor from the IBM Telco Network Cloud Manager - Orchestration catalog by running the following query on the Apollo API:
    GET /api/catalog/descriptors/assembly::t_bta::1.0
    The response to this query displays the descriptor. A sample extract is shown here. A full assembly descriptor sample can be viewed in the following topic: Sample assembly descriptor
    name: assembly::t_bta::1.0
    description: Assembly comprised of "components\\t_simple.yml" 
    properties:
      data:
        default: "data"
        type: string
        description: 'parameter passed'
      output:
        description: an example output parameter
        type: string
        read-only: true
      deploymentLocation:
        type: string
        description: name of openstack project to deploy network
        default: admin@local
    ...
    
    The purpose of the 'properties' section in the API request is to give values to required assembly properties. The 'properties' section in the API request must set the value of any properties from the 'properties' section of the assembly descriptor that don’t have a default value. You can override any default values. In the following example steps the default value of 'deploymentLocation' is changed.
  2. Initiate a createAssembly event from the Daytona API. Use the swagger-url for the Daytona service to create a new assembly instance using the following POST command:
    POST /api/intent/createAssembly
    {
      "assemblyName": "test_1",
      "descriptorName": "assembly::t_bta::1.0",
      "intendedState": "Inactive",
    	properties":{
    "deploymentLocation":"admin@local"}
    }
    
    In this case, the test_1 assembly instance (assemblyName) does not exist, and so IBM Telco Network Cloud Manager - Orchestration will attempt to install, configure and then start this new instance.
    Note: Use the 'properties' section to define any assembly properties that are as yet undefined, or to override any already defined default values. In this example a value of admin@local is set for the deploymentLocation property.
  3. If test_1 has been successfully created, IBM Telco Network Cloud Manager - Orchestration will return a Response Code 201, as in this example:
    Response code 201
    
    {
      "location": "http://10.220.217.161:8280/api/processes/5a65ce87-4637-401e-868b-e20ec254fd35",
      "date": "Mon, 11 Sep 2017 11:54:20 GMT",
      "server": "ALM Ishtar/1.1.0-SNAPSHOT",
      "transfer-encoding": "chunked",
      "x-application-context": "ishtar:prod,swagger:8280",
      "content-type": null
    }
    
    The process identifier in this response is 5a65ce87-4637-401e-868b-e20ec254fd35. As soon as the new assembly instance is created, it can be referred to by name. that is, test_1.
  4. To check progress of this request, copy the process identifier from the response into the id parameter of the following GET command (GET /api/topology/assemblies{id}):
    GET /api/topology/assemblies/5a65ce87-4637-401e-868b-e20ec254fd35
    
    The processState in the following sample response indicates that the request has completed, while intendedState indicates that it is as yet inactive.
    {
      "processId": "5a65ce87-4637-401e-868b-e20ec254fd35",
      "assemblyId": " ef4ea879-e313-4e3b-ad11-6a0a7e7544eb",
      "assemblyName": "test_1",
      "assemblyDescriptorName": "assembly::t_bta::1.0",
      "intentType": "CreateAssembly",
      "intent": {
        "assemblyName": "test_1",
        "descriptorName": "assembly::t_bta::1.0",
        "intendedState": "Inactive"
      },
      "processState": "Completed",
      "processStartedAt": "2017-09-14T07:34:55.569Z",
      "processFinishedAt": "2017-09-14T07:34:58.806Z"
    }
    
    Note: If the request had not completed it would have been in the InProgress state. If there had been an issue, it would have been in the Failed state, in which case there would have been a requestStateReason property with text describing the failure.
  5. Initiate a Start event from the Daytona API to start the new assembly instance, that is, move it from an inactive to an active state.
    To start the new assembly instance, use the swagger-url for the Daytona service, using the following POST command:
    POST /api/intent/changeAssemblyState
    {
      "assemblyName": "test_1",
      "intendedState": "Active"
    }
    
    IBM Telco Network Cloud Manager - Orchestration executes Configure and then Start transitions, which move the state to 'active'.
  6. To verify the status of the assembly instance, check it again:
    GET /api/topology/assemblies/5a65ce87-4637-401e-868b-e20ec254fd35
    
    The 'intendedState' in the sample response indicates that the Start event has completed successfully.
    {
      "processId": "5a65ce87-4637-401e-868b-e20ec254fd35",
      "assemblyId": " ef4ea879-e313-4e3b-ad11-6a0a7e7544eb",
      "assemblyName": "test_1",
      "assemblyDescriptorName": "assembly::t_bta::1.0",
      "intentType": "CreateAssembly",
      "intent": {
        "assemblyName": "test_1",
        "descriptorName": "assembly::t_bta::1.0",
        "intendedState": "Active",
    ...

Results

A new assembly instance with the name 'test_1' exists in an 'Active' state, and configured according to the rules defined in assembly descriptor 'assembly::t_bta::1.0'.