rev |
line source |
igor@34
|
1 ####
|
igor@34
|
2 #
|
igor@34
|
3 # External variables:
|
igor@34
|
4 # * network
|
igor@34
|
5 # * domain
|
igor@34
|
6
|
igor@34
|
7
|
igor@35
|
8 try:
|
igor@35
|
9 domain
|
igor@35
|
10 except NameError:
|
igor@35
|
11 import sys
|
igor@35
|
12 network=sys.modules['__main__'].network
|
igor@35
|
13 domain=sys.modules['__main__'].domain
|
igor@34
|
14
|
nata@36
|
15 import os
|
nata@36
|
16 sys.path.append(os.environ['HOME']+"/xentaur")
|
nata@36
|
17 os.environ['xendomain']=domain
|
nata@36
|
18
|
igor@47
|
19
|
igor@47
|
20 ############################
|
igor@47
|
21 # default values:
|
igor@47
|
22 platform='7200'
|
igor@47
|
23 npe_type='npe-400'
|
igor@47
|
24 bridge_bridge_table = {
|
igor@47
|
25 }
|
igor@47
|
26
|
igor@47
|
27 hidden_bridges = []
|
igor@47
|
28 broken_links = []
|
igor@47
|
29 temporary_links = []
|
igor@47
|
30
|
igor@47
|
31 real_bridges=[]
|
igor@47
|
32 real_nodes=[]
|
igor@47
|
33 ############################
|
igor@47
|
34
|
igor@47
|
35 # overriden by network config
|
igor@35
|
36 #try:
|
igor@35
|
37 exec 'from %s import *' % (network)
|
igor@35
|
38 #except:
|
igor@35
|
39 # print "Can't find or interpret module %s with topology description" %(network)
|
igor@35
|
40 # sys.exit(1)
|
igor@34
|
41
|
igor@34
|
42
|
igor@35
|
43 N = str(domains.index(domain))
|
igor@35
|
44 name=domain
|
igor@34
|
45
|
igor@34
|
46 pae=1
|
igor@34
|
47 if pae:
|
igor@40
|
48 kernel = "/boot/vmlinuz-2.6.18-4-xen-686"
|
igor@40
|
49 ramdisk = "/boot/initrd.img-2.6.18-4-xen-686"
|
igor@34
|
50 else:
|
igor@34
|
51 kernel = "/boot/vmlinuz-2.6.18-without-PAE-4-xen-686"
|
igor@34
|
52 ramdisk = "/boot/initrd.img-2.6.18-without-PAE-4-xen-686-domU"
|
igor@34
|
53
|
igor@34
|
54 #builder='linux'
|
igor@34
|
55 cpu_cap = 10
|
igor@34
|
56
|
igor@34
|
57
|
igor@34
|
58 vbridges = vbridges_table[name]
|
igor@34
|
59
|
igor@34
|
60 vif=[]
|
igor@34
|
61 x=1
|
igor@34
|
62 for i in vbridges:
|
igor@34
|
63 vif.append('bridge='+i+',mac=00:16:3e:01:'+hex(int(N))[2:]+':'+hex(int('c0',16)+x)[2:])
|
igor@34
|
64 x+=1
|
igor@34
|
65
|
igor@34
|
66 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' ]
|
igor@34
|
67 root = "/dev/hda1 ro"
|
igor@34
|
68
|
igor@42
|
69 platform_option=""
|
igor@42
|
70 if platform != '7200':
|
igor@42
|
71 platform_option=' -P '+platform
|
igor@42
|
72
|
igor@42
|
73 npe_option=""
|
igor@42
|
74 if platform == '7200':
|
igor@42
|
75 npe_option=" -t "+npe_type
|
igor@42
|
76
|
igor@45
|
77 mac_option=' -m 00:16:3e:01:'+hex(int(N))[2:]+':01'
|
igor@45
|
78 if platform != '7200':
|
igor@45
|
79 mac_option =''
|
igor@34
|
80
|
igor@45
|
81 xenomips='/xenomips/ios/'+ios_name+platform_option+npe_option+mac_option
|
igor@45
|
82
|
igor@45
|
83 default_network_module={
|
igor@44
|
84 '7200' : 'PA-FE-TX',
|
igor@44
|
85 '3600' : 'NM-1FE-TX',
|
igor@44
|
86 '3725' : 'NM-1FE-TX',
|
igor@44
|
87 '3745' : 'NM-1FE-TX',
|
igor@44
|
88 '2691' : 'NM-1FE-TX',
|
igor@44
|
89 }
|
igor@44
|
90 network_module=default_network_module[platform]
|
igor@44
|
91
|
igor@45
|
92 for i in range(len(vbridges)):
|
igor@45
|
93 if platform!= '7200' or i!=0:
|
igor@45
|
94 xenomips += ' -p '+str(i)+':'+network_module
|
igor@34
|
95
|
igor@34
|
96 for i in range(len(vbridges)):
|
igor@34
|
97 xenomips += ' -s '+str(i)+':0:gen_eth:eth'+str(i)
|
igor@34
|
98
|
igor@34
|
99 if domain_types[int(N)] == 'quagga':
|
igor@34
|
100 extra = "quagga"
|
igor@34
|
101 else:
|
igor@34
|
102 extra = "xenomips=\""+xenomips+"\""
|
igor@34
|
103
|
igor@34
|
104 on_poweroff = 'destroy'
|
igor@34
|
105 on_reboot = 'restart'
|
igor@34
|
106 on_crash = 'restart'
|
igor@34
|
107
|