Thomas Vachuska | 0fdf7c9 | 2016-05-05 17:01:39 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # Creates a new cell. |
| 3 | |
| 4 | name="$1" |
| 5 | ipx="$2" |
Thomas Vachuska | 5420ba3 | 2016-05-13 14:45:25 -0400 | [diff] [blame] | 6 | spec="$3" |
| 7 | shift 3 |
Thomas Vachuska | e91541f | 2016-05-05 23:15:41 -0700 | [diff] [blame] | 8 | key="$@" |
Thomas Vachuska | 0fdf7c9 | 2016-05-05 17:01:39 -0700 | [diff] [blame] | 9 | |
| 10 | cd $(dirname $0) |
| 11 | |
Thomas Vachuska | 5420ba3 | 2016-05-13 14:45:25 -0400 | [diff] [blame] | 12 | nodes=${spec%+*} |
| 13 | mininet=${spec#*+} |
| 14 | |
Thomas Vachuska | 9e61bd9 | 2016-05-06 15:34:59 -0700 | [diff] [blame] | 15 | sudo lxc-attach -n bit-proxy -- bash -c "grep -qF \"$key\" /home/sdn/.ssh/authorized_keys || echo $key >> /home/sdn/.ssh/authorized_keys" |
| 16 | |
Thomas Vachuska | 5420ba3 | 2016-05-13 14:45:25 -0400 | [diff] [blame] | 17 | if [ $mininet -ge 1 ]; then |
| 18 | ./clone-node base-mininet ${ipx/x/0} $name-n "$key" |
| 19 | fi |
Thomas Vachuska | 0fdf7c9 | 2016-05-05 17:01:39 -0700 | [diff] [blame] | 20 | |
Thomas Vachuska | 5420ba3 | 2016-05-13 14:45:25 -0400 | [diff] [blame] | 21 | let n=1 |
| 22 | while [ $n -le $nodes ]; do |
Thomas Vachuska | 0fdf7c9 | 2016-05-05 17:01:39 -0700 | [diff] [blame] | 23 | ./clone-node base-onos ${ipx/x/$n} $name-$n "$key" |
Thomas Vachuska | 5420ba3 | 2016-05-13 14:45:25 -0400 | [diff] [blame] | 24 | let n=n+1 |
Thomas Vachuska | 0fdf7c9 | 2016-05-05 17:01:39 -0700 | [diff] [blame] | 25 | done |