Esempio n. 1
0
def main():
    phys_ports, name, cli = handle_args()
    if not cli:
        fibbingnode.log_to_file('%s.log' % name)
    mngr = FibbingManager(name)

    def sig_handler(sig, frame):
        mngr.cleanup()
        fibbingnode.EXIT.set()
        sys.exit()

    signal.signal(signal.SIGINT, sig_handler)
    signal.signal(signal.SIGTERM, sig_handler)

    try:
        mngr.start(phys_ports=phys_ports)
        if cli:
            cli = FibbingCLI(mngr=mngr)
            cli.cmdloop()
            fibbingnode.EXIT.set()
    except Exception as e:
        log.exception(e)
        fibbingnode.EXIT.set()
    finally:
        fibbingnode.EXIT.wait()
        mngr.cleanup()
Esempio n. 2
0
def main(_CLI=FibbingCLI):
    phys_ports, name, cli = handle_args()
    if not cli:
        fibbingnode.log_to_file('%s.log' % name)
    mngr = FibbingManager(name)

    def sig_handler(sig, frame):
        mngr.cleanup()
        fibbingnode.EXIT.set()
        sys.exit()

    signal.signal(signal.SIGINT, sig_handler)
    signal.signal(signal.SIGTERM, sig_handler)

    try:
        mngr.start(phys_ports=phys_ports)
        if cli:
            cli = _CLI(mngr=mngr)
            cli.cmdloop()
            fibbingnode.EXIT.set()
    except Exception as e:
        log.exception(e)
        fibbingnode.EXIT.set()
    finally:
        fibbingnode.EXIT.wait()
        mngr.cleanup()
Esempio n. 3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest

import networkx as nx

import fibbingnode.algorithms.cross_optimizer as crossopt
import fibbingnode.algorithms.merger as merger
import fibbingnode.algorithms.utils as ssu
import fibbingnode as fibbing

from test_merger import MergerTestCase

log = fibbing.log
fibbing.log_to_file("test_crossopt.log", "w")

#
# Useful tip to selectively disable test: @unittest.skip('reason')
#


def check_fwd_dags(fwd_req, topo, lsas, solver):
    correct = True
    topo = topo.copy()
    # Check that the topology/dag contain the destinations, otherwise add it
    for dest, dag in fwd_req.iteritems():
        dest_in_dag = dest in dag
        dest_in_graph = dest in topo
        if not dest_in_dag or not dest_in_graph:
            if not dest_in_dag:
                sinks = ssu.find_sink(dag)
Esempio n. 4
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest

import networkx as nx

import fibbingnode.algorithms.cross_optimizer as crossopt
import fibbingnode.algorithms.merger as merger
import fibbingnode.algorithms.utils as ssu
import fibbingnode as fibbing

from test_merger import MergerTestCase

log = fibbing.log
fibbing.log_to_file('test_crossopt.log', 'w')

#
# Useful tip to selectively disable test: @unittest.skip('reason')
#


def check_fwd_dags(fwd_req, topo, lsas, solver):
    correct = True
    topo = topo.copy()
    # Check that the topology/dag contain the destinations, otherwise add it
    for dest, dag in fwd_req.iteritems():
        dest_in_dag = dest in dag
        dest_in_graph = dest in topo
        if not dest_in_dag or not dest_in_graph:
            if not dest_in_dag:
                sinks = ssu.find_sink(dag)