예제 #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]