blob: fb9f93b08bd8a0c3a6f24e30a96c27d5189dadb6 [file] [log] [blame]
Scott Bakerfab7c9e2021-07-29 17:12:16 -07001.. vim: syntax=rst
2
3Aether ROC Developer Guide
4==========================
5
6Background / Development Environment
7------------------------------------
8
9This document assumes familiarity with Kubernetes and Helm, and that a Kubernetes/Helm development
10environment has already been deployed in the developer’s work environment.
Zack Williams1ae109e2021-07-27 11:17:04 -070011
12This development environment can use any of a number of potential mechanisms -- including KinD, kubeadm, etc.
13
Scott Bakerfab7c9e2021-07-29 17:12:16 -070014The Aether-in-a-Box script is one potential way to setup a development environment, but not the only way.
15As 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 -070016cloud infrastructure such as Cloudlab.
Scott Bakerfab7c9e2021-07-29 17:12:16 -070017
Sean Condoneb95cd62021-08-04 19:44:18 +010018.. note:: When ROC is deployed it is unsecured by default, with no Authentication or Authorization.
19 To secure ROC so that the Authentication and Authorization can be tested, follow the Securing ROC
20 guide below :ref:`securing_roc`
21
Scott Bakerfab7c9e2021-07-29 17:12:16 -070022Installing Prerequisites
23------------------------
24
25Atomix and onos-operator must be installed::
26
27 # create necessary namespaces
28 kubectl create namespace micro-onos
29
Andy Bavier4c425412021-08-27 14:39:38 -070030 # add repos
31 helm repo add atomix https://charts.atomix.io
32 helm repo add onosproject https://charts.onosproject.org
33 helm repo update
34
Scott Bakerfab7c9e2021-07-29 17:12:16 -070035 # install atomix
Sean Condon70dcf702021-08-24 10:57:29 +010036 export ATOMIX_CONTROLLER_VERSION=0.6.8
Sean Condon257687f2021-08-23 11:13:20 +010037 helm -n kube-system install atomix-controller atomix/atomix-controller --version $ATOMIX_CONTROLLER_VERSION
Scott Baker6bd3d192022-03-03 14:50:38 -080038 export ATOMIX_RAFT_VERSION=0.1.16
Sean Condon70dcf702021-08-24 10:57:29 +010039 helm -n kube-system install atomix-raft-storage atomix/atomix-raft-storage --version $ATOMIX_RAFT_VERSION
Scott Bakerfab7c9e2021-07-29 17:12:16 -070040
41 # install the onos operator
Scott Baker6bd3d192022-03-03 14:50:38 -080042 ONOS_OPERATOR_VERSION=0.5.1
Sean Condon257687f2021-08-23 11:13:20 +010043 helm install -n kube-system onos-operator onosproject/onos-operator --version $ONOS_OPERATOR_VERSION
Scott Bakerfab7c9e2021-07-29 17:12:16 -070044
Sean Condon257687f2021-08-23 11:13:20 +010045.. note:: The ROC is sensitive to the versions of Atomix and onos-operator installed. The values
Sean Condon8d55a1e2021-11-11 12:49:00 +000046 shown above are correct for the 1.4.42- versions of the *aether-roc-umbrella*.
Sean Condon257687f2021-08-23 11:13:20 +010047
48.. list-table:: ROC support component version matrix
Sean Condon70dcf702021-08-24 10:57:29 +010049 :widths: 40 20 20 20
Sean Condon257687f2021-08-23 11:13:20 +010050 :header-rows: 1
51
52 * - ROC Version
53 - Atomix Controller
54 - Atomix Raft
55 - Onos Operator
Sean Condon70dcf702021-08-24 10:57:29 +010056 * - 1.2.25-1.2.45
Sean Condon257687f2021-08-23 11:13:20 +010057 - 0.6.7
58 - 0.1.8
59 - 0.4.8
Zack Williams90578fa2021-11-04 11:57:23 -070060 * - 1.3.0-1.3.10
Sean Condon70dcf702021-08-24 10:57:29 +010061 - 0.6.8
62 - 0.1.9
Sean Condon1df1fcf2021-09-20 09:45:39 +010063 - 0.4.10
Zack Williams90578fa2021-11-04 11:57:23 -070064 * - 1.3.11-,1.4.0-
65 - 0.6.8
66 - 0.1.14
67 - 0.4.12
Sean Condon8d55a1e2021-11-11 12:49:00 +000068 * - 1.4.42-
69 - 0.6.8
70 - 0.1.15
71 - 0.4.14
Scott Baker6bd3d192022-03-03 14:50:38 -080072 * - 2.0.29-
73 - 0.6.8
74 - 0.1.16
75 - 0.5.1
Scott Bakerfab7c9e2021-07-29 17:12:16 -070076
77Verify that these services were installed properly.
78You should see pods for *atomix-controller*, *atomix-raft-storage-controller*,
79*onos-operator-config*, and *onos-operator-topo*.
80Execute these commands::
81
Sean Condon257687f2021-08-23 11:13:20 +010082 helm -n kube-system list
Scott Bakerfab7c9e2021-07-29 17:12:16 -070083 kubectl -n kube-system get pods | grep -i atomix
84 kubectl -n kube-system get pods | grep -i onos
85
Scott Bakerfab7c9e2021-07-29 17:12:16 -070086Create a values-override.yaml
87-----------------------------
88
89You’ll want to override several of the defaults in the ROC helm charts::
90
91 cat > values-override.yaml <<EOF
92 import:
Scott Bakerb46a6ed2021-08-02 14:03:10 -070093 onos-gui:
94 enabled: true
Scott Bakerfab7c9e2021-07-29 17:12:16 -070095
96 onos-gui:
Scott Bakerb46a6ed2021-08-02 14:03:10 -070097 ingress:
98 enabled: false
Scott Bakerfab7c9e2021-07-29 17:12:16 -070099
Scott Baker6bd3d192022-03-03 14:50:38 -0800100 aether-roc-gui-v2:
Scott Bakerb46a6ed2021-08-02 14:03:10 -0700101 ingress:
102 enabled: false
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700103 EOF
104
Zack Williams1ae109e2021-07-27 11:17:04 -0700105Installing the ``aether-roc-umbrella`` Helm chart
106-------------------------------------------------
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700107
108Add the necessary helm repositories::
109
Scott Baker6bd3d192022-03-03 14:50:38 -0800110 helm repo add aether https://charts.aetherproject.org
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700111
Zack Williams1ae109e2021-07-27 11:17:04 -0700112``aether-roc-umbrella`` will bring up the ROC and its services::
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700113
Sean Condon1df1fcf2021-09-20 09:45:39 +0100114 helm -n micro-onos install aether-roc-umbrella aether/aether-roc-umbrella -f values-override.yaml
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700115
116 kubectl wait pod -n micro-onos --for=condition=Ready -l type=config --timeout=300s
117
118
Sean Condonf918f642021-08-04 14:32:53 +0100119.. _posting-the-mega-patch:
120
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700121Posting the mega-patch
122----------------------
123
124The ROC usually comes up in a blank state -- there are no Enterprises, UEs, or other artifacts present in it.
125The mega-patch is an example patch that populates the ROC with some sample enterprises, UEs, slices, etc.
126Execute the following::
127
128 # launch a port-forward for the API
129 # this will continue to run in the background
130 kubectl -n micro-onos port-forward service/aether-roc-api --address 0.0.0.0 8181:8181 &
131
132 git clone https://github.com/onosproject/aether-roc-api.git
133
134 # execute the mega-patch (it will post via CURL to localhost:8181)
Scott Bakerae024102022-02-23 10:55:28 -0800135 bash ~/path/to/aether-roc-api/examples/MEGA_Patch_20.curl
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700136
137
138You may wish to customize the mega patch.
Zack Williams1ae109e2021-07-27 11:17:04 -0700139
140For example, by default the patch configures the ``sdcore-adapter`` to push to
141``sdcore-test-dummy``.
142
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700143You could configure it to push to a live aether-in-a-box core by doing something like this::
144
Scott Bakerae024102022-02-23 10:55:28 -0800145 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 -0700146
147 #apply the patch
Scott Bakerae024102022-02-23 10:55:28 -0800148 ./MEGA_Patch_20.curl
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700149
150(Note that if your Aether-in-a-Box was installed on a different machine that port-forwarding may be necessary)
151
152
153Expected CURL output from a successful mega-patch post will be a UUID.
Zack Williams1ae109e2021-07-27 11:17:04 -0700154
155You can also verify that the mega-patch was successful by going into the
156``aether-roc-gui`` in a browser (see the section on useful port-forwards
157below). The GUI may open to a dashboard that is unpopulated -- you can use the
158dropdown menu (upper-right hand corner of the screen) to select an object such
Scott Bakerae024102022-02-23 10:55:28 -0800159as Slice and you will see a list of slices.
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700160
161 |ROCGUI|
162
Zack Williams1ae109e2021-07-27 11:17:04 -0700163Uninstalling the ``aether-roc-umbrella`` Helm chart
164---------------------------------------------------
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700165
166To tear things back down, usually as part of a developer loop prior to redeploying again, do the following::
167
168 helm -n micro-onos del aether-roc-umbrella
169
170If the uninstall hangs or if a subsequent reinstall hangs, it could be an issue with some of the CRDs
171not getting cleaned up. The following may be useful::
172
Sean Condon8d55a1e2021-11-11 12:49:00 +0000173 # fix stuck finalizers in operator CRDs
Scott Baker6bd3d192022-03-03 14:50:38 -0800174 kubectl -n micro-onos patch entities connectivity-service-v2 --type json --patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]' && \
Sean Condon8d55a1e2021-11-11 12:49:00 +0000175 kubectl -n micro-onos patch entities plproxy-amp --type json --patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]' && \
176 kubectl -n micro-onos patch entities plproxy-acc --type json --patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]' && \
177 kubectl -n micro-onos patch kind plproxy --type json --patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]' && \
178 kubectl -n micro-onos patch kind aether --type json --patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]'
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700179
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700180
181Useful port forwards
182--------------------
183
184Port forwarding is often necessary to allow access to ports inside of Kubernetes pods that use ClusterIP addressing.
185Note that you typically need to leave a port-forward running (you can put it in the background).
186Also, If you redeploy the ROC and/or if a pod crashes then you might have to restart a port-forward.
187The following port-forwards may be useful::
188
189 # aether-roc-api
190
191 kubectl -n micro-onos port-forward service/aether-roc-api --address 0.0.0.0 8181:8181
192
193 # aether-roc-gui
194
Scott Baker6bd3d192022-03-03 14:50:38 -0800195 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 -0700196
197 # grafana
198
199 kubectl -n micro-onos port-forward service/aether-roc-umbrella-grafana --address 0.0.0.0 8187:80
200
Zack Williams1ae109e2021-07-27 11:17:04 -0700201``aether-roc-api`` and ``aether-roc-gui`` are in our experience the most useful two port-forwards.
202
203``aether-roc-api`` is useful to be able to POST REST API requests.
204
205``aether-roc-gui`` is useful to be able to interactively browse the current configuration.
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700206
Sean Condon257687f2021-08-23 11:13:20 +0100207.. note:: Internally the ``aether-roc-gui`` operates a Reverse Proxy on the ``aether-roc-api``. This
208 means that if you have done a ``port-forward`` to ``aether-roc-gui`` say on port ``8183`` there's no
209 need to do another on the ``aether-roc-api`` instead you can access the API on
210 ``http://localhost:8183/aether-roc-api``
211
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700212Deploying using custom images
213-----------------------------
214
215Custom images may be used by editing the values-override.yaml file.
Zack Williams1ae109e2021-07-27 11:17:04 -0700216For example, to deploy a custom ``sdcore-adapter``::
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700217
Scott Baker6bd3d192022-03-03 14:50:38 -0800218 sdcore-adapter-v2:
219 prometheusEnabled: false
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700220 image:
Scott Baker6bd3d192022-03-03 14:50:38 -0800221 repository: my-private-repo/sdcore-adapter
222 tag: my-tag
223 pullPolicy: Always
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700224
Zack Williams1ae109e2021-07-27 11:17:04 -0700225The above example assumes you have published a docker images at ``my-private-repo/sdcore-adapter:my-tag``.
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700226My particular workflow is to deploy a local-docker registry and push my images to that.
227Please do not publish ONF images to a public repository unless the image is intended to be public.
228Several ONF repositories are private, and therefore their docker artifacts should also be private.
229
230There are alternatives to using a private docker repository.
Zack Williams1ae109e2021-07-27 11:17:04 -0700231For example, if you are using kubeadm, then you may be able to simply tag the image locally.
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700232If you’re using KinD, then you can push a local image to into the kind cluster::
233
234 kind load docker-image sdcore-adapter:my-tag
235
Scott Bakerabcfc6e2021-09-08 22:37:51 -0700236Developing using a custom onos-config
237-------------------------------------
238
Scott Baker6bd3d192022-03-03 14:50:38 -0800239The onos-config helm chart is responsible for loading model plugins at runtime. You can override which
240plugins it loads, and optionally override the image for onos-config as well. For example::
Scott Bakerabcfc6e2021-09-08 22:37:51 -0700241
Scott Baker6bd3d192022-03-03 14:50:38 -0800242 onos-config:
243 image:
244 tag: mytag
245 repository: mydockeraccount/onos-config
246 modelPlugins:
247 - name: aether-2
248 image: mydockeraccount/aether-2.0.x:mytag
249 endpoint: localhost
250 port: 5152
251 - name: aether-4
252 image: mydockeraccount/aether-4.x:mytag
253 endpoint: localhost
254 port: 5153
Scott Bakerabcfc6e2021-09-08 22:37:51 -0700255
Scott Baker6bd3d192022-03-03 14:50:38 -0800256In the above example, the onos-config image will be pulled from `mydockeraccount`, and it will install
257two plugins for v2 and v4 models, from that same docker account.
Scott Bakerabcfc6e2021-09-08 22:37:51 -0700258
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700259Inspecting logs
260---------------
261
262Most of the relevant Kubernetes pods are in the micro-onos namespace.
263The names may change from deployment to deployment, so start by getting a list of pods::
264
265 kubectl -n micro-onos get pods
266
267Then you can inspect a specific pod/container::
268
Scott Baker6bd3d192022-03-03 14:50:38 -0800269 kubectl -n micro-onos logs deployment/sdcore-adapter-v2
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700270
Sean Condoneb95cd62021-08-04 19:44:18 +0100271.. _securing_roc:
272
273Securing ROC
274------------
275
Sean Condon9e182f62021-12-06 17:35:53 -0800276keycloak-dev.onlab.us
277^^^^^^^^^^^^^^^^^^^^^
278Keycloak is an Open Source Identity and Access Management for Modern Applications and
279Services. It can be used as an OIDC Issuer than can act as a front end to several authentication systems
280e.g. LDAP, Crowd, Google, GitHub
281
Zack Williams1ae109e2021-07-27 11:17:04 -0700282When deploying ROC with the ``aether-roc-umbrella`` chart, secure mode can be enabled by
Sean Condoneb95cd62021-08-04 19:44:18 +0100283specifying an OpenID Connect (OIDC) issuer like::
284
Andy Baviere86261e2021-09-21 11:05:18 -0700285 helm -n micro-onos install aether-roc-umbrella aether/aether-roc-umbrella \
Sean Condon9e182f62021-12-06 17:35:53 -0800286 --set onos-config.openidc.issuer=https://keycloak-dev.onlab.us/auth/realms/master \
287 --set aether-roc-api.openidc.issuer=https://keycloak-dev.onlab.us/auth/realms/master \
Scott Baker6bd3d192022-03-03 14:50:38 -0800288 --set aether-roc-gui-v2.openidc.issuer=https://keycloak-dev.onlab.us/auth/realms/master \
Sean Condon9e182f62021-12-06 17:35:53 -0800289 --set prom-label-proxy-acc.config.openidc.issuer=https://keycloak-dev.onlab.us/auth/realms/master \
290 --set prom-label-proxy-amp.config.openidc.issuer=https://keycloak-dev.onlab.us/auth/realms/master
Sean Condoneb95cd62021-08-04 19:44:18 +0100291
Sean Condon9e182f62021-12-06 17:35:53 -0800292The 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 +0100293
Sean Condon9e182f62021-12-06 17:35:53 -0800294Its LDAP server is populated with 7 different users in the 2 example enterprises - *starbucks* and *acme*.
Sean Condon948aeaa2021-09-29 12:08:30 +0100295
Sean Condon9e182f62021-12-06 17:35:53 -0800296+------------------+----------+-------------+-----------------+-----------------+-----------------+-----------+------+
297| User | login | mixedGroup: | charactersGroup | AetherROCAdmin | EnterpriseAdmin | starbucks | acme |
298+==================+==========+=============+=================+=================+=================+===========+======+
299| Alice Admin | alicea | ✓ | | ✓ | | | |
300+------------------+----------+-------------+-----------------+-----------------+-----------------+-----------+------+
301| Bob Cratchit | bobc | ✓ | ✓ | | | | |
302+------------------+----------+-------------+-----------------+-----------------+-----------------+-----------+------+
303| Charlie Brown | charlieb | | ✓ | | | | |
304+------------------+----------+-------------+-----------------+-----------------+-----------------+-----------+------+
305| Daisy Duke | daisyd | | ✓ | | ✓ | ✓ | |
306+------------------+----------+-------------+-----------------+-----------------+-----------------+-----------+------+
307| Elmer Fudd | elmerf | | ✓ | | | ✓ | |
308+------------------+----------+-------------+-----------------+-----------------+-----------------+-----------+------+
309| Fred Flintstone | fredf | | ✓ | | ✓ | | ✓ |
310+------------------+----------+-------------+-----------------+-----------------+-----------------+-----------+------+
311| Gandalf The Grey | gandalfg | | ✓ | | | | ✓ |
312+------------------+----------+-------------+-----------------+-----------------+-----------------+-----------+------+
313
314.. note:: all users have the same password - please contact `aether-roc <https://onf-internal.slack.com/archives/C01S7BVC1FX>`_ slack group if you need it
315
316.. note:: Because of the SSO feature of Keycloak you will need to explicitly logout of Keycloak to change users.
317 To login as 2 separate users at the same time, use a private browser window for one.
318
319Running your own Keycloak Server
320^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
321
322It is also possible to run your own own Keycloak server inside of Kubernetes.
Sean Condon948aeaa2021-09-29 12:08:30 +0100323
324``keycloak-389-umbrella`` is a Helm chart that combines a Keycloak server with an LDAP
Sean Condon8d55a1e2021-11-11 12:49:00 +0000325installation (389 Directory Server), and an LDAP administration tool. It can be deployed (with name ``k3u`` in to the
326same cluster namespace as ``aether-roc-umbrella``::
Sean Condon948aeaa2021-09-29 12:08:30 +0100327
Sean Condon8d55a1e2021-11-11 12:49:00 +0000328 helm -n micro-onos install k3u onosproject/keycloak-389-umbrella
329
Sean Condon8d55a1e2021-11-11 12:49:00 +0000330To make the deployment available with the hostname ``k3u-keycloak`` requires:
331
332#. a port forward like ``kubectl -n micro-onos port-forward service/k3u-keycloak --address=0.0.0.0 5557:80``
333#. editing your ``/etc/hosts`` file (on the machine where your browser runs) so that the name ``k3u-keycloak`` points
334 to the IP address of the machine where the ``port-forward`` runs (usually ``localhost``).
Sean Condon948aeaa2021-09-29 12:08:30 +0100335
336When running it should be available at *http://k3u-keycloak:5557/auth/realms/master/.well-known/openid-configuration*.
337
Sean Condon8d55a1e2021-11-11 12:49:00 +0000338.. 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 -0800339 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 +0000340 To login as 2 separate users at the same time, use a private browser window for one.
341
Sean Condon9e182f62021-12-06 17:35:53 -0800342.. note:: Services inside the cluster (e.g. onos-config) should set the issuer to *https://k3u-keycloak:80/auth/realms/master*
343 on port 80, while the aether-roc-gui should use port 5557
344
345As any OIDC server can work with ROC you can alternately use ``dex-ldap-umbrella``
346(`deprecated <https://github.com/onosproject/onos-helm-charts/tree/master/dex-ldap-umbrella>`_).
347
Sean Condon948aeaa2021-09-29 12:08:30 +0100348See `keycloak-389-umbrella <https://github.com/onosproject/onos-helm-charts/tree/master/keycloak-389-umbrella#readme>`_
349for more details.
350
Sean Condon9e182f62021-12-06 17:35:53 -0800351Production Environment
352^^^^^^^^^^^^^^^^^^^^^^
353In 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 +0100354See `public keycloak <https://keycloak.opennetworking.org/auth/realms/master/.well-known/openid-configuration>`_ for more details.
355
356.. note:: Your RBAC access to ROC will be limited by the groups you belong to in its LDAP store.
357
Sean Condoneb95cd62021-08-04 19:44:18 +0100358Role Based Access Control
Sean Condon9e182f62021-12-06 17:35:53 -0800359^^^^^^^^^^^^^^^^^^^^^^^^^
Zack Williams1ae109e2021-07-27 11:17:04 -0700360
Sean Condoneb95cd62021-08-04 19:44:18 +0100361When secured, access to the configuration in ROC is limited by the **groups** that a user belongs to.
362
363* **AetherROCAdmin** - users in this group have full read **and** write access to all configuration.
364* *<enterprise>* - users in a group the lowercase name of an enterprise, will have **read** access to that enterprise.
365* **EnterpriseAdmin** - users in this group will have read **and** write access the enterprise they belong to.
366
Sean Condon948aeaa2021-09-29 12:08:30 +0100367 For example in *keycloak-389-umbrella* the user *Daisy Duke* belongs to *starbucks* **and**
Sean Condoneb95cd62021-08-04 19:44:18 +0100368 *EnterpriseAdmin* and so has read **and** write access to items linked with *starbucks* enterprise.
369
370 By comparison the user *Elmer Fudd* belongs only to *starbucks* group and so has only **read** access to items
371 linked with the *starbucks* enterprise.
372
373Requests to a Secure System
Sean Condon9e182f62021-12-06 17:35:53 -0800374^^^^^^^^^^^^^^^^^^^^^^^^^^^
Zack Williams1ae109e2021-07-27 11:17:04 -0700375
Sean Condoneb95cd62021-08-04 19:44:18 +0100376When configuration is retrieved or updated through *aether-config*, a Bearer Token in the
Zack Williams1ae109e2021-07-27 11:17:04 -0700377form of a JSON Web Token (JWT) issued by the selected OIDC Issuer server must accompany
Sean Condoneb95cd62021-08-04 19:44:18 +0100378the request as an Authorization Header.
379
Zack Williams1ae109e2021-07-27 11:17:04 -0700380This applies to both the REST interface of ``aether-roc-api`` **and** the *gnmi* interface of
Sean Condon8d55a1e2021-11-11 12:49:00 +0000381``aether-config``.
Sean Condoneb95cd62021-08-04 19:44:18 +0100382
383In the Aether ROC, a Bearer Token can be generated by logging in and selecting API Key from the
384menu. This pops up a window with a copy button, where the key can be copied.
385
Sean Condon8d55a1e2021-11-11 12:49:00 +0000386Alternatively with Keycloak a Token may be requested programmatically through the Keycloak API::
387
Sean Condon9e182f62021-12-06 17:35:53 -0800388 curl --location --request POST 'https://keycloak-dev.onlab.us/auth/realms/master/protocol/openid-connect/token' \
Sean Condon8d55a1e2021-11-11 12:49:00 +0000389 --header 'Content-Type: application/x-www-form-urlencoded' \
390 --data-urlencode 'grant_type=password' \
391 --data-urlencode 'client_id=aether-roc-gui' \
392 --data-urlencode 'username=alicea' \
393 --data-urlencode 'password=password' \
Scott Baker6bd3d192022-03-03 14:50:38 -0800394 --data-urlencode 'scope=openid profile email groups' | jq "{access_token}"
Sean Condon8d55a1e2021-11-11 12:49:00 +0000395
396
Sean Condoneb95cd62021-08-04 19:44:18 +0100397The key will expire after 24 hours.
398
399.. image:: images/aether-roc-gui-copy-api-key.png
400 :width: 580
401 :alt: Aether ROC GUI allows copying of API Key to clipboard
402
403Accessing the REST interface from a tool like Postman, should include this Auth token.
404
405.. image:: images/postman-auth-token.png
406 :width: 930
407 :alt: Postman showing Authentication Token pasted in
408
409Logging
Zack Williams1ae109e2021-07-27 11:17:04 -0700410"""""""
411
Sean Condoneb95cd62021-08-04 19:44:18 +0100412The logs of *aether-config* will contain the **username** and **timestamp** of
413any **gnmi** call when security is enabled.
414
415.. image:: images/aether-config-log.png
416 :width: 887
417 :alt: aether-config log message showing username and timestamp
418
Sean Condon435be9a2021-08-06 14:28:37 +0100419Accessing GUI from an external system
Zack Williams1ae109e2021-07-27 11:17:04 -0700420"""""""""""""""""""""""""""""""""""""
421
Sean Condon435be9a2021-08-06 14:28:37 +0100422To access the ROC GUI from a computer outside the Cluster machine using *port-forwarding* then
423it is necessary to:
424
425* Ensure that all *port-forward*'s have **--address=0.0.0.0**
426* Add to the IP address of the cluster machine to the **/etc/hosts** of the outside computer as::
427
Sean Condon948aeaa2021-09-29 12:08:30 +0100428 <ip address of cluster> k3u-keycloak aether-roc-gui
Sean Condon9e182f62021-12-06 17:35:53 -0800429* 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 -0700430* Access the GUI through the hostname (rather than ip address) ``http://aether-roc-gui:8183``
Sean Condon435be9a2021-08-06 14:28:37 +0100431
Sean Condoneb95cd62021-08-04 19:44:18 +0100432Troubleshooting Secure Access
Zack Williams1ae109e2021-07-27 11:17:04 -0700433"""""""""""""""""""""""""""""
434
Sean Condoneb95cd62021-08-04 19:44:18 +0100435While every effort has been made to ensure that securing Aether is simple and effective,
436some difficulties may arise.
437
Sean Condon948aeaa2021-09-29 12:08:30 +0100438One of the most important steps is to validate that the OIDC Issuer (Keycloak server) can be reached
Sean Condoneb95cd62021-08-04 19:44:18 +0100439from the browser. The **well_known** URL should be available and show the important endpoints are correct.
440
Sean Condon948aeaa2021-09-29 12:08:30 +0100441.. image:: images/keycloak-389-umbrella-well-known.png
Sean Condoneb95cd62021-08-04 19:44:18 +0100442 :width: 580
Sean Condon948aeaa2021-09-29 12:08:30 +0100443 :alt: Keycloak Well Known page
Sean Condoneb95cd62021-08-04 19:44:18 +0100444
445If 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 +0100446redirect to the Keycloak login page.
Sean Condoneb95cd62021-08-04 19:44:18 +0100447
Sean Condon948aeaa2021-09-29 12:08:30 +0100448.. image:: images/keycloak-ldap-login-page.png
Sean Condoneb95cd62021-08-04 19:44:18 +0100449 :width: 493
Sean Condon948aeaa2021-09-29 12:08:30 +0100450 :alt: Keycloak Login page
Sean Condoneb95cd62021-08-04 19:44:18 +0100451
452When logged in the User details can be seen by clicking the User's name in the drop down menu.
453This shows the **groups** that the user belongs to, and can be used to debug RBAC issues.
454
455.. image:: images/aether-roc-gui-user-details.png
456 :width: 700
457 :alt: User Details page
458
Sean Condon948aeaa2021-09-29 12:08:30 +0100459When you sign out of the ROC GUI, if you are not redirected to the Keycloak Login Page,
Sean Condoneb95cd62021-08-04 19:44:18 +0100460you should check the Developer Console of the browser. The console should show the correct
Sean Condon948aeaa2021-09-29 12:08:30 +0100461OIDC issuer (Keycloak server), and that Auth is enabled.
Sean Condoneb95cd62021-08-04 19:44:18 +0100462
463.. image:: images/aether-roc-gui-console-loggedin.png
464 :width: 418
465 :alt: Browser Console showing correct configuration
466
Sean Condon8d55a1e2021-11-11 12:49:00 +0000467Keycloak installation issues
468^^^^^^^^^^^^^^^^^^^^^^^^^^^^
469
470The ``fedorea-389ds`` pod may restart a couple of times before it finally reaches running.
471There are 2 post install jobs that take some time to start. Overall allow 3 minutes for startup.
472
473Some users are finding that the Fedora pod will never reach a running state on resource
474constrained machines. This issue is being investigated.
475
476
Scott Bakerb46a6ed2021-08-02 14:03:10 -0700477ROC Data Model Conventions and Requirements
478-------------------------------------------
479
480The MEGA-Patch described above will bring up a fully compliant sample data model.
481However, it may be useful to bring up your own data model, customized to a different
482site of sites. This subsection documents conventions and requirements for the Aether
Zack Williams1ae109e2021-07-27 11:17:04 -0700483modeling within the ROC.
Scott Bakerb46a6ed2021-08-02 14:03:10 -0700484
485The ROC models must be configured with the following:
486
487* A default enterprise with the id `defaultent`.
Scott Bakerb46a6ed2021-08-02 14:03:10 -0700488* A default site with the id `defaultent-defaultsite`.
Scott Bakerae024102022-02-23 10:55:28 -0800489 This site should be within the `defaultent` enterprise.
490 This site is used by ``subscriber-proxy`` to place detected SIM Cards that cannot
491 be matched to an existing site.
Scott Bakerb46a6ed2021-08-02 14:03:10 -0700492
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700493Some exercises to get familiar
494------------------------------
495
Zack Williams1ae109e2021-07-27 11:17:04 -07004961. Deploy the ROC and POST the mega-patch, go into the ``aether-roc-gui`` and click
Scott Bakerae024102022-02-23 10:55:28 -0800497 through the Slice, DeviceGroup, and other objects to see that they were
Zack Williams1ae109e2021-07-27 11:17:04 -0700498 created as expected.
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700499
Scott Baker6bd3d192022-03-03 14:50:38 -08005002. Examine the log of the ``sdcore-adapter-v2`` container. It should be
Zack Williams1ae109e2021-07-27 11:17:04 -0700501 attempting to push the mega-patch’s changes. If you don’t have a core
502 available, it may be failing the push, but you should see the attempts.
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700503
Scott Baker6bd3d192022-03-03 14:50:38 -08005043. Change an object in the GUI. Watch the ``sdcore-adapter-v2`` log file and
Zack Williams1ae109e2021-07-27 11:17:04 -0700505 see that the adapter attempts to push the change.
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700506
Scott Baker6bd3d192022-03-03 14:50:38 -08005074. Try POSTing a change via the API. Observe the ``sdcore-adapter-v2`` log
Zack Williams1ae109e2021-07-27 11:17:04 -0700508 file and see that the adapter attempts to push the change.
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700509
Andy Bavierf73c3d22021-08-30 10:29:06 -07005105. Deploy a 5G Aether-in-a-Box (See :doc:`Setting Up Aether-in-a-Box
511 <aiab>`), modify the mega-patch to specify the URL for the Aether-in-a-Box
Zack Williams1ae109e2021-07-27 11:17:04 -0700512 ``webui`` container, POST the mega-patch, and observe that the changes were
Scott Baker6bd3d192022-03-03 14:50:38 -0800513 correctly pushed via the ``sdcore-adapter-v2`` into the ``sd-core``’s
Zack Williams1ae109e2021-07-27 11:17:04 -0700514 ``webui`` container (``webui`` container log will show configuration as it
515 is received)
Scott Bakerfab7c9e2021-07-29 17:12:16 -0700516
517.. |ROCGUI| image:: images/rocgui.png
Sean Condoneb95cd62021-08-04 19:44:18 +0100518 :width: 945
Scott Bakerae024102022-02-23 10:55:28 -0800519 :alt: ROC GUI showing list of Slices