blob: f8eb3f0e29bb3663d0adda7d8f6336203fe6bd1d [file] [log] [blame]
Thomas Vachuskab1906d22018-02-14 16:50:16 -08001#!/bin/bash
2# -----------------------------------------------------------------------------
3# Creates a spine-leaf fabric with large number of hosts using null providers
4# -----------------------------------------------------------------------------
5
6# config
7node=${1:-$OCI}
8
9# Create the script of ONOS commands first and then execute it all at once.
10export CMDS="/tmp/fab-onos.cmds"
11rm $CMDS
12
13function sim {
14 echo "$@" >> $CMDS
15}
16
Thomas Vachuskacab29d22018-02-21 15:47:29 -080017# 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 Vachuskab1906d22018-02-14 16:50:16 -080023
24spinePorts=48
25leafPorts=64
Thomas Vachuskacab29d22018-02-21 15:47:29 -080026accessPorts=128
Thomas Vachuskab1906d22018-02-14 16:50:16 -080027
28# Create spines
29for spine in {1..2}; do
30 sim "null-create-device switch Spine-${spine} ${spinePorts}"
31done
32
33# Create 2 leaf pairs with dual links to the spines and a link between the pair
34for 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
51done
52
53# Create 8 single leafs with dual links to the spines
54for 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 Vachuskacab29d22018-02-21 15:47:29 -080064 for host in {1..50}; do
Thomas Vachuskab1906d22018-02-14 16:50:16 -080065 sim "null-create-host Access-${access} 10.0.${access}.${host}"
66 done
67done
68
69
Thomas Vachuskacab29d22018-02-21 15:47:29 -080070# make sure null providers are activated and any running simulation is stopped
Thomas Vachuskab1906d22018-02-14 16:50:16 -080071onos ${node} app activate org.onosproject.null
Thomas Vachuskab1906d22018-02-14 16:50:16 -080072sleep 2
Thomas Vachuskacab29d22018-02-21 15:47:29 -080073onos ${node} null-simulation stop
74
75# wait until the masterships clear-out across the cluster
76while onos ${node} masters | grep -qv " 0 devices"; do sleep 1; done
77
78# clean-up
79onos ${node} wipe-out please
80sleep 1
Thomas Vachuskab1906d22018-02-14 16:50:16 -080081
82# start custom simulation..
83onos ${node} null-simulation start custom
Thomas Vachuskacab29d22018-02-21 15:47:29 -080084sleep 2
Thomas Vachuskab1906d22018-02-14 16:50:16 -080085
86# Add devices, links, and hosts
87cat $CMDS | onos ${node}
88