xentaur
changeset 40:10444acb35f4
*** empty log message ***
author | igor |
---|---|
date | Fri Oct 12 17:31:34 2007 +0300 (2007-10-12) |
parents | 54b7c7ae50ec |
children | 8c00f233a1d4 |
files | build-xenomips-image xendomain.py xentaur.py |
line diff
1.1 --- a/build-xenomips-image Fri Sep 28 13:35:54 2007 +0300 1.2 +++ b/build-xenomips-image Fri Oct 12 17:31:34 2007 +0300 1.3 @@ -1,13 +1,13 @@ 1.4 #!/bin/sh 1.5 1.6 DYNAMIPS_BUILD=no 1.7 -XENOMIPS_FS_BUILD=no 1.8 +XENOMIPS_FS_BUILD=yes 1.9 CONFIG_FS_BUILD=no 1.10 IOS_FS_BUILD=yes 1.11 1.12 XENOMIPS_DIR="files/" 1.13 -XENOMIPS_IMAGES_DIR="/home/nata/xenomips-images/" 1.14 -IOS_DIR="/home/nata/ios/" 1.15 +XENOMIPS_IMAGES_DIR="/xen/images/" 1.16 +IOS_DIR="ios/" 1.17 SSH_OPEN_KEY=files/id_dsa.pub 1.18 1.19 #Xenomips FS 1.20 @@ -23,7 +23,7 @@ 1.21 IOS_FS_SIZE=2048k 1.22 IOS_FS_NAME=${XENOMIPS_IMAGES_DIR}/xenomips-ios1.img 1.23 1.24 -DEBIAN_MIRROR=http://debian.org.ua/debian 1.25 +DEBIAN_MIRROR=http://debian.osdn.org.ua/debian 1.26 DISTRO=sid 1.27 PACKAGES="openssh-server libc6-xen libelf1 libpcap0.8 screen nfs-common quagga tcpdump" 1.28 DYNAMIPS_SOURCES=http://www.ipflow.utc.fr/dynamips/dynamips-0.2.7.tar.gz 1.29 @@ -83,6 +83,10 @@ 1.30 FSTAB 1.31 mkdir -p /data/Cisco_IOS /xenomips 1.32 1.33 +cat <<EOF > /etc/sysctl.conf 1.34 +net/ipv4/ip_forward=1 1.35 +EOF 1.36 + 1.37 cat <<'INTERFACES' > /etc/network/interfaces 1.38 auto lo eth0 1.39
2.1 --- a/xendomain.py Fri Sep 28 13:35:54 2007 +0300 2.2 +++ b/xendomain.py Fri Oct 12 17:31:34 2007 +0300 2.3 @@ -29,8 +29,8 @@ 2.4 2.5 pae=1 2.6 if pae: 2.7 - kernel = "/boot/vmlinuz-2.6.18-5-xen-686" 2.8 - ramdisk = "/boot/initrd.img-2.6.18-5-xen-686" 2.9 + kernel = "/boot/vmlinuz-2.6.18-4-xen-686" 2.10 + ramdisk = "/boot/initrd.img-2.6.18-4-xen-686" 2.11 else: 2.12 kernel = "/boot/vmlinuz-2.6.18-without-PAE-4-xen-686" 2.13 ramdisk = "/boot/initrd.img-2.6.18-without-PAE-4-xen-686-domU"
3.1 --- a/xentaur.py Fri Sep 28 13:35:54 2007 +0300 3.2 +++ b/xentaur.py Fri Oct 12 17:31:34 2007 +0300 3.3 @@ -8,8 +8,8 @@ 3.4 sys.path.append('/etc/xen') 3.5 sys.path.append(xentaur_path) 3.6 3.7 -network='netw' 3.8 -domain='dyn3' 3.9 +network='snrs_ipsec_preshared_1' 3.10 +domain='qua1' 3.11 from xendomain import * 3.12 3.13 bridges_turned_down=[] 3.14 @@ -38,7 +38,7 @@ 3.15 3.16 def create_bridges_script(): 3.17 unbound_bridges=set(bridges)-set(real_bridges) 3.18 - create_unbound_bridges="\n".join(map(lambda x: "sudo /usr/sbin/brctl show | awk '{print $1}' | grep -q "+x+" || sudo /usr/sbin/brctl addbr "+x, unbound_bridges)) 3.19 + create_unbound_bridges="\n".join(map(lambda x: "sudo /usr/sbin/brctl show | awk '{print $1}' | grep -qx "+x+" || sudo /usr/sbin/brctl addbr "+x, unbound_bridges)) 3.20 create_unbound_bridges+="\n"+"\n".join(map(lambda x: "sudo /bin/ip link set "+x+" up", unbound_bridges)) 3.21 3.22 print """#!/bin/sh 3.23 @@ -185,6 +185,7 @@ 3.24 """ % graph_dot) 3.25 f.close() 3.26 run_command("neato -Tpng -o xenomips.png xenomips.dot ") 3.27 + run_command("neato -Tsvg -o xenomips.svg xenomips.dot ") 3.28 3.29 def autoredraw(): 3.30 graph() 3.31 @@ -386,9 +387,85 @@ 3.32 3.33 3.34 def configure_ip_addresses(doms=domains): 3.35 + 3.36 + cisco_set_ip_on_int=""" 3.37 +\n\n\n 3.38 +int fa%s/0 3.39 +no ip address 3.40 +ip address %s 255.255.255.0 3.41 +no shutdown 3.42 +exit 3.43 +""" 3.44 + 3.45 + quagga_set_ip_on_int=""" 3.46 +int eth%s 3.47 +no ip address 3.48 +ip address %s/24 3.49 +no shutdown 3.50 +exit 3.51 +""" 3.52 + 3.53 + for dom in doms: 3.54 + i=domains.index(dom)+1 3.55 + if domain_types[domains.index(dom)] == 'quagga': 3.56 + command = quagga_set_ip_on_int 3.57 + write_to(i,"\nconf t\n") 3.58 + j=0 3.59 + for br in vbridges_table[dom]: 3.60 + write_to(i,command % (j, "192.168.%s.%s"%(bridges.index(br)+1,i))) 3.61 + j+=1 3.62 + write_to(i,"\nend\n") 3.63 + else: 3.64 + command = cisco_set_ip_on_int 3.65 + write_to(i,"\nena\nconf t\n") 3.66 + j=0 3.67 + for br in vbridges_table[dom]: 3.68 + write_to(i,command % (j, "192.168.%s.%s"%(bridges.index(br)+1,i))) 3.69 + j+=1 3.70 + write_to(i,"\nend\n") 3.71 + return 0 3.72 + 3.73 +def configure_no_ip_addresses(doms=domains): 3.74 + 3.75 + cisco_set_ip_on_int=""" 3.76 +\n\n\n 3.77 +int fa%s/0 3.78 +no ip address %s 255.255.255.0 3.79 +exit 3.80 +""" 3.81 + 3.82 + quagga_set_ip_on_int=""" 3.83 +int eth%s 3.84 +no ip address %s/24 3.85 +exit 3.86 +""" 3.87 + 3.88 + for dom in doms: 3.89 + i=domains.index(dom)+1 3.90 + if domain_types[domains.index(dom)] == 'quagga': 3.91 + command = quagga_set_ip_on_int 3.92 + write_to(i,"\nconf t\n") 3.93 + j=0 3.94 + for br in vbridges_table[dom]: 3.95 + write_to(i,command % (j, "192.168.%s.%s"%(bridges.index(br)+1,i))) 3.96 + j+=1 3.97 + write_to(i,"\nend\n") 3.98 + else: 3.99 + command = cisco_set_ip_on_int 3.100 + write_to(i,"\nena\nconf t\n") 3.101 + j=0 3.102 + for br in vbridges_table[dom]: 3.103 + write_to(i,command % (j, "192.168.%s.%s"%(bridges.index(br)+1,i))) 3.104 + j+=1 3.105 + write_to(i,"\nend\n") 3.106 return 0 3.107 3.108 def configure_ospf(doms=domains): 3.109 + for dom in doms: 3.110 + if domain_types[domains.index(dom)] == 'quagga': 3.111 + write_to(dom,"\n\nconf t\nrouter ospf\nnetwork 192.168.0.0/16 area 0\nend\n") 3.112 + else: 3.113 + write_to(dom,"\n\nena\nconf t\nrouter ospf 1\nnetwork 192.168.0.0 0.0.255.255 area 0\nend\n") 3.114 return 0 3.115 3.116 def configure_save(doms=domains):