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@56
|
57 for br in bridges:
|
igor@56
|
58 if not br in vbridges_table.keys():
|
igor@56
|
59 vbridges_table[br]=[]
|
igor@56
|
60
|
igor@56
|
61 for domain in domains:
|
igor@56
|
62 if not domain in connection_table.keys():
|
igor@56
|
63 connection_table[domain]='true'
|
igor@34
|
64
|
igor@34
|
65 vbridges = vbridges_table[name]
|
igor@34
|
66
|
igor@34
|
67 vif=[]
|
igor@34
|
68 x=1
|
igor@34
|
69 for i in vbridges:
|
igor@34
|
70 vif.append('bridge='+i+',mac=00:16:3e:01:'+hex(int(N))[2:]+':'+hex(int('c0',16)+x)[2:])
|
igor@34
|
71 x+=1
|
igor@34
|
72
|
igor@34
|
73 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
|
74 root = "/dev/hda1 ro"
|
igor@34
|
75
|
igor@42
|
76 platform_option=""
|
igor@42
|
77 if platform != '7200':
|
igor@42
|
78 platform_option=' -P '+platform
|
igor@42
|
79
|
igor@42
|
80 npe_option=""
|
igor@42
|
81 if platform == '7200':
|
igor@42
|
82 npe_option=" -t "+npe_type
|
igor@42
|
83
|
igor@45
|
84 mac_option=' -m 00:16:3e:01:'+hex(int(N))[2:]+':01'
|
igor@45
|
85 if platform != '7200':
|
igor@45
|
86 mac_option =''
|
igor@34
|
87
|
igor@45
|
88 xenomips='/xenomips/ios/'+ios_name+platform_option+npe_option+mac_option
|
igor@45
|
89
|
igor@45
|
90 default_network_module={
|
igor@44
|
91 '7200' : 'PA-FE-TX',
|
igor@44
|
92 '3600' : 'NM-1FE-TX',
|
igor@44
|
93 '3725' : 'NM-1FE-TX',
|
igor@44
|
94 '3745' : 'NM-1FE-TX',
|
igor@44
|
95 '2691' : 'NM-1FE-TX',
|
igor@44
|
96 }
|
igor@44
|
97 network_module=default_network_module[platform]
|
igor@44
|
98
|
igor@48
|
99 if platform== '7200':
|
igor@48
|
100 for i in range(len(vbridges)-1):
|
igor@48
|
101 xenomips += ' -p '+str(i+1)+':'+network_module
|
igor@48
|
102 else:
|
igor@48
|
103 for i in range(len(vbridges)-1):
|
igor@48
|
104 xenomips += ' -p '+str(i+1)+':'+network_module
|
igor@48
|
105
|
igor@34
|
106
|
igor@34
|
107 for i in range(len(vbridges)):
|
igor@34
|
108 xenomips += ' -s '+str(i)+':0:gen_eth:eth'+str(i)
|
igor@34
|
109
|
igor@34
|
110 if domain_types[int(N)] == 'quagga':
|
igor@34
|
111 extra = "quagga"
|
igor@34
|
112 else:
|
igor@34
|
113 extra = "xenomips=\""+xenomips+"\""
|
igor@34
|
114
|
igor@34
|
115 on_poweroff = 'destroy'
|
igor@34
|
116 on_reboot = 'restart'
|
igor@34
|
117 on_crash = 'restart'
|
igor@34
|
118
|