Adding tools for next version of warden.
Change-Id: I35b0ac57b54b0bf7b8c6b6a40e02f050b3fcc7f1
Showing
5 changed files
with
78 additions
and
0 deletions
utils/warden/bin/cell-def
0 → 100755
| 1 | +#!/bin/bash | ||
| 2 | +# Creates a cell definition from the given name and LXC info | ||
| 3 | + | ||
| 4 | +name="$1" | ||
| 5 | +apps="${2:-drivers,openflow,proxyarp,mobility,pathpainter}" | ||
| 6 | + | ||
| 7 | +echo "export ONOS_CELL=borrow" | ||
| 8 | +echo "export ONOS_NIC=\"10.128.11.*\"" | ||
| 9 | + | ||
| 10 | +sudo lxc-ls -F "name,ipv4" --fancy | grep $name | \ | ||
| 11 | + sed "s/^$name/OC/" | tr "[:lower:]" "[:upper:]" | \ | ||
| 12 | + sed -r 's/[ ]+/\=/;s/^/export /' | ||
| 13 | + | ||
| 14 | +echo "export OCT=\"\$OC1\"" | ||
| 15 | +echo "export ONOS_USE_SSH=true" | ||
| 16 | +echo "export ONOS_APPS=${apps}" |
utils/warden/bin/clone-node
0 → 100755
| 1 | +#!/bin/bash | ||
| 2 | +# Creates a new node from the base image. | ||
| 3 | + | ||
| 4 | +base="$1" | ||
| 5 | +ip="$2" | ||
| 6 | +name="$3" | ||
| 7 | +key="$4" | ||
| 8 | + | ||
| 9 | +sudo lxc-clone -o $base -n $name | ||
| 10 | + | ||
| 11 | +sudo chmod 777 /var/lib/lxc | ||
| 12 | +sudo chmod 777 /var/lib/lxc/$name | ||
| 13 | +sudo chmod 666 /var/lib/lxc/$name/config | ||
| 14 | + | ||
| 15 | +sudo cat >>/var/lib/lxc/$name/config <<EOF | ||
| 16 | +lxc.network.ipv4 = ${ip}/16 | ||
| 17 | +lxc.network.ipv4.gateway = 10.128.0.1 | ||
| 18 | +EOF | ||
| 19 | + | ||
| 20 | +sudo chmod 644 /var/lib/lxc/$name/config | ||
| 21 | +sudo chmod 750 /var/lib/lxc/$name | ||
| 22 | +sudo chmod 700 /var/lib/lxc | ||
| 23 | + | ||
| 24 | +sudo lxc-start -d -n $name | ||
| 25 | +sudo lxc-attach -n $name -- ping -c1 8.8.8.8 | ||
| 26 | +sudo lxc-attach -n $name -- bash -c "echo $key >> /home/sdn/.ssh/authorized_keys" | ||
| 27 | +sudo lxc-ls --fancy |
utils/warden/bin/create-cell
0 → 100755
utils/warden/bin/destroy-cell
0 → 100755
utils/warden/bin/destroy-node
0 → 100755
-
Please register or login to post a comment