5 # all below addresses are those of the qemu host
6 [ -z "$SELF_HOST" ] && SELF_HOST="selftest.$(hostname)"
7 [ -z "$SELF_IP" ] && SELF_IP="10.1.159.48"
10 ####################################################
14 rpm -q myplc-native > /dev/null
16 [ $installed -eq 1 ] && yum -y install myplc-native
18 # setup qemu to run the node from the bootcd
19 rpm -q qemu > /dev/null
21 [ $installed -eq 1 ] && yum -y install qemu
27 # make sure its stopped
30 # turn off plc until its been configured
33 ####################################################
34 # configure myplc for testing purposes
37 function genpassword()
40 [ -z "$len" ] && len=8
42 import crypt, random, string
43 salt = [random.choice(string.letters + string.digits + "./") for i in range(0,$len)]
48 # create new 16 char random password
59 root@localhost.localdomain
64 e PLC_MAIL_SUPPORT_ADDRESS
65 build@lists.planet-lab.org
95 plc-config-tty < $config
97 echo "$PW" > /etc/planetlab/pw
98 chmod 400 /etc/planetlab/pw
100 # remove temporary config file
105 ####################################################
107 SVNPATH="http://svn.planet-lab.org/svn/"
109 # check out test suite
110 # temporarily disabling -- mef
111 #svn export ${SVNPATH}/tests/trunk/${QA_TESTSUITE} /tmp/${QA_TESTSUITE}
112 #cd /tmp/${QA_TESTSUITE}/
113 #chmod +x runtests.py
117 ####################################################
118 # configure a site and a node @ the local myplc for qemu testing
120 # configure a selftest site
122 TESTHOST="qemu-1.$(hostname)"
126 TESTURL="http://selftest.doesnotexist"
127 TESTDISK="/selftest.img"
128 TESTCONF="/selftest.txt"
132 DeleteSite("$TESTSITE")
133 AddSite({"name":"$TESTNAME","url":"$TESTURL","max_slices":10,"login_base":"$TESTSITE","is_public":True,"abbreviated_name":"$TESTABR"})
134 # create a test node for qemu
135 AddNode("st",{"boot_state":"rins","model":"qemu/minhw","hostname":"$TESTHOST","version":"$TESTVERS"})
136 # set up the nodenetwork setting for qemu
137 AddNodeNetwork("$TESTHOST",{"network":"10.0.2.0","hostname":"$TESTHOST","is_primary":True,"dns1":"$SELF_IP","method":"static","type":"ipv4","netmask":"255.255.255.0","broadcast":"10.0.2.255","gateway":"10.0.2.2"})
138 # Download the node's boot cd iso
139 GetBootMedium("$TESTHOST","node-floppy","$TESTCONF")
144 # generate custom iso
145 SERIAL="ttyS0:115200:n:8"
146 /usr/share/bootcd/build.sh -s $SERIAL -O selftest -f $TESTCONF -t iso_cramfs
147 SNAME=$(echo $SERIAL | sed 's,:,,g')
148 TESTISO="./selftest-serial-$SNAME-cramfs.iso"
150 qemu-img create -f qcow $TESTDISK 5GB
153 # -nographic -> for serial line console
154 # -boot d -> to boot from cdrom
155 # -cdrom -> specifies iso file to serve as cdrom
156 # -m 512 -> 512MB memory
158 [ -f "$TESTDISK" -a -f "$TESTISO" ] && qemu-system-x86_64 -boot d -nographic -m 512 -cdrom $TESTISO $TESTDISK