blob: b75a30c040fc15199b1babeba504f8e7e2987773 [file] [log] [blame]
Thomas Vachuska0fdf7c92016-05-05 17:01:39 -07001#!/bin/bash
2# Creates a new cell.
3
4name="$1"
5ipx="$2"
Thomas Vachuska5420ba32016-05-13 14:45:25 -04006spec="$3"
7shift 3
Thomas Vachuskae91541f2016-05-05 23:15:41 -07008key="$@"
Thomas Vachuska0fdf7c92016-05-05 17:01:39 -07009
10cd $(dirname $0)
11
Thomas Vachuska5420ba32016-05-13 14:45:25 -040012nodes=${spec%+*}
13mininet=${spec#*+}
14
Thomas Vachuska9e61bd92016-05-06 15:34:59 -070015sudo lxc-attach -n bit-proxy -- bash -c "grep -qF \"$key\" /home/sdn/.ssh/authorized_keys || echo $key >> /home/sdn/.ssh/authorized_keys"
16
Thomas Vachuska5420ba32016-05-13 14:45:25 -040017if [ $mininet -ge 1 ]; then
18 ./clone-node base-mininet ${ipx/x/0} $name-n "$key"
19fi
Thomas Vachuska0fdf7c92016-05-05 17:01:39 -070020
Thomas Vachuska5420ba32016-05-13 14:45:25 -040021let n=1
22while [ $n -le $nodes ]; do
Thomas Vachuska0fdf7c92016-05-05 17:01:39 -070023 ./clone-node base-onos ${ipx/x/$n} $name-$n "$key"
Thomas Vachuska5420ba32016-05-13 14:45:25 -040024 let n=n+1
Thomas Vachuska0fdf7c92016-05-05 17:01:39 -070025done