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 # make sure its stopped
21 # turn off plc until its been configured
24 ####################################################
25 # configure myplc for testing purposes
28 function genpassword()
31 [ -z "$len" ] && len=8
33 import crypt, random, string
34 salt = [random.choice(string.letters + string.digits + "./") for i in range(0,$len)]
39 # create new 16 char random password
50 root@localhost.localdomain
55 e PLC_MAIL_SUPPORT_ADDRESS
56 build@lists.planet-lab.org
86 plc-config-tty < $config
88 echo "$PW" > /etc/planetlab/pw
89 chmod 400 /etc/planetlab/pw
91 # remove temporary config file
96 ####################################################
98 SVNPATH="http://svn.planet-lab.org/svn/"
100 # check out test suite
101 # temporarily disabling -- mef
102 #svn export ${SVNPATH}/tests/trunk/${QA_TESTSUITE} /tmp/${QA_TESTSUITE}
103 #cd /tmp/${QA_TESTSUITE}/
104 #chmod +x runtests.py
108 ####################################################
109 # configure a site and a node @ the local myplc for qemu testing
111 # configure a selftest site
113 TESTHOST="qemu-1.$(hostname)"
117 TESTURL="http://selftest.doesnotexist"
118 TESTDISK="/selftest.img"
119 TESTCONF="/selftest.txt"
123 DeleteSite("$TESTSITE")
124 AddSite({"name":"$TESTNAME","url":"$TESTURL","max_slices":10,"login_base":"$TESTSITE","is_public":True,"abbreviated_name":"$TESTABR"})
125 # create a test node for qemu
126 AddNode("st",{"boot_state":"rins","model":"qemu/minhw","hostname":"$TESTHOST","version":"$TESTVERS"})
127 # set up the nodenetwork setting for qemu
128 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"})
129 # Download the node's boot cd iso
130 GetBootMedium("$TESTHOST","node-floppy","$TESTCONF")
135 # generate custom iso
136 SERIAL="ttyS0:115200:n:8"
137 /usr/share/bootcd/build.sh -s $SERIAL -O selftest -f $TESTCONF -t iso_cramfs
138 SNAME=$(echo $SERIAL | sed 's,:,,g')
139 TESTISO="./selftest-serial-$SNAME-cramfs.iso"
141 # setup qemu to run the node from the bootcd
142 rpm -q qemu > /dev/null
144 [ $installed -eq 1 ] && yum -y install qemu
145 qemu-img create -f qcow $TESTDISK 5GB
148 # -nographic -> for serial line console
149 # -boot d -> to boot from cdrom
150 # -cdrom -> specifies iso file to serve as cdrom
151 # -m 512 -> 512MB memory
153 [ -f "$TESTDISK" -a -f "$TESTISO" ] && qemu-system-x86_64 -boot d -nographic -m 512 -cdrom $TESTISO $TESTDISK