try:
    from xenomips_vars import N
except:
    print "can't find xenomips_vars module"

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


############################################################################################
# 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 = []

############################################################################################

if domain_types[int(N)] == 'quagga':
    memory = 64
else:
    memory = 400

xenomips_dir='/xen/images/'
ios_name='C7200-JK.BIN'

#this instance configuration
name = domains[int(N)]

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+' -m 00:16:3e:01:'+hex(int(N))[2:]+':01'

#for i in range(len(vbridges)-2):
# xenomips += ' -p '+str(i+1)+':PA-FE-TX'
#
#for i in range(len(vbridges)-1):
# xenomips += ' -s '+str(i)+':0:gen_eth:eth'+str(i+1)

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'