Policy documentation
[policy/engine.git] / docs / platform / swarch_brmsgw.rst
1
2 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
3 .. http://creativecommons.org/licenses/by/4.0
4
5 ****************************
6 BRMSGW Software Architecture 
7 ****************************
8
9 .. contents::
10     :depth: 3
11
12 Overview
13 ^^^^^^^^
14 This document provides an architectural overview of the **BRMSGW**. **BRMS** stands for Business Rule Management System which is based on JBoss Business Rule Management software used by PDP-D or Drools based rules and **GW** is short for Gateway. BRMSGW acts as as interface between PDP-D and PDP-X so that the drools rules are managed/assigned to PDP-D. It manages the rules present in PDP-D and is an integral part of the closed loop architecture.
15
16 Context
17 ^^^^^^^
18 Purpose of BRMSGW:
19
20 - PDP-D needs rule artifacts in nexus in order to take them. So, BRMSGW converts the BRMS configuration rules from PDP-X .drl format to PDP-D nexus artifact format. 
21 - BRMSGW Listens to Notifications from PDP for any BRMS based policies. 
22 - It manages controllers and dependencies for the PDP-D rule artifacts/jars.
23 - Upon any notification, BRMS rule (.drl) would be extracted from the PDP-X and updated to the maven project
24 - Maven deploy is executed to create the rule jar and pushed to nexus repository to make it available for PDP-D. 
25 - DMaaP/UEB notification is sent to PDP-D regarding the new rule artifact
26
27 BRMSGW Application software
28 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
29
30 - BRMSGW application is a standalone java application. It can support multiple BRMSGW applications running. But, would run in active-standby mode. This is internally managed by BRMSGW backup monitors. 
31 - It is a policy client application which only acts on PDP's notifications. The action is only taken if the BRMSGW Node is active and during standby mode actions are skipped in order to avoid multiple nexus jars 
32 - Upon Notification BRMSGW, will be doing a getConfig call back to PDP to retrieve the brms policy configuration which is the .drl rule. This rule is identified by its controller meta data information and added to appropriate controller's maven project in file system. 
33 - Once the project structure is updated based on update or remove notification the BRMS push is initiated. During this process maven deploy cycle is executed and the rule jar is pushed to nexus repository. 
34 - Once the rule jar is pushed to nexus, a notification message is sent to PDP-D. 
35 - MariaDB - In order to maintain sync and other controller, rule information database is used to keep in sync. 
36 - FileSystem - Properties, configuration and Rule maven projects are stored in file system. 
37 - Maven - BRMSGW has dependency on maven installation, hence needs maven and maven's settings.xml file to be available in order to be operating successfully. 
38 - BRMSGW project is available at https://git.onap.org/policy/engine/tree/BRMSGateway 
39
40 Architecture Overview 
41 ^^^^^^^^^^^^^^^^^^^^^
42 BRMSGW flow is shown below: 
43
44     .. image:: Swarch_brmsgw.png
45
46     1. Notification Listener will be listening to notifications from BRMSGW and will be triggered by PDP's Notification messages. 
47     2. If the notification is about BRMS rule, Retrieve rule is called. 
48     3. Retrieve rule does a getConfig call using the policy API to PDP-X and retrieves the BRMS configuration rule which is the raw .drl rule. 
49     4. The .drl rule retrieved is then passed down to Rule project management. 
50     5. The rule is either added to the project or removed from the project as per the notification received and the file system is updated. 
51     6. Maven deploy execution cycle is called.which creates the rule jar artifact from the updated project.
52     7. Maven deploy is going to upload the rule jar to nexus repository. 
53     8. Once nexus is updated a DMaaP/UEB notification message is sent to PDP-D about the new rule artifact. 
54
55         .. code-block:: bash
56            :caption: Notification Format that is sent to PDP-D:
57     
58             {
59                 "requestID": "7f5474ca-16a9-42ac-abc0-d86f62296fbc",
60                 "entity": "controller",
61                 "controllers": [{
62                     "name": "closed-loop",
63                     "drools": {
64                         "groupId": "org.onap.policy-engine.drools",
65                         "artifactId": "closed-loop",
66                         "version": "1.1.0"
67                     },
68                     "operation": "create"
69                 }]
70             }
71
72
73 Configuration 
74 ^^^^^^^^^^^^^
75 - All configurations related to the brmsgw are present in config.properties. 
76 - All dependency configurations related to controllers are maintained in dependency.json file. 
77
78
79 End of Document
80
81 .. SSNote: Wiki page ref. https://wiki.onap.org/display/DW/BRMSGW+Software+Architecture
82
83