Release image version 1.1.2
[ric-app/hw-go.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 and Deployment of Hw-go xApp
8 =======================================
9
10 .. contents::
11   :depth: 3
12   :local:
13
14 Onboarding of hw-go using dms_cli tool
15 --------------------------------------
16
17 `dms_cli` offers rich set of command line utility to onboard *hw-go* xapp
18 to `chartmuseme`.
19
20 First checkout the `hw-go <https://gerrit.o-ran-sc.org/r/admin/repos/ric-app/hw-go>`_ repository from gerrit.
21
22 .. code-block:: bash
23
24   $ git clone "https://gerrit.o-ran-sc.org/r/ric-app/hw-go"
25
26
27 `hw-go` has following folder structure
28
29 .. code-block:: bash
30
31   ├── Dockerfile
32   ├── INFO.yaml
33   ├── LICENSES.txt
34   ├── README.md
35   ├── config
36   │   ├── config-file.json           // descriptor for hw-go
37   │   ├── schema.json                // schema for controls section of descriptor
38   │   └── uta_rtg.rt                 // local route file
39   ├── docs
40   ├── go.mod
41   ├── go.sum
42   └── hwApp.go
43
44
45 For onboarding `hw-go` 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
46 configure `dms_cli`.
47
48 Once `dms_cli` is availabe we can proceed to onboarding procedure.
49
50 configure the `export CHART_REPO_URL` to point `chartmuseme`.
51
52 .. code-block:: bash
53
54   $export CHART_REPO_URL=http://<service-ricplt-xapp-onboarder-http.ricplt>:8080
55
56 check if `dms_cli` working fine.
57
58 .. code-block:: bash
59
60   $ dms_cli health
61   True
62
63 Now move to `config` folder to initiate onboarding.
64
65 .. code-block:: bash
66
67   $ cd config
68   $ dms_cli onboard --config_file_path=config-file.json --shcema_file_path=schema.json
69   httpGet:
70     path: '{{ index .Values "readinessProbe" "httpGet" "path" | toJson }}'
71     port: '{{ index .Values "readinessProbe" "httpGet" "port" | toJson }}'
72   initialDelaySeconds: '{{ index .Values "readinessProbe" "initialDelaySeconds" | toJson }}'
73   periodSeconds: '{{ index .Values "readinessProbe" "periodSeconds" | toJson }}'
74
75   httpGet:
76     path: '{{ index .Values "livenessProbe" "httpGet" "path" | toJson }}'
77     port: '{{ index .Values "livenessProbe" "httpGet" "port" | toJson }}'
78   initialDelaySeconds: '{{ index .Values "livenessProbe" "initialDelaySeconds" | toJson }}'
79   periodSeconds: '{{ index .Values "livenessProbe" "periodSeconds" | toJson }}'
80
81   {
82       "status": "Created"
83   }
84
85 Check if `hw-go` is onborded
86
87 .. code-block:: bash
88
89   $ curl --location --request GET "http://<appmgr>:32080/onboard/api/v1/charts"  --header 'Content-Type: application/json'
90
91   {
92       "hw-go": [
93           {
94               "name": "hw-go",
95               "version": "1.0.0",
96               "description": "Standard xApp Helm Chart",
97               "apiVersion": "v1",
98               "appVersion": "1.0",
99               "urls": [
100                   "charts/hw-go-1.0.0.tgz"
101               ],
102               "created": "2021-06-24T18:57:41.98056196Z",
103               "digest": "14a484d9a394ed34eab66e5241ec33e73be8fa70a2107579d19d037f2adf57a0"
104           }
105       ]
106   }
107
108 If we would wish to download the charts then we can perform following curl operation :
109
110 .. code-block:: bash
111
112   curl --location --request GET "http://<appmgr>:32080/onboard/api/v1/charts/xapp/hw-go/ver/1.0.0"  --header 'Content-Type: application/json' --output hw-go.tgz
113
114 Now the onboarding is done.
115
116 Deployment of hw-go
117 -------------------
118
119 Once charts are available we can deploy the the `hw-go` using following curl command :
120
121 .. code-block:: bash
122
123   $ curl --location --request POST "http://<appmgr>:32080/appmgr/ric/v1/xapps"  --header 'Content-Type: application/json'  --data-raw '{"xappName": "hw-go", "helmVersion": "1.0.0"}'
124   {"instances":null,"name":"hw-go","status":"deployed","version":"1.0"}
125
126 Deployment will be done in `ricxapp` ns :
127
128 .. code-block:: bash
129
130   # kubectl get po -n ricxapp
131   NAME                             READY   STATUS    RESTARTS   AGE
132   ricxapp-hw-go-55ff7549df-kpj6k   1/1     Running   0          2m
133
134   # kubectl get svc -n ricxapp
135   NAME                         TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)             AGE
136   aux-entry                    ClusterIP   IP1             <none>        80/TCP,443/TCP      73d
137   service-ricxapp-hw-go-http   ClusterIP   IP2             <none>        8080/TCP            103m
138   service-ricxapp-hw-go-rmr    ClusterIP   IP3             <none>        4560/TCP,4561/TCP   103m
139
140 Now we can query to appmgr to get list of all the deployed xapps :
141
142 .. code-block:: bash
143
144   # curl http://service-ricplt-appmgr-http.ricplt:8080/ric/v1/xapps | jq .
145     % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
146                                   Dload  Upload   Total   Spent    Left  Speed
147   100   347  100   347    0     0    578      0 --:--:-- --:--:-- --:--:--   579
148   [
149     {
150       "instances": [
151         {
152           "ip": "service-ricxapp-hw-go-rmr.ricxapp",
153           "name": "hw-go-55ff7549df-kpj6k",
154           "policies": [
155             1
156           ],
157           "port": 4560,
158           "rxMessages": [
159             "RIC_SUB_RESP",
160             "A1_POLICY_REQ",
161             "RIC_HEALTH_CHECK_REQ"
162           ],
163           "status": "running",
164           "txMessages": [
165             "RIC_SUB_REQ",
166             "A1_POLICY_RESP",
167             "A1_POLICY_QUERY",
168             "RIC_HEALTH_CHECK_RESP"
169           ]
170         }
171       ],
172       "name": "hw-go",
173       "status": "deployed",
174       "version": "1.0"
175     }
176   ]
177
178 Logs from `hw-go` :
179
180 .. code-block:: bash
181
182   # kubectl  logs ricxapp-hw-go-55ff7549df-kpj6k -n ricxapp
183   {"ts":1624562552123,"crit":"INFO","id":"hw-app","mdc":{"time":"2021-06-24T19:22:32"},"msg":"Using config file: config/config-file.json"}
184   {"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"}
185   {"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[]}"}
186   {"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[]}"}
187   1624562552 6/RMR [INFO] ric message routing library on SI95 p=0 mv=3 flg=00 (fd4477a 4.5.2 built: Jan 21 2021)
188   {"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=[]"}
189   {"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[]}"}
190   {"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[]}"}
191   {"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[]}"}
192   {"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[]}"}
193   {"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"}
194   {"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 ..."}
195   {"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..."}
196   {"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"}
197   1624562553 6/RMR [INFO] sends: ts=1624562553 src=service-ricxapp-hw-go-rmr.ricxapp:0 target=localhost:4591 open=0 succ=0 fail=0 (hard=0 soft=0)
198   1624562553 6/RMR [INFO] sends: ts=1624562553 src=service-ricxapp-hw-go-rmr.ricxapp:0 target=localhost:4560 open=0 succ=0 fail=0 (hard=0 soft=0)
199   1624562553 6/RMR [INFO] sends: ts=1624562553 src=service-ricxapp-hw-go-rmr.ricxapp:0 target=service-ricplt-a1mediator-rmr.ricplt:4562 open=0 succ=0 fail=0 (hard=0 soft=0)
200   RMR is ready now ...
201   {"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-go' is not ready yet, waiting ..."}
202   {"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-go' is not ready yet, waiting ..."}
203
204 Here we are done with the onboaring and deployment of `hw-go`.
205