summaryrefslogtreecommitdiffstats
path: root/onap-dcae-dcaepolicy-lib/README.md
diff options
context:
space:
mode:
authorAlex Shatov <alexs@att.com>2018-02-23 14:56:36 -0500
committerAlex Shatov <alexs@att.com>2018-02-23 14:56:36 -0500
commitcfdd67d316e3436fb8054e07f883eceeff5bd08c (patch)
treec8cfff66970b3029a12b9fefe789dddf7342d9b7 /onap-dcae-dcaepolicy-lib/README.md
parentd1a814370eb3e45368af9d6a76f8ded77cca5c82 (diff)
store policies into consul-kv as <scn>:policies/
- now storing policies into consul-kv under folder <service_cmponent_name>:policies/ as items/<policy_id>=<policy_body> and event={"action": "gathered", "policies_count": 30, "timestamp": "2018-02-12T10:20:30.777Z", "update_id": "0e79edc0-6c64-425e-a618-cc13ef50cd56"}} - this data is going to be retrieved by config-binding service thru a new API http GET <CBS>/service_component_all/<service_component_name> - passing policy_body objects to plugins that consume the Policies decorators to pass to component - new decorator to delete the <service_cmponent_name>:policies/ folder in consul-kv upon uninstalling the component - sorting and merge of policy configs into application config is not removed yet - to be done later - fixed unit tests - coverage is 83% Change-Id: Ie55be9298ac7889d516a5b884a2e24ac05c65a01 Signed-off-by: Alex Shatov <alexs@att.com> Issue-ID: DCAEGEN2-347
Diffstat (limited to 'onap-dcae-dcaepolicy-lib/README.md')
-rw-r--r--onap-dcae-dcaepolicy-lib/README.md44
1 files changed, 29 insertions, 15 deletions
diff --git a/onap-dcae-dcaepolicy-lib/README.md b/onap-dcae-dcaepolicy-lib/README.md
index ff37256..221cc24 100644
--- a/onap-dcae-dcaepolicy-lib/README.md
+++ b/onap-dcae-dcaepolicy-lib/README.md
@@ -1,4 +1,5 @@
# onap-dcae-dcaepolicy-lib - policy in dcae controller
+
- python-package to be used in cloudify plugins to maintain the policies lifecycle
## upload the python package to pypi server
@@ -8,23 +9,26 @@ python setup.py sdist upload
```
---
-# usage in plugins
-**requirements.txt**
+## usage in plugins
+
+### **requirements.txt**
+
```python
onap-dcae-dcaepolicy-lib==1.0.0
```
-**tasks.py**
-- import
+### **tasks.py**
+
+import
```python
from onap_dcae_dcaepolicy_lib import Policies
```
-# examples of **@operation** with **@Policies.<>** decorator
+### examples of **@operation** with **@Policies.<>** decorator
-## Usage
+### Usage:
import the dcaepolicy-node-type.yaml into your blueprint to use the dcae.nodes.type node
@@ -46,9 +50,12 @@ node_templates:
Then the dcaepolicyplugin will bring the latest policy to the dcae.nodes.policy node during the install workflow of cloudify.
-------
-## cloudify.interfaces.lifecycle.**configure**
+---
+
+### cloudify.interfaces.lifecycle.**configure**
+
- gather policy data into runtime_properties of policy consumer node
+
```yaml
cloudify.interfaces.lifecycle:
configure:
@@ -105,8 +112,10 @@ def node_configure(**kwargs):
demo_app.get_logs()
```
-------
-## execute-operation **policy-update**
+---
+
+### execute-operation **policy-update**
+
```yaml
dcae.interfaces.policy:
policy_update:
@@ -114,6 +123,7 @@ dcae.interfaces.policy:
```
execute-operation **policy-update** that gets a list of changed policy-configs
+
```python
from .discovery import DiscoveryClient
@@ -156,17 +166,21 @@ def policy_update(updated_policies, **kwargs):
```
example of the **changed\_policies** with **configs_only=True**
+
- list of config objects (preparsed from json string)
+
- manual mess produced by mock_policy_updater
+
```json
[{
- "policy_updated_from_ver": "2",
- "policy_updated_to_ver": "3",
- "updated_policy_id": "DCAE_alex.Config_db_client_policy_id_value",
- "policy_hello": "world!",
- "policy_updated_ts": "2017-08-17T21:49:39.279187Z"
+ "policy_updated_from_ver": "2",
+ "policy_updated_to_ver": "3",
+ "updated_policy_id": "DCAE_alex.Config_db_client_policy_id_value",
+ "policy_hello": "world!",
+ "policy_updated_ts": "2017-08-17T21:49:39.279187Z"
}]
```
+
---
example of **policies** in runtime_properties **before policy-update**