# Path: ravel/log.py
# LEVELS = { "debug" : logging.DEBUG,
#            "info" : logging.INFO,
#            "warning" : logging.WARNING,
#            "error" : logging.ERROR,
#            "critical" : logging.CRITICAL
#        }
# DEFAULT_LEVEL = logging.ERROR
# MSG_FORMAT = "%(levelname)s:%(funcName)s: %(message)s"
# class Singleton(type):
# class RavelLogger(Logger, object):
#     def __init__(cls, name, bases, dict_):
#     def __call__(cls, *args, **kw):
#     def __init__(self):
#     def setLogLevel(self, levelname=None):


from igraph import Graph
from ravel.log import logger
import os, sys
            return

        for line in nodeFile:
            for word in line.split():
                try:
                    nodeMp[int(word)] = 's{0}'.format(word)
                    nodeNmLst.append('s{0}'.format(word))
                except Exception, e:
                    logger.error("Unable to parse node number '{0}': ".format(word))
                    return
                break 

        for line in edgeFile:
            line=line.rstrip()
            words = line.split()
            if len(words) != 2:
                logger.error("Unrecognized format of edges file!")
                raise Exception
            try:
                if int(words[0]) not in nodeMp.keys():
                    logger.error("An edge connects to a nonexist switch {0} that is not exist!".format(words[0]))
                    raise Exception
                if int(words[1]) not in nodeMp.keys():
                    logger.error("An edge connects to a nonexist switch {0} that is not exist!".format(words[1]))
                    raise Exception
                if int(words[0]) != int(words[1]):
                    if ((int(words[0]), int(words[1])) not in link) and ((int(words[1]), int(words[0])) not in link):
                        #Edges in the edge file are unidirectional, but Ravel takes link in the topology as bidirectional. So, only one link is added for every edge.
                        link.append((int(words[0]), int(words[1])))
            except ValueError, e:

# Path: ravel/log.py
# LEVELS = { "debug" : logging.DEBUG,
#            "info" : logging.INFO,
#            "warning" : logging.WARNING,
#            "error" : logging.ERROR,
#            "critical" : logging.CRITICAL
#        }
# DEFAULT_LEVEL = logging.ERROR
# MSG_FORMAT = "%(levelname)s:%(funcName)s: %(message)s"
# class Singleton(type):
# class RavelLogger(Logger, object):
#     def __init__(cls, name, bases, dict_):
#     def __call__(cls, *args, **kw):
#     def __init__(self):
#     def setLogLevel(self, levelname=None):


# Path: topo/topolib.py
from igraph import Graph
from ravel.log import logger
import os, sys

            return

        for line in nodeFile:
            for word in line.split():
                try:
                    nodeMp[int(word)] = 's{0}'.format(word)
                    nodeNmLst.append('s{0}'.format(word))
                except Exception, e:
                    logger.error("Unable to parse node number '{0}': ".format(word))
                    return
                break 

        for line in edgeFile:
            line=line.rstrip()
            words = line.split()
            if len(words) != 2:
                logger.error("Unrecognized format of edges file!")
                raise Exception
            try:
                if int(words[0]) not in nodeMp.keys():
                    logger.error("An edge connects to a nonexist switch {0} that is not exist!".format(words[0]))
                    raise Exception
                if int(words[1]) not in nodeMp.keys():
                    logger.error("An edge connects to a nonexist switch {0} that is not exist!".format(words[1]))
                    raise Exception
                if int(words[0]) != int(words[1]):
                    if ((int(words[0]), int(words[1])) not in link) and ((int(words[1]), int(words[0])) not in link):
                        #Edges in the edge file are unidirectional, but Ravel takes link in the topology as bidirectional. So, only one link is added for every edge.
                        link.append((int(words[0]), int(words[1])))
            except ValueError, e:

                logger.error("Unable to parse edge from switch '{0}' to switch '{1}'".format(words[0],words[1]))