Support arbitrary json format in os::mistral::workflow handle signal

Registered by noa

Currently, os::mistral::workflow expects a specific json format from a
signal request body.
{
  "input": {
    ...
  },
  "params": {
    ...
  }
}

Since external systems (or even the ceilometer project)
tend to have predefined bodies in their requests,
which are not compatible with this format,
we need to add support so that signals from these systems can pass
information to the workflows being signaled.

The suggestion is to except any json format as a map where all the keys
will be treated as inputs to the workflow.
After the change, optionally, in order to pass parameters to the workflow,
the request will send them using a specific header instead of the request body.
the change will not break current behavior, as explained later.

Example:
Ceilometer signal request body looks like this:
"{
     "severity": "low",
     "alarm_name": "my-alarm",
     "current": "insufficient data",
     "alarm_id": "895fe8c8-3a6e-48bf-b557-eede3e7f4bbd",
     "reason": "1 datapoints are unknown",
     "reason_data": {
           "count": 1,
           "most_recent": null,
           "type": "threshold",
           "disposition": "unknown"
     },
     "previous": "ok"
}
"
Currently mistral can't use any of this information, after the change the user will
be able to define the appropriate inputs in the workflow and they will be
filled when the signal is called.
"my_workflow:
    type: OS::Mistral::Workflow
    properties:
      input:
        current: !!null
        alarm_id: !!null
        reason: !!null
        previous: !!null
        severity: !!null
        alarm_name: !!null
        reason_data: !!null
"

In order to keep backward compatibility, we should add a new property to the
os::mistral::workflow resource, for example: "params_alarm_http_header_name",
if this property is null or undefined, the old behaviour will be used.
in case this property was given a value, the request body will be
treated as a simple json (no format), and any data passed in the specific header
will be passed as a parameter to the workflow.

Blueprint information

Status:
Complete
Approver:
Sergey Kraynev
Priority:
Medium
Drafter:
noa
Direction:
Needs approval
Assignee:
noa
Definition:
Approved
Series goal:
None
Implementation:
Implemented
Milestone target:
milestone icon mitaka-2
Started by
Sergey Kraynev
Completed by
Sergey Kraynev

Related branches

Sprints

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:bp/mistral-wf-signal-json-format,n,z

Addressed by: https://review.openstack.org/243087
    Enable simple json format in workflow signal

It is worth noting that if the workflow resource is created using the new property, there is no ability to override the workflow params using heat resource-signal API call.

Addressed by: https://review.openstack.org/245521
    Enable simple json format in workflow signal

Addressed by: https://review.openstack.org/257835
    Enable simple json format in workflow signal

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.