#!/usr/bin/python
#coding=utf-8


'''
使用 次模块 必须 先 关闭 防火墙
# Centos 7 命令
os.system("systemctl stop firewalld.service")    # 停止防火墙
os.system("systemctl disable firewalld.service") # 禁用防火墙
# Centos 6 命令
os.system("service iptables stop")    # 停止防火墙
os.system("chkconfig iptables off") # 禁用防火墙
'''
from logger.logrecord import LogRecord

# LogRecord.instance().logger.debug("debug")
# LogRecord.instance().logger.info("info")
# LogRecord.instance().logger.warn("warn")
# LogRecord.instance().logger.error("erro")

from usbip import UsbIp_Mgr



# usbIp管理类
class UsbIpManage(UsbIp_Mgr):

    def __init__(self,usbIpDir = None):
        super(UsbIpManage, self).__init__()


#----------------------
#   测试 用例
#----------------------

def test_main():

    ip_list = ["192.168.0.1","192.168.102.113"]

    usbipSer = UsbIpManage()
    print "启动usbip server"
    UsbIpManage.usbIpServer_run()
    # usbipSer.usbIpServer_run()

    # UsbIpManage.usb_connect2("192.168.102.113")

    UsbIpManage.usb_connect_Ext(ip_list)

    raw_input("stop usbip server , press Enter:")
    # usbipSer.usbIpServer_stop()
    UsbIpManage.usbIpServer_stop()


if __name__ == "__main__":
    from os import getenv, environ
    if getenv('LOG_STDOUT') == None:
        environ["LOG_STDOUT"] = "stdout"  #

    test_main()

