summaryrefslogtreecommitdiffstats
path: root/docs/sections/services/slice-analysis-ms/runtime_configuration.rst
blob: a0772c86746ba4ba3d9ea711561280c1b6aaaa92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0

Runtime Configuration
=====================
The 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

This 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.

Architecture
------------
The architecture below depicts how runtime configuration works in the Slice MS as a part of DCAE.

.. image:: ../../images/R11_architecture_diagram.png

Slice Analysis MS provides runtime configuration feature since Kohn Version.

For 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.

Prerequisite
~~~~~~~~~~~~
- Using OOM to pull up ONAP environment

Deployment
~~~~~~~~~~
- Enable "dcae-slice-analysis-ms" in oom /oom/kubernetes/dcaegen2-services/values.yaml.

     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.

            .. code-block:: bash

               dcae-slice-analysis-ms:
                 enabled: true
                 logConfigMapNamePrefix: '{{ include "common.release" . }}-dcaegen2-services'

- Original params set in oom /oom/kubernetes/dcaegen2-services/components/dcae-slice-analysis-ms/values.yaml have to be modified.

     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.

             .. code-block:: bash

                dcaePolicySyncImage: onap/org.onap.dcaegen2.deployments.dcae-services-policy-sync:1.0.1
                policies:
                  duration:
                         10
                  policyID: |
                    '["onap.dcae.slicems.config"]'

- If the ONAP environment has already been deployed previously, just uninstall and reinstall DCAEGEN2-SERVICES via oom helm charts after the previous 2 modifications.

Workflow
~~~~~~~~

.. image:: ./runtime_config_work_flow.jpg

To 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".

Policy 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.

So if someone wants to pass new configurations to the Slice Analysis MS, do the following steps:
    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.
    1. Undeploy the current policy if exists
    2. Delete the current policy if exists
    3. Create a new policy
    4. Deploy the new policy


Steps to Use Runtime Configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Create the policy type
    command

    .. code-block:: bash

       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

    request body: policy_type.json

    .. code-block:: bash

       {
          "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
          "policy_types": {
            "onap.policies.monitoring.docker.slicems.app": {
              "version": "1.0.0",
              "description": "Slice MS Policy Type",
              "derived_from": "onap.policies.Monitoring:1.0.0",
                "description": "Runtime Configuration of Slice MS",
              "properties": {
                "cllId": {
                  "type": "string",
                  "required": true,
                  "description": "cll id"
                },
                "closedLoopStatus": {
                  "type": "string",
                  "required": true,
                  "description": "whether provide closed loop assurance for one cll"
                },
                "originalBw": {
                  "type": "string",
                  "required": true,
                  "description": "original bw of one cll"
                }
              }
            }
          }
        }

2. Create the policy
    command: {versionNumber} here needs to match the "policies"-"version" in the request body "slicems_config_policy.json"

    .. code-block:: bash

       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

    request body: slicems_config_policy.json

    .. code-block:: bash

        {
          "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
          "topology_template": {
            "policies": [
              {
                "onap.dcae.slicems.config": {
                  "type": "onap.policies.monitoring.docker.slicems.app",
                  "type_version": "1.0.0",
                  "version": "1.0.0",
                  "metadata": {
                    "policy-id": "onap.dcae.slicems.config",
                    "policy-version": 1
                  },
                  "properties": {
                    "originalBw": "1000",
                    "closedLoopStatus": "false",
                    "cllId": "cll-8000000564489181"
                  }
                }
              }
            ]
          }
        }

3. Deploy the policy
    command

    .. code-block:: bash

    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

    request body: push.json

    .. code-block:: bash

    {
      "policies": [
        {
          "policy-id": "onap.dcae.slicems.config",
           "policy-version": 1
        }
      ]
    }

4. Verify in SliceMS that configurations received

.. image:: ./example_slice_update_policy.png

How to Develop Your Own Runtime Configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Create your own policy type
2. Create a policy based on your policy type
3. Deploy the policy
4. Verify in SliceMS that configurations received. (Needs to write code in SliceMS to deal with your configurations in advance.)