blob: 36b990182dfc09d4efbb12b50551dfa5eeda967d [file] [log] [blame]
Zack Williams16042b62020-03-29 22:03:16 -07001Setting up an Ubuntu Development Environment
2============================================
3
4These notes describe the checking out and building from the multiple
5gerrit repositories needed to run a VOLTHA 2.x environment with
6docker-compose. Starting point is a basic Ubuntu 16.04 or 18.04
7installation with internet access.
8
9These notes are intended for iterative development only. The testing
10environments and production environments will run a Kubernetes and Helm
11based deployment.
12
13Install prerequisites
14---------------------
15
16Patch and updated
17
18.. code:: sh
19
20 sudo apt update
21 sudo apt dist-upgrade
22
23Add ``docker-ce`` apt repo and install docker and build tools
24
25.. code:: sh
26
27 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
28 sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
29 sudo apt update
30 sudo apt install build-essential docker-ce git
31
32Install current ``docker-compose``. Older versions may cause docker
33build problems:
34https://github.com/docker/docker-credential-helpers/issues/103
35
36.. code:: sh
37
38 sudo curl -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
39 sudo chmod 755 /usr/local/bin/docker-compose
40
41Install the Golang ppa apt repository and install **golang 1.13**.
42
43.. code:: sh
44
45 sudo add-apt-repository ppa:longsleep/golang-backports
46 sudo apt update
47 sudo apt install golang-1.13
48
49Setup environment
50~~~~~~~~~~~~~~~~~
51
52Setup a local Golang and docker-compose environment, verifying the
53golang-1.13 binaries are in your path. Also add your local ``GOPATH``
54bin folder to ``PATH`` Add export statements to your ``~/.profile`` to
55persist.
56
57.. code:: sh
58
59 mkdir $HOME/source
60 mkdir $HOME/go
61 export GO111MODULE=on
62 export GOPATH=$HOME/go
63 export DOCKER_TAG=latest
64 export PATH=$PATH:/usr/lib/go-1.13/bin:$GOPATH/bin
65 go version
66
67Allow your current non-root user ``$USER`` docker system access
68
69.. code:: sh
70
71 sudo usermod -a -G docker $USER
72
73Logout/Login to assume new group membership needed for running docker as
74non-root user and verify any environment variables set in
75``~/.profile``.
76
77Checkout source and build images
78--------------------------------
79
80VOLTHA 2.x Core Containers
81~~~~~~~~~~~~~~~~~~~~~~~~~~
82
83Checkout needed source from gerrit. Build the ``voltha-rw-core`` docker
84image.
85
86.. code:: sh
87
88 cd ~/source/
89 git clone https://gerrit.opencord.org/voltha-go.git
90 cd ~/source/voltha-go
91 make build
92
93For more details regarding building and debugging the 2.x core outside
94of Docker refer to voltha-go BUILD.md.
95
96https://github.com/opencord/voltha-go/blob/master/BUILD.md
97
98VOLTHA 2.x OpenOLT Container
99~~~~~~~~~~~~~~~~~~~~~~~~~~~~
100
101Checkout needed source from gerrit. Build the ``voltha-openolt-adapter``
102docker image.
103
104.. code:: sh
105
106 cd ~/source/
107 git clone https://gerrit.opencord.org/voltha-openolt-adapter.git
108 cd ~/source/voltha-openolt-adapter/
109 make build
110
111VOLTHA 2.x OpenONU Container
112~~~~~~~~~~~~~~~~~~~~~~~~~~~~
113
114Checkout needed source from gerrit. Build the ``voltha-openonu-adapter``
115docker image.
116
117.. code:: sh
118
119 cd ~/source/
120 git clone https://gerrit.opencord.org/voltha-openonu-adapter.git
121 cd ~/source/voltha-openonu-adapter/
122 make build
123
124VOLTHA 2.x OFAgent
125~~~~~~~~~~~~~~~~~~
126
127Checkout needed source from gerrit. Build the ``voltha-ofagent`` docker
128image.
129
130.. code:: sh
131
132 cd ~/source/
133 git clone https://gerrit.opencord.org/ofagent-go.git
134 cd ~/source/ofagent-go/
135 make docker-build
136
137ONOS Container with VOLTHA Compatible Apps
138~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
139
140By default the standard ONOS docker image does not contain nor start any
141apps needed by VOLTHA. If you use the standard image then you need to
142use the ONOS restful API to load needed apps separately.
143
144For development convenience there is an ONOS docker image build that
145adds in the current compatible VOLTHA apps. Checkout and build the ONOS
146image with added ONOS apps (olt, aaa, sadis, dhcpl2relay, and kafka).
147
148.. code:: sh
149
150 cd ~/source/
151 git clone https://gerrit.opencord.org/voltha-onos.git
152 cd ~/source/voltha-onos
153 make build
154
155Install voltctl VOLTHA Command Line Management Tool
156~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
157
158A working Golang build environment is required as ``voltctl`` is build
159and run directly from the host. Build the ``voltctl`` executable and
160install in ~/go/bin which should already be in your $PATH
161
162.. code:: sh
163
164 cd ~/source/
165 git clone https://gerrit.opencord.org/voltctl.git
166 cd ~/source/voltctl
167 make build
168 make install
169
170Configure the ``voltctl`` environment configuration files
171``~/.volt/config`` and ``~/.volt/command_options`` to point at the local
172``voltha-rw-core`` instance that will be running.
173
174.. code:: sh
175
176 mkdir ~/.volt/
177
178 cat << EOF > ~/.volt/config
179 apiVersion: v2
180 server: localhost:50057
181 tls:
182 useTls: false
183 caCert: ""
184 cert: ""
185 key: ""
186 verify: ""
187 grpc:
188 timeout: 10s
189 EOF
190
191 cat << EOF > ~/.volt/command_options
192 device-list:
193 format: table{{.Id}}\t{{.Type}}\t{{.Root}}\t{{.ParentId}}\t{{.SerialNumber}}\t{{.Address}}\t{{.AdminState}}\t{{.OperStatus}}\t{{.ConnectStatus}}\t{{.Reason}}
194 order: -Root,SerialNumber
195
196 device-ports:
197 order: PortNo
198
199 device-flows:
200 order: Priority,EthType
201
202 logical-device-list:
203 order: RootDeviceId,DataPathId
204
205 logical-device-ports:
206 order: Id
207
208 logical-device-flows:
209 order: Priority,EthType
210
211 adapter-list:
212 order: Id
213
214 component-list:
215 order: Component,Name,Id
216
217 loglevel-get:
218 order: ComponentName,PackageName,Level
219
220 loglevel-list:
221 order: ComponentName,PackageName,Level
222 EOF
223
224
225Install VOLTHA bbsim olt/onu Simulator (Optional)
226~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
227
228If you do not have physical OLT/ONU hardware you can build a simulator.
229
230.. code:: sh
231
232 cd ~/source/
233 git clone https://gerrit.opencord.org/bbsim.git
234 cd ~/source/bbsim
235 make docker-build
236
237Test
238----
239
240Startup
241~~~~~~~
242
243Run the combined docker-compose yaml configuration file that starts the
244core, its dependent systems (etcd, zookeeper, and kafka) and the openonu
245and openolt adapters. Export the ``DOCKER_HOST_IP`` environment variable
246to your non-localhost IP address needed for inter-container
247communication. This can be the IP assigned to ``eth0`` or the
248``docker0`` bridge (typically 172.17.0.1)
249
250For convenience you can also export ``DOCKER_TAG`` to signify the docker
251images tag you would like to use. Though for typical development you may
252have to edit ``compose/system-test.yml`` to override the specific docker
253image ``DOCKER_TAG`` needed. The ``DOCKER_REGISTRY`` and
254``DOCKER_REPOSITORY`` variables are not needed unless you wish to
255override the docker image path. See the ``system-test.yml`` file for
256details on the docker image path creation string.
257
258.. code:: sh
259
260 export DOCKER_HOST_IP=172.17.0.1
261 export DOCKER_TAG=latest
262
263 cd ~/source/voltha-go
264 docker-compose -f compose/system-test.yml up -d
265
266
267 WARNING: The DOCKER_REGISTRY variable is not set. Defaulting to a blank string.
268 WARNING: The DOCKER_REPOSITORY variable is not set. Defaulting to a blank string.
269 Creating network "compose_default" with driver "bridge"
270 Pulling zookeeper (wurstmeister/zookeeper:latest)...
271 latest: Pulling from wurstmeister/zookeeper
272 a3ed95caeb02: Pull complete
273 ef38b711a50f: Pull complete
274 e057c74597c7: Pull complete
275 666c214f6385: Pull complete
276 c3d6a96f1ffc: Pull complete
277 3fe26a83e0ca: Pull complete
278 3d3a7dd3a3b1: Pull complete
279 f8cc938abe5f: Pull complete
280 9978b75f7a58: Pull complete
281 4d4dbcc8f8cc: Pull complete
282 8b130a9baa49: Pull complete
283 6b9611650a73: Pull complete
284 5df5aac51927: Pull complete
285 76eea4448d9b: Pull complete
286 8b66990876c6: Pull complete
287 f0dd38204b6f: Pull complete
288 Digest: sha256:7a7fd44a72104bfbd24a77844bad5fabc86485b036f988ea927d1780782a6680
289 Status: Downloaded newer image for wurstmeister/zookeeper:latest
290 Pulling kafka (wurstmeister/kafka:2.11-2.0.1)...
291 2.11-2.0.1: Pulling from wurstmeister/kafka
292 4fe2ade4980c: Pull complete
293 6fc58a8d4ae4: Pull complete
294 819f4a45746c: Pull complete
295 a3133bc2e3e5: Pull complete
296 72f0dc369677: Pull complete
297 1e1130fc942d: Pull complete
298 Digest: sha256:20d08a6849383b124bccbe58bc9c48ec202eefb373d05e0a11e186459b84f2a0
299 Status: Downloaded newer image for wurstmeister/kafka:2.11-2.0.1
300 Pulling etcd (quay.io/coreos/etcd:v3.2.9)...
301 v3.2.9: Pulling from coreos/etcd
302 88286f41530e: Pull complete
303 2fa4a2c3ffb5: Pull complete
304 539b8e6ccce1: Pull complete
305 79e70e608afa: Pull complete
306 f1bf8f503bff: Pull complete
307 c4abfc27d146: Pull complete
308 Digest: sha256:1913dd980d55490fa50640bbef0f4540d124e5c66d6db271b0b4456e9370a272
309 Status: Downloaded newer image for quay.io/coreos/etcd:v3.2.9
310 Creating compose_kafka_1 ... done
311 Creating compose_cli_1 ... done
312 Creating compose_adapter_openolt_1 ... done
313 Creating compose_rw_core_1 ... done
314 Creating compose_adapter_openonu_1 ... done
315 Creating compose_etcd_1 ... done
316 Creating compose_onos_1 ... done
317 Creating compose_ofagent_1 ... done
318 Creating compose_zookeeper_1 ... done
319
320Verify containers have continuous uptime and no restarts
321
322.. code:: sh
323
324 $ docker-compose -f compose/system-test.yml ps
325 WARNING: The DOCKER_REGISTRY variable is not set. Defaulting to a blank string.
326 WARNING: The DOCKER_REPOSITORY variable is not set. Defaulting to a blank string.
327 Name Command State Ports
328 ---------------------------------------------------------------------------------------------------------------------------------------------------------------
329 compose_adapter_openolt_1 /app/openolt --kafka_adapt ... Up 0.0.0.0:50062->50062/tcp
330 compose_adapter_openonu_1 /voltha/adapters/brcm_open ... Up
331 compose_etcd_1 etcd --name=etcd0 --advert ... Up 0.0.0.0:2379->2379/tcp, 0.0.0.0:32929->2380/tcp, 0.0.0.0:32928->4001/tcp
332 compose_kafka_1 start-kafka.sh Up 0.0.0.0:9092->9092/tcp
333 compose_ofagent_1 /app/ofagent --controller= ... Up
334 compose_onos_1 ./bin/onos-service server Up 6640/tcp, 0.0.0.0:6653->6653/tcp, 0.0.0.0:8101->8101/tcp, 0.0.0.0:8181->8181/tcp, 9876/tcp
335 compose_rw_core_1 /app/rw_core -kv_store_typ ... Up 0.0.0.0:50057->50057/tcp
336 compose_zookeeper_1 /bin/sh -c /usr/sbin/sshd ... Up 0.0.0.0:2181->2181/tcp, 22/tcp, 2888/tcp, 3888/tcp
337
338.. code:: sh
339
340 $ docker ps
341 CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
342 08a0e7a1ee5c voltha-openolt-adapter:latest "/app/openolt --kafk…" 31 seconds ago Up 27 seconds 0.0.0.0:50062->50062/tcp compose_adapter_openolt_1
343 1f364cf7912d wurstmeister/zookeeper:latest "/bin/sh -c '/usr/sb…" 31 seconds ago Up 27 seconds 22/tcp, 2888/tcp, 3888/tcp, 0.0.0.0:2181->2181/tcp compose_zookeeper_1
344 ab1822baed41 wurstmeister/kafka:2.11-2.0.1 "start-kafka.sh" 31 seconds ago Up 24 seconds 0.0.0.0:9092->9092/tcp compose_kafka_1
345 22a4fe4b2eb4 voltha-ofagent-go:latest "/app/ofagent --cont…" 31 seconds ago Up 23 seconds compose_ofagent_1
346 d34e1c976db5 voltha-rw-core:latest "/app/rw_core -kv_st…" 31 seconds ago Up 26 seconds 0.0.0.0:50057->50057/tcp compose_rw_core_1
347 f6ef52975dc0 voltha-openonu-adapter:latest "/voltha/adapters/br…" 31 seconds ago Up 29 seconds compose_adapter_openonu_1
348 7ce8bcf7436c voltha-onos:latest "./bin/onos-service …" 31 seconds ago Up 25 seconds 0.0.0.0:6653->6653/tcp, 0.0.0.0:8101->8101/tcp, 6640/tcp, 9876/tcp, 0.0.0.0:8181->8181/tcp compose_onos_1
349 60ac172726f5 quay.io/coreos/etcd:v3.4.1 "etcd --name=etcd0 -…" 31 seconds ago Up 28 seconds 0.0.0.0:2379->2379/tcp, 0.0.0.0:32931->2380/tcp, 0.0.0.0:32930->4001/tcp compose_etcd_1
350
351Verify Cluster Communication
352~~~~~~~~~~~~~~~~~~~~~~~~~~~~
353
354Use ``voltctl`` commands to verify core and adapters are running.
355
356.. code:: sh
357
358 voltctl adapter list
359 ID VENDOR VERSION SINCELASTCOMMUNICATION
360 brcm_openomci_onu VOLTHA OpenONU 2.3.2-dev UNKNOWN
361 openolt VOLTHA OpenOLT 2.3.5-dev UNKNOWN
362
363List devices to verify no devices exist.
364
365.. code:: sh
366
367 voltctl device list
368 ID TYPE ROOT PARENTID SERIALNUMBER ADDRESS ADMINSTATE OPERSTATUS CONNECTSTATUS REASON
369
370At this point create/preprovision and enable an olt device and add flows
371via onos and ofagent.
372
373Physical OLT/ONU Testing with Passing Traffic
374~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
375
376Start a physical OLT and ONU. Tested with Edgecore OLT, Broadcom based
377ONU, and RG capable of EAPoL. Create/Preprovision the OLT and enable.
378The create command returns the device ID needed for enable and
379subsequent commands.
380
381**Add device to VOLTHA**
382
383.. code:: sh
384
385 $ voltctl device create -t openolt -H 10.64.1.206:9191
386 db87c4b48843bb99567d3d94
387
388 $ voltctl device enable db87c4b48843bb99567d3d94
389 db87c4b48843bb99567d3d94
390
391**Verify device state**
392
393.. code:: sh
394
395 $ voltctl device list
396 ID TYPE ROOT PARENTID SERIALNUMBER ADDRESS ADMINSTATE OPERSTATUS CONNECTSTATUS REASON
397 db87c4b48843bb99567d3d94 openolt true a82bb53678ae EC1721000221 10.64.1.206:9191 ENABLED ACTIVE REACHABLE
398 082d7c2e628325ccc3336275 brcm_openomci_onu false db87c4b48843bb99567d3d94 ALPHe3d1cf57 unknown ENABLED ACTIVE REACHABLE omci-flows-pushed
399
400.. code:: sh
401
402 $ voltctl device port list db87c4b48843bb99567d3d94
403 PORTNO LABEL TYPE ADMINSTATE OPERSTATUS DEVICEID PEERS
404 1048576 nni-1048576 ETHERNET_NNI ENABLED ACTIVE []
405 536870912 pon-536870912 PON_OLT ENABLED ACTIVE [{082d7c2e628325ccc3336275 536870912}]
406 536870913 pon-536870913 PON_OLT ENABLED ACTIVE []
407 536870914 pon-536870914 PON_OLT ENABLED ACTIVE []
408 536870915 pon-536870915 PON_OLT ENABLED ACTIVE []
409 536870916 pon-536870916 PON_OLT ENABLED ACTIVE []
410 536870917 pon-536870917 PON_OLT ENABLED ACTIVE []
411 536870918 pon-536870918 PON_OLT ENABLED ACTIVE []
412 536870919 pon-536870919 PON_OLT ENABLED ACTIVE []
413 536870920 pon-536870920 PON_OLT ENABLED ACTIVE []
414 536870921 pon-536870921 PON_OLT ENABLED ACTIVE []
415 536870922 pon-536870922 PON_OLT ENABLED ACTIVE []
416 536870923 pon-536870923 PON_OLT ENABLED ACTIVE []
417 536870924 pon-536870924 PON_OLT ENABLED ACTIVE []
418 536870925 pon-536870925 PON_OLT ENABLED ACTIVE []
419 536870926 pon-536870926 PON_OLT ENABLED ACTIVE []
420 536870927 pon-536870927 PON_OLT ENABLED ACTIVE []
421
422.. code:: sh
423
424 $ voltctl device port list 082d7c2e628325ccc3336275
425 PORTNO LABEL TYPE ADMINSTATE OPERSTATUS DEVICEID PEERS
426 16 uni-16 ETHERNET_UNI ENABLED ACTIVE []
427 17 uni-17 ETHERNET_UNI ENABLED DISCOVERED []
428 18 uni-18 ETHERNET_UNI ENABLED DISCOVERED []
429 19 uni-19 ETHERNET_UNI ENABLED DISCOVERED []
430 20 uni-20 ETHERNET_UNI ENABLED DISCOVERED []
431 536870912 PON port PON_ONU ENABLED ACTIVE [{db87c4b48843bb99567d3d94 536870912}]
432
433Verify ONOS device state and eventual EAPoL authentication. ONOS default
434Username is ``karaf``, Password is ``karaf``
435
436.. code:: sh
437
438 ssh -p 8101 karaf@localhost
439
440Display the device and ports discovered
441
442.. code:: sh
443
444 karaf@root > ports
445
446 id=of:0000a82bb53678ae, available=true, local-status=connected 4m27s ago, role=MASTER, type=SWITCH, mfr=VOLTHA Project, hw=open_pon, sw=open_pon, serial=EC1721000221, chassis=a82bb53678ae, driver=voltha, channelId=172.27.0.1:59124, managementAddress=172.27.0.1, protocol=OF_13
447 port=16, state=enabled, type=fiber, speed=0 , adminState=enabled, portMac=08:00:00:00:00:10, portName=ALPHe3d1cf57-1
448 port=17, state=disabled, type=fiber, speed=0 , adminState=enabled, portMac=08:00:00:00:00:11, portName=ALPHe3d1cf57-2
449 port=18, state=disabled, type=fiber, speed=0 , adminState=enabled, portMac=08:00:00:00:00:12, portName=ALPHe3d1cf57-3
450 port=19, state=disabled, type=fiber, speed=0 , adminState=enabled, portMac=08:00:00:00:00:13, portName=ALPHe3d1cf57-4
451 port=20, state=disabled, type=fiber, speed=0 , adminState=enabled, portMac=08:00:00:00:00:14, portName=ALPHe3d1cf57-5
452 port=1048576, state=enabled, type=fiber, speed=0 , adminState=enabled, portMac=a8:2b:b5:36:78:ae, portName=nni-1048576
453
454EAPoL may take up to 30 seconds to complete.
455
456.. code:: sh
457
458 karaf@root > aaa-users
459
460 of:0000a82bb53678ae/16: AUTHORIZED_STATE, last-changed=4m22s ago, mac=94:CC:B9:DA:AB:D1, subid=PON 1/1/3/1:2.1.1, username=94:CC:B9:DA:AB:D1
461
462**Provision subscriber flows**
463
464.. code:: sh
465
466 karaf@root > volt-add-subscriber-access of:0000a82bb53678ae 16
467
468 karaf@root > volt-programmed-subscribers
469
470 location=of:0000a82bb53678ae/16 tagInformation=UniTagInformation{uniTagMatch=0, ponCTag=20, ponSTag=11, usPonCTagPriority=-1, usPonSTagPriority=-1, dsPonCTagPriority=-1, dsPonSTagPriority=-1, technologyProfileId=64, enableMacLearning=false, upstreamBandwidthProfile='Default', downstreamBandwidthProfile='Default', serviceName='', configuredMacAddress='A4:23:05:00:00:00', isDhcpRequired=true, isIgmpRequired=false}
471
472After about 30 seconds the RG should attempt DHCP which should be
473visible in onos. At this point the RG should be able to pass database
474traffic via the ONU/OLT.
475
476.. code:: sh
477
478 karaf@root > dhcpl2relay-allocations
479
480 SubscriberId=ALPHe3d1cf57-1,ConnectPoint=of:0000a82bb53678ae/16,State=DHCPREQUEST,MAC=94:CC:B9:DA:AB:D1,CircuitId=PON 1/1/3/1:2.1.1,IP Allocated=29.29.206.20,Allocation Timestamp=2020-02-17T15:34:31.572746Z
481
482BBSIM Simulated OLT/ONU Testing Control Plane Traffic
483~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
484
485If you do not have physical OLT/ONU hardware you can start VOLTHA
486containers and the bbsim olt/onu hardware simulator using a different
487docker-compose yaml file. Verify containers are running as above with
488the addition of the bbsim and radius server containers.
489
490.. code:: sh
491
492 export DOCKER_HOST_IP=172.17.0.1
493 export DOCKER_TAG=latest
494
495 cd ~/source/voltha-go
496 docker-compose -f compose/system-test-bbsim.yml up -d
497
498Create/Preprovision and enable similarly to the physical OLT above,
499providing the local bbsim IP and listening port
500
501.. code:: sh
502
503 voltctl device create -t openolt -H 172.17.0.1:50060
504 ece94c86e93c6e06dd0a544b
505
506 voltctl device enable ece94c86e93c6e06dd0a544b
507 ece94c86e93c6e06dd0a544b
508
509Proceed with the verification and ONOS provisioning commands similar to
510the physical OLT described above.