コード例 #1
0
ファイル: cli.py プロジェクト: lafenicecc/easyOVS
 def __init__(self, stdin=sys.stdin, foreground=True):
     self.bridge = None  # default bridge
     self.ipt = IPtables()
     if foreground:
         output('EasyOVS %s, type help for information\n' % VERSION)
         self.prompt = color_str(PROMPT_KW, 'g')
         self.stdin = stdin
         self.in_poller = poll()
         self.in_poller.register(stdin)
         Cmd.__init__(self)
         output("***\n Welcome to EasyOVS,"
                "type help to see available commands.\n***\n")
         info('*** Starting CLI:\n')
         debug("==Loading credentials==\n")
         debug("auth_url = %s\n" % os.getenv('OS_AUTH_URL')
               or cfg.CONF.OS.auth_url)
         debug("username = %s\n" % os.getenv('OS_USERNAME')
               or cfg.CONF.OS.username)
         passwd = os.getenv('OS_PASSWORD') or cfg.CONF.OS.password
         passwd = passwd[:len(passwd) / 4] + "****" + passwd[-len(passwd) /
                                                             4:]
         debug("password = %s\n" % passwd)
         debug("tenant_name = %s\n" % os.getenv('OS_TENANT_NAME')
               or cfg.CONF.OS.tenant_name)
         while True:
             try:
                 #if self.isatty():
                 #quietRun( 'stty sane' )
                 self.cmdloop()
                 break
             except KeyboardInterrupt:
                 info('\nInterrupt\n')
コード例 #2
0
ファイル: cli.py プロジェクト: hmings888/easyOVS
 def __init__(self, stdin=sys.stdin, foreground=True):
     self.bridge = None  # default bridge
     self.ipt = None
     self.nss = None
     self.dvr = None
     if foreground:
         self.prompt = color_str(PROMPT_KW, 'g')
         self.stdin = stdin
         self.in_poller = poll()
         self.in_poller.register(stdin)
         Cmd.__init__(self)
         output("***\n Welcome to EasyOVS %s, "
                "type help to see available cmds.\n***\n" % VERSION)
         info('*** Starting CLI:\n')
         debug("==Loading credentials==\n")
         debug("auth_url = %s\n" % os.getenv('OS_AUTH_URL') or
               cfg.CONF.OS.auth_url)
         debug("username = %s\n" % os.getenv('OS_USERNAME') or
               cfg.CONF.OS.username)
         passwd = os.getenv('OS_PASSWORD') or cfg.CONF.OS.password
         passwd = passwd[:len(passwd)/4] + "****" + passwd[-len(passwd)/4:]
         debug("password = %s\n" % passwd)
         debug("tenant_name = %s\n" % os.getenv('OS_TENANT_NAME') or
               cfg.CONF.OS.tenant_name)
         while True:
             try:
                 #if self.isatty():
                 #quietRun( 'stty sane' )
                 self.cmdloop()
                 break
             except KeyboardInterrupt:
                 info('\nInterrupt\n')
コード例 #3
0
def cleanup():
    """Clean up junk which might be left over from old runs;
    """
    sh('pkill -9 -f "neutron port-list"')

    info("*** Removing junk from /tmp\n")
    sh('rm -f /tmp/tmp_switch_* /tmp/vlogs* /tmp/*.out /tmp/*.log')

    info("*** Cleanup complete.\n")
コード例 #4
0
ファイル: cli.py プロジェクト: longsube/easyOVS
 def __init__(self, bridge=None, stdin=sys.stdin):
     self.prompt = color_str('g', PROMPT_KW)
     self.bridge = bridge
     self.stdin = stdin
     self.in_poller = poll()
     self.in_poller.register(stdin)
     Cmd.__init__(self)
     output("***\n Welcome to EasyOVS, type help to see available commands.\n***\n")
     info('*** Starting CLI:\n')
     while True:
         try:
             #if self.isatty():
             #quietRun( 'stty sane' )
             self.cmdloop()
             break
         except KeyboardInterrupt:
             info('\nInterrupt\n')
コード例 #5
0
 def __init__(self, bridge=None, stdin=sys.stdin):
     self.prompt = color_str('g', PROMPT_KW)
     self.bridge = bridge
     self.stdin = stdin
     self.in_poller = poll()
     self.in_poller.register(stdin)
     Cmd.__init__(self)
     output(
         "***\n Welcome to EasyOVS, type help to see available commands.\n***\n"
     )
     info('*** Starting CLI:\n')
     while True:
         try:
             #if self.isatty():
             #quietRun( 'stty sane' )
             self.cmdloop()
             break
         except KeyboardInterrupt:
             info('\nInterrupt\n')
コード例 #6
0
ファイル: cli.py プロジェクト: cyclefusion/easyOVS
 def __init__(self, bridge=None, stdin=sys.stdin):
     self.prompt = color_str("g", PROMPT_KW)
     self.bridge = bridge
     self.stdin = stdin
     self.in_poller = poll()
     self.in_poller.register(stdin)
     Cmd.__init__(self)
     output("***\n Welcome to EasyOVS, type help to see available commands.\n***\n")
     info("*** Starting CLI:\n")
     debug("==cfg.ADMIN==\n")
     debug("auth_url = %s\n" % cfg.CONF.OS.auth_url)
     debug("username = %s\n" % cfg.CONF.OS.username)
     debug("password = %s\n" % cfg.CONF.OS.password)
     debug("tenant_name = %s\n" % cfg.CONF.OS.tenant_name)
     while True:
         try:
             # if self.isatty():
             # quietRun( 'stty sane' )
             self.cmdloop()
             break
         except KeyboardInterrupt:
             info("\nInterrupt\n")
コード例 #7
0
 def __init__(self, bridge=None, stdin=sys.stdin):
     self.prompt = color_str('g', PROMPT_KW)
     self.bridge = bridge
     self.stdin = stdin
     self.in_poller = poll()
     self.in_poller.register(stdin)
     Cmd.__init__(self)
     output("***\n Welcome to EasyOVS, type help to see available commands.\n***\n")
     info('*** Starting CLI:\n')
     debug("==cfg.ADMIN==\n")
     debug("auth_url = %s\n" % cfg.CONF.OS.auth_url)
     debug("username = %s\n" % cfg.CONF.OS.username)
     debug("password = %s\n" % cfg.CONF.OS.password)
     debug("tenant_name = %s\n" % cfg.CONF.OS.tenant_name)
     while True:
         try:
             #if self.isatty():
             #quietRun( 'stty sane' )
             self.cmdloop()
             break
         except KeyboardInterrupt:
             info('\nInterrupt\n')
コード例 #8
0
ファイル: util.py プロジェクト: li525628/easyOVS
def sh(cmd):
    """
    Print a command and send it to the shell
    """
    info(cmd + '\n')
    return Popen(['/bin/sh', '-c', cmd], stdout=PIPE).communicate()[0]
コード例 #9
0
ファイル: util.py プロジェクト: cyclefusion/easyOVS
def sh(cmd):
    """
    Print a command and send it to the shell
    """
    info(cmd + '\n')
    return Popen(['/bin/sh', '-c', cmd], stdout=PIPE).communicate()[0]
コード例 #10
0
ファイル: util.py プロジェクト: hmings888/easyOVS
def sh(cmd):
    """
    Print a command and send it to the shell
    """
    info(cmd + "\n")
    return Popen(["/bin/sh", "-c", cmd], stdout=PIPE).communicate()[0]