Update requirements to branch
[osm/POL.git] / docs / architecture.md
1 <!--
2 This file is part of OSM Policy Management module
3 All Rights Reserved to Whitestack, LLC
4
5 Licensed under the Apache License, Version 2.0 (the "License"); you may
6 not use this file except in compliance with the License. You may obtain
7 a copy of the License at
8
9         http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 License for the specific language governing permissions and limitations
15 under the License.
16
17 For those usages not covered by the Apache License, Version 2.0 please
18 contact: bdiaz@whitestack.com or glavado@whitestack.com
19 -->
20 # Policy Management module (POL)
21
22 ## Summary
23
24 POL accomplishes the following tasks:
25
26 * Configure auto scaling groups for VNFs.
27 * Configure VNF alarms for VNFs.
28 * Listen for MON alarms status and evaluating corresponding policies (scaling and vnf alarms).
29 * Sending scaling messages to LCM when scaling policy conditions are met.
30 * Calling webhooks when VNF alarm policies are met.
31
32 ## Overview
33
34 ![](assets/POL_Overview_Diagram.jpg)
35
36 POL has the following components:
37
38 * POL Agent: 
39   * Listens to message bus for NS LCM actions (instantiation, scaling, deletion) and configures resources accordingly.
40   * Listens to message bus for alarm notifications, evaluates policies and executes corresponding actions.
41
42 ## POL Agent
43
44 POL subscribes to the message bus and waits for the following messages:
45
46 * topic: ns - key: instantiated
47 * topic: ns - key: scaled
48 * topic: ns - key: terminated
49 * topic: alarm_response - key: notify_alarm
50
51 When a NS is created, it checks the corresponding VNFDs for scaling group descriptors or vnf alarms. It creates the corresponding
52 resources in MON.
53 When a NS is scaled, it does the same as above for new VDUs if scaled out. It removes orphaned resources if scaled in.
54 When a NS is terminated, it deletes associated resources.
55
56 When an alarm is raised, if it corresponds to a scaling policy, it stores its last status and then validates the policy,
57 as policies can have N alarms related to them and can specify a boolean operator (AND/OR) to evaluate the conditions.
58 If it corresponds to a VNF alarm, the associated webhook is called.
59
60 Data is stored in POL database in the OSM MySQL engine.