blob: cd0149b0e30e1c228d28d82734e2a9b8b36ddb62 [file] [log] [blame]
Matteo Scandolo9f619492019-10-25 13:11:58 -07001.. BBSim documentation master file, created by
2 sphinx-quickstart on Fri Oct 25 12:03:42 2019.
3 You can adapt this file completely to your liking, but it should at least
4 contain the root `toctree` directive.
5
Zack Williamsd2907e62020-04-03 10:23:02 -07006BBSim, a Broadband Simulator
7============================
Matteo Scandolo9f619492019-10-25 13:11:58 -07008
9.. toctree::
10 :maxdepth: 2
11 :caption: Contents:
12
Matteo Scandoloe383d5d2019-10-25 14:47:27 -070013 operations.rst
Matteo Scandolo9f619492019-10-25 13:11:58 -070014 onu-state-machine.rst
Matteo Scandolod02b79b2019-12-05 16:42:13 -080015 olt-state-machine.rst
Matteo Scandolo9f619492019-10-25 13:11:58 -070016 development-dependencies.rst
17 bbr.rst
18 bbsimctl.rst
Zdravko Bozakov2da76342019-10-21 09:47:35 +020019 api.rst
Matteo Scandolo9f619492019-10-25 13:11:58 -070020
21
22Quickstart
23----------
24
Zack Williams4b0ef4d2019-12-18 14:25:20 -070025BBSim (a.k.a. BroadBand Simulator) is a tool designed to emulate an `Openolt
26<https://github.com/opencord/openolt>`_ compatible device.
Matteo Scandolo9f619492019-10-25 13:11:58 -070027
28In order to use BBSim you need to have:
29
30- a Kubernetes cluster
31- helm
32- a working installation of VOLTHA
33
Zack Williams4b0ef4d2019-12-18 14:25:20 -070034We strongly recommend the utilization of `kind-voltha
35<https://github.com/ciena/kind-voltha>`_ to setup such environment.
Matteo Scandolo9f619492019-10-25 13:11:58 -070036
37Installation
38------------
39
40Once VOLTHA is up and running, you can deploy BBSim with this command:
41
42.. code:: bash
43
44 helm install -n bbsim cord/bbsim
45
Matteo Scandoloc1147092019-10-29 09:38:33 -070046If you need to specify a custom image for BBSim you can:
47
48.. code:: bash
49
50 helm install -n bbsim cord/bbsim --set images.bbsim.repository=bbsim --set images.bbsim.tag=candidate --set images.bbsim.pullPolicy=Never
51
Zack Williams4b0ef4d2019-12-18 14:25:20 -070052The BBSim installation can be customized to emulate multiple ONUs and multiple
53PON Ports:
Matteo Scandolo9f619492019-10-25 13:11:58 -070054
55.. code:: bash
56
57 helm install -n bbsim cord/bbsim --set onu=8 --set pon=2
58
Matteo Scandoloc1147092019-10-29 09:38:33 -070059BBSim can also be configured to automatically start Authentication or DHCP:
60
61.. code:: bash
62
63 helm install -n bbsim cord/bbsim --set auth=true --set dhcp=true
64
Matteo Scandolo9f619492019-10-25 13:11:58 -070065Once BBSim is installed you can verify that it's running with:
66
67.. code:: bash
68
69 kubectl logs -n voltha -f $(kubectl get pods -n voltha | grep bbsim | awk '{print $1}')
70
71Provision a BBSim OLT in VOLTHA
72-------------------------------
73
74Create the device:
75
76.. code:: bash
77
78 voltctl device create -t openolt -H $(kubectl get -n voltha service/bbsim -o go-template='{{.spec.clusterIP}}'):50060
79
80Enable the device:
81
82.. code:: bash
83
84 voltctl device enable $(voltctl device list --filter Type~openolt -q)
Matteo Scandoloc1147092019-10-29 09:38:33 -070085
86BBSim startup options
87---------------------
88
Zack Williams4b0ef4d2019-12-18 14:25:20 -070089``BBSim`` supports a series of options that can be set at startup, you can see
90the list via ``./bbsim --help``
Matteo Scandoloc1147092019-10-29 09:38:33 -070091
92.. code:: bash
93
94 $ ./bbsim --help
95 Usage of ./bbsim:
Matteo Scandolof65e6872020-04-15 15:18:43 -070096 -api_address string
97 IP address:port (default ":50070")
Matteo Scandoloc1147092019-10-29 09:38:33 -070098 -auth
99 Set this flag if you want authentication to start automatically
100 -c_tag int
101 C-Tag starting value, each ONU will get a sequential one (targeting 1024 ONUs per BBSim instance the range is big enough) (default 900)
Matteo Scandolof65e6872020-04-15 15:18:43 -0700102 -c_tag_allocation string
103 Use 'unique' for incremental values, 'shared' to use the same value in all the ONUs (default "unique")
104 -ca string
105 Set the mode for controlled activation of PON ports and ONUs (default "default")
Matteo Scandoloc1147092019-10-29 09:38:33 -0700106 -cpuprofile string
107 write cpu profile to file
Matteo Scandolocae57b52019-11-12 10:52:53 -0800108 -delay int
109 The delay between ONU DISCOVERY batches in milliseconds (1 ONU per each PON PORT at a time (default 200)
Matteo Scandoloc1147092019-10-29 09:38:33 -0700110 -dhcp
111 Set this flag if you want DHCP to start automatically
Matteo Scandolof65e6872020-04-15 15:18:43 -0700112 -enableEvents
113 Enable sending BBSim events on configured kafka server
114 -enableperf
115 Setting this flag will cause BBSim to not store data like traffic schedulers, flows of ONUs etc..
116 -kafkaAddress string
117 IP:Port for kafka (default ":9092")
Matteo Scandoloc1147092019-10-29 09:38:33 -0700118 -logCaller
119 Whether to print the caller filename or not
120 -logLevel string
121 Set the log level (trace, debug, info, warn, error) (default "debug")
122 -nni int
123 Number of NNI ports per OLT device to be emulated (default 1)
124 -olt_id int
Matteo Scandolof65e6872020-04-15 15:18:43 -0700125 OLT device ID
Matteo Scandoloc1147092019-10-29 09:38:33 -0700126 -onu int
127 Number of ONU devices per PON port to be emulated (default 1)
Matteo Scandolof65e6872020-04-15 15:18:43 -0700128 -openolt_address string
129 IP address:port (default ":50060")
Matteo Scandoloc1147092019-10-29 09:38:33 -0700130 -pon int
131 Number of PON ports per OLT device to be emulated (default 1)
Matteo Scandolof65e6872020-04-15 15:18:43 -0700132 -rest_api_address string
133 IP address:port (default ":50071")
Matteo Scandoloc1147092019-10-29 09:38:33 -0700134 -s_tag int
Matteo Scandolof65e6872020-04-15 15:18:43 -0700135 S-Tag initial value (default 900)
136 -s_tag_allocation string
137 Use 'unique' for incremental values, 'shared' to use the same value in all the ONUs (default "shared")
138 -sadisFormat string
139 Which format should sadis expose? [att|dt|tt] (default "att")
Shrey Baid64cda472020-04-24 18:58:18 +0530140 -enableEvents
141 Set this flag for publishing BBSim events on configured kafkaAddress
142 -kafkaAddress string
143 IP:Port for kafka, used only when bbsimEvents flag is set (default ":9092")
144 -ca string
145 Set the mode for controlled activation of PON ports and ONUs
146 -enableperf bool
147 Setting this flag will cause BBSim to not store data like traffic schedulers, flows of ONUs etc
148 -kafkaEventTopic string
149 Set the topic on which BBSim publishes events on kafka
Shrey Baide72b3cc2020-05-12 00:03:06 +0530150 -igmp
151 Set this flag to start IGMP automatically
Shrey Baidf8abccc2020-06-15 19:41:22 +0530152 -dhcpRetry bool
153 Set this flag if BBSim should retry DHCP upon failure until success
154 -authRetry bool
155 Set this flag if BBSim should retry EAPOL (Authentication) upon failure until success
Zdravko Bozakov3ddb2452019-11-29 14:33:41 +0100156
Zack Williams4b0ef4d2019-12-18 14:25:20 -0700157``BBSim`` also looks for a configuration file in ``configs/bbsim.yaml`` from
158which it reads a number of default settings. The command line options listed
159above override the corresponding configuration file settings. A sample
160configuration file is given below:
Zdravko Bozakov3ddb2452019-11-29 14:33:41 +0100161
162.. literalinclude:: ../../configs/bbsim.yaml
Zdravko Bozakov958d81c2019-12-13 22:09:48 +0100163
Matteo Scandolof65e6872020-04-15 15:18:43 -0700164Specifying different tagging schemes
165------------------------------------
166
167BBSim supports two different tagging schemes:
168- ``-s_tag_allocation shared -c_tag_allocation unique``
169- ``-s_tag_allocation unique -c_tag_allocation shared``
170
171Where the former will use the same ``S-Tag`` for all the ONUs and a unique ``C-Tag`` for each of them
172and the latter will use a unique ``S-Tag`` for each ONU and the same ``C-Tag`` for all of them.
173
174For example:
175
176.. code:: bash
177
178 # -s_tag_allocation shared -c_tag_allocation unique
179 PONPORTID ID PORTNO SERIALNUMBER HWADDRESS STAG CTAG OPERSTATE INTERNALSTATE
180 0 0 0 BBSM00000001 2e:60:70:00:00:01 900 900 down created
181 1 0 0 BBSM00000101 2e:60:70:00:01:01 900 901 down created
182 2 0 0 BBSM00000201 2e:60:70:00:02:01 900 902 down created
183 3 0 0 BBSM00000301 2e:60:70:00:03:01 900 903 down created
184
185
186 # -s_tag_allocation unique -c_tag_allocation shared
187 PONPORTID ID PORTNO SERIALNUMBER HWADDRESS STAG CTAG OPERSTATE INTERNALSTATE
188 0 0 0 BBSM00000001 2e:60:70:00:00:01 900 7 down created
189 1 0 0 BBSM00000101 2e:60:70:00:01:01 901 7 down created
190 2 0 0 BBSM00000201 2e:60:70:00:02:01 902 7 down created
191 3 0 0 BBSM00000301 2e:60:70:00:03:01 903 7 down created
192
193
194
Zdravko Bozakov958d81c2019-12-13 22:09:48 +0100195Using the BBSim Sadis server in ONOS
196------------------------------------
197
Zack Williams4b0ef4d2019-12-18 14:25:20 -0700198BBSim provides a simple server for testing with the ONOS Sadis app. The server
199listens on port 50074 by default and provides the endpoints
200``subscribers/<id>`` and ``bandwidthprofiles/<id>``.
Zdravko Bozakov958d81c2019-12-13 22:09:48 +0100201
Zack Williams4b0ef4d2019-12-18 14:25:20 -0700202To configure ONOS to use the BBSim ``Sadis`` server endpoints, the Sadis app
203must use be configured as follows (see ``examples/sadis-in-bbsim.json``):
Zdravko Bozakov958d81c2019-12-13 22:09:48 +0100204
Matteo Scandolof65e6872020-04-15 15:18:43 -0700205.. literalinclude:: ../../examples/sadis-in-bbsim.json
Zdravko Bozakov958d81c2019-12-13 22:09:48 +0100206
Zack Williams4b0ef4d2019-12-18 14:25:20 -0700207This base configuration may also be obtained directly from the BBSim Sadis
208server:
Zdravko Bozakov958d81c2019-12-13 22:09:48 +0100209
210.. code:: bash
211
Matteo Scandolof65e6872020-04-15 15:18:43 -0700212 curl http://<BBSIM_IP>:50074/v2/cfg -o examples/sadis.json
Zdravko Bozakov958d81c2019-12-13 22:09:48 +0100213
214It can then be pushed to the Sadis app using the following command:
215
216.. code:: bash
217
218 curl -sSL --user karaf:karaf \
219 -X POST \
220 -H Content-Type:application/json \
221 http://localhost:8181/onos/v1/network/configuration/apps/org.opencord.sadis \
222 --data @examples/sadis-in-bbsim.json
223
224You can verify the current Sadis configuration:
225
226.. code:: bash
227
228 curl --user karaf:karaf http://localhost:8181/onos/v1/network/configuration/apps/org.opencord.sadis
229
230In ONOS subscriber information can be queried using ``sadis <id>``.
Pragya Arya324337e2020-02-20 14:35:08 +0530231
Matteo Scandolof65e6872020-04-15 15:18:43 -0700232*Note that BBSim supports both sadis configuration versions,
233if you need to support the configuration for release older than VOLTHA-2.3
234you can use the following command:*
Matteo Scandolo9d08be52020-03-12 09:43:53 -0700235
Matteo Scandolof65e6872020-04-15 15:18:43 -0700236.. code:: bash
237
238 curl http://<BBSIM_IP>:50074/v1/cfg -o examples/sadis.json
239
240Configure the Sadis format for different workflows
241**************************************************
242
243BBSim support different sadis formats, required for different workflows.
244The desired sadis format can be specified via the ``-sadisFormat`` flag.
245
246The difference in the format is restricted to the ``uniTagList`` property,
247for example:
248
249**ATT**
250
251.. code:: json
252
253 {
Matteo Scandolo5ff80082019-12-20 13:20:57 -0800254 "id": "BBSM00000003-1",
255 "nasPortId": "BBSM00000003-1",
256 "circuitId": "BBSM00000003-1",
257 "remoteId": "BBSM00000003-1",
258 "uniTagList": [
259 {
260 "DownstreamBandwidthProfile": "User_Bandwidth1",
261 "IsDhcpRequired": true,
262 "IsIgmpRequired": true,
263 "PonCTag": 903,
264 "PonSTag": 900,
265 "TechnologyProfileID": 64,
266 "UpstreamBandwidthProfile": "Default"
267 }
268 ]
269 }
270
Matteo Scandolof65e6872020-04-15 15:18:43 -0700271
272**DT**
273
274.. code:: json
275
276 {
Matteo Scandolo5ff80082019-12-20 13:20:57 -0800277 "id": "BBSM00000003-1",
278 "nasPortId": "BBSM00000003-1",
279 "circuitId": "BBSM00000003-1",
280 "remoteId": "BBSM00000003-1",
281 "uniTagList": [
282 {
283 "DownstreamBandwidthProfile": "User_Bandwidth1",
284 "PonCTag": 4096,
285 "PonSTag": 903,
286 "TechnologyProfileID": 64,
287 "UniTagMatch": 4096,
288 "UpstreamBandwidthProfile": "Default"
289 }
290 ]
291 }
292
Matteo Scandolof65e6872020-04-15 15:18:43 -0700293
294**TT**
295
296*Coming soon...*
Matteo Scandolo9d08be52020-03-12 09:43:53 -0700297
Pragya Arya3f8fdc62020-03-16 11:12:27 +0530298Controlled PON and ONU activation
299---------------------------------
300
Zack Williamsd2907e62020-04-03 10:23:02 -0700301BBSim provides support for controlled PON and ONU activation. By default both
302PON ports and ONUs are automatically activated when OLT is enabled. This can
303be controlled using ``-ca`` option.
Pragya Arya3f8fdc62020-03-16 11:12:27 +0530304
305``-ca`` can be set to one of below four modes:
306
307- default: PON ports and ONUs are automatic activated (default behavior).
308
309- only-onu: PON ports automatically enabled and ONUs dynamically activated
310 On Enable OLT, IntfIndications for all PON ports are sent but ONU discovery indications are not sent.
311 When PoweronONU request is received at BBSim API server then ONU discovery indication is sent for that ONU.
Zack Williamsd2907e62020-04-03 10:23:02 -0700312
Pragya Arya3f8fdc62020-03-16 11:12:27 +0530313- only-pon: PON ports dynamically enabled and ONUs automatically activated
314 On Enable OLT, neither IntfIndications for PON ports nor ONU discovery indications are sent.
315 When EnablePonIf request is received at OpenOLT server, then that PON port is enabled and
316 IntfIndication is sent for that PON and all ONUs under that ports are discovered automatically.
Zack Williamsd2907e62020-04-03 10:23:02 -0700317
Pragya Arya3f8fdc62020-03-16 11:12:27 +0530318- both: Both PON ports and ONUs are dynamically activated
319 On Enable OLT, neither IntfIndication for PON ports nor ONU discovery indications are sent.
Zack Williamsd2907e62020-04-03 10:23:02 -0700320 When EnablePonIf request is received on OpenOLT server then
321 IntfIndication is sent for that PON but no ONU discovery indication
322 will be sent.
Pragya Arya3f8fdc62020-03-16 11:12:27 +0530323 When PoweronONU request is received at BBSim API server then ONU discovery indication is sent for that ONU.
324
325
Pragya Arya324337e2020-02-20 14:35:08 +0530326Publishing BBSim Events on kafka
327--------------------------------
328
Zack Williamsd2907e62020-04-03 10:23:02 -0700329BBSim provides option for publishing events on kafka. To publish events on
330kafka, set BBSimEvents flag and configure kafkaAddress.
331
332Once BBSim is started, it will publish events (as and when they happen) on
333topic ``BBSim-OLT-<id>-Events``.
Pragya Arya324337e2020-02-20 14:35:08 +0530334
335Types of Events:
336 - OLT-enable-received
337 - OLT-disable-received
338 - OLT-reboot-received
339 - OLT-reenable-received
340 - ONU-discovery-indication-sent
341 - ONU-activate-indication-received
342 - MIB-upload-received
343 - MIB-upload-done
344 - Flow-add-received
345 - Flow-remove-received
346 - ONU-authentication-done
347 - ONU-DHCP-ACK-received
348
349Sample output of kafkacat consumer for BBSim with OLT-ID 4:
350
351.. code:: bash
352
353 $ kafkacat -b localhost:9092 -t BBSim-OLT-4-Events -C
354 {"EventType":"OLT-enable-received","OnuSerial":"","OltID":4,"IntfID":-1,"OnuID":-1,"EpochTime":1583152243144,"Timestamp":"2020-03-02 12:30:43.144449453"}
355 {"EventType":"ONU-discovery-indication-sent","OnuSerial":"BBSM00040001","OltID":4,"IntfID":0,"OnuID":0,"EpochTime":1583152243227,"Timestamp":"2020-03-02 12:30:43.227183506"}
356 {"EventType":"ONU-activate-indication-received","OnuSerial":"BBSM00040001","OltID":4,"IntfID":0,"OnuID":1,"EpochTime":1583152243248,"Timestamp":"2020-03-02 12:30:43.248225467"}
357 {"EventType":"MIB-upload-received","OnuSerial":"BBSM00040001","OltID":4,"IntfID":0,"OnuID":1,"EpochTime":1583152243299,"Timestamp":"2020-03-02 12:30:43.299480183"}