blob: a0772c86746ba4ba3d9ea711561280c1b6aaaa92 [file] [log] [blame]
qingshutingf91cb4a2022-10-12 11:22:13 +08001.. This work is licensed under a Creative Commons Attribution 4.0 International License.
2.. http://creativecommons.org/licenses/by/4.0
qingshutingf91cb4a2022-10-12 11:22:13 +08003
4Runtime Configuration
5=====================
Vijay Venkatesh Kumarbea4fdc2023-04-24 12:54:30 -04006The Slice Analysis MS provides an easy way to receive runtime configurations through Policy, another ONAP module. Runtime configuration is initially developed to meet the requirements of the ONAP Kohn release IBN use case. If you want to use this function, please also refer to https://wiki.onap.org/pages/viewpage.action?pageId=138872665
qingshutingf91cb4a2022-10-12 11:22:13 +08007
8This page will explain how runtime configuration works, and how to utilize it. Hopefully this page can help you develop your own runtime configuration to meet your own requirements.
9
10Architecture
11------------
qingshuting67948ca2022-11-08 11:20:27 +080012The architecture below depicts how runtime configuration works in the Slice MS as a part of DCAE.
13
14.. image:: ../../images/R11_architecture_diagram.png
qingshutingf91cb4a2022-10-12 11:22:13 +080015
16Slice Analysis MS provides runtime configuration feature since Kohn Version.
17
qingshutingf91cb4a2022-10-12 11:22:13 +080018For the Slice Analysis MS, there is a CBS thread running that will continually fetch the latest policies from the XCAML PDP engine. So if you want to pass runtime configuration, you can format your configuration contents in the form of an XCAML policy, then push it into the XCAML PDP engine. The Slice Analysis MS will get updated within seconds.
19
20Prerequisite
21~~~~~~~~~~~~
22- Using OOM to pull up ONAP environment
23
24Deployment
25~~~~~~~~~~
26- Enable "dcae-slice-analysis-ms" in oom /oom/kubernetes/dcaegen2-services/values.yaml.
27
28 1. Enable dcae-slice-analysis-ms in values.yaml. When using the helm chart of OOM to pull up the whole onap environment, dcae-slice-analysis-ms will be automatically installed.
qingshuting67948ca2022-11-08 11:20:27 +080029
qingshutingf91cb4a2022-10-12 11:22:13 +080030 .. code-block:: bash
qingshuting67948ca2022-11-08 11:20:27 +080031
qingshutingf91cb4a2022-10-12 11:22:13 +080032 dcae-slice-analysis-ms:
33 enabled: true
34 logConfigMapNamePrefix: '{{ include "common.release" . }}-dcaegen2-services'
35
36- Original params set in oom /oom/kubernetes/dcaegen2-services/components/dcae-slice-analysis-ms/values.yaml have to be modified.
37
38 1. Uncomment the following lines. "duration" is the interval of a thread in policy sync container to retrieve latest policy from XCAML PDP engine. The unit of "duration" is seconds.
qingshuting67948ca2022-11-08 11:20:27 +080039
qingshutingf91cb4a2022-10-12 11:22:13 +080040 .. code-block:: bash
qingshuting67948ca2022-11-08 11:20:27 +080041
qingshutingf91cb4a2022-10-12 11:22:13 +080042 dcaePolicySyncImage: onap/org.onap.dcaegen2.deployments.dcae-services-policy-sync:1.0.1
43 policies:
44 duration:
45 10
46 policyID: |
47 '["onap.dcae.slicems.config"]'
48
49- If the ONAP environment has already been deployed previously, just uninstall and reinstall DCAEGEN2-SERVICES via oom helm charts after the previous 2 modifications.
50
51Workflow
52~~~~~~~~
qingshuting67948ca2022-11-08 11:20:27 +080053
qingshutingf91cb4a2022-10-12 11:22:13 +080054.. image:: ./runtime_config_work_flow.jpg
55
56To realize the runtime configuration feature for SliceMS, similarly to SON-Handler, we add a "policy sync" container for Slice MS. There are 3 containers in Slice MS, "dcae-slice-analysis-ms", "dcae-slice-analysis-ms-filebeat" and "policy-sync".
57
58Policy Sync container keeps retrieving latest data (policies) from XCAML PDP Engine through a thread. The interval of the thread is set /oom/kubernetes/dcaegen2-services/components/dcae-slice-analysis-ms/values.yaml. Like in the above example, duration is set to 10, which means the thread will retrieve data from XCAML PDP every 10 seconds.
59
60So if someone wants to pass new configurations to the Slice Analysis MS, do the following steps:
61 Prerequisite: Create the policy type. This step only needs to be done once when you deploy the ONAP environment, except for when you redeploy the POLICY module (which causes the policy type to not exist). Then the policy type needs to be recreated. Currently only 1 policy type is supported, which will be attached here.
62 1. Undeploy the current policy if exists
63 2. Delete the current policy if exists
64 3. Create a new policy
65 4. Deploy the new policy
66
67
68Steps to Use Runtime Configuration
69~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
701. Create the policy type
71 command
qingshuting67948ca2022-11-08 11:20:27 +080072
qingshutingf91cb4a2022-10-12 11:22:13 +080073 .. code-block:: bash
qingshuting67948ca2022-11-08 11:20:27 +080074
qingshutingf91cb4a2022-10-12 11:22:13 +080075 curl -k -v --user 'username:password' -X POST "https://policyApiIp:6969/policy/api/v1/policytypes" -H "Content-Type:application/json" -H "Accept: application/json" -d @policy_type.json
76
77 request body: policy_type.json
qingshuting67948ca2022-11-08 11:20:27 +080078
qingshutingf91cb4a2022-10-12 11:22:13 +080079 .. code-block:: bash
qingshuting67948ca2022-11-08 11:20:27 +080080
qingshutingf91cb4a2022-10-12 11:22:13 +080081 {
82 "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
83 "policy_types": {
84 "onap.policies.monitoring.docker.slicems.app": {
85 "version": "1.0.0",
86 "description": "Slice MS Policy Type",
87 "derived_from": "onap.policies.Monitoring:1.0.0",
88 "description": "Runtime Configuration of Slice MS",
89 "properties": {
90 "cllId": {
91 "type": "string",
92 "required": true,
93 "description": "cll id"
94 },
95 "closedLoopStatus": {
96 "type": "string",
97 "required": true,
98 "description": "whether provide closed loop assurance for one cll"
99 },
100 "originalBw": {
101 "type": "string",
102 "required": true,
103 "description": "original bw of one cll"
104 }
105 }
106 }
107 }
108 }
109
1102. Create the policy
111 command: {versionNumber} here needs to match the "policies"-"version" in the request body "slicems_config_policy.json"
qingshuting67948ca2022-11-08 11:20:27 +0800112
qingshutingf91cb4a2022-10-12 11:22:13 +0800113 .. code-block:: bash
qingshuting67948ca2022-11-08 11:20:27 +0800114
qingshutingf91cb4a2022-10-12 11:22:13 +0800115 curl --silent -k -w %{http_code} --user 'username:password' -X POST "https://policyApiIp:6969/policy/api/v1/policytypes/onap.policies.monitoring.docker.slicems.app/versions/{versionNumber}}/policies" -H "Accept: application/json" -H "Content-Type: application/json" -d @slicems_config_policy.json
116
117 request body: slicems_config_policy.json
qingshuting67948ca2022-11-08 11:20:27 +0800118
qingshutingf91cb4a2022-10-12 11:22:13 +0800119 .. code-block:: bash
qingshuting67948ca2022-11-08 11:20:27 +0800120
qingshutingf91cb4a2022-10-12 11:22:13 +0800121 {
122 "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
123 "topology_template": {
124 "policies": [
125 {
126 "onap.dcae.slicems.config": {
127 "type": "onap.policies.monitoring.docker.slicems.app",
128 "type_version": "1.0.0",
129 "version": "1.0.0",
130 "metadata": {
131 "policy-id": "onap.dcae.slicems.config",
132 "policy-version": 1
133 },
134 "properties": {
135 "originalBw": "1000",
136 "closedLoopStatus": "false",
137 "cllId": "cll-8000000564489181"
138 }
139 }
140 }
141 ]
142 }
143 }
144
1453. Deploy the policy
146 command
qingshuting67948ca2022-11-08 11:20:27 +0800147
qingshutingf91cb4a2022-10-12 11:22:13 +0800148 .. code-block:: bash
qingshuting67948ca2022-11-08 11:20:27 +0800149
qingshutingf91cb4a2022-10-12 11:22:13 +0800150 curl -w %{http_code} --silent -k --user 'username:password' -X POST "https://policyPAPApi:6969/policy/pap/v1/pdps/policies" -H "Accept: application/json" -H "Content-Type: application/json" -d @push.json
151
152 request body: push.json
qingshuting67948ca2022-11-08 11:20:27 +0800153
qingshutingf91cb4a2022-10-12 11:22:13 +0800154 .. code-block:: bash
qingshuting67948ca2022-11-08 11:20:27 +0800155
qingshutingf91cb4a2022-10-12 11:22:13 +0800156 {
157 "policies": [
158 {
159 "policy-id": "onap.dcae.slicems.config",
160 "policy-version": 1
161 }
162 ]
163 }
164
1654. Verify in SliceMS that configurations received
qingshuting67948ca2022-11-08 11:20:27 +0800166
qingshutingf91cb4a2022-10-12 11:22:13 +0800167.. image:: ./example_slice_update_policy.png
168
169How to Develop Your Own Runtime Configuration
170~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1711. Create your own policy type
1722. Create a policy based on your policy type
1733. Deploy the policy
1744. Verify in SliceMS that configurations received. (Needs to write code in SliceMS to deal with your configurations in advance.)
175