Thomas Vachuska | b1906d2 | 2018-02-14 16:50:16 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- |
| 3 | # Creates a spine-leaf fabric with large number of hosts using null providers |
| 4 | # ----------------------------------------------------------------------------- |
| 5 | |
| 6 | # config |
| 7 | node=${1:-$OCI} |
| 8 | |
| 9 | # Create the script of ONOS commands first and then execute it all at once. |
| 10 | export CMDS="/tmp/fab-onos.cmds" |
| 11 | rm $CMDS |
| 12 | |
| 13 | function sim { |
| 14 | echo "$@" >> $CMDS |
| 15 | } |
| 16 | |
Thomas Vachuska | cab29d2 | 2018-02-21 15:47:29 -0800 | [diff] [blame] | 17 | # Generate the recipe using the following: |
| 18 | # 2 spines, can potentially be few more |
| 19 | # 12 leaves in total |
| 20 | # 2 leaf pair |
| 21 | # 8 non-paired |
| 22 | # Host per leaf up to 1K |
Thomas Vachuska | b1906d2 | 2018-02-14 16:50:16 -0800 | [diff] [blame] | 23 | |
| 24 | spinePorts=48 |
| 25 | leafPorts=64 |
Thomas Vachuska | cab29d2 | 2018-02-21 15:47:29 -0800 | [diff] [blame] | 26 | accessPorts=128 |
Thomas Vachuska | b1906d2 | 2018-02-14 16:50:16 -0800 | [diff] [blame] | 27 | |
| 28 | # Create spines |
| 29 | for spine in {1..2}; do |
| 30 | sim "null-create-device switch Spine-${spine} ${spinePorts}" |
| 31 | done |
| 32 | |
| 33 | # Create 2 leaf pairs with dual links to the spines and a link between the pair |
| 34 | for pair in A B; do |
| 35 | sim "null-create-device switch Leaf-${pair}1 ${leafPorts}" |
| 36 | sim "null-create-device switch Leaf-${pair}2 ${leafPorts}" |
| 37 | sim "null-create-link direct Leaf-${pair}1 Leaf-${pair}2" |
| 38 | |
| 39 | for spine in {1..2}; do |
| 40 | for link in {1..2}; do |
| 41 | sim "null-create-link direct Spine-${spine} Leaf-${pair}1" |
| 42 | sim "null-create-link direct Spine-${spine} Leaf-${pair}2" |
| 43 | done |
| 44 | done |
| 45 | |
| 46 | # Create hosts for each leaf group; multi-homed to each leaf in the pair |
| 47 | [ $pair = A ] && pn=1 || pn=2 |
| 48 | for host in {1..10}; do |
| 49 | sim "null-create-host Leaf-${pair}1,Leaf-${pair}2 10.${pn}.1.${host}" |
| 50 | done |
| 51 | done |
| 52 | |
| 53 | # Create 8 single leafs with dual links to the spines |
| 54 | for access in {1..8}; do |
| 55 | sim "null-create-device switch Access-${access} ${accessPorts}" |
| 56 | |
| 57 | for spine in {1..2}; do |
| 58 | for link in {1..2}; do |
| 59 | sim "null-create-link direct Spine-${spine} Access-${access}" |
| 60 | done |
| 61 | done |
| 62 | |
| 63 | # Create hosts for each single leaf |
Thomas Vachuska | cab29d2 | 2018-02-21 15:47:29 -0800 | [diff] [blame] | 64 | for host in {1..50}; do |
Thomas Vachuska | b1906d2 | 2018-02-14 16:50:16 -0800 | [diff] [blame] | 65 | sim "null-create-host Access-${access} 10.0.${access}.${host}" |
| 66 | done |
| 67 | done |
| 68 | |
| 69 | |
Thomas Vachuska | cab29d2 | 2018-02-21 15:47:29 -0800 | [diff] [blame] | 70 | # make sure null providers are activated and any running simulation is stopped |
Thomas Vachuska | b1906d2 | 2018-02-14 16:50:16 -0800 | [diff] [blame] | 71 | onos ${node} app activate org.onosproject.null |
Thomas Vachuska | b1906d2 | 2018-02-14 16:50:16 -0800 | [diff] [blame] | 72 | sleep 2 |
Thomas Vachuska | cab29d2 | 2018-02-21 15:47:29 -0800 | [diff] [blame] | 73 | onos ${node} null-simulation stop |
| 74 | |
| 75 | # wait until the masterships clear-out across the cluster |
| 76 | while onos ${node} masters | grep -qv " 0 devices"; do sleep 1; done |
| 77 | |
| 78 | # clean-up |
| 79 | onos ${node} wipe-out please |
| 80 | sleep 1 |
Thomas Vachuska | b1906d2 | 2018-02-14 16:50:16 -0800 | [diff] [blame] | 81 | |
| 82 | # start custom simulation.. |
| 83 | onos ${node} null-simulation start custom |
Thomas Vachuska | cab29d2 | 2018-02-21 15:47:29 -0800 | [diff] [blame] | 84 | sleep 2 |
Thomas Vachuska | b1906d2 | 2018-02-14 16:50:16 -0800 | [diff] [blame] | 85 | |
| 86 | # Add devices, links, and hosts |
| 87 | cat $CMDS | onos ${node} |
| 88 | |