# 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: ravel/of.py
# OFPP_FLOOD = 65531
# 
# OFPFC_ADD = 0
# 
# OFPFC_DELETE = 3
# 
# OFPFC_DELETE_STRICT = 4


import os
import pickle
import threading
import time
import xmlrpclib
import sysv_ipc
import ravel.profiling
from SimpleXMLRPCServer import SimpleXMLRPCServer
from ravel.log import logger
from ravel.of import OFPP_FLOOD, OFPFC_ADD, OFPFC_DELETE, OFPFC_DELETE_STRICT
        """Send the specified OpenFlow message
           msg: the message to send"""

        # don't need to handle barrier messages
        if not hasattr(msg, 'command'):
            return

        pc = ravel.profiling.PerfCounter("ovs_send")
        pc.start()

        subcmd = OvsSender.subcmds[msg.command]

        # TODO: this is different for remote switches (ie, on physical network)
        dest = msg.switch.name

        params = []
        if msg.match.nw_src is not None:
            params.append("nw_src={0}".format(msg.match.nw_src))
        if msg.match.nw_dst is not None:
            params.append("nw_dst={0}".format(msg.match.nw_dst))
        if msg.match.dl_src is not None:
            params.append("dl_src={0}".format(msg.match.dl_src))
        if msg.match.dl_dst is not None:
            params.append("dl_dst={0}".format(msg.match.dl_dst))
        if msg.match.dl_type is not None:
            params.append("dl_type={0}".format(msg.match.dl_type))

        params.append("priority={0}".format(msg.priority))
        actions = ["flood" if a == OFPP_FLOOD else str(a) for a in msg.actions]


# 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: ravel/of.py
# OFPP_FLOOD = 65531
# 
# OFPFC_ADD = 0
# 
# OFPFC_DELETE = 3
# 
# OFPFC_DELETE_STRICT = 4


# Path: ravel/messaging.py
import os
import pickle
import threading
import time
import xmlrpclib
import sysv_ipc
import ravel.profiling
from SimpleXMLRPCServer import SimpleXMLRPCServer
from ravel.log import logger
from ravel.of import OFPP_FLOOD, OFPFC_ADD, OFPFC_DELETE, OFPFC_DELETE_STRICT

        """Send the specified OpenFlow message
           msg: the message to send"""

        # don't need to handle barrier messages
        if not hasattr(msg, 'command'):
            return

        pc = ravel.profiling.PerfCounter("ovs_send")
        pc.start()

        subcmd = OvsSender.subcmds[msg.command]

        # TODO: this is different for remote switches (ie, on physical network)
        dest = msg.switch.name

        params = []
        if msg.match.nw_src is not None:
            params.append("nw_src={0}".format(msg.match.nw_src))
        if msg.match.nw_dst is not None:
            params.append("nw_dst={0}".format(msg.match.nw_dst))
        if msg.match.dl_src is not None:
            params.append("dl_src={0}".format(msg.match.dl_src))
        if msg.match.dl_dst is not None:
            params.append("dl_dst={0}".format(msg.match.dl_dst))
        if msg.match.dl_type is not None:
            params.append("dl_type={0}".format(msg.match.dl_type))

        params.append("priority={0}".format(msg.priority))
        actions = ["flood" if a == OFPP_FLOOD else str(a) for a in msg.actions]


        if msg.command == OFPFC_ADD: