# HG changeset patch # User igor # Date 1190740344 -10800 # Node ID dd8c79bc715c3b30c0065c72cbdfd4c394528b2a # Parent c68d804c30172e7b0fea99ee5baaa39d9c8eb2b1 xendomain.py added diff -r c68d804c3017 -r dd8c79bc715c xendomain.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xendomain.py Tue Sep 25 20:12:24 2007 +0300 @@ -0,0 +1,115 @@ +try: + from xenomips_vars import N +except: + print "can't find xenomips_vars module" + + +#### +# +# External variables: +# * network +# * domain + + +############################################################################################ +# Topology description + +network='change-default-route' + +domains = [ 'dyn1', 'dyn2', 'dyn3', 'qua4', 'qua5', 'qua6', 'qua7', 'qua8', 'qua9', ] +domain_types = [ 'xenomips', 'xenomips', 'xenomips', 'quagga', 'quagga', 'quagga', 'quagga', 'quagga', 'quagga', ] +bridges = [ + 'vlan100', + 'vlan101', + 'vlan102', + 'vlan103', + 'vlan104', + 'vlan105', + 'vlan106', + 'vlan107', + 'vlan108', + 'vlan109', + 'vlan110', + 'vlan111', + ] + +vbridges_table = { + 'dyn1' : [ 'vlan101', 'vlan102' ], + 'dyn2' : [ 'vlan101', 'vlan103' ], + 'dyn3' : [ 'vlan102', 'vlan103', 'vlan104' ], + + 'qua4' : [ 'vlan105', 'vlan106', 'vlan111' ], + 'qua5' : [ 'vlan110', 'vlan111' ], + 'qua6' : [ 'vlan109', 'vlan110' ], + 'qua7' : [ 'vlan108', 'vlan109' ], + 'qua8' : [ 'vlan107', 'vlan108' ], + 'qua9' : [ 'vlan106', 'vlan107' ], + } + +hidden_bridges = [] +broken_links = [] +temporary_links = [] + +xenomips_dir='/xen/images/' +ios_name='C7200-JK.BIN' +npe_type="npe-200" + +name = domain + +# property should be specified only to override default values +properties = { + 'dyn1': { + npe_type: "npe-400", + } + } + +#this instance configuration +if domain_types[domain] == 'quagga': + memory = 64 +else: + memory = 400 + +############################################################################################ + +N = domains.index(domain) + +pae=1 +if pae: + kernel = "/boot/vmlinuz-2.6.18-4-xen-686" + ramdisk = "/boot/initrd.img-2.6.18-4-xen-686" +else: + kernel = "/boot/vmlinuz-2.6.18-without-PAE-4-xen-686" + ramdisk = "/boot/initrd.img-2.6.18-without-PAE-4-xen-686-domU" + +#builder='linux' +cpu_cap = 10 + + +vbridges = vbridges_table[name] + +vif=[] +x=1 +for i in vbridges: + vif.append('bridge='+i+',mac=00:16:3e:01:'+hex(int(N))[2:]+':'+hex(int('c0',16)+x)[2:]) + x+=1 + +disk = [ 'file:'+xenomips_dir+'xenomips1.img,hda1,r', 'file:'+xenomips_dir+'xenomips-ios1.img,hda2,r', 'file:'+xenomips_dir+'xenomips-config'+N+'.img,hda3,w' ] +root = "/dev/hda1 ro" + +xenomips='/xenomips/ios/'+ios_name+' -t '+npe_type+' -m 00:16:3e:01:'+hex(int(N))[2:]+':01' + +for i in range(len(vbridges)-1): + xenomips += ' -p '+str(i+1)+':PA-FE-TX' + +for i in range(len(vbridges)): + xenomips += ' -s '+str(i)+':0:gen_eth:eth'+str(i) + +if domain_types[int(N)] == 'quagga': + extra = "quagga" +else: + extra = "xenomips=\""+xenomips+"\"" + +on_poweroff = 'destroy' +on_reboot = 'restart' +on_crash = 'restart' +