Matteo Scandolo | 9f61949 | 2019-10-25 13:11:58 -0700 | [diff] [blame] | 1 | .. 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 Williams | d2907e6 | 2020-04-03 10:23:02 -0700 | [diff] [blame] | 6 | BBSim, a Broadband Simulator |
| 7 | ============================ |
Matteo Scandolo | 9f61949 | 2019-10-25 13:11:58 -0700 | [diff] [blame] | 8 | |
| 9 | .. toctree:: |
| 10 | :maxdepth: 2 |
| 11 | :caption: Contents: |
| 12 | |
Matteo Scandolo | e383d5d | 2019-10-25 14:47:27 -0700 | [diff] [blame] | 13 | operations.rst |
Matteo Scandolo | 9f61949 | 2019-10-25 13:11:58 -0700 | [diff] [blame] | 14 | onu-state-machine.rst |
Matteo Scandolo | d02b79b | 2019-12-05 16:42:13 -0800 | [diff] [blame] | 15 | olt-state-machine.rst |
Matteo Scandolo | 9f61949 | 2019-10-25 13:11:58 -0700 | [diff] [blame] | 16 | development-dependencies.rst |
| 17 | bbr.rst |
| 18 | bbsimctl.rst |
Zdravko Bozakov | 2da7634 | 2019-10-21 09:47:35 +0200 | [diff] [blame] | 19 | api.rst |
Matteo Scandolo | 9f61949 | 2019-10-25 13:11:58 -0700 | [diff] [blame] | 20 | |
| 21 | |
| 22 | Quickstart |
| 23 | ---------- |
| 24 | |
Zack Williams | 4b0ef4d | 2019-12-18 14:25:20 -0700 | [diff] [blame] | 25 | BBSim (a.k.a. BroadBand Simulator) is a tool designed to emulate an `Openolt |
| 26 | <https://github.com/opencord/openolt>`_ compatible device. |
Matteo Scandolo | 9f61949 | 2019-10-25 13:11:58 -0700 | [diff] [blame] | 27 | |
| 28 | In order to use BBSim you need to have: |
| 29 | |
| 30 | - a Kubernetes cluster |
| 31 | - helm |
| 32 | - a working installation of VOLTHA |
| 33 | |
Zack Williams | 4b0ef4d | 2019-12-18 14:25:20 -0700 | [diff] [blame] | 34 | We strongly recommend the utilization of `kind-voltha |
| 35 | <https://github.com/ciena/kind-voltha>`_ to setup such environment. |
Matteo Scandolo | 9f61949 | 2019-10-25 13:11:58 -0700 | [diff] [blame] | 36 | |
| 37 | Installation |
| 38 | ------------ |
| 39 | |
| 40 | Once 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 Scandolo | c114709 | 2019-10-29 09:38:33 -0700 | [diff] [blame] | 46 | If 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 Williams | 4b0ef4d | 2019-12-18 14:25:20 -0700 | [diff] [blame] | 52 | The BBSim installation can be customized to emulate multiple ONUs and multiple |
| 53 | PON Ports: |
Matteo Scandolo | 9f61949 | 2019-10-25 13:11:58 -0700 | [diff] [blame] | 54 | |
| 55 | .. code:: bash |
| 56 | |
| 57 | helm install -n bbsim cord/bbsim --set onu=8 --set pon=2 |
| 58 | |
Matteo Scandolo | c114709 | 2019-10-29 09:38:33 -0700 | [diff] [blame] | 59 | BBSim 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 Scandolo | 9f61949 | 2019-10-25 13:11:58 -0700 | [diff] [blame] | 65 | Once 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 | |
| 71 | Provision a BBSim OLT in VOLTHA |
| 72 | ------------------------------- |
| 73 | |
| 74 | Create 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 | |
| 80 | Enable the device: |
| 81 | |
| 82 | .. code:: bash |
| 83 | |
| 84 | voltctl device enable $(voltctl device list --filter Type~openolt -q) |
Matteo Scandolo | c114709 | 2019-10-29 09:38:33 -0700 | [diff] [blame] | 85 | |
| 86 | BBSim startup options |
| 87 | --------------------- |
| 88 | |
Zack Williams | 4b0ef4d | 2019-12-18 14:25:20 -0700 | [diff] [blame] | 89 | ``BBSim`` supports a series of options that can be set at startup, you can see |
| 90 | the list via ``./bbsim --help`` |
Matteo Scandolo | c114709 | 2019-10-29 09:38:33 -0700 | [diff] [blame] | 91 | |
| 92 | .. code:: bash |
| 93 | |
| 94 | $ ./bbsim --help |
| 95 | Usage of ./bbsim: |
Matteo Scandolo | f65e687 | 2020-04-15 15:18:43 -0700 | [diff] [blame] | 96 | -api_address string |
| 97 | IP address:port (default ":50070") |
Matteo Scandolo | c114709 | 2019-10-29 09:38:33 -0700 | [diff] [blame] | 98 | -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 Scandolo | f65e687 | 2020-04-15 15:18:43 -0700 | [diff] [blame] | 102 | -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 Scandolo | c114709 | 2019-10-29 09:38:33 -0700 | [diff] [blame] | 106 | -cpuprofile string |
| 107 | write cpu profile to file |
Matteo Scandolo | cae57b5 | 2019-11-12 10:52:53 -0800 | [diff] [blame] | 108 | -delay int |
| 109 | The delay between ONU DISCOVERY batches in milliseconds (1 ONU per each PON PORT at a time (default 200) |
Matteo Scandolo | c114709 | 2019-10-29 09:38:33 -0700 | [diff] [blame] | 110 | -dhcp |
| 111 | Set this flag if you want DHCP to start automatically |
Matteo Scandolo | f65e687 | 2020-04-15 15:18:43 -0700 | [diff] [blame] | 112 | -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 Scandolo | c114709 | 2019-10-29 09:38:33 -0700 | [diff] [blame] | 118 | -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 Scandolo | f65e687 | 2020-04-15 15:18:43 -0700 | [diff] [blame] | 125 | OLT device ID |
Matteo Scandolo | c114709 | 2019-10-29 09:38:33 -0700 | [diff] [blame] | 126 | -onu int |
| 127 | Number of ONU devices per PON port to be emulated (default 1) |
Matteo Scandolo | f65e687 | 2020-04-15 15:18:43 -0700 | [diff] [blame] | 128 | -openolt_address string |
| 129 | IP address:port (default ":50060") |
Matteo Scandolo | c114709 | 2019-10-29 09:38:33 -0700 | [diff] [blame] | 130 | -pon int |
| 131 | Number of PON ports per OLT device to be emulated (default 1) |
Matteo Scandolo | f65e687 | 2020-04-15 15:18:43 -0700 | [diff] [blame] | 132 | -rest_api_address string |
| 133 | IP address:port (default ":50071") |
Matteo Scandolo | c114709 | 2019-10-29 09:38:33 -0700 | [diff] [blame] | 134 | -s_tag int |
Matteo Scandolo | f65e687 | 2020-04-15 15:18:43 -0700 | [diff] [blame] | 135 | 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") |
Zdravko Bozakov | 3ddb245 | 2019-11-29 14:33:41 +0100 | [diff] [blame] | 140 | |
Zack Williams | 4b0ef4d | 2019-12-18 14:25:20 -0700 | [diff] [blame] | 141 | ``BBSim`` also looks for a configuration file in ``configs/bbsim.yaml`` from |
| 142 | which it reads a number of default settings. The command line options listed |
| 143 | above override the corresponding configuration file settings. A sample |
| 144 | configuration file is given below: |
Zdravko Bozakov | 3ddb245 | 2019-11-29 14:33:41 +0100 | [diff] [blame] | 145 | |
| 146 | .. literalinclude:: ../../configs/bbsim.yaml |
Zdravko Bozakov | 958d81c | 2019-12-13 22:09:48 +0100 | [diff] [blame] | 147 | |
Matteo Scandolo | f65e687 | 2020-04-15 15:18:43 -0700 | [diff] [blame] | 148 | Specifying different tagging schemes |
| 149 | ------------------------------------ |
| 150 | |
| 151 | BBSim supports two different tagging schemes: |
| 152 | - ``-s_tag_allocation shared -c_tag_allocation unique`` |
| 153 | - ``-s_tag_allocation unique -c_tag_allocation shared`` |
| 154 | |
| 155 | Where the former will use the same ``S-Tag`` for all the ONUs and a unique ``C-Tag`` for each of them |
| 156 | and the latter will use a unique ``S-Tag`` for each ONU and the same ``C-Tag`` for all of them. |
| 157 | |
| 158 | For example: |
| 159 | |
| 160 | .. code:: bash |
| 161 | |
| 162 | # -s_tag_allocation shared -c_tag_allocation unique |
| 163 | PONPORTID ID PORTNO SERIALNUMBER HWADDRESS STAG CTAG OPERSTATE INTERNALSTATE |
| 164 | 0 0 0 BBSM00000001 2e:60:70:00:00:01 900 900 down created |
| 165 | 1 0 0 BBSM00000101 2e:60:70:00:01:01 900 901 down created |
| 166 | 2 0 0 BBSM00000201 2e:60:70:00:02:01 900 902 down created |
| 167 | 3 0 0 BBSM00000301 2e:60:70:00:03:01 900 903 down created |
| 168 | |
| 169 | |
| 170 | # -s_tag_allocation unique -c_tag_allocation shared |
| 171 | PONPORTID ID PORTNO SERIALNUMBER HWADDRESS STAG CTAG OPERSTATE INTERNALSTATE |
| 172 | 0 0 0 BBSM00000001 2e:60:70:00:00:01 900 7 down created |
| 173 | 1 0 0 BBSM00000101 2e:60:70:00:01:01 901 7 down created |
| 174 | 2 0 0 BBSM00000201 2e:60:70:00:02:01 902 7 down created |
| 175 | 3 0 0 BBSM00000301 2e:60:70:00:03:01 903 7 down created |
| 176 | |
| 177 | |
| 178 | |
Zdravko Bozakov | 958d81c | 2019-12-13 22:09:48 +0100 | [diff] [blame] | 179 | Using the BBSim Sadis server in ONOS |
| 180 | ------------------------------------ |
| 181 | |
Zack Williams | 4b0ef4d | 2019-12-18 14:25:20 -0700 | [diff] [blame] | 182 | BBSim provides a simple server for testing with the ONOS Sadis app. The server |
| 183 | listens on port 50074 by default and provides the endpoints |
| 184 | ``subscribers/<id>`` and ``bandwidthprofiles/<id>``. |
Zdravko Bozakov | 958d81c | 2019-12-13 22:09:48 +0100 | [diff] [blame] | 185 | |
Zack Williams | 4b0ef4d | 2019-12-18 14:25:20 -0700 | [diff] [blame] | 186 | To configure ONOS to use the BBSim ``Sadis`` server endpoints, the Sadis app |
| 187 | must use be configured as follows (see ``examples/sadis-in-bbsim.json``): |
Zdravko Bozakov | 958d81c | 2019-12-13 22:09:48 +0100 | [diff] [blame] | 188 | |
Matteo Scandolo | f65e687 | 2020-04-15 15:18:43 -0700 | [diff] [blame] | 189 | .. literalinclude:: ../../examples/sadis-in-bbsim.json |
Zdravko Bozakov | 958d81c | 2019-12-13 22:09:48 +0100 | [diff] [blame] | 190 | |
Zack Williams | 4b0ef4d | 2019-12-18 14:25:20 -0700 | [diff] [blame] | 191 | This base configuration may also be obtained directly from the BBSim Sadis |
| 192 | server: |
Zdravko Bozakov | 958d81c | 2019-12-13 22:09:48 +0100 | [diff] [blame] | 193 | |
| 194 | .. code:: bash |
| 195 | |
Matteo Scandolo | f65e687 | 2020-04-15 15:18:43 -0700 | [diff] [blame] | 196 | curl http://<BBSIM_IP>:50074/v2/cfg -o examples/sadis.json |
Zdravko Bozakov | 958d81c | 2019-12-13 22:09:48 +0100 | [diff] [blame] | 197 | |
| 198 | It can then be pushed to the Sadis app using the following command: |
| 199 | |
| 200 | .. code:: bash |
| 201 | |
| 202 | curl -sSL --user karaf:karaf \ |
| 203 | -X POST \ |
| 204 | -H Content-Type:application/json \ |
| 205 | http://localhost:8181/onos/v1/network/configuration/apps/org.opencord.sadis \ |
| 206 | --data @examples/sadis-in-bbsim.json |
| 207 | |
| 208 | You can verify the current Sadis configuration: |
| 209 | |
| 210 | .. code:: bash |
| 211 | |
| 212 | curl --user karaf:karaf http://localhost:8181/onos/v1/network/configuration/apps/org.opencord.sadis |
| 213 | |
| 214 | In ONOS subscriber information can be queried using ``sadis <id>``. |
Pragya Arya | 324337e | 2020-02-20 14:35:08 +0530 | [diff] [blame] | 215 | |
Matteo Scandolo | f65e687 | 2020-04-15 15:18:43 -0700 | [diff] [blame] | 216 | *Note that BBSim supports both sadis configuration versions, |
| 217 | if you need to support the configuration for release older than VOLTHA-2.3 |
| 218 | you can use the following command:* |
Matteo Scandolo | 9d08be5 | 2020-03-12 09:43:53 -0700 | [diff] [blame] | 219 | |
Matteo Scandolo | f65e687 | 2020-04-15 15:18:43 -0700 | [diff] [blame] | 220 | .. code:: bash |
| 221 | |
| 222 | curl http://<BBSIM_IP>:50074/v1/cfg -o examples/sadis.json |
| 223 | |
| 224 | Configure the Sadis format for different workflows |
| 225 | ************************************************** |
| 226 | |
| 227 | BBSim support different sadis formats, required for different workflows. |
| 228 | The desired sadis format can be specified via the ``-sadisFormat`` flag. |
| 229 | |
| 230 | The difference in the format is restricted to the ``uniTagList`` property, |
| 231 | for example: |
| 232 | |
| 233 | **ATT** |
| 234 | |
| 235 | .. code:: json |
| 236 | |
| 237 | { |
| 238 | "id": "BBSM00000003-1", |
| 239 | "nasPortId": "BBSM00000003-1", |
| 240 | "circuitId": "BBSM00000003-1", |
| 241 | "remoteId": "BBSM00000003-1", |
| 242 | "uniTagList": [ |
| 243 | { |
| 244 | "DownstreamBandwidthProfile": "User_Bandwidth1", |
| 245 | "IsDhcpRequired": true, |
| 246 | "IsIgmpRequired": true, |
| 247 | "PonCTag": 903, |
| 248 | "PonSTag": 900, |
| 249 | "TechnologyProfileID": 64, |
| 250 | "UpstreamBandwidthProfile": "Default" |
| 251 | } |
| 252 | ] |
| 253 | } |
| 254 | |
| 255 | **DT** |
| 256 | |
| 257 | .. code:: json |
| 258 | |
| 259 | { |
| 260 | "id": "BBSM00000003-1", |
| 261 | "nasPortId": "BBSM00000003-1", |
| 262 | "circuitId": "BBSM00000003-1", |
| 263 | "remoteId": "BBSM00000003-1", |
| 264 | "uniTagList": [ |
| 265 | { |
| 266 | "DownstreamBandwidthProfile": "User_Bandwidth1", |
| 267 | "PonCTag": 4096, |
| 268 | "PonSTag": 903, |
| 269 | "TechnologyProfileID": 64, |
| 270 | "UniTagMatch": 4096, |
| 271 | "UpstreamBandwidthProfile": "Default" |
| 272 | } |
| 273 | ] |
| 274 | } |
| 275 | |
| 276 | **TT** |
| 277 | |
| 278 | *Coming soon...* |
Matteo Scandolo | 9d08be5 | 2020-03-12 09:43:53 -0700 | [diff] [blame] | 279 | |
Pragya Arya | 3f8fdc6 | 2020-03-16 11:12:27 +0530 | [diff] [blame] | 280 | Controlled PON and ONU activation |
| 281 | --------------------------------- |
| 282 | |
Zack Williams | d2907e6 | 2020-04-03 10:23:02 -0700 | [diff] [blame] | 283 | BBSim provides support for controlled PON and ONU activation. By default both |
| 284 | PON ports and ONUs are automatically activated when OLT is enabled. This can |
| 285 | be controlled using ``-ca`` option. |
Pragya Arya | 3f8fdc6 | 2020-03-16 11:12:27 +0530 | [diff] [blame] | 286 | |
| 287 | ``-ca`` can be set to one of below four modes: |
| 288 | |
| 289 | - default: PON ports and ONUs are automatic activated (default behavior). |
| 290 | |
| 291 | - only-onu: PON ports automatically enabled and ONUs dynamically activated |
| 292 | On Enable OLT, IntfIndications for all PON ports are sent but ONU discovery indications are not sent. |
| 293 | When PoweronONU request is received at BBSim API server then ONU discovery indication is sent for that ONU. |
Zack Williams | d2907e6 | 2020-04-03 10:23:02 -0700 | [diff] [blame] | 294 | |
Pragya Arya | 3f8fdc6 | 2020-03-16 11:12:27 +0530 | [diff] [blame] | 295 | - only-pon: PON ports dynamically enabled and ONUs automatically activated |
| 296 | On Enable OLT, neither IntfIndications for PON ports nor ONU discovery indications are sent. |
| 297 | When EnablePonIf request is received at OpenOLT server, then that PON port is enabled and |
| 298 | IntfIndication is sent for that PON and all ONUs under that ports are discovered automatically. |
Zack Williams | d2907e6 | 2020-04-03 10:23:02 -0700 | [diff] [blame] | 299 | |
Pragya Arya | 3f8fdc6 | 2020-03-16 11:12:27 +0530 | [diff] [blame] | 300 | - both: Both PON ports and ONUs are dynamically activated |
| 301 | On Enable OLT, neither IntfIndication for PON ports nor ONU discovery indications are sent. |
Zack Williams | d2907e6 | 2020-04-03 10:23:02 -0700 | [diff] [blame] | 302 | When EnablePonIf request is received on OpenOLT server then |
| 303 | IntfIndication is sent for that PON but no ONU discovery indication |
| 304 | will be sent. |
Pragya Arya | 3f8fdc6 | 2020-03-16 11:12:27 +0530 | [diff] [blame] | 305 | When PoweronONU request is received at BBSim API server then ONU discovery indication is sent for that ONU. |
| 306 | |
| 307 | |
Pragya Arya | 324337e | 2020-02-20 14:35:08 +0530 | [diff] [blame] | 308 | Publishing BBSim Events on kafka |
| 309 | -------------------------------- |
| 310 | |
Zack Williams | d2907e6 | 2020-04-03 10:23:02 -0700 | [diff] [blame] | 311 | BBSim provides option for publishing events on kafka. To publish events on |
| 312 | kafka, set BBSimEvents flag and configure kafkaAddress. |
| 313 | |
| 314 | Once BBSim is started, it will publish events (as and when they happen) on |
| 315 | topic ``BBSim-OLT-<id>-Events``. |
Pragya Arya | 324337e | 2020-02-20 14:35:08 +0530 | [diff] [blame] | 316 | |
| 317 | Types of Events: |
| 318 | - OLT-enable-received |
| 319 | - OLT-disable-received |
| 320 | - OLT-reboot-received |
| 321 | - OLT-reenable-received |
| 322 | - ONU-discovery-indication-sent |
| 323 | - ONU-activate-indication-received |
| 324 | - MIB-upload-received |
| 325 | - MIB-upload-done |
| 326 | - Flow-add-received |
| 327 | - Flow-remove-received |
| 328 | - ONU-authentication-done |
| 329 | - ONU-DHCP-ACK-received |
| 330 | |
| 331 | Sample output of kafkacat consumer for BBSim with OLT-ID 4: |
| 332 | |
| 333 | .. code:: bash |
| 334 | |
| 335 | $ kafkacat -b localhost:9092 -t BBSim-OLT-4-Events -C |
| 336 | {"EventType":"OLT-enable-received","OnuSerial":"","OltID":4,"IntfID":-1,"OnuID":-1,"EpochTime":1583152243144,"Timestamp":"2020-03-02 12:30:43.144449453"} |
| 337 | {"EventType":"ONU-discovery-indication-sent","OnuSerial":"BBSM00040001","OltID":4,"IntfID":0,"OnuID":0,"EpochTime":1583152243227,"Timestamp":"2020-03-02 12:30:43.227183506"} |
| 338 | {"EventType":"ONU-activate-indication-received","OnuSerial":"BBSM00040001","OltID":4,"IntfID":0,"OnuID":1,"EpochTime":1583152243248,"Timestamp":"2020-03-02 12:30:43.248225467"} |
| 339 | {"EventType":"MIB-upload-received","OnuSerial":"BBSM00040001","OltID":4,"IntfID":0,"OnuID":1,"EpochTime":1583152243299,"Timestamp":"2020-03-02 12:30:43.299480183"} |