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