blob: 281d828b874f7146c2043842109ba9e41e474c7e [file] [log] [blame]
Scott Bakerfab7c9e2021-07-29 17:12:16 -07001.. vim: syntax=rst
2
Scott Bakerf07ec232022-03-08 12:20:24 -08003.. _roc-developer-guide:
4
Larry Peterson0fa9b362023-08-09 15:15:13 -07005ROC Development
6===============
Scott Bakerfab7c9e2021-07-29 17:12:16 -07007
Larry Petersonbd529682023-10-11 11:56:46 -07008This document assumes familiarity with Kubernetes and Helm, and that a
9Kubernetes/Helm development environment has already been deployed in
10the developer’s work environment (for example, using a mechanism like
11KinD or kubeadm).
Scott Bakerfab7c9e2021-07-29 17:12:16 -070012
Larry Petersonbd529682023-10-11 11:56:46 -070013.. note:: By default, ROC is deployed without security enabled, with no Authentication or Authorization.
Sean Condoneb95cd62021-08-04 19:44:18 +010014 To secure ROC so that the Authentication and Authorization can be tested, follow the Securing ROC
Larry Petersonbd529682023-10-11 11:56:46 -070015 section below :ref:`securing_roc`.
Sean Condoneb95cd62021-08-04 19:44:18 +010016
Scott Bakerfab7c9e2021-07-29 17:12:16 -070017Installing Prerequisites
18------------------------
19
20Atomix and onos-operator must be installed::
21
22 # create necessary namespaces
SeanCondon13596ad2023-05-23 14:01:15 +010023 kubectl create namespace aether
Scott Bakerfab7c9e2021-07-29 17:12:16 -070024
Andy Bavier4c425412021-08-27 14:39:38 -070025 # add repos
26 helm repo add atomix https://charts.atomix.io
27 helm repo add onosproject https://charts.onosproject.org
28 helm repo update
29
Scott Bakerfab7c9e2021-07-29 17:12:16 -070030 # install atomix
SeanCondon13596ad2023-05-23 14:01:15 +010031 export ATOMIX_VERSION=1.1.2
32 helm -n kube-system install atomix atomix/atomix --version $ATOMIX_VERSION
Scott Bakerfab7c9e2021-07-29 17:12:16 -070033
34 # install the onos operator
SeanCondon5e6234c2022-11-30 14:44:05 +000035 ONOS_OPERATOR_VERSION=0.5.6
Sean Condon257687f2021-08-23 11:13:20 +010036 helm install -n kube-system onos-operator onosproject/onos-operator --version $ONOS_OPERATOR_VERSION
Scott Bakerfab7c9e2021-07-29 17:12:16 -070037
Larry Petersonbd529682023-10-11 11:56:46 -070038.. note:: ROC is sensitive to the versions of Atomix and onos-operator installed. The values
SeanCondon13596ad2023-05-23 14:01:15 +010039 shown above are correct for the 2.1.36- versions of the *aether-roc-umbrella*.
Sean Condon257687f2021-08-23 11:13:20 +010040
41.. list-table:: ROC support component version matrix
SeanCondon13596ad2023-05-23 14:01:15 +010042 :widths: 40 20 20 20 20 20
Sean Condon257687f2021-08-23 11:13:20 +010043 :header-rows: 1
44
45 * - ROC Version
SeanCondon13596ad2023-05-23 14:01:15 +010046 - atomix/atomix-controller
47 - atomix/atomix-raft
48 - atomix/atomix-runtime
49 - atomix/atomix
50 - onosproject/onos-operator
Sean Condon70dcf702021-08-24 10:57:29 +010051 * - 1.2.25-1.2.45
Sean Condon257687f2021-08-23 11:13:20 +010052 - 0.6.7
53 - 0.1.8
SeanCondon5e6234c2022-11-30 14:44:05 +000054 - n/a
SeanCondon13596ad2023-05-23 14:01:15 +010055 - n/a
Sean Condon257687f2021-08-23 11:13:20 +010056 - 0.4.8
Zack Williams90578fa2021-11-04 11:57:23 -070057 * - 1.3.0-1.3.10
Sean Condon70dcf702021-08-24 10:57:29 +010058 - 0.6.8
59 - 0.1.9
SeanCondon5e6234c2022-11-30 14:44:05 +000060 - n/a
SeanCondon13596ad2023-05-23 14:01:15 +010061 - n/a
Sean Condon1df1fcf2021-09-20 09:45:39 +010062 - 0.4.10
Zack Williams90578fa2021-11-04 11:57:23 -070063 * - 1.3.11-,1.4.0-
64 - 0.6.8
65 - 0.1.14
SeanCondon5e6234c2022-11-30 14:44:05 +000066 - n/a
SeanCondon13596ad2023-05-23 14:01:15 +010067 - n/a
Zack Williams90578fa2021-11-04 11:57:23 -070068 - 0.4.12
Sean Condon8d55a1e2021-11-11 12:49:00 +000069 * - 1.4.42-
70 - 0.6.8
71 - 0.1.15
SeanCondon5e6234c2022-11-30 14:44:05 +000072 - n/a
SeanCondon13596ad2023-05-23 14:01:15 +010073 - n/a
Sean Condon8d55a1e2021-11-11 12:49:00 +000074 - 0.4.14
Scott Baker6bd3d192022-03-03 14:50:38 -080075 * - 2.0.29-
76 - 0.6.8
77 - 0.1.16
SeanCondon5e6234c2022-11-30 14:44:05 +000078 - n/a
SeanCondon13596ad2023-05-23 14:01:15 +010079 - n/a
Scott Baker6bd3d192022-03-03 14:50:38 -080080 - 0.5.1
SeanCondon909d55b2022-04-25 17:59:46 +010081 * - 2.1.8-
82 - 0.6.9
83 - 0.1.26
SeanCondon5e6234c2022-11-30 14:44:05 +000084 - n/a
SeanCondon13596ad2023-05-23 14:01:15 +010085 - n/a
SeanCondon909d55b2022-04-25 17:59:46 +010086 - 0.5.3
SeanCondon13596ad2023-05-23 14:01:15 +010087 * - 2.1.32-2.1.35
SeanCondon5e6234c2022-11-30 14:44:05 +000088 - n/a
89 - n/a
90 - 0.1.8
SeanCondon13596ad2023-05-23 14:01:15 +010091 - n/a
92 - 0.5.6
93 * - 2.1.36-
94 - n/a
95 - n/a
96 - n/a
97 - 1.1.2
SeanCondon5e6234c2022-11-30 14:44:05 +000098 - 0.5.6
99
Larry Petersonbd529682023-10-11 11:56:46 -0700100.. note:: Changing between atomix and operators in a cluster may cause problems
101 if there are changes in the definition of the CRDs that they
102 include. To fully ensure a clean installation the CRDs should be
103 deleted manually AFTER deleting the old version of atomix or ONOS
104 Operator.
SeanCondon5e6234c2022-11-30 14:44:05 +0000105
Larry Petersonbd529682023-10-11 11:56:46 -0700106Use `kubectl get crds | grep atomix` and `kubectl get crds | grep onos` to see the CRDs present.
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700107
108Verify that these services were installed properly.
SeanCondon13596ad2023-05-23 14:01:15 +0100109You should see pods for *atomix-controller(s)*
SeanCondon909d55b2022-04-25 17:59:46 +0100110*onos-operator-app*, and *onos-operator-topo*.
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700111Execute these commands::
112
Sean Condon257687f2021-08-23 11:13:20 +0100113 helm -n kube-system list
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700114 kubectl -n kube-system get pods | grep -i atomix
115 kubectl -n kube-system get pods | grep -i onos
116
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700117
Zack Williams1ae109e2021-07-27 11:17:04 -0700118Installing the ``aether-roc-umbrella`` Helm chart
119-------------------------------------------------
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700120
121Add the necessary helm repositories::
122
Scott Baker6bd3d192022-03-03 14:50:38 -0800123 helm repo add aether https://charts.aetherproject.org
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700124
Zack Williams1ae109e2021-07-27 11:17:04 -0700125``aether-roc-umbrella`` will bring up the ROC and its services::
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700126
SeanCondon13596ad2023-05-23 14:01:15 +0100127 helm -n aether install aether-roc-umbrella aether/aether-roc-umbrella
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700128
SeanCondon13596ad2023-05-23 14:01:15 +0100129 kubectl wait pod -n aether --for=condition=Ready -l type=config --timeout=300s
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700130
131
Sean Condonf918f642021-08-04 14:32:53 +0100132.. _posting-the-mega-patch:
133
Larry Petersonbd529682023-10-11 11:56:46 -0700134Posting the Mega-Patch
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700135----------------------
136
Larry Petersonbd529682023-10-11 11:56:46 -0700137The ROC usually comes up in a blank state; there are no Enterprises,
138UEs, or other artifacts present in it. The Mega-Patch is an example
139patch that populates the ROC with some sample enterprises, UEs,
140slices, etc.
SeanCondon909d55b2022-04-25 17:59:46 +0100141
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700142Execute the following::
143
144 # launch a port-forward for the API
145 # this will continue to run in the background
SeanCondon909d55b2022-04-25 17:59:46 +0100146
SeanCondon13596ad2023-05-23 14:01:15 +0100147 kubectl -n aether port-forward service/aether-roc-api --address 0.0.0.0 8181:8181 &
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700148
SeanCondon909d55b2022-04-25 17:59:46 +0100149 curl http://localhost:8181/targets
150 # It should show a list of the configure enterprises: [{"name":"defaultent"},{"name":"acme"},{"name":"starbucks"}
151
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700152 git clone https://github.com/onosproject/aether-roc-api.git
153
154 # execute the mega-patch (it will post via CURL to localhost:8181)
Scott Bakerae024102022-02-23 10:55:28 -0800155 bash ~/path/to/aether-roc-api/examples/MEGA_Patch_20.curl
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700156
Larry Petersonbd529682023-10-11 11:56:46 -0700157.. note:: No port-forwarding is necessary to configure Aether
158 OnRamp. Use URL *http://<hostname>:31194/aether-roc-api/*.
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700159
Larry Petersonbd529682023-10-11 11:56:46 -0700160You may wish to customize the mega patch. For example, by default the
161patch configures the ``sdcore-adapter`` to push to
162``sdcore-test-dummy``. You could instead configure it to push to a
163live instantiation of Aether by doing something like this::
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700164
SeanCondon909d55b2022-04-25 17:59:46 +0100165 sed -i 's^http://aether-roc-umbrella-sdcore-test-dummy/v1/config/5g^http://webui.omec.svc.cluster.local:9089/config^g' MEGA_Patch_21.curl
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700166
167 #apply the patch
Scott Bakerae024102022-02-23 10:55:28 -0800168 ./MEGA_Patch_20.curl
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700169
Larry Petersonbd529682023-10-11 11:56:46 -0700170Note that if Aether is installed on a different machine, then port-forwarding may be necessary.
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700171
Larry Petersonbd529682023-10-11 11:56:46 -0700172Expected CURL output from a successful Mega-Patch post will be a UUID.
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700173
Larry Petersonbd529682023-10-11 11:56:46 -0700174You can also verify that the Mega-Patch was successful by going into the
Zack Williams1ae109e2021-07-27 11:17:04 -0700175``aether-roc-gui`` in a browser (see the section on useful port-forwards
Larry Petersonbd529682023-10-11 11:56:46 -0700176below). The GUI may open to a dashboard that is unpopulated. You can use the
Zack Williams1ae109e2021-07-27 11:17:04 -0700177dropdown menu (upper-right hand corner of the screen) to select an object such
Scott Bakerae024102022-02-23 10:55:28 -0800178as Slice and you will see a list of slices.
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700179
180 |ROCGUI|
181
Larry Petersonbd529682023-10-11 11:56:46 -0700182Adding New Enterprises
SeanCondon909d55b2022-04-25 17:59:46 +0100183----------------------
184
Larry Petersonbd529682023-10-11 11:56:46 -0700185Enterprises are stored in `onos-topo` outside of `onos-config` are are
186usually only created by system administrators during the onboarding of
187new customers (tenants) on Aether.
SeanCondon909d55b2022-04-25 17:59:46 +0100188
Larry Petersonbd529682023-10-11 11:56:46 -0700189There is currently no way of adding new Enterprises through the ROC
190GUI or the ROC API. It can be done in the two ways described in the
191following sections.
SeanCondon909d55b2022-04-25 17:59:46 +0100192
Larry Petersonbd529682023-10-11 11:56:46 -0700193Enterprises are specified as Entities using CRDs, and the
194`onos-operator` ensures that these are created as `entitites` inside
195`onos-topo`.
SeanCondon909d55b2022-04-25 17:59:46 +0100196
197To check that the current list of enterprises (as CRDs), the following command may be used::
198
SeanCondon13596ad2023-05-23 14:01:15 +0100199 kubectl -n aether get entities
SeanCondon909d55b2022-04-25 17:59:46 +0100200
Larry Petersonbd529682023-10-11 11:56:46 -0700201and to check that the `onos-operator` does indeed take effect, the ROC
202API endpoint `/targets` can be used to list the `enterprises`.
SeanCondon909d55b2022-04-25 17:59:46 +0100203
204Another option is to use the `onos-cli` pod to query `onos-topo` directly::
205
SeanCondon13596ad2023-05-23 14:01:15 +0100206 kubectl -n aether exec deployment/onos-cli -- onos topo get entities -v
SeanCondon909d55b2022-04-25 17:59:46 +0100207
Larry Petersonbd529682023-10-11 11:56:46 -0700208Adding New Enterprises Through Helm Chart
SeanCondon909d55b2022-04-25 17:59:46 +0100209^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
210
Larry Petersonbd529682023-10-11 11:56:46 -0700211To have an entity added at **start up of the cluster** it can be added
212through the Helm Chart in the `values.yaml` under
213`enterprises`. e.g.::
SeanCondon909d55b2022-04-25 17:59:46 +0100214
215 enterprises:
216 - id: starbucks
217 name: Starbucks Enterprise
218 lat: 52.5150
219 long: 13.3885
220
221This will load the `enterprise` as an Entity CRD through the `onos-operator`.
222
Larry Petersonbd529682023-10-11 11:56:46 -0700223Adding New Enterprises Through `onos-topo`
SeanCondon909d55b2022-04-25 17:59:46 +0100224^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
225
Larry Petersonbd529682023-10-11 11:56:46 -0700226New `enterprises` can be added to a live running system through the
227`onos-topo` command line (bypassing the `onos-operator`). For
228example::
SeanCondon909d55b2022-04-25 17:59:46 +0100229
SeanCondon13596ad2023-05-23 14:01:15 +0100230 kubectl -n aether exec deployment/onos-cli -- \
SeanCondon909d55b2022-04-25 17:59:46 +0100231 onos topo create entity new-enterprise \
232 -a onos.topo.Configurable='{"address”:”sdcore-adapter-v2-1:5150”,”version”:”2.1.x”,”type”:”aether”}' \
233 -a onos.topo.TLSOptions='{"insecure":true}' \
234 -a onos.topo.Asset='{"name”:”New Enterprise”}' \
235 -a onos.topo.MastershipState='{}' \
SeanCondon5e6234c2022-11-30 14:44:05 +0000236 -k enterprise
SeanCondon909d55b2022-04-25 17:59:46 +0100237
Larry Petersonbd529682023-10-11 11:56:46 -0700238Uninstalling the ``aether-roc-umbrella`` Helm Chart
Zack Williams1ae109e2021-07-27 11:17:04 -0700239---------------------------------------------------
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700240
Larry Petersonbd529682023-10-11 11:56:46 -0700241To tear things back down, usually as part of a developer loop prior to
242redeploying again, do the following::
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700243
SeanCondon13596ad2023-05-23 14:01:15 +0100244 helm -n aether del aether-roc-umbrella
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700245
Larry Petersonbd529682023-10-11 11:56:46 -0700246Useful Port Forwards
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700247--------------------
248
Larry Petersonbd529682023-10-11 11:56:46 -0700249Port forwarding is often necessary to allow access to ports inside of
250Kubernetes pods that use ClusterIP addressing. Note that you
251typically need to leave a port-forward running (you can put it in the
252background). Also, If you redeploy the ROC and/or if a pod crashes
253then you might have to restart a port-forward.
SeanCondon909d55b2022-04-25 17:59:46 +0100254
Larry Petersonbd529682023-10-11 11:56:46 -0700255.. note:: No port-forward is necessary with OnRamp. The GUI
256 can be accessed at ``http://<hostname>:31194`` and the API at
257 ``http://<hostname>:31194/aether-roc-api/``.
SeanCondon909d55b2022-04-25 17:59:46 +0100258
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700259The following port-forwards may be useful::
260
261 # aether-roc-api
262
SeanCondon13596ad2023-05-23 14:01:15 +0100263 kubectl -n aether port-forward service/aether-roc-api --address 0.0.0.0 8181:8181
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700264
265 # aether-roc-gui
266
SeanCondon13596ad2023-05-23 14:01:15 +0100267 kubectl -n aether port-forward service/aether-roc-gui-v2-1 --address 0.0.0.0 8183:80
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700268
269 # grafana
270
SeanCondon13596ad2023-05-23 14:01:15 +0100271 kubectl -n aether port-forward service/aether-roc-umbrella-grafana --address 0.0.0.0 8187:80
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700272
Larry Petersonbd529682023-10-11 11:56:46 -0700273.. note:: Internally, the ``aether-roc-gui`` operates a Reverse Proxy
274 on the ``aether-roc-api``. This means that if you have done a
275 ``port-forward`` to ``aether-roc-gui``, say on port ``8183``,
276 there's no need to do another on the ``aether-roc-api``. Instead,
277 you can access the API on ``http://localhost:8183/aether-roc-api``.
Sean Condon257687f2021-08-23 11:13:20 +0100278
Larry Petersonbd529682023-10-11 11:56:46 -0700279Deploying Custom Images
280--------------------------
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700281
282Custom images may be used by editing the values-override.yaml file.
Zack Williams1ae109e2021-07-27 11:17:04 -0700283For example, to deploy a custom ``sdcore-adapter``::
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700284
SeanCondon909d55b2022-04-25 17:59:46 +0100285 sdcore-adapter-v2-1:
Scott Baker6bd3d192022-03-03 14:50:38 -0800286 prometheusEnabled: false
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700287 image:
Scott Baker6bd3d192022-03-03 14:50:38 -0800288 repository: my-private-repo/sdcore-adapter
289 tag: my-tag
290 pullPolicy: Always
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700291
Larry Petersonbd529682023-10-11 11:56:46 -0700292The above example assumes you have published a docker images at
293``my-private-repo/sdcore-adapter:my-tag``. One possible workflow is
294to deploy a local-docker registry and push images to that.
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700295
Larry Petersonbd529682023-10-11 11:56:46 -0700296There are alternatives to using a private docker repository. For
297example, if you are using kubeadm, then you may be able to simply tag
298the image locally. If you’re using KinD, then you can push a local
299image to into the kind cluster::
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700300
301 kind load docker-image sdcore-adapter:my-tag
302
Larry Petersonbd529682023-10-11 11:56:46 -0700303Developing with a Custom onos-config
Scott Bakerabcfc6e2021-09-08 22:37:51 -0700304-------------------------------------
305
Larry Petersonbd529682023-10-11 11:56:46 -0700306The onos-config Helm Chart is responsible for loading model plugins at
307runtime. You can override which plugins it loads, and optionally
308override the image for onos-config as well. For example::
Scott Bakerabcfc6e2021-09-08 22:37:51 -0700309
Scott Baker6bd3d192022-03-03 14:50:38 -0800310 onos-config:
311 image:
312 tag: mytag
313 repository: mydockeraccount/onos-config
314 modelPlugins:
SeanCondon909d55b2022-04-25 17:59:46 +0100315 - name: aether-2
SeanCondon13596ad2023-05-23 14:01:15 +0100316 image: onosproject/aether-2.0.x:2.0.16-aether-2.0.x
SeanCondon909d55b2022-04-25 17:59:46 +0100317 endpoint: localhost
318 port: 5152
319 - name: aether-2-1
SeanCondon13596ad2023-05-23 14:01:15 +0100320 image: onosproject/aether-2.1.x:2.1.16-aether-2.1.x
SeanCondon909d55b2022-04-25 17:59:46 +0100321 endpoint: localhost
322 port: 5153
Scott Bakerabcfc6e2021-09-08 22:37:51 -0700323
Larry Petersonbd529682023-10-11 11:56:46 -0700324In the above example, the onos-config image will be pulled from
325`mydockeraccount`, and it will install two plugins for v2 and v4
326models, from that same docker account.
Scott Bakerabcfc6e2021-09-08 22:37:51 -0700327
Larry Petersonbd529682023-10-11 11:56:46 -0700328Inspecting Logs
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700329---------------
330
Larry Petersonbd529682023-10-11 11:56:46 -0700331Most of the relevant Kubernetes pods are in the aether namespace. The
332names may change from deployment to deployment, so start by getting a
333list of pods::
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700334
SeanCondon13596ad2023-05-23 14:01:15 +0100335 kubectl -n aether get pods
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700336
337Then you can inspect a specific pod/container::
338
SeanCondon13596ad2023-05-23 14:01:15 +0100339 kubectl -n aether logs deployment/sdcore-adapter-v2-1
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700340
Sean Condoneb95cd62021-08-04 19:44:18 +0100341.. _securing_roc:
342
343Securing ROC
344------------
345
SeanCondon13596ad2023-05-23 14:01:15 +0100346Running your own Keycloak Server
347^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
348
Larry Petersonbd529682023-10-11 11:56:46 -0700349.. note:: There is no longer a central keycloak server
350 for development as there was at `keycloak-dev.onlab.us`, so you
351 must run your own own Keycloak server inside of Kubernetes.
SeanCondon13596ad2023-05-23 14:01:15 +0100352
353See `Keycloak README.md <https://gerrit.opencord.org/plugins/gitiles/roc-helm-charts/+/refs/heads/master/keycloak/>`_ for details.
354
Larry Petersonbd529682023-10-11 11:56:46 -0700355When running it should be available at
356*http://localhost:8080/realms/master/.well-known/openid-configuration*.
SeanCondon13596ad2023-05-23 14:01:15 +0100357
Larry Petersonbd529682023-10-11 11:56:46 -0700358.. note:: You can access the Keycloak management page from
359 *http://localhost:8080/admin* but you must login as
360 `admin`. Because of the SSO feature of Keycloak this will affect
361 your Aether ROC GUI login too. To login as two separate users at
362 the same time, use a private browser window for one.
SeanCondon13596ad2023-05-23 14:01:15 +0100363
Larry Petersonbd529682023-10-11 11:56:46 -0700364.. note:: Services inside the cluster (e.g. onos-config) should set
365 the issuer to *https://keycloak/realms/master* on port 80, while
366 the aether-roc-gui should use `http://localhost:8080/realms/master`.
SeanCondon13596ad2023-05-23 14:01:15 +0100367
Larry Petersonbd529682023-10-11 11:56:46 -0700368Enabling Security
369^^^^^^^^^^^^^^^^^^^^^
SeanCondon13596ad2023-05-23 14:01:15 +0100370
Larry Petersonbd529682023-10-11 11:56:46 -0700371When deploying ROC with the ``aether-roc-umbrella`` chart, secure mode
372can be enabled by specifying an OpenID Connect (OIDC) issuer; for example::
Sean Condoneb95cd62021-08-04 19:44:18 +0100373
SeanCondon13596ad2023-05-23 14:01:15 +0100374 helm -n aether install aether-roc-umbrella aether/aether-roc-umbrella \
375 --set onos-config.openidc.issuer=http://keycloak/realms/master \
376 --set onos-config.openpolicyagent.enabled=true \
377 --set onos-config.openpolicyagent.regoConfigMap=aether-roc-umbrella-opa-rbac \
378 --set aether-roc-api.openidc.issuer=http://keycloak/realms/master \
379 --set aether-roc-gui-v2-1.openidc.issuer=http://localhost:8080/realms/master \
380 --set prom-label-proxy-acc.config.openidc.issuer=http://keycloak/realms/master \
381 --set prom-label-proxy-amp.config.openidc.issuer=http://keycloak/realms/master
Sean Condoneb95cd62021-08-04 19:44:18 +0100382
Larry Petersonbd529682023-10-11 11:56:46 -0700383The choice of OIDC issuer in this case is the **local** Keycloak
384server at *http://keycloak* inside the `aether` namespace.
Sean Condon9e182f62021-12-06 17:35:53 -0800385
Sean Condon9e182f62021-12-06 17:35:53 -0800386Production Environment
387^^^^^^^^^^^^^^^^^^^^^^
Larry Petersonbd529682023-10-11 11:56:46 -0700388
389In a production environment, the public Aether Keycloak (with its LDAP
390server populated with real Aether users and groups) should be used.
391See `public keycloak
392<https://keycloak.opennetworking.org/auth/realms/master/.well-known/openid-configuration>`_
393for more details.
Sean Condon948aeaa2021-09-29 12:08:30 +0100394
395.. note:: Your RBAC access to ROC will be limited by the groups you belong to in its LDAP store.
396
Sean Condoneb95cd62021-08-04 19:44:18 +0100397Role Based Access Control
Sean Condon9e182f62021-12-06 17:35:53 -0800398^^^^^^^^^^^^^^^^^^^^^^^^^
Zack Williams1ae109e2021-07-27 11:17:04 -0700399
Larry Petersonbd529682023-10-11 11:56:46 -0700400When secured, access to the configuration in ROC is limited by the
401**groups** that a user belongs to.
Sean Condoneb95cd62021-08-04 19:44:18 +0100402
403* **AetherROCAdmin** - users in this group have full read **and** write access to all configuration.
404* *<enterprise>* - users in a group the lowercase name of an enterprise, will have **read** access to that enterprise.
405* **EnterpriseAdmin** - users in this group will have read **and** write access the enterprise they belong to.
406
Sean Condoneb95cd62021-08-04 19:44:18 +0100407
408Requests to a Secure System
Sean Condon9e182f62021-12-06 17:35:53 -0800409^^^^^^^^^^^^^^^^^^^^^^^^^^^
Zack Williams1ae109e2021-07-27 11:17:04 -0700410
Larry Petersonbd529682023-10-11 11:56:46 -0700411When configuration is retrieved or updated through *aether-config*, a
412Bearer Token in the form of a JSON Web Token (JWT) issued by the
413selected OIDC Issuer server must accompany the request as an
414Authorization Header.
Sean Condoneb95cd62021-08-04 19:44:18 +0100415
Larry Petersonbd529682023-10-11 11:56:46 -0700416This applies to both the REST interface of ``aether-roc-api`` **and**
417the *gnmi* interface of ``aether-config``.
Sean Condoneb95cd62021-08-04 19:44:18 +0100418
Larry Petersonbd529682023-10-11 11:56:46 -0700419In the Aether ROC, a Bearer Token can be generated by logging in and
420selecting API Key from the menu. This pops up a window with a copy
421button, where the key can be copied.
Sean Condoneb95cd62021-08-04 19:44:18 +0100422
Larry Petersonbd529682023-10-11 11:56:46 -0700423Alternatively with Keycloak a Token may be requested programmatically
424through the Keycloak API::
Sean Condon8d55a1e2021-11-11 12:49:00 +0000425
SeanCondon13596ad2023-05-23 14:01:15 +0100426 curl --location --request POST 'http://localhost:8080/realms/master/protocol/openid-connect/token' \
Sean Condon8d55a1e2021-11-11 12:49:00 +0000427 --header 'Content-Type: application/x-www-form-urlencoded' \
428 --data-urlencode 'grant_type=password' \
429 --data-urlencode 'client_id=aether-roc-gui' \
430 --data-urlencode 'username=alicea' \
431 --data-urlencode 'password=password' \
Scott Baker6bd3d192022-03-03 14:50:38 -0800432 --data-urlencode 'scope=openid profile email groups' | jq "{access_token}"
Sean Condon8d55a1e2021-11-11 12:49:00 +0000433
434
Sean Condoneb95cd62021-08-04 19:44:18 +0100435The key will expire after 24 hours.
436
437.. image:: images/aether-roc-gui-copy-api-key.png
438 :width: 580
439 :alt: Aether ROC GUI allows copying of API Key to clipboard
440
441Accessing the REST interface from a tool like Postman, should include this Auth token.
442
443.. image:: images/postman-auth-token.png
444 :width: 930
445 :alt: Postman showing Authentication Token pasted in
446
447Logging
Zack Williams1ae109e2021-07-27 11:17:04 -0700448"""""""
449
Sean Condoneb95cd62021-08-04 19:44:18 +0100450The logs of *aether-config* will contain the **username** and **timestamp** of
451any **gnmi** call when security is enabled.
452
453.. image:: images/aether-config-log.png
454 :width: 887
455 :alt: aether-config log message showing username and timestamp
456
Sean Condon435be9a2021-08-06 14:28:37 +0100457Accessing GUI from an external system
Zack Williams1ae109e2021-07-27 11:17:04 -0700458"""""""""""""""""""""""""""""""""""""
459
Sean Condon435be9a2021-08-06 14:28:37 +0100460To access the ROC GUI from a computer outside the Cluster machine using *port-forwarding* then
461it is necessary to:
462
463* Ensure that all *port-forward*'s have **--address=0.0.0.0**
464* Add to the IP address of the cluster machine to the **/etc/hosts** of the outside computer as::
465
Sean Condon948aeaa2021-09-29 12:08:30 +0100466 <ip address of cluster> k3u-keycloak aether-roc-gui
SeanCondon13596ad2023-05-23 14:01:15 +0100467* Verify that you can access the Keycloak server by its name *http://localhost:8080/realms/master/.well-known/openid-configuration*
Zack Williams1ae109e2021-07-27 11:17:04 -0700468* Access the GUI through the hostname (rather than ip address) ``http://aether-roc-gui:8183``
Sean Condon435be9a2021-08-06 14:28:37 +0100469
Sean Condoneb95cd62021-08-04 19:44:18 +0100470Troubleshooting Secure Access
Zack Williams1ae109e2021-07-27 11:17:04 -0700471"""""""""""""""""""""""""""""
472
Sean Condoneb95cd62021-08-04 19:44:18 +0100473While every effort has been made to ensure that securing Aether is simple and effective,
474some difficulties may arise.
475
Sean Condon948aeaa2021-09-29 12:08:30 +0100476One of the most important steps is to validate that the OIDC Issuer (Keycloak server) can be reached
Sean Condoneb95cd62021-08-04 19:44:18 +0100477from the browser. The **well_known** URL should be available and show the important endpoints are correct.
478
Sean Condon948aeaa2021-09-29 12:08:30 +0100479.. image:: images/keycloak-389-umbrella-well-known.png
Sean Condoneb95cd62021-08-04 19:44:18 +0100480 :width: 580
Sean Condon948aeaa2021-09-29 12:08:30 +0100481 :alt: Keycloak Well Known page
Sean Condoneb95cd62021-08-04 19:44:18 +0100482
483If logged out of the Browser when accessing the Aether ROC GUI, accessing any page of the application should
Sean Condon948aeaa2021-09-29 12:08:30 +0100484redirect to the Keycloak login page.
Sean Condoneb95cd62021-08-04 19:44:18 +0100485
Sean Condon948aeaa2021-09-29 12:08:30 +0100486.. image:: images/keycloak-ldap-login-page.png
Sean Condoneb95cd62021-08-04 19:44:18 +0100487 :width: 493
Sean Condon948aeaa2021-09-29 12:08:30 +0100488 :alt: Keycloak Login page
Sean Condoneb95cd62021-08-04 19:44:18 +0100489
490When logged in the User details can be seen by clicking the User's name in the drop down menu.
491This shows the **groups** that the user belongs to, and can be used to debug RBAC issues.
492
493.. image:: images/aether-roc-gui-user-details.png
494 :width: 700
495 :alt: User Details page
496
Sean Condon948aeaa2021-09-29 12:08:30 +0100497When you sign out of the ROC GUI, if you are not redirected to the Keycloak Login Page,
Sean Condoneb95cd62021-08-04 19:44:18 +0100498you should check the Developer Console of the browser. The console should show the correct
Sean Condon948aeaa2021-09-29 12:08:30 +0100499OIDC issuer (Keycloak server), and that Auth is enabled.
Sean Condoneb95cd62021-08-04 19:44:18 +0100500
501.. image:: images/aether-roc-gui-console-loggedin.png
502 :width: 418
503 :alt: Browser Console showing correct configuration
504
Sean Condon8d55a1e2021-11-11 12:49:00 +0000505
Scott Bakerb46a6ed2021-08-02 14:03:10 -0700506ROC Data Model Conventions and Requirements
507-------------------------------------------
508
Larry Petersonbd529682023-10-11 11:56:46 -0700509The Mega-Patch described above will bring up a fully compliant sample data model.
Scott Bakerb46a6ed2021-08-02 14:03:10 -0700510However, it may be useful to bring up your own data model, customized to a different
511site of sites. This subsection documents conventions and requirements for the Aether
Zack Williams1ae109e2021-07-27 11:17:04 -0700512modeling within the ROC.
Scott Bakerb46a6ed2021-08-02 14:03:10 -0700513
514The ROC models must be configured with the following:
515
516* A default enterprise with the id `defaultent`.
Scott Bakerb46a6ed2021-08-02 14:03:10 -0700517* A default site with the id `defaultent-defaultsite`.
Scott Bakerae024102022-02-23 10:55:28 -0800518 This site should be within the `defaultent` enterprise.
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700519
520.. |ROCGUI| image:: images/rocgui.png
Sean Condoneb95cd62021-08-04 19:44:18 +0100521 :width: 945
Scott Bakerae024102022-02-23 10:55:28 -0800522 :alt: ROC GUI showing list of Slices