From cfdd67d316e3436fb8054e07f883eceeff5bd08c Mon Sep 17 00:00:00 2001 From: Alex Shatov Date: Fri, 23 Feb 2018 14:56:36 -0500 Subject: store policies into consul-kv as :policies/ - now storing policies into consul-kv under folder :policies/ as items/= 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 /service_component_all/ - passing policy_body objects to plugins that consume the Policies decorators to pass to component - new decorator to delete the :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 Issue-ID: DCAEGEN2-347 --- onap-dcae-dcaepolicy-lib/README.md | 44 +++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 15 deletions(-) (limited to 'onap-dcae-dcaepolicy-lib/README.md') 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** -- cgit 1.2.3-korg