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 | |
| 17 | sim "wipe-out please" |
| 18 | |
| 19 | spinePorts=48 |
| 20 | leafPorts=64 |
| 21 | accessPorts=1024 |
| 22 | |
| 23 | # Create spines |
| 24 | for spine in {1..2}; do |
| 25 | sim "null-create-device switch Spine-${spine} ${spinePorts}" |
| 26 | done |
| 27 | |
| 28 | # Create 2 leaf pairs with dual links to the spines and a link between the pair |
| 29 | for pair in A B; do |
| 30 | sim "null-create-device switch Leaf-${pair}1 ${leafPorts}" |
| 31 | sim "null-create-device switch Leaf-${pair}2 ${leafPorts}" |
| 32 | sim "null-create-link direct Leaf-${pair}1 Leaf-${pair}2" |
| 33 | |
| 34 | for spine in {1..2}; do |
| 35 | for link in {1..2}; do |
| 36 | sim "null-create-link direct Spine-${spine} Leaf-${pair}1" |
| 37 | sim "null-create-link direct Spine-${spine} Leaf-${pair}2" |
| 38 | done |
| 39 | done |
| 40 | |
| 41 | # Create hosts for each leaf group; multi-homed to each leaf in the pair |
| 42 | [ $pair = A ] && pn=1 || pn=2 |
| 43 | for host in {1..10}; do |
| 44 | sim "null-create-host Leaf-${pair}1,Leaf-${pair}2 10.${pn}.1.${host}" |
| 45 | done |
| 46 | done |
| 47 | |
| 48 | # Create 8 single leafs with dual links to the spines |
| 49 | for access in {1..8}; do |
| 50 | sim "null-create-device switch Access-${access} ${accessPorts}" |
| 51 | |
| 52 | for spine in {1..2}; do |
| 53 | for link in {1..2}; do |
| 54 | sim "null-create-link direct Spine-${spine} Access-${access}" |
| 55 | done |
| 56 | done |
| 57 | |
| 58 | # Create hosts for each single leaf |
| 59 | for host in {1..25}; do |
| 60 | sim "null-create-host Access-${access} 10.0.${access}.${host}" |
| 61 | done |
| 62 | done |
| 63 | |
| 64 | |
| 65 | |
| 66 | # make sure null providers are activated |
| 67 | onos ${node} app activate org.onosproject.null |
| 68 | |
| 69 | sleep 2 |
| 70 | |
| 71 | # start custom simulation.. |
| 72 | onos ${node} null-simulation start custom |
| 73 | |
| 74 | # Generate the recipe using the following: |
| 75 | # 2 spines, can potentially be few more |
| 76 | # 12 leaves in total |
| 77 | # 2 leaf pair |
| 78 | # 8 non-paired |
| 79 | # Host per leaf up to 1K |
| 80 | |
| 81 | sleep 5 |
| 82 | |
| 83 | # Add devices, links, and hosts |
| 84 | cat $CMDS | onos ${node} |
| 85 | |