blob: fc2b282bd7e0ff60c54f6fba6ee22febea1ac826 [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
Scott Bakerfab7c9e2021-07-29 17:12:16 -07005Aether ROC Developer Guide
6==========================
7
8Background / Development Environment
9------------------------------------
10
11This document assumes familiarity with Kubernetes and Helm, and that a Kubernetes/Helm development
12environment has already been deployed in the developer’s work environment.
Zack Williams1ae109e2021-07-27 11:17:04 -070013
14This development environment can use any of a number of potential mechanisms -- including KinD, kubeadm, etc.
15
Scott Bakerfab7c9e2021-07-29 17:12:16 -070016The Aether-in-a-Box script is one potential way to setup a development environment, but not the only way.
17As an alternative to the developer’s local machine, a remote environment can be set up, for example on
Zack Williams1ae109e2021-07-27 11:17:04 -070018cloud infrastructure such as Cloudlab.
Scott Bakerfab7c9e2021-07-29 17:12:16 -070019
Sean Condoneb95cd62021-08-04 19:44:18 +010020.. note:: When ROC is deployed it is unsecured by default, with no Authentication or Authorization.
21 To secure ROC so that the Authentication and Authorization can be tested, follow the Securing ROC
22 guide below :ref:`securing_roc`
23
Scott Bakerfab7c9e2021-07-29 17:12:16 -070024Installing Prerequisites
25------------------------
26
27Atomix and onos-operator must be installed::
28
29 # create necessary namespaces
30 kubectl create namespace micro-onos
31
Andy Bavier4c425412021-08-27 14:39:38 -070032 # add repos
33 helm repo add atomix https://charts.atomix.io
34 helm repo add onosproject https://charts.onosproject.org
35 helm repo update
36
Scott Bakerfab7c9e2021-07-29 17:12:16 -070037 # install atomix
Sean Condon70dcf702021-08-24 10:57:29 +010038 export ATOMIX_CONTROLLER_VERSION=0.6.8
Sean Condon257687f2021-08-23 11:13:20 +010039 helm -n kube-system install atomix-controller atomix/atomix-controller --version $ATOMIX_CONTROLLER_VERSION
Scott Baker6bd3d192022-03-03 14:50:38 -080040 export ATOMIX_RAFT_VERSION=0.1.16
Sean Condon70dcf702021-08-24 10:57:29 +010041 helm -n kube-system install atomix-raft-storage atomix/atomix-raft-storage --version $ATOMIX_RAFT_VERSION
Scott Bakerfab7c9e2021-07-29 17:12:16 -070042
43 # install the onos operator
Scott Baker6bd3d192022-03-03 14:50:38 -080044 ONOS_OPERATOR_VERSION=0.5.1
Sean Condon257687f2021-08-23 11:13:20 +010045 helm install -n kube-system onos-operator onosproject/onos-operator --version $ONOS_OPERATOR_VERSION
Scott Bakerfab7c9e2021-07-29 17:12:16 -070046
Sean Condon257687f2021-08-23 11:13:20 +010047.. note:: The ROC is sensitive to the versions of Atomix and onos-operator installed. The values
Sean Condon8d55a1e2021-11-11 12:49:00 +000048 shown above are correct for the 1.4.42- versions of the *aether-roc-umbrella*.
Sean Condon257687f2021-08-23 11:13:20 +010049
50.. list-table:: ROC support component version matrix
Sean Condon70dcf702021-08-24 10:57:29 +010051 :widths: 40 20 20 20
Sean Condon257687f2021-08-23 11:13:20 +010052 :header-rows: 1
53
54 * - ROC Version
55 - Atomix Controller
56 - Atomix Raft
57 - Onos Operator
Sean Condon70dcf702021-08-24 10:57:29 +010058 * - 1.2.25-1.2.45
Sean Condon257687f2021-08-23 11:13:20 +010059 - 0.6.7
60 - 0.1.8
61 - 0.4.8
Zack Williams90578fa2021-11-04 11:57:23 -070062 * - 1.3.0-1.3.10
Sean Condon70dcf702021-08-24 10:57:29 +010063 - 0.6.8
64 - 0.1.9
Sean Condon1df1fcf2021-09-20 09:45:39 +010065 - 0.4.10
Zack Williams90578fa2021-11-04 11:57:23 -070066 * - 1.3.11-,1.4.0-
67 - 0.6.8
68 - 0.1.14
69 - 0.4.12
Sean Condon8d55a1e2021-11-11 12:49:00 +000070 * - 1.4.42-
71 - 0.6.8
72 - 0.1.15
73 - 0.4.14
Scott Baker6bd3d192022-03-03 14:50:38 -080074 * - 2.0.29-
75 - 0.6.8
76 - 0.1.16
77 - 0.5.1
Scott Bakerfab7c9e2021-07-29 17:12:16 -070078
79Verify that these services were installed properly.
80You should see pods for *atomix-controller*, *atomix-raft-storage-controller*,
81*onos-operator-config*, and *onos-operator-topo*.
82Execute these commands::
83
Sean Condon257687f2021-08-23 11:13:20 +010084 helm -n kube-system list
Scott Bakerfab7c9e2021-07-29 17:12:16 -070085 kubectl -n kube-system get pods | grep -i atomix
86 kubectl -n kube-system get pods | grep -i onos
87
Scott Bakerfab7c9e2021-07-29 17:12:16 -070088Create a values-override.yaml
89-----------------------------
90
91You’ll want to override several of the defaults in the ROC helm charts::
92
93 cat > values-override.yaml <<EOF
94 import:
Scott Bakerb46a6ed2021-08-02 14:03:10 -070095 onos-gui:
96 enabled: true
Scott Bakerfab7c9e2021-07-29 17:12:16 -070097
98 onos-gui:
Scott Bakerb46a6ed2021-08-02 14:03:10 -070099 ingress:
100 enabled: false
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700101
Scott Baker6bd3d192022-03-03 14:50:38 -0800102 aether-roc-gui-v2:
Scott Bakerb46a6ed2021-08-02 14:03:10 -0700103 ingress:
104 enabled: false
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700105 EOF
106
Zack Williams1ae109e2021-07-27 11:17:04 -0700107Installing the ``aether-roc-umbrella`` Helm chart
108-------------------------------------------------
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700109
110Add the necessary helm repositories::
111
Scott Baker6bd3d192022-03-03 14:50:38 -0800112 helm repo add aether https://charts.aetherproject.org
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700113
Zack Williams1ae109e2021-07-27 11:17:04 -0700114``aether-roc-umbrella`` will bring up the ROC and its services::
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700115
Sean Condon1df1fcf2021-09-20 09:45:39 +0100116 helm -n micro-onos install aether-roc-umbrella aether/aether-roc-umbrella -f values-override.yaml
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700117
118 kubectl wait pod -n micro-onos --for=condition=Ready -l type=config --timeout=300s
119
120
Sean Condonf918f642021-08-04 14:32:53 +0100121.. _posting-the-mega-patch:
122
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700123Posting the mega-patch
124----------------------
125
126The ROC usually comes up in a blank state -- there are no Enterprises, UEs, or other artifacts present in it.
127The mega-patch is an example patch that populates the ROC with some sample enterprises, UEs, slices, etc.
128Execute the following::
129
130 # launch a port-forward for the API
131 # this will continue to run in the background
132 kubectl -n micro-onos port-forward service/aether-roc-api --address 0.0.0.0 8181:8181 &
133
134 git clone https://github.com/onosproject/aether-roc-api.git
135
136 # execute the mega-patch (it will post via CURL to localhost:8181)
Scott Bakerae024102022-02-23 10:55:28 -0800137 bash ~/path/to/aether-roc-api/examples/MEGA_Patch_20.curl
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700138
139
140You may wish to customize the mega patch.
Zack Williams1ae109e2021-07-27 11:17:04 -0700141
142For example, by default the patch configures the ``sdcore-adapter`` to push to
143``sdcore-test-dummy``.
144
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700145You could configure it to push to a live aether-in-a-box core by doing something like this::
146
Scott Bakerae024102022-02-23 10:55:28 -0800147 sed -i 's^http://aether-roc-umbrella-sdcore-test-dummy/v1/config/5g^http://webui.omec.svc.cluster.local:9089/config^g' MEGA_Patch_20.curl
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700148
149 #apply the patch
Scott Bakerae024102022-02-23 10:55:28 -0800150 ./MEGA_Patch_20.curl
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700151
152(Note that if your Aether-in-a-Box was installed on a different machine that port-forwarding may be necessary)
153
154
155Expected CURL output from a successful mega-patch post will be a UUID.
Zack Williams1ae109e2021-07-27 11:17:04 -0700156
157You can also verify that the mega-patch was successful by going into the
158``aether-roc-gui`` in a browser (see the section on useful port-forwards
159below). The GUI may open to a dashboard that is unpopulated -- you can use the
160dropdown menu (upper-right hand corner of the screen) to select an object such
Scott Bakerae024102022-02-23 10:55:28 -0800161as Slice and you will see a list of slices.
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700162
163 |ROCGUI|
164
Zack Williams1ae109e2021-07-27 11:17:04 -0700165Uninstalling the ``aether-roc-umbrella`` Helm chart
166---------------------------------------------------
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700167
168To tear things back down, usually as part of a developer loop prior to redeploying again, do the following::
169
170 helm -n micro-onos del aether-roc-umbrella
171
172If the uninstall hangs or if a subsequent reinstall hangs, it could be an issue with some of the CRDs
173not getting cleaned up. The following may be useful::
174
Sean Condon8d55a1e2021-11-11 12:49:00 +0000175 # fix stuck finalizers in operator CRDs
Scott Baker6bd3d192022-03-03 14:50:38 -0800176 kubectl -n micro-onos patch entities connectivity-service-v2 --type json --patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]' && \
Sean Condon8d55a1e2021-11-11 12:49:00 +0000177 kubectl -n micro-onos patch entities plproxy-amp --type json --patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]' && \
178 kubectl -n micro-onos patch entities plproxy-acc --type json --patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]' && \
179 kubectl -n micro-onos patch kind plproxy --type json --patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]' && \
180 kubectl -n micro-onos patch kind aether --type json --patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]'
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700181
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700182
183Useful port forwards
184--------------------
185
186Port forwarding is often necessary to allow access to ports inside of Kubernetes pods that use ClusterIP addressing.
187Note that you typically need to leave a port-forward running (you can put it in the background).
188Also, If you redeploy the ROC and/or if a pod crashes then you might have to restart a port-forward.
189The following port-forwards may be useful::
190
191 # aether-roc-api
192
193 kubectl -n micro-onos port-forward service/aether-roc-api --address 0.0.0.0 8181:8181
194
195 # aether-roc-gui
196
Scott Baker6bd3d192022-03-03 14:50:38 -0800197 kubectl -n micro-onos port-forward service/aether-roc-gui-v2 --address 0.0.0.0 8183:80
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700198
199 # grafana
200
201 kubectl -n micro-onos port-forward service/aether-roc-umbrella-grafana --address 0.0.0.0 8187:80
202
Zack Williams1ae109e2021-07-27 11:17:04 -0700203``aether-roc-api`` and ``aether-roc-gui`` are in our experience the most useful two port-forwards.
204
205``aether-roc-api`` is useful to be able to POST REST API requests.
206
207``aether-roc-gui`` is useful to be able to interactively browse the current configuration.
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700208
Sean Condon257687f2021-08-23 11:13:20 +0100209.. note:: Internally the ``aether-roc-gui`` operates a Reverse Proxy on the ``aether-roc-api``. This
210 means that if you have done a ``port-forward`` to ``aether-roc-gui`` say on port ``8183`` there's no
211 need to do another on the ``aether-roc-api`` instead you can access the API on
212 ``http://localhost:8183/aether-roc-api``
213
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700214Deploying using custom images
215-----------------------------
216
217Custom images may be used by editing the values-override.yaml file.
Zack Williams1ae109e2021-07-27 11:17:04 -0700218For example, to deploy a custom ``sdcore-adapter``::
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700219
Scott Baker6bd3d192022-03-03 14:50:38 -0800220 sdcore-adapter-v2:
221 prometheusEnabled: false
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700222 image:
Scott Baker6bd3d192022-03-03 14:50:38 -0800223 repository: my-private-repo/sdcore-adapter
224 tag: my-tag
225 pullPolicy: Always
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700226
Zack Williams1ae109e2021-07-27 11:17:04 -0700227The above example assumes you have published a docker images at ``my-private-repo/sdcore-adapter:my-tag``.
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700228My particular workflow is to deploy a local-docker registry and push my images to that.
229Please do not publish ONF images to a public repository unless the image is intended to be public.
230Several ONF repositories are private, and therefore their docker artifacts should also be private.
231
232There are alternatives to using a private docker repository.
Zack Williams1ae109e2021-07-27 11:17:04 -0700233For example, if you are using kubeadm, then you may be able to simply tag the image locally.
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700234If you’re using KinD, then you can push a local image to into the kind cluster::
235
236 kind load docker-image sdcore-adapter:my-tag
237
Scott Bakerabcfc6e2021-09-08 22:37:51 -0700238Developing using a custom onos-config
239-------------------------------------
240
Scott Baker6bd3d192022-03-03 14:50:38 -0800241The onos-config helm chart is responsible for loading model plugins at runtime. You can override which
242plugins it loads, and optionally override the image for onos-config as well. For example::
Scott Bakerabcfc6e2021-09-08 22:37:51 -0700243
Scott Baker6bd3d192022-03-03 14:50:38 -0800244 onos-config:
245 image:
246 tag: mytag
247 repository: mydockeraccount/onos-config
248 modelPlugins:
249 - name: aether-2
250 image: mydockeraccount/aether-2.0.x:mytag
251 endpoint: localhost
252 port: 5152
253 - name: aether-4
254 image: mydockeraccount/aether-4.x:mytag
255 endpoint: localhost
256 port: 5153
Scott Bakerabcfc6e2021-09-08 22:37:51 -0700257
Scott Baker6bd3d192022-03-03 14:50:38 -0800258In the above example, the onos-config image will be pulled from `mydockeraccount`, and it will install
259two plugins for v2 and v4 models, from that same docker account.
Scott Bakerabcfc6e2021-09-08 22:37:51 -0700260
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700261Inspecting logs
262---------------
263
264Most of the relevant Kubernetes pods are in the micro-onos namespace.
265The names may change from deployment to deployment, so start by getting a list of pods::
266
267 kubectl -n micro-onos get pods
268
269Then you can inspect a specific pod/container::
270
Scott Baker6bd3d192022-03-03 14:50:38 -0800271 kubectl -n micro-onos logs deployment/sdcore-adapter-v2
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700272
Sean Condoneb95cd62021-08-04 19:44:18 +0100273.. _securing_roc:
274
275Securing ROC
276------------
277
Sean Condon9e182f62021-12-06 17:35:53 -0800278keycloak-dev.onlab.us
279^^^^^^^^^^^^^^^^^^^^^
280Keycloak is an Open Source Identity and Access Management for Modern Applications and
281Services. It can be used as an OIDC Issuer than can act as a front end to several authentication systems
282e.g. LDAP, Crowd, Google, GitHub
283
Zack Williams1ae109e2021-07-27 11:17:04 -0700284When deploying ROC with the ``aether-roc-umbrella`` chart, secure mode can be enabled by
Sean Condoneb95cd62021-08-04 19:44:18 +0100285specifying an OpenID Connect (OIDC) issuer like::
286
Andy Baviere86261e2021-09-21 11:05:18 -0700287 helm -n micro-onos install aether-roc-umbrella aether/aether-roc-umbrella \
Sean Condon9e182f62021-12-06 17:35:53 -0800288 --set onos-config.openidc.issuer=https://keycloak-dev.onlab.us/auth/realms/master \
289 --set aether-roc-api.openidc.issuer=https://keycloak-dev.onlab.us/auth/realms/master \
Scott Baker6bd3d192022-03-03 14:50:38 -0800290 --set aether-roc-gui-v2.openidc.issuer=https://keycloak-dev.onlab.us/auth/realms/master \
Sean Condon9e182f62021-12-06 17:35:53 -0800291 --set prom-label-proxy-acc.config.openidc.issuer=https://keycloak-dev.onlab.us/auth/realms/master \
292 --set prom-label-proxy-amp.config.openidc.issuer=https://keycloak-dev.onlab.us/auth/realms/master
Sean Condoneb95cd62021-08-04 19:44:18 +0100293
Sean Condon9e182f62021-12-06 17:35:53 -0800294The choice of OIDC issuer in this case is the **development** Keycloak server at https://keycloak-dev.onlab.us
Sean Condoneb95cd62021-08-04 19:44:18 +0100295
Sean Condon9e182f62021-12-06 17:35:53 -0800296Its LDAP server is populated with 7 different users in the 2 example enterprises - *starbucks* and *acme*.
Sean Condon948aeaa2021-09-29 12:08:30 +0100297
Sean Condon9e182f62021-12-06 17:35:53 -0800298+------------------+----------+-------------+-----------------+-----------------+-----------------+-----------+------+
299| User | login | mixedGroup: | charactersGroup | AetherROCAdmin | EnterpriseAdmin | starbucks | acme |
300+==================+==========+=============+=================+=================+=================+===========+======+
301| Alice Admin | alicea | ✓ | | ✓ | | | |
302+------------------+----------+-------------+-----------------+-----------------+-----------------+-----------+------+
303| Bob Cratchit | bobc | ✓ | ✓ | | | | |
304+------------------+----------+-------------+-----------------+-----------------+-----------------+-----------+------+
305| Charlie Brown | charlieb | | ✓ | | | | |
306+------------------+----------+-------------+-----------------+-----------------+-----------------+-----------+------+
307| Daisy Duke | daisyd | | ✓ | | ✓ | ✓ | |
308+------------------+----------+-------------+-----------------+-----------------+-----------------+-----------+------+
309| Elmer Fudd | elmerf | | ✓ | | | ✓ | |
310+------------------+----------+-------------+-----------------+-----------------+-----------------+-----------+------+
311| Fred Flintstone | fredf | | ✓ | | ✓ | | ✓ |
312+------------------+----------+-------------+-----------------+-----------------+-----------------+-----------+------+
313| Gandalf The Grey | gandalfg | | ✓ | | | | ✓ |
314+------------------+----------+-------------+-----------------+-----------------+-----------------+-----------+------+
315
316.. note:: all users have the same password - please contact `aether-roc <https://onf-internal.slack.com/archives/C01S7BVC1FX>`_ slack group if you need it
317
318.. note:: Because of the SSO feature of Keycloak you will need to explicitly logout of Keycloak to change users.
319 To login as 2 separate users at the same time, use a private browser window for one.
320
321Running your own Keycloak Server
322^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
323
324It is also possible to run your own own Keycloak server inside of Kubernetes.
Sean Condon948aeaa2021-09-29 12:08:30 +0100325
326``keycloak-389-umbrella`` is a Helm chart that combines a Keycloak server with an LDAP
Sean Condon8d55a1e2021-11-11 12:49:00 +0000327installation (389 Directory Server), and an LDAP administration tool. It can be deployed (with name ``k3u`` in to the
328same cluster namespace as ``aether-roc-umbrella``::
Sean Condon948aeaa2021-09-29 12:08:30 +0100329
Sean Condon8d55a1e2021-11-11 12:49:00 +0000330 helm -n micro-onos install k3u onosproject/keycloak-389-umbrella
331
Sean Condon8d55a1e2021-11-11 12:49:00 +0000332To make the deployment available with the hostname ``k3u-keycloak`` requires:
333
334#. a port forward like ``kubectl -n micro-onos port-forward service/k3u-keycloak --address=0.0.0.0 5557:80``
335#. editing your ``/etc/hosts`` file (on the machine where your browser runs) so that the name ``k3u-keycloak`` points
336 to the IP address of the machine where the ``port-forward`` runs (usually ``localhost``).
Sean Condon948aeaa2021-09-29 12:08:30 +0100337
338When running it should be available at *http://k3u-keycloak:5557/auth/realms/master/.well-known/openid-configuration*.
339
Sean Condon8d55a1e2021-11-11 12:49:00 +0000340.. note:: You can access the Keycloak management page from *http://k3u-keycloak:5557/auth/admin* but you must
Sean Condon9e182f62021-12-06 17:35:53 -0800341 login as `admin`. Because of the SSO feature of Keycloak this will affect your Aether ROC GUI login too.
Sean Condon8d55a1e2021-11-11 12:49:00 +0000342 To login as 2 separate users at the same time, use a private browser window for one.
343
Sean Condon9e182f62021-12-06 17:35:53 -0800344.. note:: Services inside the cluster (e.g. onos-config) should set the issuer to *https://k3u-keycloak:80/auth/realms/master*
345 on port 80, while the aether-roc-gui should use port 5557
346
347As any OIDC server can work with ROC you can alternately use ``dex-ldap-umbrella``
348(`deprecated <https://github.com/onosproject/onos-helm-charts/tree/master/dex-ldap-umbrella>`_).
349
Sean Condon948aeaa2021-09-29 12:08:30 +0100350See `keycloak-389-umbrella <https://github.com/onosproject/onos-helm-charts/tree/master/keycloak-389-umbrella#readme>`_
351for more details.
352
Sean Condon9e182f62021-12-06 17:35:53 -0800353Production Environment
354^^^^^^^^^^^^^^^^^^^^^^
355In a production environment, the public Aether Keycloak (with its LDAP server populated with real Aether users and groups) should be used.
Sean Condon948aeaa2021-09-29 12:08:30 +0100356See `public keycloak <https://keycloak.opennetworking.org/auth/realms/master/.well-known/openid-configuration>`_ for more details.
357
358.. note:: Your RBAC access to ROC will be limited by the groups you belong to in its LDAP store.
359
Sean Condoneb95cd62021-08-04 19:44:18 +0100360Role Based Access Control
Sean Condon9e182f62021-12-06 17:35:53 -0800361^^^^^^^^^^^^^^^^^^^^^^^^^
Zack Williams1ae109e2021-07-27 11:17:04 -0700362
Sean Condoneb95cd62021-08-04 19:44:18 +0100363When secured, access to the configuration in ROC is limited by the **groups** that a user belongs to.
364
365* **AetherROCAdmin** - users in this group have full read **and** write access to all configuration.
366* *<enterprise>* - users in a group the lowercase name of an enterprise, will have **read** access to that enterprise.
367* **EnterpriseAdmin** - users in this group will have read **and** write access the enterprise they belong to.
368
Sean Condon948aeaa2021-09-29 12:08:30 +0100369 For example in *keycloak-389-umbrella* the user *Daisy Duke* belongs to *starbucks* **and**
Sean Condoneb95cd62021-08-04 19:44:18 +0100370 *EnterpriseAdmin* and so has read **and** write access to items linked with *starbucks* enterprise.
371
372 By comparison the user *Elmer Fudd* belongs only to *starbucks* group and so has only **read** access to items
373 linked with the *starbucks* enterprise.
374
375Requests to a Secure System
Sean Condon9e182f62021-12-06 17:35:53 -0800376^^^^^^^^^^^^^^^^^^^^^^^^^^^
Zack Williams1ae109e2021-07-27 11:17:04 -0700377
Sean Condoneb95cd62021-08-04 19:44:18 +0100378When configuration is retrieved or updated through *aether-config*, a Bearer Token in the
Zack Williams1ae109e2021-07-27 11:17:04 -0700379form of a JSON Web Token (JWT) issued by the selected OIDC Issuer server must accompany
Sean Condoneb95cd62021-08-04 19:44:18 +0100380the request as an Authorization Header.
381
Zack Williams1ae109e2021-07-27 11:17:04 -0700382This applies to both the REST interface of ``aether-roc-api`` **and** the *gnmi* interface of
Sean Condon8d55a1e2021-11-11 12:49:00 +0000383``aether-config``.
Sean Condoneb95cd62021-08-04 19:44:18 +0100384
385In the Aether ROC, a Bearer Token can be generated by logging in and selecting API Key from the
386menu. This pops up a window with a copy button, where the key can be copied.
387
Sean Condon8d55a1e2021-11-11 12:49:00 +0000388Alternatively with Keycloak a Token may be requested programmatically through the Keycloak API::
389
Sean Condon9e182f62021-12-06 17:35:53 -0800390 curl --location --request POST 'https://keycloak-dev.onlab.us/auth/realms/master/protocol/openid-connect/token' \
Sean Condon8d55a1e2021-11-11 12:49:00 +0000391 --header 'Content-Type: application/x-www-form-urlencoded' \
392 --data-urlencode 'grant_type=password' \
393 --data-urlencode 'client_id=aether-roc-gui' \
394 --data-urlencode 'username=alicea' \
395 --data-urlencode 'password=password' \
Scott Baker6bd3d192022-03-03 14:50:38 -0800396 --data-urlencode 'scope=openid profile email groups' | jq "{access_token}"
Sean Condon8d55a1e2021-11-11 12:49:00 +0000397
398
Sean Condoneb95cd62021-08-04 19:44:18 +0100399The key will expire after 24 hours.
400
401.. image:: images/aether-roc-gui-copy-api-key.png
402 :width: 580
403 :alt: Aether ROC GUI allows copying of API Key to clipboard
404
405Accessing the REST interface from a tool like Postman, should include this Auth token.
406
407.. image:: images/postman-auth-token.png
408 :width: 930
409 :alt: Postman showing Authentication Token pasted in
410
411Logging
Zack Williams1ae109e2021-07-27 11:17:04 -0700412"""""""
413
Sean Condoneb95cd62021-08-04 19:44:18 +0100414The logs of *aether-config* will contain the **username** and **timestamp** of
415any **gnmi** call when security is enabled.
416
417.. image:: images/aether-config-log.png
418 :width: 887
419 :alt: aether-config log message showing username and timestamp
420
Sean Condon435be9a2021-08-06 14:28:37 +0100421Accessing GUI from an external system
Zack Williams1ae109e2021-07-27 11:17:04 -0700422"""""""""""""""""""""""""""""""""""""
423
Sean Condon435be9a2021-08-06 14:28:37 +0100424To access the ROC GUI from a computer outside the Cluster machine using *port-forwarding* then
425it is necessary to:
426
427* Ensure that all *port-forward*'s have **--address=0.0.0.0**
428* Add to the IP address of the cluster machine to the **/etc/hosts** of the outside computer as::
429
Sean Condon948aeaa2021-09-29 12:08:30 +0100430 <ip address of cluster> k3u-keycloak aether-roc-gui
Sean Condon9e182f62021-12-06 17:35:53 -0800431* Verify that you can access the Keycloak server by its name *https://keycloak-dev.onlab.us/auth/realms/master/.well-known/openid-configuration*
Zack Williams1ae109e2021-07-27 11:17:04 -0700432* Access the GUI through the hostname (rather than ip address) ``http://aether-roc-gui:8183``
Sean Condon435be9a2021-08-06 14:28:37 +0100433
Sean Condoneb95cd62021-08-04 19:44:18 +0100434Troubleshooting Secure Access
Zack Williams1ae109e2021-07-27 11:17:04 -0700435"""""""""""""""""""""""""""""
436
Sean Condoneb95cd62021-08-04 19:44:18 +0100437While every effort has been made to ensure that securing Aether is simple and effective,
438some difficulties may arise.
439
Sean Condon948aeaa2021-09-29 12:08:30 +0100440One of the most important steps is to validate that the OIDC Issuer (Keycloak server) can be reached
Sean Condoneb95cd62021-08-04 19:44:18 +0100441from the browser. The **well_known** URL should be available and show the important endpoints are correct.
442
Sean Condon948aeaa2021-09-29 12:08:30 +0100443.. image:: images/keycloak-389-umbrella-well-known.png
Sean Condoneb95cd62021-08-04 19:44:18 +0100444 :width: 580
Sean Condon948aeaa2021-09-29 12:08:30 +0100445 :alt: Keycloak Well Known page
Sean Condoneb95cd62021-08-04 19:44:18 +0100446
447If 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 +0100448redirect to the Keycloak login page.
Sean Condoneb95cd62021-08-04 19:44:18 +0100449
Sean Condon948aeaa2021-09-29 12:08:30 +0100450.. image:: images/keycloak-ldap-login-page.png
Sean Condoneb95cd62021-08-04 19:44:18 +0100451 :width: 493
Sean Condon948aeaa2021-09-29 12:08:30 +0100452 :alt: Keycloak Login page
Sean Condoneb95cd62021-08-04 19:44:18 +0100453
454When logged in the User details can be seen by clicking the User's name in the drop down menu.
455This shows the **groups** that the user belongs to, and can be used to debug RBAC issues.
456
457.. image:: images/aether-roc-gui-user-details.png
458 :width: 700
459 :alt: User Details page
460
Sean Condon948aeaa2021-09-29 12:08:30 +0100461When you sign out of the ROC GUI, if you are not redirected to the Keycloak Login Page,
Sean Condoneb95cd62021-08-04 19:44:18 +0100462you should check the Developer Console of the browser. The console should show the correct
Sean Condon948aeaa2021-09-29 12:08:30 +0100463OIDC issuer (Keycloak server), and that Auth is enabled.
Sean Condoneb95cd62021-08-04 19:44:18 +0100464
465.. image:: images/aether-roc-gui-console-loggedin.png
466 :width: 418
467 :alt: Browser Console showing correct configuration
468
Sean Condon8d55a1e2021-11-11 12:49:00 +0000469Keycloak installation issues
470^^^^^^^^^^^^^^^^^^^^^^^^^^^^
471
472The ``fedorea-389ds`` pod may restart a couple of times before it finally reaches running.
473There are 2 post install jobs that take some time to start. Overall allow 3 minutes for startup.
474
475Some users are finding that the Fedora pod will never reach a running state on resource
476constrained machines. This issue is being investigated.
477
478
Scott Bakerb46a6ed2021-08-02 14:03:10 -0700479ROC Data Model Conventions and Requirements
480-------------------------------------------
481
482The MEGA-Patch described above will bring up a fully compliant sample data model.
483However, it may be useful to bring up your own data model, customized to a different
484site of sites. This subsection documents conventions and requirements for the Aether
Zack Williams1ae109e2021-07-27 11:17:04 -0700485modeling within the ROC.
Scott Bakerb46a6ed2021-08-02 14:03:10 -0700486
487The ROC models must be configured with the following:
488
489* A default enterprise with the id `defaultent`.
Scott Bakerb46a6ed2021-08-02 14:03:10 -0700490* A default site with the id `defaultent-defaultsite`.
Scott Bakerae024102022-02-23 10:55:28 -0800491 This site should be within the `defaultent` enterprise.
492 This site is used by ``subscriber-proxy`` to place detected SIM Cards that cannot
493 be matched to an existing site.
Scott Bakerb46a6ed2021-08-02 14:03:10 -0700494
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700495Some exercises to get familiar
496------------------------------
497
Zack Williams1ae109e2021-07-27 11:17:04 -07004981. Deploy the ROC and POST the mega-patch, go into the ``aether-roc-gui`` and click
Scott Bakerae024102022-02-23 10:55:28 -0800499 through the Slice, DeviceGroup, and other objects to see that they were
Zack Williams1ae109e2021-07-27 11:17:04 -0700500 created as expected.
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700501
Scott Baker6bd3d192022-03-03 14:50:38 -08005022. Examine the log of the ``sdcore-adapter-v2`` container. It should be
Zack Williams1ae109e2021-07-27 11:17:04 -0700503 attempting to push the mega-patch’s changes. If you don’t have a core
504 available, it may be failing the push, but you should see the attempts.
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700505
Scott Baker6bd3d192022-03-03 14:50:38 -08005063. Change an object in the GUI. Watch the ``sdcore-adapter-v2`` log file and
Zack Williams1ae109e2021-07-27 11:17:04 -0700507 see that the adapter attempts to push the change.
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700508
Scott Baker6bd3d192022-03-03 14:50:38 -08005094. Try POSTing a change via the API. Observe the ``sdcore-adapter-v2`` log
Zack Williams1ae109e2021-07-27 11:17:04 -0700510 file and see that the adapter attempts to push the change.
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700511
Andy Bavierf73c3d22021-08-30 10:29:06 -07005125. Deploy a 5G Aether-in-a-Box (See :doc:`Setting Up Aether-in-a-Box
513 <aiab>`), modify the mega-patch to specify the URL for the Aether-in-a-Box
Zack Williams1ae109e2021-07-27 11:17:04 -0700514 ``webui`` container, POST the mega-patch, and observe that the changes were
Scott Baker6bd3d192022-03-03 14:50:38 -0800515 correctly pushed via the ``sdcore-adapter-v2`` into the ``sd-core``’s
Zack Williams1ae109e2021-07-27 11:17:04 -0700516 ``webui`` container (``webui`` container log will show configuration as it
517 is received)
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700518
519.. |ROCGUI| image:: images/rocgui.png
Sean Condoneb95cd62021-08-04 19:44:18 +0100520 :width: 945
Scott Bakerae024102022-02-23 10:55:28 -0800521 :alt: ROC GUI showing list of Slices