コード例 #1
0
ファイル: rfproxy.py プロジェクト: chenkaigithub/RouteFlow
def launch():
    core.openflow.addListenerByName("ConnectionUp", on_datapath_up)
    core.openflow.addListenerByName("ConnectionDown", on_datapath_down)
    core.openflow.addListenerByName("PacketIn", on_packet_in)
    ipc.listen(RFSERVER_RFPROXY_CHANNEL, RFProtocolFactory(), RFProcessor(),
               False)
    log.info("RFProxy running.")
コード例 #2
0
    def __init__(self, *args, **kwargs):
        super(RFProxy, self).__init__(*args, **kwargs)

        ID = 0
        self.ipc = MongoIPC.MongoIPCMessageService(MONGO_ADDRESS,
                                                   MONGO_DB_NAME, str(ID),
                                                   hub_thread_wrapper,
                                                   hub.sleep)
        self.ipc.listen(RFSERVER_RFPROXY_CHANNEL, RFProtocolFactory(),
                        RFProcessor(), False)
        log.info("RFProxy running.")
コード例 #3
0
ファイル: rfproxy.py プロジェクト: vdham/ryu-rfproxy
    def __init__(self, *args, **kwargs):
        super(RFProxy, self).__init__(*args, **kwargs)

        self.ID = 0
        self.table = Table()
        self.switches = kwargs['switches']
        self.rfprocess = RFProcessor(self.switches, self.table)

        self.ipc = IPCService.for_proxy(str(self.ID), HubThreading)
        self.ipc.listen(RFSERVER_RFPROXY_CHANNEL, RFProtocolFactory(),
                        self.rfprocess, False)
        log.info("RFProxy running.")
コード例 #4
0
ファイル: rfdb.py プロジェクト: dewanggaputra/uwu

def usage():
    print('Usage: %s <channel>\n' % sys.argv[0])
    print('channel: "rfclient" or "rfproxy"')
    sys.exit(1)


def parse_args(args=sys.argv):
    if (len(sys.argv) < 2):
        return None
    if (args[1] == 'rfclient'):
        return defs.RFCLIENT_RFSERVER_CHANNEL
    if (args[1] == 'rfproxy'):
        return defs.RFSERVER_RFPROXY_CHANNEL
    return None


if __name__ == '__main__':
    connection = pymongo.Connection('localhost', 27017)
    db = connection[defs.MONGO_DB_NAME]
    channel = parse_args()

    if (channel == None):
        usage()

    factory = RFProtocolFactory()
    for entry in db[channel].find():
        msg = MongoIPC.take_from_envelope(entry, factory)
        print(msg)