From c17c559999168620a8eb4ff459b3e0b637e691f3 Mon Sep 17 00:00:00 2001
From: Nikolay Stanchev <ns17@it-innovation.soton.ac.uk>
Date: Fri, 9 Aug 2019 11:35:09 +0100
Subject: [PATCH] Extends clmc dev guide with info on alerts api

---
 docs/clmc-development-guide.md | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/docs/clmc-development-guide.md b/docs/clmc-development-guide.md
index af16d0e..28b2a25 100644
--- a/docs/clmc-development-guide.md
+++ b/docs/clmc-development-guide.md
@@ -395,4 +395,11 @@ When creating/updating alerts, the following steps are performed (in the specifi
 8) the Kapacitor topic is named after the Kapacitor task (they share the same identifier)
 9) register all URLs as Kapacitor HTTP handlers for the created Kapacitor topic
 10) the Kapacitor handler identifier is generated as a hash of the concatenated sfc, sfc instance, policy and trigger identifiers with the handler URL
-11) return a response which contains the errors (if any) that were encountered while interacting with Kapacitor (e.g. if an alert already exist)
+11) fill in the Kapacitor templates and forward to the Kapacitor HTTP API
+12) return a response which contains the errors (if any) that were encountered while interacting with Kapacitor (e.g. if an alert already exist)
+
+Something that is not mentioned in the steps above is the generation of the SFEMC handler URL, that is every time the alerts configuration document references **flame_sfemc** as an alert handler. SFEMC expects a POST request for a given alert to a URL in the following format: 
+
+`http://<sfemc fqdn>:<sfemc port number>/<sfc identifier>/<policy identifier>/<trigger identifier>`
+
+However, policy and trigger identifiers are the identifiers included in the TOSCA resource specification document since this is the only deployment information that the SFEMC knows (SFEMC doesn't know anything about the CLMC alert management). This is why we have the restriction that **policy identifiers that reference flame_sfemc from the alerts configuration document must match with StateChange policy identifiers from the resource specification document**. Thus, we ensure that the policy identifier in the generated URL is what SFEMC expects. For the trigger identifiers, we ensure that **a trigger name that references flame_sfemc in the alerts configuration must match with an identifier from a `clmc::<trigger name>` constraint from the resource specification document**. Thus, the SFEMC URL is consistently generated with what SFEMC expects as a request URL. The SFC identifier is extracted from the metadata section of the alerts configuration. 
\ No newline at end of file
-- 
GitLab