xentaur

changeset 60:e7b9761c03e8

info() + logo()
author igor
date Sun Nov 11 20:57:50 2007 +0200 (2007-11-11)
parents 9d54d94a7dff
children 6471afbee150
files xendomain.py xentaur.py
line diff
     1.1 --- a/xendomain.py	Sun Nov 11 19:46:27 2007 +0200
     1.2 +++ b/xendomain.py	Sun Nov 11 20:57:50 2007 +0200
     1.3 @@ -35,6 +35,7 @@
     1.4  hidden_bridges = []
     1.5  broken_links = []
     1.6  temporary_links = []
     1.7 +cross_bridges=[]
     1.8  
     1.9  real_bridges=[]
    1.10  real_nodes=[]
     2.1 --- a/xentaur.py	Sun Nov 11 19:46:27 2007 +0200
     2.2 +++ b/xentaur.py	Sun Nov 11 20:57:50 2007 +0200
     2.3 @@ -1,5 +1,5 @@
     2.4  #!/usr/bin/python
     2.5 -
     2.6 +# vim: set fileencoding=utf-8 :
     2.7  
     2.8  import sys,os,time
     2.9  
    2.10 @@ -158,11 +158,11 @@
    2.11  ####################################################
    2.12  
    2.13  def screen():
    2.14 -    wait_seconds=5
    2.15 +    wait_seconds=1
    2.16      screens=[]
    2.17      for domain in domains:
    2.18          screens.append("screen -t %s %s sh -c 'while true; do %s ; echo Retrying in %s secods...; sleep %s ; clear; done'" %
    2.19 -                                 (domain,domains.index(domain),node_object[domain].console_string(),wait_seconds,wait_seconds))
    2.20 +                                 (domain,domains.index(domain)+1,node_object[domain].console_string(),wait_seconds,wait_seconds))
    2.21      screenlist="\n".join(screens)
    2.22  
    2.23      hardstatus='hardstatus string "%{rk}Xentaur%{bk}@%H %{gk}%c %{yk}%d.%m %{wk}%?%-Lw%?%{bw}%n*%f%t%?(%u)%?%{wk}%?%+Lw%?"'
    2.24 @@ -173,9 +173,10 @@
    2.25  hardstatus alwayslastline
    2.26  %s
    2.27  
    2.28 -screen -t console 0 bash
    2.29 +screen -t console 0 sh -c 'while true; do cd %s; ./xentaur.py shell ; echo Retrying in %s secods...; sleep %s ; clear; done'
    2.30 +#screen -t xentaur - sh -c 'while true; do bash ; echo Retrying in %s secods...; sleep %s ; clear; done'
    2.31  %s
    2.32 -""" % (hardstatus,screenlist))
    2.33 +""" % (hardstatus,xentaur_path,wait_seconds,wait_seconds,wait_seconds,wait_seconds,screenlist))
    2.34      f.close()
    2.35      print "# GNU Screen config file is written to: %s" % screenrc
    2.36  
    2.37 @@ -234,6 +235,38 @@
    2.38      ipshell = IPShellEmbed()
    2.39      ipshell()
    2.40  
    2.41 +def version():
    2.42 +    print "Xentaur 0.1-PRE"
    2.43 +    print "(Godzilla-mutant)  _"
    2.44 +    print "                 / * \\"
    2.45 +    print "                /   .-"
    2.46 +    print "               /   |"
    2.47 +    print "              | \\ \\\\ \\"
    2.48 +    print "     _ -------|  \\ \\\\ \\"
    2.49 +    print " / /              \\_\\ -"
    2.50 +    print "/ |\\           |   |"
    2.51 +    print "| |  \\ .-----. | \\ |"
    2.52 +    print "  |  /        \\ \\ \\ \\"
    2.53 +    print "  \\/|.\\        \\ \\ \\ \\"
    2.54 +    print "   \\| - .       \\_\\ \\_\\"
    2.55 +    print "-----------------------------------------------"
    2.56 +
    2.57 +
    2.58 +def info():
    2.59 +    version()
    2.60 +
    2.61 +    print "Network name: ", network
    2.62 +    print "-----------------------------------------------"
    2.63 +    print
    2.64 +    print "Nodes: ", len(domains)
    2.65 +    print "  * virtual nodes: ", len(domains)-len(real_nodes)
    2.66 +    print "  * real nodes:", len(real_nodes)
    2.67 +    print 
    2.68 +    print "Bridges:", len(bridges)
    2.69 +    print "  * virtual bridges:", len(bridges)-len(real_bridges)-len(cross_bridges)
    2.70 +    print "  * real switches:", len(real_bridges)
    2.71 +    print "  * direct links:", len(cross_bridges)
    2.72 +
    2.73  def show_usage():
    2.74      print """Usage:
    2.75      xentaur <command> [<argument>]
    2.76 @@ -703,6 +736,8 @@
    2.77          graph()
    2.78      elif sys.argv[1] == 'shell':
    2.79          shell()
    2.80 +    elif sys.argv[1] == 'info':
    2.81 +        info()
    2.82      else:
    2.83          show_usage()
    2.84          sys.exit(1)