xentaur

diff xendomain.py @ 35:244f1602496a

config splitted to several modules
author igor
date Tue Sep 25 22:16:24 2007 +0300 (2007-09-25)
parents dd8c79bc715c
children 7bf7abe92123
line diff
     1.1 --- a/xendomain.py	Tue Sep 25 20:12:24 2007 +0300
     1.2 +++ b/xendomain.py	Tue Sep 25 22:16:24 2007 +0300
     1.3 @@ -1,9 +1,3 @@
     1.4 -try:
     1.5 -    from xenomips_vars import N
     1.6 -except:
     1.7 -    print "can't find xenomips_vars module"
     1.8 -
     1.9 -
    1.10  ####
    1.11  #
    1.12  # External variables:
    1.13 @@ -11,67 +5,24 @@
    1.14  # * domain
    1.15  
    1.16  
    1.17 -############################################################################################
    1.18 -# Topology description
    1.19 +try: 
    1.20 +    domain
    1.21 +except NameError:
    1.22 +    import sys
    1.23 +    network=sys.modules['__main__'].network
    1.24 +    domain=sys.modules['__main__'].domain
    1.25  
    1.26 -network='change-default-route'
    1.27 +#sys.path.append('/home/igor/xentaur')
    1.28 +#try:
    1.29  
    1.30 -domains =       [ 'dyn1',     'dyn2',     'dyn3',     'qua4',   'qua5',   'qua6',   'qua7',   'qua8',   'qua9',   ]
    1.31 -domain_types =  [ 'xenomips', 'xenomips', 'xenomips', 'quagga', 'quagga', 'quagga', 'quagga', 'quagga', 'quagga', ]
    1.32 -bridges =       [
    1.33 -                  'vlan100',
    1.34 -                  'vlan101',
    1.35 -                  'vlan102',
    1.36 -                  'vlan103',
    1.37 -                  'vlan104',
    1.38 -                  'vlan105',
    1.39 -                  'vlan106',
    1.40 -                  'vlan107',
    1.41 -                  'vlan108',
    1.42 -                  'vlan109',
    1.43 -                  'vlan110',
    1.44 -                  'vlan111',
    1.45 -                ]
    1.46 +exec 'from %s import *' % (network)
    1.47 +#except:
    1.48 +#    print "Can't find or interpret module %s with topology description" %(network)
    1.49 +#    sys.exit(1)
    1.50  
    1.51 -vbridges_table = {
    1.52 -                  'dyn1'    : [ 'vlan101', 'vlan102' ],
    1.53 -                  'dyn2'    : [ 'vlan101', 'vlan103' ],
    1.54 -                  'dyn3'    : [ 'vlan102', 'vlan103', 'vlan104' ],
    1.55  
    1.56 -                  'qua4'    : [ 'vlan105', 'vlan106', 'vlan111' ],
    1.57 -                  'qua5'    : [ 'vlan110', 'vlan111' ],
    1.58 -                  'qua6'    : [ 'vlan109',  'vlan110' ],
    1.59 -                  'qua7'    : [ 'vlan108',  'vlan109'  ],
    1.60 -                  'qua8'    : [ 'vlan107',  'vlan108' ],
    1.61 -                  'qua9'    : [ 'vlan106',  'vlan107' ],
    1.62 -                 }
    1.63 -
    1.64 -hidden_bridges  = []
    1.65 -broken_links    = []
    1.66 -temporary_links = []
    1.67 -
    1.68 -xenomips_dir='/xen/images/'
    1.69 -ios_name='C7200-JK.BIN'
    1.70 -npe_type="npe-200"
    1.71 -
    1.72 -name = domain
    1.73 -
    1.74 -# property should be specified only to override default values
    1.75 -properties       = {
    1.76 -                    'dyn1': {
    1.77 -                                npe_type: "npe-400",
    1.78 -                            }
    1.79 -                   }
    1.80 -
    1.81 -#this instance configuration
    1.82 -if domain_types[domain] == 'quagga':
    1.83 -    memory = 64
    1.84 -else:
    1.85 -    memory = 400
    1.86 -
    1.87 -############################################################################################
    1.88 -
    1.89 -N = domains.index(domain)
    1.90 +N = str(domains.index(domain))
    1.91 +name=domain
    1.92  
    1.93  pae=1
    1.94  if pae: