Professional Documents
Culture Documents
grivtsov'
# -*- coding: utf-8 -*-
import os
import sys
import shutil
import xlrd
import datetime
from pytils import translit
from subprocess import Popen
from datetime import date
import time
from win32com import *
from xlwings import *
import telnetlib
from win32com.client import Dispatch
from formlayout import fedit
import socket
import hashlib
import subprocess
import re
from PyQt4 import QtCore, QtGui, uic
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import threading
import re
# ------Input Block---------
input_name = ['']
input_action = [0]
input_rus = [0]
input_ret = [0]
input_duw = [0]
input_tcu = [False]
input_pnr = [False]
input_action_lte = [0]
# ------Info Block---------
# ????????? ?????? ??? ????????,
# ? ??? ???????????? ???????? ?? ??
startname_arr = ['']
location_ru = ['']
duw_ip_arr = ['']
iub_ip_arr = ['']
tcu_ip_arr = ['']
scr1_arr = ['']
scr2_arr = ['']
scr3_arr = ['']
scr4_arr = ['']
scr5_arr = ['']
scr6_arr = ['']
rnc_arr = ['']
lac_arr = ['']
iub_id_arr = ['']
lte_oam_arr = ['']
lte_oam_gw_arr = ['']
lte_s1_arr = ['']
lte_s1_gw_arr = ['']
lte_vlan_oam_arr = ['']
lte_vlan_s1_arr = ['']
ura_arr = ['']
global values
if hostname_ch in truehostnames:
pass
else:
print("????????????? RBS Integrator ?? ?????? ?????????? ?????????!")
time.sleep(2)
print("?????? ????? ?????, ?????????? ?? ??????")
time.sleep(3)
quit()
startname = input_name[-1]
except NameError:
try:
input("\n\n ??????? Enter, ????? ?????? ?????? ??? Ctrl+C ??? ??????.")
except KeyboardInterrupt:
print("?????? ????? ?????, ?????????? ?? ??????")
time.sleep(3)
sys.exit()
inp()
else:
new_path = path
os.mkdir(new_path)
#
-----------------------------------------------------------------------------------
-----------------------------------
#
-----------------------------------------------------------------------------------
-----------------------------------
# -----------------------------------????????? ?????? ??
Excel----------------------------------------------------------
#
-----------------------------------------------------------------------------------
-----------------------------------
#
-----------------------------------------------------------------------------------
-----------------------------------
def extdata(): #
-----------------------------------Extract_RNC_RBS_ID------------------------------
------
global startname
global rbs_id
global rnc_id, rnc_id_true
global rnc_ip
global lac
global rac
global cid1, cid2, cid3
global longitude
global latitude
global altitude
global location
global location_rus
global rnc_label
global usrlbl
global ura
global scramblingcode1, scramblingcode2, scramblingcode3, scramblingcode4,
scramblingcode5, scramblingcode6
usrlbl = ["%s_%s" % (startname, x) for x in range(1, 7)] # generator Cell name
new
workbook = xlrd.open_workbook('./DB/New_data_T2_v4.xlsx')
worksheet = workbook.sheet_by_name('Table')
for row in range(worksheet.nrows):
try:
data = (worksheet.cell_value(row, 8))
except:
print("??? ????? ??")
if str("%s_1" % startname) == str(data):
for col in range(worksheet.ncols):
rnc_id = str(worksheet.cell_value(row, 4))
rbs_id = str(int(worksheet.cell_value(row, 3)))
longitude = str(round(worksheet.cell_value(row, 5)*3600000)) #
Coordinates for OSS
latitude = str(round(worksheet.cell_value(row, 6)*3600000)) #
Coordinates for OSS
try:
altitude = str(int(worksheet.cell_value(row, 13)))
except:
altitude = "0"
lac = str(int(worksheet.cell_value(row, 7)))
if str(startname) == str(data2):
try:
location = str(translit.translify(worksheet.cell_value(row, 17)))
location_rus = str((worksheet.cell_value(row, 17)))
except:
print("????? ????????, ????????? ?? ? ??????")
location = "Mordor"
pass
try:
ura = str(int(worksheet.cell_value(row, 18)))
except:
print("Ura ?? ??????")
ura = "NO URA"
pass
del workbook
def extip(): #
-----------------------------------Extract_IP--------------------------------------
-----
global startname
global duw_ip
global tcu_ip
global iub_ip
global row_true
global lte_oam, lte_oam_gw, lte_s1, lte_s1_gw, lte_vlan_oam, lte_vlan_s1
try:
workbook = xlrd.open_workbook('./DB/MOS_IP_PLAN_V5_.xlsx')
worksheet = workbook.sheet_by_name('IP ????')
for row in range(worksheet.nrows):
data = (worksheet.cell_value(row,0))
if str(startname) == str(data):
row_true = row+1
for col in range(worksheet.ncols):
duw_ip = (worksheet.cell_value(row, 7)) # IP startname
iub_ip = (worksheet.cell_value(row, 19))
tcu_ip = (worksheet.cell_value(row, 35))
lte_oam = (worksheet.cell_value(row, 12))
lte_oam_gw = (worksheet.cell_value(row, 13))
lte_s1 = (worksheet.cell_value(row, 24))
lte_s1_gw = (worksheet.cell_value(row, 25))
lte_vlan_oam = str(int(worksheet.cell_value(row, 10)))
lte_vlan_s1 = str(int(worksheet.cell_value(row, 22)))
del workbook
except (NameError, ValueError):
print("IP ?? ?????? ??? vlan ??????????")
pass
def ext_lte_data():
global PLCellIdGroup1, PLSubCellId1,PLCellIdGroup2,
PLSubCellId2,PLCellIdGroup3, PLSubCellId3
try:
workbook = xlrd.open_workbook('./DB/?????? ??? ???????? LTE2600
(PCI+RSI).xlsx')
worksheet = workbook.sheet_by_name('NewLTE')
for row in range(worksheet.nrows):
data = (worksheet.cell_value(row,2))
cid = (worksheet.cell_value(row,27))
if str(startname) == str(data) and str(cid) == '021':
for col in range(worksheet.ncols):
PLCellIdGroup1 = str(int(worksheet.cell_value(row, 31)))
PLSubCellId1 = str(int(worksheet.cell_value(row, 32)))
if str(startname) == str(data) and str(cid) == '022':
for col in range(worksheet.ncols):
PLCellIdGroup2 = str(int(worksheet.cell_value(row, 31)))
PLSubCellId2 = str(int(worksheet.cell_value(row, 32)))
if str(startname) == str(data) and str(cid) == '023':
for col in range(worksheet.ncols):
PLCellIdGroup3 = str(int(worksheet.cell_value(row, 31)))
PLSubCellId3 = str(int(worksheet.cell_value(row, 32)))
if str(startname) == str(data) and str(cid) == '024':
for col in range(worksheet.ncols):
PLCellIdGroup3 = str(int(worksheet.cell_value(row, 31)))
PLSubCellId3 = str(int(worksheet.cell_value(row, 32)))
del workbook
except (NameError, ValueError):
print("4G ?? ?? ???????, ????????? ??? LTE ?? ???????")
pass
#
-----------------------------------------------------------------------------------
-----------------------------------
#
-----------------------------------------------------------------------------------
-----------------------------------
#
-----------------------------------???????? ????????-------------------------------
-----------------------------------
#
-----------------------------------------------------------------------------------
-----------------------------------
#
-----------------------------------------------------------------------------------
-----------------------------------
lines = open(tmpl).readlines()
src = "%s"*len(lines) % tuple(lines)
for key, var in var_list.items():
src = str.replace(src, key, var)
return src
# ----------------------------------????????_???????_???
_????-----------------------------------------------------------
def NE_Site_create():
NE_Site = './template/NE_Site.txt'
body = replace_tmpl(NE_Site, {'$userLabel': startname,
'$altitude': altitude,
'$location': location,
'$longitude': longitude,
'$latitude': latitude
})
def NE_RBS_create():
NE_RBS = './template/NE_RBS_create.txt'
body = replace_tmpl(NE_RBS, {'$RNC': rnc_label,
'$ManagedElementId': startname,
'$associatedSite': startname,
'$ipAddress': duw_ip_arr[-1]
})
file = open("%s/02_NE_RBS_%s.xml" % (path, startname), "w")
file.write(body)
file.close()
def NE_TCU_create():
NE_TCU = './template/NE_TCU_create.txt'
body = replace_tmpl(NE_TCU, {'$ManagedElementId': startname,
'$associatedSite' : startname,
'$ipAddress': tcu_ip_arr[-1],
'$RNC': rnc_label
})
file = open("%s/03_NE_TCU_%s.xml"% (path, startname), "w")
file.write(body)
file.close()
def NE_ERBS_create():
NE_RBS = './template/NE_ERBS_create.txt'
body = replace_tmpl(NE_RBS, { '$ManagedElementId': startname,
'$associatedSite': startname,
'$ipAddress': lte_oam_arr[-1]
})
file = open("%s/04_NE_ERBS_%s.xml" % (path, startname), "w")
file.write(body)
file.close()
# ---------------------CreateEricssonSite_v2.xlsm--
Generator----------------------------
def CreateEricssonSite():
global rus
print(scr2_arr[-1])
folder = os.getcwd()
#excel = Dispatch("Excel.Application")
def CreateEricssonSite_LTE():
folder = os.getcwd()
#excel = Dispatch("Excel.Application")
pass
#
-----------------------------------------------------------------------------------
-----------------------------------
#
-----------------------------------------------------------------------------------
-----------------------------------
#
-----------------------------------------------------------------------------------
-----------------------------------
#
-----------------------------------------------------------------------------------
-----------------------------------
def ftp_ses():
#-------------------------FTP-to-OSS-session---------------------------------
p = subprocess.Popen(cmd, shell=False)
p.wait()
os.remove("commandsftp.txt")
global startname
tn = telnetlib.Telnet(HOST2)
tn.read_until(b"login: ")
tn.write(user.encode('ascii') + b"\n")
if password:
tn.read_until(b"Password: ")
tn.write(password.encode('ascii') + b"\n")
tn.read_until(("@%s>" % HOST2_name).encode('ascii'))
print(tn.read_eager().decode('ascii'))
tn.write(("/opt/ericsson/arne/bin/import.sh -f /home/%s/scripts/%s/01_OSS_Site_
%s.xml -import"
% (user, startname, startname)).encode('ascii') + b"\n")
print(tn.read_eager().decode('ascii'))
tn.read_until(("@%s>" % HOST2_name).encode('ascii'))
tn.write(("/opt/ericsson/arne/bin/import.sh -f /home/%s/scripts/%s/02_NE_RBS_
%s.xml -import"
% (user, startname, startname)).encode('ascii') + b"\n")
print(tn.read_eager().decode('ascii'))
tn.read_until(("@%s>" % HOST2_name).encode('ascii'))
if input_tcu[-1]:
tn.write(("/opt/ericsson/arne/bin/import.sh -f
/home/%s/scripts/%s/03_NE_TCU_%s.xml -import"
% (user, startname, startname)).encode('ascii') + b"\n")
tn.write(b"exit\n")
print(tn.read_all().decode('ascii'))
global startname
tn = telnetlib.Telnet(HOST_LTE)
tn.read_until(b"login: ")
tn.write(user.encode('ascii') + b"\n")
if password:
tn.read_until(b"Password: ")
tn.write(password.encode('ascii') + b"\n")
tn.write(("/opt/ericsson/arne/bin/import.sh -f /home/%s/scripts/%s/04_NE_ERBS_
%s.xml -import"
% (user, startname, startname)).encode('ascii') + b"\n")
tn.read_until(("@%s>" % HOST_LTE_NAME).encode('ascii'))
tn.write(b"exit\n")
print(tn.read_all().decode('ascii'))
def ipping():
import time
s = "%Y-%m-%d %H:%M:%S"
times = time.strftime(s, time.gmtime())
file.write("lt all\n")
file.write("confb+\n")
file.write("passwd ; rbs ; rbs\n")
file.write("rbs\n")
file.write("setclock %s\n" % times)
file.write("license iu activate\n")
file.write("l+ /scripts/%s/%s_RBS_log.txt\n" % (startname, startname))
file.write("truni /scripts/%s/Create_3G_RBS_W15_%s.mo\n" % (startname,
startname))
file.write("truni /scripts/%s/Create_3G_RBS_W15_Features_%s.mo\n" % (startname,
startname))
if retu == "ARETU":
file.write("set NodebFunction=1 featureStateStandardizedRet 1\n")
if retu == "CASCADE":
file.write("set NodebFunction=1 featureStateStandardizedRet 1\n")
file.write("set NodebFunction=1 featureStateRetCascading 1\n")
file.write("run /scripts/autoCreatedCV_pass_profile.mos\n")
file.write("confb-\n")
file.write("cvms RBS_FIN\n")
file.write("l- \n")
def RNC_side_conf():
file = open("%s/commandsRNC.mos" % path, "w")
file.write("lt all\n")
file.write("l+ /home/%s/scripts/%s/%s_RNC_log.txt\n" % (user, startname,
startname))
file.write("truni /home/%s/scripts/%s/Create_3G_RNC_W15_%s.mo\n" % (user,
startname, startname))
file.write("ldeb IubLink=Iub_%s\n" % rbs_id)
file.write("ldeb utrancell=%s\n" % startname)
file.write("l-\n")
def RbsOperations():
# global startname
#
# tn = telnetlib.Telnet(HOST)
#
# tn.read_until(b"login: ")
# tn.write(user.encode('ascii') + b"\n")
# if password:
# tn.read_until(b"Password: ")
# tn.write(password.encode('ascii') + b"\n")
# tn.write(("cd /home/%s/scripts/%s\r\n" % (user, startname)).encode('ascii'))
# tn.write(('amos %s "lt all; run commands.mos; q"\n' % duw_ip_arr[-
1]).encode('ascii'))
# #tn.write(b"exit\n")
# while True:
# line = tn.read_until(b"\n\r") # Check for new line
# print(line.decode('utf-8'))
# if (b"\nLog close:") in line: # If last read line is the prompt, end
loop
# break
#
# tn.close()
print(scripts_load_command)
os.chdir('cygwin')
cmd = ['Cygwin.bat']
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
stdin=subprocess.PIPE, stderr=subprocess.PIPE)
p_stdout = p.communicate(input=scripts_load_command)[0]
print(p_stdout.decode())
os.chdir('..')
def RncOperations():
global startname
tn = telnetlib.Telnet(HOST)
tn.read_until(b"login: ")
tn.write(user.encode('ascii') + b"\n")
if password:
tn.read_until(b"Password: ")
tn.write(password.encode('ascii') + b"\n")
tn.write(("cd /home/%s/scripts/%s\r\n" % (user, startname)).encode('ascii'))
tn.write(('amos %s "lt all; run commandsRNC.mos; q"\n' %
rnc_ip).encode('ascii'))
while True:
line = tn.read_until(b"\n\r") # Check for new line and CR
print(line.decode('utf-8'))
if (b"\nLog close:") in line: # If last read line is the prompt, end loop
break
tn.close()
def LteOperations():
global startname
tn = telnetlib.Telnet(HOST_LTE_OSS)
tn.read_until(b"login: ")
tn.write(user.encode('ascii') + b"\n")
if password:
tn.read_until(b"Password: ")
tn.write(password.encode('ascii') + b"\n")
def LteLoadScript():
global startname
tn = telnetlib.Telnet(HOST_LTE_OSS)
tn.read_until(b"login: ")
tn.write(user.encode('ascii') + b"\n")
if password:
tn.read_until(b"Password: ")
tn.write(password.encode('ascii') + b"\n")
def LteCabinet():
global startname
tn = telnetlib.Telnet(HOST_LTE_OSS)
tn.read_until(b"login: ")
tn.write(user.encode('ascii') + b"\n")
if password:
tn.read_until(b"Password: ")
tn.write(password.encode('ascii') + b"\n")
try:
tn.write(('amos %s "lt all; truni /home/%s/scripts/Create_Cab_4G.mo; cvms
configure_ok"\n'
% (lte_oam_arr[-1], user)).encode('ascii'))
tn.write(b"exit\n")
print(tn.read_all().decode('ascii'))
except:
print("Cabinet file Create_Cab_4G.mo for lte no found! Cabinet no
created!")
pass
try:
file = open("%s" % ipsites, "a+", )
file.write("%s %s rbs\n" % (startname, duw_ip_arr[-1]))
file.write("%s_LTE %s rbs\n" % (startname, lte_oam_arr[-1]))
except FileNotFoundError:
print("?? ?????? sitefiles ??? moshell")
pass
def em_start():
p = subprocess.Popen(cmd_em, stdout=subprocess.PIPE)
while True:
line = p.stdout.readline()
print(line)
if not line:
break
def inform():
global values
global startname
global location_rus, ura
global location
global duw_ip
global tcu_ip
global iub_ip
global lte_oam, lte_oam_gw, lte_s1, lte_s1_gw, lte_vlan_oam, lte_vlan_s1
global rnc_id, rnc_id_true
global rnc_ip
global rbs_id
global lac
global rac
global scramblingcode1
global scramblingcode2
global scramblingcode3
global scramblingcode4
global scramblingcode5
global scramblingcode6
global longitude
global latitude
global altitude
global rnc_label
global PLCellIdGroup1, PLSubCellId1,PLCellIdGroup2,
PLSubCellId2,PLCellIdGroup3, PLSubCellId3
rnc_config()
except:
print("Unexpected error:", sys.exc_info())
pass
def write_log():
try:
f = open("./logfile.txt", "a")
d = datetime.datetime.now()
f.write("%s %s %s \n" % (startname, startname, d))
f.close()
except:
print("logfile.txt ?? ??????")
pass
def write_PNR_LOG():
try:
today = date.today()
file = open("PNR_LOG.csv", "a", encoding='cp1251')
file.write("%s;%s;MS;%s;%s;250;20;%s;%s;%s;%s;%s\n" % (today, startname,
rnc_arr[-1], rnc_id_true, lac_arr[-1], cid1, usrlbl[0], cid1, rac ))
file.write("%s;%s;MS;%s;%s;250;20;%s;%s;%s;%s;%s\n" % (today, startname,
rnc_arr[-1], rnc_id_true, lac_arr[-1], cid2, usrlbl[1], cid2, rac ))
file.write("%s;%s;MS;%s;%s;250;20;%s;%s;%s;%s;%s\n" % (today, startname,
rnc_arr[-1], rnc_id_true, lac_arr[-1], cid3, usrlbl[2], cid3, rac ))
except:
print("??? ?????? PNR_LOG.csv ???????? ????? ?? ????????...")
file.write("log ?? ??????? ??? ?? %s" % startname)
pass
file.close()
# --------------------------------Main-
menu------------------------------------------------
def gui_menu():
def create_datalist2():
def chng_input(x):
global rnc_id
global rnc_label
global rnc_ip
global rac, ura
global rnc_id_true
startname_arr.append(x[0])
location_ru.append(x[1])
duw_ip_arr.append(x[2])
tcu_ip_arr.append(x[4])
iub_ip_arr.append(x[3])
scr1_arr.append(x[5])
scr2_arr.append(x[6])
scr3_arr.append(x[7])
scr4_arr.append(x[8])
scr5_arr.append(x[9])
scr6_arr.append(x[10])
rnc_arr.append(x[11])
lac_arr.append(x[12])
iub_id_arr.append(x[13])
ura_arr.append(x[14])
lte_oam_arr.append(x[15])
lte_oam_gw_arr.append(x[16])
lte_s1_arr.append(x[17])
lte_s1_gw_arr.append(x[18])
lte_vlan_oam_arr.append(x[19])
lte_vlan_s1_arr.append(x[20])
rnc_id = rnc_arr[-1] # at first equal rnc_id and new input rnc ID(lable)
rnc_config()
# ----------Action---------------------
print('??????????')
datalist2 = create_datalist2()
(fedit(datalist2, title="RBS Infromation",
comment="<b>???????? ?????? ??? ??????? ??????!</b>",
apply=chng_input))
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
window = uic.loadUi("CES_Window.ui") # type: <class 'PyQt4.QtGui.QWidget'>
duw = str(window.comboBox.currentText())
rus = str(window.comboBox_2.currentText())
retu = str(window.comboBox_3.currentText())
arr = []
for i in settings:
arr.append(i.rstrip().split())
HOST = arr[0][0].strip()
user = arr[1][0].strip()
password = arr[2][0].strip()
EM_path = arr[3][0].strip()
HOST2_name = arr[5][0].strip()
HOST_LTE_OSS = arr[7][0].strip()
HOST_LTE = arr[8][0].strip()
HOST_LTE_NAME = arr[9][0].strip()
try:
HOST2 = arr[4][0].strip()
except:
print("IP for MOMAS server not found in settings(in 5th string) Exit...")
time.sleep(5)
sys.exit()
try:
ipsites = arr[6][0].strip()
except:
print("Part to ipdabase file not found in settings(in 6th string). File
ipdatabase not to be writing")
time.sleep(5)
def tcu_chk():
if window.checkBox_7.isChecked():
global input_tcu, tcu
input_tcu = [True]
tcu = "TCU OK"
else:
input_tcu = [False]
tcu = "NO TCU"
def initial():
print("?????????? ? ??")
startname = (window.lineEdit.text()).upper()
window.plainTextEdit.appendPlainText(startname)
input_name.append(startname)
inform()
window.plainTextEdit.appendPlainText("?????????? ? ??...")
gui_menu()
def script_gen():
tcu_chk()
print("??????? ???????...")
print(rnc_label, duw_ip_arr[-1], duw, retu, rus, tcu)
window.plainTextEdit.appendPlainText("%s %s %s %s %s %s" %
(rnc_label, duw_ip_arr[-1], duw, retu,
rus, tcu))
inp(), new_dir(),
NE_Site_create(), NE_RBS_create(), NE_TCU_create(), NE_ERBS_create()
RBS_side_conf(), RNC_side_conf(),EM_data()
CreateEricssonSite()
if window.checkBox.isChecked():
CreateEricssonSite_LTE()
ftp_ses()
write_PNR_LOG()
print("??????? ???????")
window.plainTextEdit.appendPlainText("??????? ??????? ??? %s" % startname)
def full_conf():
tcu_chk()
global startname, duw, rus, retu, tcu
inp(), new_dir(),
NE_Site_create(), NE_RBS_create(), NE_TCU_create(), NE_ERBS_create()
CreateEricssonSite(),
#CreateEricssonSite_LTE()
print("??????? ???????")
time.sleep(3)
RBS_side_conf(), RNC_side_conf(), EM_data(), write_log(), write_PNR_LOG(),
ftp_ses(),
print("??????? ??????????? ??")
RbsOperations(),
time.sleep(3)
print("?? ????????????????, ??????? ??????????? RNC")
RncOperations(),
time.sleep(3)
#em_start()
teln_ses()
print("?? ?????????")
window.plainTextEdit.appendPlainText("?? %s ?????????" % startname)
def rbs_conf():
print("?????????? ??...")
inp()
if window.checkBox.isChecked():
LteOperations(), LteCabinet()
print("LTE ?????????")
window.plainTextEdit.appendPlainText("LTE %s ?????????" % startname)
else:
RbsOperations()
print("RBS ?????????")
window.plainTextEdit.appendPlainText("RBS %s ?????????" % startname)
def rnc_conf():
print("?????????? RNC...")
inp(), RncOperations()
print("RNC ????????")
window.plainTextEdit.appendPlainText("?? %s ?? RNC %s ????????" %
(startname, rnc_label))
def oss_conf():
print("??????????? ?? OSS")
tcu_chk()
inp()
if window.checkBox.isChecked():
teln_ses_lte()
print("LTE ?? OSS ?????????")
window.plainTextEdit.appendPlainText("%s ?? OSS ?????????" % startname)
else:
teln_ses()
print("?? ?? OSS ?????????")
window.plainTextEdit.appendPlainText("%s ?? OSS ?????????" % startname)
def fing_get():
print("???????? fingerprint...")
tn = telnetlib.Telnet(HOST)
tn.read_until(b"login: ")
tn.write(user.encode('ascii') + b"\n")
if password:
tn.read_until(b"Password: ")
tn.write(password.encode('ascii') + b"\n")
tn.write(("amos %s 'lt all; get Licensing=1 fingerprint; al'"
% duw_ip_arr[-1]).encode('ascii') + b"\n")
tn.read_until(b"@rnduas1>")
tn.write(b"exit\n")
out_fing = tn.read_all().decode('ascii')
raw_fing = re.findall("fingerprint .*", out_fing)
true_fing = raw_fing[0].split()[1]
print(tn.read_all().decode('ascii'))
window.plainTextEdit.appendPlainText("%s" % true_fing)
def rdb():
global enter_value, rdb_bs_name
print("?????? RDB")
enter_value = '00'+startname[2:6]
rdb_bs_name = startname[0:2]+enter_value
link = driver.find_element_by_link_text(rdb_bs_name)
link.click()
link2 = driver.find_element_by_partial_link_text(rdb_bs_name)
link2.click()
link3 = driver.find_element_by_link_text("3g")
link3.click()
link_form = driver.current_url
driver = webdriver.Chrome('.\chromedriver.exe')
driver.get("http://rdb.tele2.ru/")
assert "?????" in driver.title
elem = driver.find_element_by_id("p_body_ListSearch_listSearchBox")
elem.send_keys(enter_value)
elem.send_keys(Keys.RETURN)
link = driver.find_element_by_link_text(rdb_bs_name)
link.click()
link2 = driver.find_element_by_partial_link_text(rdb_bs_name)
link2.click()
link_form = driver.current_url
t1 = threading.Thread(target=ustanovka)
t2 = threading.Thread(target=got_zapusk)
t1.start()
t2.start()
def chng_ip():
print("?????? IUB IP ?? ?????(%s) ?? RNC..." % iub_ip_arr[-1])
global startname
tn = telnetlib.Telnet(HOST)
tn.read_until(b"login: ")
tn.write(user.encode('ascii') + b"\n")
if password:
tn.read_until(b"Password: ")
tn.write(password.encode('ascii') + b"\n")
QtCore.QObject.connect(window.pushButton_4, QtCore.SIGNAL("clicked()"),
initial)
QtCore.QObject.connect(window.pushButton_6, QtCore.SIGNAL("clicked()"),
script_gen)
QtCore.QObject.connect(window.pushButton_2, QtCore.SIGNAL("clicked()"),
rbs_conf)
QtCore.QObject.connect(window.pushButton, QtCore.SIGNAL("clicked()"), rnc_conf)
QtCore.QObject.connect(window.pushButton_5, QtCore.SIGNAL("clicked()"),
oss_conf)
QtCore.QObject.connect(window.pushButton_8, QtCore.SIGNAL("clicked()"),
fing_get)
QtCore.QObject.connect(window.pushButton_3, QtCore.SIGNAL("clicked()"),
full_conf)
QtCore.QObject.connect(window.pushButton_10, QtCore.SIGNAL("clicked()"),
em_start)
QtCore.QObject.connect(window.pushButton_11, QtCore.SIGNAL("clicked()"), rdb)
QtCore.QObject.connect(window.pushButton_12, QtCore.SIGNAL("clicked()"),
chng_ip)
QtCore.QObject.connect(window.pushButton_9, QtCore.SIGNAL("clicked()"),
QtGui.qApp.quit)
window.show()
sys.exit(app.exec_())