Ejemplo n.º 1
0
def main(argv=None):
    # Parameter
    options = libTopology.Parameter(argv)
    options.check()
    
    log = libTopology.logC()
    
    cfg = config([options.netcfg, options.topocfg], options)
    cfg.eval()
    
    db = dbCon.dbCon(options)
    cDB = libTopology.cacheDB(options, cfg, db, log,"/tmp/topology.db")
    
    cDB.init()
    ## Los gehts
    G = graph(cDB)
    G.evalSystems()

    topo = libTopology.myTopo(cDB,options,cfg,log)
    topo.create(31)
    cDB.bkpDat()
    print "Ausstieg nach topo.create(None)"
    sys.exit()
    topo.fixPositions()
    topo.create(None)
    topo.svg()
    
    cDB.bkpDat()
Ejemplo n.º 2
0
def eval_topo(options, db, cfg, log):
    #if False:
    if True:
        try:
            os.remove("/tmp/topology.db")
        except:
            pass
        cDB = libTopology.cacheDB(options, cfg, db, log, "/tmp/topology.db")
    else:
        cDB = libTopology.cacheDB(options, cfg, db, log)

    rDB = dbCon.dbCon(options)

    cDB.init()
    ## Los gehts
    G = graph(cDB, options)
    G.evalSystems()

    cDB.bkpDat()

    topo = libTopology.myTopo(rDB, cDB, options, cfg, log)
    topo.create()
    topo.fixPositions()

    cDB.bkpDat()
Ejemplo n.º 3
0
def main(argv=None):
    options = libTopology.Parameter(argv)
    options.check()

    rDB = dbCon.dbCon(options)

    while True:
        if os.path.exists('/tmp/parse_ibnetdiscover.lock'):
            time.sleep(1)
            print "Lockfile exists"
            continue
        cfg = config([options.cfgfile, ], options)
        cfg.eval()
        log = libTopology.logC("/var/log/create_netgraph.log")
        if os.path.exists('/tmp/parse_ibnetdiscover.lock'):
            time.sleep(1)
            print "Lockfile exists"
            continue
        try:
            create(options, rDB, cfg, log)
        except IOError, e:
            print "Creation failed, I guess it overlaps with parse_ibnetdiscover"
            print e
            time.sleep(2)
            continue
        else:
            dump_log(rDB)

        if not options.loop:
            break
        time.sleep(int(options.loop_delay))
Ejemplo n.º 4
0
def main(argv=None):
    options = libTopology.Parameter(argv)
    options.check()

    db = dbCon.dbCon(options)

    cfg = libTopology.config([options.cfgfile, ], options)
    cfg.eval()
    log = libTopology.logC(options, "/var/log/uptopo.log")
    eval_topo(options, db, cfg, log)
Ejemplo n.º 5
0
def gui(qnib, opt):
    from qnib_control import logC, log_entry
    logE = log_entry("Exec create_netgraph")
    qnib.addLog(logE)

    cfg = libTopology.config([opt.cfgfile, ], opt)
    cfg.eval()
    log = logC(opt, qnib)
    db = dbCon.dbCon(opt)
    create(opt, db, cfg, log)

    logE.set_status(log.get_status())
    qnib.refresh_log()
Ejemplo n.º 6
0
def main(argv=None):
    opt = MYparameter(argv)
    opt.check()
    
    while True:
        datab = dbCon.dbCon(opt)
        interval = 10
        count_res = 1
        while count_res > 0:
            count_res = update_perf(opt, datab, interval)
        count_res = 1
        while count_res > 0:
            count_res = update_err(opt, datab, interval)
        if not opt.loop:
            break
        time.sleep(int(opt.loop_delay))
Ejemplo n.º 7
0
def main():
    """ get all links and creates graph """
    opt = Parameter()
    dbcon = dbCon.dbCon(opt)
    q_net = QnibNetworkx()

    links = dbcon.getLinkList()
    while True:
        if len(links) == 0:
            break
        link = links.pop()
        (src, edge, dst) = split_link(link)

        if not q_net.is_in(src):
            q_net.add_node(src)
        if not q_net.is_in(dst):
            q_net.add_node(dst)
        q_net.add_edge(src, edge, dst)
    if opt.pickle:
        q_net.pickle_ibgraph(opt.picklefile)
        q_net.pickle_swgraph(opt.picklefile)
Ejemplo n.º 8
0
def main(argv=None):
    opt = MYparameter(argv)

    datab = dbCon.dbCon(opt)

    while True:
        query = """SELECT DISTINCT n_name, p_ext
                FROM ports NATURAL JOIN nodes
                ORDER BY n_name,p_ext;"""
        res = datab.sel(query)
        data = {}
        for row in res:
            (n_name, p_ext) = row
            if n_name not in data.keys():
                data[n_name] = []
            data[n_name].append(p_ext)
        
        for node, ports in data.items():
            my_rrd = rrd.RRD(node)
            my_rrd.html5(15)
        if not opt.loop:
            break
        time.sleep(int(opt.loop_delay))