Example #1
0
def deploy():
    options,i = get_command()
    server_list = load_server_info(server_cfg)
    if i == 0:
        if check_pkg_exist(options.pkg):
            for nodetype,server_info in server_list.items():
                host = server_info.get("ip")
                username = server_info.get("username")
                password = server_info.get("password")
                if nodetype in  ('IMSHSS','LTEHSS','MSC','HLR','3GSGSN','GGSN'):
                    engineid = server_info.get("engineid")
                    if engineid == None:
                        logger.error("engineId not configured for " + nodetype)              

                SftpInstance = SftpSim(host,username,password,logger,180,50000)
                SftpInstance.start()
                SftpInstance.upload_file(options.pkg,options.dest)
                SftpInstance.close()
                SshInstall = SshPexpect(host,username,password,logger,180,50000)
Example #2
0
if not os.path.isfile(tool_from_path):
    logger.error("can't find the tool in the specified path ")

if not os.path.exists(tool_install_path):
    os.makedirs(tool_install_path)

if tool_type.lower() not in ('pmgen','zacademy','test_tool'):
    logger.error("the input tool not supported. The supported tool is zacademy,pmgen and test_tool.")

def load_server_info(server_info):
    pass

server_cfg = os.path.normpath(os.path.dirname(os.path.abspath(__file__))).split('sbin')[0] + "config" + os.sep + 'deploy_tools' + os.sep + "server_list.cfg"
server_dict = load_server_info(server_cfg)


for type,server_info in server_dict.items():
    host = server_info.get("ip")
    username = server_info.get("username")
    password = server_info.get("password")
    if type in ('IMSHSS','LTEHSS','MSC','HLR','3GSGSN','GGSN'):
        engineid = server_info.get("engineid")
       
    
    SftpInstance = SftpSim(host,username,password,logger,180,50000)
    SftpInstance.start()
    SftpInstance.upload_file(tool_pkg,install_path)
    SftpInstance.close()