blob: 45ae27bc795275827f8ac0f2dd5b84bed77eddec [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
Sean Condonf918f642021-08-04 14:32:53 +010086.. _posting-the-mega-patch:
87
Scott Bakerfab7c9e2021-07-29 17:12:16 -070088Posting the mega-patch
89----------------------
90
91The ROC usually comes up in a blank state -- there are no Enterprises, UEs, or other artifacts present in it.
92The mega-patch is an example patch that populates the ROC with some sample enterprises, UEs, slices, etc.
93Execute the following::
94
95 # launch a port-forward for the API
96 # this will continue to run in the background
97 kubectl -n micro-onos port-forward service/aether-roc-api --address 0.0.0.0 8181:8181 &
98
99 git clone https://github.com/onosproject/aether-roc-api.git
100
101 # execute the mega-patch (it will post via CURL to localhost:8181)
102 bash ~/path/to/aether-roc-api/examples/MEGA_Patch.curl
103
104
105You may wish to customize the mega patch.
106For example, by default the patch configures the sdcore-adapter to push to sdcore-test-dummy.
107You could configure it to push to a live aether-in-a-box core by doing something like this::
108
109 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
110
111 #apply the patch
112 ./MEGA_Patch.curl
113
114(Note that if your Aether-in-a-Box was installed on a different machine that port-forwarding may be necessary)
115
116
117Expected CURL output from a successful mega-patch post will be a UUID.
118You can also verify that the mega-patch was successful by going into the aether-roc-gui in a browser
119(see the section on useful port-forwards below). The GUI may open to a dashboard that is unpopulated -- you
120can use the dropdown menu (upper-right hand corner of the screen) to select an object such as VCS and you
121will see a list of VCS.
122
123 |ROCGUI|
124
125Uninstalling the Aether-Roc-Umbrella Helm chart
126-----------------------------------------------
127
128To tear things back down, usually as part of a developer loop prior to redeploying again, do the following::
129
130 helm -n micro-onos del aether-roc-umbrella
131
132If the uninstall hangs or if a subsequent reinstall hangs, it could be an issue with some of the CRDs
133not getting cleaned up. The following may be useful::
134
135 # fix stuck finalizers in operator CRDs
136
137 kubectl -n micro-onos patch entities connectivity-service-v2 --type json --patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]'
138
139 kubectl -n micro-onos patch entities connectivity-service-v3 --type json --patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]'
140
141 kubectl -n micro-onos patch kind aether --type json --patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]'
142
143Useful port forwards
144--------------------
145
146Port forwarding is often necessary to allow access to ports inside of Kubernetes pods that use ClusterIP addressing.
147Note that you typically need to leave a port-forward running (you can put it in the background).
148Also, If you redeploy the ROC and/or if a pod crashes then you might have to restart a port-forward.
149The following port-forwards may be useful::
150
151 # aether-roc-api
152
153 kubectl -n micro-onos port-forward service/aether-roc-api --address 0.0.0.0 8181:8181
154
155 # aether-roc-gui
156
157 kubectl -n micro-onos port-forward service/aether-roc-gui --address 0.0.0.0 8183:80
158
159 # grafana
160
161 kubectl -n micro-onos port-forward service/aether-roc-umbrella-grafana --address 0.0.0.0 8187:80
162
163 # onos gui
164
165 kubectl -n micro-onos port-forward service/onos-gui --address 0.0.0.0 8182:80
166
167Aether-roc-api and aether-roc-gui are in our experience the most useful two port-forwards.
168Aether-roc-api is useful to be able to POST REST API requests.
169Aether-roc-gui is useful to be able to interactively browse the current configuration.
170
171Deploying using custom images
172-----------------------------
173
174Custom images may be used by editing the values-override.yaml file.
175For example, to deploy a custom sdcore-adapter::
176
177 sdcore-adapter-v3:
178
179 prometheusEnabled: false
180
181 image:
182
183 repository: my-private-repo/sdcore-adapter
184
185 tag: my-tag
186
187 pullPolicy: Always
188
189The above example assumes you have published a docker images at my-private-repo/sdcore-adapter:my-tag.
190My particular workflow is to deploy a local-docker registry and push my images to that.
191Please do not publish ONF images to a public repository unless the image is intended to be public.
192Several ONF repositories are private, and therefore their docker artifacts should also be private.
193
194There are alternatives to using a private docker repository.
195For example, if you are using kubadm, then you may be able to simply tag the image locally.
196If youre using KinD, then you can push a local image to into the kind cluster::
197
198 kind load docker-image sdcore-adapter:my-tag
199
200Inspecting logs
201---------------
202
203Most of the relevant Kubernetes pods are in the micro-onos namespace.
204The names may change from deployment to deployment, so start by getting a list of pods::
205
206 kubectl -n micro-onos get pods
207
208Then you can inspect a specific pod/container::
209
210 kubectl -n micro-onos logs sdcore-adapter-v3-7468cc58dc-ktctz sdcore-adapter-v3
211
212Some exercises to get familiar
213------------------------------
214
2151) Deploy the ROC and POST the mega-patch, go into the aether-roc-GUI and click through the VCS, DeviceGroup, and
216other objects to see that they were created as expected.
217
2182) Examine the log of the sdcore-adapter-v3 container.
219It should be attempting to push the mega-patchs changes.
220If you dont have a core available, it may be failing the push, but you should see the attempts.
221
2223) Change an object in the GUI.
223Watch the sdcore-adapter-v3 log file and see that the adapter attempts to push the change.
224
2254) Try POSTing a change via the API.
226Observe the sdcore-adapter-v3 log file and see that the adapter attempts to push the change.
227
2285) Deploy a 5G Aether-in-a-Box (See sd-core developer guide), modify the mega-patch to specify the URL for the
229Aether-in-a-Box webui container, POST the mega-patch, and observe that the changes were correctly pushed via the
230sdcore-adapter-v3 into the sd-cores webui container (webui container log will show configuration as it is
231received)
232
233.. |ROCGUI| image:: images/rocgui.png