blob: f58f03d29600a66eee7a4ba74d36bd68f9d97e49 [file] [log] [blame]
liamfallone206a102021-10-07 19:00:18 +01001.. This work is licensed under a Creative Commons Attribution 4.0 International License.
2
waynedunicanc41c4132022-04-05 09:00:02 +01003.. _clamp-acm-http-participant:
liamfallone206a102021-10-07 19:00:18 +01004
5HTTP Participant
6################
7
liamfallone206a102021-10-07 19:00:18 +01008The CLAMP HTTP participant receives configuration information from the CLAMP runtime,
9maps the configuration information to a REST URL, and makes a REST call on the URL.
10Typically the HTTP Participant is used with another participant such as the
waynedunicanc41c4132022-04-05 09:00:02 +010011:ref:`Kubernetes Participant <clamp-acm-k8s-participant>`, which brings up
liamfallone206a102021-10-07 19:00:18 +010012the microservice that runs a REST server. Once the microservice is up, the HTTP
13participant can be used to configure the microservice over its REST interface.Of course,
14the HTTP participant works towards any REST service, it is not restricted to REST
15services started by participants.
16
rameshiyer2729e43442021-10-14 17:49:31 +010017
liamfallone206a102021-10-07 19:00:18 +010018.. image:: ../../images/participants/http-participant.png
19
rameshiyer2729e43442021-10-14 17:49:31 +010020
waynedunicanc41c4132022-04-05 09:00:02 +010021The HTTP participant runs a Automation Composition Element to handle the REST dialogues for a
liamfallone206a102021-10-07 19:00:18 +010022particular application domain. The REST dialogues are whatever REST calls that are
23required to implement the functionality for the application domain.
24
waynedunicanc41c4132022-04-05 09:00:02 +010025The HTTP participant allows the REST dialogues for a Automation Composition to be managed. A
26particular Automation Composition may require many *things* to be configured and managed and this
liamfallone206a102021-10-07 19:00:18 +010027may require many REST dialogues to achieve.
28
waynedunicanc41c4132022-04-05 09:00:02 +010029When a automation composition is initialized, the HTTP participant starts a HTTP Automation Composition
30element for the automation composition. It reads the configuration information sent from the
31Automation Composition Runtime runs a HTTP client to talk to the REST endpoint that is receiving
32the REST requests. A HTTP participant can simultaneously manage HTTP Automation Composition
liamfallone206a102021-10-07 19:00:18 +010033Elements towards multiple REST endpoints, as shown in the diagram above where the HTTP
waynedunicanc41c4132022-04-05 09:00:02 +010034participant is running two HTTP Automation Composition Elements, one for Automation Composition A and one for
35Automation Composition B.
liamfallone206a102021-10-07 19:00:18 +010036
waynedunicanc41c4132022-04-05 09:00:02 +010037Configuring a Automation Composition Element on the HTTP participant for a Automation Composition
adheli.tavares12a315f2022-04-05 14:21:40 +010038-------------------------------------------------------------------------------------------------
rameshiyer2729e43442021-10-14 17:49:31 +010039A *Configuration Entity* describes a concept that is managed by the HTTP participant. A
40Configuration Entity can be created, Read, Updated, and Deleted (CRUD). The user defines
waynedunicanc41c4132022-04-05 09:00:02 +010041the Configuration Entities that it wants its HTTP Automation Composition Element to manage and
rameshiyer2729e43442021-10-14 17:49:31 +010042provides a sequence of parameterized REST commands to Create, Read, Update, and Delete
43each Configuration Entity.
liamfallone206a102021-10-07 19:00:18 +010044
waynedunicanc41c4132022-04-05 09:00:02 +010045Sample tosca template defining a http participant and a automation composition element for a automation composition. :download:`click here <tosca/tosca-http-participant.yml>`
rameshiyer2729e43442021-10-14 17:49:31 +010046
47The user configures the following properties in the TOSCA for the HTTP participant:
liamfallone206a102021-10-07 19:00:18 +010048
49.. list-table::
50 :widths: 15 10 50
51 :header-rows: 1
52
53 * - Property
54 - Type
55 - Description
56 * - baseUrl
57 - URL
58 - A well formed URL pointing at the REST server that is processing the REST requests
59 * - httpHeaders
60 - map
61 - A map of *<String, String>* defining the HTTP headers to send on all REST calls
62 * - configurationEntitiies
63 - map
64 - A map of *<String, ConfigurationEntity>* describing the names and definitions of
waynedunicanc41c4132022-04-05 09:00:02 +010065 configuration entities that are managed by this HTTP Automation Composition Element
liamfallone206a102021-10-07 19:00:18 +010066
67The *ConfigurationEntity* type is described in the following table:
68
69.. list-table::
70 :widths: 15 10 50
71 :header-rows: 1
72
73 * - Field
74 - Type
75 - Description
76 * - ID
77 - ToscaConceptIdentifier
78 - The name and version of the Configuration Entity
79 * - restSequence
80 - List<RestRequest>
81 - A list of REST requests to give manage the Configuration Entity
82
83The *RestRequest* type is described in the following table:
84
85.. list-table::
86 :widths: 15 10 50
87 :header-rows: 1
88
89 * - Field
90 - Type
91 - Description
92 * - httpMethod
93 - HttpMethod
94 - An enum for the HTTP method {GET, PUT, POST, DELETE}
95 * - path
96 - String
rameshiyer2729e43442021-10-14 17:49:31 +010097 - The path of the REST endpoint relative to the baseUrl
liamfallone206a102021-10-07 19:00:18 +010098 * - body
99 - String
100 - The body of the request for POST and PUT methods
101 * - expectedResponse
102 - HttpStatus
103 - The expected HTTP response code fo the REST request
rameshiyer2729e43442021-10-14 17:49:31 +0100104
105Http participant Interactions:
106------------------------------
waynedunicanc41c4132022-04-05 09:00:02 +0100107The http participant interacts with Automation Composition Runtime on the northbound via DMaap. It interacts with any microservice on the southbound over http for configuration.
rameshiyer2729e43442021-10-14 17:49:31 +0100108
waynedunicanc41c4132022-04-05 09:00:02 +0100109The communication for the Automation Composition updates and state change requests are sent from the Automation Composition Runtime to the participant via DMaap.
110The participant invokes the appropriate http endpoint of the microservice based on the received messages from the Automation Composition Runtime.
rameshiyer2729e43442021-10-14 17:49:31 +0100111
112
113startPhase:
114-----------
waynedunicanc41c4132022-04-05 09:00:02 +0100115The http participant is often used along with :ref:`Kubernetes Participant <clamp-acm-k8s-participant>` to configure the microservice after the deployment.
116This requires the Automation Composition Element of http participant to be started after the completion of deployment of the microservice. This can be achieved by adding the property `startPhase`
117in the Automation Composition Element of http participant. Automation Composition Runtime starts the elements based on the `startPhase` value defined in the Tosca. The default value of startPhase is taken as '0'
118which takes precedence over the Automation Composition Elements with the startPhase value '1'. Http Automation Composition Elements are defined with value '1' in order to start the Automation Composition Element in the second phase.
rameshiyer2729e43442021-10-14 17:49:31 +0100119
120Http participant Workflow:
121--------------------------
waynedunicanc41c4132022-04-05 09:00:02 +0100122Once the participant is started, it sends a "REGISTER" event to the DMaap topic which is then consumed by the Automation Composition Runtime to register this participant on the runtime database.
123The user can commission the tosca definitions from the Policy Gui to the Automation Composition Runtime that further updates the participant with these definitions via DMaap.
124Once the automation composition definitions are available in the runtime database, the Automation Composition can be instantiated with the default state "UNINITIALISED" from the Policy Gui.
rameshiyer2729e43442021-10-14 17:49:31 +0100125
waynedunicanc41c4132022-04-05 09:00:02 +0100126When the state of the Automation Composition is changed from "UNINITIALISED" to "PASSIVE" from the Policy Gui, the http participant receives the automation composition state change event from the runtime and
127configures the microservice of the corresponding Automation Composition Element over http.
128The configuration entity for a microservice is associated with each Automation Composition Element for the http participant.
rameshiyer2729e43442021-10-14 17:49:31 +0100129The http participant holds the executed http requests information along with the responses received.
130
131The participant is used in a generic way to configure any entity over http and it does not hold the information about the microservice to unconfigure/revert the configurations when the
waynedunicanc41c4132022-04-05 09:00:02 +0100132state of Automation Composition changes from "PASSIVE" to "UNINITIALISED".
rameshiyer2729e43442021-10-14 17:49:31 +0100133