blob: a3b2f9bee54e441a09b42c93745e42bd9ebdc4b3 [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 developers work environment.
11This development environment can use any of a number of potential mechanisms -- including KinD, Kubeadm, etc.
12The Aether-in-a-Box script is one potential way to setup a development environment, but not the only way.
13As an alternative to the developers local machine, a remote environment can be set up, for example on
14cloud infrastructure such as cloudlab.
15
16Installing Prerequisites
17------------------------
18
19Atomix and onos-operator must be installed::
20
21 # create necessary namespaces
22 kubectl create namespace micro-onos
23
24 # install atomix
25 helm -n kube-system install atomix-controller atomix/atomix-controller
26 helm -n kube-system install atomix-raft-storage atomix/atomix-raft-storage
27
28 # install the onos operator
29 helm install -n kube-system onos-operator onosproject/onos-operator
30
31
32Verify that these services were installed properly.
33You should see pods for *atomix-controller*, *atomix-raft-storage-controller*,
34*onos-operator-config*, and *onos-operator-topo*.
35Execute these commands::
36
37 kubectl -n kube-system get pods | grep -i atomix
38 kubectl -n kube-system get pods | grep -i onos
39
40
41Create a values-override.yaml
42-----------------------------
43
44Youll want to override several of the defaults in the ROC helm charts::
45
46 cat > values-override.yaml <<EOF
47 import:
48 onos-gui:
49 enabled: true
50
51 onos-gui:
52 ingress:
53 enabled: false
54
55 sdcore-adapter-v3:
56 prometheusEnabled: false
57
58 sdcore-exporter:
59 prometheusEnabled: false
60
61 onos-exporter:
62 prometheusEnabled: false
63
64 aether-roc-gui-v3:
65 ingress:
66 enabled: false
67 EOF
68
69Installing the Aether-Roc-Umbrella Helm chart
70---------------------------------------------
71
72Add the necessary helm repositories::
73
74 # obtain username and password from Michelle and/or ONF infra team
75 export repo_user=<username>
76 export repo_password=<password>
77 helm repo add sdran --username "$repo_user" --password "$repo_password" https://sdrancharts.onosproject.org
78
79Aether-Roc-Umbrella will bring up the ROC and its services::
80
81 helm -n micro-onos install aether-roc-umbrella sdran/aether-roc-umbrella -f values-override.yaml
82
83 kubectl wait pod -n micro-onos --for=condition=Ready -l type=config --timeout=300s
84
85
86Posting the mega-patch
87----------------------
88
89The ROC usually comes up in a blank state -- there are no Enterprises, UEs, or other artifacts present in it.
90The mega-patch is an example patch that populates the ROC with some sample enterprises, UEs, slices, etc.
91Execute the following::
92
93 # launch a port-forward for the API
94 # this will continue to run in the background
95 kubectl -n micro-onos port-forward service/aether-roc-api --address 0.0.0.0 8181:8181 &
96
97 git clone https://github.com/onosproject/aether-roc-api.git
98
99 # execute the mega-patch (it will post via CURL to localhost:8181)
100 bash ~/path/to/aether-roc-api/examples/MEGA_Patch.curl
101
102
103You may wish to customize the mega patch.
104For example, by default the patch configures the sdcore-adapter to push to sdcore-test-dummy.
105You could configure it to push to a live aether-in-a-box core by doing something like this::
106
107 sed -i 's^http://aether-roc-umbrella-sdcore-test-dummy/v1/config/5g^http://webui.omec.svc.cluster.local:9089/config^g' MEGA_Patch.curl
108
109 #apply the patch
110 ./MEGA_Patch.curl
111
112(Note that if your Aether-in-a-Box was installed on a different machine that port-forwarding may be necessary)
113
114
115Expected CURL output from a successful mega-patch post will be a UUID.
116You can also verify that the mega-patch was successful by going into the aether-roc-gui in a browser
117(see the section on useful port-forwards below). The GUI may open to a dashboard that is unpopulated -- you
118can use the dropdown menu (upper-right hand corner of the screen) to select an object such as VCS and you
119will see a list of VCS.
120
121 |ROCGUI|
122
123Uninstalling the Aether-Roc-Umbrella Helm chart
124-----------------------------------------------
125
126To tear things back down, usually as part of a developer loop prior to redeploying again, do the following::
127
128 helm -n micro-onos del aether-roc-umbrella
129
130If the uninstall hangs or if a subsequent reinstall hangs, it could be an issue with some of the CRDs
131not getting cleaned up. The following may be useful::
132
133 # fix stuck finalizers in operator CRDs
134
135 kubectl -n micro-onos patch entities connectivity-service-v2 --type json --patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]'
136
137 kubectl -n micro-onos patch entities connectivity-service-v3 --type json --patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]'
138
139 kubectl -n micro-onos patch kind aether --type json --patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]'
140
141Useful port forwards
142--------------------
143
144Port forwarding is often necessary to allow access to ports inside of Kubernetes pods that use ClusterIP addressing.
145Note that you typically need to leave a port-forward running (you can put it in the background).
146Also, If you redeploy the ROC and/or if a pod crashes then you might have to restart a port-forward.
147The following port-forwards may be useful::
148
149 # aether-roc-api
150
151 kubectl -n micro-onos port-forward service/aether-roc-api --address 0.0.0.0 8181:8181
152
153 # aether-roc-gui
154
155 kubectl -n micro-onos port-forward service/aether-roc-gui --address 0.0.0.0 8183:80
156
157 # grafana
158
159 kubectl -n micro-onos port-forward service/aether-roc-umbrella-grafana --address 0.0.0.0 8187:80
160
161 # onos gui
162
163 kubectl -n micro-onos port-forward service/onos-gui --address 0.0.0.0 8182:80
164
165Aether-roc-api and aether-roc-gui are in our experience the most useful two port-forwards.
166Aether-roc-api is useful to be able to POST REST API requests.
167Aether-roc-gui is useful to be able to interactively browse the current configuration.
168
169Deploying using custom images
170-----------------------------
171
172Custom images may be used by editing the values-override.yaml file.
173For example, to deploy a custom sdcore-adapter::
174
175 sdcore-adapter-v3:
176
177 prometheusEnabled: false
178
179 image:
180
181 repository: my-private-repo/sdcore-adapter
182
183 tag: my-tag
184
185 pullPolicy: Always
186
187The above example assumes you have published a docker images at my-private-repo/sdcore-adapter:my-tag.
188My particular workflow is to deploy a local-docker registry and push my images to that.
189Please do not publish ONF images to a public repository unless the image is intended to be public.
190Several ONF repositories are private, and therefore their docker artifacts should also be private.
191
192There are alternatives to using a private docker repository.
193For example, if you are using kubadm, then you may be able to simply tag the image locally.
194If youre using KinD, then you can push a local image to into the kind cluster::
195
196 kind load docker-image sdcore-adapter:my-tag
197
198Inspecting logs
199---------------
200
201Most of the relevant Kubernetes pods are in the micro-onos namespace.
202The names may change from deployment to deployment, so start by getting a list of pods::
203
204 kubectl -n micro-onos get pods
205
206Then you can inspect a specific pod/container::
207
208 kubectl -n micro-onos logs sdcore-adapter-v3-7468cc58dc-ktctz sdcore-adapter-v3
209
210Some exercises to get familiar
211------------------------------
212
2131) Deploy the ROC and POST the mega-patch, go into the aether-roc-GUI and click through the VCS, DeviceGroup, and
214other objects to see that they were created as expected.
215
2162) Examine the log of the sdcore-adapter-v3 container.
217It should be attempting to push the mega-patchs changes.
218If you dont have a core available, it may be failing the push, but you should see the attempts.
219
2203) Change an object in the GUI.
221Watch the sdcore-adapter-v3 log file and see that the adapter attempts to push the change.
222
2234) Try POSTing a change via the API.
224Observe the sdcore-adapter-v3 log file and see that the adapter attempts to push the change.
225
2265) Deploy a 5G Aether-in-a-Box (See sd-core developer guide), modify the mega-patch to specify the URL for the
227Aether-in-a-Box webui container, POST the mega-patch, and observe that the changes were correctly pushed via the
228sdcore-adapter-v3 into the sd-cores webui container (webui container log will show configuration as it is
229received)
230
231.. |ROCGUI| image:: images/rocgui.png