diff options
author | Saryu Shah <ss3917@att.com> | 2019-06-03 16:23:04 +0000 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2019-06-03 17:57:35 +0000 |
commit | bd1de26f1e46c41b92ea7cdcc703af9372c6a278 (patch) | |
tree | da2bf05f7d0565330aa07cbf6b1fd9c3c2ede11f /docs/drools | |
parent | 21b8895270fdce164ba3a43e971cb4cc54cea098 (diff) |
Create Drools PDP documentation - features
Create Drools PDP documentation in parent - features
Change-Id: Ie710842a7921fd46ffdef4628d50637093111cc8
Issue-ID: POLICY-1678
Signed-off-by: Saryu Shah <ss3917@att.com>
(cherry picked from commit f96ef833d3b00f84639b712579d6e2824e6063b4)
Diffstat (limited to 'docs/drools')
22 files changed, 1109 insertions, 1 deletions
diff --git a/docs/drools/ctrlog_config.png b/docs/drools/ctrlog_config.png Binary files differnew file mode 100755 index 00000000..8d5aeb65 --- /dev/null +++ b/docs/drools/ctrlog_config.png diff --git a/docs/drools/ctrlog_enablefeature.png b/docs/drools/ctrlog_enablefeature.png Binary files differnew file mode 100755 index 00000000..dc1abf34 --- /dev/null +++ b/docs/drools/ctrlog_enablefeature.png diff --git a/docs/drools/ctrlog_logback.png b/docs/drools/ctrlog_logback.png Binary files differnew file mode 100755 index 00000000..252f3fe1 --- /dev/null +++ b/docs/drools/ctrlog_logback.png diff --git a/docs/drools/ctrlog_view.png b/docs/drools/ctrlog_view.png Binary files differnew file mode 100755 index 00000000..118bd64d --- /dev/null +++ b/docs/drools/ctrlog_view.png diff --git a/docs/drools/drools.rst b/docs/drools/drools.rst index 90bd05a5..a7705b0f 100644 --- a/docs/drools/drools.rst +++ b/docs/drools/drools.rst @@ -5,8 +5,10 @@ Policy Drools PDP Engine ------------------------ .. toctree:: - :maxdepth: 1 + :maxdepth: 2 + droolsFeaturesIndex.rst + droolsTutorialsIndex.rst End of Document diff --git a/docs/drools/droolsFeaturesIndex.rst b/docs/drools/droolsFeaturesIndex.rst new file mode 100644 index 00000000..6bff285b --- /dev/null +++ b/docs/drools/droolsFeaturesIndex.rst @@ -0,0 +1,23 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. + +.. _drools-features-label: + +PDP-D Features +-------------- + +.. toctree:: + :maxdepth: 1 + + feature_activestdbymgmt.rst + feature_controllerlogging.rst + feature_eelf.rst + feature_healthcheck.rst + feature_locking.rst + feature_mdcfilters.rst + feature_pooling.rst + feature_sesspersist.rst + feature_statemgmt.rst + feature_testtransaction.rst + + +End of Document diff --git a/docs/drools/droolsTutorialsIndex.rst b/docs/drools/droolsTutorialsIndex.rst new file mode 100644 index 00000000..227db2e9 --- /dev/null +++ b/docs/drools/droolsTutorialsIndex.rst @@ -0,0 +1,12 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. + +.. _drools-tutorials-label: + +PDP-D Tutorials +---------------- + +.. toctree:: + :maxdepth: 1 + + +End of Document diff --git a/docs/drools/feature_activestdbymgmt.rst b/docs/drools/feature_activestdbymgmt.rst new file mode 100644 index 00000000..a7c3fb97 --- /dev/null +++ b/docs/drools/feature_activestdbymgmt.rst @@ -0,0 +1,116 @@ + +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 + +********************************** +Feature: Active/Standby Management +********************************** + +.. contents:: + :depth: 3 + +Summary +^^^^^^^ +When the Feature Session Persistence is enabled, there can only be one active/providing service Drools PDP due to the behavior of Drools persistence. The Active/Standby Management Feature controls the selection of the Drools PDP that is providing service. It utilizes its own database and the State Management Feature database in the election algorithm. All Drools PDP nodes periodically run the election algorithm and, since they all use the same data, all nodes come to the same conclusion with the "elected" node assuming an active/providingservice state. Thus, the algorithm is distributed and has no single point of failure - assuming the database is configured for high availability. + +When the algorithm selects a Drools PDP to be active/providing service the controllers and topic endpoints are unlocked and allowed to process transactions. When a Drools PDP transitions to a hotstandby or coldstandby state, the controllers and topic endpoints are locked, preventing the Drools PDP from handling transactions. + + +Usage +^^^^^ + +Enabling and Disabling Feature State Management +----------------------------------------------- + +The Active/Standby Management Feature is enabled from the command line when logged in as policy after configuring the feature properties file (see Description Details section). From the command line: + +- > features status - Lists the status of features +- > features enable active-standby-management - Enables the Active-Standby Management Feature +- > features disable active-standby-management - Disables the Active-Standby Management Feature + +The Drools PDP must be stopped prior to enabling/disabling features and then restarted after the features have been enabled/disabled. + + .. code-block:: bash + :caption: Enabling Active/Standby Management Feature + + policy@hyperion-4:/opt/app/policy$ policy stop + [drools-pdp-controllers] + L []: Stopping Policy Management... Policy Management (pid=354) is stopping... Policy Management has stopped. + policy@hyperion-4:/opt/app/policy$ features enable active-standby-management + name version status + ---- ------- ------ + controlloop-utils 1.1.0-SNAPSHOT disabled + healthcheck 1.1.0-SNAPSHOT disabled + test-transaction 1.1.0-SNAPSHOT disabled + eelf 1.1.0-SNAPSHOT disabled + state-management 1.1.0-SNAPSHOT disabled + active-standby-management 1.1.0-SNAPSHOT enabled + session-persistence 1.1.0-SNAPSHOT disabled + + +Description Details +^^^^^^^^^^^^^^^^^^^ + +Election Algorithm +------------------ + +The election algorithm selects the active/providingservice Drools PDP. The algorithm on each node reads the *standbystatus* from the *StateManagementEntity* table for all other nodes to determine if they are providingservice or in a hotstandby state and able to assume an active status. It uses the *DroolsPdpEntity* table to verify that other node election algorithms are currently functioning and when the other nodes were last designated as the active Drools PDP. + +In general terms, the election algorithm periodically gathers the standbystatus and designation status for all the Drools PDPs. If the node which is currently designated as providingservice is "current" in updating its status, no action is required. If the designated node is either not current or has a standbystatus other than providingservice, it is time to choose another designated *DroolsPDP*. The algorithm will build a list of all DroolsPDPs that are current and have a *standbystatus* of *hotstandby*. It will then give preference to DroolsPDPs within the same site, choosing the DroolsPDP with the lowest lexicographic value to the droolsPdpId (resourceName). If the chosen DroolsPDP is itself, it will promote its standbystatus from hotstandby to providingservice. If the chosen DroolsPDP is other than itself, it will do nothing. + +When the DroolsPDP promotes its *standbystatus* from hotstandby to providing service, a state change notification will occur and the Standby State Change Handler will take appropriate action. + + +Standby State Change Handler +---------------------------- + +The Standby State Change Handler (*PMStandbyStateChangeHandler* class) extends the IntegrityMonitor StateChangeNotifier class which implements the Observer class. When the DroolsPDP is constructed, an instance of the handler is constructed and registered with StateManagement. Whenever StateManagement implements a state transition, it calls the *handleStateChange()* method of the handler. If the StandbyStatus transitions to hot or cold standby, the handler makes a call into the lower level management layer to lock the application controllers and topic endpoints, preventing it from handling transactions. If the StandbyStatus transitions to providingservice, the handler makes a call into the lower level management layer to unlock the application controllers and topic endpoints, allowing it to handle transactions. + + +Database +-------- + +The Active/Standby Feature creates a database named activestandbymanagement with a single table, **droolspdpentity**. The election handler uses that table to determine which DroolsPDP was/is designated as the active DroolsPDP and which DroolsPDP election handlers are healthy enough to periodically update their status. + +The **droolspdpentity** table has the following columns: + - **pdpId** - The unique indentifier for the DroolsPDP. It is the same as the resourceName + - **designated** - Has a value of 1 if the DroolsPDP is designated as active/providingservice. It has a value of 0 otherwise + - **priority** - Indicates the priority level of the DroolsPDP for the election handler. In general, this is ignore and all have the same priority. + - **updatedDate** - This is the timestamp for the most recent update of the record. + - **designatedDate** - This is the timestamp that indicates when the designated column was most recently set to a value of 1 + - **site** - This is the name of the site + +Properties +---------- + +The properties are found in the feature-active-standby-management.properties file. In general, the properties are adequately described in the properties file. Parameters which must be replaced prior to usage are indicated thus: ${{parameter to be replaced}} + + .. code-block:: bash + :caption: feature-active-standby-mangement.properties + + # DB properties + javax.persistence.jdbc.driver=org.mariadb.jdbc.Driver + javax.persistence.jdbc.url=jdbc:mariadb://${{SQL_HOST}}:3306/activestandbymanagement + javax.persistence.jdbc.user=${{SQL_USER}} + javax.persistence.jdbc.password=${{SQL_PASSWORD}} + + # Must be unique across the system + resource.name=pdp1 + # Name of the site in which this node is hosted + site_name=site1 + + # Needed by DroolsPdpsElectionHandler + pdp.checkInterval=1500 # The interval in ms between updates of the updatedDate + pdp.updateInterval=1000 # The interval in ms between executions of the election handler + #pdp.timeout=3000 + # Need long timeout, because testTransaction is only run every 10 seconds. + pdp.timeout=15000 + #how long do we wait for the pdp table to populate on initial startup + pdp.initialWait=20000 + + +End of Document + +.. SSNote: Wiki page ref. https://wiki.onap.org/pages/viewpage.action?pageId=16005790 + + diff --git a/docs/drools/feature_controllerlogging.rst b/docs/drools/feature_controllerlogging.rst new file mode 100644 index 00000000..0677030e --- /dev/null +++ b/docs/drools/feature_controllerlogging.rst @@ -0,0 +1,50 @@ + +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 + +*************************** +Feature: Controller Logging +*************************** + +.. contents:: + :depth: 3 + +Summary +^^^^^^^ +The controller logging feature provides a way to log network topic messages to a separate controller log file for each controller. This allows a clear separation of network traffic between all of the controllers. + +Enabling Controller Logging +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Type "features enable controller-logging". The feature will now display as "enabled". + + .. image:: ctrlog_enablefeature.png + +When the feature's enable script is executed, it will search the $POLICY_HOME/config directory for any logback files containing the prefix "logback-include-". These logger configuration files are typically provided with a feature that installs a controlloop (ex: controlloop-amsterdam and controlloop-casablanca features). Once these configuration files are found by the enable script, the logback.xml config file will be updated to include the configurations. + + .. image:: ctrlog_logback.png + + +Controller Logger Configuration +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The contents of a logback-include-``*``.xml file follows the same configuration syntax as the logback.xml file. It will contain the configurations for the logger associated with the given controller. + + .. note:: A controller logger MUST be configured with the same name as the controller (ex: a controller named "casablanca" will have a logger named "casablanca"). + + .. image:: ctrlog_config.png + + +Viewing the Controller Logs +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Once a logger for the controller is configured, start the drools-pdp and navigate to the $POLICY_LOGS directory. A new controller specific network log will be added that contains all the network topic traffic of the controller. + + .. image:: ctrlog_view.png + +The original network log remains and will append traffic information from all topics regardless of which controller it is for. To abbreviate and customize messages for the network log, refer to the `Feature MDC Filters <feature_mdcfilters.html>`_ documentation. + + +End of Document + + diff --git a/docs/drools/feature_eelf.rst b/docs/drools/feature_eelf.rst new file mode 100644 index 00000000..7daeb76d --- /dev/null +++ b/docs/drools/feature_eelf.rst @@ -0,0 +1,52 @@ + +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 + +************************************************* +Feature: EELF (Event and Error Logging Framework) +************************************************* + +.. contents:: + :depth: 3 + +Summary +^^^^^^^ +The EELF feature provides backwards compatibility with R0 logging functionality. It supports the use of EELF/Common Framework style logging at the same time as traditional logging. + +.. seealso:: Additional information for EELF logging can be found at `EELF wiki`_. + +.. _EELF wiki: https://github.com/att/EELF/wiki + + +Usage +^^^^^ + +To utilize the eelf logging capabilities, first stop policy engine and then enable the feature using the "*features*" command. + + .. code-block:: bash + :caption: Enabling EELF Feature + + policy@hyperion-4:/opt/app/policy$ policy stop + [drools-pdp-controllers] + L []: Stopping Policy Management... Policy Management (pid=354) is stopping... Policy Management has stopped. + policy@hyperion-4:/opt/app/policy$ features enable eelf + name version status + ---- ------- ------ + controlloop-utils 1.1.0-SNAPSHOT disabled + healthcheck 1.1.0-SNAPSHOT disabled + test-transaction 1.1.0-SNAPSHOT disabled + eelf 1.1.0-SNAPSHOT enabled + state-management 1.1.0-SNAPSHOT disabled + active-standby-management 1.1.0-SNAPSHOT disabled + session-persistence 1.1.0-SNAPSHOT disabled + +The output of the enable command will indicate whether or not the feature was enabled successfully. + +Policy engine can then be started as usual. + + + +End of Document + +.. SSNote: Wiki page ref. https://wiki.onap.org/display/DW/Feature+EELF + diff --git a/docs/drools/feature_healthcheck.rst b/docs/drools/feature_healthcheck.rst new file mode 100644 index 00000000..a0793e92 --- /dev/null +++ b/docs/drools/feature_healthcheck.rst @@ -0,0 +1,117 @@ + +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 + +************************* +Feature: Healthcheck +************************* + +.. contents:: + :depth: 3 + +Summary +^^^^^^^ +The Healthcheck feature provides reports used to verify the health of *PolicyEngine.manager* in addition to the construction, operation, and deconstruction of HTTP server/client objects. + +Usage +^^^^^ + +When enabled, the feature takes as input a properties file named "*feature-healtcheck.properties*" (example below). This file should contain configuration properties necessary for the construction of HTTP client and server objects. + +Upon initialization, the feature first constructs HTTP server and client objects using the properties from its properties file. A healthCheck operation is then triggered. The logic of the healthCheck verifies that *PolicyEngine.manager* is alive, and iteratively tests each HTTP server object by sending HTTP GET requests using its respective client object. If a server returns a "200 OK" message, it is marked as "healthy" in its individual report. Any other return code results in an "unhealthy" report. + +After the testing of the server objects has completed, the feature returns a single consolidated report. + + + .. code-block:: bash + :caption: feature-healthcheck.properties + :linenos: + + ### + # ============LICENSE_START======================================================= + # feature-healthcheck + # ================================================================================ + # Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + # ================================================================================ + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + # ============LICENSE_END========================================================= + ### + + http.server.services=HEALTHCHECK + http.server.services.HEALTHCHECK.host=0.0.0.0 + http.server.services.HEALTHCHECK.port=6969 + http.server.services.HEALTHCHECK.restClasses=org.onap.policy.drools.healthcheck.RestHealthCheck + http.server.services.HEALTHCHECK.managed=false + http.server.services.HEALTHCHECK.swagger=true + http.server.services.HEALTHCHECK.userName=healthcheck + http.server.services.HEALTHCHECK.password=zb!XztG34 + + http.client.services=PAP,PDP + + http.client.services.PAP.host=pap + http.client.services.PAP.port=9091 + http.client.services.PAP.contextUriPath=pap/test + http.client.services.PAP.https=false + http.client.services.PAP.userName=testpap + http.client.services.PAP.password=alpha123 + http.client.services.PAP.managed=true + + http.client.services.PDP.host=pdp + http.client.services.PDP.port=8081 + http.client.services.PDP.contextUriPath=pdp/test + http.client.services.PDP.https=false + http.client.services.PDP.userName=testpdp + http.client.services.PDP.password=alpha123 + http.client.services.PDP.managed=false + + +To utilize the healthcheck functionality, first stop policy engine and then enable the feature using the "*features*" command. + + .. code-block:: bash + :caption: Enabling Healthcheck feature + + policy@hyperion-4:/opt/app/policy$ policy stop + [drools-pdp-controllers] + L []: Stopping Policy Management... Policy Management (pid=354) is stopping... Policy Management has stopped. + policy@hyperion-4:/opt/app/policy$ features enable healthcheck + name version status + ---- ------- ------ + controlloop-utils 1.1.0-SNAPSHOT disabled + healthcheck 1.1.0-SNAPSHOT enabled + test-transaction 1.1.0-SNAPSHOT disabled + eelf 1.1.0-SNAPSHOT disabled + state-management 1.1.0-SNAPSHOT disabled + active-standby-management 1.1.0-SNAPSHOT disabled + session-persistence 1.1.0-SNAPSHOT disabled + + +The output of the enable command will indicate whether or not the feature was enabled successfully. + +Policy engine can then be started as usual. + +The Healthcheck can also be invoked manually as follows: + + .. code-block:: bash + :caption: Manual Healthcheck invokation + + + # Assuming the healthcheck service credentials have not been changed + # post-installation within the drools container + + source /opt/app/policy/config/feature-healthcheck.conf.environment + curl -k --silent --user "${HEALTHCHECK_USER}:${HEALTHCHECK_PASSWORD}" -X GET https://localhost:6969/healthcheck | python -m json.tool + + +End of Document + +.. SSNote: Wiki page ref. https://wiki.onap.org/display/DW/Feature+Healthcheck diff --git a/docs/drools/feature_locking.rst b/docs/drools/feature_locking.rst new file mode 100644 index 00000000..1236c93f --- /dev/null +++ b/docs/drools/feature_locking.rst @@ -0,0 +1,47 @@ + +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 + +**************************** +Feature: Distributed Locking +**************************** + +Summary +^^^^^^^ + +The Distributed Locking Feature provides locking of resources across a pool of PDP-D hosts. The list of locks is maintained in a database, where each record includes a resource identifier, an owner identifier, and an expiration time. Typically, a drools application will unlock the resource when it's operation completes. However, if it fails to do so, then the resource will be automatically released when the lock expires, thus preventing a resource from becoming permanently locked. + +Usage +^^^^^ + + .. code-block:: bash + :caption: Enable Feature Distributed Locking + + policy stop + + features enable distributed-locking + + The configuration is located at: + + * $POLICY_HOME/config/feature-distributed-locking.properties + + + .. code-block:: bash + :caption: Start the PDP-D using pooling + + policy start + + + .. code-block:: bash + :caption: Disable the Distributed Locking feature + + policy stop + features disable distributed-locking + policy start + + +End of Document + +.. SSNote: Wiki page ref. https://wiki.onap.org/display/DW/Feature+Distributed+Locking + + diff --git a/docs/drools/feature_mdcfilters.rst b/docs/drools/feature_mdcfilters.rst new file mode 100644 index 00000000..b0f5543d --- /dev/null +++ b/docs/drools/feature_mdcfilters.rst @@ -0,0 +1,121 @@ + +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 + +******************** +Feature: MDC Filters +******************** + +.. contents:: + :depth: 3 + +Summary +^^^^^^^ +The MDC Filter Feature provides configurable properties for network topics to extract fields from JSON strings and place them in a mapped diagnostic context (MDC). + +Network Log Structure Before Feature Enabled +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Before enabling the feature, the network log contains the entire content of each message received on a topic. Below is a sample message from the network log. Note that the topic used for this tutorial is DCAE-CL. + + .. code-block:: bash + + [2019-03-22T16:36:42.942+00:00|DMAAP-source-DCAE-CL][IN|DMAAP|DCAE-CL] + {"closedLoopControlName":"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e","closedLoopAlarmStart":1463679805324,"closedLoopEventClient":"DCAE_INSTANCE_ID.dcae-tca","closedLoopEventStatus":"ONSET","requestID":"664be3d2-6c12-4f4b-a3e7-c349acced200","target_type":"VNF","target":"generic-vnf.vnf-id","AAI":{"vserver.is-closed-loop-disabled":"false","vserver.prov-status":"ACTIVE","generic-vnf.vnf-id":"vCPE_Infrastructure_vGMUX_demo_app"},"from":"DCAE","version":"1.0.2"} + +The network log can become voluminous if messages received from various topics carry large messages for various controllers. With the MDC Filter Feature, users can define keywords in JSON messages to extract and structure according to a desired format. This is done through configuring the feature's properties. + +Configuring the MDC Filter Feature +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +To configure the feature, the feature must be enabled using the following command: + + .. code-block:: bash + + features enable mdc-filters + + + .. image:: mdc_enablefeature.png + +Once the feature is enabled, there will be a new properties file in *$POLICY_HOME/config* called **feature-mdc-filters.properties**. + + .. image:: mdc_properties.png + +The properties file contains filters to extract key data from messages on the network topics that are saved in an MDC, which can be referenced in logback.xml. The configuration format is as follows: + + .. code-block:: bash + + <protocol>.<type>.topics.<topic-name>.mdcFilters=<filters> + + Where: + <protocol> = ueb, dmaap, noop + <type> = source, sink + <topic-name> = Name of DMaaP or UEB topic + <filters> = Comma separated list of key/json-path(s) + +The filters consist of an MDC key used by **logback.xml** (see below) and the JSON path(s) to the desired data. The path always begins with '$', which signifies the root of the JSON document. The underlying library, JsonPath, uses a query syntax for searching through a JSON file. The query syntax and some examples can be found at https://github.com/json-path/JsonPath. An example filter for the *DCAE-CL* is provided below: + + .. code-block:: bash + + dmaap.source.topics.DCAE-CL.mdcFilters=requestID=$.requestID + +This filter is specifying that the dmaap source topic *DCAE-CL* will search each message received for requestID by following the path starting at the root ($) and searching for the field *requestID*. If the field is found, it is placed in the MDC with the key "requestID" as signified by the left hand side of the filter before the "=". + + +Configuring Multiple Filters and Paths +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Multiple fields can be found for a given JSON document by a comma separated list of <mdcKey,jsonPath> pairs. For the previous example, another filter is added by adding a comma and specifying the filter as follows: + + .. code-block:: bash + + dmaap.source.topics.DCAE-CL.mdcFilters=requestID=$.requestID,closedLoopName=$.closedLoopControlName + +The feature will now search for both requestID and closedLoopControlName in a JSON message using the specified "$." path notations and put them in the MDC using the keys "requestID" and "closedLoopName" respectively. To further refine the filter, if a topic receives different message structures (ex: a response message structure vs an error message structure) the "|" notation allows multiple paths to a key to be defined. The feature will search through each specified path until a match is found. An example can be found below: + + .. code-block:: bash + + dmaap.source.topics.DCAE-CL.mdcFilters=requestID=$.requestID,closedLoopName=$.closedLoopControlName|$.AAI.closedLoopControlName + +Now when the filter is searching for closedLoopControlName it will check the first path "$.closedLoopControlName", if it is not present then it will try the second path "$.AAI.closedLoopControlName". If the user is unsure of the path to a field, JsonPath supports a deep scan by using the ".." notation. This will search the entire JSON document for the field without specifying the path. + + +Accessing the MDC Values in logback.xml +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Once the feature properties have been defined, logback.xml contains a "abstractNetworkPattern" property that will hold the desired message structure defined by the user. The user has the flexibility to define the message structure however they choose but for this tutorial the following pattern is used: + + .. code-block:: bash + + <property name="abstractNetworkPattern" value="[%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}] [%X{networkEventType:-NULL}|%X{networkProtocol:-NULL}|%X{networkTopic:-NULL}|%X{requestID:-NULL}|%X{closedLoopName:-NULL}]%n" /> + +The "value" portion consists of two headers in bracket notation, the first header defines the timestamp while the second header references the keys from the MDC filters defined in the feature properties. The standard logback syntax is used and more information on the syntax can be found here. Note that some of the fields here were not defined in the feature properties file. The feature automatically puts the network infrastructure information in the keys that are prepended with "network". The current supported network infrastructure information is listed below. + + +-------------------+-------------------------------------------------+ + | Field | Values | + +===================+=================================================+ + | networkEventType | IN, OUT | + +-------------------+-------------------------------------------------+ + | networkProtocol | DMAAP, UEB, NOOP | + +-------------------+-------------------------------------------------+ + | networkTopic | The name of the topic that received the message | + +-------------------+-------------------------------------------------+ + + +To reference the keys from the feature properties the syntax "%X{KEY_DEFINED_IN_PROPERTIES}" provides access to the value. An optional addition is to append ":-", which specifies a default value to display in the log if the field was not found in the message received. For this tutorial, a default of "NULL" is displayed for any of the fields that were not found while filtering. The "|" has no special meaning and is just used as a field separator for readability; the user can decorate the log format to their desired visual appeal. + +Network Log Structure After Feature Enabled +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Once the feature and logback.xml is configured to the user's desired settings, start the PDP-D by running "policy start". Based on the configurations from the previous sections of this tutorial, the following log message is written to network log when a message is received on the DCAE-CL topic: + + .. code-block:: bash + + [2019-03-22T16:38:23.884+00:00] [IN|DMAAP|DCAE-CL|664be3d2-6c12-4f4b-a3e7-c349acced200|ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e] + +The message has now been filtered to display the network infrastructure information and the extracted data from the JSON message based on the feature properties. In order to view the entire message received from a topic, a complementary feature was developed to display the entire message on a per controller basis while preserving the compact network log. Refer to the `Feature Controller Logging <feature_controllerlogging.html>`_ documentation for details. + + + +End of Document + diff --git a/docs/drools/feature_pooling.rst b/docs/drools/feature_pooling.rst new file mode 100644 index 00000000..f7d3579d --- /dev/null +++ b/docs/drools/feature_pooling.rst @@ -0,0 +1,100 @@ + +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 + +**************** +Feature: Pooling +**************** + +Summary +^^^^^^^ + +The Pooling feature provides the ability to load-balance work across a “pool” of active-active Drools-PDP hosts. This particular implementation uses a DMaaP topic for communication between the hosts within the pool. + +The pool is adjusted automatically, with no manual intervention when: + * a new host is brought online + * a host goes offline, whether gracefully or due to a failure in the host or in the network + +Assumptions and Limitations +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + * Session persistence is not required + * Data may be lost when processing is moved from one host to another + * The entire pool may shut down if the inter-host DMaaP topic becomes inaccessible + + .. image:: poolingDesign.png + + +Key Points +^^^^^^^^^^ + * Requests are received on a common DMaaP topic + - DMaaP distributes the requests randomly to the hosts + - The request topic should have at least as many partitions as there are hosts + * Uses a single, internal DMaaP topic for all inter-host communication + * Allocates buckets to each host + - Requests are assigned to buckets based on their respective “request IDs” + * No session persistence + * No objects copied between hosts + * Requires feature(s): distributed-locking + * Precludes feature(s): session-persistence, active-standby, state-management + +Example Scenario +^^^^^^^^^^^^^^^^ + 1. Incoming DMaaP message is received on a topic — all hosts are listening, but only one random host receives the message + 2. Decode message to determine “request ID” key (message-specific operation) + 3. Hash request ID to determine the bucket number + 4. Look up host associated with hash bucket (most likely remote) + 5. Publish “forward” message to internal DMaaP topic, including remote host, bucket number, DMaaP topic information, and message body + 6. Remote host verifies ownership of bucket, and routes the DMaaP message to its own rule engine for processing + + The figure below shows several different hosts in a pool. Each host has a copy of the bucket assignments, which specifies which buckets are assigned to which hosts. Incoming requests are mapped to a bucket, and a bucket is mapped to a host, to which the request is routed. The host table includes an entry for each active host in the pool, to which one or more buckets are mapped. + + .. image:: poolingPdps.png + +Bucket Reassignment +^^^^^^^^^^^^^^^^^^^ + * When a host goes up or down, buckets are rebalanced + * Attempts to maintain an even distribution + * Leaves buckets with their current owner, where possible + * Takes a few buckets from each host to assign to new hosts + + For example, in the diagram below, the left side shows how 32 buckets might be assigned among four different hosts. When the first host fails, the buckets from host 1 would be reassigned among the remaining hosts, similar to what is shown on the right side of the diagram. Any requests that were being processed by host 1 will be lost and must be restarted. However, the buckets that had already been assigned to the remaining hosts are unchanged, thus requests associated with those buckets are not impacted by the loss of host 1. + + .. image:: poolingBuckets.png + +Usage +^^^^^ + +For pooling to be enabled, the distributed-locking feature must be also be enabled. + + .. code-block:: bash + :caption: Enable Feature Pooling + + policy stop + + features enable distributed-locking + features enable pooling-dmaap + + The configuration is located at: + + * $POLICY_HOME/config/feature-pooling-dmaap.properties + + + .. code-block:: bash + :caption: Start the PDP-D using pooling + + policy start + + + .. code-block:: bash + :caption: Disable the pooling feature + + policy stop + features disable pooling-dmaap + policy start + + +End of Document + +.. SSNote: Wiki page ref. https://wiki.onap.org/display/DW/Feature+Pooling + + diff --git a/docs/drools/feature_sesspersist.rst b/docs/drools/feature_sesspersist.rst new file mode 100644 index 00000000..4bb5ef62 --- /dev/null +++ b/docs/drools/feature_sesspersist.rst @@ -0,0 +1,49 @@ + +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 + +************************************ +Feature: Session Persistence +************************************ + +The session persistence feature allows drools kie sessions to be persisted in a database surviving pdp-d restarts. + + .. code-block:: bash + :caption: Enable session persistence + :linenos: + + policy stop + features enable session-persistence + +The configuration is located at: + + - *$POLICY_HOME/config/feature-session-persistence.properties* + +Each controller that wants to be started with persistence should contain the following line in its *<controller-name>-controller.properties* + + - *persistence.type=auto* + + .. code-block:: bash + :caption: Start the PDP-D using session-persistence + :linenos: + + db-migrator -o upgrade -s ALL + policy start + +Facts will survive PDP-D restart using the native drools capabilities and introduce a performance overhead. + + .. code-block:: bash + :caption: Disable the session-persistence feature + :linenos: + + policy stop + features disable session-persistence + sed -i "/persistence.type=auto/d" <controller-name>-controller.properties + db-migrator -o erase -s sessionpersistence # delete all its database data (optional) + policy start + +End of Document + +.. SSNote: Wiki page ref. https://wiki.onap.org/display/DW/Feature+Session+Persistence + + diff --git a/docs/drools/feature_statemgmt.rst b/docs/drools/feature_statemgmt.rst new file mode 100644 index 00000000..960ff396 --- /dev/null +++ b/docs/drools/feature_statemgmt.rst @@ -0,0 +1,313 @@ + +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 + +************************* +Feature: State Management +************************* + +.. contents:: + :depth: 2 + +Summary +^^^^^^^ +The State Management Feature provides: + +- Node-level health monitoring +- Monitoring the health of dependency nodes - nodes on which a particular node is dependent +- Ability to lock/unlock a node and suspend or resume all application processing +- Ability to suspend application processing on a node that is disabled or in a standby state +- Interworking/Coordination of state values +- Support for ITU X.731 states and state transitions for: + - Administrative State + - Operational State + - Availability Status + - Standby Status + +Usage +^^^^^ + +Enabling and Disabling Feature State Management +----------------------------------------------- + +The State Management Feature is enabled from the command line when logged in as policy after configuring the feature properties file (see Description Details section). From the command line: + +- > features status - Lists the status of features +- > features enable state-management - Enables the State Management Feature +- > features disable state-management - Disables the State Management Feature + +The Drools PDP must be stopped prior to enabling/disabling features and then restarted after the features have been enabled/disabled. + + .. code-block:: bash + :caption: Enabling State Management Feature + + policy@hyperion-4:/opt/app/policy$ policy stop + [drools-pdp-controllers] + L []: Stopping Policy Management... Policy Management (pid=354) is stopping... Policy Management has stopped. + policy@hyperion-4:/opt/app/policy$ features enable state-management + name version status + ---- ------- ------ + controlloop-utils 1.1.0-SNAPSHOT disabled + healthcheck 1.1.0-SNAPSHOT disabled + test-transaction 1.1.0-SNAPSHOT disabled + eelf 1.1.0-SNAPSHOT disabled + state-management 1.1.0-SNAPSHOT enabled + active-standby-management 1.1.0-SNAPSHOT disabled + session-persistence 1.1.0-SNAPSHOT disabled + +Description Details +^^^^^^^^^^^^^^^^^^^ + +State Model +----------- + +The state model follows the ITU X.731 standard for state management. The supported state values are: + **Administrative State:** + - Locked - All application transaction processing is prohibited + - Unlocked - Application transaction processing is allowed + + **Administrative State Transitions:** + - The transition from Unlocked to Locked state is triggered with a Lock operation + - The transition from the Locked to Unlocked state is triggered with an Unlock operation + + **Operational State:** + - Enabled - The node is healthy and able to process application transactions + - Disabled - The node is not healthy and not able to process application transactions + + **Operational State Transitions:** + - The transition from Enabled to Disabled is triggered with a disableFailed or disableDependency operation + - The transition from Disabled to Enabled is triggered with an enableNotFailed and enableNoDependency operation + + **Availability Status:** + - Null - The Operational State is Enabled + - Failed - The Operational State is Disabled because the node is no longer healthy + - Dependency - The Operational State is Disabled because all members of a dependency group are disabled + - Dependency.Failed - The Operational State is Disabled because the node is no longer healthy and all members of a dependency group are disabled + + **Availability Status Transitions:** + - The transition from Null to Failed is triggered with a disableFailed operation + - The transtion from Null to Dependency is triggered with a disableDependency operation + - The transition from Failed to Dependency.Failed is triggered with a disableDependency operation + - The transition from Dependency to Dependency.Failed is triggered with a disableFailed operation + - The transition from Dependency.Failed to Failed is triggered with an enableNoDependency operation + - The transition from Dependency.Failed to Dependency is triggered with an enableNotFailed operation + - The transition from Failed to Null is triggered with an enableNotFailed operation + - The transition from Dependency to Null is triggered with an enableNoDependency operation + + **Standby Status:** + - Null - The node does not support active-standby behavior + - ProvidingService - The node is actively providing application transaction service + - HotStandby - The node is capable of providing application transaction service, but is currently waiting to be promoted + - ColdStandby - The node is not capable of providing application service because of a failure + + **Standby Status Transitions:** + - The transition from Null to HotStandby is triggered by a demote operation when the Operational State is Enabled + - The transition for Null to ColdStandby is triggered is a demote operation when the Operational State is Disabled + - The transition from ColdStandby to HotStandby is triggered by a transition of the Operational State from Disabled to Enabled + - The transition from HotStandby to ColdStandby is triggered by a transition of the Operational State from Enabled to Disabled + - The transition from ProvidingService to ColdStandby is triggered by a transition of the Operational State from Enabled to Disabled + - The transition from HotStandby to ProvidingService is triggered by a Promote operation + - The transition from ProvidingService to HotStandby is triggered by a Demote operation + +Database +-------- + +The State Management feature creates a StateManagement database having three tables: + + **StateManagementEntity** - This table has the following columns: + - **id** - Automatically created unique identifier + - **resourceName** - The unique identifier for a node + - **adminState** - The Administrative State + - **opState** - The Operational State + - **availStatus** - The Availability Status + - **standbyStatus** - The Standby Status + - **created_Date** - The timestamp the resource entry was created + - **modifiedDate** - The timestamp the resource entry was last modified + + **ForwardProgressEntity** - This table has the following columns: + - **forwardProgressId** - Automatically created unique identifier + - **resourceName** - The unique identifier for a node + - **fpc_count** - A forward progress counter which is periodically incremented if the node is healthy + - **created_date** - The timestamp the resource entry was created + - **last_updated** - The timestamp the resource entry was last updated + + **ResourceRegistrationEntity** - This table has the following columns: + - **ResourceRegistrationId** - Automatically created unique identifier + - **resourceName** - The unique identifier for a node + - **resourceUrl** - The JMX URL used to check the health of a node + - **site** - The name of the site in which the resource resides + - **nodeType** - The type of the node (i.e, pdp_xacml, pdp_drools, pap, pap_admin, logparser, brms_gateway, astra_gateway, elk_server, pypdp) + - **created_date** - The timestamp the resource entry was created + - **last_updated** - The timestamp the resource entry was last updated + +Node Health Monitoring +---------------------- + +**Application Monitoring** + + Application monitoring can be implemented using the *startTransaction()* and *endTransaction()* methods. Whenever a transaction is started, the *startTransaction()* method is called. If the node is locked, disabled or in a hot/cold standby state, the method will throw an exception. Otherwise, it resets the timer which triggers the default *testTransaction()* method. + + When a transaction completes, calling *endTransaction()* increments the forward process counter in the *ForwardProgressEntity* DB table. As long as this counter is updating, the integrity monitor will assume the node is healthy/sane. + + If the *startTransaction()* method is not called within a provisioned period of time, a timer will expire which calls the *testTransaction()* method. The default implementation of this method simply increments the forward progress counter. The *testTransaction()* method may be overwritten to perform a more meaningful test of system sanity, if desired. + + If the forward progress counter stops incrementing, the integrity monitoring routine will assume the node application has lost sanity and it will trigger a *statechange* (disableFailed) to cause the operational state to become disabled and the availability status attribute to become failed. Once the forward progress counter again begins incrementing, the operational state will return to enabled. + +**Application Monitoring with AllSeemsWell** + + The IntegrityMonitor class provides a facility for applications to directly control updates of the forwardprogressentity table. As previously described, *startTransaction()* and *endTransaction()* are provided to monitor the forward progress of transactions. This, however, does not monitor things such as internal threads that may be blocked or die. An example is the feature-state-management *DroolsPdpElectionHandler.run()* method. + + The *run()* method is monitored by a timer task, *checkWaitTimer()*. If the *run()* method is stalled an extended period of time, the *checkWaitTimer()* method will call *StateManagementFeature.allSeemsWell(<className>, <AllSeemsWell State>, <String message>)* with the AllSeemsWell state of Boolean.FALSE. + + The IntegrityMonitor instance owned by StateManagementFeature will then store an entry in the allSeemsWellMap and block updates of the forwardprogressentity table. This in turn, will cause the Drools PDP operational state to be set to “disabled” and availability status to be set to “failed”. + + Once the blocking condition is cleared, the *checkWaiTimer()* will again call the *allSeemsWell()* method and include an AllSeemsWell state of Boolean.True. This will cause the IntegrityMonitor to remove the entry for that className from the allSeemsWellMap and allow updating of the forwardprogressentity table, so long as there are no other entries in the map. + +**Dependency Monitoring** + + When a Drools PDP (or other node using the *IntegrityMonitor* policy/common module) is dependent upon other nodes to perform its function, those other nodes can be defined as dependencies in the properties file. In order for the dependency algorithm to function, the other nodes must also be running the *IntegrityMonitor*. Periodically the Drools PDP will check the state of dependencies. If all of a node type have failed, the Drools PDP will declare that it can no longer function and change the operational state to disabled and the availability status to dependency. + + In addition to other policy node types, there is a *subsystemTest()* method that is periodically called by the *IntegrityMonitor*. In Drools PDP, *subsystemTest* has been overwritten to execute an audit of the Database and of the Maven Repository. If the audit is unable to verify the function of either the DB or the Maven Repository, he Drools PDP will declare that it can no longer function and change the operational state to disabled and the availability status to dependency. + + When a failed dependency returns to normal operation, the *IntegrityMontor* will change the operational state to enabled and availability status to null. + +**External Health Monitoring Interface** + + The Drools PDP has a http test interface which, when called, will return 200 if all seems well and 500 otherwise. The test interface URL is defined in the properties file. + + +Site Manager +------------ + +The Site Manager is not deployed with the Drools PDP, but it is available in the policy/common repository in the site-manager directory. +The Site Manager provides a lock/unlock interface for nodes and a way to display node information and status. + +The following is from the README file included with the Site Manager. + + .. code-block:: bash + :caption: Site Manager README extract + + Before using 'siteManager', the file 'siteManager.properties' needs to be + edited to configure the parameters used to access the database: + + javax.persistence.jdbc.driver - typically 'org.mariadb.jdbc.Driver' + + javax.persistence.jdbc.url - URL referring to the database, + which typically has the form: 'jdbc:mariadb://<host>:<port>/<db>' + ('<db>' is probably 'xacml' in this case) + + javax.persistence.jdbc.user - the user id for accessing the database + + javax.persistence.jdbc.password - password for accessing the database + + Once the properties file has been updated, the 'siteManager' script can be + invoked as follows: + + siteManager show [ -s <site> | -r <resourceName> ] : + display node information (Site, NodeType, ResourceName, AdminState, + OpState, AvailStatus, StandbyStatus) + + siteManager setAdminState { -s <site> | -r <resourceName> } <new-state> : + update admin state on selected nodes + + siteManager lock { -s <site> | -r <resourceName> } : + lock selected nodes + + siteManager unlock { -s <site> | -r <resourceName> } : + unlock selected nodes + +Note that the 'siteManager' script assumes that the script, +'site-manager-${project.version}.jar' file and 'siteManager.properties' file +are all in the same directory. If the files are separated, the 'siteManager' +script will need to be modified so it can locate the jar and properties files. + + +Properties +---------- + +The feature-state-mangement.properties file controls the function of the State Management Feature. In general, the properties have adequate descriptions in the file. Parameters which must be replaced prior to usage are indicated thus: ${{parameter to be replaced}}. + + .. code-block:: bash + :caption: feature-state-mangement.properties + + # DB properties + javax.persistence.jdbc.driver=org.mariadb.jdbc.Driver + javax.persistence.jdbc.url=jdbc:mariadb://${{SQL_HOST}}:3306/statemanagement + javax.persistence.jdbc.user=${{SQL_USER}} + javax.persistence.jdbc.password=${{SQL_PASSWORD}} + + # DroolsPDPIntegrityMonitor Properties + # Test interface host and port defaults may be overwritten here + http.server.services.TEST.host=0.0.0.0 + http.server.services.TEST.port=9981 + #These properties will default to the following if no other values are provided: + # http.server.services.TEST.restClasses=org.onap.policy.drools.statemanagement.IntegrityMonitorRestManager + # http.server.services.TEST.managed=false + # http.server.services.TEST.swagger=true + + #IntegrityMonitor Properties + + # Must be unique across the system + resource.name=pdp1 + # Name of the site in which this node is hosted + site_name=site1 + # Forward Progress Monitor update interval seconds + fp_monitor_interval=30 + # Failed counter threshold before failover + failed_counter_threshold=3 + # Interval between test transactions when no traffic seconds + test_trans_interval=10 + # Interval between writes of the FPC to the DB seconds + write_fpc_interval=5 + # Node type Note: Make sure you don't leave any trailing spaces, or you'll get an 'invalid node type' error! + node_type=pdp_drools + # Dependency groups are groups of resources upon which a node operational state is dependent upon. + # Each group is a comma-separated list of resource names and groups are separated by a semicolon. For example: + # dependency_groups=site_1.astra_1,site_1.astra_2;site_1.brms_1,site_1.brms_2;site_1.logparser_1;site_1.pypdp_1 + dependency_groups= + # When set to true, dependent health checks are performed by using JMX to invoke test() on the dependent. + # The default false is to use state checks for health. + test_via_jmx=true + # This is the max number of seconds beyond which a non incrementing FPC is considered a failure + max_fpc_update_interval=120 + # Run the state audit every 60 seconds (60000 ms). The state audit finds stale DB entries in the + # forwardprogressentity table and marks the node as disabled/failed in the statemanagemententity + # table. NOTE! It will only run on nodes that have a standbystatus = providingservice. + # A value of <= 0 will turn off the state audit. + state_audit_interval_ms=60000 + # The refresh state audit is run every (default) 10 minutes (600000 ms) to clean up any state corruption in the + # DB statemanagemententity table. It only refreshes the DB state entry for the local node. That is, it does not + # refresh the state of any other nodes. A value <= 0 will turn the audit off. Any other value will override + # the default of 600000 ms. + refresh_state_audit_interval_ms=600000 + + + # Repository audit properties + # Assume it's the releaseRepository that needs to be audited, + # because that's the one BRMGW will publish to. + repository.audit.id=${{releaseRepositoryID}} + repository.audit.url=${{releaseRepositoryUrl}} + repository.audit.username=${{repositoryUsername}} + repository.audit.password=${{repositoryPassword}} + repository2.audit.id=${{releaseRepository2ID}} + repository2.audit.url=${{releaseRepository2Url}} + repository2.audit.username=${{repositoryUsername2}} + repository2.audit.password=${{repositoryPassword2}} + + # Repository Audit Properties + # Flag to control the execution of the subsystemTest for the Nexus Maven repository + repository.audit.is.active=false + repository.audit.ignore.errors=true + repository.audit.interval_sec=86400 + repository.audit.failure.threshold=3 + + # DB Audit Properties + # Flag to control the execution of the subsystemTest for the Database + db.audit.is.active=false + + +End of Document + +.. SSNote: Wiki page ref. https://wiki.onap.org/display/DW/Feature+State+Management + + diff --git a/docs/drools/feature_testtransaction.rst b/docs/drools/feature_testtransaction.rst new file mode 100644 index 00000000..488ee1a5 --- /dev/null +++ b/docs/drools/feature_testtransaction.rst @@ -0,0 +1,106 @@ + +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 + +************************* +Feature: Test Transaction +************************* + +.. contents:: + :depth: 3 + +Summary +^^^^^^^ + +The Test Transaction feature provides a mechanism by which the health of drools policy controllers can be tested. + +When enabled, the feature functions by injecting an event object (identified by a UUID) into the drools session of each policy controller that is active in the system. Only an object with this UUID can trigger the Test Transaction-specific drools logic to execute. + +The injection of the event triggers the "TT" rule (see *TestTransactionTemplate.drl* below) to fire. The "TT" rule simply increments a ForwardProgress counter object, thereby confirming that the drools session for this particular controller is active and firing its rules accordingly. This cycle repeats at 20 second intervals. + +If it is ever the case that a drools controller does not have the "TT" rule present in its *.drl*, or that the forward progress counter is not incremented, the Test Transaction thread for that particular drools session (i.e. controller) is terminated and a message is logged to *error.log*. + +Usage +^^^^^ + +Prior to being enabled, the following drools rules need to be appended to the rules templates of any use-case that is to be monitored by the feature. + + .. code-block:: java + :caption: TestTransactionTemplate.drl + :linenos: + + /* + * ============LICENSE_START======================================================= + * feature-test-transaction + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + + package org.onap.policy.drools.rules; + + import java.util.EventObject; + + declare ForwardProgress + counter : Long + end + + rule "TT.SETUP" + when + then + ForwardProgress fp = new ForwardProgress(); + fp.setCounter(0L); + insert(fp); + end + + rule "TT" + when + $fp : ForwardProgress() + $tt : EventObject(source == "43868e59-d1f3-43c2-bd6f-86f89a61eea5") + then + $fp.setCounter($fp.getCounter() + 1); + retract($tt); + end + query "TT.FPC" + ForwardProgress(counter >= 0, $ttc : counter) + end + +Once the proper artifacts are built and deployed with the addition of the TestTransactionTemplate rules, the feature can then be enabled by entering the following commands: + + .. code-block:: bash + :caption: PDPD Features Command + + policy@hyperion-4:/opt/app/policy$ policy stop + [drools-pdp-controllers] + L []: Stopping Policy Management... Policy Management (pid=354) is stopping... Policy Management has stopped. + policy@hyperion-4:/opt/app/policy$ features enable test-transaction + name version status + ---- ------- ------ + controlloop-utils 1.1.0-SNAPSHOT disabled + healthcheck 1.1.0-SNAPSHOT disabled + test-transaction 1.1.0-SNAPSHOT enabled + eelf 1.1.0-SNAPSHOT disabled + state-management 1.1.0-SNAPSHOT disabled + active-standby-management 1.1.0-SNAPSHOT disabled + session-persistence 1.1.0-SNAPSHOT disabled + +The output of the enable command will indicate whether or not the feature was enabled successfully. + +Policy engine can then be started as usual. + + +End of Document + +.. SSNote: Wiki page ref. https://wiki.onap.org/display/DW/Feature+Test+Transaction diff --git a/docs/drools/mdc_enablefeature.png b/docs/drools/mdc_enablefeature.png Binary files differnew file mode 100755 index 00000000..26ae55a4 --- /dev/null +++ b/docs/drools/mdc_enablefeature.png diff --git a/docs/drools/mdc_properties.png b/docs/drools/mdc_properties.png Binary files differnew file mode 100755 index 00000000..63cea92e --- /dev/null +++ b/docs/drools/mdc_properties.png diff --git a/docs/drools/poolingBuckets.png b/docs/drools/poolingBuckets.png Binary files differnew file mode 100644 index 00000000..8b43a7de --- /dev/null +++ b/docs/drools/poolingBuckets.png diff --git a/docs/drools/poolingDesign.png b/docs/drools/poolingDesign.png Binary files differnew file mode 100644 index 00000000..8040e809 --- /dev/null +++ b/docs/drools/poolingDesign.png diff --git a/docs/drools/poolingPdps.png b/docs/drools/poolingPdps.png Binary files differnew file mode 100644 index 00000000..e05bad3d --- /dev/null +++ b/docs/drools/poolingPdps.png |