示例#1
0
def get_mmt_port():
    intf_str = cmd_exec.execute_cmd('%s -D' % MMT_PATH)
    mmt_intf_list = re.findall(r'\((.*)\)', intf_str)

    ip_info = cmd_exec.execute_cmd('ipconfig /all')
    prog = re.compile('.*Description[^:]+: ([^\r\n]+).*?IP(v4)? Address.*?(192.168.129.190)',re.IGNORECASE|re.DOTALL)
    intf_desc = prog.match(ip_info).groups()[0]

    for i, desc in enumerate(mmt_intf_list):
        if intf_desc in desc:
            return i+1
    raise Exception("No interface is related to 192.168.129.190.")
示例#2
0
def create_env_file(bts_ip):
    with open('d:/data.pkl', 'wb') as ot:
        pickle.dump(bts_ip, ot)
    src_file = os.path.join(CFG_PATH, 'bts_sample_env.txt')
    dst_file = os.path.join(CFG_PATH, 'bts_%s_env.txt' % bts_ip)
    print cmd_exec.execute_cmd('copy %s %s' % (src_file, dst_file))