# HG changeset patch
# User igor
# Date 1194801772 -7200
# Node ID 58381d1fe31b55c04900baf399df5cd248b9cfce
# Parent  548bd71dc5fb772c6f24ac524199a57c88b1c479
domains_brief support

diff -r 548bd71dc5fb -r 58381d1fe31b xendomain.py
--- a/xendomain.py	Sat Nov 10 20:00:12 2007 +0200
+++ b/xendomain.py	Sun Nov 11 19:22:52 2007 +0200
@@ -12,33 +12,61 @@
     network=sys.modules['__main__'].network
     domain=sys.modules['__main__'].domain
 
-import os
+import os,re
 sys.path.append(os.environ['HOME']+"/xentaur")
 os.environ['xendomain']=domain
 
+        
+        
 
 ############################
 # default values:
-platform='7200'
+platform=''
 npe_type='npe-400'
 bridge_bridge_table = {
 }
 
+domains_brief=[]
+domains=[]
+domain_types=[]
+domain_notes=[]
+domain_subtypes=[]
+
 hidden_bridges = []
 broken_links = []
 temporary_links = []
 
 real_bridges=[]
 real_nodes=[]
+# overriden by network config
 ############################
 
-# overriden by network config
+def process_domains_brief():
+    global domains, domain_types, real_nodes, domain_notes
+    node_brief_re=re.compile('([a-zA-Z_0-9-]*)(?::([a-zA-Z_0-9-]*))?(?::([a-zA-Z_0-9-]*))?(\*?)(?:#(.*))?')
+    if len(domains)==0:
+        domains=map(lambda x:node_brief_re.search(x).groups()[0] or '', domains_brief)
+    if len(domain_types)==0:
+        domain_types=map(lambda x:node_brief_re.search(x).groups()[1] or '', domains_brief)
+    if len(domain_subtypes)==0:
+        domain_subtypes=map(lambda x:node_brief_re.search(x).groups()[2] or '', domains_brief)
+    if len(real_nodes)==0:
+        i=0
+        for brief in domains_brief:
+            if node_brief_re.search(brief).groups()[3] == '*':
+                real_nodes.append(domains[i])
+            i+=1
+    if len(domain_notes)==0:
+        domain_notes=map(lambda x:node_brief_re.search(x).groups()[4] or '', domains_brief)
+
+############################
 #try:
 exec 'from %s import *' % (network)
 #except:
 #    print "Can't find or interpret module %s with topology description" %(network)
 #    sys.exit(1)
 
+process_domains_brief()
 
 N = str(domains.index(domain))
 name=domain
@@ -73,6 +101,11 @@
 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"
 
+if domain_subtypes[N] != '' and platform == '':
+    platform=domain_subtypes[N]
+
+if platform = '': 
+    platform='7200'
 platform_option=""
 if platform != '7200':
     platform_option=' -P '+platform