Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 1 | .. vim: syntax=rst |
| 2 | |
| 3 | Aether ROC Developer Guide |
| 4 | ========================== |
| 5 | |
| 6 | Background / Development Environment |
| 7 | ------------------------------------ |
| 8 | |
| 9 | This document assumes familiarity with Kubernetes and Helm, and that a Kubernetes/Helm development |
| 10 | environment has already been deployed in the developer’s work environment. |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 11 | |
| 12 | This development environment can use any of a number of potential mechanisms -- including KinD, kubeadm, etc. |
| 13 | |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 14 | The Aether-in-a-Box script is one potential way to setup a development environment, but not the only way. |
| 15 | As an alternative to the developer’s local machine, a remote environment can be set up, for example on |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 16 | cloud infrastructure such as Cloudlab. |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 17 | |
Sean Condon | eb95cd6 | 2021-08-04 19:44:18 +0100 | [diff] [blame] | 18 | .. 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 Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 22 | Installing Prerequisites |
| 23 | ------------------------ |
| 24 | |
| 25 | Atomix and onos-operator must be installed:: |
| 26 | |
| 27 | # create necessary namespaces |
| 28 | kubectl create namespace micro-onos |
| 29 | |
Andy Bavier | 4c42541 | 2021-08-27 14:39:38 -0700 | [diff] [blame] | 30 | # 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 Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 35 | # install atomix |
Sean Condon | 70dcf70 | 2021-08-24 10:57:29 +0100 | [diff] [blame] | 36 | export ATOMIX_CONTROLLER_VERSION=0.6.8 |
Sean Condon | 257687f | 2021-08-23 11:13:20 +0100 | [diff] [blame] | 37 | helm -n kube-system install atomix-controller atomix/atomix-controller --version $ATOMIX_CONTROLLER_VERSION |
Sean Condon | 9f3b5a0 | 2021-10-19 17:47:59 +0100 | [diff] [blame] | 38 | export ATOMIX_RAFT_VERSION=0.1.14 |
Sean Condon | 70dcf70 | 2021-08-24 10:57:29 +0100 | [diff] [blame] | 39 | helm -n kube-system install atomix-raft-storage atomix/atomix-raft-storage --version $ATOMIX_RAFT_VERSION |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 40 | |
| 41 | # install the onos operator |
Sean Condon | 9f3b5a0 | 2021-10-19 17:47:59 +0100 | [diff] [blame] | 42 | ONOS_OPERATOR_VERSION=0.4.12 |
Sean Condon | 257687f | 2021-08-23 11:13:20 +0100 | [diff] [blame] | 43 | helm install -n kube-system onos-operator onosproject/onos-operator --version $ONOS_OPERATOR_VERSION |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 44 | |
Sean Condon | 257687f | 2021-08-23 11:13:20 +0100 | [diff] [blame] | 45 | .. note:: The ROC is sensitive to the versions of Atomix and onos-operator installed. The values |
Sean Condon | 1df1fcf | 2021-09-20 09:45:39 +0100 | [diff] [blame] | 46 | shown above are correct for the 1.3.x versions of the *aether-roc-umbrella*. |
Sean Condon | 257687f | 2021-08-23 11:13:20 +0100 | [diff] [blame] | 47 | |
| 48 | .. list-table:: ROC support component version matrix |
Sean Condon | 70dcf70 | 2021-08-24 10:57:29 +0100 | [diff] [blame] | 49 | :widths: 40 20 20 20 |
Sean Condon | 257687f | 2021-08-23 11:13:20 +0100 | [diff] [blame] | 50 | :header-rows: 1 |
| 51 | |
| 52 | * - ROC Version |
| 53 | - Atomix Controller |
| 54 | - Atomix Raft |
| 55 | - Onos Operator |
Sean Condon | 70dcf70 | 2021-08-24 10:57:29 +0100 | [diff] [blame] | 56 | * - 1.2.25-1.2.45 |
Sean Condon | 257687f | 2021-08-23 11:13:20 +0100 | [diff] [blame] | 57 | - 0.6.7 |
| 58 | - 0.1.8 |
| 59 | - 0.4.8 |
Sean Condon | 9f3b5a0 | 2021-10-19 17:47:59 +0100 | [diff] [blame] | 60 | * - 1.3.0-1.3.10 |
Sean Condon | 70dcf70 | 2021-08-24 10:57:29 +0100 | [diff] [blame] | 61 | - 0.6.8 |
| 62 | - 0.1.9 |
Sean Condon | 1df1fcf | 2021-09-20 09:45:39 +0100 | [diff] [blame] | 63 | - 0.4.10 |
Sean Condon | 9f3b5a0 | 2021-10-19 17:47:59 +0100 | [diff] [blame] | 64 | * - 1.3.11-,1.4.0- |
| 65 | - 0.6.8 |
| 66 | - 0.1.14 |
| 67 | - 0.4.12 |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 68 | |
| 69 | Verify that these services were installed properly. |
| 70 | You should see pods for *atomix-controller*, *atomix-raft-storage-controller*, |
| 71 | *onos-operator-config*, and *onos-operator-topo*. |
| 72 | Execute these commands:: |
| 73 | |
Sean Condon | 257687f | 2021-08-23 11:13:20 +0100 | [diff] [blame] | 74 | helm -n kube-system list |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 75 | kubectl -n kube-system get pods | grep -i atomix |
| 76 | kubectl -n kube-system get pods | grep -i onos |
| 77 | |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 78 | Create a values-override.yaml |
| 79 | ----------------------------- |
| 80 | |
| 81 | You’ll want to override several of the defaults in the ROC helm charts:: |
| 82 | |
| 83 | cat > values-override.yaml <<EOF |
| 84 | import: |
Scott Baker | b46a6ed | 2021-08-02 14:03:10 -0700 | [diff] [blame] | 85 | onos-gui: |
| 86 | enabled: true |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 87 | |
| 88 | onos-gui: |
Scott Baker | b46a6ed | 2021-08-02 14:03:10 -0700 | [diff] [blame] | 89 | ingress: |
| 90 | enabled: false |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 91 | |
| 92 | aether-roc-gui-v3: |
Scott Baker | b46a6ed | 2021-08-02 14:03:10 -0700 | [diff] [blame] | 93 | ingress: |
| 94 | enabled: false |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 95 | EOF |
| 96 | |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 97 | Installing the ``aether-roc-umbrella`` Helm chart |
| 98 | ------------------------------------------------- |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 99 | |
| 100 | Add the necessary helm repositories:: |
| 101 | |
| 102 | # obtain username and password from Michelle and/or ONF infra team |
| 103 | export repo_user=<username> |
| 104 | export repo_password=<password> |
Sean Condon | 1df1fcf | 2021-09-20 09:45:39 +0100 | [diff] [blame] | 105 | helm repo add aether --username "$repo_user" --password "$repo_password" https://charts.aetherproject.org |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 106 | |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 107 | ``aether-roc-umbrella`` will bring up the ROC and its services:: |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 108 | |
Sean Condon | 1df1fcf | 2021-09-20 09:45:39 +0100 | [diff] [blame] | 109 | helm -n micro-onos install aether-roc-umbrella aether/aether-roc-umbrella -f values-override.yaml |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 110 | |
| 111 | kubectl wait pod -n micro-onos --for=condition=Ready -l type=config --timeout=300s |
| 112 | |
| 113 | |
Sean Condon | f918f64 | 2021-08-04 14:32:53 +0100 | [diff] [blame] | 114 | .. _posting-the-mega-patch: |
| 115 | |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 116 | Posting the mega-patch |
| 117 | ---------------------- |
| 118 | |
| 119 | The ROC usually comes up in a blank state -- there are no Enterprises, UEs, or other artifacts present in it. |
| 120 | The mega-patch is an example patch that populates the ROC with some sample enterprises, UEs, slices, etc. |
| 121 | Execute the following:: |
| 122 | |
| 123 | # launch a port-forward for the API |
| 124 | # this will continue to run in the background |
| 125 | kubectl -n micro-onos port-forward service/aether-roc-api --address 0.0.0.0 8181:8181 & |
| 126 | |
| 127 | git clone https://github.com/onosproject/aether-roc-api.git |
| 128 | |
| 129 | # execute the mega-patch (it will post via CURL to localhost:8181) |
Sean Condon | 9f3b5a0 | 2021-10-19 17:47:59 +0100 | [diff] [blame] | 130 | bash ~/path/to/aether-roc-api/examples/MEGA_Patch_40.curl |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 131 | |
| 132 | |
| 133 | You may wish to customize the mega patch. |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 134 | |
| 135 | For example, by default the patch configures the ``sdcore-adapter`` to push to |
| 136 | ``sdcore-test-dummy``. |
| 137 | |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 138 | You could configure it to push to a live aether-in-a-box core by doing something like this:: |
| 139 | |
Sean Condon | 9f3b5a0 | 2021-10-19 17:47:59 +0100 | [diff] [blame] | 140 | sed -i 's^http://aether-roc-umbrella-sdcore-test-dummy/v1/config/5g^http://webui.omec.svc.cluster.local:9089/config^g' MEGA_Patch_40.curl |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 141 | |
| 142 | #apply the patch |
Sean Condon | 9f3b5a0 | 2021-10-19 17:47:59 +0100 | [diff] [blame] | 143 | ./MEGA_Patch_40.curl |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 144 | |
| 145 | (Note that if your Aether-in-a-Box was installed on a different machine that port-forwarding may be necessary) |
| 146 | |
| 147 | |
| 148 | Expected CURL output from a successful mega-patch post will be a UUID. |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 149 | |
| 150 | You can also verify that the mega-patch was successful by going into the |
| 151 | ``aether-roc-gui`` in a browser (see the section on useful port-forwards |
| 152 | below). The GUI may open to a dashboard that is unpopulated -- you can use the |
| 153 | dropdown menu (upper-right hand corner of the screen) to select an object such |
| 154 | as VCS and you will see a list of VCS. |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 155 | |
| 156 | |ROCGUI| |
| 157 | |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 158 | Uninstalling the ``aether-roc-umbrella`` Helm chart |
| 159 | --------------------------------------------------- |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 160 | |
| 161 | To tear things back down, usually as part of a developer loop prior to redeploying again, do the following:: |
| 162 | |
| 163 | helm -n micro-onos del aether-roc-umbrella |
| 164 | |
| 165 | If the uninstall hangs or if a subsequent reinstall hangs, it could be an issue with some of the CRDs |
| 166 | not getting cleaned up. The following may be useful:: |
| 167 | |
| 168 | # fix stuck finalizers in operator CRDs |
| 169 | |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 170 | kubectl -n micro-onos patch entities connectivity-service-v3 --type json --patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]' |
| 171 | |
Sean Condon | 9f3b5a0 | 2021-10-19 17:47:59 +0100 | [diff] [blame] | 172 | kubectl -n micro-onos patch entities connectivity-service-v4 --type json --patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]' |
| 173 | |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 174 | kubectl -n micro-onos patch kind aether --type json --patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]' |
| 175 | |
| 176 | Useful port forwards |
| 177 | -------------------- |
| 178 | |
| 179 | Port forwarding is often necessary to allow access to ports inside of Kubernetes pods that use ClusterIP addressing. |
| 180 | Note that you typically need to leave a port-forward running (you can put it in the background). |
| 181 | Also, If you redeploy the ROC and/or if a pod crashes then you might have to restart a port-forward. |
| 182 | The following port-forwards may be useful:: |
| 183 | |
| 184 | # aether-roc-api |
| 185 | |
| 186 | kubectl -n micro-onos port-forward service/aether-roc-api --address 0.0.0.0 8181:8181 |
| 187 | |
| 188 | # aether-roc-gui |
| 189 | |
| 190 | kubectl -n micro-onos port-forward service/aether-roc-gui --address 0.0.0.0 8183:80 |
| 191 | |
| 192 | # grafana |
| 193 | |
| 194 | kubectl -n micro-onos port-forward service/aether-roc-umbrella-grafana --address 0.0.0.0 8187:80 |
| 195 | |
| 196 | # onos gui |
| 197 | |
| 198 | kubectl -n micro-onos port-forward service/onos-gui --address 0.0.0.0 8182:80 |
| 199 | |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 200 | ``aether-roc-api`` and ``aether-roc-gui`` are in our experience the most useful two port-forwards. |
| 201 | |
| 202 | ``aether-roc-api`` is useful to be able to POST REST API requests. |
| 203 | |
| 204 | ``aether-roc-gui`` is useful to be able to interactively browse the current configuration. |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 205 | |
Sean Condon | 257687f | 2021-08-23 11:13:20 +0100 | [diff] [blame] | 206 | .. note:: Internally the ``aether-roc-gui`` operates a Reverse Proxy on the ``aether-roc-api``. This |
| 207 | means that if you have done a ``port-forward`` to ``aether-roc-gui`` say on port ``8183`` there's no |
| 208 | need to do another on the ``aether-roc-api`` instead you can access the API on |
| 209 | ``http://localhost:8183/aether-roc-api`` |
| 210 | |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 211 | Deploying using custom images |
| 212 | ----------------------------- |
| 213 | |
| 214 | Custom images may be used by editing the values-override.yaml file. |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 215 | For example, to deploy a custom ``sdcore-adapter``:: |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 216 | |
| 217 | sdcore-adapter-v3: |
| 218 | |
| 219 | prometheusEnabled: false |
| 220 | |
| 221 | image: |
| 222 | |
| 223 | repository: my-private-repo/sdcore-adapter |
| 224 | |
| 225 | tag: my-tag |
| 226 | |
| 227 | pullPolicy: Always |
| 228 | |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 229 | The above example assumes you have published a docker images at ``my-private-repo/sdcore-adapter:my-tag``. |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 230 | My particular workflow is to deploy a local-docker registry and push my images to that. |
| 231 | Please do not publish ONF images to a public repository unless the image is intended to be public. |
| 232 | Several ONF repositories are private, and therefore their docker artifacts should also be private. |
| 233 | |
| 234 | There are alternatives to using a private docker repository. |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 235 | For example, if you are using kubeadm, then you may be able to simply tag the image locally. |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 236 | If you’re using KinD, then you can push a local image to into the kind cluster:: |
| 237 | |
| 238 | kind load docker-image sdcore-adapter:my-tag |
| 239 | |
Scott Baker | abcfc6e | 2021-09-08 22:37:51 -0700 | [diff] [blame] | 240 | Developing using a custom onos-config |
| 241 | ------------------------------------- |
| 242 | |
| 243 | The onos-operator is responsible for building model plugins at runtime. To do this, it needs source code |
| 244 | for onos-config that matches the onos-config image that is deployed. One way to do this is to fork the |
| 245 | onos-config repository and commit your onos-config changes to a personal repository, and then reference |
| 246 | that personal repository in the values.yaml. For example:: |
| 247 | |
| 248 | onos-config: |
| 249 | plugin: |
| 250 | compiler: |
| 251 | target: "github.com/mygithubaccount/onos-config@mytag" |
| 252 | image: |
| 253 | repository: mydockeraccount/onos-config |
| 254 | tag: mytag |
| 255 | pullPolicy: Always |
| 256 | |
| 257 | In the above example, the operator will pull the image from `mydockeraccount`, and it'll pull the |
| 258 | onos-config code from `mygithubaccount`. Using a personal docker account is not strictly necessary; |
| 259 | images can also be built and tagged entirely locally. |
| 260 | |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 261 | Inspecting logs |
| 262 | --------------- |
| 263 | |
| 264 | Most of the relevant Kubernetes pods are in the micro-onos namespace. |
| 265 | The names may change from deployment to deployment, so start by getting a list of pods:: |
| 266 | |
| 267 | kubectl -n micro-onos get pods |
| 268 | |
| 269 | Then you can inspect a specific pod/container:: |
| 270 | |
| 271 | kubectl -n micro-onos logs sdcore-adapter-v3-7468cc58dc-ktctz sdcore-adapter-v3 |
| 272 | |
Sean Condon | eb95cd6 | 2021-08-04 19:44:18 +0100 | [diff] [blame] | 273 | .. _securing_roc: |
| 274 | |
| 275 | Securing ROC |
| 276 | ------------ |
| 277 | |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 278 | When deploying ROC with the ``aether-roc-umbrella`` chart, secure mode can be enabled by |
Sean Condon | eb95cd6 | 2021-08-04 19:44:18 +0100 | [diff] [blame] | 279 | specifying an OpenID Connect (OIDC) issuer like:: |
| 280 | |
Andy Bavier | e86261e | 2021-09-21 11:05:18 -0700 | [diff] [blame] | 281 | helm -n micro-onos install aether-roc-umbrella aether/aether-roc-umbrella \ |
Sean Condon | 948aeaa | 2021-09-29 12:08:30 +0100 | [diff] [blame] | 282 | --set onos-config.openidc.issuer=http://k3u-keycloak:80/auth/realms/master \ |
| 283 | --set aether-roc-gui-v3.openidc.issuer=http://k3u-keycloak:5557/auth/realms/master |
Sean Condon | eb95cd6 | 2021-08-04 19:44:18 +0100 | [diff] [blame] | 284 | |
Sean Condon | 948aeaa | 2021-09-29 12:08:30 +0100 | [diff] [blame] | 285 | The choice of OIDC issuer in this case is ``keycloak-389-umbrella``, or alternately ``dex-ldap-umbrella`` (deprecated). |
Sean Condon | eb95cd6 | 2021-08-04 19:44:18 +0100 | [diff] [blame] | 286 | |
Sean Condon | 948aeaa | 2021-09-29 12:08:30 +0100 | [diff] [blame] | 287 | ``keycloak-389-umbrella`` |
| 288 | """"""""""""""""""""""""" |
| 289 | |
| 290 | Keycloak is an Open Source Identity and Access Management for Modern Applications and |
| 291 | Services. It can be used as an OIDC Issuer than can act as a front end to several authentication systems |
| 292 | e.g. LDAP, Crowd, Google, GitHub |
| 293 | |
| 294 | ``keycloak-389-umbrella`` is a Helm chart that combines a Keycloak server with an LDAP |
| 295 | installation (389 Directory Server), and an LDAP administration tool. It can be deployed in to the |
| 296 | same cluster namespace as ``aether-roc-umbrella``. |
| 297 | |
| 298 | Its LDAP server is populated with 7 different users in the 2 example enterprises - *starbucks* and *acme*. |
| 299 | |
| 300 | When running it should be available at *http://k3u-keycloak:5557/auth/realms/master/.well-known/openid-configuration*. |
| 301 | |
| 302 | See `keycloak-389-umbrella <https://github.com/onosproject/onos-helm-charts/tree/master/keycloak-389-umbrella#readme>`_ |
| 303 | for more details. |
| 304 | |
| 305 | In a production environment, the public Aether Keycloak (with its LDAP server populated with Aether users and groups) should be used. |
| 306 | See `public keycloak <https://keycloak.opennetworking.org/auth/realms/master/.well-known/openid-configuration>`_ for more details. |
| 307 | |
| 308 | .. note:: Your RBAC access to ROC will be limited by the groups you belong to in its LDAP store. |
| 309 | |
| 310 | ``dex-ldap-umbrella`` (Deprecated) |
| 311 | """""""""""""""""""""""""""""""""" |
Sean Condon | eb95cd6 | 2021-08-04 19:44:18 +0100 | [diff] [blame] | 312 | |
| 313 | Dex is a cloud native OIDC Issuer than can act as a front end to several authentication systems |
| 314 | e.g. LDAP, Crowd, Google, GitHub |
| 315 | |
Sean Condon | 948aeaa | 2021-09-29 12:08:30 +0100 | [diff] [blame] | 316 | ``dex-ldap-umbrella`` is a Helm chart that combines a Dex server with an OpenLDAP |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 317 | installation, and an LDAP administration tool. It can be deployed in to the |
| 318 | same cluster namespace as ``aether-roc-umbrella``. |
Sean Condon | eb95cd6 | 2021-08-04 19:44:18 +0100 | [diff] [blame] | 319 | |
| 320 | Its LDAP server is populated with 7 different users in the 2 example enterprises - *starbucks* and *acme*. |
| 321 | |
| 322 | When running it should be available at *http://dex-ldap-umbrella:5556/.well-known/openid-configuration*. |
| 323 | |
| 324 | See `dex-ldap-umbrella <https://github.com/onosproject/onos-helm-charts/tree/master/dex-ldap-umbrella#readme>`_ |
| 325 | for more details. |
| 326 | |
| 327 | As an alternative there is a public Dex server connected to the ONF Crowd server, that allows |
| 328 | ONF staff to login with their own credentials: |
| 329 | See `public dex <https://dex.aetherproject.org/dex/.well-known/openid-configuration>`_ for more details. |
| 330 | |
| 331 | .. note:: Your RBAC access to ROC will be limited by the groups you belong to in Crowd. |
| 332 | |
| 333 | Role Based Access Control |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 334 | """"""""""""""""""""""""" |
| 335 | |
Sean Condon | eb95cd6 | 2021-08-04 19:44:18 +0100 | [diff] [blame] | 336 | When secured, access to the configuration in ROC is limited by the **groups** that a user belongs to. |
| 337 | |
| 338 | * **AetherROCAdmin** - users in this group have full read **and** write access to all configuration. |
| 339 | * *<enterprise>* - users in a group the lowercase name of an enterprise, will have **read** access to that enterprise. |
| 340 | * **EnterpriseAdmin** - users in this group will have read **and** write access the enterprise they belong to. |
| 341 | |
Sean Condon | 948aeaa | 2021-09-29 12:08:30 +0100 | [diff] [blame] | 342 | For example in *keycloak-389-umbrella* the user *Daisy Duke* belongs to *starbucks* **and** |
Sean Condon | eb95cd6 | 2021-08-04 19:44:18 +0100 | [diff] [blame] | 343 | *EnterpriseAdmin* and so has read **and** write access to items linked with *starbucks* enterprise. |
| 344 | |
| 345 | By comparison the user *Elmer Fudd* belongs only to *starbucks* group and so has only **read** access to items |
| 346 | linked with the *starbucks* enterprise. |
| 347 | |
| 348 | Requests to a Secure System |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 349 | """"""""""""""""""""""""""" |
| 350 | |
Sean Condon | eb95cd6 | 2021-08-04 19:44:18 +0100 | [diff] [blame] | 351 | When configuration is retrieved or updated through *aether-config*, a Bearer Token in the |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 352 | form of a JSON Web Token (JWT) issued by the selected OIDC Issuer server must accompany |
Sean Condon | eb95cd6 | 2021-08-04 19:44:18 +0100 | [diff] [blame] | 353 | the request as an Authorization Header. |
| 354 | |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 355 | This applies to both the REST interface of ``aether-roc-api`` **and** the *gnmi* interface of |
| 356 | ``aether-rconfig``. |
Sean Condon | eb95cd6 | 2021-08-04 19:44:18 +0100 | [diff] [blame] | 357 | |
| 358 | In the Aether ROC, a Bearer Token can be generated by logging in and selecting API Key from the |
| 359 | menu. This pops up a window with a copy button, where the key can be copied. |
| 360 | |
| 361 | The key will expire after 24 hours. |
| 362 | |
| 363 | .. image:: images/aether-roc-gui-copy-api-key.png |
| 364 | :width: 580 |
| 365 | :alt: Aether ROC GUI allows copying of API Key to clipboard |
| 366 | |
| 367 | Accessing the REST interface from a tool like Postman, should include this Auth token. |
| 368 | |
| 369 | .. image:: images/postman-auth-token.png |
| 370 | :width: 930 |
| 371 | :alt: Postman showing Authentication Token pasted in |
| 372 | |
| 373 | Logging |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 374 | """"""" |
| 375 | |
Sean Condon | eb95cd6 | 2021-08-04 19:44:18 +0100 | [diff] [blame] | 376 | The logs of *aether-config* will contain the **username** and **timestamp** of |
| 377 | any **gnmi** call when security is enabled. |
| 378 | |
| 379 | .. image:: images/aether-config-log.png |
| 380 | :width: 887 |
| 381 | :alt: aether-config log message showing username and timestamp |
| 382 | |
Sean Condon | 435be9a | 2021-08-06 14:28:37 +0100 | [diff] [blame] | 383 | Accessing GUI from an external system |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 384 | """"""""""""""""""""""""""""""""""""" |
| 385 | |
Sean Condon | 435be9a | 2021-08-06 14:28:37 +0100 | [diff] [blame] | 386 | To access the ROC GUI from a computer outside the Cluster machine using *port-forwarding* then |
| 387 | it is necessary to: |
| 388 | |
| 389 | * Ensure that all *port-forward*'s have **--address=0.0.0.0** |
| 390 | * Add to the IP address of the cluster machine to the **/etc/hosts** of the outside computer as:: |
| 391 | |
Sean Condon | 948aeaa | 2021-09-29 12:08:30 +0100 | [diff] [blame] | 392 | <ip address of cluster> k3u-keycloak aether-roc-gui |
| 393 | * Verify that you can access the Keycloak server by its name *http://k3u-keycloak:5557/auth/realms/master/.well-known/openid-configuration* |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 394 | * Access the GUI through the hostname (rather than ip address) ``http://aether-roc-gui:8183`` |
Sean Condon | 435be9a | 2021-08-06 14:28:37 +0100 | [diff] [blame] | 395 | |
Sean Condon | eb95cd6 | 2021-08-04 19:44:18 +0100 | [diff] [blame] | 396 | Troubleshooting Secure Access |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 397 | """"""""""""""""""""""""""""" |
| 398 | |
Sean Condon | eb95cd6 | 2021-08-04 19:44:18 +0100 | [diff] [blame] | 399 | While every effort has been made to ensure that securing Aether is simple and effective, |
| 400 | some difficulties may arise. |
| 401 | |
Sean Condon | 948aeaa | 2021-09-29 12:08:30 +0100 | [diff] [blame] | 402 | One of the most important steps is to validate that the OIDC Issuer (Keycloak server) can be reached |
Sean Condon | eb95cd6 | 2021-08-04 19:44:18 +0100 | [diff] [blame] | 403 | from the browser. The **well_known** URL should be available and show the important endpoints are correct. |
| 404 | |
Sean Condon | 948aeaa | 2021-09-29 12:08:30 +0100 | [diff] [blame] | 405 | .. image:: images/keycloak-389-umbrella-well-known.png |
Sean Condon | eb95cd6 | 2021-08-04 19:44:18 +0100 | [diff] [blame] | 406 | :width: 580 |
Sean Condon | 948aeaa | 2021-09-29 12:08:30 +0100 | [diff] [blame] | 407 | :alt: Keycloak Well Known page |
Sean Condon | eb95cd6 | 2021-08-04 19:44:18 +0100 | [diff] [blame] | 408 | |
| 409 | If logged out of the Browser when accessing the Aether ROC GUI, accessing any page of the application should |
Sean Condon | 948aeaa | 2021-09-29 12:08:30 +0100 | [diff] [blame] | 410 | redirect to the Keycloak login page. |
Sean Condon | eb95cd6 | 2021-08-04 19:44:18 +0100 | [diff] [blame] | 411 | |
Sean Condon | 948aeaa | 2021-09-29 12:08:30 +0100 | [diff] [blame] | 412 | .. image:: images/keycloak-ldap-login-page.png |
Sean Condon | eb95cd6 | 2021-08-04 19:44:18 +0100 | [diff] [blame] | 413 | :width: 493 |
Sean Condon | 948aeaa | 2021-09-29 12:08:30 +0100 | [diff] [blame] | 414 | :alt: Keycloak Login page |
Sean Condon | eb95cd6 | 2021-08-04 19:44:18 +0100 | [diff] [blame] | 415 | |
| 416 | When logged in the User details can be seen by clicking the User's name in the drop down menu. |
| 417 | This shows the **groups** that the user belongs to, and can be used to debug RBAC issues. |
| 418 | |
| 419 | .. image:: images/aether-roc-gui-user-details.png |
| 420 | :width: 700 |
| 421 | :alt: User Details page |
| 422 | |
Sean Condon | 948aeaa | 2021-09-29 12:08:30 +0100 | [diff] [blame] | 423 | When you sign out of the ROC GUI, if you are not redirected to the Keycloak Login Page, |
Sean Condon | eb95cd6 | 2021-08-04 19:44:18 +0100 | [diff] [blame] | 424 | you should check the Developer Console of the browser. The console should show the correct |
Sean Condon | 948aeaa | 2021-09-29 12:08:30 +0100 | [diff] [blame] | 425 | OIDC issuer (Keycloak server), and that Auth is enabled. |
Sean Condon | eb95cd6 | 2021-08-04 19:44:18 +0100 | [diff] [blame] | 426 | |
| 427 | .. image:: images/aether-roc-gui-console-loggedin.png |
| 428 | :width: 418 |
| 429 | :alt: Browser Console showing correct configuration |
| 430 | |
Scott Baker | b46a6ed | 2021-08-02 14:03:10 -0700 | [diff] [blame] | 431 | ROC Data Model Conventions and Requirements |
| 432 | ------------------------------------------- |
| 433 | |
| 434 | The MEGA-Patch described above will bring up a fully compliant sample data model. |
| 435 | However, it may be useful to bring up your own data model, customized to a different |
| 436 | site of sites. This subsection documents conventions and requirements for the Aether |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 437 | modeling within the ROC. |
Scott Baker | b46a6ed | 2021-08-02 14:03:10 -0700 | [diff] [blame] | 438 | |
| 439 | The ROC models must be configured with the following: |
| 440 | |
| 441 | * A default enterprise with the id `defaultent`. |
| 442 | * A default ip-domain with the id `defaultent-defaultip`. |
| 443 | * A default site with the id `defaultent-defaultsite`. |
| 444 | This site should be linked to the `defaultent` enterprise. |
| 445 | * A default device group with the id `defaultent-defaultsite-default`. |
| 446 | This device group should be linked to the `defaultent-defaultip` ip-domain |
| 447 | and the `defaultent-defaultsite` site. |
| 448 | |
| 449 | Each Enterprise Site must be configured with a default device group and that default |
| 450 | device group's name must end in the suffix `-default`. For example, `acme-chicago-default`. |
| 451 | |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 452 | Some exercises to get familiar |
| 453 | ------------------------------ |
| 454 | |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 455 | 1. Deploy the ROC and POST the mega-patch, go into the ``aether-roc-gui`` and click |
| 456 | through the VCS, DeviceGroup, and other objects to see that they were |
| 457 | created as expected. |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 458 | |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 459 | 2. Examine the log of the ``sdcore-adapter-v3`` container. It should be |
| 460 | attempting to push the mega-patch’s changes. If you don’t have a core |
| 461 | available, it may be failing the push, but you should see the attempts. |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 462 | |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 463 | 3. Change an object in the GUI. Watch the ``sdcore-adapter-v3`` log file and |
| 464 | see that the adapter attempts to push the change. |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 465 | |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 466 | 4. Try POSTing a change via the API. Observe the ``sdcore-adapter-v3`` log |
| 467 | file and see that the adapter attempts to push the change. |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 468 | |
Andy Bavier | f73c3d2 | 2021-08-30 10:29:06 -0700 | [diff] [blame] | 469 | 5. Deploy a 5G Aether-in-a-Box (See :doc:`Setting Up Aether-in-a-Box |
| 470 | <aiab>`), modify the mega-patch to specify the URL for the Aether-in-a-Box |
Zack Williams | 1ae109e | 2021-07-27 11:17:04 -0700 | [diff] [blame] | 471 | ``webui`` container, POST the mega-patch, and observe that the changes were |
| 472 | correctly pushed via the ``sdcore-adapter-v3`` into the ``sd-core``’s |
| 473 | ``webui`` container (``webui`` container log will show configuration as it |
| 474 | is received) |
Scott Baker | fab7c9e | 2021-07-29 17:12:16 -0700 | [diff] [blame] | 475 | |
| 476 | .. |ROCGUI| image:: images/rocgui.png |
Sean Condon | eb95cd6 | 2021-08-04 19:44:18 +0100 | [diff] [blame] | 477 | :width: 945 |
| 478 | :alt: ROC GUI showing list of VCS |