Release image version 1.1.1
[ric-app/hw-python.git] / docs / onboard-and-deploy.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. SPDX-License-Identifier: CC-BY-4.0
3 .. Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved.Copyright (C) 2021
4
5 .. _Deployment Guide:
6
7 ### Onboarding of hw-python using dms_cli tool
8
9 `dms_cli` offers rich set of command line utility to onboard `hw-python` xapp
10 to `chartmuseme`.
11
12 First checkout the [hw-python](https://gerrit.o-ran-sc.org/r/ric-app/hw-python) repository from gerrit.
13
14 .. code-block:: bash
15     git clone "https://gerrit.o-ran-sc.org/r/ric-app/hw-python"
16
17 `hw-python` has following folder structure
18 .. code-block:: bash
19     +---docs
20     |
21     +---hw_python.egg-info
22     |
23     +---init
24     |       config-file.json # descriptor for xapp deployment.
25     |       init_script.py
26     |       test_route.rt
27     |       schema.json #schema for validating the config-file.json
28     |
29     +---releases
30     |
31     +---resources
32     |
33     +---src
34
35 For onboarding `hw-python` make sure that `dms_cli` and helm3 is installed. One can follow [documentation](https://docs.o-ran-sc.org/projects/o-ran-sc-it-dep/en/latest/installation-guides.html#ric-applications) to
36 configure `dms_cli`.
37
38 Once `dms_cli` is availabe we can proceed to onboarding proceure.
39
40 configure the `export CHART_REPO_URL` to point `chartmuseme`.
41 .. code-block:: bash
42     $export CHART_REPO_URL=http://<service-ricplt-xapp-onboarder-http.ricplt>:8080
43
44
45 check if `dms_cli` working fine.
46 .. code-block:: bash
47     $ dms_cli health
48     True
49
50
51 Now move to `init` folder to initiate onboarding.
52
53 .. code-block:: bash
54     $ cd init
55
56     $ dms_cli onboard --config_file_path=config-file.json --shcema_file_path=schema.json
57     httpGet:
58     path: '{{ index .Values "readinessProbe" "httpGet" "path" | toJson }}'
59     port: '{{ index .Values "readinessProbe" "httpGet" "port" | toJson }}'
60     initialDelaySeconds: '{{ index .Values "readinessProbe" "initialDelaySeconds" | toJson }}'
61     periodSeconds: '{{ index .Values "readinessProbe" "periodSeconds" | toJson }}'
62
63     httpGet:
64     path: '{{ index .Values "livenessProbe" "httpGet" "path" | toJson }}'
65     port: '{{ index .Values "livenessProbe" "httpGet" "port" | toJson }}'
66     initialDelaySeconds: '{{ index .Values "livenessProbe" "initialDelaySeconds" | toJson }}'
67     periodSeconds: '{{ index .Values "livenessProbe" "periodSeconds" | toJson }}'
68
69     {
70     "status": "Created"
71     }
72
73
74 Check if `hw-python` is onborded
75 .. code-block:: bash
76     $ curl --location --request GET "http://<appmgr>:32080/onboard/api/v1/charts"  --header 'Content-Type: application/json'
77     {
78         "hw-python": [
79             {
80             "name": "hw-python",
81             "version": "1.0.0",
82             "description": "Standard xApp Helm Chart",
83             "apiVersion": "v1",
84             "appVersion": "1.0",
85             "urls": [
86                 "charts/hw-python-1.0.0.tgz"
87             ],
88             "created": "2021-07-05T15:07:34.518377486Z",
89             "digest": "e9db874d35154643a2c6f26dd52929c9dcf143f165683c03d07518bb0c2d768d"
90             }
91         ],
92     "hw-python": [
93         {
94             "name": "hw-python",
95             "version": "1.0.0",
96             "description": "Standard xApp Helm Chart",
97             "apiVersion": "v1",
98             "appVersion": "1.0",
99             "urls": [
100                 "charts/hw-python-1.0.0.tgz"
101             ],
102             "created": "2021-07-05T15:20:13.965653743Z",
103             "digest": "975b1da1f8669e8ed1b1e5be809e7cf4841ef33abcb88207bc3a735e9b543a9a"
104         }
105     ]
106     }
107
108
109 If we would wish to download the charts then we can perform following curl operation :
110
111 .. code-block:: bash
112 curl --location --request GET "http://<appmgr>:32080/onboard/api/v1/charts/xapp/hw-python/ver/1.0.0"  --header 'Content-Type: application/json' --output hw-python.tgz
113
114 The downloaded folder has the deployment files for hw-python
115 .. code-block:: bash
116     tar -xvzf hw-python.tgz
117     hw-python/Chart.yaml
118     hw-python/values.yaml
119     hw-python/templates/_helpers.tpl
120     hw-python/templates/appconfig.yaml
121     hw-python/templates/appenv.yaml
122     hw-python/templates/deployment.yaml
123     hw-python/templates/service-http.yaml
124     hw-python/templates/service-rmr.yaml
125     hw-python/config/config-file.json
126     hw-python/descriptors/schema.json
127
128 ```
129
130 Now the onboarding is done.
131
132 ### Deployment of hw-python
133
134 Once charts are available we can deploy the the `hw-python` using following curl command :
135
136 .. code-block:: bash
137     $ curl --location --request POST "http://<appmgr>:32080/appmgr/ric/v1/xapps"  --header 'Content-Type: application/json'  --data-raw '{"xappName": "hw-python", "helmVersion": "1.0.0"}'
138     {"instances":null,"name":"hw-python","status":"deployed","version":"1.0"}
139
140
141 Deployment will be done in `ricxapp` ns :
142
143 ```
144 # kubectl get pods -n ricxapp
145 NAME                                 READY   STATUS    RESTARTS   AGE
146 ricxapp-hw-python-64b5447dcc-mbt5w   1/1     Running   0          5m45s
147
148        CLUSTER-IP       EXTERNAL-IP   PORT(S)             AGE
149 aux-entry                        ClusterIP   10.111.35.76     <none>        80/TCP,443/TCP      9d
150 service-ricxapp-hw-python-http   ClusterIP   10.104.223.245   <none>        8080/TCP            6m23s
151 service-ricxapp-hw-python-rmr    ClusterIP   10.103.243.21    <none>        4560/TCP,4561/TCP   6m23s
152
153 ```
154
155 Now we can query to appmgr to get list of all the deployed xapps :
156
157 ```
158 # curl http://service-ricplt-appmgr-http.ricplt:8080/ric/v1/xapps | jq .
159   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
160                                  Dload  Upload   Total   Spent    Left  Speed
161 100   347  100   347    0     0    578      0 --:--:-- --:--:-- --:--:--   579
162 [
163   {
164     "instances": [
165       {
166         "ip": "service-ricxapp-hw-python-rmr.ricxapp",
167         "name": "hw-python-55ff7549df-kpj6k",
168         "policies": [
169           1
170         ],
171         "port": 4560,
172         "rxMessages": [
173           "RIC_SUB_RESP",
174           "A1_POLICY_REQ",
175           "RIC_HEALTH_CHECK_REQ"
176         ],
177         "status": "running",
178         "txMessages": [
179           "RIC_SUB_REQ",
180           "A1_POLICY_RESP",
181           "A1_POLICY_QUERY",
182           "RIC_HEALTH_CHECK_RESP"
183         ]
184       }
185     ],
186     "name": "hw-python",
187     "status": "deployed",
188     "version": "1.0"
189   }
190 ]
191
192 ```
193 Logs from `hw-python` :
194
195 ```
196 # kubectl  logs ricxapp-hw-python-55ff7549df-kpj6k -n ricxapp
197 {"ts":1624562552123,"crit":"INFO","id":"hw-app","mdc":{"time":"2021-06-24T19:22:32"},"msg":"Using config file: config/config-file.json"}
198 {"ts":1624562552124,"crit":"INFO","id":"hw-app","mdc":{"CONTAINER_NAME":"","HOST_NAME":"","PID":"6","POD_NAME":"","SERVICE_NAME":"","SYSTEM_NAME":"","time":"2021-06-24T19:22:32"},"msg":"Serving metrics on: url=/ric/v1/metrics namespace=ricxapp"}
199 {"ts":1624562552133,"crit":"INFO","id":"hw-app","mdc":{"CONTAINER_NAME":"","HOST_NAME":"","PID":"6","POD_NAME":"","SERVICE_NAME":"","SYSTEM_NAME":"","time":"2021-06-24T19:22:32"},"msg":"Register new counter with opts: {ricxapp SDL Stored The total number of stored SDL transactions map[]}"}
200 {"ts":1624562552133,"crit":"INFO","id":"hw-app","mdc":{"CONTAINER_NAME":"","HOST_NAME":"","PID":"6","POD_NAME":"","SERVICE_NAME":"","SYSTEM_NAME":"","time":"2021-06-24T19:22:32"},"msg":"Register new counter with opts: {ricxapp SDL StoreError The total number of SDL store errors map[]}"}
201 1624562552 6/RMR [INFO] ric message routing library on SI95 p=0 mv=3 flg=00 (fd4477a 4.5.2 built: Jan 21 2021)
202 {"ts":1624562552140,"crit":"INFO","id":"hw-app","mdc":{"CONTAINER_NAME":"","HOST_NAME":"","HWApp":"0.0.1","PID":"6","POD_NAME":"","SERVICE_NAME":"","SYSTEM_NAME":"","time":"2021-06-24T19:22:32"},"msg":"new rmrClient with parameters: ProtPort=0 MaxSize=0 ThreadType=0 StatDesc=RMR LowLatency=false FastAck=false Policies=[]"}
203 {"ts":1624562552140,"crit":"INFO","id":"hw-app","mdc":{"CONTAINER_NAME":"","HOST_NAME":"","HWApp":"0.0.1","PID":"6","POD_NAME":"","SERVICE_NAME":"","SYSTEM_NAME":"","time":"2021-06-24T19:22:32"},"msg":"Register new counter with opts: {ricxapp RMR Transmitted The total number of transmited RMR messages map[]}"}
204 {"ts":1624562552140,"crit":"INFO","id":"hw-app","mdc":{"CONTAINER_NAME":"","HOST_NAME":"","HWApp":"0.0.1","PID":"6","POD_NAME":"","SERVICE_NAME":"","SYSTEM_NAME":"","time":"2021-06-24T19:22:32"},"msg":"Register new counter with opts: {ricxapp RMR Received The total number of received RMR messages map[]}"}
205 {"ts":1624562552140,"crit":"INFO","id":"hw-app","mdc":{"CONTAINER_NAME":"","HOST_NAME":"","HWApp":"0.0.1","PID":"6","POD_NAME":"","SERVICE_NAME":"","SYSTEM_NAME":"","time":"2021-06-24T19:22:32"},"msg":"Register new counter with opts: {ricxapp RMR TransmitError The total number of RMR transmission errors map[]}"}
206 {"ts":1624562552140,"crit":"INFO","id":"hw-app","mdc":{"CONTAINER_NAME":"","HOST_NAME":"","HWApp":"0.0.1","PID":"6","POD_NAME":"","SERVICE_NAME":"","SYSTEM_NAME":"","time":"2021-06-24T19:22:32"},"msg":"Register new counter with opts: {ricxapp RMR ReceiveError The total number of RMR receive errors map[]}"}
207 {"ts":1624562552140,"crit":"INFO","id":"hw-app","mdc":{"CONTAINER_NAME":"","HOST_NAME":"","HWApp":"0.0.1","PID":"6","POD_NAME":"","SERVICE_NAME":"","SYSTEM_NAME":"","time":"2021-06-24T19:22:32"},"msg":"Xapp started, listening on: :8080"}
208 {"ts":1624562552140,"crit":"INFO","id":"hw-app","mdc":{"CONTAINER_NAME":"","HOST_NAME":"","HWApp":"0.0.1","PID":"6","POD_NAME":"","SERVICE_NAME":"","SYSTEM_NAME":"","time":"2021-06-24T19:22:32"},"msg":"rmrClient: Waiting for RMR to be ready ..."}
209 {"ts":1624562553140,"crit":"INFO","id":"hw-app","mdc":{"CONTAINER_NAME":"","HOST_NAME":"","HWApp":"0.0.1","PID":"6","POD_NAME":"","SERVICE_NAME":"","SYSTEM_NAME":"","time":"2021-06-24T19:22:33"},"msg":"rmrClient: RMR is ready after 1 seconds waiting..."}
210 {"ts":1624562553141,"crit":"INFO","id":"hw-app","mdc":{"CONTAINER_NAME":"","HOST_NAME":"","HWApp":"0.0.1","PID":"6","POD_NAME":"","SERVICE_NAME":"","SYSTEM_NAME":"","time":"2021-06-24T19:22:33"},"msg":"xApp ready call back received"}
211 1624562553 6/RMR [INFO] sends: ts=1624562553 src=service-ricxapp-hw-python-rmr.ricxapp:0 target=localhost:4591 open=0 succ=0 fail=0 (hard=0 soft=0)
212 1624562553 6/RMR [INFO] sends: ts=1624562553 src=service-ricxapp-hw-python-rmr.ricxapp:0 target=localhost:4560 open=0 succ=0 fail=0 (hard=0 soft=0)
213 1624562553 6/RMR [INFO] sends: ts=1624562553 src=service-ricxapp-hw-python-rmr.ricxapp:0 target=service-ricplt-a1mediator-rmr.ricplt:4562 open=0 succ=0 fail=0 (hard=0 soft=0)
214 RMR is ready now ...
215 {"ts":1624562557140,"crit":"INFO","id":"hw-app","mdc":{"CONTAINER_NAME":"","HOST_NAME":"","HWApp":"0.0.1","PID":"6","POD_NAME":"","SERVICE_NAME":"","SYSTEM_NAME":"","time":"2021-06-24T19:22:37"},"msg":"Application='hw-python' is not ready yet, waiting ..."}
216 {"ts":1624562562141,"crit":"INFO","id":"hw-app","mdc":{"CONTAINER_NAME":"","HOST_NAME":"","HWApp":"0.0.1","PID":"6","POD_NAME":"","SERVICE_NAME":"","SYSTEM_NAME":"","time":"2021-06-24T19:22:42"},"msg":"Application='hw-python' is not ready yet, waiting ..."}
217 {"ts":1624562567141,"crit":"INFO","id":"hw-app","mdc":{"CONTAINER_NAME":"","HOST_NAME":"","HWApp":"0.0.1","PID":"6","POD_NAME":"","SERVICE_NAME":"","SYSTEM_NAME":"","time":"2021-06-24T19:22:47"},"msg":"Application='hw-python' is not ready yet, waiting ..."}
218 {"ts":1624562567370,"crit":"INFO","id":"hw-app","mdc":{"CONTAINER_NAME":"","HOST_NAME":"","HWApp":"0.0.1","PID":"6","POD_NAME":"","SERVICE_NAME":"","SYSTEM_NAME":"","time":"2021-06-24T19:22:47"},"msg":"restapi: method=GET url=/ric/v1/health/ready"}
219 {"ts":1624562569766,"crit":"INFO","id":"hw-app","mdc":{"CONTAINER_NAME":"","HOST_NAME":"","HWApp":"0.0.1","PID":"6","POD_NAME":"","SERVICE_NAME":"","SYSTEM_NAME":"","time":"2021-06-24T19:22:49"},"msg":"restapi: method=GET url=/ric/v1/health/alive"}
220 ```
221
222 Here we are done with the onboaring and deployment of `hw-python`.