E2E Network slicing - I-rel Documentation update
[integration.git] / docs / docs_vFW_CNF_CDS.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3 .. Copyright 2021 ONAP
4
5 .. _docs_vFW_CNF_CDS:
6
7 :orphan:
8
9 vFirewall CNF Use Case
10 ----------------------
11
12 Source files
13 ~~~~~~~~~~~~
14 - Heat/Helm/CDS models: `vFW_CNF_CDS Model`_
15 - Automation Scripts: `vFW_CNF_CDS Automation`_
16
17 Description
18 ~~~~~~~~~~~
19 This use case is a combination of `vFW CDS Dublin`_ and `vFW EDGEX K8S`_ use cases. The aim is to continue improving Kubernetes based Network Functions (a.k.a CNF) support in ONAP. Use case continues where `vFW EDGEX K8S`_ left and brings CDS support into picture like `vFW CDS Dublin`_ did for the old vFW Use case. Predecessor use case is also documented here `vFW EDGEX K8S In ONAP Wiki`_.
20
21 This use case shows how to onboard helm packages and to instantiate them with help of ONAP. Following improvements were made in the vFW CNF Use Case:
22
23 - vFW Kubernetes Helm charts support overrides (previously mostly hardcoded values)
24 - SDC accepts Onboarding Package with many helm packages what allows to keep decomposition of service instance similar to `vFW CDS Dublin`_
25 - Compared to `vFW EDGEX K8S`_ use case **MACRO** workflow in SO is used instead of VNF a'la carte workflow
26 - No VNF data preloading used, instead resource-assignment feature of CDS is used
27 - CDS is used to resolve instantiation time parameters (Helm overrides)
28   * IP addresses with IPAM
29   * Unique names for resources with ONAP naming service
30   * CDS is used to create and upload **multicloud/k8s profile** as part of instantiation flow
31 - Combined all models (Heat, Helm, CBA) in to same git repo and a created single onboarding package `vFW_CNF_CDS Model`_
32 - vFW CNF status is monitored prior to the completion of the instantiation process.
33 - It is possible to not only provide overrides for Helm packages but we can modify Helm packages before instantiation or we can modify CNF after its deployment
34 - Use case does not contain Closed Loop part of the vFW demo.
35
36 All changes to related ONAP components and Use Case can be found in the following tickets:
37
38 - `REQ-182`_
39 - `REQ-341`_
40 - `REQ-458`_
41
42 **Since Guilin ONAP supports Helm packages as a native onboarding artifacts and SO natively orchestrates Helm packages what brings significant advantages in the future. Also since Guilin release ONAP has first mechanisms for monitoring of the status of deployed CNF resources. Since Honolulu release native CNF testing capability was enabled that allows for execution of the dedicated test jobs for each helm package**.
43
44 The vFW CNF Use Case
45 ~~~~~~~~~~~~~~~~~~~~
46 The vFW CNF CDS use case shows how to instantiate multiple CNF instances in similar way as VNFs bringing CNFs closer to first class citizens in ONAP.
47
48 One of the biggest practical change compared to the old demos (any ONAP demo) is that whole network function content (user provided content) is collected to one place and more importantly into git repository (`vFW_CNF_CDS Model`_) that provides version control (that is pretty important thing). That is very basic thing but unfortunately this is a common problem when running any ONAP demo and trying to find all content from many different git repositories and even some files only in ONAP wiki.
49
50 Demo git directory has also `Data Dictionary`_ file (CDS model time resource) included.
51
52 Another founding idea from the start was to provide complete content in single onboarding package available directly from that git repository. Not any revolutionary idea as that's the official package format ONAP supports and all content supposed to be in that same package for single service regardless of the models and closed loops and configurations etc.
53
54 Following table describes all the source models to which this demo is based on.
55
56 ===============  =================       ===========
57 Model            Git reference           Description
58 ---------------  -----------------       -----------
59 Heat             `vFW_NextGen`_          Heat templates used in original vFW demo but split into multiple vf-modules
60 Helm             `vFW_Helm Model`_       Helm templates used in `vFW EDGEX K8S`_ demo
61 CDS model        `vFW CBA Model`_        CDS CBA model used in `vFW CDS Dublin`_ demo
62 ===============  =================       ===========
63
64 .. note::  Since the Guilin release `vFW_CNF_CDS Model`_ contains sources that allow to model and instantiate CNF with VNF/Heat orchestration approach (Frankfurt) and with native Helm orchestration approach (Guilin and beyond). VNF/Heat orchestration approach is deprecated and will not be enhanced in the future. Please follow README.txt description and further documentation here to generate and select appropriate onboarding package which will leverage appropriate SO orchestration path.
65
66 Modeling of Onboarding Package/Helm
67 ...................................
68
69 The starting point for this demo was Helm package containing one Kubernetes application, see `vFW_Helm Model`_. In this demo we decided to follow SDC/SO vf-module concept the same way as original vFW demo was split into multiple vf-modules instead of one (`vFW_NextGen`_). The same way we splitted Helm version of vFW into multiple Helm packages each matching one dedicated vf-module.
70
71 The Honolulu version of the `vFW_CNF_CDS Model`_ contains files required to create **VSP onboarding packages in two formats**: the **Dummy Heat** (available in Frankfurt release already) one that considers association of each Helm package with dummy heat templates and the **Native Helm** one where each Helm package is standalone and is natively understood in consequence by SO. For both variants of VSP Helm packages are matched to the vf-module concept, so basically each Helm application after instantiation is visible to ONAP as a separate vf-module. The chosen format for onboarding has **crucial** role in the further orchestration approach applied for Helm package instantiation. The **Dummy Heat** will result with orchestration through the **Openstack Adapter** component of SO while **Native Helm** will result with **CNF Adapter**. Both approaches will result with instantiation of the same CNF, however the **Native Helm** approach will be enhanced in the future releases while **Dummy Heat** approach will become deprecated in the future.
72
73 Produced **Dummy Heat** VSP onboarding package `Creating Onboarding Package`_ format has following MANIFEST file (package_dummy/MANIFEST.json). The Helm package is delivered as CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT package through SDC and SO. Dummy heat templates are matched to Helm packages by the same prefix <vf_module_label> of the file name that for both dummy Heat teamplate and for CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT must be the same, like i.e. *vpg* vf-module in the manifest file below. The name of the CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT artifact is predefined and needs to match the pattern: <vf_module_label>_cloudtech_k8s_charts.tgz. More examples can be found in `Modeling Onboarding Package/Helm`_ section.
74
75 ::
76
77     {
78         "name": "virtualFirewall",
79         "description": "",
80         "data": [
81             {
82                 "file": "CBA.zip",
83                 "type": "CONTROLLER_BLUEPRINT_ARCHIVE"
84             },
85             {
86                 "file": "base_template.yaml",
87                 "type": "HEAT",
88                 "isBase": "true",
89                 "data": [
90                     {
91                         "file": "base_template.env",
92                         "type": "HEAT_ENV"
93                     }
94                 ]
95             },
96             {
97                 "file": "base_template_cloudtech_k8s_charts.tgz",
98                 "type": "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT"
99             },
100             {
101                 "file": "vfw.yaml",
102                 "type": "HEAT",
103                 "isBase": "false",
104                 "data": [
105                     {
106                         "file": "vfw.env",
107                         "type": "HEAT_ENV"
108                     }
109                 ]
110             },
111             {
112                 "file": "vfw_cloudtech_k8s_charts.tgz",
113                 "type": "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT"
114             },
115             {
116                 "file": "vpkg.yaml",
117                 "type": "HEAT",
118                 "isBase": "false",
119                 "data": [
120                     {
121                         "file": "vpkg.env",
122                         "type": "HEAT_ENV"
123                     }
124                 ]
125             },
126             {
127                 "file": "vpkg_cloudtech_k8s_charts.tgz",
128                 "type": "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT"
129             },
130             {
131                 "file": "vsn.yaml",
132                 "type": "HEAT",
133                 "isBase": "false",
134                 "data": [
135                     {
136                         "file": "vsn.env",
137                         "type": "HEAT_ENV"
138                     }
139                 ]
140             },
141             {
142                 "file": "vsn_cloudtech_k8s_charts.tgz",
143                 "type": "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT"
144             }
145         ]
146     }
147
148 Produced **Native Helm** VSP onboarding package `Creating Onboarding Package`_ format has following MANIFEST file (package_native/MANIFEST.json). The Helm package is delivered as HELM package through SDC and SO. The *isBase* flag of HELM artifact is ignored by SDC but in the manifest one HELM or HEAT artifacts must be defined as isBase = true. If both HEAT and HELM are present in the same manifest file the base one must be always one of HELM artifacts. Moreover, the name of HELM type artifact must match the specified pattern: *helm_<some_name>* and the HEAT type artifacts, if present in the same manifest, cannot contain keyword *helm*. These limitations are a consequence of current limitations of the SDC onboarding and VSP validation engine and will be adresssed in the future releases.
149
150 ::
151
152     {
153         "name": "virtualFirewall",
154         "description": "",
155         "data": [
156             {
157                 "file": "CBA.zip",
158                 "type": "CONTROLLER_BLUEPRINT_ARCHIVE"
159             },
160             {
161                 "file": "helm_base_template.tgz",
162                 "type": "HELM",
163                 "isBase": "true"
164             },
165             {
166                 "file": "helm_vfw.tgz",
167                 "type": "HELM",
168                 "isBase": "false"
169             },
170             {
171                 "file": "helm_vpkg.tgz",
172                 "type": "HELM",
173                 "isBase": "false"
174             },
175             {
176                 "file": "helm_vsn.tgz",
177                 "type": "HELM",
178                 "isBase": "false"
179             }
180         ]
181     }
182
183 .. note::  CDS model (CBA package) is delivered as SDC supported own type CONTROLLER_BLUEPRINT_ARCHIVE but the current limitation of VSP onbarding forces to use the artifact name *CBA.zip* to automaticaly recognize CBA as a CONTROLLER_BLUEPRINT_ARCHIVE.
184
185 CDS Model (CBA)
186 ...............
187
188 CDS plays a crucial role in the process of CNF instantiation and is responsible for delivery of instantiation parameters, CNF customization, configuration of CBF after the deployment and may be used in the process of CNF status verification.
189
190 Creating CDS model was the core of the use case work and also the most difficult and time consuming part. Current template used by use-case should be easily reusable for anyone. Once CDS GUI will be fully working, we think that CBA development should be much easier. For CBA structure reference, please visit it's documentation page `CDS Documentation`_.
191
192 At first the target was to keep CDS model as close as possible to `vFW_CNF_CDS Model`_ use case model and only add smallest possible changes to enable also k8s usage. That is still the target but in practice model deviated from the original one already and time pressure pushed us to not care about sync. Basically the end result could be possible much streamlined if wanted to be smallest possible to working only for K8S based network functions.
193
194 Base on this example there are demonstrated following features of CDS and CBA model
195
196 - resource assignment string, integer and json types
197 - sourcing of resolved value on vf-module level from vnf level assignment
198 - extracting data from AAI and MD-SAL during the resource assignment
199 - custom resource assignment with Kotlin script
200 - templating of the vtl files
201 - building of imperative workflows
202 - utilization of on_succes and on_failure event in imperative workflow
203 - handling of the failure in the workflow
204 - implementation of custom workflow logic with Kotlin script
205 - example of config-assign and config-deploy operation decomposed into many steps
206 - complex parametrization of config deploy operation
207 - combination and aggregation of AAI and MD-SAL data in config-assign and config-deploy operations
208
209 The prepared CBA model demonstrates also how to utilize CNF specific features of CBA, suited for the deployment of CNF with k8splugin in ONAP:
210
211 - building and upload of k8s profile template into k8splugin
212 - building and upload of k8s configuration template into k8splugin
213 - parametrization and creation of configuration instance from configuration template
214 - validation of CNF status with Kotlin script
215
216 As K8S application is split into multiple Helm packages to match vf-modules, CBA modeling follows the same and for each vf-module there's own template in CBA package. The list of artifact with the templates is different for **Dummy Heat** and **Native Helm** approach. The second one has artifact names starting with *helm_* prefix, in the same way like names of artifacts in the MANIFEST file of VSP differs. The **Dummy Heat** artifacts' list is following:
217
218 ::
219
220     "artifacts" : {
221       "base_template-template" : {
222         "type" : "artifact-template-velocity",
223         "file" : "Templates/base_template-template.vtl"
224       },
225       "base_template-mapping" : {
226         "type" : "artifact-mapping-resource",
227         "file" : "Templates/base_template-mapping.json"
228       },
229       "vpkg-template" : {
230         "type" : "artifact-template-velocity",
231         "file" : "Templates/vpkg-template.vtl"
232       },
233       "vpkg-mapping" : {
234         "type" : "artifact-mapping-resource",
235         "file" : "Templates/vpkg-mapping.json"
236       },
237       "vfw-template" : {
238         "type" : "artifact-template-velocity",
239         "file" : "Templates/vfw-template.vtl"
240       },
241       "vfw-mapping" : {
242         "type" : "artifact-mapping-resource",
243         "file" : "Templates/vfw-mapping.json"
244       },
245       "vnf-template" : {
246         "type" : "artifact-template-velocity",
247         "file" : "Templates/vnf-template.vtl"
248       },
249       "vnf-mapping" : {
250         "type" : "artifact-mapping-resource",
251         "file" : "Templates/vnf-mapping.json"
252       },
253       "vsn-template" : {
254         "type" : "artifact-template-velocity",
255         "file" : "Templates/vsn-template.vtl"
256       },
257       "vsn-mapping" : {
258         "type" : "artifact-mapping-resource",
259         "file" : "Templates/vsn-mapping.json"
260       }
261     }
262
263 The **Native Helm** artifacts' list is following:
264
265 ::
266
267     "artifacts" : {
268       "helm_base_template-template" : {
269         "type" : "artifact-template-velocity",
270         "file" : "Templates/base_template-template.vtl"
271       },
272       "helm_base_template-mapping" : {
273         "type" : "artifact-mapping-resource",
274         "file" : "Templates/base_template-mapping.json"
275       },
276       "helm_vpkg-template" : {
277         "type" : "artifact-template-velocity",
278         "file" : "Templates/vpkg-template.vtl"
279       },
280       "helm_vpkg-mapping" : {
281         "type" : "artifact-mapping-resource",
282         "file" : "Templates/vpkg-mapping.json"
283       },
284       "helm_vfw-template" : {
285         "type" : "artifact-template-velocity",
286         "file" : "Templates/vfw-template.vtl"
287       },
288       "helm_vfw-mapping" : {
289         "type" : "artifact-mapping-resource",
290         "file" : "Templates/vfw-mapping.json"
291       },
292       "vnf-template" : {
293         "type" : "artifact-template-velocity",
294         "file" : "Templates/vnf-template.vtl"
295       },
296       "vnf-mapping" : {
297         "type" : "artifact-mapping-resource",
298         "file" : "Templates/vnf-mapping.json"
299       },
300       "helm_vsn-template" : {
301         "type" : "artifact-template-velocity",
302         "file" : "Templates/vsn-template.vtl"
303       },
304       "helm_vsn-mapping" : {
305         "type" : "artifact-mapping-resource",
306         "file" : "Templates/vsn-mapping.json"
307       }
308     }
309
310 SO requires for instantiation name of the profile in the parameter: *k8s-rb-profile-name* and name of the release of thr application: *k8s-rb-instance-release-name*. The latter one, when not specified, will be replaced with combination of profile name and vf-module-id for each Helm instance/vf-module instantiated. Both values can be found in vtl templates dedicated for vf-modules.
311
312 CBA offers possibility of the automatic generation and upload to multicloud/k8s plugin the RB profile content. RB profile is required if you want to deploy your CNF into k8s namesapce other than *default*. Also, if you want to ensure particular templating of your Helm charts, specific to particular version of the cluster into which Helm packages will deployed on, profile is used to specify the version of your cluster.
313
314 RB profile can be used to enrich or to modify the content of the original helm package. Profile can be also used to add additional k8s helm templates for helm installation or can be used to modify existing k8s helm templates for each create CNF instance. It opens another level of CNF customization, much more than customization of the Helm package with override values. K8splugin offers also *default* profile without content, for default namespace and default cluster version.
315
316 ::
317
318   ---
319   version: v1
320   type:
321     values: "override_values.yaml"
322     configresource:
323       - filepath: resources/deployment.yaml
324         chartpath: templates/deployment.yaml
325
326
327 Above we have exemplary manifest file of the RB profile. Since Frankfurt *override_values.yaml* file does not need to be used as instantiation values are passed to the plugin over Instance API of k8s plugin. In the example, profile contains additional k8s Helm template which will be added on demand to the helm package during its installation. In our case, depending on the SO instantiation request input parameters, vPGN helm package can be enriched with additional ssh service. Such service will be dynamically added to the profile by CDS and later on CDS will upload whole custom RB profile to multicloud/k8s plugin.
328
329 In order to support generation and upload of profile, our vFW CBA model has enhanced **resource-assignment** workflow which contains additional step: **profile-upload**. It leverages dedicated functionality introduced in Guilin release that can be used to upload predefined profile or to generate and upload content of the profile with Velocity templating mechanism.
330
331 ::
332
333     "resource-assignment": {
334         "steps": {
335             "resource-assignment": {
336                 "description": "Resource Assign Workflow",
337                 "target": "resource-assignment",
338                 "activities": [
339                     {
340                         "call_operation": "ResourceResolutionComponent.process"
341                     }
342                 ],
343                 "on_success": [
344                     "profile-upload"
345                 ]
346             },
347             "profile-upload": {
348                 "description": "Generate and upload K8s Profile",
349                 "target": "k8s-profile-upload",
350                 "activities": [
351                     {
352                         "call_operation": "ComponentScriptExecutor.process"
353                     }
354                 ]
355             }
356         },
357
358 .. note:: In the Frankfurt release profile upload was implemented as a custom Kotlin script included into the CBA. It was responsible for upload of K8S profile into multicloud/k8s plugin. It is still a good example of  the integration of Kotlin scripting into the CBA. For those interested in this functionaliy we recommend to look into the `Frankfurt CBA Definition`_ and `Frankfurt CBA Script`_. Since Honolulu we introduce more advanced use of the Kotlin script for verification of the CNF status or custom resolution of complex parameters over Kotlin script - both can be found in the further part of the documentation.
359
360 In our example for vPKG helm package we may select *vfw-cnf-cds-vpkg-profile* profile that is included into CBA as a folder. Profile generation step uses Velocity templates processing embedded CDS functionality on its basis ssh port number (specified in the SO request as *vpg-management-port*).
361
362 ::
363
364     {
365         "name": "vpg-management-port",
366         "property": {
367             "description": "The number of node port for ssh service of vpg",
368             "type": "integer",
369             "default": "0"
370         },
371         "input-param": false,
372         "dictionary-name": "vpg-management-port",
373         "dictionary-source": "default",
374         "dependencies": []
375     }
376
377 *vpg-management-port* can be included directly into the helm template and such template will be included into vPKG helm package in time of its instantiation.
378
379 ::
380
381   apiVersion: v1
382   kind: Service
383   metadata:
384     name: {{ .Values.vpg_name_0 }}-ssh-access
385     labels:
386       vnf-name: {{ .Values.vnf_name }}
387       vf-module-name: {{ .Values.vpg_name_0 }}
388       release: {{ .Release.Name }}
389       chart: {{ .Chart.Name }}
390   spec:
391     type: NodePort
392     ports:
393       - port: 22
394         nodePort: ${vpg-management-port}
395     selector:
396       vf-module-name: {{ .Values.vpg_name_0 }}
397       release: {{ .Release.Name }}
398       chart: {{ .Chart.Name }}
399
400 .. warning:: The port value is of Integer type and CDS resolves it as an integer. If the resolved values are returned to SO during the resource resolution phase they are being passed to k8splugin back only as a strings. In consequence, Integer values are passed to the Instantiation API as a strings and then they have go be converted in the helm template to the integer. In order to avoid such conversion it is better to customize override values with Integers in the profile and to skip return of this parameters in the resource resolution phase (they should not be included in the .vtl files).
401
402 The mechanism of profile generation and upload requires specific node teamplate in the CBA definition. In our case, it comes with the declaration of two profiles: one static *vfw-cnf-cds-base-profile* in a form of an archive and the second complex *vfw-cnf-cds-vpkg-profile* in a form of a folder for processing and profile generation. Below is the example of the definition of node type for execution of the profile upload operation.
403
404 ::
405
406     "k8s-profile-upload": {
407         "type": "component-k8s-profile-upload",
408         "interfaces": {
409             "K8sProfileUploadComponent": {
410                 "operations": {
411                     "process": {
412                         "inputs": {
413                             "artifact-prefix-names": {
414                                 "get_input": "template-prefix"
415                             },
416                             "resource-assignment-map": {
417                                 "get_attribute": [
418                                     "resource-assignment",
419                                     "assignment-map"
420                                 ]
421                             }
422                         }
423                     }
424                 }
425             }
426         },
427         "artifacts": {
428             "vfw-cnf-cds-base-profile": {
429                 "type": "artifact-k8sprofile-content",
430                 "file": "Templates/k8s-profiles/vfw-cnf-cds-base-profile.tar.gz"
431             },
432             "vfw-cnf-cds-vpkg-profile": {
433                 "type": "artifact-k8sprofile-content",
434                 "file": "Templates/k8s-profiles/vfw-cnf-cds-vpkg-profile"
435             },
436             "vfw-cnf-cds-vpkg-profile-mapping": {
437                 "type": "artifact-mapping-resource",
438                 "file": "Templates/k8s-profiles/vfw-cnf-cds-vpkg-profile/ssh-service-mapping.json"
439             }
440         }
441     }
442
443 Artifact file determines a place of the static profile or the content of the complex profile. In the latter case we need a pair of profile folder and mapping file with a declaration of the parameters that CDS needs to resolve first, before the Velocity templating is applied to the .vtl files present in the profile content. After Velocity templating the .vtl extensions will be dropped from the file names. The embedded mechanism will include in the profile only files present in the profile MANIFEST file that needs to contain the list of final names of the files to be included into the profile. The figure below shows the idea of profile templating.
444
445 .. figure:: files/vFW_CNF_CDS/profile-templating.png
446    :align: center
447
448    K8s Profile Templating
449
450 SO requires for instantiation name of the profile in the parameter: *k8s-rb-profile-name*. The *component-k8s-profile-upload* that stands behind the profile uploading mechanism has input parameters that can be passed directly (checked in the first order) or can be taken from the *resource-assignment-map* parameter which can be a result of associated *component-resource-resolution* result, like in our case their values are resolved on vf-module level resource assignment. The *component-k8s-profile-upload* inputs are following:
451
452 - k8s-rb-definition-name - the name under which RB definition was created - **VF Module Model Invariant ID** in ONAP
453 - k8s-rb-definition-version - the version of created RB definition name - **VF Module Model Version ID**  in ONAP
454 - k8s-rb-profile-name - (mandatory) the name of the profile under which it will be created in k8s plugin. Other parameters are required only when profile must be uploaded because it does not exist yet
455 - k8s-rb-profile-source - the source of profile content - name of the artifact of the profile. If missing *k8s-rb-profile-name* is treated as a source
456 - k8s-rb-profile-namespace - the k8s namespace name associated with profile being created
457 - k8s-rb-profile-kubernetes-version - the version of the cluster on which application will be deployed - it may impact the helm templating process like selection of the api versions for resources.
458 - resource-assignment-map - result of the associated resource assignment step - it may deliver values of inputs if they are not specified directly
459 - artifact-prefix-names - (mandatory) the list of artifact prefixes like for resource-assigment step in the resource-assigment workflow or its subset
460
461 In the SO request user can pass parameter of name *k8s-rb-profile-name* which in our case may have value: *vfw-cnf-cds-base-profile*, *vfw-cnf-cds-vpkg-profile* or *default*. The *default* profile does not contain any content inside and allows instantiation of CNF without the need to define and upload any additional profiles. *vfw-cnf-cds-vpkg-profile* has been prepared to test instantiation of the second modified vFW CNF instance.
462
463 K8splugin allows to specify override parameters (similar to --set behavior of helm client) to instantiated resource bundles. This allows for providing dynamic parameters to instantiated resources without the need to create new profiles for this purpose. This mechanism should be used with *default* profile but may be used also with any custom profile.
464
465 The overall flow of helm overrides parameters processing is visible on following figure. When *rb definition* (helm package) is being instantiated for specified *rb profile* K8splugin combines override values from the helm package, *rb profile* and from the instantiation request - in the respective order. It means that the value from the instantiation request (SO request input or CDS resource assignement result) has a precedence over the value from the *rb profile* and value from the *rb profile* has a precedence over the helm package default override value. Similarly, profile can contain resource files that may extend or ammend the existing files for the original helm package content.
466
467 .. figure:: files/vFW_CNF_CDS/helm-overrides.png
468    :align: center
469
470    The overall flow of helm data processing
471
472 Both profile content (4) like the instantiation request values (5) can be generated during the resource assignment process according to its definition for CBA associated with helm package. CBA may generate i.e. names, IP addresses, ports and can use this information to produce the *rb-profile* (3) content. Finally, all three sources of override values, temnplates and additional resources files are merged together (6) by K8splugin in the order exaplained before.
473
474 .. figure:: files/vFW_CNF_CDS/helm-overrides-steps.png
475    :align: center
476
477    The steps of processing of helm data with help of CDS
478
479 Both profile content (4) like the instantiation request values (5) can be generated during the resource assignment process according to its definition for CBA associated with helm package. CBA may generate i.e. names, IP addresses, ports and can use this information to produce the *rb-profile* (3) content. Finally, all three sources of override values, temnplates and additional resources files are merged together (6) by K8splugin in the order exaplained before.
480
481 Beside the deployment of Helm application the CBA of vFW demonstrates also how to use deicated features for config-assign (7) and config-deploy (8) operations. In the use case, config-assign and config-deploy operations deal mainly with creation and instantiation of configuration template for k8s plugin. The configuration template has a form of Helm package. When k8s plugin instantiates configuration, it creates or may replace existing resources deployed on k8s cluster. In our case the configuration template is used to provide alternative way of upload of the additional ssh-service but it coud be used to modify configmap of vfw or vpkg vf-modules.
482
483 In order to provide configuration instantiation capability standard condfig-assign and config-deploy workflows have been changed into imperative workflows with first step responsible for collection of informatino for configuration templating and configuration instantiation. The source of data for this operations is AAI, MDSAL with data for vnf and vf-modules as config-assign and config-deploy does not receive dedicated input parameters from SO. In consequence both operations need to source from resource-assignent phase and data placed in the AAI and MDSAL.
484
485 vFW CNF config-assign workflow is following:
486
487 ::
488
489     "config-assign": {
490         "steps": {
491             "config-setup": {
492                 "description": "Gather necessary input for config template upload",
493                 "target": "config-setup-process",
494                 "activities": [
495                     {
496                         "call_operation": "ResourceResolutionComponent.process"
497                     }
498                 ],
499                 "on_success": [
500                     "config-template"
501                 ]
502             },
503             "config-template": {
504                 "description": "Generate and upload K8s config template",
505                 "target": "k8s-config-template",
506                 "activities": [
507                     {
508                         "call_operation": "K8sConfigTemplateComponent.process"
509                     }
510                 ]
511             }
512         },
513
514 vFW CNF config-deploy workflow is following:
515
516 ::
517
518     "config-deploy": {
519         "steps": {
520             "config-setup": {
521                 "description": "Gather necessary input for config init and status verification",
522                 "target": "config-setup-process",
523                 "activities": [
524                     {
525                         "call_operation": "ResourceResolutionComponent.process"
526                     }
527                 ],
528                 "on_success": [
529                     "config-apply"
530                 ]
531             },
532             "config-apply": {
533                 "description": "Activate K8s config template",
534                 "target": "k8s-config-apply",
535                 "activities": [
536                     {
537                         "call_operation": "K8sConfigTemplateComponent.process"
538                     }
539                 ],
540                 "on_success": [
541                     "status-verification-script"
542                 ]
543             },
544
545
546 In our example configuration template for vFW CNF is a helm package that contains the same resource that we can find in the vPKG *vfw-cnf-cds-vpkg-profile* profile - extra ssh service. This helm package contains Helm encapsulation for ssh-service and the values.yaml file with declaration of all the inputs that may parametrize the ssh-service. The configuration templating step leverages the *component-k8s-config-template* component that prepares the configuration template and uploads it to k8splugin. In consequence, it may be used later on for instatiation of the configuration.
547
548 In this use case we have two options with *ssh-service-config* and *ssh-service-config-customizable* as a source of the same configuration template. In consequence, or we take a complete template or we have have the templatefolder with the content of the helm package and CDS may perform dedicated resource resolution for it with templating of all the files with .vtl extensions. The process is very similar to the one describe for profile upload functionality.
549
550 ::
551
552     "k8s-config-template": {
553         "type": "component-k8s-config-template",
554         "interfaces": {
555             "K8sConfigTemplateComponent": {
556                 "operations": {
557                     "process": {
558                         "inputs": {
559                             "artifact-prefix-names": [
560                                 "helm_vpkg"
561                             ],
562                             "resource-assignment-map": {
563                                 "get_attribute": [
564                                     "config-setup-process",
565                                     "",
566                                     "assignment-map",
567                                     "config-deploy",
568                                     "config-deploy-setup"
569                                 ]
570                             }
571                         }
572                     }
573                 }
574             }
575         },
576         "artifacts": {
577             "ssh-service-config": {
578                 "type": "artifact-k8sconfig-content",
579                 "file": "Templates/k8s-configs/ssh-service.tar.gz"
580             },
581             "ssh-service-config-customizable": {
582                 "type": "artifact-k8sconfig-content",
583                 "file": "Templates/k8s-configs/ssh-service-config"
584             },
585             "ssh-service-config-customizable-mapping": {
586                 "type": "artifact-mapping-resource",
587                 "file": "Templates/k8s-configs/ssh-service-config/ssh-service-mapping.json"
588             }
589         }
590     }
591
592 The *component-k8s-config-template* that stands behind creation of configuration template has input parameters that can be passed directly (checked in the first order) or can be taken from the *resource-assignment-map* parameter which can be a result of associated *component-resource-resolution* result, like in vFW CNF use case their values are resolved on vf-module level dedicated for config-assign and config-deploy resource assignment step. The *component-k8s-config-template* inputs are following:
593
594 - k8s-rb-definition-name - the name under which RB definition was created - **VF Module Model Invariant ID** in ONAP
595 - k8s-rb-definition-version - the version of created RB definition name - **VF Module Model Version ID**  in ONAP
596 - k8s-rb-config-template-name - (mandatory) the name of the configuration template under which it will be created in k8s plugin. Other parameters are required only when configuration template must be uploaded because it does not exist yet
597 - k8s-rb-config-template-source - the source of config template content - name of the artifact of the configuration template. If missing *k8s-rb-config-template-name* is treated as a source
598 - resource-assignment-map - result of the associated resource assignment step - it may deliver values of inputs if they are not specified directly
599 - artifact-prefix-names - (mandatory) the list of artifact prefixes like for resource-assigment step in the resource-assigment workflow or its subset
600
601 In our case the *component-k8s-config-template* component receives all the inputs from the dedicated resource-assignment process  *config-setup* that is responsible for resolution of all the inputs for configuration templating. This process generates data for *helm_vpkg* prefix and such one is specified in the list of prefixes of the configuration template component. It means that configuration template will be prepared only for vPKG function.
602
603 ::
604
605     "k8s-config-apply": {
606         "type": "component-k8s-config-value",
607         "interfaces": {
608             "K8sConfigValueComponent": {
609                 "operations": {
610                     "process": {
611                         "inputs": {
612                             "artifact-prefix-names": [
613                                 "helm_vpkg"
614                             ],
615                             "k8s-config-operation-type": "create",
616                             "resource-assignment-map": {
617                                 "get_attribute": [
618                                     "config-setup-process",
619                                     "",
620                                     "assignment-map",
621                                     "config-deploy",
622                                     "config-deploy-setup"
623                                 ]
624                             }
625                         }
626                     }
627                 }
628             }
629         },
630         "artifacts": {
631             "ssh-service-default": {
632                 "type": "artifact-k8sconfig-content",
633                 "file": "Templates/k8s-configs/ssh-service-config/values.yaml"
634             },
635             "ssh-service-config": {
636                 "type": "artifact-k8sconfig-content",
637                 "file": "Templates/k8s-configs/ssh-service-values/values.yaml.vtl"
638             },
639             "ssh-service-config-mapping": {
640                 "type": "artifact-mapping-resource",
641                 "file": "Templates/k8s-configs/ssh-service-values/ssh-service-mapping.json"
642             }
643         }
644     }
645
646
647 The *component-k8s-config-value* that stands behind creation of configuration instance has input parameters that can be passed directly (checked in the first order) or can be taken from the *resource-assignment-map* parameter which can be a result of associated *component-resource-resolution* result, like in vFW CNF use case their values are resolved on vf-module level dedicated for config-assign and config-deploy resource assignment step. The *component-k8s-config-value* inputs are following:
648
649 - k8s-rb-config-name - (mandatory) the name of the configuration template under which it will be created in k8s plugin. Other parameters are required only when configuration template must be uploaded because it does not exist yet
650 - k8s-rb-config-template-name - (mandatory) the name of the configuration template under which it will be created in k8s plugin. Other parameters are required only when configuration template must be uploaded because it does not exist yet
651 - k8s-rb-config-value-source - the source of config template content - name of the artifact of the configuration template. If missing *k8s-rb-config-name* is treated as a source
652 - k8s-instance-id - (mandatory) the identifier of the rb instance for which the configuration should be applied
653 - k8s-config-operation-type - the type of the configuration operation to perform: create, update or delete. By default create operation is performed
654 - resource-assignment-map - result of the associated resource assignment step - it may deliver values of inputs if they are not specified directly
655 - artifact-prefix-names - (mandatory) the list of artifact prefixes like for resource-assigment step in the resource-assigment workflow or its subset
656
657 Like for the configuration template, the *component-k8s-config-value* component receives all the inputs from the dedicated resource-assignment process *config-setup* that is responsible for resolution of all the inputs for configuration. This process generates data for *helm_vpkg* prefix and such one is specified in the list of prefixes of the configuration values component. It means that configuration instance will be created only for vPKG function (component allows also update or delete of the configuration but in the vFW CNF case it is used only to create configuration instance).
658
659 Finally, `Data Dictionary`_ is also included into demo git directory, re-modeling and making changes into model utilizing CDS model time / runtime is easier as used DD is also known.
660
661 .. note:: CBA of vFW CNF use case is already enriched and VSP of vFW CNF has CBA included inside. In conequence, when VSP is being onboarded into SDC and service is being distributed, CBA is uploaded into CDS. Anyway, CDS contains in the starter dictionary all data dictionary values used in the use case and enrichment of CBA should work as well.
662
663 Instantiation Overview
664 ----------------------
665
666 .. note:: Since Guilin release use case is equipped with automated method **<AUTOMATED>** with python scripts to replace Postman method **<MANUAL>** used in Frankfurt. Nevertheless, Postman collection is good to understand the entire process. If a user selects to follow Postman collection, then automation scripts **must not** be used. **For the entire process use only scripts or only Postman collection**. Both options are described in the further steps of this instruction.
667
668 The figure below shows all the interactions that take place during vFW CNF instantiation. It's not describing flow of actions (ordered steps) but rather component dependencies.
669
670 .. figure:: files/vFW_CNF_CDS/Instantiation_topology.png
671    :align: center
672
673    vFW CNF CDS Use Case Runtime interactions.
674
675 PART 1 - ONAP Installation
676 ~~~~~~~~~~~~~~~~~~~~~~~~~~
677
678 1-1 Deployment components
679 .........................
680
681 In order to run the vFW_CNF_CDS use case, we need ONAP Honolulu Release (or later) with at least following components:
682
683 =======================================================   ===========
684 ONAP Component name                                       Describtion
685 -------------------------------------------------------   -----------
686 AAI                                                       Required for Inventory Cloud Owner, Customer, Owning Entity, Service, Generic VNF, VF Module
687 SDC                                                       VSP, VF and Service Modeling of the CNF
688 DMAAP                                                     Distribution of the onboarding package including CBA to all ONAP components
689 SO                                                        Required for Macro Orchestration using the generic building blocks
690 CDS                                                       Resolution of cloud parameters including Helm override parameters for the CNF. Creation of the multicloud/k8s profile for CNF instantion. Creation of configuration template and its instantiation
691 SDNC (needs to include netbox and Naming Generation mS)   Provides GENERIC-RESOURCE-API for cloud Instantiation orchestration via CDS.
692 Policy                                                    Used to Store Naming Policy
693 AAF                                                       Used for Authentication and Authorization of requests
694 Portal                                                    Required to access SDC.
695 MSB                                                       Exposes multicloud interfaces used by SO.
696 Multicloud                                                K8S plugin part used to pass SO instantiation requests to external Kubernetes cloud region.
697 Contrib                                                   Chart containing multiple external components. Out of those, we only use Netbox utility in this use-case for IPAM
698 Robot                                                     Optional. Can be used for running automated tasks, like provisioning cloud customer, cloud region, service subscription, etc ..
699 Shared Cassandra DB                                       Used as a shared storage for ONAP components that rely on Cassandra DB, like AAI
700 Shared Maria DB                                           Used as a shared storage for ONAP components that rely on Maria DB, like SDNC, and SO
701 =======================================================   ===========
702
703 1-2 Deployment
704 ..............
705
706 In order to deploy such an instance, follow the `ONAP Deployment Guide`_
707
708 As we can see from the guide, we can use an override file that helps us customize our ONAP deployment, without modifying the OOM Folder, so you can download this override file here, that includes the necessary components mentioned above.
709
710 **override.yaml** file where enabled: true is set for each component needed in demo (by default all components are disabled).
711
712 ::
713
714   aai:
715     enabled: true
716   aaf:
717     enabled: true
718   cassandra:
719     enabled: true
720   cds:
721     enabled: true
722   contrib:
723     enabled: true
724   dmaap:
725     enabled: true
726   mariadb-galera:
727     enabled: true
728   msb:
729     enabled: true
730   multicloud:
731     enabled: true
732   policy:
733     enabled: true
734   portal:
735     enabled: true
736   robot:
737     enabled: true
738   sdc:
739     enabled: true
740   sdnc:
741     enabled: true
742   so:
743     enabled: true
744
745 Then deploy ONAP with Helm with your override file.
746
747 ::
748
749     helm deploy onap local/onap --namespace onap -f ~/override.yaml
750
751 In case redeployment needed `Helm Healer`_ could be a faster and convenient way to redeploy.
752
753 ::
754
755     helm-healer.sh -n onap -f ~/override.yaml -s /dockerdata-nfs --delete-all
756
757 Or redeploy (clean re-deploy also data removed) just wanted components (Helm releases), cds in this example.
758
759 ::
760
761     helm-healer.sh -f ~/override.yaml -s /dockerdata-nfs/ -n onap -c onap-cds
762
763 There are many instructions in ONAP wiki how to follow your deployment status and does it succeeded or not, mostly using Robot Health checks. One way we used is to skip the outermost Robot wrapper and use directly ete-k8s.sh to able to select checked components easily. Script is found from OOM git repository *oom/kubernetes/robot/ete-k8s.sh*.
764
765 ::
766
767     {
768     failed=
769     for comp in {aaf,aai,dmaap,msb,multicloud,policy,portal,sdc,sdnc,so}; do
770         if ! ./ete-k8s.sh onap health-$comp; then
771             failed=$failed,$comp
772         fi
773     done
774     if [ -n "$failed" ]; then
775         echo "These components failed: $failed"
776         false
777     else
778         echo "Healthcheck successful"
779     fi
780     }
781
782 And check status of pods, deployments, jobs etc.
783
784 ::
785
786     kubectl -n onap get pods | grep -vie 'completed' -e 'running'
787     kubectl -n onap get deploy,sts,jobs
788
789
790 1-3 Post Deployment
791 ...................
792
793 After completing the first part above, we should have a functional ONAP deployment for the Honolulu Release.
794
795 We will need to apply a few modifications to the deployed ONAP Honolulu instance in order to run the use case.
796
797 Retrieving logins and passwords of ONAP components
798 ++++++++++++++++++++++++++++++++++++++++++++++++++
799
800 Since Frankfurt release hardcoded passwords were mostly removed and it is possible to configure passwords of ONAP components in time of their installation. In order to retrieve these passwords with associated logins it is required to get them with kubectl. Below is the procedure on mariadb-galera DB component example.
801
802 ::
803
804     kubectl get secret `kubectl get secrets | grep mariadb-galera-db-root-password | awk '{print $1}'` -o jsonpath="{.data.login}" | base64 --decode
805     kubectl get secret `kubectl get secrets | grep mariadb-galera-db-root-password | awk '{print $1}'` -o jsonpath="{.data.password}" | base64 --decode
806
807 In this case login is empty as the secret is dedicated to root user.
808
809
810 Postman collection setup
811 ++++++++++++++++++++++++
812
813 In this demo we have on purpose created all manual ONAP preparation steps (which in real life are automated) by using Postman so it will be clear what exactly is needed. Some of the steps like AAI population is automated by Robot scripts in other ONAP demos (**./demo-k8s.sh onap init**) and Robot script could be used for many parts also in this demo.
814
815 Postman collection is used also to trigger instantiation using SO APIs.
816
817 Following steps are needed to setup Postman:
818
819 - Import this Postman collection zip
820
821   :download:`Postman collection <files/vFW_CNF_CDS/postman.zip>`
822
823 - Extract the zip and import Postman collection into Postman. Environment file is provided for reference, it's better to create own environment on your own providing variables as listed in next chapter.
824     - `vFW_CNF_CDS.postman_collection.json`
825     - `vFW_CNF_CDS.postman_environment.json`
826
827 - For use case debugging purposes to get Kubernetes cluster external access to SO CatalogDB (GET operations only), modify SO CatalogDB service to NodePort instead of ClusterIP. You may also create separate own NodePort if you wish, but here we have just edited directly the service with kubectl.
828
829 ::
830
831     kubectl -n onap edit svc so-catalog-db-adapter
832          - .spec.type: ClusterIP
833          + .spec.type: NodePort
834          + .spec.ports[0].nodePort: 30120
835
836 .. note::  The port number 30120 is used in included Postman collection
837
838 - You may also want to inspect after SDC distribution if CBA has been correctly delivered to CDS. In order to do it, there are created relevant calls later described in doc, however CDS since Frankfurt doesn't expose blueprints-processor's service as NodePort. This is OPTIONAL but if you'd like to use these calls later, you need to expose service in similar way as so-catalog-db-adapter above:
839
840 ::
841
842     kubectl edit -n onap svc cds-blueprints-processor-http
843           - .spec.type: ClusterIP
844           + .spec.type: NodePort
845           + .spec.ports[0].nodePort: 30499
846
847 .. note::  The port number 30499 is used in included Postman collection
848
849 **Postman variables:**
850
851 Most of the Postman variables are automated by Postman scripts and environment file provided, but there are few mandatory variables to fill by user.
852
853 =====================  ===================
854 Variable               Description
855 ---------------------  -------------------
856 k8s                    ONAP Kubernetes host
857 sdnc_port              port of sdnc service for accessing MDSAL
858 service-name           name of service as defined in SDC
859 service-version        version of service defined in SDC (if service wasn't updated, it should be set to "1.0")
860 service-instance-name  name of instantiated service (if ending with -{num}, will be autoincremented for each instantiation request)
861 =====================  ===================
862
863 You can get the sdnc_port value with
864
865 ::
866
867     kubectl -n onap get svc sdnc -o json | jq '.spec.ports[]|select(.port==8282).nodePort'
868
869 Automation Environment Setup
870 ............................
871
872 Whole content of this use case is stored into single git repository and it contains both the required onboarding information as well as automation scripts for onboarding and instantiation of the use case.
873
874 ::
875
876   git clone --single-branch --branch honolulu "https://gerrit.onap.org/r/demo"
877   cd demo/heat/vFW_CNF_CDS/templates
878
879 In order to prepare environment for onboarding and instantiation of the use case make sure you have *git*, *make*, *helm* and *pipenv* applications installed.
880
881 The automation scripts are based on `Python SDK`_ and are adopted to automate process of service onboarding, instantiation, deletion and cloud region registration. To configure them for further use:
882
883 ::
884
885   cd demo/heat/vFW_CNF_CDS/automation
886
887 1. Install required packages with
888 ::
889
890     pipenv pipenv install
891
892 2. Run virtual python environment
893 ::
894
895     pipenv shell --fancy
896
897 3. Add kubeconfig files, one for ONAP cluster, and one for k8s cluster that will host vFW
898
899 .. note:: Both files can be configured after creation of k8s cluster for vFW instance `2-1 Installation of Managed Kubernetes`_. Make sure that they have configured external IP address properly. If any cluster uses self signed certificates set also *insecure-skip-tls-verify* flag in the config file.
900
901 - artifacts/cluster_kubeconfig - IP address must be reachable by ONAP pods, especially *mutlicloud-k8s* pod
902
903 - artifacts/onap_kubeconfig - IP address must be reachable by automation scripts
904
905 4. Modify config.py file
906
907 - NATIVE - when enabled **Native Helm** path will be used, otherwise **Dummy Heat** path will be used
908 - CLOUD_REGION - name of your k8s cluster from ONAP perspective
909 - GLOBAL_CUSTOMER_ID - identifier of customer in ONAP
910 - VENDOR - name of the Vendor in ONAP
911 - SERVICENAME - **Name of your service model in SDC**
912 - CUSTOMER_RESOURCE_DEFINITIONS - add list of CRDs to be installed on non KUD k8s cluster - should be used ony to use some non-KUD cluster like i.e. ONAP one to test instantiation of Helm package. For KUD should be empty list
913
914 .. note:: For automation script it is necessary to modify only NATIVE and SERVICENAME constants. Other constants may be modified if needed.
915
916 AAI
917 ...
918
919 Some basic entries are needed in ONAP AAI. These entries are needed ones per onap installation and do not need to be repeated when running multiple demos based on same definitions.
920
921 Create all these entries into AAI in this order. Postman collection provided in this demo can be used for creating each entry.
922
923 **<MANUAL>**
924 ::
925
926     Postman -> Initial ONAP setup -> Create
927
928 - Create Customer
929 - Create Owning-entity
930 - Create Platform
931 - Create Project
932 - Create Line Of Business
933
934 Corresponding GET operations in "Check" folder in Postman can be used to verify entries created. Postman collection also includes some code that tests/verifies some basic issues e.g. gives error if entry already exists.
935
936 **<AUTOMATED>**
937
938 This step is performed jointly with onboarding step `3-1 Onboarding`_
939
940 Naming Policy
941 +++++++++++++
942
943 Naming policy is needed to generate unique names for all instance time resources that are wanted to be modeled in the way naming policy is used. Those are normally VNF, VNFC and VF-module names, network names etc. Naming is general ONAP feature and not limited to this use case.
944
945 This usecase leverages default ONAP naming policy - "SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP".
946 To check that the naming policy is created and pushed OK, we can run the command below from inside any ONAP pod.
947
948 ::
949
950   curl --silent -k --user 'healthcheck:zb!XztG34' -X GET "https://policy-api:6969/policy/api/v1/policytypes/onap.policies.Naming/versions/1.0.0/policies/SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP/versions/1.0.0"
951
952 .. note:: Please change credentials respectively to your installation. The required credentials can be retrieved with instruction `Retrieving logins and passwords of ONAP components`_
953
954 PART 2 - Installation of managed Kubernetes cluster
955 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
956
957 In this demo the target cloud region is a Kubernetes cluster of your choice basically just like with Openstack. ONAP platform is a bit too much hard wired to Openstack and it's visible in many demos.
958
959 2-1 Installation of Managed Kubernetes
960 ......................................
961
962 In this demo we use Kubernetes deployment used by ONAP multicloud/k8s team to test their plugin features see `KUD github`_. There's also some outdated instructions in ONAP wiki `KUD in Wiki`_.
963
964 KUD deployment is fully automated and also used in ONAP's CI/CD to automatically verify all `Multicloud k8s gerrit`_ commits (see `KUD Jenkins ci/cd verification`_) and that's quite good (and rare) level of automated integration testing in ONAP. KUD deployemnt is used as it's installation is automated and it also includes bunch of Kubernetes plugins used to tests various k8s plugin features. In addition to deployement, KUD repository also contains test scripts to automatically test multicloud/k8s plugin features. Those scripts are run in CI/CD.
965
966 See `KUD subproject in github`_ for a list of additional plugins this Kubernetes deployment has. In this demo the tested CNF is dependent on following plugins:
967
968 - ovn4nfv
969 - Multus
970 - Virtlet
971
972 Follow instructions in `KUD github`_ and install target Kubernetes cluster in your favorite machine(s), simplest being just one machine. Your cluster nodes(s) needs to be accessible from ONAP Kuberenetes nodes. Make sure your installed *pip* is of **version < 21.0**. Version 21 do not support python 2.7 that is used in *aio.sh* script. Also to avoid performance problems of your k8s cluster make sure you install only necessary plugins and before running *aio.sh* script execute following command
973 ::
974
975     export KUD_ADDONS="virtlet ovn4nfv"
976
977 2-2 Cloud Registration
978 ......................
979
980 Managed Kubernetes cluster is registered here into ONAP as one cloud region. This obviously is done just one time for this particular cloud. Cloud registration information is kept in AAI.
981
982 **<MANUAL>**
983
984 Postman collection have folder/entry for each step. Execute in this order.
985 ::
986
987     Postman -> K8s Cloud Region Registration -> Create
988
989 - Create Complex
990 - Create Cloud Region
991 - Create Complex-Cloud Region Relationship
992 - Create Service
993 - Create Service Subscription
994 - Create Cloud Tenant
995 - Create Availability Zone
996 - Upload Connectivity Info
997
998 .. note:: For "Upload Connectivity Info" call you need to provide kubeconfig file of existing KUD cluster. You can find that kubeconfig on deployed KUD in the directory `~/.kube/config` and this file can be easily copied e.g. via SCP. Please ensure that kubeconfig contains external IP of K8s cluster in kubeconfig and correct it, if it's not.
999
1000 SO database needs to be (manually) modified for SO to know that this particular cloud region is to be handled by multicloud. Values we insert needs to obviously match to the ones we populated into AAI.
1001
1002 .. note:: Please change credentials respectively to your installation. The required credentials can be retrieved with instruction `Retrieving logins and passwords of ONAP components`_
1003
1004 ::
1005
1006     kubectl -n onap exec onap-mariadb-galera-0 -it -- mysql -uroot -psecretpassword -D catalogdb
1007         select * from cloud_sites;
1008         insert into cloud_sites(ID, REGION_ID, IDENTITY_SERVICE_ID, CLOUD_VERSION, CLLI, ORCHESTRATOR) values("k8sregionfour", "k8sregionfour", "DEFAULT_KEYSTONE", "2.5", "clli2", "multicloud");
1009         select * from cloud_sites;
1010         exit
1011
1012 .. note:: The configuration of the new k8s cloud site is documented also here `K8s cloud site config`_
1013
1014 **<AUTOMATED>**
1015
1016 Please copy the kubeconfig file of existing KUD cluster to automation/artifacts/cluster_kubeconfig location `Automation Environment Setup`_ - step **3**. You can find that kubeconfig on deployed KUD in the directory `~/.kube/config` and this file can be easily copied e.g. via SCP. Please ensure that kubeconfig contains external IP of K8s cluster in kubeconfig and correct it, if it's not.
1017
1018 ::
1019
1020     python create_k8s_region.py
1021
1022 PART 3 - Execution of the Use Case
1023 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1024
1025 This part contains all the steps to run the use case by using ONAP GUIs, Postman or Python automation scripts.
1026
1027 Following pictures describe the overall sequential flow of the use case in two scenarios: **Dummy Heat** path (with OpenStack adapter) and **Native Helm** path (with CNF Adapter)
1028
1029 Dummy Heat CNF Orchestration
1030 ............................
1031
1032 This orchestration method stands on the grounds of Heat template orchestration mechanisms. In SDC onboarding package needs to contains simple Heat templates that are associated with additional Cloud artifacts. SDC distributes Heat templates to SO and Helm packages to K8sPlugin directly. SO orchestrates the Heat templates without any knowledge about their existence, however the OpenStack adater in SO understands k8s region type for which communication over MSB/Mutlicloud is provided - it handles interaction with K8sPlugin for CNF instantiation.
1033
1034 .. figure:: files/vFW_CNF_CDS/Dummy_Heat_Flow.png
1035    :align: center
1036
1037    vFW CNF CDS Use Case sequence flow for *Dummy Heat* (Frankfurt) path.
1038
1039 Native Helm CNF Orchestration
1040 .............................
1041
1042 Introduced in the Guilin release CNF orchestration method brings native distribution of Helm packages from SDC and native orchestration of CNFs (Helm packages) with SO. SO leverages CNF adapter to interact with K8sPlugin that takes resposnibility for the communication with k8s clusters. Heat templates are not required in the SDC onboarding package and thanks to the fact that SO knows about Helm package orchestration future synchronization of data between k8s clusters and AAI is possible.
1043
1044 .. figure:: files/vFW_CNF_CDS/Native_Helm_Flow.png
1045    :align: center
1046
1047    vFW CNF CDS Use Case sequence flow for *Native Helm* (Guilin+) path.
1048
1049 .. warning:: K8sPlugin supports only Helm packages that can be validated by Helm 2.14 application. It means that only Chart with apiVersion: v1 or v2 property but without Helm 3 specific features can be instantiated by ONAP. Also the latest features of Helm 2, beyond Helm version 2.14 are not supported currently. Istanbul release will bring native support of Helm 3 packages and also latests features of Helm 2 package format. 
1050
1051 3-1 Onboarding
1052 ..............
1053
1054 .. note:: Make sure you have performed `Automation Environment Setup`_ steps before following actions here.
1055
1056 Creating Onboarding Package
1057 +++++++++++++++++++++++++++
1058
1059 Content of the onboarding package can be created with provided Makefile in the *template* folder.
1060
1061 Complete content of both Onboarding Packages for **Dummy Heat**  and **Native Helm** is packaged to the following VSP onboarding package files:
1062
1063 - **Dummy Heat** path: **vfw_k8s_demo.zip**
1064
1065 - **Native Helm** path: **native_vfw_k8s_demo.zip**
1066
1067 .. note::  Procedure requires *make* and *helm* applications installed
1068
1069 ::
1070
1071   git clone --single-branch --branch honolulu "https://gerrit.onap.org/r/demo"
1072   cd demo/heat/vFW_CNF_CDS/templates
1073   make
1074
1075 The result of make operation execution is following:
1076 ::
1077
1078     make clean
1079     make[1]: Entering directory '/mnt/c/Users/advnet/Desktop/SOURCES/demo/heat/vFW_CNF_CDS/templates'
1080     rm -rf package_dummy/
1081     rm -rf package_native/
1082     rm -rf cba_dummy
1083     rm -f vfw_k8s_demo.zip
1084     rm -f native_vfw_k8s_demo.zip
1085     make[1]: Leaving directory '/mnt/c/Users/advnet/Desktop/SOURCES/demo/heat/vFW_CNF_CDS/templates'
1086     make all
1087     make[1]: Entering directory '/mnt/c/Users/advnet/Desktop/SOURCES/demo/heat/vFW_CNF_CDS/templates'
1088     mkdir package_dummy/
1089     mkdir package_native/
1090     make -C helm
1091     make[2]: Entering directory '/mnt/c/Users/advnet/Desktop/SOURCES/demo/heat/vFW_CNF_CDS/templates/helm'
1092     rm -f base_template-*.tgz
1093     rm -f helm_base_template.tgz
1094     rm -f base_template_cloudtech_k8s_charts.tgz
1095     helm package base_template
1096     Successfully packaged chart and saved it to: /mnt/c/Users/advnet/Desktop/SOURCES/demo/heat/vFW_CNF_CDS/templates/helm/base_template-0.2.0.tgz
1097     mv base_template-*.tgz helm_base_template.tgz
1098     cp helm_base_template.tgz base_template_cloudtech_k8s_charts.tgz
1099     rm -f vpkg-*.tgz
1100     rm -f helm_vpkg.tgz
1101     rm -f vpkg_cloudtech_k8s_charts.tgz
1102     helm package vpkg
1103     Successfully packaged chart and saved it to: /mnt/c/Users/advnet/Desktop/SOURCES/demo/heat/vFW_CNF_CDS/templates/helm/vpkg-0.2.0.tgz
1104     mv vpkg-*.tgz helm_vpkg.tgz
1105     cp helm_vpkg.tgz vpkg_cloudtech_k8s_charts.tgz
1106     rm -f vfw-*.tgz
1107     rm -f helm_vfw.tgz
1108     rm -f vfw_cloudtech_k8s_charts.tgz
1109     helm package vfw
1110     Successfully packaged chart and saved it to: /mnt/c/Users/advnet/Desktop/SOURCES/demo/heat/vFW_CNF_CDS/templates/helm/vfw-0.2.0.tgz
1111     mv vfw-*.tgz helm_vfw.tgz
1112     cp helm_vfw.tgz vfw_cloudtech_k8s_charts.tgz
1113     rm -f vsn-*.tgz
1114     rm -f helm_vsn.tgz
1115     rm -f vsn_cloudtech_k8s_charts.tgz
1116     helm package vsn
1117     Successfully packaged chart and saved it to: /mnt/c/Users/advnet/Desktop/SOURCES/demo/heat/vFW_CNF_CDS/templates/helm/vsn-0.2.0.tgz
1118     mv vsn-*.tgz helm_vsn.tgz
1119     cp helm_vsn.tgz vsn_cloudtech_k8s_charts.tgz
1120     make[2]: Leaving directory '/mnt/c/Users/advnet/Desktop/SOURCES/demo/heat/vFW_CNF_CDS/templates/helm'
1121     mv helm/helm_*.tgz package_native/
1122     mv helm/*.tgz package_dummy/
1123     cp base_dummy/* package_dummy/
1124     cp base_native/* package_native/
1125     cp -r cba cba_dummy
1126     sed -i 's/"helm_/"/g' cba_dummy/Definitions/vFW_CNF_CDS.json
1127     cd cba_dummy/ && zip -r CBA.zip . -x pom.xml .idea/\* target/\*
1128     adding: Definitions/ (stored 0%)
1129     adding: Definitions/artifact_types.json (deflated 69%)
1130     adding: Definitions/data_types.json (deflated 88%)
1131     adding: Definitions/node_types.json (deflated 90%)
1132     adding: Definitions/policy_types.json (stored 0%)
1133     adding: Definitions/relationship_types.json (stored 0%)
1134     adding: Definitions/resources_definition_types.json (deflated 94%)
1135     adding: Definitions/vFW_CNF_CDS.json (deflated 87%)
1136     adding: Scripts/ (stored 0%)
1137     adding: Scripts/kotlin/ (stored 0%)
1138     adding: Scripts/kotlin/README.md (stored 0%)
1139     adding: Templates/ (stored 0%)
1140     adding: Templates/base_template-mapping.json (deflated 89%)
1141     adding: Templates/base_template-template.vtl (deflated 87%)
1142     adding: Templates/k8s-profiles/ (stored 0%)
1143     adding: Templates/k8s-profiles/vfw-cnf-cds-base-profile.tar.gz (stored 0%)
1144     adding: Templates/k8s-profiles/vfw-cnf-cds-vpkg-profile/ (stored 0%)
1145     adding: Templates/k8s-profiles/vfw-cnf-cds-vpkg-profile/manifest.yaml (deflated 35%)
1146     adding: Templates/k8s-profiles/vfw-cnf-cds-vpkg-profile/override_values.yaml (stored 0%)
1147     adding: Templates/k8s-profiles/vfw-cnf-cds-vpkg-profile/ssh-service-mapping.json (deflated 51%)
1148     adding: Templates/k8s-profiles/vfw-cnf-cds-vpkg-profile/ssh-service-template.yaml.vtl (deflated 56%)
1149     adding: Templates/nf-params-mapping.json (deflated 88%)
1150     adding: Templates/nf-params-template.vtl (deflated 44%)
1151     adding: Templates/vfw-mapping.json (deflated 89%)
1152     adding: Templates/vfw-template.vtl (deflated 87%)
1153     adding: Templates/vnf-mapping.json (deflated 89%)
1154     adding: Templates/vnf-template.vtl (deflated 93%)
1155     adding: Templates/vpkg-mapping.json (deflated 89%)
1156     adding: Templates/vpkg-template.vtl (deflated 87%)
1157     adding: Templates/vsn-mapping.json (deflated 89%)
1158     adding: Templates/vsn-template.vtl (deflated 87%)
1159     adding: TOSCA-Metadata/ (stored 0%)
1160     adding: TOSCA-Metadata/TOSCA.meta (deflated 37%)
1161     cd cba/ && zip -r CBA.zip . -x pom.xml .idea/\* target/\*
1162     adding: Definitions/ (stored 0%)
1163     adding: Definitions/artifact_types.json (deflated 69%)
1164     adding: Definitions/data_types.json (deflated 88%)
1165     adding: Definitions/node_types.json (deflated 90%)
1166     adding: Definitions/policy_types.json (stored 0%)
1167     adding: Definitions/relationship_types.json (stored 0%)
1168     adding: Definitions/resources_definition_types.json (deflated 94%)
1169     adding: Definitions/vFW_CNF_CDS.json (deflated 87%)
1170     adding: Scripts/ (stored 0%)
1171     adding: Scripts/kotlin/ (stored 0%)
1172     adding: Scripts/kotlin/README.md (stored 0%)
1173     adding: Templates/ (stored 0%)
1174     adding: Templates/base_template-mapping.json (deflated 89%)
1175     adding: Templates/base_template-template.vtl (deflated 87%)
1176     adding: Templates/k8s-profiles/ (stored 0%)
1177     adding: Templates/k8s-profiles/vfw-cnf-cds-base-profile.tar.gz (stored 0%)
1178     adding: Templates/k8s-profiles/vfw-cnf-cds-vpkg-profile/ (stored 0%)
1179     adding: Templates/k8s-profiles/vfw-cnf-cds-vpkg-profile/manifest.yaml (deflated 35%)
1180     adding: Templates/k8s-profiles/vfw-cnf-cds-vpkg-profile/override_values.yaml (stored 0%)
1181     adding: Templates/k8s-profiles/vfw-cnf-cds-vpkg-profile/ssh-service-mapping.json (deflated 51%)
1182     adding: Templates/k8s-profiles/vfw-cnf-cds-vpkg-profile/ssh-service-template.yaml.vtl (deflated 56%)
1183     adding: Templates/nf-params-mapping.json (deflated 88%)
1184     adding: Templates/nf-params-template.vtl (deflated 44%)
1185     adding: Templates/vfw-mapping.json (deflated 89%)
1186     adding: Templates/vfw-template.vtl (deflated 87%)
1187     adding: Templates/vnf-mapping.json (deflated 89%)
1188     adding: Templates/vnf-template.vtl (deflated 93%)
1189     adding: Templates/vpkg-mapping.json (deflated 89%)
1190     adding: Templates/vpkg-template.vtl (deflated 87%)
1191     adding: Templates/vsn-mapping.json (deflated 89%)
1192     adding: Templates/vsn-template.vtl (deflated 87%)
1193     adding: TOSCA-Metadata/ (stored 0%)
1194     adding: TOSCA-Metadata/TOSCA.meta (deflated 37%)
1195     mv cba/CBA.zip package_native/
1196     mv cba_dummy/CBA.zip package_dummy/
1197     cd package_dummy/ && zip -r vfw_k8s_demo.zip .
1198     adding: base_template.env (deflated 22%)
1199     adding: base_template.yaml (deflated 59%)
1200     adding: base_template_cloudtech_k8s_charts.tgz (stored 0%)
1201     adding: CBA.zip (stored 0%)
1202     adding: MANIFEST.json (deflated 84%)
1203     adding: vfw.env (deflated 23%)
1204     adding: vfw.yaml (deflated 60%)
1205     adding: vfw_cloudtech_k8s_charts.tgz (stored 0%)
1206     adding: vpkg.env (deflated 13%)
1207     adding: vpkg.yaml (deflated 59%)
1208     adding: vpkg_cloudtech_k8s_charts.tgz (stored 0%)
1209     adding: vsn.env (deflated 15%)
1210     adding: vsn.yaml (deflated 59%)
1211     adding: vsn_cloudtech_k8s_charts.tgz (stored 0%)
1212     cd package_native/ && zip -r native_vfw_k8s_demo.zip .
1213     adding: CBA.zip (stored 0%)
1214     adding: helm_base_template.tgz (stored 0%)
1215     adding: helm_vfw.tgz (stored 0%)
1216     adding: helm_vpkg.tgz (stored 0%)
1217     adding: helm_vsn.tgz (stored 0%)
1218     adding: MANIFEST.json (deflated 71%)
1219     mv package_dummy/vfw_k8s_demo.zip .
1220     mv package_native/native_vfw_k8s_demo.zip .
1221   $
1222
1223 Import this package into SDC and follow onboarding steps.
1224
1225 Service Creation with SDC
1226 +++++++++++++++++++++++++
1227
1228 **<MANUAL>**
1229
1230 Service Creation in SDC is composed of the same steps that are performed by most other use-cases. For reference, you can relate to `vLB use-case`_
1231
1232 Onboard VSP
1233
1234 - Remember during VSP onboard to choose "Network Package" Onboarding procedure
1235
1236 Create VF and Service
1237 Service -> Properties Assignment -> Choose VF (at right box):
1238
1239 - sdnc_artifact_name - vnf
1240 - sdnc_model_name - vFW_CNF_CDS
1241 - sdnc_model_version - 8.0.0
1242 - skip_post_instantiation_configuration - True
1243
1244 .. note:: Since Honolulu skip_post_instantiation_configuration flag can be set to *False* if we want to run config-assign/config-deploy operations.
1245
1246 **<AUTOMATED>**
1247 .. note:: The onboarding packages for **Dummy Heat** and **Native Helm** path contain different CBA packages but with the same version and number. In consequence, when one VSP is distributed it replaces the CBA package of the other one and you can instantiate service only for the vFW CNF service service model distributed as a last one. If you want to instantiate vFW CNF service, make sure you have fresh distribution of vFW CNF service model.
1248
1249 ::
1250
1251     python onboarding.py
1252
1253 Distribution Of Service
1254 +++++++++++++++++++++++
1255
1256 **<MANUAL>**
1257
1258 Distribute service.
1259
1260 Verify in SDC UI if distribution was successful. In case of any errors (sometimes SO fails on accepting CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT), try redistribution. You can also verify distribution for few components manually:
1261
1262 - SDC:
1263
1264     SDC Catalog database should have our service now defined.
1265
1266     ::
1267
1268         Postman -> LCM -> [SDC] Catalog Service
1269
1270     ::
1271
1272         {
1273             "uuid": "64dd38f3-2307-4e0a-bc98-5c2cbfb260b6",
1274             "invariantUUID": "cd1a5c2d-2d4e-4d62-ac10-a5fe05e32a22",
1275             "name": "vfw_cnf_cds_svc",
1276             "version": "1.0",
1277             "toscaModelURL": "/sdc/v1/catalog/services/64dd38f3-2307-4e0a-bc98-5c2cbfb260b6/toscaModel",
1278             "category": "Network L4+",
1279             "lifecycleState": "CERTIFIED",
1280             "lastUpdaterUserId": "cs0008",
1281             "distributionStatus": "DISTRIBUTED"
1282         }
1283
1284     Listing should contain entry with our service name **vfw_cnf_cds_svc**.
1285
1286 .. note:: Note that it's an example name, it depends on how your model is named during Service design in SDC and must be kept in sync with Postman variables.
1287
1288 - SO:
1289
1290     SO Catalog database should have our service NFs defined now.
1291
1292     ::
1293
1294         Postman -> LCM -> [SO] Catalog DB Service xNFs
1295
1296     ::
1297
1298         {
1299             "serviceVnfs": [
1300                 {
1301                     "modelInfo": {
1302                         "modelName": "vfw_cnf_cds_vsp",
1303                         "modelUuid": "70edaca8-8c79-468a-aa76-8224cfe686d0",
1304                         "modelInvariantUuid": "7901fc89-a94d-434a-8454-1e27b99dc0e2",
1305                         "modelVersion": "1.0",
1306                         "modelCustomizationUuid": "86dc8af4-aa17-4fc7-9b20-f12160d99718",
1307                         "modelInstanceName": "vfw_cnf_cds_vsp 0"
1308                     },
1309                     "toscaNodeType": "org.openecomp.resource.vf.VfwCnfCdsVsp",
1310                     "nfFunction": null,
1311                     "nfType": null,
1312                     "nfRole": null,
1313                     "nfNamingCode": null,
1314                     "multiStageDesign": "false",
1315                     "vnfcInstGroupOrder": null,
1316                     "resourceInput": "TBD",
1317                     "vfModules": [
1318                         {
1319                             "modelInfo": {
1320                                 "modelName": "VfwCnfCdsVsp..base_template..module-0",
1321                                 "modelUuid": "274f4bc9-7679-4767-b34d-1df51cdf2496",
1322                                 "modelInvariantUuid": "52842255-b7be-4a1c-ab3b-2bd3bd4a5423",
1323                                 "modelVersion": "1",
1324                                 "modelCustomizationUuid": "b27fad11-44da-4840-9256-7ed8a32fbe3e"
1325                             },
1326                             "isBase": true,
1327                             "vfModuleLabel": "base_template",
1328                             "initialCount": 1,
1329                             "hasVolumeGroup": false
1330                         },
1331                         {
1332                             "modelInfo": {
1333                                 "modelName": "VfwCnfCdsVsp..vsn..module-1",
1334                                 "modelUuid": "0cbf558f-5a96-4555-b476-7df8163521aa",
1335                                 "modelInvariantUuid": "36f25e1b-199b-4de2-b656-c870d341cf0e",
1336                                 "modelVersion": "1",
1337                                 "modelCustomizationUuid": "4cac0584-c0d6-42a7-bdb3-29162792e07f"
1338                             },
1339                             "isBase": false,
1340                             "vfModuleLabel": "vsn",
1341                             "initialCount": 0,
1342                             "hasVolumeGroup": false
1343                         },
1344                         {
1345                             "modelInfo": {
1346                                 "modelName": "VfwCnfCdsVsp..vpkg..module-2",
1347                                 "modelUuid": "011b5f61-6524-4789-bd9a-44cfbf321463",
1348                                 "modelInvariantUuid": "4e2b9975-5214-48b8-861a-5701c09eedfa",
1349                                 "modelVersion": "1",
1350                                 "modelCustomizationUuid": "4e7028a1-4c80-4d20-a7a2-a1fb3343d5cb"
1351                             },
1352                             "isBase": false,
1353                             "vfModuleLabel": "vpkg",
1354                             "initialCount": 0,
1355                             "hasVolumeGroup": false
1356                         },
1357                         {
1358                             "modelInfo": {
1359                                 "modelName": "VfwCnfCdsVsp..vfw..module-3",
1360                                 "modelUuid": "0de4ed56-8b4c-4a2d-8ce6-85d5e269204f",
1361                                 "modelInvariantUuid": "9ffda670-3d77-4f6c-a4ad-fb7a09f19817",
1362                                 "modelVersion": "1",
1363                                 "modelCustomizationUuid": "1e123e43-ba40-4c93-90d7-b9f27407ec03"
1364                             },
1365                             "isBase": false,
1366                             "vfModuleLabel": "vfw",
1367                             "initialCount": 0,
1368                             "hasVolumeGroup": false
1369                         }
1370                     ],
1371                     "groups": []
1372                 }
1373             ]
1374         }
1375
1376 .. note:: For **Native Helm** path both modelName will have prefix *helm_* i.e. *helm_vfw* and vfModuleLabel will have *helm_* keyword inside i.e. *VfwCnfCdsVsp..helm_vfw..module-3*
1377
1378 - SDNC:
1379
1380     SDNC should have it's database updated with *sdnc_* properties that were set during service modeling.
1381
1382 .. note:: Please change credentials respectively to your installation. The required credentials can be retrieved with instruction `Retrieving logins and passwords of ONAP components`_
1383
1384
1385 ::
1386
1387     kubectl -n onap exec onap-mariadb-galera-0 -it -- sh
1388     mysql -uroot -psecretpassword -D sdnctl
1389             MariaDB [sdnctl]> select sdnc_model_name, sdnc_model_version, sdnc_artifact_name from VF_MODEL WHERE customization_uuid = '86dc8af4-aa17-4fc7-9b20-f12160d99718';
1390             +-----------------+--------------------+--------------------+
1391             | sdnc_model_name | sdnc_model_version | sdnc_artifact_name |
1392             +-----------------+--------------------+--------------------+
1393             | vFW_CNF_CDS     | 8.0.0              | vnf                |
1394             +-----------------+--------------------+--------------------+
1395             1 row in set (0.00 sec)
1396
1397
1398 .. note:: customization_uuid value is the modelCustomizationUuid of the VNF (serviceVnfs response in 2nd Postman call from SO Catalog DB)
1399
1400 - CDS:
1401
1402     CDS should onboard CBA uploaded as part of VF.
1403
1404     ::
1405
1406         Postman -> Distribution Verification -> [CDS] List CBAs
1407
1408     ::
1409
1410                 [
1411                         {
1412                                 "blueprintModel": {
1413                                         "id": "c505e516-b35d-4181-b1e2-bcba361cfd0a",
1414                                         "artifactUUId": null,
1415                                         "artifactType": "SDNC_MODEL",
1416                                         "artifactVersion": "8.0.0",
1417                                         "artifactDescription": "Controller Blueprint for vFW_CNF_CDS:8.0.0",
1418                                         "internalVersion": null,
1419                                         "createdDate": "2020-05-29T06:02:20.000Z",
1420                                         "artifactName": "vFW_CNF_CDS",
1421                                         "published": "N",
1422                                         "updatedBy": "Samuli Silvius <s.silvius@partner.samsung.com>",
1423                                         "tags": "Samuli Silvius, Lukasz Rajewski, vFW_CNF_CDS"
1424                                 }
1425                         }
1426                 ]
1427
1428     The list should have the matching entries with SDNC database:
1429
1430     - sdnc_model_name == artifactName
1431     - sdnc_model_version == artifactVersion
1432
1433     You can also use Postman to download CBA for further verification but it's fully optional.
1434
1435     ::
1436
1437         Postman -> Distribution Verification -> [CDS] CBA Download
1438
1439 - K8splugin:
1440
1441     K8splugin should onboard 4 resource bundles related to helm resources:
1442
1443     ::
1444
1445         Postman -> Distribution Verification -> [K8splugin] List Resource Bundle Definitions
1446
1447     ::
1448
1449                 [
1450                         {
1451                                 "rb-name": "52842255-b7be-4a1c-ab3b-2bd3bd4a5423",
1452                                 "rb-version": "274f4bc9-7679-4767-b34d-1df51cdf2496",
1453                                 "chart-name": "base_template",
1454                                 "description": "",
1455                                 "labels": {
1456                                         "vnf_customization_uuid": "b27fad11-44da-4840-9256-7ed8a32fbe3e"
1457                                 }
1458                         },
1459                         {
1460                                 "rb-name": "36f25e1b-199b-4de2-b656-c870d341cf0e",
1461                                 "rb-version": "0cbf558f-5a96-4555-b476-7df8163521aa",
1462                                 "chart-name": "vsn",
1463                                 "description": "",
1464                                 "labels": {
1465                                         "vnf_customization_uuid": "4cac0584-c0d6-42a7-bdb3-29162792e07f"
1466                                 }
1467                         },
1468                         {
1469                                 "rb-name": "4e2b9975-5214-48b8-861a-5701c09eedfa",
1470                                 "rb-version": "011b5f61-6524-4789-bd9a-44cfbf321463",
1471                                 "chart-name": "vpkg",
1472                                 "description": "",
1473                                 "labels": {
1474                                         "vnf_customization_uuid": "4e7028a1-4c80-4d20-a7a2-a1fb3343d5cb"
1475                                 }
1476                         },
1477                         {
1478                                 "rb-name": "9ffda670-3d77-4f6c-a4ad-fb7a09f19817",
1479                                 "rb-version": "0de4ed56-8b4c-4a2d-8ce6-85d5e269204f",
1480                                 "chart-name": "vfw",
1481                                 "description": "",
1482                                 "labels": {
1483                                         "vnf_customization_uuid": "1e123e43-ba40-4c93-90d7-b9f27407ec03"
1484                                 }
1485                         }
1486                 ]
1487
1488 **<AUTOMATED>**
1489
1490 Distribution is a part of the onboarding step and at this stage is performed
1491
1492 3-2 CNF Instantiation
1493 .....................
1494
1495 This is the whole beef of the use case and furthermore the core of it is that we can instantiate any amount of instances of the same CNF each running and working completely of their own. Very basic functionality in VM (VNF) side but for Kubernetes and ONAP integration this is the first milestone towards other normal use cases familiar for VNFs.
1496
1497 **<MANUAL>**
1498
1499 Postman collection is automated to populate needed parameters when queries are run in correct order. If you did not already run following 2 queries after distribution (to verify distribution), run those now:
1500
1501 ::
1502
1503     Postman -> LCM -> 1.[SDC] Catalog Service
1504
1505 ::
1506
1507     Postman -> LCM -> 2. [SO] Catalog DB Service xNFs
1508
1509 Now actual instantiation can be triggered with:
1510
1511 ::
1512
1513     Postman -> LCM -> 3. [SO] Self-Serve Service Assign & Activate
1514
1515 **<AUTOMATED>**
1516
1517 Required inputs for instantiation process are taken from the *config.py* file.
1518 ::
1519
1520     python instantiation.py
1521
1522
1523 Finally, to follow the progress of instantiation request with SO's GET request:
1524
1525 **<MANUAL>**
1526
1527 ::
1528
1529     Postman -> LCM -> 4. [SO] Infra Active Requests
1530
1531 The successful reply payload in that query should start like this:
1532
1533 ::
1534
1535     {
1536       "requestStatus": "COMPLETE",
1537       "statusMessage": "Macro-Service-createInstance request was executed correctly.",
1538       "flowStatus": "Successfully completed all Building Blocks",
1539       "progress": 100,
1540       "startTime": 1590996766000,
1541       "endTime": 1590996945000,
1542       "source": "Postman",
1543       "vnfId": "93b3350d-ed6f-413b-9cc5-a158c1676eb0",
1544       "tenantId": "aaaa",
1545       "requestBody": "**REDACTED FOR READABILITY**",
1546       "lastModifiedBy": "CamundaBPMN",
1547       "modifyTime": "2020-06-01T07:35:45.000+0000",
1548       "cloudRegion": "k8sregionfour",
1549       "serviceInstanceId": "8ead0480-cf44-428e-a4c2-0e6ed10f7a72",
1550       "serviceInstanceName": "vfw-cnf-16",
1551       "requestScope": "service",
1552       "requestAction": "createInstance",
1553       "requestorId": "11c2ddb7-4659-4bf0-a685-a08dcbb5a099",
1554       "requestUrl": "http://infra:30277/onap/so/infra/serviceInstantiation/v7/serviceInstances",
1555       "tenantName": "k8stenant",
1556       "cloudApiRequests": [],
1557       "requestURI": "6a369c8e-d492-4ab5-a107-46804eeb7873",
1558       "_links": {
1559         "self": {
1560           "href": "http://infra:30277/infraActiveRequests/6a369c8e-d492-4ab5-a107-46804eeb7873"
1561         },
1562         "infraActiveRequests": {
1563           "href": "http://infra:30277/infraActiveRequests/6a369c8e-d492-4ab5-a107-46804eeb7873"
1564         }
1565       }
1566     }
1567
1568
1569 Progress can be also followed also with `SO Monitoring`_ dashboard.
1570
1571 Service Instance Termination
1572 ++++++++++++++++++++++++++++
1573
1574 Service instance can be terminated with the following postman call:
1575
1576 **<MANUAL>**
1577 ::
1578
1579     Postman -> LCM -> 5. [SO] Service Delete
1580
1581 **<AUTOMATED>**
1582 ::
1583
1584     python delete.py
1585
1586 .. note:: Automated service deletion mecvhanism takes information about the instantiated service instance from the *config.py* file and *SERVICE_INSTANCE_NAME* variable. If you modify this value before the deletion of existing service instance then you will loose opportunity to easy delete already created service instance.
1587
1588 Second Service Instance Instantiation
1589 +++++++++++++++++++++++++++++++++++++
1590
1591 To finally verify that all the work done within this demo, it should be possible to instantiate second vFW instance successfully.
1592
1593 Trigger new instance createion. You can use previous call or a separate one that will utilize profile templating mechanism implemented in CBA:
1594
1595 **<MANUAL>**
1596 ::
1597
1598     Postman -> LCM -> 6. [SO] Self-Serve Service Assign & Activate - Second
1599
1600 **<AUTOMATED>**
1601
1602 Before second instance of service is created you need to modify *config.py* file changing the *SERVICENAME* and *SERVICE_INSTANCE_NAME* to different values and by changing the value or *k8s-rb-profile-name* parameter for *vpg* module from value *default* or *vfw-cnf-cds-base-profile* to *vfw-cnf-cds-vpkg-profile* what will result with instantiation of additional ssh service for *vpg* module. Second onboarding in automated case is required due to the existing limitations of *python-sdk* librarier that create vf-module instance name base on the vf-module model name. For manual Postman option vf-module instance name is set on service instance name basis what makes it unique.
1603 ::
1604
1605     python onboarding.py
1606     python instantiation.py
1607
1608 3-3 Results and Logs
1609 ....................
1610
1611 Now multiple instances of Kubernetes variant of vFW are running in target VIM (KUD deployment).
1612
1613 .. figure:: files/vFW_CNF_CDS/vFW_Instance_In_Kubernetes.png
1614    :align: center
1615
1616    vFW Instance In Kubernetes
1617
1618 **<MANUAL>**
1619
1620 To review situation after instantiation from different ONAP components, most of the info can be found using Postman queries provided. For each query, example response payload(s) is/are saved and can be found from top right corner of the Postman window.
1621
1622 ::
1623
1624     Postman -> Instantiation verification**
1625
1626 Execute example Postman queries and check example section to see the valid results.
1627
1628 ==========================    =================
1629 Verify Target                 Postman query
1630 --------------------------    -----------------
1631 Service Instances in AAI      **Postman -> Instantiation verification -> [AAI] List Service Instances**
1632 Service Instances in MDSAL    **Postman -> Instantiation verification -> [SDNC] GR-API MD-SAL Services**
1633 K8S Instances in KUD          **Postman -> Instantiation verification -> [K8splugin] List Instances**
1634 ==========================    =================
1635
1636 .. note:: "[AAI] List vServers <Empty>" Request won't return any vserver info from AAI, as currently such information are not provided during instantiation process.
1637
1638
1639 Query also directly from VIM:
1640
1641 ::
1642
1643     #
1644     ubuntu@kud-host:~$ kubectl get pods,svc,networks,cm,network-attachment-definition,deployments
1645     NAME                                                            READY   STATUS    RESTARTS   AGE
1646     pod/vfw-17f6f7d3-8424-4550-a188-cd777f0ab48f-7cfb9949d9-8b5vg   1/1     Running   0          22s
1647     pod/vfw-19571429-4af4-49b3-af65-2eb1f97bba43-75cd7c6f76-4gqtz   1/1     Running   0          11m
1648     pod/vpg-5ea0d3b0-9a0c-4e88-a2e2-ceb84810259e-f4485d485-pln8m    1/1     Running   0          11m
1649     pod/vpg-8581bc79-8eef-487e-8ed1-a18c0d638b26-6f8cff54d-dvw4j    1/1     Running   0          32s
1650     pod/vsn-8e7ac4fc-2c31-4cf8-90c8-5074c5891c14-5879c56fd-q59l7    2/2     Running   0          11m
1651     pod/vsn-fdc9b4ba-c0e9-4efc-8009-f9414ae7dd7b-5889b7455-96j9d    2/2     Running   0          30s
1652
1653     NAME                                                              TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
1654     service/vpg-5ea0d3b0-9a0c-4e88-a2e2-ceb84810259e-management-api   NodePort    10.244.43.245   <none>        2831:30831/TCP   11m
1655     service/vpg-8581bc79-8eef-487e-8ed1-a18c0d638b26-management-api   NodePort    10.244.1.45     <none>        2831:31831/TCP   33s
1656     service/vsn-8e7ac4fc-2c31-4cf8-90c8-5074c5891c14-darkstat-ui      NodePort    10.244.16.187   <none>        667:30667/TCP    11m
1657     service/vsn-fdc9b4ba-c0e9-4efc-8009-f9414ae7dd7b-darkstat-ui      NodePort    10.244.20.229   <none>        667:31667/TCP    30s
1658
1659     NAME                                                                                    AGE
1660     network.k8s.plugin.opnfv.org/55118b80-8470-4c99-bfdf-d122cd412739-management-network    40s
1661     network.k8s.plugin.opnfv.org/55118b80-8470-4c99-bfdf-d122cd412739-protected-network     40s
1662     network.k8s.plugin.opnfv.org/55118b80-8470-4c99-bfdf-d122cd412739-unprotected-network   40s
1663     network.k8s.plugin.opnfv.org/567cecc3-9692-449e-877a-ff0b560736be-management-network    11m
1664     network.k8s.plugin.opnfv.org/567cecc3-9692-449e-877a-ff0b560736be-protected-network     11m
1665     network.k8s.plugin.opnfv.org/567cecc3-9692-449e-877a-ff0b560736be-unprotected-network   11m
1666
1667     NAME                                                           DATA   AGE
1668     configmap/vfw-17f6f7d3-8424-4550-a188-cd777f0ab48f-configmap   6      22s
1669     configmap/vfw-19571429-4af4-49b3-af65-2eb1f97bba43-configmap   6      11m
1670     configmap/vpg-5ea0d3b0-9a0c-4e88-a2e2-ceb84810259e-configmap   6      11m
1671     configmap/vpg-8581bc79-8eef-487e-8ed1-a18c0d638b26-configmap   6      33s
1672     configmap/vsn-8e7ac4fc-2c31-4cf8-90c8-5074c5891c14-configmap   2      11m
1673     configmap/vsn-fdc9b4ba-c0e9-4efc-8009-f9414ae7dd7b-configmap   2      30s
1674
1675     NAME                                                                                       AGE
1676     networkattachmentdefinition.k8s.cni.cncf.io/55118b80-8470-4c99-bfdf-d122cd412739-ovn-nat   40s
1677     networkattachmentdefinition.k8s.cni.cncf.io/567cecc3-9692-449e-877a-ff0b560736be-ovn-nat   11m
1678
1679     NAME                                                             READY   UP-TO-DATE   AVAILABLE   AGE
1680     deployment.extensions/vfw-17f6f7d3-8424-4550-a188-cd777f0ab48f   1/1     1            1           22s
1681     deployment.extensions/vfw-19571429-4af4-49b3-af65-2eb1f97bba43   1/1     1            1           11m
1682     deployment.extensions/vpg-5ea0d3b0-9a0c-4e88-a2e2-ceb84810259e   1/1     1            1           11m
1683     deployment.extensions/vpg-8581bc79-8eef-487e-8ed1-a18c0d638b26   1/1     1            1           33s
1684     deployment.extensions/vsn-8e7ac4fc-2c31-4cf8-90c8-5074c5891c14   1/1     1            1           11m
1685     deployment.extensions/vsn-fdc9b4ba-c0e9-4efc-8009-f9414ae7dd7b   1/1     1            1           30s
1686
1687
1688 Component Logs From The Execution
1689 +++++++++++++++++++++++++++++++++
1690
1691 **<MANUAL>**
1692
1693 All logs from the use case execution can be retrieved with following
1694
1695 ::
1696
1697     kubectl -n onap logs `kubectl -n onap get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}' | grep -m1 <COMPONENT_NAME>` -c <CONTAINER>
1698
1699 where <COMPONENT_NAME> and <CONTAINER> should be replaced with following keywords respectively:
1700
1701 - so-bpmn-infra, so-bpmn-infra
1702 - so-openstack-adapter, so-openstack-adapter
1703 - so-cnf-adapter, so-cnf-adapter
1704 - sdnc-0, sdnc
1705
1706   From karaf.log all requests (payloads) to CDS can be found by searching following string:
1707
1708   ``'Sending request below to url http://cds-blueprints-processor-http:8080/api/v1/execution-service/process'``
1709
1710 - cds-blueprints-processor, cds-blueprints-processor
1711 - multicloud-k8s, multicloud-k8s
1712 - network-name-gen, network-name-gen, 
1713
1714 **Debug log**
1715
1716 In case more detailed logging is needed, here's instructions how to setup DEBUG logging for few components.
1717
1718 - SDNC
1719
1720   ::
1721
1722     kubectl -n onap exec -it onap-sdnc-0 -c sdnc /opt/opendaylight/bin/client log:set DEBUG
1723
1724
1725 - CDS Blueprint Processor
1726
1727   ::
1728
1729     # Edit configmap
1730     kubectl -n onap edit configmap onap-cds-blueprints-processor-configmap
1731
1732     # Edit logback.xml content change root logger level from info to debug.
1733     <root level="debug">
1734         <appender-ref ref="STDOUT"/>
1735     </root>
1736
1737     # Delete the Pods to make changes effective
1738     kubectl -n onap delete pods -l app=cds-blueprints-processor
1739
1740 3-4 Verification of the CNF Status
1741 ..................................
1742
1743 **<MANUAL>**
1744
1745 The Guilin introduced new API for verification of the status of instantiated resouces in k8s cluster. The API gives result similar to *kubectl describe* operation for all the resources created for particular *rb-definition*. Status API can be used to verify the k8s resources after instantiation but also can be used leveraged for synchronization of the information with external components, like AAI in the future. To use Status API call
1746
1747 ::
1748
1749     curl -i http://${K8S_NODE_IP}:30280/api/multicloud-k8s/v1/v1/instance/{rb-instance-id}/status
1750
1751 where {rb-instance-id} can be taken from the list of instances resolved the following call
1752
1753 ::
1754
1755     curl -i http://${K8S_NODE_IP}:30280/api/multicloud-k8s/v1/v1/instance/
1756
1757 or from AAI *heat-stack-id* property of created *vf-module* associated with each Helm package from onboarded VSP which holds the *rb-instance-id* value.
1758
1759 Examplary output of Status API is shown below (full result of test vFW CNF helm package in the attached file). It shows the list of GVK resources created for requested *rb-instance* (Helm and vf-module in the same time) with assocated describe result for all of them.
1760
1761   :download:`Full Status API Result <files/vFW_CNF_CDS/status-response.json>`
1762
1763 ::
1764
1765     {
1766         "request": {
1767             "rb-name": "vfw",
1768             "rb-version": "plugin_test",
1769             "profile-name": "test_profile",
1770             "release-name": "",
1771             "cloud-region": "kud",
1772             "labels": {
1773                 "testCaseName": "plugin_fw.sh"
1774             },
1775             "override-values": {
1776                 "global.onapPrivateNetworkName": "onap-private-net-test"
1777             }
1778         },
1779         "ready": false,
1780         "resourceCount": 1,
1781         "resourcesStatus": [
1782             {
1783                 "name": "sink-configmap",
1784                 "GVK": {
1785                     "Group": "",
1786                     "Version": "v1",
1787                     "Kind": "ConfigMap"
1788                 },
1789                 "status": {
1790                     "apiVersion": "v1",
1791                     "data": {
1792                         "protected_net_gw": "192.168.20.100",
1793                         "protected_private_net_cidr": "192.168.10.0/24"
1794                     },
1795                     "kind": "ConfigMap",
1796                     "metadata": {
1797                         "creationTimestamp": "2020-09-29T13:36:25Z",
1798                         "labels": {
1799                             "k8splugin.io/rb-instance-id": "practical_nobel"
1800                         },
1801                         "name": "sink-configmap",
1802                         "namespace": "plugin-tests-namespace",
1803                         "resourceVersion": "10720771",
1804                         "selfLink": "/api/v1/namespaces/plugin-tests-namespace/configmaps/sink-configmap",
1805                         "uid": "46c8bec4-980c-455b-9eb0-fb84ac8cc450"
1806                     }
1807                 }
1808             }
1809         ]
1810     }
1811
1812 .. note:: The example of how the Stauts API could be integrated into CDS can be found in the Frankfurt version of k8s profile upload mechanism `Frankfurt CBA Definition`_ (*profile-upload* TOSCA node template), implemented in inside of the Kotlin script `Frankfurt CBA Script`_ for profile upload. This method shows how to integrate mutlicloud-k8s API endpoint into Kotlin script executed by CDS. For more details please take a look into Definition file of 1.0.45 version of the CBA and also the kotlin script used there for uploading the profile. 
1813
1814 PART 4 - Future improvements needed
1815 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1816
1817 Future development areas for this use case:
1818
1819 - Automated smoke use case.
1820 - Include Closed Loop part of the vFW demo.
1821 - vFW service with Openstack VNF and Kubernetes CNF
1822 - On-demand healthcheck workflow of vFW
1823
1824 Future development areas for CNF support:
1825
1826 - Validation of Helm package and extraction of override values in time of the package onboarding.
1827 - Synchroinzation of information about CNF between AAI and K8s.
1828 - Coordination of the vFW Helm charts instantiation performed by cnf-adapter of SO
1829 - Use multicloud/k8S API v2.
1830
1831 Many features from the list above are covered by the Honolulu roadmap described in `REQ-627`_. 
1832
1833
1834 .. _ONAP Deployment Guide: https://docs.onap.org/projects/onap-oom/en/guilin/oom_quickstart_guide.html
1835 .. _CDS Documentation: https://docs.onap.org/projects/onap-ccsdk-cds/en/guilin/index.html
1836 .. _vLB use-case: https://wiki.onap.org/pages/viewpage.action?pageId=71838898
1837 .. _vFW_CNF_CDS Model: https://git.onap.org/demo/tree/heat/vFW_CNF_CDS/templates?h=guilin
1838 .. _vFW_CNF_CDS Automation: https://git.onap.org/demo/tree/heat/vFW_CNF_CDS/automation?h=guilin
1839 .. _vFW CDS Dublin: https://wiki.onap.org/display/DW/vFW+CDS+Dublin
1840 .. _vFW CBA Model: https://git.onap.org/ccsdk/cds/tree/components/model-catalog/blueprint-model/service-blueprint/vFW?h=elalto
1841 .. _vFW_Helm Model: https://git.onap.org/multicloud/k8s/tree/kud/demo/firewall?h=elalto
1842 .. _vFW_NextGen: https://git.onap.org/demo/tree/heat/vFW_NextGen?h=elalto
1843 .. _vFW EDGEX K8S: https://docs.onap.org/en/elalto/submodules/integration.git/docs/docs_vfw_edgex_k8s.html
1844 .. _vFW EDGEX K8S In ONAP Wiki: https://wiki.onap.org/display/DW/Deploying+vFw+and+EdgeXFoundry+Services+on+Kubernets+Cluster+with+ONAP
1845 .. _KUD github: https://github.com/onap/multicloud-k8s/tree/master/kud/hosting_providers/baremetal
1846 .. _KUD in Wiki: https://wiki.onap.org/display/DW/Kubernetes+Baremetal+deployment+setup+instructions
1847 .. _Multicloud k8s gerrit: https://gerrit.onap.org/r/q/status:open+project:+multicloud/k8s
1848 .. _KUD subproject in github: https://github.com/onap/multicloud-k8s/tree/master/kud
1849 .. _Frankfurt CBA Definition: https://git.onap.org/demo/tree/heat/vFW_CNF_CDS/templates/cba/Definitions/vFW_CNF_CDS.json?h=frankfurt
1850 .. _Frankfurt CBA Script: https://git.onap.org/demo/tree/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/KotlinK8sProfileUpload.kt?h=frankfurt
1851 .. _SO-3403: https://jira.onap.org/browse/SO-3403
1852 .. _SO-3404: https://jira.onap.org/browse/SO-3404
1853 .. _REQ-182: https://jira.onap.org/browse/REQ-182
1854 .. _REQ-341: https://jira.onap.org/browse/REQ-341
1855 .. _REQ-458: https://jira.onap.org/browse/REQ-458
1856 .. _REQ-627: https://jira.onap.org/browse/REQ-627
1857 .. _Python SDK: https://docs.onap.org/projects/onap-integration/en/guilin/integration-tooling.html?highlight=python-sdk#python-onapsdk
1858 .. _KUD Jenkins ci/cd verification: https://jenkins.onap.org/job/multicloud-k8s-master-kud-deployment-verify-shell/
1859 .. _K8s cloud site config: https://docs.onap.org/en/guilin/guides/onap-operator/cloud_site/k8s/index.html
1860 .. _SO Monitoring: https://docs.onap.org/projects/onap-so/en/guilin/developer_info/Working_with_so_monitoring.html
1861 .. _Data Dictionary: https://git.onap.org/demo/tree/heat/vFW_CNF_CDS/templates/cba-dd.json?h=guilin
1862 .. _Helm Healer: https://git.onap.org/oom/offline-installer/tree/tools/helm-healer.sh?h=frankfurt
1863 .. _CDS UAT Testing: https://wiki.onap.org/display/DW/Modeling+Concepts
1864 .. _infra_workload: https://docs.onap.org/projects/onap-multicloud-framework/en/latest/specs/multicloud_infra_workload.html?highlight=multicloud