blob: a68b05ce98461d72e761eeaa509676f309100641 [file] [log] [blame]
Ayumu Uehaa91a3252022-10-21 05:01:46 +00001.. This work is licensed under a Creative Commons Attribution 4.0 International License.
2.. http://creativecommons.org/licenses/by/4.0
3
4
5How to deploy CNF Deployment
6============================
7
8This user guide shows how to deploy CNF (Container Network Function) using Helm via Tacker.
9See the `ETSI NFV-SOL CNF Deployment by Helm chart` for the original procedure.
10
11.. contents::
12 :depth: 3
13 :local:
14
15Prerequisites
16-------------
17
18VIM
19~~~
20Register Kubernetes VIM (Virtualized Infrastructure Manager) by following procedure below.
21
221. Prepare VIM config file, please change the parameters to suit your environment.
23 If you get bearer_token via INF O2 service, follow the "Use Kubernetes Control Client through O2 DMS profile" section of `INF O2 Service Userguide`_.
24
25 Sample config file:
26
27 .. code:: bash
28
29 $ cat vim_config_k8s.yaml
30 auth_url: "https://192.168.121.170:6443"
31 project_name: "default"
32 bearer_token: "eyJhbGciOiJSUzI1NiIsImtpZCI6InZQOGs5bjhKdExWVkZiRU5reVZRdEtBS0pnYXJFemROcElKNFpIdEFtMXMifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJhZG1pbi11c2VyLXRva2VuLTk4am1qIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6ImFkbWluLXVzZXIiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiIzZWJkZmEzZi0wMTA1LTRhN2YtODFjZS1kYjg5ODcxYTBiMDYiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06YWRtaW4tdXNlciJ9.df_mV4RbsRN6oOS2KnkaKid0cJBAvdpautWnK67R0y8PRSm79Vc02NbUCmai0M4QiIF9gKhqtM0OYB5vZYJJng9vkcSNVWFUv6hA4Tvjw8FnEcGWe7TnWE2q-ZywJYiZNHvToRIgP5EH5UuLACEXu8KeeG56LxL3T2qNsUenUYLYaT6EciwKiy5SaEk3H1BB0zvSff0d_6sPvGCtY4xL_Q1pqqdgeL2lwC7tcivwEyRy3rMp1FBRrWOVdyeybww0XiNfEnYOjFyVSI4ED2n2msIdz_2JoHAnphGO7nslpn3MmkO-K1Mnhk7EKiR0kgHboGXwQlcnjW4Cje77PjumPg"
33 type: "kubernetes"
34
352. Register VIM to Tacker by running following command.
36
37 .. code:: bash
38
39 $ source ${devstack_dir}/openrc admin admin
40 $ openstack vim register --confi-file vim_config_k8s.yaml vim-kubernetes
41
423. Check the registered VIM status is ``REACHABLE``.
43
44 .. code:: bash
45
46 $ openstack vim list
47 +--------------------------------------+----------------+----------------------------------+------------+------------+-----------+
48 | ID | Name | Tenant_id | Type | Is Default | Status |
49 +--------------------------------------+----------------+----------------------------------+------------+------------+-----------+
50 | 5a5815fa-bf1d-41f4-a824-3e39bbdcebd0 | vim-kubernetes | a51290751e094e608ad1e5e251b8cd39 | kubernetes | True | REACHABLE |
51 +--------------------------------------+----------------+----------------------------------+------------+------------+-----------+
52
53Helm Environment
54~~~~~~~~~~~~~~~~
55Create an executable environment for Helm CLI by following procedure below.
56
571. Install Helm.
58
59 .. code:: bash
60
61 $ HELM_VERSION="3.10.0" # Change to version that is compatible with your cluster
62 $ wget -P /tmp https://get.helm.sh/helm-v$HELM_VERSION-linux-amd64.tar.gz
63 $ tar zxf /tmp/helm-v$HELM_VERSION-linux-amd64.tar.gz -C /tmp
64 $ sudo mv /tmp/linux-amd64/helm /usr/local/bin/helm
65
662. Create directory to store Helm chart.
67
68 .. code:: bash
69
70 $ HELM_CHART_DIR="/var/tacker/helm"
71 $ sudo mkdir -p $HELM_CHART_DIR
72
733. Update Helm Connection Information to VIM DB.
74
75 .. code:: bash
76
77 $ mysql
78 mysql> use tacker;
79 mysql> update vims set extra=json_object(
80 'helm_info', '{"masternode_ip": ["127.0.0.1"], "masternode_username": "stack", "masternode_password": "******"}')
81 where id="5a5815fa-bf1d-41f4-a824-3e39bbdcebd0";
82 mysql> exit
83
84 .. note::
85
86 The specified user must meet the following criteria:
87 * User can run Helm CLI commands via SSH.
88 * User can access to masternode_ip via ssh with password.
89 * User can execute sudo mkdir/chown/rm command without password.
90
91VNF Package
92~~~~~~~~~~~
93Create and upload the VNF Package that you want to deploy by following procedure below.
94
951. Prepare VNF Package.
96 The sample VNF Package used in this guide is stored in ``o2/tacker/samples/packages/cnf`` directory.
97
98 .. code:: bash
99
100 $ git clone https://gerrit.o-ran-sc.org/r/smo/o2
101 $ cd o2/tacker/samples/packages/cnf
102 $ ls
103 Definitions Files input_param.json TOSCA-Metadata
104
105 $ zip sample_cnf_package.zip -r Definitions/ Files/ TOSCA-Metadata/
106
107 About details to prepare VNF Package, please refer to `Prepare VNF Package`_.
108
1092. Create and Upload VNF Package.
110
111 .. code:: bash
112
113 $ openstack vnf package create
114 +-------------------+-------------------------------------------------------------------------------------------------+
115 | Field | Value |
116 +-------------------+-------------------------------------------------------------------------------------------------+
117 | ID | 1efcf585-3fea-4813-88dd-bbc93692b51a |
118 | Links | { |
119 | | "self": { |
120 | | "href": "/vnfpkgm/v1/vnf_packages/1efcf585-3fea-4813-88dd-bbc93692b51a" |
121 | | }, |
122 | | "packageContent": { |
123 | | "href": "/vnfpkgm/v1/vnf_packages/1efcf585-3fea-4813-88dd-bbc93692b51a/package_content" |
124 | | } |
125 | | } |
126 | Onboarding State | CREATED |
127 | Operational State | DISABLED |
128 | Usage State | NOT_IN_USE |
129 | User Defined Data | {} |
130 +-------------------+-------------------------------------------------------------------------------------------------+
131
132 $ openstack vnf package upload --path sample_cnf_package.zip 1efcf585-3fea-4813-88dd-bbc93692b51a
133 Upload request for VNF package 1efcf585-3fea-4813-88dd-bbc93692b51a has been accepted.
134
135
136Deployment Procedure
137--------------------
138
139.. note::
140
141 This procedure uses the CLI available by installing python-tackerclient.
142 If you want to process with RESTfull API, see the `API-Docs`_ for more information.
143
144Create
145~~~~~~
146Create a VNF Instance by specifying the VNFD ID. The VNFD ID is the value defined in the VNFD file and can be found in the :command:`openstack vnf package show` command.
147
148.. code:: bash
149
150 $ openstack vnflcm create 37391b92-a1d9-44e5-855a-83644cdc3265
151 +-----------------------------+------------------------------------------------------------------------------------------------------------------+
152 | Field | Value |
153 +-----------------------------+------------------------------------------------------------------------------------------------------------------+
154 | ID | b0915924-7e04-4c16-b229-d3dfcc366eee |
155 | Instantiation State | NOT_INSTANTIATED |
156 | Links | { |
157 | | "self": { |
158 | | "href": "http://localhost:9890/vnflcm/v1/vnf_instances/b0915924-7e04-4c16-b229-d3dfcc366eee" |
159 | | }, |
160 | | "instantiate": { |
161 | | "href": "http://localhost:9890/vnflcm/v1/vnf_instances/b0915924-7e04-4c16-b229-d3dfcc366eee/instantiate" |
162 | | } |
163 | | } |
164 | VNF Configurable Properties | |
165 | VNF Instance Description | None |
166 | VNF Instance Name | vnf-b0915924-7e04-4c16-b229-d3dfcc366eee |
167 | VNF Product Name | Sample CNF |
168 | VNF Provider | Company |
169 | VNF Software Version | 1.0 |
170 | VNFD ID | 37391b92-a1d9-44e5-855a-83644cdc3265 |
171 | VNFD Version | 1.0 |
172 | vnfPkgId | |
173 +-----------------------------+------------------------------------------------------------------------------------------------------------------+
174
175Instantiate
176~~~~~~~~~~~
177Instantiate a VNF by specifying the ID of the created VNF Instance and a file path of input parameters.
178
179.. code:: bash
180
181 $ cat input_param.json
182 {
183 "flavourId": "helmchart",
184 "additionalParams": {
185 "namespace": "default",
186 "use_helm": "true",
187 "using_helm_install_param": [
188 {
189 "exthelmchart": "false",
190 "helmchartfile_path": "Files/kubernetes/localhelm-0.1.0.tgz",
191 "helmreleasename": "tacker-test-vdu"
192 }
193 ],
194 "helm_replica_values": {
195 "vdu1_aspect": "replicaCount"
196 }
197 },
198 "vimConnectionInfo": [
199 {
200 "id": "742f1fc7-7f00-417d-85a6-d4e788353181",
201 "vimId": "5a5815fa-bf1d-41f4-a824-3e39bbdcebd0",
202 "vimType": "kubernetes"
203 }
204 ]
205 }
206
207 $ openstack vnflcm instantiate b0915924-7e04-4c16-b229-d3dfcc366eee input_param.json
208 Instantiate request for VNF Instance b0915924-7e04-4c16-b229-d3dfcc366eee has been accepted.
209
210You can verify that the deployment was successful in the following ways:
211
2121. Verify that the VNF Instance displayed by the command is as follows:
213
214 * ``Instantiation State`` became ``INSTANTIATED``.
215 * Deployed resource information is stored in ``vnfcResourceInfo`` of ``Instantiated Vnf Info``.
216
217 .. code:: bash
218
219 $ openstack vnflcm show b0915924-7e04-4c16-b229-d3dfcc366eee
220 +-----------------------------+----------------------------------------------------------------------------------------------------------------------+
221 | Field | Value |
222 +-----------------------------+----------------------------------------------------------------------------------------------------------------------+
223 | ID | b0915924-7e04-4c16-b229-d3dfcc366eee |
224 | Instantiated Vnf Info | { |
225 | | "flavourId": "helmchart", |
226 | | "vnfState": "STARTED", |
227 | | "scaleStatus": [ |
228 | | { |
229 | | "aspectId": "vdu1_aspect", |
230 | | "scaleLevel": 0 |
231 | | } |
232 | | ], |
233 | | "extCpInfo": [], |
234 | | "vnfcResourceInfo": [ |
235 | | { |
236 | | "id": "df202937-2bb8-40a9-8be0-a8aa5e2ec0ae", |
237 | | "vduId": "VDU1", |
238 | | "computeResource": { |
239 | | "vimConnectionId": null, |
240 | | "resourceId": "tacker-test-vdu-localhelm-7b5489f949-fzmc5", |
241 | | "vimLevelResourceType": "Deployment" |
242 | | }, |
243 | | "storageResourceIds": [] |
244 | | } |
245 | | ], |
246 | | "additionalParams": { |
247 | | "useHelm": "true", |
248 | | "namespace": "default", |
249 | | "helmReplicaValues": { |
250 | | "vdu1Aspect": "replicaCount" |
251 | | }, |
252 | | "usingHelmInstallParam": [ |
253 | | { |
254 | | "exthelmchart": "false", |
255 | | "helmreleasename": "tacker-test-vdu", |
256 | | "helmchartfilePath": "Files/kubernetes/localhelm-0.1.0.tgz" |
257 | | } |
258 | | ] |
259 | | } |
260 | | } |
261 | Instantiation State | INSTANTIATED |
262 | Links | { |
263 | | "self": { |
264 | | "href": "http://localhost:9890/vnflcm/v1/vnf_instances/b0915924-7e04-4c16-b229-d3dfcc366eee" |
265 | | }, |
266 | | "terminate": { |
267 | | "href": "http://localhost:9890/vnflcm/v1/vnf_instances/b0915924-7e04-4c16-b229-d3dfcc366eee/terminate" |
268 | | }, |
269 | | "heal": { |
270 | | "href": "http://localhost:9890/vnflcm/v1/vnf_instances/b0915924-7e04-4c16-b229-d3dfcc366eee/heal" |
271 | | }, |
272 | | "changeExtConn": { |
273 | | "href": "http://localhost:9890/vnflcm/v1/vnf_instances/b0915924-7e04-4c16-b229-d3dfcc366eee/change_ext_conn" |
274 | | } |
275 | | } |
276 | VIM Connection Info | [ |
277 | | { |
278 | | "id": "742f1fc7-7f00-417d-85a6-d4e788353181", |
279 | | "vimId": "5a5815fa-bf1d-41f4-a824-3e39bbdcebd0", |
280 | | "vimType": "kubernetes", |
281 | | "interfaceInfo": {}, |
282 | | "accessInfo": {}, |
283 | | "extra": {} |
284 | | } |
285 | | ] |
286 | VNF Configurable Properties | |
287 | VNF Instance Description | None |
288 | VNF Instance Name | vnf-b0915924-7e04-4c16-b229-d3dfcc366eee |
289 | VNF Product Name | Sample CNF |
290 | VNF Provider | Company |
291 | VNF Software Version | 1.0 |
292 | VNFD ID | 37391b92-a1d9-44e5-855a-83644cdc3265 |
293 | VNFD Version | 1.0 |
294 | metadata | namespace=default |
295 | vnfPkgId | |
296 +-----------------------------+----------------------------------------------------------------------------------------------------------------------+
297
2982. Verify the CNF resources that were actually created as follows:
299
300 .. code:: bash
301
302 $ kubectl get deployment
303 NAME READY UP-TO-DATE AVAILABLE AGE
304 tacker-test-vdu-localhelm 1/1 1 1 20s
305
306 $ kubectl get pod
307 NAME READY STATUS RESTARTS AGE
308 tacker-test-vdu-localhelm-7b5489f949-fzmc5 1/1 Running 0 24s
309
310 $ helm list
311 NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
312 tacker-test-vdu default 1 2022-06-29 14:54:32.20990033 +0000 UTC deployed localhelm-0.1.0 1.16.0
313
314Terminate
315~~~~~~~~~
316Terminate a VNF by specifying the VNF Instance ID.
317
318.. code:: bash
319
320 $ openstack vnflcm terminate b0915924-7e04-4c16-b229-d3dfcc366eee
321 Terminate request for VNF Instance 'b0915924-7e04-4c16-b229-d3dfcc366eee' has been accepted.
322
323
324.. _ETSI NFV-SOL CNF Deployment by Helm chart: https://docs.openstack.org/tacker/latest/user/mgmt_driver_deploy_k8s_and_cnf_with_helm.html#etsi-nfv-sol-cnf-deployment-by-helm-chart
325.. _INF O2 Service Userguide: https://docs.o-ran-sc.org/projects/o-ran-sc-pti-o2/en/latest/user-guide.html
326.. _Prepare VNF Package: https://docs.openstack.org/tacker/latest/user/mgmt_driver_deploy_k8s_and_cnf_with_helm.html#prepare-vnf-package
327.. _API-Docs: https://docs.o-ran-sc.org/projects/o-ran-sc-smo-o2/en/latest/tacker/api-docs.html