xentaur

changeset 63:07c6777758dc

* path to shapes
* dynamips icon
author igor
date Fri Feb 29 07:22:46 2008 +0200 (2008-02-29)
parents e838c1223b89
children baf0c3300c19
files shapes/all/dynamips.png xendomain.py xentaur.py
line diff
     1.1 Binary file shapes/all/dynamips.png has changed
     2.1 --- a/xendomain.py	Thu Feb 21 21:41:20 2008 +0200
     2.2 +++ b/xendomain.py	Fri Feb 29 07:22:46 2008 +0200
     2.3 @@ -14,6 +14,7 @@
     2.4  import os
     2.5  
     2.6  sys.path.append(os.environ['HOME']+"/xentaur")
     2.7 +sys.path.append('.')
     2.8  os.environ['xendomain']=domain
     2.9  
    2.10          
    2.11 @@ -145,7 +146,7 @@
    2.12  if domain_types[N] == 'quagga':
    2.13      memory = 64
    2.14  elif domain_types[N] == 'linux':
    2.15 -    memory = 550
    2.16 +    memory = 128
    2.17  else:
    2.18      memory = 300
    2.19  
     3.1 --- a/xentaur.py	Thu Feb 21 21:41:20 2008 +0200
     3.2 +++ b/xentaur.py	Fri Feb 29 07:22:46 2008 +0200
     3.3 @@ -7,14 +7,15 @@
     3.4  
     3.5  sys.path.append('/etc/xen')
     3.6  sys.path.append(xentaur_path)
     3.7 +sys.path.append('.')
     3.8  
     3.9  #network='snrs_ipsec_rsa_1'
    3.10  node_object={}
    3.11  link_object={}
    3.12  bridge_object={}
    3.13  
    3.14 -network='ids2007dec'
    3.15 -domain='fbsd1'
    3.16 +network='openvpnbridge'
    3.17 +domain='debian1'
    3.18  
    3.19  #network='snrs'
    3.20  #domain='dyn1'
    3.21 @@ -26,6 +27,7 @@
    3.22  
    3.23  
    3.24  screenrc=os.environ['HOME']+"/.screenrc_xentaur"
    3.25 +path_shapes='/xen/xentaur/shapes'
    3.26  
    3.27  def run(program, *args):
    3.28      pid = os.fork()
    3.29 @@ -140,7 +142,7 @@
    3.30              int_label=""
    3.31              if this_bridge.find(':') != -1:
    3.32                  res = this_bridge.split(':')
    3.33 -                this_bridge= res[0]
    3.34 +                this_bridge= res[2]
    3.35                  bridges_raw[j] = this_bridge
    3.36                  int_label  = res[1]
    3.37              if not [ node, bridges_raw.index(this_bridge), this_bridge ] in temporary_links:
    3.38 @@ -203,11 +205,9 @@
    3.39      edge [len=1.25];
    3.40      splines=true;
    3.41  // nodes
    3.42 -//    node [shape=plaintext,color=white,shapefile="shapes/cisco.bmp/router.png"];
    3.43      %s
    3.44  
    3.45  // bridges
    3.46 -//    node [shape=none,shapefile="shapes/all/switch.png"];
    3.47      %s
    3.48  
    3.49  // physical
    3.50 @@ -339,15 +339,15 @@
    3.51  
    3.52      def graphviz_string(self):
    3.53          if self.is_hidden():
    3.54 -            return ""
    3.55 +            return "//"
    3.56          elif self.is_cross():
    3.57              return "%s [shape=circle,height=0.03,color=black,fillcolor=black,style=filled,label=\"\"]" % (self.name)
    3.58          elif self.is_real():
    3.59 -            return "%s [color=white,shape=none,shapefile=\"shapes/all/real_switch.png\"]" % (self.name)
    3.60 +            return "%s [color=white,shape=none,shapefile=\"%s/all/real_switch.png\"]" % (self.name, path_shapes)
    3.61          elif self.is_turned_down():
    3.62 -            return "%s [color=white,shape=none,shapefile=\"shapes/all/switch_turned_down.png\"]" % (self.name)
    3.63 +            return "%s [color=white,shape=none,shapefile=\"%s/all/switch_turned_down.png\"]" % (self.name, path_shapes)
    3.64          else:
    3.65 -            return "%s [color=white,shape=none,shapefile=\"shapes/all/switch.png\"]" % (self.name)
    3.66 +            return "%s [color=white,shape=none,shapefile=\"%s/all/switch.png\"]" % (self.name, path_shapes)
    3.67  
    3.68  
    3.69  class Node:
    3.70 @@ -363,7 +363,7 @@
    3.71      def get_domain_id(self):
    3.72          return get_domain_id(self.name)
    3.73      def graphviz_string(self):
    3.74 -        return self.name+" [color=white,shape=plaintext,label=\"  "+self.name+"\",shapefile=\"shapes/all/"+\
    3.75 +        return self.name+" [color=white,shape=plaintext,label=\"  "+self.name+"\",shapefile=\""+path_shapes+"/all/"+\
    3.76          domain_types[domains.index(self.name)]+".png\",fontcolor=black,fontsize=16,target=\"http://google.com\"]"
    3.77      def console_string(self):
    3.78          if self.type in [ 'quagga', 'xenomips', 'freebsd', 'linux' ]:
    3.79 @@ -386,7 +386,12 @@
    3.80      def is_broken(self):
    3.81          return ([self.node,self.interface,self.bridge] in broken_links)
    3.82  
    3.83 +    def is_hidden(self):
    3.84 +        return self.bridge in hidden_bridges
    3.85 +
    3.86      def graphviz_string(self):
    3.87 +        if self.is_hidden():
    3.88 +            return "//"
    3.89          if self.is_temporary():
    3.90              return self.node+" -- "+self.bridge+" [taillabel=\"fa"+str(self.interface)+"/0\",color=blue,len=10,w=5,weight=5]"
    3.91          if self.is_broken():
    3.92 @@ -549,6 +554,10 @@
    3.93  exit
    3.94  """
    3.95  
    3.96 +    linux_set_ip_on_int="""
    3.97 +ifconfig eth%s %s netmask 255.255.255.0
    3.98 +"""
    3.99 +
   3.100      for dom in doms:
   3.101          i=domains.index(dom)+1
   3.102          if domain_types[domains.index(dom)] == 'quagga':
   3.103 @@ -559,6 +568,13 @@
   3.104                  write_to(i,command % (j, "192.168.%s.%s"%(bridges.index(br)+1,i)))
   3.105                  j+=1
   3.106              write_to(i,"\nend\n")
   3.107 +        elif domain_types[domains.index(dom)] == 'linux':
   3.108 +            command = linux_set_ip_on_int
   3.109 +            j=0
   3.110 +            for br in  vbridges_table[dom]:
   3.111 +                #write_to(i, command % (j, "192.168.%s.%s"%(bridges.index(br)+1,i)) )
   3.112 +                print i, command % (j, "192.168.%s.%s"%(bridges.index(br)+1,i)) 
   3.113 +                j+=1
   3.114          else:
   3.115              command = cisco_set_ip_on_int
   3.116              write_to(i,"\nena\nconf t\n")